]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge current mainline tree into linux-omap tree
authorTony Lindgren <tony@atomide.com>
Mon, 9 Feb 2009 21:05:28 +0000 (13:05 -0800)
committerTony Lindgren <tony@atomide.com>
Mon, 9 Feb 2009 21:05:28 +0000 (13:05 -0800)
Merge branches 'master' and 'linus'

Conflicts:

arch/arm/mach-omap2/irq.c
arch/arm/plat-omap/devices.c
arch/arm/plat-omap/dma.c

711 files changed:
.mailmap
Documentation/Changes
Documentation/CodingStyle
Documentation/DMA-API.txt
Documentation/DocBook/uio-howto.tmpl
Documentation/IO-mapping.txt
Documentation/block/biodoc.txt
Documentation/block/queue-sysfs.txt [new file with mode: 0644]
Documentation/cgroups/memcg_test.txt
Documentation/cpu-freq/user-guide.txt
Documentation/filesystems/proc.txt
Documentation/filesystems/sysfs-pci.txt
Documentation/filesystems/ubifs.txt
Documentation/ja_JP/stable_kernel_rules.txt
Documentation/lguest/Makefile
Documentation/networking/alias.txt
Documentation/powerpc/dts-bindings/fsl/mpc5200.txt [new file with mode: 0644]
Documentation/powerpc/mpc52xx-device-tree-bindings.txt [deleted file]
Documentation/usb/dma.txt
Documentation/video4linux/v4lgrab.c
MAINTAINERS
Makefile
arch/alpha/Kconfig
arch/alpha/include/asm/bug.h
arch/alpha/include/asm/dma-mapping.h
arch/alpha/kernel/entry.S
arch/alpha/kernel/osf_sys.c
arch/alpha/kernel/pci-noop.c
arch/alpha/kernel/signal.c
arch/alpha/kernel/smp.c
arch/alpha/kernel/systbls.S
arch/arm/kernel/entry-armv.S
arch/arm/kernel/entry-common.S
arch/arm/kernel/irq.c
arch/arm/mach-msm/board-halibut.c
arch/arm/mach-omap1/devices.c
arch/arm/mach-omap2/devices.c
arch/arm/mach-omap2/irq.c
arch/arm/mach-sa1100/generic.c
arch/arm/mm/fault-armv.c
arch/arm/plat-mxc/include/mach/mmc.h [new file with mode: 0644]
arch/arm/plat-omap/devices.c
arch/arm/plat-omap/include/mach/mmc.h
arch/blackfin/Kconfig
arch/blackfin/Makefile
arch/blackfin/configs/BF518F-EZBRD_defconfig
arch/blackfin/configs/BF526-EZBRD_defconfig
arch/blackfin/configs/BF527-EZKIT_defconfig
arch/blackfin/configs/BF533-EZKIT_defconfig
arch/blackfin/configs/BF533-STAMP_defconfig
arch/blackfin/configs/BF537-STAMP_defconfig
arch/blackfin/configs/BF538-EZKIT_defconfig
arch/blackfin/configs/BF548-EZKIT_defconfig
arch/blackfin/configs/BF561-EZKIT_defconfig
arch/blackfin/configs/CM-BF527_defconfig
arch/blackfin/include/asm/checksum.h
arch/blackfin/include/asm/delay.h
arch/blackfin/include/asm/gpio.h
arch/blackfin/include/asm/kgdb.h
arch/blackfin/include/asm/mem_init.h
arch/blackfin/include/asm/pda.h
arch/blackfin/include/asm/reboot.h
arch/blackfin/kernel/Makefile
arch/blackfin/kernel/bfin_dma_5xx.c
arch/blackfin/kernel/bfin_gpio.c
arch/blackfin/kernel/cplb-mpu/cplbinit.c
arch/blackfin/kernel/cplb-nompu/cplbmgr.c
arch/blackfin/kernel/irqchip.c
arch/blackfin/kernel/reboot.c
arch/blackfin/kernel/setup.c
arch/blackfin/kernel/traps.c
arch/blackfin/mach-bf518/boards/ezbrd.c
arch/blackfin/mach-bf518/include/mach/portmux.h
arch/blackfin/mach-bf527/boards/cm_bf527.c
arch/blackfin/mach-bf527/boards/ezbrd.c
arch/blackfin/mach-bf527/boards/ezkit.c
arch/blackfin/mach-bf527/include/mach/portmux.h
arch/blackfin/mach-bf533/boards/blackstamp.c
arch/blackfin/mach-bf533/boards/stamp.c
arch/blackfin/mach-bf533/include/mach/portmux.h
arch/blackfin/mach-bf537/boards/cm_bf537.c
arch/blackfin/mach-bf537/boards/generic_board.c
arch/blackfin/mach-bf537/boards/minotaur.c
arch/blackfin/mach-bf537/boards/pnav10.c
arch/blackfin/mach-bf537/boards/stamp.c
arch/blackfin/mach-bf537/boards/tcm_bf537.c
arch/blackfin/mach-bf537/include/mach/portmux.h
arch/blackfin/mach-bf538/include/mach/portmux.h
arch/blackfin/mach-bf548/boards/ezkit.c
arch/blackfin/mach-bf548/include/mach/anomaly.h
arch/blackfin/mach-bf548/include/mach/bf548.h
arch/blackfin/mach-bf548/include/mach/gpio.h
arch/blackfin/mach-bf548/include/mach/portmux.h
arch/blackfin/mach-bf561/include/mach/defBF561.h
arch/blackfin/mach-bf561/include/mach/portmux.h
arch/blackfin/mach-common/clocks-init.c
arch/blackfin/mach-common/entry.S
arch/blackfin/mach-common/head.S
arch/blackfin/mach-common/interrupt.S
arch/blackfin/mach-common/ints-priority.c
arch/blackfin/mach-common/pm.c
arch/ia64/hp/common/sba_iommu.c
arch/ia64/sn/kernel/io_acpi_init.c
arch/ia64/sn/kernel/io_init.c
arch/mips/Kconfig
arch/mips/alchemy/common/time.c
arch/mips/cavium-octeon/setup.c
arch/mips/configs/ip27_defconfig
arch/mips/include/asm/atomic.h
arch/mips/include/asm/mach-rc32434/gpio.h
arch/mips/include/asm/mach-rc32434/irq.h
arch/mips/include/asm/mach-rc32434/rb.h
arch/mips/include/asm/ptrace.h
arch/mips/include/asm/termios.h
arch/mips/include/asm/txx9/tx4939.h
arch/mips/kernel/genex.S
arch/mips/kernel/mips-mt-fpaff.c
arch/mips/kernel/traps.c
arch/mips/lib/memcpy-inatomic.S
arch/mips/lib/memcpy.S
arch/mips/mm/c-r4k.c
arch/mips/mm/fault.c
arch/mips/pci/pci-rc32434.c
arch/mips/rb532/devices.c
arch/mips/rb532/gpio.c
arch/mips/rb532/irq.c
arch/mips/rb532/serial.c
arch/mips/txx9/generic/setup_tx4939.c
arch/mips/txx9/rbtx4939/setup.c
arch/parisc/include/asm/dma-mapping.h
arch/parisc/kernel/pci-dma.c
arch/powerpc/configs/52xx/cm5200_defconfig
arch/powerpc/configs/52xx/lite5200b_defconfig
arch/powerpc/configs/52xx/motionpro_defconfig
arch/powerpc/configs/52xx/pcm030_defconfig
arch/powerpc/configs/52xx/tqm5200_defconfig
arch/powerpc/configs/mpc5200_defconfig
arch/powerpc/kernel/pci-common.c
arch/powerpc/platforms/52xx/mpc52xx_pci.c
arch/sh/boards/board-ap325rxa.c
arch/sh/configs/ap325rxa_defconfig
arch/sh/configs/migor_defconfig
arch/sh/include/asm/mutex-llsc.h
arch/sh/include/asm/syscall_32.h
arch/sh/include/asm/syscall_64.h
arch/sh/kernel/cpu/sh4/fpu.c
arch/sh/kernel/setup.c
arch/sh/kernel/signal_32.c
arch/sh/kernel/signal_64.c
arch/sh/lib/checksum.S
arch/sparc/include/asm/cpudata_64.h
arch/sparc/include/asm/irq_64.h
arch/sparc/include/asm/kdebug_64.h
arch/sparc/include/asm/nmi.h [new file with mode: 0644]
arch/sparc/include/asm/pcr.h [new file with mode: 0644]
arch/sparc/include/asm/pil.h
arch/sparc/kernel/Makefile
arch/sparc/kernel/cpu.c
arch/sparc/kernel/irq_64.c
arch/sparc/kernel/kernel.h
arch/sparc/kernel/nmi.c [new file with mode: 0644]
arch/sparc/kernel/pcr.c [new file with mode: 0644]
arch/sparc/kernel/process_64.c
arch/sparc/kernel/setup_64.c
arch/sparc/kernel/ttable.S
arch/sparc/mm/fault_64.c
arch/sparc/oprofile/init.c
arch/x86/boot/video-vesa.c
arch/x86/ia32/ia32entry.S
arch/x86/include/asm/dma-mapping.h
arch/x86/include/asm/e820.h
arch/x86/include/asm/kvm.h
arch/x86/include/asm/mce.h
arch/x86/include/asm/mtrr.h
arch/x86/include/asm/ptrace-abi.h
arch/x86/include/asm/sigcontext.h
arch/x86/include/asm/sigcontext32.h
arch/x86/include/asm/swab.h
arch/x86/kernel/acpi/sleep.c
arch/x86/kernel/apic.c
arch/x86/kernel/cpu/cpufreq/Kconfig
arch/x86/kernel/cpu/intel.c
arch/x86/kernel/cpu/intel_cacheinfo.c
arch/x86/kernel/cpu/mtrr/main.c
arch/x86/kernel/ds.c
arch/x86/kernel/entry_64.S
arch/x86/kernel/io_apic.c
arch/x86/kernel/irqinit_32.c
arch/x86/kernel/pci-gart_64.c
arch/x86/lguest/boot.c
arch/x86/mach-default/setup.c
arch/x86/mach-voyager/setup.c
arch/x86/mach-voyager/voyager_smp.c
arch/x86/mm/fault.c
arch/x86/pci/irq.c
arch/x86/xen/multicalls.h
block/blk-barrier.c
block/blk-core.c
block/blk-integrity.c
block/blk-sysfs.c
block/blk.h
block/blktrace.c
block/cfq-iosched.c
drivers/acpi/Kconfig
drivers/acpi/acpica/tbutils.c
drivers/acpi/acpica/uteval.c
drivers/acpi/container.c
drivers/acpi/dock.c
drivers/acpi/ec.c
drivers/acpi/glue.c
drivers/acpi/osl.c
drivers/acpi/pci_link.c
drivers/acpi/processor_idle.c
drivers/acpi/processor_perflib.c
drivers/acpi/sleep.c
drivers/acpi/tables.c
drivers/acpi/video.c
drivers/ata/ahci.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-pmp.c
drivers/ata/libata-scsi.c
drivers/ata/libata.h
drivers/ata/pata_qdi.c
drivers/ata/sata_mv.c
drivers/ata/sata_nv.c
drivers/ata/sata_sil.c
drivers/base/core.c
drivers/char/Kconfig
drivers/char/selection.c
drivers/char/sx.c
drivers/dca/dca-core.c
drivers/firewire/fw-card.c
drivers/firewire/fw-device.c
drivers/firewire/fw-device.h
drivers/firewire/fw-ohci.c
drivers/firewire/fw-sbp2.c
drivers/firewire/fw-topology.c
drivers/firewire/fw-transaction.h
drivers/gpio/gpiolib.c
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/i915/intel_lvds.c
drivers/hid/hid-core.c
drivers/hid/hid-ids.h
drivers/hid/hid-microsoft.c
drivers/hid/usbhid/hiddev.c
drivers/hwmon/applesmc.c
drivers/hwmon/hp_accel.c
drivers/ide/Kconfig
drivers/ide/Makefile
drivers/ide/cs5536.c [new file with mode: 0644]
drivers/ide/icside.c
drivers/ide/ide-acpi.c
drivers/ide/ide-cd.c
drivers/ide/ide-io.c
drivers/ide/ide-probe.c
drivers/ide/qd65xx.c
drivers/ide/qd65xx.h
drivers/ide/tx4939ide.c
drivers/ide/via82cxxx.c
drivers/ieee1394/dv1394.c
drivers/ieee1394/ieee1394.h
drivers/ieee1394/ieee1394_core.c
drivers/ieee1394/ohci1394.h
drivers/ieee1394/sbp2.c
drivers/lguest/core.c
drivers/lguest/lguest_user.c
drivers/md/linear.c
drivers/md/md.c
drivers/md/raid1.c
drivers/media/common/saa7146_video.c
drivers/media/common/tuners/mxl5007t.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.h
drivers/media/dvb/dvb-usb/af9005-fe.c
drivers/media/dvb/dvb-usb/af9015.c
drivers/media/dvb/dvb-usb/dib0700_devices.c
drivers/media/dvb/dvb-usb/dvb-usb-ids.h
drivers/media/dvb/frontends/drx397xD.c
drivers/media/dvb/frontends/s5h1409.c
drivers/media/dvb/frontends/stb0899_algo.c
drivers/media/dvb/ttpci/budget.c
drivers/media/dvb/ttusb-dec/ttusb_dec.c
drivers/media/radio/radio-mr800.c
drivers/media/video/cs5345.c
drivers/media/video/cx23885/cx23885-417.c
drivers/media/video/cx23885/cx23885-video.c
drivers/media/video/cx25840/cx25840-core.c
drivers/media/video/cx88/cx88-dvb.c
drivers/media/video/cx88/cx88.h
drivers/media/video/em28xx/em28xx-audio.c
drivers/media/video/em28xx/em28xx-cards.c
drivers/media/video/em28xx/em28xx-core.c
drivers/media/video/em28xx/em28xx-dvb.c
drivers/media/video/em28xx/em28xx-video.c
drivers/media/video/em28xx/em28xx.h
drivers/media/video/gspca/gspca.c
drivers/media/video/ivtv/ivtv-driver.c
drivers/media/video/pwc/pwc-if.c
drivers/media/video/saa7127.c
drivers/media/video/saa7134/saa7134-alsa.c
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/saa717x.c
drivers/media/video/tda9875.c
drivers/media/video/tveeprom.c
drivers/media/video/tvp514x.c
drivers/media/video/upd64031a.c
drivers/media/video/upd64083.c
drivers/media/video/usbvision/usbvision-i2c.c
drivers/media/video/uvc/uvc_ctrl.c
drivers/media/video/uvc/uvc_driver.c
drivers/media/video/uvc/uvc_isight.c
drivers/media/video/uvc/uvc_queue.c
drivers/media/video/uvc/uvc_status.c
drivers/media/video/uvc/uvc_v4l2.c
drivers/media/video/uvc/uvc_video.c
drivers/media/video/uvc/uvcvideo.h
drivers/media/video/v4l2-subdev.c
drivers/media/video/zoran/zoran.h
drivers/media/video/zoran/zoran_card.c
drivers/media/video/zoran/zoran_card.h
drivers/media/video/zoran/zoran_driver.c
drivers/mfd/pcf50633-core.c
drivers/misc/Kconfig
drivers/misc/atmel-ssc.c
drivers/misc/hpilo.c
drivers/misc/hpilo.h
drivers/misc/sgi-xp/xpc.h
drivers/misc/sgi-xp/xpc_channel.c
drivers/misc/sgi-xp/xpc_sn2.c
drivers/misc/sgi-xp/xpc_uv.c
drivers/misc/sgi-xp/xpnet.c
drivers/mmc/host/Kconfig
drivers/mmc/host/Makefile
drivers/mmc/host/mmci.c
drivers/mmc/host/mmci.h
drivers/mmc/host/mxcmmc.c [new file with mode: 0644]
drivers/mmc/host/pxamci.c
drivers/mmc/host/ricoh_mmc.c
drivers/mtd/maps/sa1100-flash.c
drivers/mtd/ubi/Kconfig.debug
drivers/mtd/ubi/build.c
drivers/mtd/ubi/cdev.c
drivers/mtd/ubi/gluebi.c
drivers/mtd/ubi/scan.c
drivers/mtd/ubi/ubi.h
drivers/mtd/ubi/upd.c
drivers/mtd/ubi/vmt.c
drivers/net/arm/etherh.c
drivers/net/cassini.c
drivers/net/cxgb3/sge.c
drivers/net/e1000/e1000_main.c
drivers/net/gianfar.c
drivers/net/gianfar.h
drivers/net/gianfar_mii.c
drivers/net/ibm_newemac/phy.c
drivers/net/igb/e1000_82575.c
drivers/net/igb/igb.h
drivers/net/igb/igb_main.c
drivers/net/netxen/netxen_nic.h
drivers/net/netxen/netxen_nic_init.c
drivers/net/pcmcia/pcnet_cs.c
drivers/net/ps3_gelic_wireless.c
drivers/net/qlge/qlge.h
drivers/net/qlge/qlge_main.c
drivers/net/r6040.c
drivers/net/sfc/efx.c
drivers/net/sfc/efx.h
drivers/net/sfc/ethtool.c
drivers/net/sfc/falcon.c
drivers/net/sfc/mdio_10g.c
drivers/net/sfc/mdio_10g.h
drivers/net/sfc/net_driver.h
drivers/net/sfc/phy.h
drivers/net/sfc/selftest.c
drivers/net/sfc/sfe4001.c
drivers/net/sfc/tenxpress.c
drivers/net/sfc/workarounds.h
drivers/net/skfp/skfddi.c
drivers/net/sky2.c
drivers/net/smc911x.c
drivers/net/smsc911x.c
drivers/net/smsc9420.c
drivers/net/sungem.c
drivers/net/sungem_phy.c
drivers/net/sunqe.c
drivers/net/tsi108_eth.c
drivers/net/tulip/21142.c
drivers/net/tulip/de2104x.c
drivers/net/ucc_geth.c
drivers/net/ucc_geth.h
drivers/net/ucc_geth_mii.c
drivers/net/ucc_geth_mii.h
drivers/net/usb/hso.c
drivers/net/virtio_net.c
drivers/net/wimax/i2400m/debugfs.c
drivers/net/wimax/i2400m/driver.c
drivers/net/wireless/ath5k/base.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-sta.c
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
drivers/parisc/sba_iommu.c
drivers/pci/hotplug/Makefile
drivers/pci/hotplug/fakephp.c
drivers/pci/msi.c
drivers/pci/pci-driver.c
drivers/pci/pci-sysfs.c
drivers/pci/pci.c
drivers/pci/pcie/aspm.c
drivers/pci/pcie/portdrv_pci.c
drivers/pci/rom.c
drivers/platform/x86/Kconfig
drivers/platform/x86/asus-laptop.c
drivers/platform/x86/asus_acpi.c
drivers/platform/x86/eeepc-laptop.c
drivers/platform/x86/hp-wmi.c
drivers/platform/x86/panasonic-laptop.c
drivers/regulator/bq24022.c
drivers/regulator/wm8350-regulator.c
drivers/rtc/Kconfig
drivers/rtc/Makefile
drivers/rtc/rtc-dm355evm.c [new file with mode: 0644]
drivers/rtc/rtc-ds1390.c
drivers/serial/jsm/jsm_tty.c
drivers/staging/agnx/agnx.h
drivers/staging/altpciechdma/altpciechdma.c
drivers/staging/android/binder.c
drivers/staging/android/lowmemorykiller.txt [new file with mode: 0644]
drivers/staging/android/timed_gpio.c
drivers/staging/comedi/Kconfig
drivers/staging/meilhaus/Kconfig
drivers/staging/poch/poch.c
drivers/staging/usbip/usbip_common.c
drivers/usb/host/whci/asl.c
drivers/usb/host/whci/hw.c
drivers/usb/host/whci/pzl.c
drivers/usb/host/whci/whcd.h
drivers/usb/wusbcore/devconnect.c
drivers/usb/wusbcore/rh.c
drivers/uwb/allocator.c
drivers/uwb/drp.c
drivers/uwb/rsv.c
drivers/video/Kconfig
drivers/video/aty/aty128fb.c
drivers/video/aty/atyfb_base.c
drivers/video/aty/mach64_ct.c
drivers/video/aty/radeon_base.c
drivers/video/aty/radeon_pm.c
drivers/video/aty/radeonfb.h
drivers/video/backlight/Makefile
drivers/video/backlight/da903x_bl.c [moved from drivers/video/backlight/da903x.c with 100% similarity]
drivers/video/fbcmap.c
drivers/video/fbmem.c
drivers/virtio/virtio_pci.c
drivers/xen/balloon.c
fs/binfmt_elf.c
fs/bio-integrity.c
fs/btrfs/Kconfig
fs/btrfs/async-thread.c
fs/btrfs/compression.c
fs/btrfs/ctree.c
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/extent-tree.c
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/extent_map.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/locking.c
fs/btrfs/locking.h
fs/btrfs/ordered-data.c
fs/btrfs/ref-cache.c
fs/btrfs/ref-cache.h
fs/btrfs/super.c
fs/btrfs/transaction.c
fs/btrfs/tree-defrag.c
fs/btrfs/tree-log.c
fs/btrfs/volumes.c
fs/btrfs/xattr.c
fs/btrfs/xattr.h
fs/buffer.c
fs/cifs/CHANGES
fs/cifs/cifsencrypt.c
fs/cifs/cifsproto.h
fs/cifs/connect.c
fs/cifs/dir.c
fs/cifs/inode.c
fs/cifs/md5.c
fs/cifs/md5.h
fs/cifs/transport.c
fs/compat.c
fs/compat_ioctl.c
fs/ecryptfs/crypto.c
fs/eventpoll.c
fs/exec.c
fs/ext3/namei.c
fs/ext4/balloc.c
fs/ext4/ext4.h
fs/ext4/extents.c
fs/ext4/inode.c
fs/ext4/mballoc.c
fs/ext4/namei.c
fs/ext4/resize.c
fs/internal.h
fs/jbd2/journal.c
fs/ocfs2/alloc.c
fs/ocfs2/dcache.c
fs/ocfs2/dcache.h
fs/ocfs2/dlmglue.c
fs/ocfs2/ocfs2.h
fs/ocfs2/quota_global.c
fs/ocfs2/super.c
fs/ocfs2/xattr.c
fs/seq_file.c
fs/super.c
fs/ubifs/budget.c
fs/ubifs/debug.c
fs/ubifs/debug.h
fs/ubifs/dir.c
fs/ubifs/file.c
fs/ubifs/gc.c
fs/ubifs/io.c
fs/ubifs/journal.c
fs/ubifs/lprops.c
fs/ubifs/lpt_commit.c
fs/ubifs/master.c
fs/ubifs/orphan.c
fs/ubifs/super.c
fs/ubifs/tnc.c
fs/ubifs/ubifs.h
fs/xfs/linux-2.6/xfs_sync.c
fs/xfs/xfs_dfrag.c
fs/xfs/xfs_log_recover.c
include/acpi/pdc_intel.h
include/linux/Kbuild
include/linux/aio_abi.h
include/linux/async.h
include/linux/ata.h
include/linux/atalk.h
include/linux/atmbr2684.h
include/linux/auto_fs4.h
include/linux/bfs_fs.h
include/linux/bio.h
include/linux/blkdev.h
include/linux/blktrace_api.h
include/linux/can/bcm.h
include/linux/capability.h
include/linux/cdrom.h
include/linux/cgroup.h
include/linux/cgroupstats.h
include/linux/clockchips.h
include/linux/dlm_plock.h
include/linux/dn.h
include/linux/dvb/audio.h
include/linux/dvb/dmx.h
include/linux/dvb/frontend.h
include/linux/dvb/net.h
include/linux/dvb/video.h
include/linux/edd.h
include/linux/efs_fs_sb.h
include/linux/elf-fdpic.h
include/linux/elf.h
include/linux/errqueue.h
include/linux/fb.h
include/linux/genetlink.h
include/linux/gfs2_ondisk.h
include/linux/hid.h
include/linux/hiddev.h
include/linux/icmpv6.h
include/linux/if_addr.h
include/linux/if_addrlabel.h
include/linux/if_fc.h
include/linux/if_hippi.h
include/linux/if_link.h
include/linux/if_ppp.h
include/linux/if_strip.h
include/linux/if_tr.h
include/linux/if_tunnel.h
include/linux/igmp.h
include/linux/inet_diag.h
include/linux/ip6_tunnel.h
include/linux/ipv6.h
include/linux/ipv6_route.h
include/linux/ipx.h
include/linux/irda.h
include/linux/jbd2.h
include/linux/kernel.h
include/linux/kprobes.h
include/linux/libata.h
include/linux/minix_fs.h
include/linux/module.h
include/linux/msdos_fs.h
include/linux/neighbour.h
include/linux/netfilter/xt_conntrack.h
include/linux/nfs_idmap.h
include/linux/nfsd/export.h
include/linux/nfsd/nfsfh.h
include/linux/nfsd/syscall.h
include/linux/nubus.h
include/linux/pci.h
include/linux/pci_ids.h
include/linux/phonet.h
include/linux/pkt_cls.h
include/linux/pkt_sched.h
include/linux/ppp_defs.h
include/linux/raid/md_p.h
include/linux/random.h
include/linux/rtnetlink.h
include/linux/sched.h
include/linux/signalfd.h
include/linux/slab_def.h
include/linux/sound.h
include/linux/spi/spidev.h
include/linux/synclink.h
include/linux/syscalls.h
include/linux/taskstats.h
include/linux/tc_act/tc_gact.h
include/linux/tc_act/tc_mirred.h
include/linux/tc_act/tc_pedit.h
include/linux/tc_ematch/tc_em_cmp.h
include/linux/tc_ematch/tc_em_meta.h
include/linux/tc_ematch/tc_em_nbyte.h
include/linux/tc_ematch/tc_em_text.h
include/linux/usb/cdc.h
include/linux/usb/gadgetfs.h
include/linux/video_decoder.h
include/linux/video_encoder.h
include/linux/videodev.h
include/linux/virtio_blk.h
include/linux/virtio_console.h
include/linux/virtio_net.h
include/linux/wait.h
include/media/v4l2-device.h
include/media/videobuf-dma-sg.h
include/mtd/inftl-user.h
include/mtd/ubi-user.h
include/net/inet_hashtables.h
include/sound/hdsp.h
include/video/aty128.h
include/video/mach64.h
include/video/radeon.h
include/video/sisfb.h
include/video/uvesafb.h
ipc/shm.c
kernel/async.c
kernel/cgroup.c
kernel/cpuset.c
kernel/fork.c
kernel/hrtimer.c
kernel/irq/chip.c
kernel/irq/numa_migrate.c
kernel/module.c
kernel/power/main.c
kernel/sched.c
kernel/sched_fair.c
kernel/sched_rt.c
kernel/signal.c
kernel/smp.c
kernel/sys.c
kernel/time/tick-common.c
kernel/trace/ftrace.c
kernel/trace/ring_buffer.c
kernel/trace/trace.c
kernel/trace/trace_irqsoff.c
kernel/trace/trace_sched_wakeup.c
kernel/wait.c
lib/smp_processor_id.c
mm/memcontrol.c
mm/memory.c
mm/mlock.c
mm/mmap.c
mm/page-writeback.c
mm/shmem.c
mm/slub.c
mm/swapfile.c
net/core/skbuff.c
net/ipv4/ipconfig.c
net/ipv4/tcp.c
net/ipv4/tcp_output.c
net/ipv4/udp.c
net/ipv6/addrconf.c
net/ipv6/icmp.c
net/ipv6/ip6_input.c
net/ipv6/ip6_output.c
net/ipv6/ip6mr.c
net/ipv6/route.c
net/packet/af_packet.c
net/sunrpc/Kconfig
net/wimax/debugfs.c
net/wimax/stack.c
net/wireless/reg.c
sound/core/oss/pcm_oss.c
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_proc.c
sound/pci/hda/patch_conexant.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_sigmatel.c
sound/pci/intel8x0.c
sound/soc/atmel/atmel_ssc_dai.c
sound/soc/atmel/atmel_ssc_dai.h
sound/soc/codecs/wm8350.c
sound/soc/codecs/wm8753.c
sound/soc/codecs/wm8990.c
sound/soc/omap/omap-mcbsp.c
sound/soc/omap/omap-pcm.c
sound/usb/usbaudio.c

index 4e83e7b52d15d2baf27f7f671483756c0c71c572..a62e6a84fd1e6fadb21e823a788f41ac00a5d9a0 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -92,6 +92,7 @@ Rudolf Marek <R.Marek@sh.cvut.cz>
 Rui Saraiva <rmps@joel.ist.utl.pt>
 Sachin P Sant <ssant@in.ibm.com>
 Sam Ravnborg <sam@mars.ravnborg.org>
+Sascha Hauer <s.hauer@pengutronix.de>
 S.Çağlar Onur <caglar@pardus.org.tr>
 Simon Kelley <simon@thekelleys.org.uk>
 Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr>
@@ -100,6 +101,7 @@ Tejun Heo <htejun@gmail.com>
 Thomas Graf <tgraf@suug.ch>
 Tony Luck <tony.luck@intel.com>
 Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com>
-Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
 Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
+Uwe Kleine-König <ukl@pengutronix.de>
+Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
 Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
index cb2b141b1c3e8c2d1cb956d79dc645b8d1dc2ae1..b95082be4d5eec7656e858685bd28f5b871a1efd 100644 (file)
@@ -33,10 +33,12 @@ o  Gnu make               3.79.1                  # make --version
 o  binutils               2.12                    # ld -v
 o  util-linux             2.10o                   # fdformat --version
 o  module-init-tools      0.9.10                  # depmod -V
-o  e2fsprogs              1.29                    # tune2fs
+o  e2fsprogs              1.41.4                  # e2fsck -V
 o  jfsutils               1.1.3                   # fsck.jfs -V
 o  reiserfsprogs          3.6.3                   # reiserfsck -V 2>&1|grep reiserfsprogs
 o  xfsprogs               2.6.0                   # xfs_db -V
+o  squashfs-tools         4.0                     # mksquashfs -version
+o  btrfs-progs            0.18                    # btrfsck
 o  pcmciautils            004                     # pccardctl -V
 o  quota-tools            3.09                    # quota -V
 o  PPP                    2.4.0                   # pppd --version
index 1875e502f87205a1dcaf268d0af78127ee336144..72968cd5eaf3286f08cc6eb7dfb3115ff9c5ce90 100644 (file)
@@ -483,17 +483,25 @@ values.  To do the latter, you can stick the following in your .emacs file:
     (* (max steps 1)
        c-basic-offset)))
 
+(add-hook 'c-mode-common-hook
+          (lambda ()
+            ;; Add kernel style
+            (c-add-style
+             "linux-tabs-only"
+             '("linux" (c-offsets-alist
+                        (arglist-cont-nonempty
+                         c-lineup-gcc-asm-reg
+                         c-lineup-arglist-tabs-only))))))
+
 (add-hook 'c-mode-hook
           (lambda ()
             (let ((filename (buffer-file-name)))
               ;; Enable kernel mode for the appropriate files
               (when (and filename
-                         (string-match "~/src/linux-trees" filename))
+                         (string-match (expand-file-name "~/src/linux-trees")
+                                       filename))
                 (setq indent-tabs-mode t)
-                (c-set-style "linux")
-                (c-set-offset 'arglist-cont-nonempty
-                              '(c-lineup-gcc-asm-reg
-                                c-lineup-arglist-tabs-only))))))
+                (c-set-style "linux-tabs-only")))))
 
 This will make emacs go better with the kernel coding style for C
 files below ~/src/linux-trees.
index 52441694fe039abca40fd83217a82fa88aca4176..2a3fcc55e98157b83a514c98c0e13fcd71bab30a 100644 (file)
@@ -5,7 +5,7 @@
 
 This document describes the DMA API.  For a more gentle introduction
 phrased in terms of the pci_ equivalents (and actual examples) see
-DMA-mapping.txt
+Documentation/PCI/PCI-DMA-mapping.txt.
 
 This API is split into two pieces.  Part I describes the API and the
 corresponding pci_ API.  Part II describes the extensions to the API
index b787e4721c90d4134f2e579ecd46006a16ea4e4a..52e1b79ce0e6aaa1fabc209921966ab5a6cd7d66 100644 (file)
@@ -41,6 +41,12 @@ GPL version 2.
 </abstract>
 
 <revhistory>
+       <revision>
+       <revnumber>0.7</revnumber>
+       <date>2008-12-23</date>
+       <authorinitials>hjk</authorinitials>
+       <revremark>Added generic platform drivers and offset attribute.</revremark>
+       </revision>
        <revision>
        <revnumber>0.6</revnumber>
        <date>2008-12-05</date>
@@ -312,6 +318,16 @@ interested in translating it, please email me
        pointed to by addr.
        </para>
 </listitem>
+<listitem>
+       <para>
+       <filename>offset</filename>: The offset, in bytes, that has to be
+       added to the pointer returned by <function>mmap()</function> to get
+       to the actual device memory. This is important if the device's memory
+       is not page aligned. Remember that pointers returned by
+       <function>mmap()</function> are always page aligned, so it is good
+       style to always add this offset.
+       </para>
+</listitem>
 </itemizedlist>
 
 <para>
@@ -594,6 +610,78 @@ framework to set up sysfs files for this region. Simply leave it alone.
        </para>
 </sect1>
 
+<sect1 id="using_uio_pdrv">
+<title>Using uio_pdrv for platform devices</title>
+       <para>
+       In many cases, UIO drivers for platform devices can be handled in a
+       generic way. In the same place where you define your
+       <varname>struct platform_device</varname>, you simply also implement
+       your interrupt handler and fill your
+       <varname>struct uio_info</varname>. A pointer to this
+       <varname>struct uio_info</varname> is then used as
+       <varname>platform_data</varname> for your platform device.
+       </para>
+       <para>
+       You also need to set up an array of <varname>struct resource</varname>
+       containing addresses and sizes of your memory mappings. This
+       information is passed to the driver using the
+       <varname>.resource</varname> and <varname>.num_resources</varname>
+       elements of <varname>struct platform_device</varname>.
+       </para>
+       <para>
+       You now have to set the <varname>.name</varname> element of
+       <varname>struct platform_device</varname> to
+       <varname>"uio_pdrv"</varname> to use the generic UIO platform device
+       driver. This driver will fill the <varname>mem[]</varname> array
+       according to the resources given, and register the device.
+       </para>
+       <para>
+       The advantage of this approach is that you only have to edit a file
+       you need to edit anyway. You do not have to create an extra driver.
+       </para>
+</sect1>
+
+<sect1 id="using_uio_pdrv_genirq">
+<title>Using uio_pdrv_genirq for platform devices</title>
+       <para>
+       Especially in embedded devices, you frequently find chips where the
+       irq pin is tied to its own dedicated interrupt line. In such cases,
+       where you can be really sure the interrupt is not shared, we can take
+       the concept of <varname>uio_pdrv</varname> one step further and use a
+       generic interrupt handler. That's what
+       <varname>uio_pdrv_genirq</varname> does.
+       </para>
+       <para>
+       The setup for this driver is the same as described above for
+       <varname>uio_pdrv</varname>, except that you do not implement an
+       interrupt handler. The <varname>.handler</varname> element of
+       <varname>struct uio_info</varname> must remain
+       <varname>NULL</varname>. The  <varname>.irq_flags</varname> element
+       must not contain <varname>IRQF_SHARED</varname>.
+       </para>
+       <para>
+       You will set the <varname>.name</varname> element of
+       <varname>struct platform_device</varname> to
+       <varname>"uio_pdrv_genirq"</varname> to use this driver.
+       </para>
+       <para>
+       The generic interrupt handler of <varname>uio_pdrv_genirq</varname>
+       will simply disable the interrupt line using
+       <function>disable_irq_nosync()</function>. After doing its work,
+       userspace can reenable the interrupt by writing 0x00000001 to the UIO
+       device file. The driver already implements an
+       <function>irq_control()</function> to make this possible, you must not
+       implement your own.
+       </para>
+       <para>
+       Using <varname>uio_pdrv_genirq</varname> not only saves a few lines of
+       interrupt handler code. You also do not need to know anything about
+       the chip's internal registers to create the kernel part of the driver.
+       All you need to know is the irq number of the pin the chip is
+       connected to.
+       </para>
+</sect1>
+
 </chapter>
 
 <chapter id="userspace_driver" xreflabel="Writing a driver in user space">
index 86edb61bdee62ba34c95171480b1af82222591aa..78a440695e11876287ec04e46c275e141082f5d9 100644 (file)
@@ -1,6 +1,6 @@
 [ NOTE: The virt_to_bus() and bus_to_virt() functions have been
-       superseded by the functionality provided by the PCI DMA
-       interface (see Documentation/DMA-mapping.txt).  They continue
+       superseded by the functionality provided by the PCI DMA interface
+       (see Documentation/PCI/PCI-DMA-mapping.txt).  They continue
        to be documented below for historical purposes, but new code
        must not use them. --davidm 00/12/12 ]
 
index 3c5434c83daf360d9bf36cb7f8d09727af7a5966..ecad6ee7570500cefabee9ee7062e69caca548a5 100644 (file)
@@ -186,8 +186,9 @@ a virtual address mapping (unlike the earlier scheme of virtual address
 do not have a corresponding kernel virtual address space mapping) and
 low-memory pages.
 
-Note: Please refer to DMA-mapping.txt for a discussion on PCI high mem DMA
-aspects and mapping of scatter gather lists, and support for 64 bit PCI.
+Note: Please refer to Documentation/PCI/PCI-DMA-mapping.txt for a discussion
+on PCI high mem DMA aspects and mapping of scatter gather lists, and support
+for 64 bit PCI.
 
 Special handling is required only for cases where i/o needs to happen on
 pages at physical memory addresses beyond what the device can support. In these
@@ -953,14 +954,14 @@ elevator_allow_merge_fn           called whenever the block layer determines
                                results in some sort of conflict internally,
                                this hook allows it to do that.
 
-elevator_dispatch_fn           fills the dispatch queue with ready requests.
+elevator_dispatch_fn*          fills the dispatch queue with ready requests.
                                I/O schedulers are free to postpone requests by
                                not filling the dispatch queue unless @force
                                is non-zero.  Once dispatched, I/O schedulers
                                are not allowed to manipulate the requests -
                                they belong to generic dispatch queue.
 
-elevator_add_req_fn            called to add a new request into the scheduler
+elevator_add_req_fn*           called to add a new request into the scheduler
 
 elevator_queue_empty_fn                returns true if the merge queue is empty.
                                Drivers shouldn't use this, but rather check
@@ -990,7 +991,7 @@ elevator_activate_req_fn    Called when device driver first sees a request.
 elevator_deactivate_req_fn     Called when device driver decides to delay
                                a request by requeueing it.
 
-elevator_init_fn
+elevator_init_fn*
 elevator_exit_fn               Allocate and free any elevator specific storage
                                for a queue.
 
diff --git a/Documentation/block/queue-sysfs.txt b/Documentation/block/queue-sysfs.txt
new file mode 100644 (file)
index 0000000..e164403
--- /dev/null
@@ -0,0 +1,63 @@
+Queue sysfs files
+=================
+
+This text file will detail the queue files that are located in the sysfs tree
+for each block device. Note that stacked devices typically do not export
+any settings, since their queue merely functions are a remapping target.
+These files are the ones found in the /sys/block/xxx/queue/ directory.
+
+Files denoted with a RO postfix are readonly and the RW postfix means
+read-write.
+
+hw_sector_size (RO)
+-------------------
+This is the hardware sector size of the device, in bytes.
+
+max_hw_sectors_kb (RO)
+----------------------
+This is the maximum number of kilobytes supported in a single data transfer.
+
+max_sectors_kb (RW)
+-------------------
+This is the maximum number of kilobytes that the block layer will allow
+for a filesystem request. Must be smaller than or equal to the maximum
+size allowed by the hardware.
+
+nomerges (RW)
+-------------
+This enables the user to disable the lookup logic involved with IO merging
+requests in the block layer. Merging may still occur through a direct
+1-hit cache, since that comes for (almost) free. The IO scheduler will not
+waste cycles doing tree/hash lookups for merges if nomerges is 1. Defaults
+to 0, enabling all merges.
+
+nr_requests (RW)
+----------------
+This controls how many requests may be allocated in the block layer for
+read or write requests. Note that the total allocated number may be twice
+this amount, since it applies only to reads or writes (not the accumulated
+sum).
+
+read_ahead_kb (RW)
+------------------
+Maximum number of kilobytes to read-ahead for filesystems on this block
+device.
+
+rq_affinity (RW)
+----------------
+If this option is enabled, the block layer will migrate request completions
+to the CPU that originally submitted the request. For some workloads
+this provides a significant reduction in CPU cycles due to caching effects.
+
+scheduler (RW)
+--------------
+When read, this file will display the current and available IO schedulers
+for this block device. The currently active IO scheduler will be enclosed
+in [] brackets. Writing an IO scheduler name to this file will switch
+control of this block device to that new IO scheduler. Note that writing
+an IO scheduler name to this file will attempt to load that IO scheduler
+module, if it isn't already present in the system.
+
+
+
+Jens Axboe <jens.axboe@oracle.com>, February 2009
index 19533f93b7a2ac4175142947142569199dacc51f..523a9c16c400526e31d05a1aadee8164ef768800 100644 (file)
@@ -1,6 +1,6 @@
 Memory Resource Controller(Memcg)  Implementation Memo.
-Last Updated: 2008/12/15
-Base Kernel Version: based on 2.6.28-rc8-mm.
+Last Updated: 2009/1/19
+Base Kernel Version: based on 2.6.29-rc2.
 
 Because VM is getting complex (one of reasons is memcg...), memcg's behavior
 is complex. This is a document for memcg's internal behavior.
@@ -340,3 +340,23 @@ Under below explanation, we assume CONFIG_MEM_RES_CTRL_SWAP=y.
        # mount -t cgroup none /cgroup -t cpuset,memory,cpu,devices
 
        and do task move, mkdir, rmdir etc...under this.
+
+ 9.7 swapoff.
+       Besides management of swap is one of complicated parts of memcg,
+       call path of swap-in at swapoff is not same as usual swap-in path..
+       It's worth to be tested explicitly.
+
+       For example, test like following is good.
+       (Shell-A)
+       # mount -t cgroup none /cgroup -t memory
+       # mkdir /cgroup/test
+       # echo 40M > /cgroup/test/memory.limit_in_bytes
+       # echo 0 > /cgroup/test/tasks
+       Run malloc(100M) program under this. You'll see 60M of swaps.
+       (Shell-B)
+       # move all tasks in /cgroup/test to /cgroup
+       # /sbin/swapoff -a
+       # rmdir /test/cgroup
+       # kill malloc task.
+
+       Of course, tmpfs v.s. swapoff test should be tested, too.
index e3443ddcfb890028cc8f1a9576a029c35d200154..917918f84fc75ac09061be1f1f242159823983cf 100644 (file)
@@ -195,19 +195,3 @@ scaling_setspeed.          By "echoing" a new frequency into this
                                you can change the speed of the CPU,
                                but only within the limits of
                                scaling_min_freq and scaling_max_freq.
-                               
-
-3.2 Deprecated Interfaces
--------------------------
-
-Depending on your kernel configuration, you might find the following 
-cpufreq-related files:
-/proc/cpufreq
-/proc/sys/cpu/*/speed
-/proc/sys/cpu/*/speed-min
-/proc/sys/cpu/*/speed-max
-
-These are files for deprecated interfaces to cpufreq, which offer far
-less functionality. Because of this, these interfaces aren't described
-here.
-
index bbebc3a43ac04e7e905b4d18d00e9ea42f0ffcc2..a87be42f82117cb94c5320baeda799becbdc6933 100644 (file)
@@ -2027,6 +2027,34 @@ increase the likelihood of this process being killed by the oom-killer.  Valid
 values are in the range -16 to +15, plus the special value -17, which disables
 oom-killing altogether for this process.
 
+The process to be killed in an out-of-memory situation is selected among all others
+based on its badness score. This value equals the original memory size of the process
+and is then updated according to its CPU time (utime + stime) and the
+run time (uptime - start time). The longer it runs the smaller is the score.
+Badness score is divided by the square root of the CPU time and then by
+the double square root of the run time.
+
+Swapped out tasks are killed first. Half of each child's memory size is added to
+the parent's score if they do not share the same memory. Thus forking servers
+are the prime candidates to be killed. Having only one 'hungry' child will make
+parent less preferable than the child.
+
+/proc/<pid>/oom_score shows process' current badness score.
+
+The following heuristics are then applied:
+ * if the task was reniced, its score doubles
+ * superuser or direct hardware access tasks (CAP_SYS_ADMIN, CAP_SYS_RESOURCE
+       or CAP_SYS_RAWIO) have their score divided by 4
+ * if oom condition happened in one cpuset and checked task does not belong
+       to it, its score is divided by 8
+ * the resulting score is multiplied by two to the power of oom_adj, i.e.
+       points <<= oom_adj when it is positive and
+       points >>= -(oom_adj) otherwise
+
+The task with the highest badness score is then selected and its children
+are killed, process itself will be killed in an OOM situation when it does
+not have children or some of them disabled oom like described above.
+
 2.13 /proc/<pid>/oom_score - Display current oom-killer score
 -------------------------------------------------------------
 
index 68ef48839c0484db0dea98da2b419eb4f94b28bf..9f8740ca3f3bc514d9f5426168eb5b2273b96d42 100644 (file)
@@ -9,6 +9,7 @@ that support it.  For example, a given bus might look like this:
      |   |-- class
      |   |-- config
      |   |-- device
+     |   |-- enable
      |   |-- irq
      |   |-- local_cpus
      |   |-- resource
@@ -32,6 +33,7 @@ files, each with their own function.
        class              PCI class (ascii, ro)
        config             PCI config space (binary, rw)
        device             PCI device (ascii, ro)
+       enable             Whether the device is enabled (ascii, rw)
        irq                IRQ number (ascii, ro)
        local_cpus         nearby CPU mask (cpumask, ro)
        resource                   PCI resource host addresses (ascii, ro)
@@ -57,10 +59,19 @@ used to do actual device programming from userspace.  Note that some platforms
 don't support mmapping of certain resources, so be sure to check the return
 value from any attempted mmap.
 
+The 'enable' file provides a counter that indicates how many times the device 
+has been enabled.  If the 'enable' file currently returns '4', and a '1' is
+echoed into it, it will then return '5'.  Echoing a '0' into it will decrease
+the count.  Even when it returns to 0, though, some of the initialisation
+may not be reversed.  
+
 The 'rom' file is special in that it provides read-only access to the device's
 ROM file, if available.  It's disabled by default, however, so applications
 should write the string "1" to the file to enable it before attempting a read
-call, and disable it following the access by writing "0" to the file.
+call, and disable it following the access by writing "0" to the file.  Note
+that the device must be enabled for a rom read to return data succesfully.
+In the event a driver is not bound to the device, it can be enabled using the
+'enable' file, documented above.
 
 Accessing legacy resources through sysfs
 ----------------------------------------
index 84da2a4ba25ab698b8788e03d33d1678f86eba22..12fedb7834c65b27d9eda747e1d38b13ac49777b 100644 (file)
@@ -79,13 +79,6 @@ Mount options
 
 (*) == default.
 
-norm_unmount (*)       commit on unmount; the journal is committed
-                       when the file-system is unmounted so that the
-                       next mount does not have to replay the journal
-                       and it becomes very fast;
-fast_unmount           do not commit on unmount; this option makes
-                       unmount faster, but the next mount slower
-                       because of the need to replay the journal.
 bulk_read              read more in one go to take advantage of flash
                        media that read faster sequentially
 no_bulk_read (*)       do not bulk-read
index b3ffe870de3349021ddf1887723f96d4943c300c..14265837c4ce346a3424212c4ab8a3181b39b499 100644 (file)
@@ -12,11 +12,11 @@ file at first.
 
 ==================================
 これは、
-linux-2.6.24/Documentation/stable_kernel_rules.txt
+linux-2.6.29/Documentation/stable_kernel_rules.txt
 の和訳です。
 
 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
-翻訳日: 2007/12/30
+翻訳日: 2009/1/14
 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com>
 校正者: 武井伸光さん、<takei at webmasters dot gr dot jp>
          かねこさん (Seiji Kaneko) <skaneko at a2 dot mbn dot or dot jp>
@@ -38,12 +38,15 @@ linux-2.6.24/Documentation/stable_kernel_rules.txt
  - ビルドエラー(CONFIG_BROKENになっているものを除く), oops, ハング、デー
    タ破壊、現実のセキュリティ問題、その他 "ああ、これはダメだね"という
    ようなものを修正しなければならない。短く言えば、重大な問題。
+ - 新しい device ID とクオークも受け入れられる。
  - どのように競合状態が発生するかの説明も一緒に書かれていない限り、
    "理論的には競合状態になる"ようなものは不可。
  - いかなる些細な修正も含めることはできない。(スペルの修正、空白のクリー
    ンアップなど)
- - 対応するサブシステムメンテナが受け入れたものでなければならない。
  - Documentation/SubmittingPatches の規則に従ったものでなければならない。
+ - パッチ自体か同等の修正が Linus のツリーに既に存在しなければならない。
+  Linus のツリーでのコミットID を -stable へのパッチ投稿の際に引用す
+   ること。
 
 -stable ツリーにパッチを送付する手続き-
 
@@ -52,8 +55,10 @@ linux-2.6.24/Documentation/stable_kernel_rules.txt
  - 送信者はパッチがキューに受け付けられた際には ACK を、却下された場合
    には NAK を受け取る。この反応は開発者たちのスケジュールによって、数
    日かかる場合がある。
- - もし受け取られたら、パッチは他の開発者たちのレビューのために
-   -stable キューに追加される。
+ - もし受け取られたら、パッチは他の開発者たちと関連するサブシステムの
+   メンテナーによるレビューのために -stable キューに追加される。
+ - パッチに stable@kernel.org のアドレスが付加されているときには、それ
+   が Linus のツリーに入る時に自動的に stable チームに email される。
  - セキュリティパッチはこのエイリアス (stable@kernel.org) に送られるべ
    きではなく、代わりに security@kernel.org のアドレスに送られる。
 
index 725eef81cd48b2af4e2af1c8574fddbf102d03cf..1f4f9e888bd1ab0ae834bb1a87ccfcf6ed26c6de 100644 (file)
@@ -1,5 +1,5 @@
 # This creates the demonstration utility "lguest" which runs a Linux guest.
-CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include -I../../arch/x86/include
+CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include -I../../arch/x86/include -U_FORTIFY_SOURCE
 LDLIBS:=-lz
 
 all: lguest
index cd12c2ff518a93feb12e4a93b8bad0afaf188de2..85046f53fcfccb09633167a81b40017aae30884e 100644 (file)
@@ -2,13 +2,13 @@
 IP-Aliasing:
 ============
 
-IP-aliases are additional IP-addresses/masks hooked up to a base 
-interface by adding a colon and a string when running ifconfig. 
-This string is usually numeric, but this is not a must.
-
-IP-Aliases are avail if CONFIG_INET (`standard' IPv4 networking) 
-is configured in the kernel.
+IP-aliases are an obsolete way to manage multiple IP-addresses/masks
+per interface. Newer tools such as iproute2 support multiple
+address/prefixes per interface, but aliases are still supported
+for backwards compatibility.
 
+An alias is formed by adding a colon and a string when running ifconfig.
+This string is usually numeric, but this is not a must.
 
 o Alias creation.
   Alias creation is done by 'magic' interface naming: eg. to create a
@@ -38,16 +38,3 @@ o Relationship with main device
 
   If the base device is shut down the added aliases will be deleted 
   too.
-
-
-Contact
--------
-Please finger or e-mail me:
-   Juan Jose Ciarlante <jjciarla@raiz.uncu.edu.ar>
-
-Updated by Erik Schoenfelder <schoenfr@gaertner.DE>
-
-; local variables:
-; mode: indented-text
-; mode: auto-fill
-; end:
diff --git a/Documentation/powerpc/dts-bindings/fsl/mpc5200.txt b/Documentation/powerpc/dts-bindings/fsl/mpc5200.txt
new file mode 100644 (file)
index 0000000..8447fd7
--- /dev/null
@@ -0,0 +1,180 @@
+MPC5200 Device Tree Bindings
+----------------------------
+
+(c) 2006-2009 Secret Lab Technologies Ltd
+Grant Likely <grant.likely@secretlab.ca>
+
+Naming conventions
+------------------
+For mpc5200 on-chip devices, the format for each compatible value is
+<chip>-<device>[-<mode>].  The OS should be able to match a device driver
+to the device based solely on the compatible value.  If two drivers
+match on the compatible list; the 'most compatible' driver should be
+selected.
+
+The split between the MPC5200 and the MPC5200B leaves a bit of a
+conundrum.  How should the compatible property be set up to provide
+maximum compatibility information; but still accurately describe the
+chip?  For the MPC5200; the answer is easy.  Most of the SoC devices
+originally appeared on the MPC5200.  Since they didn't exist anywhere
+else; the 5200 compatible properties will contain only one item;
+"fsl,mpc5200-<device>".
+
+The 5200B is almost the same as the 5200, but not quite.  It fixes
+silicon bugs and it adds a small number of enhancements.  Most of the
+devices either provide exactly the same interface as on the 5200.  A few
+devices have extra functions but still have a backwards compatible mode.
+To express this information as completely as possible, 5200B device trees
+should have two items in the compatible list:
+       compatible = "fsl,mpc5200b-<device>","fsl,mpc5200-<device>";
+
+It is *strongly* recommended that 5200B device trees follow this convention
+(instead of only listing the base mpc5200 item).
+
+ie. ethernet on mpc5200: compatible = "fsl,mpc5200-fec";
+    ethernet on mpc5200b: compatible = "fsl,mpc5200b-fec", "fsl,mpc5200-fec";
+
+Modal devices, like PSCs, also append the configured function to the
+end of the compatible field.  ie. A PSC in i2s mode would specify
+"fsl,mpc5200-psc-i2s", not "fsl,mpc5200-i2s".  This convention is chosen to
+avoid naming conflicts with non-psc devices providing the same
+function.  For example, "fsl,mpc5200-spi" and "fsl,mpc5200-psc-spi" describe
+the mpc5200 simple spi device and a PSC spi mode respectively.
+
+At the time of writing, exact chip may be either 'fsl,mpc5200' or
+'fsl,mpc5200b'.
+
+The soc node
+------------
+This node describes the on chip SOC peripherals.  Every mpc5200 based
+board will have this node, and as such there is a common naming
+convention for SOC devices.
+
+Required properties:
+name                   description
+----                   -----------
+ranges                 Memory range of the internal memory mapped registers.
+                       Should be <0 [baseaddr] 0xc000>
+reg                    Should be <[baseaddr] 0x100>
+compatible             mpc5200: "fsl,mpc5200-immr"
+                       mpc5200b: "fsl,mpc5200b-immr"
+system-frequency       'fsystem' frequency in Hz; XLB, IPB, USB and PCI
+                       clocks are derived from the fsystem clock.
+bus-frequency          IPB bus frequency in Hz.  Clock rate
+                       used by most of the soc devices.
+
+soc child nodes
+---------------
+Any on chip SOC devices available to Linux must appear as soc5200 child nodes.
+
+Note: The tables below show the value for the mpc5200.  A mpc5200b device
+tree should use the "fsl,mpc5200b-<device>","fsl,mpc5200-<device>" form.
+
+Required soc5200 child nodes:
+name                           compatible              Description
+----                           ----------              -----------
+cdm@<addr>                     fsl,mpc5200-cdm         Clock Distribution
+interrupt-controller@<addr>    fsl,mpc5200-pic         need an interrupt
+                                                       controller to boot
+bestcomm@<addr>                        fsl,mpc5200-bestcomm    Bestcomm DMA controller
+
+Recommended soc5200 child nodes; populate as needed for your board
+name           compatible              Description
+----           ----------              -----------
+timer@<addr>   fsl,mpc5200-gpt          General purpose timers
+gpio@<addr>    fsl,mpc5200-gpio         MPC5200 simple gpio controller
+gpio@<addr>    fsl,mpc5200-gpio-wkup    MPC5200 wakeup gpio controller
+rtc@<addr>     fsl,mpc5200-rtc          Real time clock
+mscan@<addr>   fsl,mpc5200-mscan        CAN bus controller
+pci@<addr>     fsl,mpc5200-pci          PCI bridge
+serial@<addr>  fsl,mpc5200-psc-uart     PSC in serial mode
+i2s@<addr>     fsl,mpc5200-psc-i2s      PSC in i2s mode
+ac97@<addr>    fsl,mpc5200-psc-ac97     PSC in ac97 mode
+spi@<addr>     fsl,mpc5200-psc-spi      PSC in spi mode
+irda@<addr>    fsl,mpc5200-psc-irda     PSC in IrDA mode
+spi@<addr>     fsl,mpc5200-spi          MPC5200 spi device
+ethernet@<addr>        fsl,mpc5200-fec          MPC5200 ethernet device
+ata@<addr>     fsl,mpc5200-ata          IDE ATA interface
+i2c@<addr>     fsl,mpc5200-i2c          I2C controller
+usb@<addr>     fsl,mpc5200-ohci,ohci-be USB controller
+xlb@<addr>     fsl,mpc5200-xlb          XLB arbitrator
+
+fsl,mpc5200-gpt nodes
+---------------------
+On the mpc5200 and 5200b, GPT0 has a watchdog timer function.  If the board
+design supports the internal wdt, then the device node for GPT0 should
+include the empty property 'fsl,has-wdt'.
+
+An mpc5200-gpt can be used as a single line GPIO controller.  To do so,
+add the following properties to the gpt node:
+       gpio-controller;
+       #gpio-cells = <2>;
+When referencing the GPIO line from another node, the first cell must always
+be zero and the second cell represents the gpio flags and described in the
+gpio device tree binding.
+
+An mpc5200-gpt can be used as a single line edge sensitive interrupt
+controller.  To do so, add the following properties to the gpt node:
+       interrupt-controller;
+       #interrupt-cells = <1>;
+When referencing the IRQ line from another node, the cell represents the
+sense mode; 1 for edge rising, 2 for edge falling.
+
+fsl,mpc5200-psc nodes
+---------------------
+The PSCs should include a cell-index which is the index of the PSC in
+hardware.  cell-index is used to determine which shared SoC registers to
+use when setting up PSC clocking.  cell-index number starts at '0'.  ie:
+       PSC1 has 'cell-index = <0>'
+       PSC4 has 'cell-index = <3>'
+
+PSC in i2s mode:  The mpc5200 and mpc5200b PSCs are not compatible when in
+i2s mode.  An 'mpc5200b-psc-i2s' node cannot include 'mpc5200-psc-i2s' in the
+compatible field.
+
+
+fsl,mpc5200-gpio and fsl,mpc5200-gpio-wkup nodes
+------------------------------------------------
+Each GPIO controller node should have the empty property gpio-controller and
+#gpio-cells set to 2. First cell is the GPIO number which is interpreted
+according to the bit numbers in the GPIO control registers. The second cell
+is for flags which is currently unused.
+
+fsl,mpc5200-fec nodes
+---------------------
+The FEC node can specify one of the following properties to configure
+the MII link:
+- fsl,7-wire-mode - An empty property that specifies the link uses 7-wire
+                    mode instead of MII
+- current-speed   - Specifies that the MII should be configured for a fixed
+                    speed.  This property should contain two cells.  The
+                    first cell specifies the speed in Mbps and the second
+                    should be '0' for half duplex and '1' for full duplex
+- phy-handle      - Contains a phandle to an Ethernet PHY.
+
+Interrupt controller (fsl,mpc5200-pic) node
+-------------------------------------------
+The mpc5200 pic binding splits hardware IRQ numbers into two levels.  The
+split reflects the layout of the PIC hardware itself, which groups
+interrupts into one of three groups; CRIT, MAIN or PERP.  Also, the
+Bestcomm dma engine has it's own set of interrupt sources which are
+cascaded off of peripheral interrupt 0, which the driver interprets as a
+fourth group, SDMA.
+
+The interrupts property for device nodes using the mpc5200 pic consists
+of three cells; <L1 L2 level>
+
+    L1 := [CRIT=0, MAIN=1, PERP=2, SDMA=3]
+    L2 := interrupt number; directly mapped from the value in the
+          "ICTL PerStat, MainStat, CritStat Encoded Register"
+    level := [LEVEL_HIGH=0, EDGE_RISING=1, EDGE_FALLING=2, LEVEL_LOW=3]
+
+For external IRQs, use the following interrupt property values (how to
+specify external interrupts is a frequently asked question):
+External interrupts:
+       external irq0:  interrupts = <0 0 n>;
+       external irq1:  interrupts = <1 1 n>;
+       external irq2:  interrupts = <1 2 n>;
+       external irq3:  interrupts = <1 3 n>;
+'n' is sense (0: level high, 1: edge rising, 2: edge falling 3: level low)
+
diff --git a/Documentation/powerpc/mpc52xx-device-tree-bindings.txt b/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
deleted file mode 100644 (file)
index 6f12f1c..0000000
+++ /dev/null
@@ -1,277 +0,0 @@
-MPC5200 Device Tree Bindings
-----------------------------
-
-(c) 2006-2007 Secret Lab Technologies Ltd
-Grant Likely <grant.likely at secretlab.ca>
-
-********** DRAFT ***********
-* WARNING: Do not depend on the stability of these bindings just yet.
-* The MPC5200 device tree conventions are still in flux
-* Keep an eye on the linuxppc-dev mailing list for more details
-********** DRAFT ***********
-
-I - Introduction
-================
-Boards supported by the arch/powerpc architecture require device tree be
-passed by the boot loader to the kernel at boot time.  The device tree
-describes what devices are present on the board and how they are
-connected.  The device tree can either be passed as a binary blob (as
-described in Documentation/powerpc/booting-without-of.txt), or passed
-by Open Firmware (IEEE 1275) compatible firmware using an OF compatible
-client interface API.
-
-This document specifies the requirements on the device-tree for mpc5200
-based boards.  These requirements are above and beyond the details
-specified in either the Open Firmware spec or booting-without-of.txt
-
-All new mpc5200-based boards are expected to match this document.  In
-cases where this document is not sufficient to support a new board port,
-this document should be updated as part of adding the new board support.
-
-II - Philosophy
-===============
-The core of this document is naming convention.  The whole point of
-defining this convention is to reduce or eliminate the number of
-special cases required to support a 5200 board.  If all 5200 boards
-follow the same convention, then generic 5200 support code will work
-rather than coding special cases for each new board.
-
-This section tries to capture the thought process behind why the naming
-convention is what it is.
-
-1.  names
----------
-There is strong convention/requirements already established for children
-of the root node.  'cpus' describes the processor cores, 'memory'
-describes memory, and 'chosen' provides boot configuration.  Other nodes
-are added to describe devices attached to the processor local bus.
-
-Following convention already established with other system-on-chip
-processors, 5200 device trees should use the name 'soc5200' for the
-parent node of on chip devices, and the root node should be its parent.
-
-Child nodes are typically named after the configured function.  ie.
-the FEC node is named 'ethernet', and a PSC in uart mode is named 'serial'.
-
-2. device_type property
------------------------
-similar to the node name convention above; the device_type reflects the
-configured function of a device.  ie. 'serial' for a uart and 'spi' for
-an spi controller.  However, while node names *should* reflect the
-configured function, device_type *must* match the configured function
-exactly.
-
-3. compatible property
-----------------------
-Since device_type isn't enough to match devices to drivers, there also
-needs to be a naming convention for the compatible property.  Compatible
-is an list of device descriptions sorted from specific to generic.  For
-the mpc5200, the required format for each compatible value is
-<chip>-<device>[-<mode>].  The OS should be able to match a device driver
-to the device based solely on the compatible value.  If two drivers
-match on the compatible list; the 'most compatible' driver should be
-selected.
-
-The split between the MPC5200 and the MPC5200B leaves a bit of a
-conundrum.  How should the compatible property be set up to provide
-maximum compatibility information; but still accurately describe the
-chip?  For the MPC5200; the answer is easy.  Most of the SoC devices
-originally appeared on the MPC5200.  Since they didn't exist anywhere
-else; the 5200 compatible properties will contain only one item;
-"mpc5200-<device>".
-
-The 5200B is almost the same as the 5200, but not quite.  It fixes
-silicon bugs and it adds a small number of enhancements.  Most of the
-devices either provide exactly the same interface as on the 5200.  A few
-devices have extra functions but still have a backwards compatible mode.
-To express this information as completely as possible, 5200B device trees
-should have two items in the compatible list;
-"mpc5200b-<device>\0mpc5200-<device>".  It is *strongly* recommended
-that 5200B device trees follow this convention (instead of only listing
-the base mpc5200 item).
-
-If another chip appear on the market with one of the mpc5200 SoC
-devices, then the compatible list should include mpc5200-<device>.
-
-ie. ethernet on mpc5200: compatible = "mpc5200-ethernet"
-    ethernet on mpc5200b: compatible = "mpc5200b-ethernet\0mpc5200-ethernet"
-
-Modal devices, like PSCs, also append the configured function to the
-end of the compatible field.  ie. A PSC in i2s mode would specify
-"mpc5200-psc-i2s", not "mpc5200-i2s".  This convention is chosen to
-avoid naming conflicts with non-psc devices providing the same
-function.  For example, "mpc5200-spi" and "mpc5200-psc-spi" describe
-the mpc5200 simple spi device and a PSC spi mode respectively.
-
-If the soc device is more generic and present on other SOCs, the
-compatible property can specify the more generic device type also.
-
-ie. mscan: compatible = "mpc5200-mscan\0fsl,mscan";
-
-At the time of writing, exact chip may be either 'mpc5200' or
-'mpc5200b'.
-
-Device drivers should always try to match as generically as possible.
-
-III - Structure
-===============
-The device tree for an mpc5200 board follows the structure defined in
-booting-without-of.txt with the following additional notes:
-
-0) the root node
-----------------
-Typical root description node; see booting-without-of
-
-1) The cpus node
-----------------
-The cpus node follows the basic layout described in booting-without-of.
-The bus-frequency property holds the XLB bus frequency
-The clock-frequency property holds the core frequency
-
-2) The memory node
-------------------
-Typical memory description node; see booting-without-of.
-
-3) The soc5200 node
--------------------
-This node describes the on chip SOC peripherals.  Every mpc5200 based
-board will have this node, and as such there is a common naming
-convention for SOC devices.
-
-Required properties:
-name                   type            description
-----                   ----            -----------
-device_type            string          must be "soc"
-ranges                 int             should be <0 baseaddr baseaddr+10000>
-reg                    int             must be <baseaddr 10000>
-compatible             string          mpc5200: "mpc5200-soc"
-                                       mpc5200b: "mpc5200b-soc\0mpc5200-soc"
-system-frequency       int             Fsystem frequency; source of all
-                                       other clocks.
-bus-frequency          int             IPB bus frequency in HZ.  Clock rate
-                                       used by most of the soc devices.
-#interrupt-cells       int             must be <3>.
-
-Recommended properties:
-name                   type            description
-----                   ----            -----------
-model                  string          Exact model of the chip;
-                                       ie: model="fsl,mpc5200"
-revision               string          Silicon revision of chip
-                                       ie: revision="M08A"
-
-The 'model' and 'revision' properties are *strongly* recommended.  Having
-them presence acts as a bit of a safety net for working around as yet
-undiscovered bugs on one version of silicon.  For example, device drivers
-can use the model and revision properties to decide if a bug fix should
-be turned on.
-
-4) soc5200 child nodes
-----------------------
-Any on chip SOC devices available to Linux must appear as soc5200 child nodes.
-
-Note: The tables below show the value for the mpc5200.  A mpc5200b device
-tree should use the "mpc5200b-<device>\0mpc5200-<device> form.
-
-Required soc5200 child nodes:
-name           device_type             compatible      Description
-----           -----------             ----------      -----------
-cdm@<addr>     cdm                     mpc5200-cmd     Clock Distribution
-pic@<addr>     interrupt-controller    mpc5200-pic     need an interrupt
-                                                       controller to boot
-bestcomm@<addr>        dma-controller          mpc5200-bestcomm 5200 pic also requires
-                                                        the bestcomm device
-
-Recommended soc5200 child nodes; populate as needed for your board
-name           device_type     compatible        Description
-----           -----------     ----------        -----------
-gpt@<addr>     gpt             fsl,mpc5200-gpt   General purpose timers
-gpt@<addr>     gpt             fsl,mpc5200-gpt-gpio    General purpose
-                                                       timers in GPIO mode
-gpio@<addr>                    fsl,mpc5200-gpio        MPC5200 simple gpio
-                                                       controller
-gpio@<addr>                    fsl,mpc5200-gpio-wkup   MPC5200 wakeup gpio
-                                                       controller
-rtc@<addr>     rtc             mpc5200-rtc       Real time clock
-mscan@<addr>   mscan           mpc5200-mscan     CAN bus controller
-pci@<addr>     pci             mpc5200-pci       PCI bridge
-serial@<addr>  serial          mpc5200-psc-uart  PSC in serial mode
-i2s@<addr>     sound           mpc5200-psc-i2s   PSC in i2s mode
-ac97@<addr>    sound           mpc5200-psc-ac97  PSC in ac97 mode
-spi@<addr>     spi             mpc5200-psc-spi   PSC in spi mode
-irda@<addr>    irda            mpc5200-psc-irda  PSC in IrDA mode
-spi@<addr>     spi             mpc5200-spi       MPC5200 spi device
-ethernet@<addr>        network         mpc5200-fec       MPC5200 ethernet device
-ata@<addr>     ata             mpc5200-ata       IDE ATA interface
-i2c@<addr>     i2c             mpc5200-i2c       I2C controller
-usb@<addr>     usb-ohci-be     mpc5200-ohci,ohci-be    USB controller
-xlb@<addr>     xlb             mpc5200-xlb       XLB arbitrator
-
-Important child node properties
-name           type            description
-----           ----            -----------
-cell-index     int             When multiple devices are present, is the
-                               index of the device in the hardware (ie. There
-                               are 6 PSC on the 5200 numbered PSC1 to PSC6)
-                                   PSC1 has 'cell-index = <0>'
-                                   PSC4 has 'cell-index = <3>'
-
-5) General Purpose Timer nodes (child of soc5200 node)
-On the mpc5200 and 5200b, GPT0 has a watchdog timer function.  If the board
-design supports the internal wdt, then the device node for GPT0 should
-include the empty property 'fsl,has-wdt'.
-
-6) PSC nodes (child of soc5200 node)
-PSC nodes can define the optional 'port-number' property to force assignment
-order of serial ports.  For example, PSC5 might be physically connected to
-the port labeled 'COM1' and PSC1 wired to 'COM1'.  In this case, PSC5 would
-have a "port-number = <0>" property, and PSC1 would have "port-number = <1>".
-
-PSC in i2s mode:  The mpc5200 and mpc5200b PSCs are not compatible when in
-i2s mode.  An 'mpc5200b-psc-i2s' node cannot include 'mpc5200-psc-i2s' in the
-compatible field.
-
-7) GPIO controller nodes
-Each GPIO controller node should have the empty property gpio-controller and
-#gpio-cells set to 2. First cell is the GPIO number which is interpreted
-according to the bit numbers in the GPIO control registers. The second cell
-is for flags which is currently unsused.
-
-8) FEC nodes
-The FEC node can specify one of the following properties to configure
-the MII link:
-"fsl,7-wire-mode" - An empty property that specifies the link uses 7-wire
-                    mode instead of MII
-"current-speed"   - Specifies that the MII should be configured for a fixed
-                    speed.  This property should contain two cells.  The
-                    first cell specifies the speed in Mbps and the second
-                    should be '0' for half duplex and '1' for full duplex
-"phy-handle"      - Contains a phandle to an Ethernet PHY.
-
-IV - Extra Notes
-================
-
-1. Interrupt mapping
---------------------
-The mpc5200 pic driver splits hardware IRQ numbers into two levels.  The
-split reflects the layout of the PIC hardware itself, which groups
-interrupts into one of three groups; CRIT, MAIN or PERP.  Also, the
-Bestcomm dma engine has it's own set of interrupt sources which are
-cascaded off of peripheral interrupt 0, which the driver interprets as a
-fourth group, SDMA.
-
-The interrupts property for device nodes using the mpc5200 pic consists
-of three cells; <L1 L2 level>
-
-    L1 := [CRIT=0, MAIN=1, PERP=2, SDMA=3]
-    L2 := interrupt number; directly mapped from the value in the
-          "ICTL PerStat, MainStat, CritStat Encoded Register"
-    level := [LEVEL_HIGH=0, EDGE_RISING=1, EDGE_FALLING=2, LEVEL_LOW=3]
-
-2. Shared registers
--------------------
-Some SoC devices share registers between them.  ie. the i2c devices use
-a single clock control register, and almost all device are affected by
-the port_config register.  Devices which need to manipulate shared regs
-should look to the parent SoC node.  The soc node is responsible
-for arbitrating all shared register access.
index e8b50b7de9d943d3efd3da6e55ebc12ce533f230..cfdcd16e3abf136b8f291da8372ceff5105fa294 100644 (file)
@@ -6,8 +6,9 @@ in the kernel usb programming guide (kerneldoc, from the source code).
 API OVERVIEW
 
 The big picture is that USB drivers can continue to ignore most DMA issues,
-though they still must provide DMA-ready buffers (see DMA-mapping.txt).
-That's how they've worked through the 2.4 (and earlier) kernels.
+though they still must provide DMA-ready buffers (see
+Documentation/PCI/PCI-DMA-mapping.txt).  That's how they've worked through
+the 2.4 (and earlier) kernels.
 
 OR:  they can now be DMA-aware.
 
@@ -62,8 +63,8 @@ and effects like cache-trashing can impose subtle penalties.
   force a consistent memory access ordering by using memory barriers.  It's
   not using a streaming DMA mapping, so it's good for small transfers on
   systems where the I/O would otherwise thrash an IOMMU mapping.  (See
-  Documentation/DMA-mapping.txt for definitions of "coherent" and "streaming"
-  DMA mappings.)
+  Documentation/PCI/PCI-DMA-mapping.txt for definitions of "coherent" and
+  "streaming" DMA mappings.)
 
   Asking for 1/Nth of a page (as well as asking for N pages) is reasonably
   space-efficient.
@@ -93,7 +94,7 @@ WORKING WITH EXISTING BUFFERS
 Existing buffers aren't usable for DMA without first being mapped into the
 DMA address space of the device.  However, most buffers passed to your
 driver can safely be used with such DMA mapping.  (See the first section
-of DMA-mapping.txt, titled "What memory is DMA-able?")
+of Documentation/PCI/PCI-DMA-mapping.txt, titled "What memory is DMA-able?")
 
 - When you're using scatterlists, you can map everything at once.  On some
   systems, this kicks in an IOMMU and turns the scatterlists into single
index 079b628481cf6a566a47b071ba354b6d3d0a1910..d6e70bef8ad0a98d040b8dd5cb5a3272a233f7bb 100644 (file)
@@ -4,12 +4,21 @@
  *
  *     Compile with:
  *             gcc -s -Wall -Wstrict-prototypes v4lgrab.c -o v4lgrab
- *      Use as:
- *              v4lgrab >image.ppm
+ *     Use as:
+ *             v4lgrab >image.ppm
  *
  *     Copyright (C) 1998-05-03, Phil Blundell <philb@gnu.org>
- *      Copied from http://www.tazenda.demon.co.uk/phil/vgrabber.c
- *      with minor modifications (Dave Forrest, drf5n@virginia.edu).
+ *     Copied from http://www.tazenda.demon.co.uk/phil/vgrabber.c
+ *     with minor modifications (Dave Forrest, drf5n@virginia.edu).
+ *
+ *
+ *     For some cameras you may need to pre-load libv4l to perform
+ *     the necessary decompression, e.g.:
+ *
+ *     export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so
+ *     ./v4lgrab >image.ppm
+ *
+ *     see http://hansdegoede.livejournal.com/3636.html for details.
  *
  */
 
@@ -24,7 +33,7 @@
 #include <linux/types.h>
 #include <linux/videodev.h>
 
-#define FILE "/dev/video0"
+#define VIDEO_DEV "/dev/video0"
 
 /* Stole this from tvset.c */
 
@@ -90,7 +99,7 @@ int get_brightness_adj(unsigned char *image, long size, int *brightness) {
 
 int main(int argc, char ** argv)
 {
-  int fd = open(FILE, O_RDONLY), f;
+  int fd = open(VIDEO_DEV, O_RDONLY), f;
   struct video_capability cap;
   struct video_window win;
   struct video_picture vpic;
@@ -100,13 +109,13 @@ int main(int argc, char ** argv)
   unsigned int i, src_depth;
 
   if (fd < 0) {
-    perror(FILE);
+    perror(VIDEO_DEV);
     exit(1);
   }
 
   if (ioctl(fd, VIDIOCGCAP, &cap) < 0) {
     perror("VIDIOGCAP");
-    fprintf(stderr, "(" FILE " not a video4linux device?)\n");
+    fprintf(stderr, "(" VIDEO_DEV " not a video4linux device?)\n");
     close(fd);
     exit(1);
   }
index d992d407197b726033a88797af6963082bc9b1e3..0ea3a6d987149dfd7113b2ada91097b21aaefb6d 100644 (file)
@@ -911,7 +911,7 @@ S:  Maintained
 BLACKFIN ARCHITECTURE
 P:     Bryan Wu
 M:     cooloney@kernel.org
-L:     uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
+L:     uclinux-dist-devel@blackfin.uclinux.org
 W:     http://blackfin.uclinux.org
 S:     Supported
 
@@ -1021,6 +1021,14 @@ M:       mb@bu3sch.de
 W:     http://bu3sch.de/btgpio.php
 S:     Maintained
 
+BTRFS FILE SYSTEM
+P:     Chris Mason
+M:     chris.mason@oracle.com
+L:     linux-btrfs@vger.kernel.org
+W:     http://btrfs.wiki.kernel.org/
+T:     git kernel.org:/pub/scm/linux/kernel/git/mason/btrfs-unstable.git
+S:     Maintained
+
 BTTV VIDEO4LINUX DRIVER
 P:     Mauro Carvalho Chehab
 M:     mchehab@infradead.org
@@ -2212,7 +2220,7 @@ P:        Sean Hefty
 M:     sean.hefty@intel.com
 P:     Hal Rosenstock
 M:     hal.rosenstock@gmail.com
-L:     general@lists.openfabrics.org
+L:     general@lists.openfabrics.org (moderated for non-subscribers)
 W:     http://www.openib.org/
 T:     git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
 S:     Supported
@@ -2836,8 +2844,6 @@ S:        Maintained
 MAC80211
 P:     Johannes Berg
 M:     johannes@sipsolutions.net
-P:     Michael Wu
-M:     flamingice@sourmilk.net
 L:     linux-wireless@vger.kernel.org
 W:     http://linuxwireless.org/
 T:     git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git
@@ -4843,6 +4849,7 @@ P:        Ingo Molnar
 M:     mingo@redhat.com
 P:     H. Peter Anvin
 M:     hpa@zytor.com
+M:     x86@kernel.org
 L:     linux-kernel@vger.kernel.org
 T:     git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git
 S:     Maintained
index 96267700effc623b039715f29ae59297b013a75a..68ac1cdb8f7b34f9e3e13cba607cb4ec87b67e3c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 29
-EXTRAVERSION = -rc3
+EXTRAVERSION = -rc4
 NAME = Erotic Pickled Herring
 
 # *DOCUMENTATION*
index 6110197757a3f6283bf999519f1e7649fb96a867..9fb8aae5c3916d4450ecc0affac8ba153f71fe29 100644 (file)
@@ -8,6 +8,7 @@ config ALPHA
        select HAVE_AOUT
        select HAVE_IDE
        select HAVE_OPROFILE
+       select HAVE_SYSCALL_WRAPPERS
        help
          The Alpha is a 64-bit general-purpose processor designed and
          marketed by the Digital Equipment Corporation of blessed memory,
index 695a5ee4b5d3da464ed25bab5668bcc861de1479..1720c8ad86fec780ca054e42ed8baaa21735e899 100644 (file)
@@ -8,17 +8,12 @@
 
 /* ??? Would be nice to use .gprel32 here, but we can't be sure that the
    function loaded the GP, so this could fail in modules.  */
-static inline void ATTRIB_NORET __BUG(const char *file, int line)
-{
-       __asm__ __volatile__(
-               "call_pal %0  # bugchk\n\t"
-               ".long %1\n\t.8byte %2"
-                      : : "i" (PAL_bugchk), "i"(line), "i"(file));
-       for ( ; ; )
-               ;
-}
-
-#define BUG() __BUG(__FILE__, __LINE__)
+#define BUG()  do {                                                    \
+       __asm__ __volatile__(                                           \
+               "call_pal %0  # bugchk\n\t"                             \
+               ".long %1\n\t.8byte %2"                                 \
+               : : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__));     \
+       for ( ; ; ); } while (0)
 
 #define HAVE_ARCH_BUG
 #endif
index a5801ae02e4be31cb7232626b6f6468a9495244e..04eb5681448c8ade147b71296531488bd56c93f6 100644 (file)
@@ -29,6 +29,8 @@
 
 #else  /* no PCI - no IOMMU. */
 
+#include <asm/io.h>    /* for virt_to_phys() */
+
 struct scatterlist;
 void *dma_alloc_coherent(struct device *dev, size_t size,
                         dma_addr_t *dma_handle, gfp_t gfp);
index aa2e50cf98578033c73a548e60b653a88e6087ec..e4a54b615894f270b97fbf3a9ddd348e2abcae3a 100644 (file)
@@ -933,7 +933,7 @@ sys_execve:
 osf_sigprocmask:
        .prologue 0
        mov     $sp, $18
-       jmp     $31, do_osf_sigprocmask
+       jmp     $31, sys_osf_sigprocmask
 .end osf_sigprocmask
 
        .align  4
index 18a3ea1aac51376882d0bd8cb50503b2d0442ee3..ae41f097864b8ccc1ee49622dd96e6a88d8d4f39 100644 (file)
@@ -54,8 +54,7 @@ extern int do_pipe(int *);
  * identical to OSF as we don't return 0 on success, but doing otherwise
  * would require changes to libc.  Hopefully this is good enough.
  */
-asmlinkage unsigned long
-osf_brk(unsigned long brk)
+SYSCALL_DEFINE1(osf_brk, unsigned long, brk)
 {
        unsigned long retval = sys_brk(brk);
        if (brk && brk != retval)
@@ -66,9 +65,9 @@ osf_brk(unsigned long brk)
 /*
  * This is pure guess-work..
  */
-asmlinkage int
-osf_set_program_attributes(unsigned long text_start, unsigned long text_len,
-                          unsigned long bss_start, unsigned long bss_len)
+SYSCALL_DEFINE4(osf_set_program_attributes, unsigned long, text_start,
+               unsigned long, text_len, unsigned long, bss_start,
+               unsigned long, bss_len)
 {
        struct mm_struct *mm;
 
@@ -146,9 +145,9 @@ Efault:
        return -EFAULT;
 }
 
-asmlinkage int
-osf_getdirentries(unsigned int fd, struct osf_dirent __user *dirent,
-                 unsigned int count, long __user *basep)
+SYSCALL_DEFINE4(osf_getdirentries, unsigned int, fd,
+               struct osf_dirent __user *, dirent, unsigned int, count,
+               long __user *, basep)
 {
        int error;
        struct file *file;
@@ -177,9 +176,9 @@ osf_getdirentries(unsigned int fd, struct osf_dirent __user *dirent,
 
 #undef NAME_OFFSET
 
-asmlinkage unsigned long
-osf_mmap(unsigned long addr, unsigned long len, unsigned long prot,
-        unsigned long flags, unsigned long fd, unsigned long off)
+SYSCALL_DEFINE6(osf_mmap, unsigned long, addr, unsigned long, len,
+               unsigned long, prot, unsigned long, flags, unsigned long, fd,
+               unsigned long, off)
 {
        struct file *file = NULL;
        unsigned long ret = -EBADF;
@@ -254,8 +253,8 @@ do_osf_statfs(struct dentry * dentry, struct osf_statfs __user *buffer,
        return error;   
 }
 
-asmlinkage int
-osf_statfs(char __user *pathname, struct osf_statfs __user *buffer, unsigned long bufsiz)
+SYSCALL_DEFINE3(osf_statfs, char __user *, pathname,
+               struct osf_statfs __user *, buffer, unsigned long, bufsiz)
 {
        struct path path;
        int retval;
@@ -268,8 +267,8 @@ osf_statfs(char __user *pathname, struct osf_statfs __user *buffer, unsigned lon
        return retval;
 }
 
-asmlinkage int
-osf_fstatfs(unsigned long fd, struct osf_statfs __user *buffer, unsigned long bufsiz)
+SYSCALL_DEFINE3(osf_fstatfs, unsigned long, fd,
+               struct osf_statfs __user *, buffer, unsigned long, bufsiz)
 {
        struct file *file;
        int retval;
@@ -368,8 +367,8 @@ osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags)
        return do_mount("", dirname, "proc", flags, NULL);
 }
 
-asmlinkage int
-osf_mount(unsigned long typenr, char __user *path, int flag, void __user *data)
+SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, char __user *, path,
+               int, flag, void __user *, data)
 {
        int retval = -EINVAL;
        char *name;
@@ -399,8 +398,7 @@ osf_mount(unsigned long typenr, char __user *path, int flag, void __user *data)
        return retval;
 }
 
-asmlinkage int
-osf_utsname(char __user *name)
+SYSCALL_DEFINE1(osf_utsname, char __user *, name)
 {
        int error;
 
@@ -423,14 +421,12 @@ osf_utsname(char __user *name)
        return error;
 }
 
-asmlinkage unsigned long
-sys_getpagesize(void)
+SYSCALL_DEFINE0(getpagesize)
 {
        return PAGE_SIZE;
 }
 
-asmlinkage unsigned long
-sys_getdtablesize(void)
+SYSCALL_DEFINE0(getdtablesize)
 {
        return sysctl_nr_open;
 }
@@ -438,8 +434,7 @@ sys_getdtablesize(void)
 /*
  * For compatibility with OSF/1 only.  Use utsname(2) instead.
  */
-asmlinkage int
-osf_getdomainname(char __user *name, int namelen)
+SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen)
 {
        unsigned len;
        int i;
@@ -527,8 +522,8 @@ enum pl_code {
        PL_DEL = 5, PL_FDEL = 6
 };
 
-asmlinkage long
-osf_proplist_syscall(enum pl_code code, union pl_args __user *args)
+SYSCALL_DEFINE2(osf_proplist_syscall, enum pl_code, code,
+               union pl_args __user *, args)
 {
        long error;
        int __user *min_buf_size_ptr;
@@ -567,8 +562,8 @@ osf_proplist_syscall(enum pl_code code, union pl_args __user *args)
        return error;
 }
 
-asmlinkage int
-osf_sigstack(struct sigstack __user *uss, struct sigstack __user *uoss)
+SYSCALL_DEFINE2(osf_sigstack, struct sigstack __user *, uss,
+               struct sigstack __user *, uoss)
 {
        unsigned long usp = rdusp();
        unsigned long oss_sp = current->sas_ss_sp + current->sas_ss_size;
@@ -608,8 +603,7 @@ osf_sigstack(struct sigstack __user *uss, struct sigstack __user *uoss)
        return error;
 }
 
-asmlinkage long
-osf_sysinfo(int command, char __user *buf, long count)
+SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count)
 {
        char *sysinfo_table[] = {
                utsname()->sysname,
@@ -647,9 +641,8 @@ osf_sysinfo(int command, char __user *buf, long count)
        return err;
 }
 
-asmlinkage unsigned long
-osf_getsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes,
-              int __user *start, void __user *arg)
+SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer,
+               unsigned long, nbytes, int __user *, start, void __user *, arg)
 {
        unsigned long w;
        struct percpu_struct *cpu;
@@ -705,9 +698,8 @@ osf_getsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes,
        return -EOPNOTSUPP;
 }
 
-asmlinkage unsigned long
-osf_setsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes,
-              int __user *start, void __user *arg)
+SYSCALL_DEFINE5(osf_setsysinfo, unsigned long, op, void __user *, buffer,
+               unsigned long, nbytes, int __user *, start, void __user *, arg)
 {
        switch (op) {
        case SSI_IEEE_FP_CONTROL: {
@@ -880,8 +872,8 @@ jiffies_to_timeval32(unsigned long jiffies, struct timeval32 *value)
        value->tv_sec = jiffies / HZ;
 }
 
-asmlinkage int
-osf_gettimeofday(struct timeval32 __user *tv, struct timezone __user *tz)
+SYSCALL_DEFINE2(osf_gettimeofday, struct timeval32 __user *, tv,
+               struct timezone __user *, tz)
 {
        if (tv) {
                struct timeval ktv;
@@ -896,8 +888,8 @@ osf_gettimeofday(struct timeval32 __user *tv, struct timezone __user *tz)
        return 0;
 }
 
-asmlinkage int
-osf_settimeofday(struct timeval32 __user *tv, struct timezone __user *tz)
+SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv,
+               struct timezone __user *, tz)
 {
        struct timespec kts;
        struct timezone ktz;
@@ -916,8 +908,7 @@ osf_settimeofday(struct timeval32 __user *tv, struct timezone __user *tz)
        return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
 }
 
-asmlinkage int
-osf_getitimer(int which, struct itimerval32 __user *it)
+SYSCALL_DEFINE2(osf_getitimer, int, which, struct itimerval32 __user *, it)
 {
        struct itimerval kit;
        int error;
@@ -929,8 +920,8 @@ osf_getitimer(int which, struct itimerval32 __user *it)
        return error;
 }
 
-asmlinkage int
-osf_setitimer(int which, struct itimerval32 __user *in, struct itimerval32 __user *out)
+SYSCALL_DEFINE3(osf_setitimer, int, which, struct itimerval32 __user *, in,
+               struct itimerval32 __user *, out)
 {
        struct itimerval kin, kout;
        int error;
@@ -952,8 +943,8 @@ osf_setitimer(int which, struct itimerval32 __user *in, struct itimerval32 __use
 
 }
 
-asmlinkage int
-osf_utimes(char __user *filename, struct timeval32 __user *tvs)
+SYSCALL_DEFINE2(osf_utimes, char __user *, filename,
+               struct timeval32 __user *, tvs)
 {
        struct timespec tv[2];
 
@@ -979,9 +970,8 @@ osf_utimes(char __user *filename, struct timeval32 __user *tvs)
 #define MAX_SELECT_SECONDS \
        ((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
 
-asmlinkage int
-osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
-          struct timeval32 __user *tvp)
+SYSCALL_DEFINE5(osf_select, int, n, fd_set __user *, inp, fd_set __user *, outp,
+               fd_set __user *, exp, struct timeval32 __user *, tvp)
 {
        struct timespec end_time, *to = NULL;
        if (tvp) {
@@ -1026,8 +1016,7 @@ struct rusage32 {
        long    ru_nivcsw;              /* involuntary " */
 };
 
-asmlinkage int
-osf_getrusage(int who, struct rusage32 __user *ru)
+SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru)
 {
        struct rusage32 r;
 
@@ -1053,9 +1042,8 @@ osf_getrusage(int who, struct rusage32 __user *ru)
        return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0;
 }
 
-asmlinkage long
-osf_wait4(pid_t pid, int __user *ustatus, int options,
-         struct rusage32 __user *ur)
+SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options,
+               struct rusage32 __user *, ur)
 {
        struct rusage r;
        long ret, err;
@@ -1101,8 +1089,8 @@ osf_wait4(pid_t pid, int __user *ustatus, int options,
  * seems to be a timeval pointer, and I suspect the second
  * one is the time remaining.. Ho humm.. No documentation.
  */
-asmlinkage int
-osf_usleep_thread(struct timeval32 __user *sleep, struct timeval32 __user *remain)
+SYSCALL_DEFINE2(osf_usleep_thread, struct timeval32 __user *, sleep,
+               struct timeval32 __user *, remain)
 {
        struct timeval tmp;
        unsigned long ticks;
@@ -1155,8 +1143,7 @@ struct timex32 {
        int  :32; int  :32; int  :32; int  :32;
 };
 
-asmlinkage int
-sys_old_adjtimex(struct timex32 __user *txc_p)
+SYSCALL_DEFINE1(old_adjtimex, struct timex32 __user *, txc_p)
 {
         struct timex txc;
        int ret;
@@ -1267,8 +1254,8 @@ osf_fix_iov_len(const struct iovec __user *iov, unsigned long count)
        return 0;
 }
 
-asmlinkage ssize_t
-osf_readv(unsigned long fd, const struct iovec __user * vector, unsigned long count)
+SYSCALL_DEFINE3(osf_readv, unsigned long, fd,
+               const struct iovec __user *, vector, unsigned long, count)
 {
        if (unlikely(personality(current->personality) == PER_OSF4))
                if (osf_fix_iov_len(vector, count))
@@ -1276,8 +1263,8 @@ osf_readv(unsigned long fd, const struct iovec __user * vector, unsigned long co
        return sys_readv(fd, vector, count);
 }
 
-asmlinkage ssize_t
-osf_writev(unsigned long fd, const struct iovec __user * vector, unsigned long count)
+SYSCALL_DEFINE3(osf_writev, unsigned long, fd,
+               const struct iovec __user *, vector, unsigned long, count)
 {
        if (unlikely(personality(current->personality) == PER_OSF4))
                if (osf_fix_iov_len(vector, count))
index 8ac08311f5a51bd765145b461b76864f550d38f1..c19a376520f45e3d3b89c6d749117a77727443f0 100644 (file)
@@ -109,7 +109,8 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn,
 /* Stubs for the routines in pci_iommu.c: */
 
 void *
-pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp)
+__pci_alloc_consistent(struct pci_dev *pdev, size_t size,
+                      dma_addr_t *dma_addrp, gfp_t gfp)
 {
        return NULL;
 }
index 410af4f3140e3ce4ff83256753f8e41d81c12106..df65eaa84c4c41218a68121c3adce386437f6642 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/tty.h>
 #include <linux/binfmts.h>
 #include <linux/bitops.h>
+#include <linux/syscalls.h>
 
 #include <asm/uaccess.h>
 #include <asm/sigcontext.h>
@@ -51,8 +52,8 @@ static void do_signal(struct pt_regs *, struct switch_stack *,
  * Note that we don't need to acquire the kernel lock for SMP
  * operation, as all of this is local to this thread.
  */
-asmlinkage unsigned long
-do_osf_sigprocmask(int how, unsigned long newmask, struct pt_regs *regs)
+SYSCALL_DEFINE3(osf_sigprocmask, int, how, unsigned long, newmask,
+               struct pt_regs *, regs)
 {
        unsigned long oldmask = -EINVAL;
 
@@ -81,9 +82,9 @@ do_osf_sigprocmask(int how, unsigned long newmask, struct pt_regs *regs)
        return oldmask;
 }
 
-asmlinkage int 
-osf_sigaction(int sig, const struct osf_sigaction __user *act,
-             struct osf_sigaction __user *oact)
+SYSCALL_DEFINE3(osf_sigaction, int, sig,
+               const struct osf_sigaction __user *, act,
+               struct osf_sigaction __user *, oact)
 {
        struct k_sigaction new_ka, old_ka;
        int ret;
@@ -112,10 +113,9 @@ osf_sigaction(int sig, const struct osf_sigaction __user *act,
        return ret;
 }
 
-asmlinkage long
-sys_rt_sigaction(int sig, const struct sigaction __user *act,
-                struct sigaction __user *oact,
-                size_t sigsetsize, void __user *restorer)
+SYSCALL_DEFINE5(rt_sigaction, int, sig, const struct sigaction __user *, act,
+               struct sigaction __user *, oact,
+               size_t, sigsetsize, void __user *, restorer)
 {
        struct k_sigaction new_ka, old_ka;
        int ret;
index d953e510f68d71ff417206e98c76dc9c13be45ad..00f1dc3dfd5f215e5e1068c89c2376afed7f7830 100644 (file)
@@ -120,8 +120,9 @@ void __cpuinit
 smp_callin(void)
 {
        int cpuid = hard_smp_processor_id();
+       cpumask_t mask = cpu_online_map;
 
-       if (cpu_test_and_set(cpuid, cpu_online_map)) {
+       if (cpu_test_and_set(cpuid, mask)) {
                printk("??, cpu 0x%x already present??\n", cpuid);
                BUG();
        }
index 9d9e3a98bb9584ddbbe05d7d8ed944af7436c5e9..95c9aef1c10645fd1462e0c93961301f17e2dc7e 100644 (file)
@@ -17,7 +17,7 @@ sys_call_table:
        .quad sys_write
        .quad alpha_ni_syscall                  /* 5 */
        .quad sys_close
-       .quad osf_wait4
+       .quad sys_osf_wait4
        .quad alpha_ni_syscall
        .quad sys_link
        .quad sys_unlink                        /* 10 */
@@ -27,11 +27,11 @@ sys_call_table:
        .quad sys_mknod
        .quad sys_chmod                         /* 15 */
        .quad sys_chown
-       .quad osf_brk
+       .quad sys_osf_brk
        .quad alpha_ni_syscall
        .quad sys_lseek
        .quad sys_getxpid                       /* 20 */
-       .quad osf_mount
+       .quad sys_osf_mount
        .quad sys_umount
        .quad sys_setuid
        .quad sys_getxuid
@@ -53,7 +53,7 @@ sys_call_table:
        .quad alpha_ni_syscall                  /* 40 */
        .quad sys_dup
        .quad sys_alpha_pipe
-       .quad osf_set_program_attributes
+       .quad sys_osf_set_program_attributes
        .quad alpha_ni_syscall
        .quad sys_open                          /* 45 */
        .quad alpha_ni_syscall
@@ -81,7 +81,7 @@ sys_call_table:
        .quad sys_newlstat
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall                  /* 70 */
-       .quad osf_mmap
+       .quad sys_osf_mmap
        .quad alpha_ni_syscall
        .quad sys_munmap
        .quad sys_mprotect
@@ -94,17 +94,17 @@ sys_call_table:
        .quad sys_setgroups                     /* 80 */
        .quad alpha_ni_syscall
        .quad sys_setpgid
-       .quad osf_setitimer
+       .quad sys_osf_setitimer
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall                  /* 85 */
-       .quad osf_getitimer
+       .quad sys_osf_getitimer
        .quad sys_gethostname
        .quad sys_sethostname
        .quad sys_getdtablesize
        .quad sys_dup2                          /* 90 */
        .quad sys_newfstat
        .quad sys_fcntl
-       .quad osf_select
+       .quad sys_osf_select
        .quad sys_poll
        .quad sys_fsync                         /* 95 */
        .quad sys_setpriority
@@ -123,22 +123,22 @@ sys_call_table:
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall                  /* 110 */
        .quad sys_sigsuspend
-       .quad osf_sigstack
+       .quad sys_osf_sigstack
        .quad sys_recvmsg
        .quad sys_sendmsg
        .quad alpha_ni_syscall                  /* 115 */
-       .quad osf_gettimeofday
-       .quad osf_getrusage
+       .quad sys_osf_gettimeofday
+       .quad sys_osf_getrusage
        .quad sys_getsockopt
        .quad alpha_ni_syscall
 #ifdef CONFIG_OSF4_COMPAT
-       .quad osf_readv                         /* 120 */
-       .quad osf_writev
+       .quad sys_osf_readv                     /* 120 */
+       .quad sys_osf_writev
 #else
        .quad sys_readv                         /* 120 */
        .quad sys_writev
 #endif
-       .quad osf_settimeofday
+       .quad sys_osf_settimeofday
        .quad sys_fchown
        .quad sys_fchmod
        .quad sys_recvfrom                      /* 125 */
@@ -154,7 +154,7 @@ sys_call_table:
        .quad sys_socketpair                    /* 135 */
        .quad sys_mkdir
        .quad sys_rmdir
-       .quad osf_utimes
+       .quad sys_osf_utimes
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall                  /* 140 */
        .quad sys_getpeername
@@ -172,16 +172,16 @@ sys_call_table:
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall                  /* 155 */
-       .quad osf_sigaction
+       .quad sys_osf_sigaction
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
-       .quad osf_getdirentries
-       .quad osf_statfs                        /* 160 */
-       .quad osf_fstatfs
+       .quad sys_osf_getdirentries
+       .quad sys_osf_statfs                    /* 160 */
+       .quad sys_osf_fstatfs
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
-       .quad osf_getdomainname                 /* 165 */
+       .quad sys_osf_getdomainname             /* 165 */
        .quad sys_setdomainname
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
@@ -224,7 +224,7 @@ sys_call_table:
        .quad sys_semctl
        .quad sys_semget                        /* 205 */
        .quad sys_semop
-       .quad osf_utsname
+       .quad sys_osf_utsname
        .quad sys_lchown
        .quad sys_shmat
        .quad sys_shmctl                        /* 210 */
@@ -258,23 +258,23 @@ sys_call_table:
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall                  /* 240 */
-       .quad osf_sysinfo
+       .quad sys_osf_sysinfo
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
-       .quad osf_proplist_syscall
+       .quad sys_osf_proplist_syscall
        .quad alpha_ni_syscall                  /* 245 */
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall                  /* 250 */
-       .quad osf_usleep_thread
+       .quad sys_osf_usleep_thread
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
        .quad sys_sysfs
        .quad alpha_ni_syscall                  /* 255 */
-       .quad osf_getsysinfo
-       .quad osf_setsysinfo
+       .quad sys_osf_getsysinfo
+       .quad sys_osf_setsysinfo
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall                  /* 260 */
index 77b047475539b9683ef9671caf738adf8ad22a9a..85040cfeb5e515d303afaa7e6025b16e604cda84 100644 (file)
@@ -650,6 +650,7 @@ ENTRY(fp_enter)
 no_fp: mov     pc, lr
 
 __und_usr_unknown:
+       enable_irq
        mov     r0, sp
        adr     lr, ret_from_exception
        b       do_undefinstr
index 06269ea375c52f392f3d45eb94254cc3be7e2bb3..49a6ba926c2bc346bcde289d7948ad4521bf985d 100644 (file)
@@ -136,7 +136,7 @@ ENTRY(mcount)
        ldmia sp!, {r0-r3, pc}
 
 trace:
-       ldr r1, [fp, #-4]
+       ldr r1, [fp, #-4]                       @ lr of instrumented routine
        mov r0, lr
        sub r0, r0, #MCOUNT_INSN_SIZE
        mov lr, pc
index 7141cee1fab71e8b131d03e0d8e6dbfc043dbb85..363db186cb93334791588db5b2158e6f295c5c54 100644 (file)
@@ -101,7 +101,7 @@ unlock:
 /* Handle bad interrupts */
 static struct irq_desc bad_irq_desc = {
        .handle_irq = handle_bad_irq,
-       .lock = SPIN_LOCK_UNLOCKED
+       .lock = __SPIN_LOCK_UNLOCKED(bad_irq_desc.lock),
 };
 
 /*
index c2a96e3965a6ccfab9bb15e6e2fd0cf8ef0b3fe0..e61967dde9a1fea73b5181550a1ffe10ebe79bb9 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/flash.h>
 
+#include <mach/irqs.h>
 #include <mach/board.h>
 #include <mach/msm_iomap.h>
 
index b4b6106cc08bd19a651d7c00646e34c8d9ffb159..bbbaeb0abcd394bb2a0c6feeb48ec62a3a345e7b 100644 (file)
@@ -181,7 +181,7 @@ void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
                }
                size = OMAP1_MMC_SIZE;
 
-               omap_mmc_add(i, base, size, irq, mmc_data[i]);
+               omap_mmc_add("mmci-omap", i, base, size, irq, mmc_data[i]);
        };
 }
 
index d7e848e80bf6b27e828a87f84b61f8bd8a775ca0..dad4528d345166cc731e1ee4f408858846edb2b0 100644 (file)
@@ -500,6 +500,7 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
                        int nr_controllers)
 {
        int i;
+       char *name;
 
        for (i = 0; i < nr_controllers; i++) {
                unsigned long base, size;
@@ -529,12 +530,14 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
                        continue;
                }
 
-               if (cpu_is_omap2420())
+               if (cpu_is_omap2420()) {
                        size = OMAP2420_MMC_SIZE;
-               else
+                       name = "mmci-omap";
+               } else {
                        size = HSMMC_SIZE;
-
-               omap_mmc_add(i, base, size, irq, mmc_data[i]);
+                       name = "mmci-omap-hs";
+               }
+               omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
        };
 }
 
index b44dcaeef738b06140a54437dee4dc91a67a1b77..2842fe8dc362bfc7e09db08c34703055d5c89235 100644 (file)
@@ -123,11 +123,6 @@ static void omap_unmask_irq(unsigned int irq)
        intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_CLEAR0 + offset);
 }
 
-static void omap_disable_irq(unsigned int irq)
-{
-       omap_mask_irq(irq);
-}
-
 static void omap_mask_ack_irq(unsigned int irq)
 {
        omap_mask_irq(irq);
@@ -139,7 +134,7 @@ static struct irq_chip omap_irq_chip = {
        .ack    = omap_mask_ack_irq,
        .mask   = omap_mask_irq,
        .unmask = omap_unmask_irq,
-       .disable = omap_disable_irq,
+       .disable = omap_mask_irq,
 };
 
 static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
index c1fbd5b5f9c459fa772df1295a337b365bd49e88..23cfdd5939541d82be5f1670ce19ddd9f5bf224e 100644 (file)
@@ -289,7 +289,7 @@ static struct platform_device sa11x0pcmcia_device = {
 };
 
 static struct platform_device sa11x0mtd_device = {
-       .name           = "flash",
+       .name           = "sa1100-mtd",
        .id             = -1,
 };
 
index 81d0b8772de33c47b108a7246967adde0d380251..bc0099d5ae85c022d12a051062915fa1bae6aefb 100644 (file)
@@ -66,7 +66,10 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address)
         * fault (ie, is old), we can safely ignore any issues.
         */
        if (ret && (pte_val(entry) & L_PTE_MT_MASK) != shared_pte_mask) {
-               flush_cache_page(vma, address, pte_pfn(entry));
+               unsigned long pfn = pte_pfn(entry);
+               flush_cache_page(vma, address, pfn);
+               outer_flush_range((pfn << PAGE_SHIFT),
+                                 (pfn << PAGE_SHIFT) + PAGE_SIZE);
                pte_val(entry) &= ~L_PTE_MT_MASK;
                pte_val(entry) |= shared_pte_mask;
                set_pte_at(vma->vm_mm, address, pte, entry);
diff --git a/arch/arm/plat-mxc/include/mach/mmc.h b/arch/arm/plat-mxc/include/mach/mmc.h
new file mode 100644 (file)
index 0000000..de2128d
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef ASMARM_ARCH_MMC_H
+#define ASMARM_ARCH_MMC_H
+
+#include <linux/mmc/host.h>
+
+struct device;
+
+/* board specific SDHC data, optional.
+ * If not present, a writable card with 3,3V is assumed.
+ */
+struct imxmmc_platform_data {
+       /* Return values for the get_ro callback should be:
+        *   0 for a read/write card
+        *   1 for a read-only card
+        *   -ENOSYS when not supported (equal to NULL callback)
+        *   or a negative errno value when something bad happened
+        */
+       int (*get_ro)(struct device *);
+
+       /* board specific hook to (de)initialize the SD slot.
+        * The board code can call 'handler' on a card detection
+        * change giving data as argument.
+        */
+       int (*init)(struct device *dev, irq_handler_t handler, void *data);
+       void (*exit)(struct device *dev, void *data);
+
+       /* available voltages. If not given, assume
+        * MMC_VDD_32_33 | MMC_VDD_33_34
+        */
+       unsigned int ocr_avail;
+
+       /* adjust slot voltage */
+       void (*setpower)(struct device *, unsigned int vdd);
+};
+
+#endif
index dd836e2dbf8c89c20717810a56fb9c7b9ee56794..6b742a8ee4e53be2125c75ac231cd2840f9f9ca1 100644 (file)
@@ -199,19 +199,14 @@ void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
 /*
  * Register MMC devices. Called from mach-omap1 and mach-omap2 device init.
  */
-int __init omap_mmc_add(int id, unsigned long base, unsigned long size,
-               unsigned int irq, struct omap_mmc_platform_data *data)
+int __init omap_mmc_add(const char *name, int id, unsigned long base,
+                               unsigned long size, unsigned int irq,
+                               struct omap_mmc_platform_data *data)
 {
        struct platform_device *pdev;
        struct resource res[OMAP_MMC_NR_RES];
-       char *name;
        int ret;
 
-       if (cpu_class_is_omap1() || cpu_is_omap242x())
-               name = "mmci-omap";
-       else
-               name = "mmci-omap-hs";
-
        pdev = platform_device_alloc(name, id);
        if (!pdev)
                return -ENOMEM;
index dae1920e1126dfe3c47a62d267764c4bc94daf16..4435bd434e179b995adfbec2944ac24436aa6119 100644 (file)
@@ -117,8 +117,9 @@ void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
                                int nr_controllers);
 void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
                                int nr_controllers);
-int omap_mmc_add(int id, unsigned long base, unsigned long size,
-                       unsigned int irq, struct omap_mmc_platform_data *data);
+int omap_mmc_add(const char *name, int id, unsigned long base,
+                               unsigned long size, unsigned int irq,
+                               struct omap_mmc_platform_data *data);
 #else
 static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
                                int nr_controllers)
@@ -128,8 +129,9 @@ static inline void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
                                int nr_controllers)
 {
 }
-static inline int omap_mmc_add(int id, unsigned long base, unsigned long size,
-               unsigned int irq, struct omap_mmc_platform_data *data)
+static inline int omap_mmc_add(const char *name, int id, unsigned long base,
+                               unsigned long size, unsigned int irq,
+                               struct omap_mmc_platform_data *data)
 {
        return 0;
 }
index a949c4fbbddd4cb428c5cd21fd9a9557db9a5eb4..8f1f97d56e1ecfec191b185350e7f374cd0df00b 100644 (file)
@@ -169,26 +169,51 @@ config BF542
        help
          BF542 Processor Support.
 
+config BF542M
+       bool "BF542m"
+       help
+         BF542 Processor Support.
+
 config BF544
        bool "BF544"
        help
          BF544 Processor Support.
 
+config BF544M
+       bool "BF544m"
+       help
+         BF544 Processor Support.
+
 config BF547
        bool "BF547"
        help
          BF547 Processor Support.
 
+config BF547M
+       bool "BF547m"
+       help
+         BF547 Processor Support.
+
 config BF548
        bool "BF548"
        help
          BF548 Processor Support.
 
+config BF548M
+       bool "BF548m"
+       help
+         BF548 Processor Support.
+
 config BF549
        bool "BF549"
        help
          BF549 Processor Support.
 
+config BF549M
+       bool "BF549m"
+       help
+         BF549 Processor Support.
+
 config BF561
        bool "BF561"
        help
@@ -224,39 +249,39 @@ config TICK_SOURCE_SYSTMR0
 
 config BF_REV_MIN
        int
-       default 0 if (BF51x || BF52x || BF54x)
+       default 0 if (BF51x || BF52x || (BF54x && !BF54xM))
        default 2 if (BF537 || BF536 || BF534)
-       default 3 if (BF561 ||BF533 || BF532 || BF531)
+       default 3 if (BF561 || BF533 || BF532 || BF531 || BF54xM)
        default 4 if (BF538 || BF539)
 
 config BF_REV_MAX
        int
-       default 2 if (BF51x || BF52x || BF54x)
-       default 3 if (BF537 || BF536 || BF534)
+       default 2 if (BF51x || BF52x || (BF54x && !BF54xM))
+       default 3 if (BF537 || BF536 || BF534 || BF54xM)
        default 5 if (BF561 || BF538 || BF539)
        default 6 if (BF533 || BF532 || BF531)
 
 choice
        prompt "Silicon Rev"
-       default BF_REV_0_1 if (BF51x || BF52x || BF54x)
+       default BF_REV_0_1 if (BF51x || BF52x || (BF54x && !BF54xM))
        default BF_REV_0_2 if (BF534 || BF536 || BF537)
-       default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF561)
+       default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF54xM || BF561)
 
 config BF_REV_0_0
        bool "0.0"
-       depends on (BF51x || BF52x || BF54x)
+       depends on (BF51x || BF52x || (BF54x && !BF54xM))
 
 config BF_REV_0_1
        bool "0.1"
-       depends on (BF52x || BF54x)
+       depends on (BF52x || (BF54x && !BF54xM))
 
 config BF_REV_0_2
        bool "0.2"
-       depends on (BF52x || BF537 || BF536 || BF534 || BF54x)
+       depends on (BF52x || BF537 || BF536 || BF534 || (BF54x && !BF54xM))
 
 config BF_REV_0_3
        bool "0.3"
-       depends on (BF561 || BF537 || BF536 || BF534 || BF533 || BF532 || BF531)
+       depends on (BF54xM || BF561 || BF537 || BF536 || BF534 || BF533 || BF532 || BF531)
 
 config BF_REV_0_4
        bool "0.4"
@@ -293,9 +318,14 @@ config BF53x
        depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537)
        default y
 
+config BF54xM
+       bool
+       depends on (BF542M || BF544M || BF547M || BF548M || BF549M)
+       default y
+
 config BF54x
        bool
-       depends on (BF542 || BF544 || BF547 || BF548 || BF549)
+       depends on (BF542 || BF544 || BF547 || BF548 || BF549 || BF54xM)
        default y
 
 config MEM_GENERIC_BOARD
index e550c8d460669ed2c96e0b97ec4c13ee2edb2f81..d54c8283825c429c3573209f1343259c6baaac95 100644 (file)
@@ -21,57 +21,67 @@ KALLSYMS         += --symbol-prefix=_
 KBUILD_DEFCONFIG := BF537-STAMP_defconfig
 
 # setup the machine name and the machine dependent settings
-machine-$(CONFIG_BF512) := bf518
-machine-$(CONFIG_BF514) := bf518
-machine-$(CONFIG_BF516) := bf518
-machine-$(CONFIG_BF518) := bf518
-machine-$(CONFIG_BF522) := bf527
-machine-$(CONFIG_BF523) := bf527
-machine-$(CONFIG_BF524) := bf527
-machine-$(CONFIG_BF525) := bf527
-machine-$(CONFIG_BF526) := bf527
-machine-$(CONFIG_BF527) := bf527
-machine-$(CONFIG_BF531) := bf533
-machine-$(CONFIG_BF532) := bf533
-machine-$(CONFIG_BF533) := bf533
-machine-$(CONFIG_BF534) := bf537
-machine-$(CONFIG_BF536) := bf537
-machine-$(CONFIG_BF537) := bf537
-machine-$(CONFIG_BF538) := bf538
-machine-$(CONFIG_BF539) := bf538
-machine-$(CONFIG_BF542) := bf548
-machine-$(CONFIG_BF544) := bf548
-machine-$(CONFIG_BF547) := bf548
-machine-$(CONFIG_BF548) := bf548
-machine-$(CONFIG_BF549) := bf548
-machine-$(CONFIG_BF561) := bf561
+machine-$(CONFIG_BF512)  := bf518
+machine-$(CONFIG_BF514)  := bf518
+machine-$(CONFIG_BF516)  := bf518
+machine-$(CONFIG_BF518)  := bf518
+machine-$(CONFIG_BF522)  := bf527
+machine-$(CONFIG_BF523)  := bf527
+machine-$(CONFIG_BF524)  := bf527
+machine-$(CONFIG_BF525)  := bf527
+machine-$(CONFIG_BF526)  := bf527
+machine-$(CONFIG_BF527)  := bf527
+machine-$(CONFIG_BF531)  := bf533
+machine-$(CONFIG_BF532)  := bf533
+machine-$(CONFIG_BF533)  := bf533
+machine-$(CONFIG_BF534)  := bf537
+machine-$(CONFIG_BF536)  := bf537
+machine-$(CONFIG_BF537)  := bf537
+machine-$(CONFIG_BF538)  := bf538
+machine-$(CONFIG_BF539)  := bf538
+machine-$(CONFIG_BF542)  := bf548
+machine-$(CONFIG_BF542M) := bf548
+machine-$(CONFIG_BF544)  := bf548
+machine-$(CONFIG_BF544M) := bf548
+machine-$(CONFIG_BF547)  := bf548
+machine-$(CONFIG_BF547M) := bf548
+machine-$(CONFIG_BF548)  := bf548
+machine-$(CONFIG_BF548M) := bf548
+machine-$(CONFIG_BF549)  := bf548
+machine-$(CONFIG_BF549M) := bf548
+machine-$(CONFIG_BF561)  := bf561
 MACHINE := $(machine-y)
 export MACHINE
 
-cpu-$(CONFIG_BF512) := bf512
-cpu-$(CONFIG_BF514) := bf514
-cpu-$(CONFIG_BF516) := bf516
-cpu-$(CONFIG_BF518) := bf518
-cpu-$(CONFIG_BF522) := bf522
-cpu-$(CONFIG_BF523) := bf523
-cpu-$(CONFIG_BF524) := bf524
-cpu-$(CONFIG_BF525) := bf525
-cpu-$(CONFIG_BF526) := bf526
-cpu-$(CONFIG_BF527) := bf527
-cpu-$(CONFIG_BF531) := bf531
-cpu-$(CONFIG_BF532) := bf532
-cpu-$(CONFIG_BF533) := bf533
-cpu-$(CONFIG_BF534) := bf534
-cpu-$(CONFIG_BF536) := bf536
-cpu-$(CONFIG_BF537) := bf537
-cpu-$(CONFIG_BF538) := bf538
-cpu-$(CONFIG_BF539) := bf539
-cpu-$(CONFIG_BF542) := bf542
-cpu-$(CONFIG_BF544) := bf544
-cpu-$(CONFIG_BF547) := bf547
-cpu-$(CONFIG_BF548) := bf548
-cpu-$(CONFIG_BF549) := bf549
-cpu-$(CONFIG_BF561) := bf561
+cpu-$(CONFIG_BF512)  := bf512
+cpu-$(CONFIG_BF514)  := bf514
+cpu-$(CONFIG_BF516)  := bf516
+cpu-$(CONFIG_BF518)  := bf518
+cpu-$(CONFIG_BF522)  := bf522
+cpu-$(CONFIG_BF523)  := bf523
+cpu-$(CONFIG_BF524)  := bf524
+cpu-$(CONFIG_BF525)  := bf525
+cpu-$(CONFIG_BF526)  := bf526
+cpu-$(CONFIG_BF527)  := bf527
+cpu-$(CONFIG_BF531)  := bf531
+cpu-$(CONFIG_BF532)  := bf532
+cpu-$(CONFIG_BF533)  := bf533
+cpu-$(CONFIG_BF534)  := bf534
+cpu-$(CONFIG_BF536)  := bf536
+cpu-$(CONFIG_BF537)  := bf537
+cpu-$(CONFIG_BF538)  := bf538
+cpu-$(CONFIG_BF539)  := bf539
+cpu-$(CONFIG_BF542)  := bf542
+cpu-$(CONFIG_BF542M) := bf542m
+cpu-$(CONFIG_BF544)  := bf544
+cpu-$(CONFIG_BF544M) := bf544m
+cpu-$(CONFIG_BF547)  := bf547
+cpu-$(CONFIG_BF547M) := bf547m
+cpu-$(CONFIG_BF548)  := bf548
+cpu-$(CONFIG_BF548M) := bf548m
+cpu-$(CONFIG_BF549)  := bf549
+cpu-$(CONFIG_BF549M) := bf549m
+cpu-$(CONFIG_BF561)  := bf561
 
 rev-$(CONFIG_BF_REV_0_0)  := 0.0
 rev-$(CONFIG_BF_REV_0_1)  := 0.1
index defb9785c65b961d893ced60ad668c7d07f216d8..4fdb9e04759f779abdcfaa6d6ee2e932a7e41ca7 100644 (file)
@@ -1,6 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.28-rc2
+# Fri Jan  9 17:58:41 2009
 #
 # CONFIG_MMU is not set
 # CONFIG_FPU is not set
@@ -149,6 +150,7 @@ CONFIG_BF_REV_0_0=y
 # CONFIG_BF_REV_ANY is not set
 # CONFIG_BF_REV_NONE is not set
 CONFIG_BF51x=y
+CONFIG_MEM_MT48LC32M8A2_75=y
 CONFIG_BFIN518F_EZBRD=y
 
 #
@@ -598,7 +600,10 @@ CONFIG_PHYLIB=y
 # CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
 CONFIG_MII=y
-# CONFIG_BFIN_MAC is not set
+CONFIG_BFIN_MAC=y
+CONFIG_BFIN_TX_DESC_NUM=10
+CONFIG_BFIN_RX_DESC_NUM=20
+# CONFIG_BFIN_MAC_RMII is not set
 # CONFIG_SMC91X is not set
 # CONFIG_SMSC911X is not set
 # CONFIG_DM9000 is not set
@@ -679,7 +684,7 @@ CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 # CONFIG_VT_HW_CONSOLE_BINDING is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index 992424ff31538f3b8449e9ba9738373a23545352..8e2b855b8db7825aafceb95711c57b7acc81f785 100644 (file)
@@ -723,7 +723,7 @@ CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 # CONFIG_VT_HW_CONSOLE_BINDING is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index 21e3c1af55bad24649f02cb4863434b5bd5f0a53..833128b3972496931aaa2028751bfaab52d8ba2b 100644 (file)
@@ -767,7 +767,7 @@ CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 # CONFIG_VT_HW_CONSOLE_BINDING is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index 0bdf20a1af6134a777a6fb6b549b126eabe8d387..334c94b51c402fb11af7e25be76d9b27f40f1c99 100644 (file)
@@ -672,7 +672,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
 CONFIG_SIMPLE_GPIO=m
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index 2f747d6e97e2dec3064cea3e5e763c898ffcc5a6..9d733436e3009ed0e8fbdb0eeb53a1a051156bd2 100644 (file)
@@ -679,7 +679,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
 CONFIG_SIMPLE_GPIO=m
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index 8b0a81294e652000d9ad251869a08975fd52a501..4fb4108d310322fbc9b82dc0e02d51a5fc461d67 100644 (file)
@@ -722,7 +722,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
 CONFIG_SIMPLE_GPIO=m
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index a1f766bf7d9b9243fd038c12a6e71597f5fa853f..cb32f5624a1b5b859bfbd23ed0f352fa99030a71 100644 (file)
@@ -726,7 +726,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
 CONFIG_SIMPLE_GPIO=m
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index cd2da6b7692c73c04dd969245c83287f568ce9c8..0f8697618aa5605f29e52774e7db0d3bde4fb37a 100644 (file)
@@ -856,7 +856,7 @@ CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 # CONFIG_VT_HW_CONSOLE_BINDING is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index b398ca202dbd8b44f0d4aa3a5986fce579bc82ce..042c7adfccfa994e42baba76eed0a56c081be836 100644 (file)
@@ -709,7 +709,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
 CONFIG_SIMPLE_GPIO=m
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index 95146948166f4a259800abbb6142673352b8a2d3..865ed85a5760e4ce27ac4d848c074fe8865dca6a 100644 (file)
@@ -1,7 +1,6 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.24.7
-# Fri Jul 18 18:00:41 2008
+# Linux kernel version: 2.6.28
 #
 # CONFIG_MMU is not set
 # CONFIG_FPU is not set
@@ -9,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
 CONFIG_BLACKFIN=y
 CONFIG_ZONE_DMA=y
-CONFIG_SEMAPHORE_SLEEPERS=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_HARDIRQS=y
@@ -32,18 +30,16 @@ CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_USER_NS is not set
-# CONFIG_PID_NS is not set
 # CONFIG_AUDIT is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_CGROUPS is not set
-CONFIG_FAIR_GROUP_SCHED=y
-CONFIG_FAIR_USER_SCHED=y
-# CONFIG_FAIR_CGROUP_SCHED is not set
-# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_GROUP_SCHED is not set
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -52,26 +48,35 @@ CONFIG_EMBEDDED=y
 CONFIG_UID16=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 # CONFIG_ELF_CORE is not set
+CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
+CONFIG_AIO=y
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_SLAB=y
 # CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+# CONFIG_MARKERS is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
 CONFIG_TINY_SHMEM=y
 CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
@@ -82,6 +87,7 @@ CONFIG_BLOCK=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -95,9 +101,11 @@ CONFIG_IOSCHED_CFQ=y
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+CONFIG_CLASSIC_RCU=y
 # CONFIG_PREEMPT_NONE is not set
 CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_PREEMPT is not set
+# CONFIG_FREEZER is not set
 
 #
 # Blackfin Processor Options
@@ -106,6 +114,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
 #
 # Processor and Board Settings
 #
+# CONFIG_BF512 is not set
+# CONFIG_BF514 is not set
+# CONFIG_BF516 is not set
+# CONFIG_BF518 is not set
 # CONFIG_BF522 is not set
 # CONFIG_BF523 is not set
 # CONFIG_BF524 is not set
@@ -118,48 +130,32 @@ CONFIG_BF527=y
 # CONFIG_BF534 is not set
 # CONFIG_BF536 is not set
 # CONFIG_BF537 is not set
+# CONFIG_BF538 is not set
+# CONFIG_BF539 is not set
 # CONFIG_BF542 is not set
+# CONFIG_BF542M is not set
 # CONFIG_BF544 is not set
+# CONFIG_BF544M is not set
 # CONFIG_BF547 is not set
+# CONFIG_BF547M is not set
 # CONFIG_BF548 is not set
+# CONFIG_BF548M is not set
 # CONFIG_BF549 is not set
+# CONFIG_BF549M is not set
 # CONFIG_BF561 is not set
+CONFIG_BF_REV_MIN=0
+CONFIG_BF_REV_MAX=2
 # CONFIG_BF_REV_0_0 is not set
 CONFIG_BF_REV_0_1=y
 # CONFIG_BF_REV_0_2 is not set
 # CONFIG_BF_REV_0_3 is not set
 # CONFIG_BF_REV_0_4 is not set
 # CONFIG_BF_REV_0_5 is not set
+# CONFIG_BF_REV_0_6 is not set
 # CONFIG_BF_REV_ANY is not set
 # CONFIG_BF_REV_NONE is not set
 CONFIG_BF52x=y
 CONFIG_MEM_MT48LC16M16A2TG_75=y
-# CONFIG_BFIN527_EZKIT is not set
-CONFIG_BFIN527_BLUETECHNIX_CM=y
-
-#
-# BF527 Specific Configuration
-#
-
-#
-# Alternative Multiplexing Scheme
-#
-# CONFIG_BF527_SPORT0_PORTF is not set
-CONFIG_BF527_SPORT0_PORTG=y
-CONFIG_BF527_SPORT0_TSCLK_PG10=y
-# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set
-CONFIG_BF527_UART1_PORTF=y
-# CONFIG_BF527_UART1_PORTG is not set
-# CONFIG_BF527_NAND_D_PORTF is not set
-CONFIG_BF527_NAND_D_PORTH=y
-
-#
-# Interrupt Priority Assignment
-#
-
-#
-# Priority
-#
 CONFIG_IRQ_PLL_WAKEUP=7
 CONFIG_IRQ_DMA0_ERROR=7
 CONFIG_IRQ_DMAR0_BLK=7
@@ -179,7 +175,6 @@ CONFIG_IRQ_SPORT0_TX=9
 CONFIG_IRQ_SPORT1_RX=9
 CONFIG_IRQ_SPORT1_TX=9
 CONFIG_IRQ_TWI=10
-CONFIG_IRQ_SPI=10
 CONFIG_IRQ_UART0_RX=10
 CONFIG_IRQ_UART0_TX=10
 CONFIG_IRQ_UART1_RX=10
@@ -205,6 +200,34 @@ CONFIG_IRQ_MEM_DMA1=13
 CONFIG_IRQ_WATCH=13
 CONFIG_IRQ_PORTF_INTA=13
 CONFIG_IRQ_PORTF_INTB=13
+# CONFIG_BFIN527_EZKIT is not set
+CONFIG_BFIN527_BLUETECHNIX_CM=y
+# CONFIG_BFIN526_EZBRD is not set
+
+#
+# BF527 Specific Configuration
+#
+
+#
+# Alternative Multiplexing Scheme
+#
+# CONFIG_BF527_SPORT0_PORTF is not set
+CONFIG_BF527_SPORT0_PORTG=y
+CONFIG_BF527_SPORT0_TSCLK_PG10=y
+# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set
+CONFIG_BF527_UART1_PORTF=y
+# CONFIG_BF527_UART1_PORTG is not set
+# CONFIG_BF527_NAND_D_PORTF is not set
+CONFIG_BF527_NAND_D_PORTH=y
+
+#
+# Interrupt Priority Assignment
+#
+
+#
+# Priority
+#
+CONFIG_IRQ_SPI=10
 CONFIG_IRQ_SPI_ERROR=7
 CONFIG_IRQ_NFC_ERROR=7
 CONFIG_IRQ_HDMA_ERROR=7
@@ -226,7 +249,6 @@ CONFIG_BOOT_LOAD=0x1000
 #
 CONFIG_CLKIN_HZ=25000000
 # CONFIG_BFIN_KERNEL_CLOCK is not set
-CONFIG_MAX_MEM_SIZE=512
 CONFIG_MAX_VCO_HZ=600000000
 CONFIG_MIN_VCO_HZ=50000000
 CONFIG_MAX_SCLK_HZ=133333333
@@ -240,10 +262,10 @@ CONFIG_HZ_250=y
 # CONFIG_HZ_300 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=250
+# CONFIG_SCHED_HRTICK is not set
 CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 # CONFIG_CYCLES_CLOCKSOURCE is not set
-# CONFIG_TICK_ONESHOT is not set
 # CONFIG_NO_HZ is not set
 # CONFIG_HIGH_RES_TIMERS is not set
 CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
@@ -277,6 +299,12 @@ CONFIG_ACCESS_OK_L1=y
 CONFIG_CACHELINE_ALIGNED_L1=y
 # CONFIG_SYSCALL_TAB_L1 is not set
 # CONFIG_CPLB_SWITCH_TAB_L1 is not set
+CONFIG_APP_STACK_L1=y
+
+#
+# Speed Optimizations
+#
+CONFIG_BFIN_INS_LOWOVERHEAD=y
 CONFIG_RAMKERNEL=y
 # CONFIG_ROMKERNEL is not set
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -285,10 +313,10 @@ CONFIG_FLATMEM_MANUAL=y
 # CONFIG_SPARSEMEM_MANUAL is not set
 CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
-# CONFIG_SPARSEMEM_STATIC is not set
-# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
+# CONFIG_PHYS_ADDR_T_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_VIRT_TO_BUS=y
 CONFIG_BFIN_GPTIMERS=y
@@ -334,7 +362,6 @@ CONFIG_BANK_3=0xFFC0
 #
 # Bus options (PCI, PCMCIA, EISA, MCA, ISA)
 #
-# CONFIG_PCI is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set
 # CONFIG_PCCARD is not set
 
@@ -345,25 +372,20 @@ CONFIG_BINFMT_ELF_FDPIC=y
 CONFIG_BINFMT_FLAT=y
 CONFIG_BINFMT_ZFLAT=y
 # CONFIG_BINFMT_SHARED_FLAT is not set
+# CONFIG_HAVE_AOUT is not set
 # CONFIG_BINFMT_MISC is not set
 
 #
 # Power management options
 #
 # CONFIG_PM is not set
-CONFIG_SUSPEND_UP_POSSIBLE=y
-# CONFIG_PM_BFIN_SLEEP_DEEPER is not set
-# CONFIG_PM_BFIN_SLEEP is not set
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PM_WAKEUP_BY_GPIO is not set
 
 #
 # CPU Frequency scaling
 #
 # CONFIG_CPU_FREQ is not set
-
-#
-# Networking
-#
 CONFIG_NET=y
 
 #
@@ -376,6 +398,7 @@ CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
 # CONFIG_XFRM_SUB_POLICY is not set
 # CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
 # CONFIG_NET_KEY is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
@@ -405,8 +428,6 @@ CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_TCP_MD5SIG is not set
 # CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
 # CONFIG_NETLABEL is not set
 # CONFIG_NETWORK_SECMARK is not set
 # CONFIG_NETFILTER is not set
@@ -415,6 +436,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
@@ -431,14 +453,14 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-
-#
-# Wireless
-#
+# CONFIG_PHONET is not set
+CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
+CONFIG_WIRELESS_OLD_REGULATORY=y
 # CONFIG_WIRELESS_EXT is not set
 # CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
@@ -456,6 +478,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
 # CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
@@ -464,6 +488,7 @@ CONFIG_MTD=y
 CONFIG_MTD_PARTITIONS=y
 # CONFIG_MTD_REDBOOT_PARTS is not set
 # CONFIG_MTD_CMDLINE_PARTS is not set
+# CONFIG_MTD_AR7_PARTS is not set
 
 #
 # User Modules And Translation Layers
@@ -507,6 +532,7 @@ CONFIG_MTD_ROM=m
 #
 CONFIG_MTD_COMPLEX_MAPPINGS=y
 # CONFIG_MTD_PHYSMAP is not set
+# CONFIG_MTD_GPIO_ADDR is not set
 # CONFIG_MTD_UCLINUX is not set
 # CONFIG_MTD_PLATRAM is not set
 
@@ -542,10 +568,12 @@ CONFIG_BLK_DEV=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
-CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
+# CONFIG_BLK_DEV_XIP is not set
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
 # CONFIG_MISC_DEVICES is not set
+CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
 #
@@ -558,7 +586,6 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -579,6 +606,7 @@ CONFIG_PHYLIB=y
 # CONFIG_SMSC_PHY is not set
 # CONFIG_BROADCOM_PHY is not set
 # CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
 # CONFIG_FIXED_PHY is not set
 # CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
@@ -591,11 +619,14 @@ CONFIG_BFIN_MAC_RMII=y
 # CONFIG_SMC91X is not set
 # CONFIG_SMSC911X is not set
 # CONFIG_DM9000 is not set
+# CONFIG_ENC28J60 is not set
 # CONFIG_IBM_NEW_EMAC_ZMII is not set
 # CONFIG_IBM_NEW_EMAC_RGMII is not set
 # CONFIG_IBM_NEW_EMAC_TAH is not set
 # CONFIG_IBM_NEW_EMAC_EMAC4 is not set
-# CONFIG_B44 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 
@@ -604,6 +635,7 @@ CONFIG_BFIN_MAC_RMII=y
 #
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
 
 #
 # USB Network Adapters
@@ -616,7 +648,6 @@ CONFIG_BFIN_MAC_RMII=y
 # CONFIG_WAN is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
-# CONFIG_SHAPER is not set
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
@@ -642,14 +673,15 @@ CONFIG_BFIN_MAC_RMII=y
 # CONFIG_BF5xx_PPIFCD is not set
 # CONFIG_BFIN_SIMPLE_TIMER is not set
 # CONFIG_BF5xx_PPI is not set
-CONFIG_BFIN_OTP=y
-# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
+# CONFIG_BF5xx_EPPI is not set
 # CONFIG_BFIN_SPORT is not set
 # CONFIG_BFIN_TIMER_LATENCY is not set
 # CONFIG_TWI_LCD is not set
+CONFIG_BFIN_DMA_INTERFACE=m
 CONFIG_SIMPLE_GPIO=m
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
+# CONFIG_BFIN_JTAG_COMM is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -673,6 +705,8 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_BFIN_SPORT is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_LEGACY_PTYS is not set
+CONFIG_BFIN_OTP=y
+# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
 
 #
 # CAN, the car bus and industrial fieldbus
@@ -680,44 +714,49 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_CAN4LINUX is not set
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
-# CONFIG_GEN_RTC is not set
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=m
+CONFIG_I2C_HELPER_AUTO=y
 
 #
-# I2C Algorithms
+# I2C Hardware Bus support
 #
-# CONFIG_I2C_ALGOBIT is not set
-# CONFIG_I2C_ALGOPCF is not set
-# CONFIG_I2C_ALGOPCA is not set
 
 #
-# I2C Hardware Bus support
+# I2C system bus drivers (mostly embedded / system-on-chip)
 #
 CONFIG_I2C_BLACKFIN_TWI=m
 CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
 # CONFIG_I2C_GPIO is not set
 # CONFIG_I2C_OCORES is not set
-# CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
-# CONFIG_I2C_STUB is not set
 # CONFIG_I2C_TINY_USB is not set
 
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_SENSORS_DS1337 is not set
-# CONFIG_SENSORS_DS1374 is not set
 # CONFIG_DS1682 is not set
+# CONFIG_AT24 is not set
 # CONFIG_SENSORS_AD5252 is not set
-# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_SENSORS_EEPROM is not set
 # CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_SENSORS_PCF8575 is not set
+# CONFIG_PCF8575 is not set
 # CONFIG_SENSORS_PCA9539 is not set
 # CONFIG_SENSORS_PCF8591 is not set
 # CONFIG_SENSORS_MAX6875 is not set
@@ -726,37 +765,41 @@ CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
 # CONFIG_I2C_DEBUG_ALGO is not set
 # CONFIG_I2C_DEBUG_BUS is not set
 # CONFIG_I2C_DEBUG_CHIP is not set
-
-#
-# SPI support
-#
 CONFIG_SPI=y
+# CONFIG_SPI_DEBUG is not set
 CONFIG_SPI_MASTER=y
 
 #
 # SPI Master Controller Drivers
 #
 CONFIG_SPI_BFIN=y
+# CONFIG_SPI_BFIN_LOCK is not set
 # CONFIG_SPI_BITBANG is not set
 
 #
 # SPI Protocol Masters
 #
-# CONFIG_EEPROM_AT25 is not set
+# CONFIG_SPI_AT25 is not set
 # CONFIG_SPI_SPIDEV is not set
 # CONFIG_SPI_TLE62X0 is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
 # CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
+# CONFIG_SENSORS_AD7414 is not set
 # CONFIG_SENSORS_AD7418 is not set
+# CONFIG_SENSORS_ADCXX is not set
 # CONFIG_SENSORS_ADM1021 is not set
 # CONFIG_SENSORS_ADM1025 is not set
 # CONFIG_SENSORS_ADM1026 is not set
 # CONFIG_SENSORS_ADM1029 is not set
 # CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ADM9240 is not set
+# CONFIG_SENSORS_ADT7462 is not set
 # CONFIG_SENSORS_ADT7470 is not set
+# CONFIG_SENSORS_ADT7473 is not set
 # CONFIG_SENSORS_ATXP1 is not set
 # CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_F71805F is not set
@@ -777,6 +820,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_LM92 is not set
 # CONFIG_SENSORS_LM93 is not set
+# CONFIG_SENSORS_MAX1111 is not set
 # CONFIG_SENSORS_MAX1619 is not set
 # CONFIG_SENSORS_MAX6650 is not set
 # CONFIG_SENSORS_PC87360 is not set
@@ -785,6 +829,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_SMSC47M1 is not set
 # CONFIG_SENSORS_SMSC47M192 is not set
 # CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_ADS7828 is not set
 # CONFIG_SENSORS_THMC50 is not set
 # CONFIG_SENSORS_VT1211 is not set
 # CONFIG_SENSORS_W83781D is not set
@@ -792,9 +837,12 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83792D is not set
 # CONFIG_SENSORS_W83793 is not set
 # CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
+# CONFIG_THERMAL is not set
+# CONFIG_THERMAL_HWMON is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
 
@@ -809,22 +857,32 @@ CONFIG_BFIN_WDT=y
 #
 # CONFIG_USBPCWATCHDOG is not set
 
-#
-# Sonics Silicon Backplane
-#
-CONFIG_SSB_POSSIBLE=y
-# CONFIG_SSB is not set
-
 #
 # Multifunction device drivers
 #
+# CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_REGULATOR is not set
 
 #
 # Multimedia devices
 #
+
+#
+# Multimedia core support
+#
 # CONFIG_VIDEO_DEV is not set
 # CONFIG_DVB_CORE is not set
+# CONFIG_VIDEO_MEDIA is not set
+
+#
+# Multimedia drivers
+#
 # CONFIG_DAB is not set
 
 #
@@ -839,10 +897,6 @@ CONFIG_SSB_POSSIBLE=y
 # Display device support
 #
 # CONFIG_DISPLAY_SUPPORT is not set
-
-#
-# Sound
-#
 # CONFIG_SOUND is not set
 CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
@@ -850,6 +904,7 @@ CONFIG_USB_ARCH_HAS_HCD=y
 # CONFIG_USB_ARCH_HAS_EHCI is not set
 CONFIG_USB=y
 # CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
 
 #
 # Miscellaneous USB options
@@ -860,40 +915,48 @@ CONFIG_USB_DEVICE_CLASS=y
 # CONFIG_USB_OTG is not set
 # CONFIG_USB_OTG_WHITELIST is not set
 CONFIG_USB_OTG_BLACKLIST_HUB=y
+CONFIG_USB_MON=y
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
 
 #
 # USB Host Controller Drivers
 #
+# CONFIG_USB_C67X00_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
-# CONFIG_USB_ISP1362_HCD is not set
 # CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
 # CONFIG_USB_SL811_HCD is not set
 # CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
 CONFIG_USB_MUSB_HDRC=y
 CONFIG_USB_MUSB_SOC=y
 
 #
-# Blackfin high speed USB support
+# Blackfin high speed USB Support
 #
 CONFIG_USB_MUSB_HOST=y
 # CONFIG_USB_MUSB_PERIPHERAL is not set
 # CONFIG_USB_MUSB_OTG is not set
 CONFIG_USB_MUSB_HDRC_HCD=y
 CONFIG_MUSB_PIO_ONLY=y
-CONFIG_USB_MUSB_LOGLEVEL=0
+CONFIG_MUSB_DMA_POLL=y
+# CONFIG_USB_MUSB_DEBUG is not set
 
 #
 # USB Device Class drivers
 #
 # CONFIG_USB_ACM is not set
 # CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
 #
 
 #
-# may also be needed; see USB_STORAGE Help for more information
+# see USB_STORAGE Help for more information
 #
 # CONFIG_USB_LIBUSUAL is not set
 
@@ -901,15 +964,10 @@ CONFIG_USB_MUSB_LOGLEVEL=0
 # USB Imaging devices
 #
 # CONFIG_USB_MDC800 is not set
-CONFIG_USB_MON=y
 
 #
 # USB port drivers
 #
-
-#
-# USB Serial Converter support
-#
 # CONFIG_USB_SERIAL is not set
 
 #
@@ -918,7 +976,7 @@ CONFIG_USB_MON=y
 # CONFIG_USB_EMI62 is not set
 # CONFIG_USB_EMI26 is not set
 # CONFIG_USB_ADUTUX is not set
-# CONFIG_USB_AUERSWALD is not set
+# CONFIG_USB_SEVSEG is not set
 # CONFIG_USB_RIO500 is not set
 # CONFIG_USB_LEGOTOWER is not set
 # CONFIG_USB_LCD is not set
@@ -934,17 +992,13 @@ CONFIG_USB_MON=y
 # CONFIG_USB_LD is not set
 # CONFIG_USB_TRANCEVIBRATOR is not set
 # CONFIG_USB_IOWARRIOR is not set
-
-#
-# USB DSL modem support
-#
-
-#
-# USB Gadget Support
-#
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
 # CONFIG_USB_GADGET is not set
 # CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
 # CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_HCTOSYS=y
@@ -973,51 +1027,59 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
 
 #
 # SPI RTC drivers
 #
-# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
+# CONFIG_RTC_DRV_DS1390 is not set
 # CONFIG_RTC_DRV_MAX6902 is not set
+# CONFIG_RTC_DRV_R9701 is not set
+# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_DS3234 is not set
 
 #
 # Platform RTC drivers
 #
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
 # CONFIG_RTC_DRV_DS1553 is not set
-# CONFIG_RTC_DRV_STK17TA8 is not set
 # CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
 # CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
 # on-CPU RTC drivers
 #
 CONFIG_RTC_DRV_BFIN=y
-
-#
-# Userspace I/O
-#
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
+# CONFIG_STAGING is not set
 
 #
 # File systems
 #
 # CONFIG_EXT2_FS is not set
 # CONFIG_EXT3_FS is not set
-# CONFIG_EXT4DEV_FS is not set
+# CONFIG_EXT4_FS is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
+CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
-# CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+# CONFIG_DNOTIFY is not set
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-# CONFIG_DNOTIFY is not set
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
@@ -1059,8 +1121,11 @@ CONFIG_SYSFS=y
 # CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
 CONFIG_NETWORK_FILESYSTEMS=y
@@ -1068,13 +1133,12 @@ CONFIG_NFS_FS=m
 CONFIG_NFS_V3=y
 # CONFIG_NFS_V3_ACL is not set
 # CONFIG_NFS_V4 is not set
-# CONFIG_NFS_DIRECTIO is not set
 # CONFIG_NFSD is not set
 CONFIG_LOCKD=m
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=m
-# CONFIG_SUNRPC_BIND34 is not set
+# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 CONFIG_SMB_FS=m
@@ -1130,7 +1194,6 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 is not set
 # CONFIG_DLM is not set
-# CONFIG_INSTRUMENTATION is not set
 
 #
 # Kernel hacking
@@ -1138,14 +1201,61 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_PRINTK_TIME is not set
 CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
 # CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_FRAME_POINTER is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_RCU_CPU_STALL_DETECTOR is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+
+#
+# Tracers
+#
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_BOOT_TRACER is not set
+# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
 # CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_DEBUG_STACKOVERFLOW is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_KGDB_TESTCASE is not set
+CONFIG_DEBUG_VERBOSE=y
 CONFIG_DEBUG_MMRS=y
+# CONFIG_DEBUG_HWERR is not set
+# CONFIG_DEBUG_DOUBLEFAULT is not set
 CONFIG_DEBUG_HUNT_FOR_ZERO=y
 CONFIG_DEBUG_BFIN_HWTRACE_ON=y
 CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
@@ -1154,7 +1264,7 @@ CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
 CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0
 # CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set
 # CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
-CONFIG_EARLY_PRINTK=y
+# CONFIG_EARLY_PRINTK is not set
 # CONFIG_CPLB_INFO is not set
 CONFIG_ACCESS_CHECK=y
 
@@ -1163,10 +1273,96 @@ CONFIG_ACCESS_CHECK=y
 #
 # CONFIG_KEYS is not set
 CONFIG_SECURITY=y
+# CONFIG_SECURITYFS is not set
 # CONFIG_SECURITY_NETWORK is not set
-# CONFIG_SECURITY_CAPABILITIES is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
 # CONFIG_SECURITY_ROOTPLUG is not set
-# CONFIG_CRYPTO is not set
+CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+# CONFIG_CRYPTO_FIPS is not set
+# CONFIG_CRYPTO_MANAGER is not set
+# CONFIG_CRYPTO_MANAGER2 is not set
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+# CONFIG_CRYPTO_CBC is not set
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+# CONFIG_CRYPTO_ECB is not set
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+# CONFIG_CRYPTO_HMAC is not set
+# CONFIG_CRYPTO_XCBC is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_MD4 is not set
+# CONFIG_CRYPTO_MD5 is not set
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+# CONFIG_CRYPTO_SHA1 is not set
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+# CONFIG_CRYPTO_AES is not set
+# CONFIG_CRYPTO_ANUBIS is not set
+# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+CONFIG_CRYPTO_HW=y
 
 #
 # Library routines
@@ -1174,6 +1370,7 @@ CONFIG_SECURITY=y
 CONFIG_BITREVERSE=y
 CONFIG_CRC_CCITT=m
 # CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
index f67289a0d8d2c5ccf3bb08bf427424e57f6cd736..793581fc955610f574f604ac7f214fadda47f06c 100644 (file)
@@ -63,23 +63,23 @@ static inline __wsum
 csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
                   unsigned short proto, __wsum sum)
 {
-
-       __asm__ ("%0 = %0 + %1;\n\t"
-                "CC = AC0;\n\t"
-                "if !CC jump 4;\n\t"
-                "%0 = %0 + %4;\n\t"
-                "%0 = %0 + %2;\n\t"
-                "CC = AC0;\n\t"
-                 "if !CC jump 4;\n\t"
-                 "%0 = %0 + %4;\n\t"
-                "%0 = %0 + %3;\n\t"
-                "CC = AC0;\n\t"
-                 "if !CC jump 4;\n\t"
-                 "%0 = %0 + %4;\n\t"
-                 "NOP;\n\t"
-                : "=d" (sum)
-                : "d" (daddr), "d" (saddr), "d" ((ntohs(len)<<16)+proto*256), "d" (1), "0"(sum)
-                : "CC");
+       unsigned int carry;
+
+       __asm__ ("%0 = %0 + %2;\n\t"
+               "CC = AC0;\n\t"
+               "%1 = CC;\n\t"
+               "%0 = %0 + %1;\n\t"
+               "%0 = %0 + %3;\n\t"
+               "CC = AC0;\n\t"
+               "%1 = CC;\n\t"
+               "%0 = %0 + %1;\n\t"
+               "%0 = %0 + %4;\n\t"
+               "CC = AC0;\n\t"
+               "%1 = CC;\n\t"
+               "%0 = %0 + %1;\n\t"
+               : "=d" (sum), "=&d" (carry)
+               : "d" (daddr), "d" (saddr), "d" ((len + proto) << 8), "0"(sum)
+               : "CC");
 
        return (sum);
 }
index 0889c3abb593c4683a62b973de0bd8bd75013d50..c31f91cc1d5dbd5cd0677ed007c002313a784109 100644 (file)
 
 static inline void __delay(unsigned long loops)
 {
-       if (ANOMALY_05000312) {
-               /* Interrupted loads to loop registers -> bad */
-               unsigned long tmp;
-               __asm__ __volatile__(
-                       "[--SP] = LC0;"
-                       "[--SP] = LT0;"
-                       "[--SP] = LB0;"
-                       "LSETUP (1f,1f) LC0 = %1;"
-                       "1: NOP;"
-                       /* We take advantage of the fact that LC0 is 0 at
-                        * the end of the loop.  Otherwise we'd need some
-                        * NOPs after the CLI here.
-                        */
-                       "CLI %0;"
-                       "LB0 = [SP++];"
-                       "LT0 = [SP++];"
-                       "LC0 = [SP++];"
-                       "STI %0;"
-                       : "=d" (tmp)
-                       : "a" (loops)
-               );
-       } else
-               __asm__ __volatile__ (
+__asm__ __volatile__ (
                        "LSETUP(1f, 1f) LC0 = %0;"
                        "1: NOP;"
                        :
@@ -47,16 +25,15 @@ static inline void __delay(unsigned long loops)
 #include <linux/param.h>       /* needed for HZ */
 
 /*
- * Use only for very small delays ( < 1 msec).  Should probably use a
- * lookup table, really, as the multiplications take much too long with
- * short delays.  This is a "reasonable" implementation, though (and the
- * first constant multiplications gets optimized away if the delay is
- * a constant)
+ * close approximation borrowed from m68knommu to avoid 64-bit math
  */
+
+#define        HZSCALE         (268435456 / (1000000/HZ))
+
 static inline void udelay(unsigned long usecs)
 {
        extern unsigned long loops_per_jiffy;
-       __delay(usecs * loops_per_jiffy / (1000000 / HZ));
+       __delay((((usecs * HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6);
 }
 
 #endif
index 9477d82fcad2b2451dd2948d6cfa01ba1aff06bd..d4a082ef75b472456f3f206b7d087ead9e2da39d 100644 (file)
  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-/*
-*  Number     BF537/6/4    BF561    BF533/2/1
-*             BF527/5/2
-*
-*  GPIO_0       PF0         PF0        PF0
-*  GPIO_1       PF1         PF1        PF1
-*  GPIO_2       PF2         PF2        PF2
-*  GPIO_3       PF3         PF3        PF3
-*  GPIO_4       PF4         PF4        PF4
-*  GPIO_5       PF5         PF5        PF5
-*  GPIO_6       PF6         PF6        PF6
-*  GPIO_7       PF7         PF7        PF7
-*  GPIO_8       PF8         PF8        PF8
-*  GPIO_9       PF9         PF9        PF9
-*  GPIO_10      PF10        PF10       PF10
-*  GPIO_11      PF11        PF11       PF11
-*  GPIO_12      PF12        PF12       PF12
-*  GPIO_13      PF13        PF13       PF13
-*  GPIO_14      PF14        PF14       PF14
-*  GPIO_15      PF15        PF15       PF15
-*  GPIO_16      PG0         PF16
-*  GPIO_17      PG1         PF17
-*  GPIO_18      PG2         PF18
-*  GPIO_19      PG3         PF19
-*  GPIO_20      PG4         PF20
-*  GPIO_21      PG5         PF21
-*  GPIO_22      PG6         PF22
-*  GPIO_23      PG7         PF23
-*  GPIO_24      PG8         PF24
-*  GPIO_25      PG9         PF25
-*  GPIO_26      PG10        PF26
-*  GPIO_27      PG11        PF27
-*  GPIO_28      PG12        PF28
-*  GPIO_29      PG13        PF29
-*  GPIO_30      PG14        PF30
-*  GPIO_31      PG15        PF31
-*  GPIO_32      PH0         PF32
-*  GPIO_33      PH1         PF33
-*  GPIO_34      PH2         PF34
-*  GPIO_35      PH3         PF35
-*  GPIO_36      PH4         PF36
-*  GPIO_37      PH5         PF37
-*  GPIO_38      PH6         PF38
-*  GPIO_39      PH7         PF39
-*  GPIO_40      PH8         PF40
-*  GPIO_41      PH9         PF41
-*  GPIO_42      PH10        PF42
-*  GPIO_43      PH11        PF43
-*  GPIO_44      PH12        PF44
-*  GPIO_45      PH13        PF45
-*  GPIO_46      PH14        PF46
-*  GPIO_47      PH15        PF47
-*/
-
 #ifndef __ARCH_BLACKFIN_GPIO_H__
 #define __ARCH_BLACKFIN_GPIO_H__
 
@@ -295,10 +241,6 @@ int bfin_gpio_direction_output(unsigned gpio, int value);
 int bfin_gpio_get_value(unsigned gpio);
 void bfin_gpio_set_value(unsigned gpio, int value);
 
-#ifndef BF548_FAMILY
-#define bfin_gpio_set_value(gpio, value)    set_gpio_data(gpio, value)
-#endif
-
 #ifdef CONFIG_GPIOLIB
 #include <asm-generic/gpio.h>          /* cansleep wrappers */
 
index 26ebac6646d879b61e7acb1759a81f4328d484c4..c8b256d2ea30ec6d86fdb3a353bc2cce3a2edf78 100644 (file)
@@ -1,32 +1,8 @@
-/*
- * File:         include/asm-blackfin/kgdb.h
- * Based on:
- * Author:       Sonic Zhang
- *
- * Created:
- * Description:
- *
- * Rev:          $Id: kgdb_bfin_linux-2.6.x.patch 4934 2007-02-13 09:32:11Z sonicz $
- *
- * Modified:
- *               Copyright 2005-2006 Analog Devices Inc.
- *
- * Bugs:         Enter bugs at http://blackfin.uclinux.org/
+/* Blackfin KGDB header
  *
- * 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.
+ * Copyright 2005-2009 Analog Devices Inc.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see the file COPYING, or write
- * to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ * Licensed under the GPL-2 or later.
  */
 
 #ifndef __ASM_BLACKFIN_KGDB_H__
 /* gdb locks */
 #define KGDB_MAX_NO_CPUS 8
 
-/************************************************************************/
-/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
-/* at least NUMREGBYTES*2 are needed for register packets */
-/* Longer buffer is needed to list all threads */
+/*
+ * BUFMAX defines the maximum number of characters in inbound/outbound buffers.
+ * At least NUMREGBYTES*2 are needed for register packets.
+ * Longer buffer is needed to list all threads.
+ */
 #define BUFMAX 2048
 
 /*
- *  Note that this register image is different from
- *  the register image that Linux produces at interrupt time.
- *  
- *  Linux's register image is defined by struct pt_regs in ptrace.h.
+ * Note that this register image is different from
+ * the register image that Linux produces at interrupt time.
+ *
+ * Linux's register image is defined by struct pt_regs in ptrace.h.
  */
 enum regnames {
   /* Core Registers */
@@ -104,14 +81,14 @@ enum regnames {
   BFIN_RETX,
   BFIN_RETN,
   BFIN_RETE,
-  
+
   /* Pseudo Registers */
   BFIN_PC,
   BFIN_CC,
   BFIN_EXTRA1,         /* Address of .text section.  */
   BFIN_EXTRA2,         /* Address of .data section.  */
   BFIN_EXTRA3,         /* Address of .bss section.  */
-  BFIN_FDPIC_EXEC, 
+  BFIN_FDPIC_EXEC,
   BFIN_FDPIC_INTERP,
 
   /* MMRs */
@@ -126,7 +103,7 @@ enum regnames {
 
 static inline void arch_kgdb_breakpoint(void)
 {
-       asm("   EXCPT 2;");
+       asm("EXCPT 2;");
 }
 #define BREAK_INSTR_SIZE       2
 #define CACHE_FLUSH_IS_SAFE    1
index 255a9316ad367e8c5e6b3793007e307033d59d4c..61f7487fbf12a6bd3e194030a8e35deccdd9d465 100644 (file)
 #define mem_SDRRC       (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num)
 
 /* Enable SCLK Out */
-#define mem_SDGCTL        (0x80000000 | SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS)
+#define mem_SDGCTL        (SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS)
 #else
 #define mem_SDRRC      CONFIG_MEM_SDRRC
 #define mem_SDGCTL     CONFIG_MEM_SDGCTL
index bd8d4a7efeb29720e0e4171c1359ba7740ffb08d..a67142740df0b4fa9592ec8c95c8df93dd0d5617 100644 (file)
@@ -59,6 +59,7 @@ struct blackfin_pda {                 /* Per-processor Data Area */
        unsigned long icplb_fault_addr;
        unsigned long retx;
        unsigned long seqstat;
+       unsigned int __nmi_count;       /* number of times NMI asserted on this CPU */
 };
 
 extern struct blackfin_pda cpu_pda[];
index 4856d62b7467af1bccad5a3817e5fa2cfc421dfb..ae1e36329bec7c71af865d8790eb2ff3a4e29af0 100644 (file)
@@ -15,6 +15,6 @@ extern void native_machine_halt(void);
 extern void native_machine_power_off(void);
 
 /* common reboot workarounds */
-extern void bfin_gpio_reset_spi0_ssel1(void);
+extern void bfin_reset_boot_spi_cs(unsigned short pin);
 
 #endif
index 38a233374f0720f2596cdfee29bc81147f03b20f..4a92a86824b7bd1d6164eae8d8dcb2ca08bbfd80 100644 (file)
@@ -15,6 +15,8 @@ else
     obj-y += time.o
 endif
 
+CFLAGS_kgdb_test.o := -mlong-calls -O0
+
 obj-$(CONFIG_IPIPE)                  += ipipe.o
 obj-$(CONFIG_IPIPE_TRACE_MCOUNT)     += mcount.o
 obj-$(CONFIG_BFIN_GPTIMERS)          += gptimers.o
index 07e02c0d1c07c17a8a3b232339644acb80810c4f..8531693fb48d8b5cddc10e60b13d3fc5f5b56275 100644 (file)
@@ -249,6 +249,13 @@ static void __dma_memcpy(u32 daddr, s16 dmod, u32 saddr, s16 smod, size_t cnt, u
 
        spin_lock_irqsave(&mdma_lock, flags);
 
+       /* Force a sync in case a previous config reset on this channel
+        * occurred.  This is needed so subsequent writes to DMA registers
+        * are not spuriously lost/corrupted.  Do it under irq lock and
+        * without the anomaly version (because we are atomic already).
+        */
+       __builtin_bfin_ssync();
+
        if (bfin_read_MDMA_S0_CONFIG())
                while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE))
                        continue;
index 4c14331978f6e369b70ea862632f4d913cc814f0..51dac55c524a486ed1a4c655e062d9f79a5db6f6 100644 (file)
  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-/*
-*  Number     BF537/6/4    BF561    BF533/2/1     BF549/8/4/2
-*
-*  GPIO_0       PF0         PF0        PF0        PA0...PJ13
-*  GPIO_1       PF1         PF1        PF1
-*  GPIO_2       PF2         PF2        PF2
-*  GPIO_3       PF3         PF3        PF3
-*  GPIO_4       PF4         PF4        PF4
-*  GPIO_5       PF5         PF5        PF5
-*  GPIO_6       PF6         PF6        PF6
-*  GPIO_7       PF7         PF7        PF7
-*  GPIO_8       PF8         PF8        PF8
-*  GPIO_9       PF9         PF9        PF9
-*  GPIO_10      PF10        PF10       PF10
-*  GPIO_11      PF11        PF11       PF11
-*  GPIO_12      PF12        PF12       PF12
-*  GPIO_13      PF13        PF13       PF13
-*  GPIO_14      PF14        PF14       PF14
-*  GPIO_15      PF15        PF15       PF15
-*  GPIO_16      PG0         PF16
-*  GPIO_17      PG1         PF17
-*  GPIO_18      PG2         PF18
-*  GPIO_19      PG3         PF19
-*  GPIO_20      PG4         PF20
-*  GPIO_21      PG5         PF21
-*  GPIO_22      PG6         PF22
-*  GPIO_23      PG7         PF23
-*  GPIO_24      PG8         PF24
-*  GPIO_25      PG9         PF25
-*  GPIO_26      PG10        PF26
-*  GPIO_27      PG11        PF27
-*  GPIO_28      PG12        PF28
-*  GPIO_29      PG13        PF29
-*  GPIO_30      PG14        PF30
-*  GPIO_31      PG15        PF31
-*  GPIO_32      PH0         PF32
-*  GPIO_33      PH1         PF33
-*  GPIO_34      PH2         PF34
-*  GPIO_35      PH3         PF35
-*  GPIO_36      PH4         PF36
-*  GPIO_37      PH5         PF37
-*  GPIO_38      PH6         PF38
-*  GPIO_39      PH7         PF39
-*  GPIO_40      PH8         PF40
-*  GPIO_41      PH9         PF41
-*  GPIO_42      PH10        PF42
-*  GPIO_43      PH11        PF43
-*  GPIO_44      PH12        PF44
-*  GPIO_45      PH13        PF45
-*  GPIO_46      PH14        PF46
-*  GPIO_47      PH15        PF47
-*/
-
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/err.h>
@@ -119,62 +66,61 @@ enum {
 #define AWA_DUMMY_READ(...)  do { } while (0)
 #endif
 
+static struct gpio_port_t * const gpio_array[] = {
 #if defined(BF533_FAMILY) || defined(BF538_FAMILY)
-static struct gpio_port_t *gpio_bankb[] = {
        (struct gpio_port_t *) FIO_FLAG_D,
-};
-#endif
-
-#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
-static struct gpio_port_t *gpio_bankb[] = {
+#elif defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
        (struct gpio_port_t *) PORTFIO,
        (struct gpio_port_t *) PORTGIO,
        (struct gpio_port_t *) PORTHIO,
+#elif defined(BF561_FAMILY)
+       (struct gpio_port_t *) FIO0_FLAG_D,
+       (struct gpio_port_t *) FIO1_FLAG_D,
+       (struct gpio_port_t *) FIO2_FLAG_D,
+#elif defined(BF548_FAMILY)
+       (struct gpio_port_t *)PORTA_FER,
+       (struct gpio_port_t *)PORTB_FER,
+       (struct gpio_port_t *)PORTC_FER,
+       (struct gpio_port_t *)PORTD_FER,
+       (struct gpio_port_t *)PORTE_FER,
+       (struct gpio_port_t *)PORTF_FER,
+       (struct gpio_port_t *)PORTG_FER,
+       (struct gpio_port_t *)PORTH_FER,
+       (struct gpio_port_t *)PORTI_FER,
+       (struct gpio_port_t *)PORTJ_FER,
+#else
+# error no gpio arrays defined
+#endif
 };
 
-static unsigned short *port_fer[] = {
+#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
+static unsigned short * const port_fer[] = {
        (unsigned short *) PORTF_FER,
        (unsigned short *) PORTG_FER,
        (unsigned short *) PORTH_FER,
 };
-#endif
 
-#if defined(BF527_FAMILY) || defined(BF518_FAMILY)
-static unsigned short *port_mux[] = {
+# if !defined(BF537_FAMILY)
+static unsigned short * const port_mux[] = {
        (unsigned short *) PORTF_MUX,
        (unsigned short *) PORTG_MUX,
        (unsigned short *) PORTH_MUX,
 };
 
 static const
-u8 pmux_offset[][16] =
-       {{ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 4, 6, 8, 8, 10, 10 }, /* PORTF */
-        { 0, 0, 0, 0, 0, 2, 2, 4, 4, 6, 8, 10, 10, 10, 12, 12 }, /* PORTG */
-        { 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 4, 4, 4, 4 }, /* PORTH */
-       };
-#endif
-
-#ifdef BF561_FAMILY
-static struct gpio_port_t *gpio_bankb[] = {
-       (struct gpio_port_t *) FIO0_FLAG_D,
-       (struct gpio_port_t *) FIO1_FLAG_D,
-       (struct gpio_port_t *) FIO2_FLAG_D,
+u8 pmux_offset[][16] = {
+#  if defined(BF527_FAMILY)
+       { 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 4, 6, 8, 8, 10, 10 }, /* PORTF */
+       { 0, 0, 0, 0, 0, 2, 2, 4, 4, 6, 8, 10, 10, 10, 12, 12 }, /* PORTG */
+       { 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 4, 4, 4, 4 }, /* PORTH */
+#  elif defined(BF518_FAMILY)
+       { 0, 2, 2, 2, 2, 2, 2, 4, 6, 6, 6, 8, 8, 8, 8, 10 }, /* PORTF */
+       { 0, 0, 0, 2, 4, 6, 6, 6, 8, 10, 10, 12, 14, 14, 14, 14 }, /* PORTG */
+       { 0, 0, 0, 0, 2, 2, 4, 6, 10, 10, 10, 10, 10, 10, 10, 10 }, /* PORTH */
+#  endif
 };
-#endif
+# endif
 
-#ifdef BF548_FAMILY
-static struct gpio_port_t *gpio_array[] = {
-       (struct gpio_port_t *)PORTA_FER,
-       (struct gpio_port_t *)PORTB_FER,
-       (struct gpio_port_t *)PORTC_FER,
-       (struct gpio_port_t *)PORTD_FER,
-       (struct gpio_port_t *)PORTE_FER,
-       (struct gpio_port_t *)PORTF_FER,
-       (struct gpio_port_t *)PORTG_FER,
-       (struct gpio_port_t *)PORTH_FER,
-       (struct gpio_port_t *)PORTI_FER,
-       (struct gpio_port_t *)PORTJ_FER,
-};
 #endif
 
 static unsigned short reserved_gpio_map[GPIO_BANK_NUM];
@@ -188,35 +134,9 @@ static struct str_ident {
 } str_ident[MAX_RESOURCES];
 
 #if defined(CONFIG_PM)
-#if defined(CONFIG_BF54x)
-static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM];
-#else
-static unsigned short wakeup_map[GPIO_BANK_NUM];
-static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS];
 static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM];
-
-#ifdef BF533_FAMILY
-static unsigned int sic_iwr_irqs[] = {IRQ_PROG_INTB};
-#endif
-
-#ifdef BF537_FAMILY
-static unsigned int sic_iwr_irqs[] = {IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX};
-#endif
-
-#ifdef BF538_FAMILY
-static unsigned int sic_iwr_irqs[] = {IRQ_PORTF_INTB};
 #endif
 
-#if defined(BF527_FAMILY) || defined(BF518_FAMILY)
-static unsigned int sic_iwr_irqs[] = {IRQ_PORTF_INTB, IRQ_PORTG_INTB, IRQ_PORTH_INTB};
-#endif
-
-#ifdef BF561_FAMILY
-static unsigned int sic_iwr_irqs[] = {IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB};
-#endif
-#endif
-#endif /* CONFIG_PM */
-
 inline int check_gpio(unsigned gpio)
 {
 #if defined(BF548_FAMILY)
@@ -330,9 +250,10 @@ static struct {
        {.res = P_SPI0_SSEL3, .offset = 0},
 };
 
-static void portmux_setup(unsigned short per, unsigned short function)
+static void portmux_setup(unsigned short per)
 {
        u16 y, offset, muxreg;
+       u16 function = P_FUNCT2MUX(per);
 
        for (y = 0; y < ARRAY_SIZE(port_mux_lut); y++) {
                if (port_mux_lut[y].res == per) {
@@ -353,30 +274,33 @@ static void portmux_setup(unsigned short per, unsigned short function)
        }
 }
 #elif defined(BF548_FAMILY)
-inline void portmux_setup(unsigned short portno, unsigned short function)
+inline void portmux_setup(unsigned short per)
 {
        u32 pmux;
+       u16 ident = P_IDENT(per);
+       u16 function = P_FUNCT2MUX(per);
 
-       pmux = gpio_array[gpio_bank(portno)]->port_mux;
+       pmux = gpio_array[gpio_bank(ident)]->port_mux;
 
-       pmux &= ~(0x3 << (2 * gpio_sub_n(portno)));
-       pmux |= (function & 0x3) << (2 * gpio_sub_n(portno));
+       pmux &= ~(0x3 << (2 * gpio_sub_n(ident)));
+       pmux |= (function & 0x3) << (2 * gpio_sub_n(ident));
 
-       gpio_array[gpio_bank(portno)]->port_mux = pmux;
+       gpio_array[gpio_bank(ident)]->port_mux = pmux;
 }
 
-inline u16 get_portmux(unsigned short portno)
+inline u16 get_portmux(unsigned short per)
 {
        u32 pmux;
+       u16 ident = P_IDENT(per);
 
-       pmux = gpio_array[gpio_bank(portno)]->port_mux;
+       pmux = gpio_array[gpio_bank(ident)]->port_mux;
 
-       return (pmux >> (2 * gpio_sub_n(portno)) & 0x3);
+       return (pmux >> (2 * gpio_sub_n(ident)) & 0x3);
 }
 #elif defined(BF527_FAMILY) || defined(BF518_FAMILY)
-inline void portmux_setup(unsigned short portno, unsigned short function)
+inline void portmux_setup(unsigned short per)
 {
-       u16 pmux, ident = P_IDENT(portno);
+       u16 pmux, ident = P_IDENT(per), function = P_FUNCT2MUX(per);
        u8 offset = pmux_offset[gpio_bank(ident)][gpio_sub_n(ident)];
 
        pmux = *port_mux[gpio_bank(ident)];
@@ -424,90 +348,71 @@ void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
        unsigned long flags; \
        local_irq_save_hw(flags); \
        if (arg) \
-               gpio_bankb[gpio_bank(gpio)]->name |= gpio_bit(gpio); \
+               gpio_array[gpio_bank(gpio)]->name |= gpio_bit(gpio); \
        else \
-               gpio_bankb[gpio_bank(gpio)]->name &= ~gpio_bit(gpio); \
+               gpio_array[gpio_bank(gpio)]->name &= ~gpio_bit(gpio); \
        AWA_DUMMY_READ(name); \
        local_irq_restore_hw(flags); \
 } \
 EXPORT_SYMBOL(set_gpio_ ## name);
 
-SET_GPIO(dir)
-SET_GPIO(inen)
-SET_GPIO(polar)
-SET_GPIO(edge)
-SET_GPIO(both)
+SET_GPIO(dir)   /* set_gpio_dir() */
+SET_GPIO(inen)  /* set_gpio_inen() */
+SET_GPIO(polar) /* set_gpio_polar() */
+SET_GPIO(edge)  /* set_gpio_edge() */
+SET_GPIO(both)  /* set_gpio_both() */
 
 
-#if ANOMALY_05000311 || ANOMALY_05000323
 #define SET_GPIO_SC(name) \
 void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
 { \
        unsigned long flags; \
-       local_irq_save_hw(flags); \
-       if (arg) \
-               gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
-       else \
-               gpio_bankb[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \
-       AWA_DUMMY_READ(name); \
-       local_irq_restore_hw(flags); \
-} \
-EXPORT_SYMBOL(set_gpio_ ## name);
-#else
-#define SET_GPIO_SC(name) \
-void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
-{ \
+       if (ANOMALY_05000311 || ANOMALY_05000323) \
+               local_irq_save_hw(flags); \
        if (arg) \
-               gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
+               gpio_array[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
        else \
-               gpio_bankb[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \
+               gpio_array[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \
+       if (ANOMALY_05000311 || ANOMALY_05000323) { \
+               AWA_DUMMY_READ(name); \
+               local_irq_restore_hw(flags); \
+       } \
 } \
 EXPORT_SYMBOL(set_gpio_ ## name);
-#endif
 
 SET_GPIO_SC(maska)
 SET_GPIO_SC(maskb)
 SET_GPIO_SC(data)
 
-#if ANOMALY_05000311 || ANOMALY_05000323
 void set_gpio_toggle(unsigned gpio)
 {
        unsigned long flags;
-       local_irq_save_hw(flags);
-       gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio);
-       AWA_DUMMY_READ(toggle);
-       local_irq_restore_hw(flags);
-}
-#else
-void set_gpio_toggle(unsigned gpio)
-{
-       gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio);
+       if (ANOMALY_05000311 || ANOMALY_05000323)
+               local_irq_save_hw(flags);
+       gpio_array[gpio_bank(gpio)]->toggle = gpio_bit(gpio);
+       if (ANOMALY_05000311 || ANOMALY_05000323) {
+               AWA_DUMMY_READ(toggle);
+               local_irq_restore_hw(flags);
+       }
 }
-#endif
 EXPORT_SYMBOL(set_gpio_toggle);
 
 
 /*Set current PORT date (16-bit word)*/
 
-#if ANOMALY_05000311 || ANOMALY_05000323
 #define SET_GPIO_P(name) \
 void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \
 { \
        unsigned long flags; \
-       local_irq_save_hw(flags); \
-       gpio_bankb[gpio_bank(gpio)]->name = arg; \
-       AWA_DUMMY_READ(name); \
-       local_irq_restore_hw(flags); \
+       if (ANOMALY_05000311 || ANOMALY_05000323) \
+               local_irq_save_hw(flags); \
+       gpio_array[gpio_bank(gpio)]->name = arg; \
+       if (ANOMALY_05000311 || ANOMALY_05000323) { \
+               AWA_DUMMY_READ(name); \
+               local_irq_restore_hw(flags); \
+       } \
 } \
 EXPORT_SYMBOL(set_gpiop_ ## name);
-#else
-#define SET_GPIO_P(name) \
-void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \
-{ \
-       gpio_bankb[gpio_bank(gpio)]->name = arg; \
-} \
-EXPORT_SYMBOL(set_gpiop_ ## name);
-#endif
 
 SET_GPIO_P(data)
 SET_GPIO_P(dir)
@@ -519,27 +424,21 @@ SET_GPIO_P(maska)
 SET_GPIO_P(maskb)
 
 /* Get a specific bit */
-#if ANOMALY_05000311 || ANOMALY_05000323
 #define GET_GPIO(name) \
 unsigned short get_gpio_ ## name(unsigned gpio) \
 { \
        unsigned long flags; \
        unsigned short ret; \
-       local_irq_save_hw(flags); \
-       ret = 0x01 & (gpio_bankb[gpio_bank(gpio)]->name >> gpio_sub_n(gpio)); \
-       AWA_DUMMY_READ(name); \
-       local_irq_restore_hw(flags); \
+       if (ANOMALY_05000311 || ANOMALY_05000323) \
+               local_irq_save_hw(flags); \
+       ret = 0x01 & (gpio_array[gpio_bank(gpio)]->name >> gpio_sub_n(gpio)); \
+       if (ANOMALY_05000311 || ANOMALY_05000323) { \
+               AWA_DUMMY_READ(name); \
+               local_irq_restore_hw(flags); \
+       } \
        return ret; \
 } \
 EXPORT_SYMBOL(get_gpio_ ## name);
-#else
-#define GET_GPIO(name) \
-unsigned short get_gpio_ ## name(unsigned gpio) \
-{ \
-       return (0x01 & (gpio_bankb[gpio_bank(gpio)]->name >> gpio_sub_n(gpio))); \
-} \
-EXPORT_SYMBOL(get_gpio_ ## name);
-#endif
 
 GET_GPIO(data)
 GET_GPIO(dir)
@@ -552,27 +451,21 @@ GET_GPIO(maskb)
 
 /*Get current PORT date (16-bit word)*/
 
-#if ANOMALY_05000311 || ANOMALY_05000323
 #define GET_GPIO_P(name) \
 unsigned short get_gpiop_ ## name(unsigned gpio) \
 { \
        unsigned long flags; \
        unsigned short ret; \
-       local_irq_save_hw(flags); \
-       ret = (gpio_bankb[gpio_bank(gpio)]->name); \
-       AWA_DUMMY_READ(name); \
-       local_irq_restore_hw(flags); \
+       if (ANOMALY_05000311 || ANOMALY_05000323) \
+               local_irq_save_hw(flags); \
+       ret = (gpio_array[gpio_bank(gpio)]->name); \
+       if (ANOMALY_05000311 || ANOMALY_05000323) { \
+               AWA_DUMMY_READ(name); \
+               local_irq_restore_hw(flags); \
+       } \
        return ret; \
 } \
 EXPORT_SYMBOL(get_gpiop_ ## name);
-#else
-#define GET_GPIO_P(name) \
-unsigned short get_gpiop_ ## name(unsigned gpio) \
-{ \
-       return (gpio_bankb[gpio_bank(gpio)]->name);\
-} \
-EXPORT_SYMBOL(get_gpiop_ ## name);
-#endif
 
 GET_GPIO_P(data)
 GET_GPIO_P(dir)
@@ -585,6 +478,26 @@ GET_GPIO_P(maskb)
 
 
 #ifdef CONFIG_PM
+
+static unsigned short wakeup_map[GPIO_BANK_NUM];
+static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS];
+
+static const unsigned int sic_iwr_irqs[] = {
+#if defined(BF533_FAMILY)
+       IRQ_PROG_INTB
+#elif defined(BF537_FAMILY)
+       IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX
+#elif defined(BF538_FAMILY)
+       IRQ_PORTF_INTB
+#elif defined(BF527_FAMILY) || defined(BF518_FAMILY)
+       IRQ_PORTF_INTB, IRQ_PORTG_INTB, IRQ_PORTH_INTB
+#elif defined(BF561_FAMILY)
+       IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB
+#else
+# error no SIC_IWR defined
+#endif
+};
+
 /***********************************************************
 *
 * FUNCTIONS: Blackfin PM Setup API
@@ -669,18 +582,18 @@ u32 bfin_pm_standby_setup(void)
                mask = wakeup_map[gpio_bank(i)];
                bank = gpio_bank(i);
 
-               gpio_bank_saved[bank].maskb = gpio_bankb[bank]->maskb;
-               gpio_bankb[bank]->maskb = 0;
+               gpio_bank_saved[bank].maskb = gpio_array[bank]->maskb;
+               gpio_array[bank]->maskb = 0;
 
                if (mask) {
 #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
                        gpio_bank_saved[bank].fer   = *port_fer[bank];
 #endif
-                       gpio_bank_saved[bank].inen  = gpio_bankb[bank]->inen;
-                       gpio_bank_saved[bank].polar = gpio_bankb[bank]->polar;
-                       gpio_bank_saved[bank].dir   = gpio_bankb[bank]->dir;
-                       gpio_bank_saved[bank].edge  = gpio_bankb[bank]->edge;
-                       gpio_bank_saved[bank].both  = gpio_bankb[bank]->both;
+                       gpio_bank_saved[bank].inen  = gpio_array[bank]->inen;
+                       gpio_bank_saved[bank].polar = gpio_array[bank]->polar;
+                       gpio_bank_saved[bank].dir   = gpio_array[bank]->dir;
+                       gpio_bank_saved[bank].edge  = gpio_array[bank]->edge;
+                       gpio_bank_saved[bank].both  = gpio_array[bank]->both;
                        gpio_bank_saved[bank].reserved =
                                                reserved_gpio_map[bank];
 
@@ -700,7 +613,7 @@ u32 bfin_pm_standby_setup(void)
                        }
 
                        bfin_internal_set_wake(sic_iwr_irqs[bank], 1);
-                       gpio_bankb[bank]->maskb_set = wakeup_map[gpio_bank(i)];
+                       gpio_array[bank]->maskb_set = wakeup_map[gpio_bank(i)];
                }
        }
 
@@ -721,18 +634,18 @@ void bfin_pm_standby_restore(void)
 #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
                        *port_fer[bank]         = gpio_bank_saved[bank].fer;
 #endif
-                       gpio_bankb[bank]->inen  = gpio_bank_saved[bank].inen;
-                       gpio_bankb[bank]->dir   = gpio_bank_saved[bank].dir;
-                       gpio_bankb[bank]->polar = gpio_bank_saved[bank].polar;
-                       gpio_bankb[bank]->edge  = gpio_bank_saved[bank].edge;
-                       gpio_bankb[bank]->both  = gpio_bank_saved[bank].both;
+                       gpio_array[bank]->inen  = gpio_bank_saved[bank].inen;
+                       gpio_array[bank]->dir   = gpio_bank_saved[bank].dir;
+                       gpio_array[bank]->polar = gpio_bank_saved[bank].polar;
+                       gpio_array[bank]->edge  = gpio_bank_saved[bank].edge;
+                       gpio_array[bank]->both  = gpio_bank_saved[bank].both;
 
                        reserved_gpio_map[bank] =
                                        gpio_bank_saved[bank].reserved;
                        bfin_internal_set_wake(sic_iwr_irqs[bank], 0);
                }
 
-               gpio_bankb[bank]->maskb = gpio_bank_saved[bank].maskb;
+               gpio_array[bank]->maskb = gpio_bank_saved[bank].maskb;
        }
        AWA_DUMMY_READ(maskb);
 }
@@ -745,21 +658,21 @@ void bfin_gpio_pm_hibernate_suspend(void)
                bank = gpio_bank(i);
 
 #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
-                       gpio_bank_saved[bank].fer   = *port_fer[bank];
+               gpio_bank_saved[bank].fer = *port_fer[bank];
 #if defined(BF527_FAMILY) || defined(BF518_FAMILY)
-                       gpio_bank_saved[bank].mux   = *port_mux[bank];
+               gpio_bank_saved[bank].mux = *port_mux[bank];
 #else
-                       if (bank == 0)
-                               gpio_bank_saved[bank].mux   = bfin_read_PORT_MUX();
+               if (bank == 0)
+                       gpio_bank_saved[bank].mux = bfin_read_PORT_MUX();
 #endif
 #endif
-                       gpio_bank_saved[bank].data  = gpio_bankb[bank]->data;
-                       gpio_bank_saved[bank].inen  = gpio_bankb[bank]->inen;
-                       gpio_bank_saved[bank].polar = gpio_bankb[bank]->polar;
-                       gpio_bank_saved[bank].dir   = gpio_bankb[bank]->dir;
-                       gpio_bank_saved[bank].edge  = gpio_bankb[bank]->edge;
-                       gpio_bank_saved[bank].both  = gpio_bankb[bank]->both;
-                       gpio_bank_saved[bank].maska  = gpio_bankb[bank]->maska;
+               gpio_bank_saved[bank].data  = gpio_array[bank]->data;
+               gpio_bank_saved[bank].inen  = gpio_array[bank]->inen;
+               gpio_bank_saved[bank].polar = gpio_array[bank]->polar;
+               gpio_bank_saved[bank].dir   = gpio_array[bank]->dir;
+               gpio_bank_saved[bank].edge  = gpio_array[bank]->edge;
+               gpio_bank_saved[bank].both  = gpio_array[bank]->both;
+               gpio_bank_saved[bank].maska = gpio_array[bank]->maska;
        }
 
        AWA_DUMMY_READ(maska);
@@ -770,27 +683,27 @@ void bfin_gpio_pm_hibernate_restore(void)
        int i, bank;
 
        for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
-                       bank = gpio_bank(i);
+               bank = gpio_bank(i);
 
 #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
 #if defined(BF527_FAMILY) || defined(BF518_FAMILY)
-                       *port_mux[bank] = gpio_bank_saved[bank].mux;
+               *port_mux[bank] = gpio_bank_saved[bank].mux;
 #else
-                       if (bank == 0)
-                               bfin_write_PORT_MUX(gpio_bank_saved[bank].mux);
+               if (bank == 0)
+                       bfin_write_PORT_MUX(gpio_bank_saved[bank].mux);
 #endif
-                       *port_fer[bank]         = gpio_bank_saved[bank].fer;
+               *port_fer[bank] = gpio_bank_saved[bank].fer;
 #endif
-                       gpio_bankb[bank]->inen  = gpio_bank_saved[bank].inen;
-                       gpio_bankb[bank]->dir   = gpio_bank_saved[bank].dir;
-                       gpio_bankb[bank]->polar = gpio_bank_saved[bank].polar;
-                       gpio_bankb[bank]->edge  = gpio_bank_saved[bank].edge;
-                       gpio_bankb[bank]->both  = gpio_bank_saved[bank].both;
+               gpio_array[bank]->inen  = gpio_bank_saved[bank].inen;
+               gpio_array[bank]->dir   = gpio_bank_saved[bank].dir;
+               gpio_array[bank]->polar = gpio_bank_saved[bank].polar;
+               gpio_array[bank]->edge  = gpio_bank_saved[bank].edge;
+               gpio_array[bank]->both  = gpio_bank_saved[bank].both;
 
-                       gpio_bankb[bank]->data_set = gpio_bank_saved[bank].data
-                                                       | gpio_bank_saved[bank].dir;
+               gpio_array[bank]->data_set = gpio_bank_saved[bank].data
+                                               | gpio_bank_saved[bank].dir;
 
-                       gpio_bankb[bank]->maska = gpio_bank_saved[bank].maska;
+               gpio_array[bank]->maska = gpio_bank_saved[bank].maska;
        }
        AWA_DUMMY_READ(maska);
 }
@@ -817,12 +730,12 @@ void bfin_gpio_pm_hibernate_suspend(void)
        for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
                bank = gpio_bank(i);
 
-                       gpio_bank_saved[bank].fer  = gpio_array[bank]->port_fer;
-                       gpio_bank_saved[bank].mux  = gpio_array[bank]->port_mux;
-                       gpio_bank_saved[bank].data  = gpio_array[bank]->port_data;
-                       gpio_bank_saved[bank].data  = gpio_array[bank]->port_data;
-                       gpio_bank_saved[bank].inen  = gpio_array[bank]->port_inen;
-                       gpio_bank_saved[bank].dir   = gpio_array[bank]->port_dir_set;
+               gpio_bank_saved[bank].fer = gpio_array[bank]->port_fer;
+               gpio_bank_saved[bank].mux = gpio_array[bank]->port_mux;
+               gpio_bank_saved[bank].data = gpio_array[bank]->data;
+               gpio_bank_saved[bank].data = gpio_array[bank]->data;
+               gpio_bank_saved[bank].inen = gpio_array[bank]->inen;
+               gpio_bank_saved[bank].dir = gpio_array[bank]->dir_set;
        }
 }
 
@@ -831,21 +744,21 @@ void bfin_gpio_pm_hibernate_restore(void)
        int i, bank;
 
        for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
-                       bank = gpio_bank(i);
-
-                       gpio_array[bank]->port_mux  = gpio_bank_saved[bank].mux;
-                       gpio_array[bank]->port_fer  = gpio_bank_saved[bank].fer;
-                       gpio_array[bank]->port_inen  = gpio_bank_saved[bank].inen;
-                       gpio_array[bank]->port_dir_set   = gpio_bank_saved[bank].dir;
-                       gpio_array[bank]->port_set = gpio_bank_saved[bank].data
-                                                       | gpio_bank_saved[bank].dir;
+               bank = gpio_bank(i);
+
+               gpio_array[bank]->port_mux = gpio_bank_saved[bank].mux;
+               gpio_array[bank]->port_fer = gpio_bank_saved[bank].fer;
+               gpio_array[bank]->inen = gpio_bank_saved[bank].inen;
+               gpio_array[bank]->dir_set = gpio_bank_saved[bank].dir;
+               gpio_array[bank]->data_set = gpio_bank_saved[bank].data
+                                               | gpio_bank_saved[bank].dir;
        }
 }
 #endif
 
 unsigned short get_gpio_dir(unsigned gpio)
 {
-       return (0x01 & (gpio_array[gpio_bank(gpio)]->port_dir_clear >> gpio_sub_n(gpio)));
+       return (0x01 & (gpio_array[gpio_bank(gpio)]->dir_clear >> gpio_sub_n(gpio)));
 }
 EXPORT_SYMBOL(get_gpio_dir);
 
@@ -905,9 +818,7 @@ int peripheral_request(unsigned short per, const char *label)
                 */
 
 #ifdef BF548_FAMILY
-               u16 funct = get_portmux(ident);
-
-               if (!((per & P_MAYSHARE) && (funct == P_FUNCT2MUX(per)))) {
+               if (!((per & P_MAYSHARE) && get_portmux(per) == P_FUNCT2MUX(per))) {
 #else
                if (!(per & P_MAYSHARE)) {
 #endif
@@ -931,11 +842,7 @@ int peripheral_request(unsigned short per, const char *label)
  anyway:
        reserved_peri_map[gpio_bank(ident)] |= gpio_bit(ident);
 
-#ifdef BF548_FAMILY
-       portmux_setup(ident, P_FUNCT2MUX(per));
-#else
-       portmux_setup(per, P_FUNCT2MUX(per));
-#endif
+       portmux_setup(per);
        port_setup(ident, PERIPHERAL_USAGE);
 
        local_irq_restore_hw(flags);
@@ -977,9 +884,6 @@ void peripheral_free(unsigned short per)
        if (!(per & P_DEFINED))
                return;
 
-       if (check_gpio(ident) < 0)
-               return;
-
        local_irq_save_hw(flags);
 
        if (unlikely(!(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident)))) {
@@ -1056,9 +960,15 @@ int bfin_gpio_request(unsigned gpio, const char *label)
                local_irq_restore_hw(flags);
                return -EBUSY;
        }
-       if (unlikely(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio)))
+       if (unlikely(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
                printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!"
                       " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio);
+       }
+#ifndef BF548_FAMILY
+       else {  /* Reset POLAR setting when acquiring a gpio for the first time */
+               set_gpio_polar(gpio, 0);
+       }
+#endif
 
        reserved_gpio_map[gpio_bank(gpio)] |= gpio_bit(gpio);
        set_label(gpio, label);
@@ -1078,6 +988,8 @@ void bfin_gpio_free(unsigned gpio)
        if (check_gpio(gpio) < 0)
                return;
 
+       might_sleep();
+
        local_irq_save_hw(flags);
 
        if (unlikely(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))) {
@@ -1158,8 +1070,16 @@ void bfin_gpio_irq_free(unsigned gpio)
        local_irq_restore_hw(flags);
 }
 
-
+static inline void __bfin_gpio_direction_input(unsigned gpio)
+{
 #ifdef BF548_FAMILY
+       gpio_array[gpio_bank(gpio)]->dir_clear = gpio_bit(gpio);
+#else
+       gpio_array[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio);
+#endif
+       gpio_array[gpio_bank(gpio)]->inen |= gpio_bit(gpio);
+}
+
 int bfin_gpio_direction_input(unsigned gpio)
 {
        unsigned long flags;
@@ -1170,125 +1090,85 @@ int bfin_gpio_direction_input(unsigned gpio)
        }
 
        local_irq_save_hw(flags);
-       gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio);
-       gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio);
+       __bfin_gpio_direction_input(gpio);
+       AWA_DUMMY_READ(inen);
        local_irq_restore_hw(flags);
 
        return 0;
 }
 EXPORT_SYMBOL(bfin_gpio_direction_input);
 
-int bfin_gpio_direction_output(unsigned gpio, int value)
+void bfin_gpio_irq_prepare(unsigned gpio)
 {
+#ifdef BF548_FAMILY
        unsigned long flags;
+#endif
 
-       if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
-               gpio_error(gpio);
-               return -EINVAL;
-       }
+       port_setup(gpio, GPIO_USAGE);
 
+#ifdef BF548_FAMILY
        local_irq_save_hw(flags);
-       gpio_array[gpio_bank(gpio)]->port_inen &= ~gpio_bit(gpio);
-       gpio_set_value(gpio, value);
-       gpio_array[gpio_bank(gpio)]->port_dir_set = gpio_bit(gpio);
+       __bfin_gpio_direction_input(gpio);
        local_irq_restore_hw(flags);
-
-       return 0;
+#endif
 }
-EXPORT_SYMBOL(bfin_gpio_direction_output);
 
 void bfin_gpio_set_value(unsigned gpio, int arg)
 {
        if (arg)
-               gpio_array[gpio_bank(gpio)]->port_set = gpio_bit(gpio);
+               gpio_array[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
        else
-               gpio_array[gpio_bank(gpio)]->port_clear = gpio_bit(gpio);
+               gpio_array[gpio_bank(gpio)]->data_clear = gpio_bit(gpio);
 }
 EXPORT_SYMBOL(bfin_gpio_set_value);
 
-int bfin_gpio_get_value(unsigned gpio)
-{
-       return (1 & (gpio_array[gpio_bank(gpio)]->port_data >> gpio_sub_n(gpio)));
-}
-EXPORT_SYMBOL(bfin_gpio_get_value);
-
-void bfin_gpio_irq_prepare(unsigned gpio)
+int bfin_gpio_direction_output(unsigned gpio, int value)
 {
        unsigned long flags;
 
-       port_setup(gpio, GPIO_USAGE);
+       if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
+               gpio_error(gpio);
+               return -EINVAL;
+       }
 
        local_irq_save_hw(flags);
-       gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio);
-       gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio);
-       local_irq_restore_hw(flags);
-}
 
+       gpio_array[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio);
+       gpio_set_value(gpio, value);
+#ifdef BF548_FAMILY
+       gpio_array[gpio_bank(gpio)]->dir_set = gpio_bit(gpio);
 #else
+       gpio_array[gpio_bank(gpio)]->dir |= gpio_bit(gpio);
+#endif
+
+       AWA_DUMMY_READ(dir);
+       local_irq_restore_hw(flags);
+
+       return 0;
+}
+EXPORT_SYMBOL(bfin_gpio_direction_output);
 
 int bfin_gpio_get_value(unsigned gpio)
 {
+#ifdef BF548_FAMILY
+       return (1 & (gpio_array[gpio_bank(gpio)]->data >> gpio_sub_n(gpio)));
+#else
        unsigned long flags;
-       int ret;
 
        if (unlikely(get_gpio_edge(gpio))) {
+               int ret;
                local_irq_save_hw(flags);
                set_gpio_edge(gpio, 0);
                ret = get_gpio_data(gpio);
                set_gpio_edge(gpio, 1);
                local_irq_restore_hw(flags);
-
                return ret;
        } else
                return get_gpio_data(gpio);
+#endif
 }
 EXPORT_SYMBOL(bfin_gpio_get_value);
 
-
-int bfin_gpio_direction_input(unsigned gpio)
-{
-       unsigned long flags;
-
-       if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
-               gpio_error(gpio);
-               return -EINVAL;
-       }
-
-       local_irq_save_hw(flags);
-       gpio_bankb[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio);
-       gpio_bankb[gpio_bank(gpio)]->inen |= gpio_bit(gpio);
-       AWA_DUMMY_READ(inen);
-       local_irq_restore_hw(flags);
-
-       return 0;
-}
-EXPORT_SYMBOL(bfin_gpio_direction_input);
-
-int bfin_gpio_direction_output(unsigned gpio, int value)
-{
-       unsigned long flags;
-
-       if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
-               gpio_error(gpio);
-               return -EINVAL;
-       }
-
-       local_irq_save_hw(flags);
-       gpio_bankb[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio);
-
-       if (value)
-               gpio_bankb[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
-       else
-               gpio_bankb[gpio_bank(gpio)]->data_clear = gpio_bit(gpio);
-
-       gpio_bankb[gpio_bank(gpio)]->dir |= gpio_bit(gpio);
-       AWA_DUMMY_READ(dir);
-       local_irq_restore_hw(flags);
-
-       return 0;
-}
-EXPORT_SYMBOL(bfin_gpio_direction_output);
-
 /* If we are booting from SPI and our board lacks a strong enough pull up,
  * the core can reset and execute the bootrom faster than the resistor can
  * pull the signal logically high.  To work around this (common) error in
@@ -1299,23 +1179,15 @@ EXPORT_SYMBOL(bfin_gpio_direction_output);
  * lives here as we need to force all the GPIO states w/out going through
  * BUG() checks and such.
  */
-void bfin_gpio_reset_spi0_ssel1(void)
+void bfin_reset_boot_spi_cs(unsigned short pin)
 {
-       u16 gpio = P_IDENT(P_SPI0_SSEL1);
-
+       unsigned short gpio = P_IDENT(pin);
        port_setup(gpio, GPIO_USAGE);
-       gpio_bankb[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
+       gpio_array[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
        AWA_DUMMY_READ(data_set);
        udelay(1);
 }
 
-void bfin_gpio_irq_prepare(unsigned gpio)
-{
-       port_setup(gpio, GPIO_USAGE);
-}
-
-#endif /*BF548_FAMILY */
-
 #if defined(CONFIG_PROC_FS)
 static int gpio_proc_read(char *buf, char **start, off_t offset,
                          int len, int *unused_i, void *unused_v)
@@ -1369,11 +1241,7 @@ int bfin_gpiolib_get_value(struct gpio_chip *chip, unsigned gpio)
 
 void bfin_gpiolib_set_value(struct gpio_chip *chip, unsigned gpio, int value)
 {
-#ifdef BF548_FAMILY
        return bfin_gpio_set_value(gpio, value);
-#else
-       return set_gpio_data(gpio, value);
-#endif
 }
 
 int bfin_gpiolib_gpio_request(struct gpio_chip *chip, unsigned gpio)
index bdb958486e7682281fae9270a016f84ad977a77c..3e329a6ce041ad79e5429d0e0ea557ca98478569 100644 (file)
@@ -63,10 +63,8 @@ void __init generate_cplb_tables_cpu(unsigned int cpu)
        dcplb_tbl[cpu][i_d].addr = 0;
        dcplb_tbl[cpu][i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB;
 
-#if 0
        icplb_tbl[cpu][i_i].addr = 0;
-       icplb_tbl[cpu][i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_4KB;
-#endif
+       icplb_tbl[cpu][i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_1KB;
 
        /* Cover kernel memory with 4M pages.  */
        addr = 0;
index 376249ab26945d5d588946a05967b03662366148..8cbb47c7b6639a76434f395b820304a62ecf9f82 100644 (file)
@@ -163,12 +163,14 @@ MGR_ATTR static int icplb_miss(int cpu)
                nr_icplb_supv_miss[cpu]++;
 
        base = 0;
-       for (idx = 0; idx < icplb_nr_bounds; idx++) {
+       idx = 0;
+       do {
                eaddr = icplb_bounds[idx].eaddr;
                if (addr < eaddr)
                        break;
                base = eaddr;
-       }
+       } while (++idx < icplb_nr_bounds);
+
        if (unlikely(idx == icplb_nr_bounds))
                return CPLB_NO_ADDR_MATCH;
 
@@ -208,12 +210,14 @@ MGR_ATTR static int dcplb_miss(int cpu)
                nr_dcplb_supv_miss[cpu]++;
 
        base = 0;
-       for (idx = 0; idx < dcplb_nr_bounds; idx++) {
+       idx = 0;
+       do {
                eaddr = dcplb_bounds[idx].eaddr;
                if (addr < eaddr)
                        break;
                base = eaddr;
-       }
+       } while (++idx < dcplb_nr_bounds);
+
        if (unlikely(idx == dcplb_nr_bounds))
                return CPLB_NO_ADDR_MATCH;
 
index ab8209cbbad0368f1ebc2bc252c7532478ec6b5a..75724eee6494c65c87545e14682f8cfe213877dd 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <asm/trace.h>
+#include <asm/pda.h>
 
 static atomic_t irq_err_count;
 static spinlock_t irq_controller_lock;
@@ -91,8 +92,13 @@ int show_interrupts(struct seq_file *p, void *v)
                seq_putc(p, '\n');
  skip:
                spin_unlock_irqrestore(&irq_desc[i].lock, flags);
-       } else if (i == NR_IRQS)
+       } else if (i == NR_IRQS) {
+               seq_printf(p, "NMI: ");
+               for_each_online_cpu(j)
+                       seq_printf(p, "%10u ", cpu_pda[j].__nmi_count);
+               seq_printf(p, "     CORE  Non Maskable Interrupt\n");
                seq_printf(p, "Err: %10u\n",  atomic_read(&irq_err_count));
+       }
        return 0;
 }
 
index eeee8cb433606bfce39c3169e007979c005ea1b5..53d08dee8531b1ba588fcef55a97b288a89c0054 100644 (file)
@@ -20,8 +20,8 @@
  * reset while the Core B bit (on dual core parts) is cleared by
  * the core reset.
  */
-__attribute__((l1_text))
-static void _bfin_reset(void)
+__attribute__ ((__l1_text__, __noreturn__))
+static void bfin_reset(void)
 {
        /* Wait for completion of "system" events such as cache line
         * line fills so that we avoid infinite stalls later on as
@@ -30,7 +30,11 @@ static void _bfin_reset(void)
         */
        __builtin_bfin_ssync();
 
-       while (1) {
+       /* The bootrom checks to see how it was reset and will
+        * automatically perform a software reset for us when
+        * it starts executing after the core reset.
+        */
+       if (ANOMALY_05000353 || ANOMALY_05000386) {
                /* Initiate System software reset. */
                bfin_write_SWRST(0x7);
 
@@ -50,6 +54,11 @@ static void _bfin_reset(void)
                /* Clear System software reset */
                bfin_write_SWRST(0);
 
+               /* The BF526 ROM will crash during reset */
+#if defined(__ADSPBF522__) || defined(__ADSPBF524__) || defined(__ADSPBF526__)
+               bfin_read_SWRST();
+#endif
+
                /* Wait for the SWRST write to complete.  Cannot rely on SSYNC
                 * though as the System state is all reset now.
                 */
@@ -60,22 +69,11 @@ static void _bfin_reset(void)
                        : "a" (15 * 1)
                        : "LC1", "LB1", "LT1"
                );
+       }
 
+       while (1)
                /* Issue core reset */
                asm("raise 1");
-       }
-}
-
-static void bfin_reset(void)
-{
-       if (ANOMALY_05000353 || ANOMALY_05000386)
-               _bfin_reset();
-       else
-               /* the bootrom checks to see how it was reset and will
-                * automatically perform a software reset for us when
-                * it starts executing boot
-                */
-               asm("raise 1;");
 }
 
 __attribute__((weak))
index b2a811347b655070472857cac98e6f782c692a78..e5c11623080015fec2cf4a2f671639448f745277 100644 (file)
@@ -60,7 +60,7 @@ void __initdata *init_retx, *init_saved_retx, *init_saved_seqstat,
 #define BFIN_MEMMAP_MAX                128 /* number of entries in bfin_memmap */
 #define BFIN_MEMMAP_RAM                1
 #define BFIN_MEMMAP_RESERVED   2
-struct bfin_memmap {
+static struct bfin_memmap {
        int nr_map;
        struct bfin_memmap_entry {
                unsigned long long addr; /* start of memory segment */
@@ -824,7 +824,15 @@ void __init setup_arch(char **cmdline_p)
        flash_probe();
 #endif
 
+       printk(KERN_INFO "Boot Mode: %i\n", bfin_read_SYSCR() & 0xF);
+
+       /* Newer parts mirror SWRST bits in SYSCR */
+#if defined(CONFIG_BF53x) || defined(CONFIG_BF561) || \
+    defined(CONFIG_BF538) || defined(CONFIG_BF539)
        _bfin_swrst = bfin_read_SWRST();
+#else
+       _bfin_swrst = bfin_read_SYSCR();
+#endif
 
 #ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT
        bfin_write_SWRST(_bfin_swrst & ~DOUBLE_FAULT);
@@ -853,7 +861,7 @@ void __init setup_arch(char **cmdline_p)
        else if (_bfin_swrst & RESET_SOFTWARE)
                printk(KERN_NOTICE "Reset caused by Software reset\n");
 
-       printk(KERN_INFO "Blackfin support (C) 2004-2008 Analog Devices, Inc.\n");
+       printk(KERN_INFO "Blackfin support (C) 2004-2009 Analog Devices, Inc.\n");
        if (bfin_compiled_revid() == 0xffff)
                printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
        else if (bfin_compiled_revid() == -1)
index 5b0667da8d05ef3256c3b403111075028ef31bb7..ffe7fb53eccbdaccd344fbe27029fdc5bba12b14 100644 (file)
@@ -673,6 +673,14 @@ static void decode_instruction(unsigned short *address)
                        verbose_printk("RTI");
                else if (opcode == 0x0012)
                        verbose_printk("RTX");
+               else if (opcode == 0x0013)
+                       verbose_printk("RTN");
+               else if (opcode == 0x0014)
+                       verbose_printk("RTE");
+               else if (opcode == 0x0025)
+                       verbose_printk("EMUEXCPT");
+               else if (opcode == 0x0040 && opcode <= 0x0047)
+                       verbose_printk("STI R%i", opcode & 7);
                else if (opcode >= 0x0050 && opcode <= 0x0057)
                        verbose_printk("JUMP (P%i)", opcode & 7);
                else if (opcode >= 0x0060 && opcode <= 0x0067)
@@ -681,6 +689,10 @@ static void decode_instruction(unsigned short *address)
                        verbose_printk("CALL (PC+P%i)", opcode & 7);
                else if (opcode >= 0x0080 && opcode <= 0x0087)
                        verbose_printk("JUMP (PC+P%i)", opcode & 7);
+               else if (opcode >= 0x0090 && opcode <= 0x009F)
+                       verbose_printk("RAISE 0x%x", opcode & 0xF);
+               else if (opcode >= 0x00A0 && opcode <= 0x00AF)
+                       verbose_printk("EXCPT 0x%x", opcode & 0xF);
                else if ((opcode >= 0x1000 && opcode <= 0x13FF) || (opcode >= 0x1800 && opcode <= 0x1BFF))
                        verbose_printk("IF !CC JUMP");
                else if ((opcode >= 0x1400 && opcode <= 0x17ff) || (opcode >= 0x1c00 && opcode <= 0x1fff))
@@ -820,11 +832,8 @@ void show_stack(struct task_struct *task, unsigned long *stack)
        decode_address(buf, (unsigned int)stack);
        printk(KERN_NOTICE " SP: [0x%p] %s\n", stack, buf);
 
-       addr = (unsigned int *)((unsigned int)stack & ~0x3F);
-
        /* First thing is to look for a frame pointer */
-       for (addr = (unsigned int *)((unsigned int)stack & ~0xF), i = 0;
-               addr < endstack; addr++, i++) {
+       for (addr = (unsigned int *)((unsigned int)stack & ~0xF); addr < endstack; addr++) {
                if (*addr & 0x1)
                        continue;
                ins_addr = (unsigned short *)*addr;
@@ -834,7 +843,8 @@ void show_stack(struct task_struct *task, unsigned long *stack)
 
                if (fp) {
                        /* Let's check to see if it is a frame pointer */
-                       while (fp >= (addr - 1) && fp < endstack && fp)
+                       while (fp >= (addr - 1) && fp < endstack
+                              && fp && ((unsigned int) fp & 0x3) == 0)
                                fp = (unsigned int *)*fp;
                        if (fp == 0 || fp == endstack) {
                                fp = addr - 1;
@@ -1052,8 +1062,9 @@ void show_regs(struct pt_regs *fp)
        char buf [150];
        struct irqaction *action;
        unsigned int i;
-       unsigned long flags;
+       unsigned long flags = 0;
        unsigned int cpu = smp_processor_id();
+       unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic();
 
        verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted());
        verbose_printk(KERN_NOTICE " SEQSTAT: %08lx  IPEND: %04lx  SYSCFG: %04lx\n",
@@ -1073,17 +1084,22 @@ void show_regs(struct pt_regs *fp)
        }
        verbose_printk(KERN_NOTICE "  EXCAUSE   : 0x%lx\n",
                fp->seqstat & SEQSTAT_EXCAUSE);
-       for (i = 6; i <= 15 ; i++) {
+       for (i = 2; i <= 15 ; i++) {
                if (fp->ipend & (1 << i)) {
-                       decode_address(buf, bfin_read32(EVT0 + 4*i));
-                       verbose_printk(KERN_NOTICE "  physical IVG%i asserted : %s\n", i, buf);
+                       if (i != 4) {
+                               decode_address(buf, bfin_read32(EVT0 + 4*i));
+                               verbose_printk(KERN_NOTICE "  physical IVG%i asserted : %s\n", i, buf);
+                       } else
+                               verbose_printk(KERN_NOTICE "  interrupts disabled\n");
                }
        }
 
        /* if no interrupts are going off, don't print this out */
        if (fp->ipend & ~0x3F) {
                for (i = 0; i < (NR_IRQS - 1); i++) {
-                       spin_lock_irqsave(&irq_desc[i].lock, flags);
+                       if (!in_atomic)
+                               spin_lock_irqsave(&irq_desc[i].lock, flags);
+
                        action = irq_desc[i].action;
                        if (!action)
                                goto unlock;
@@ -1096,7 +1112,8 @@ void show_regs(struct pt_regs *fp)
                        }
                        verbose_printk("\n");
 unlock:
-                       spin_unlock_irqrestore(&irq_desc[i].lock, flags);
+                       if (!in_atomic)
+                               spin_unlock_irqrestore(&irq_desc[i].lock, flags);
                }
        }
 
index 15f1351c8645834a680103f4e2141ad309950f99..0e175342112e45340d72fbe558234d97840027a2 100644 (file)
@@ -46,6 +46,7 @@
 #include <asm/dpmc.h>
 #include <asm/bfin_sdh.h>
 #include <linux/spi/ad7877.h>
+#include <net/dsa.h>
 
 /*
  * Name the Board for the /proc/cpuinfo
@@ -104,8 +105,31 @@ static struct platform_device rtc_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
+};
+#endif
+
+#if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
+static struct dsa_platform_data ksz8893m_switch_data = {
+       .mii_bus = &bfin_mii_bus.dev,
+       .netdev = &bfin_mac_device.dev,
+       .port_names[0]  = NULL,
+       .port_names[1]  = "eth%d",
+       .port_names[2]  = "eth%d",
+       .port_names[3]  = "cpu",
+};
+
+static struct platform_device ksz8893m_switch_device = {
+       .name           = "dsa",
+       .id             = 0,
+       .num_resources  = 0,
+       .dev.platform_data = &ksz8893m_switch_data,
 };
 #endif
 
@@ -147,6 +171,15 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
 };
 #endif
 
+#if defined(CONFIG_NET_DSA_KSZ8893M) \
+       || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
+/* SPI SWITCH CHIP */
+static struct bfin5xx_spi_chip spi_switch_info = {
+       .enable_dma = 0,
+       .bits_per_word = 8,
+};
+#endif
+
 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
        .enable_dma = 1,
@@ -226,6 +259,19 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
        },
 #endif
 
+#if defined(CONFIG_NET_DSA_KSZ8893M) \
+       || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
+       {
+               .modalias = "ksz8893m",
+               .max_speed_hz = 5000000,
+               .bus_num = 0,
+               .chip_select = 1,
+               .platform_data = NULL,
+               .controller_data = &spi_switch_info,
+               .mode = SPI_MODE_3,
+       },
+#endif
+
 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
        {
                .modalias = "spi_mmc_dummy",
@@ -473,7 +519,6 @@ static struct platform_device i2c_bfin_twi_device = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
        {
@@ -487,7 +532,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 };
-#endif
 
 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
 static struct platform_device bfin_sport0_uart_device = {
@@ -584,9 +628,14 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
+#if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
+       &ksz8893m_switch_device,
+#endif
+
 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
        &bfin_spi0_device,
        &bfin_spi1_device,
@@ -632,12 +681,8 @@ static struct platform_device *stamp_devices[] __initdata = {
 static int __init ezbrd_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
-
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
-
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
        return 0;
@@ -649,7 +694,7 @@ void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
 
 void bfin_get_ether_addr(char *addr)
index ac16d54734d4cfd8fa7ced7934fc7390117fe6c9..f618b487b2b0eabd96d03e1be423b282122770ca 100644 (file)
 #define P_SPI1_SSEL4   (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(2))
 #define P_SPI1_SSEL5   (P_DEFINED | P_IDENT(GPIO_PG11) | P_FUNCT(2))
 
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2
+
 /* SPORT Port Mux */
 #define P_SPORT0_DRPRI (P_DEFINED | P_IDENT(GPIO_PG3) | P_FUNCT(0))
 #define P_SPORT0_RSCLK (P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(0))
index a2c3578f4b6c8a82ee9b50e4836af895ddefca36..856c097b5317eda49cc70cf8456f8dfee1bfbc6c 100644 (file)
@@ -403,8 +403,13 @@ static struct platform_device isp1362_hcd_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -793,7 +798,6 @@ static struct platform_device i2c_bfin_twi_device = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
        {
@@ -809,7 +813,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 };
-#endif
 
 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
 static struct platform_device bfin_sport0_uart_device = {
@@ -920,6 +923,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -968,27 +972,23 @@ static struct platform_device *stamp_devices[] __initdata = {
        &bfin_gpios_device,
 };
 
-static int __init stamp_init(void)
+static int __init cm_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
-
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
-
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
        return 0;
 }
 
-arch_initcall(stamp_init);
+arch_initcall(cm_init);
 
 void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
 
 void bfin_get_ether_addr(char *addr)
index 0314bd3355eba4a76123c21ad2b51b625c5e324b..83606fcdde2757ea8a6d7361864c27c7d2240b9c 100644 (file)
@@ -208,8 +208,13 @@ static struct platform_device rtc_device = {
 
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -590,7 +595,6 @@ static struct platform_device i2c_bfin_twi_device = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
        {
@@ -604,7 +608,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 };
-#endif
 
 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
 static struct platform_device bfin_sport0_uart_device = {
@@ -720,6 +723,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -764,27 +768,23 @@ static struct platform_device *stamp_devices[] __initdata = {
        &bfin_gpios_device,
 };
 
-static int __init stamp_init(void)
+static int __init ezbrd_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
-
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
-
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
        return 0;
 }
 
-arch_initcall(stamp_init);
+arch_initcall(ezbrd_init);
 
 void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
 
 void bfin_get_ether_addr(char *addr)
index 9454fb7b18c3e4d403f5fb09acbfb38b4f682fa8..d0864111ef594f3b05ed613c31d18251c87961c3 100644 (file)
@@ -425,8 +425,13 @@ static struct platform_device isp1362_hcd_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -830,7 +835,6 @@ static struct platform_device i2c_bfin_twi_device = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
        {
@@ -844,7 +848,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 };
-#endif
 
 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
 static struct platform_device bfin_sport0_uart_device = {
@@ -988,6 +991,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -1048,27 +1052,23 @@ static struct platform_device *stamp_devices[] __initdata = {
        &bfin_gpios_device,
 };
 
-static int __init stamp_init(void)
+static int __init ezkit_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
-
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
-
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
        return 0;
 }
 
-arch_initcall(stamp_init);
+arch_initcall(ezkit_init);
 
 void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
 
 void bfin_get_ether_addr(char *addr)
index 7f6da2c386bb80c3072fc8bf4ba1176b4a0e0c40..72b1652be4dabe6abd500ba11569e411ebc14600 100644 (file)
@@ -73,6 +73,8 @@
 
 #define P_HWAIT                (P_DONTCARE)
 
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL1
+
 #define P_SPI0_SS      (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0))
 #define P_SPI0_SSEL1   (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(2))
 #define P_SPI0_SCK     (P_DEFINED | P_IDENT(GPIO_PG2) | P_FUNCT(2))
index 6ee607c259acfb933fa3ecb3f46a410badb7d211..015c18f85e7faf2d272c2fc5dffb6cdc89547a44 100644 (file)
@@ -309,10 +309,8 @@ static struct platform_device i2c_gpio_device = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 };
-#endif
 
 static const unsigned int cclk_vlev_datasheet[] =
 {
@@ -390,10 +388,8 @@ static int __init blackstamp_init(void)
 
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
 
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
 
        ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        if (ret < 0)
index 07f9ad1e189c4c66d44d27c0810d7066476577ac..db96f33f72e238ee5d4c64178232859a692645cf 100644 (file)
@@ -441,7 +441,6 @@ static struct platform_device i2c_gpio_device = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
        {
@@ -461,7 +460,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 };
-#endif
 
 static const unsigned int cclk_vlev_datasheet[] =
 {
@@ -550,10 +548,8 @@ static int __init stamp_init(void)
 
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
 
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
 
        ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        if (ret < 0)
index 685a2651dcda305d07ae85525e4ed1af96965740..2f59ce0b0cb5400319b64b61176aeb96f239bf7b 100644 (file)
 #define P_SPI0_SSEL2   (P_DEFINED | P_IDENT(GPIO_PF2))
 #define P_SPI0_SSEL1   (P_DEFINED | P_IDENT(GPIO_PF1))
 #define P_SPI0_SS      (P_DEFINED | P_IDENT(GPIO_PF0))
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2
 
 #define P_TMR2         (P_DONTCARE)
 #define P_TMR1         (P_DONTCARE)
 #define P_TMR0         (P_DONTCARE)
 #define P_TMRCLK       (P_DEFINED | P_IDENT(GPIO_PF1))
 
-
-
-
-
 #endif /* _MACH_PORTMUX_H_ */
index 6ac8e4d5bd386dadc8d108531d29c4d81250d6a3..9cd8fb2a30d32ba3d81ef2409e9078df884b55f0 100644 (file)
@@ -479,8 +479,13 @@ static struct platform_device bfin_sport1_uart_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -591,6 +596,7 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
index dd6e6bfb98eadf00d33ba184ab4f99c316cc537b..da710fdc4569d46963e77e2ed4ec428a480797ed 100644 (file)
@@ -262,8 +262,13 @@ static struct platform_device isp1362_hcd_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -662,6 +667,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -708,7 +714,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 };
 
-static int __init stamp_init(void)
+static int __init generic_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
@@ -720,13 +726,13 @@ static int __init stamp_init(void)
        return 0;
 }
 
-arch_initcall(stamp_init);
+arch_initcall(generic_init);
 
 void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
index bb795341cb178545c7437501e87a5a829c07b189..db7d3a385e4bda4ade36365ca439080a3c4787aa 100644 (file)
@@ -61,8 +61,13 @@ static struct platform_device rtc_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -324,6 +329,7 @@ static struct platform_device *minotaur_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -377,5 +383,5 @@ void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
index 89de94f4545dae898a4e40ed2da71fd504d72db9..590eb3a139b7a7542a070aa4b885a561997c188a 100644 (file)
@@ -198,8 +198,13 @@ static struct platform_device isp1362_hcd_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -529,6 +534,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -558,7 +564,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 };
 
-static int __init stamp_init(void)
+static int __init pnav_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
@@ -569,7 +575,7 @@ static int __init stamp_init(void)
        return 0;
 }
 
-arch_initcall(stamp_init);
+arch_initcall(pnav_init);
 
 void bfin_get_ether_addr(char *addr)
 {
index d812e2514a2f6b5c09a637cfd3d676753b78ee99..cd04c5e448788ab811f77f8681d0cba87a461f45 100644 (file)
@@ -321,8 +321,13 @@ static struct platform_device isp1362_hcd_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -1068,7 +1073,6 @@ static struct adp5588_kpad_platform_data adp5588_kpad_data = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
        {
@@ -1102,7 +1106,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 };
-#endif
 
 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
 static struct platform_device bfin_sport0_uart_device = {
@@ -1217,6 +1220,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -1284,12 +1288,8 @@ static struct platform_device *stamp_devices[] __initdata = {
 static int __init stamp_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
-
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
-
        bfin_plat_nand_init();
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
@@ -1307,7 +1307,7 @@ void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
 
 /*
index 2f4b066153c52dd87185607797d9f5ee106d3024..3f4f203a06ec9b0c0ffb570d7e00b8e1b611db60 100644 (file)
@@ -481,8 +481,13 @@ static struct platform_device bfin_sport1_uart_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -593,6 +598,7 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -615,7 +621,7 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
        &bfin_gpios_device,
 };
 
-static int __init cm_bf537_init(void)
+static int __init tcm_bf537_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
        platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices));
@@ -629,7 +635,7 @@ static int __init cm_bf537_init(void)
        return 0;
 }
 
-arch_initcall(cm_bf537_init);
+arch_initcall(tcm_bf537_init);
 
 void bfin_get_ether_addr(char *addr)
 {
index 78fee6e0f23730cb2fc621b80ede4cb4f3fa21df..87285e75e903107e04d1eab8e168c6c742d0b218 100644 (file)
@@ -31,6 +31,7 @@
 #define P_PPI0_FS1     (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(1))
 #define P_TACLK0       (P_DEFINED | P_IDENT(GPIO_PF14) | P_FUNCT(1))
 #define P_TMRCLK       (P_DEFINED | P_IDENT(GPIO_PF15) | P_FUNCT(1))
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL1
 
 #define P_PPI0_D0      (P_DEFINED | P_IDENT(GPIO_PG0) | P_FUNCT(0))
 #define P_PPI0_D1      (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0))
index 1e031b588b47bce7ee8fa0ca40700c446e504d71..c8db264e3e4d83779f17faa2e543470ae9d5ad2b 100644 (file)
 #define P_SPI0_SSEL2   (P_DEFINED | P_IDENT(GPIO_PF2))
 #define P_SPI0_SSEL1   (P_DEFINED | P_IDENT(GPIO_PF1))
 #define P_SPI0_SS      (P_DEFINED | P_IDENT(GPIO_PF0))
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2
 
 #endif /* _MACH_PORTMUX_H_ */
index 309c16014caea54d8582f8dfc222e36a08eb78ab..096e661700a7d666ab4534edbdb847a83975100f 100644 (file)
@@ -781,7 +781,6 @@ static struct platform_device i2c_bfin_twi1_device = {
 #endif
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
 };
 
@@ -800,7 +799,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
 #endif
 };
 #endif
-#endif
 
 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
 #include <linux/gpio_keys.h>
@@ -956,13 +954,11 @@ static int __init ezkit_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
 
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info0,
                                ARRAY_SIZE(bfin_i2c_board_info0));
 #if !defined(CONFIG_BF542)     /* The BF542 only has 1 TWI */
        i2c_register_board_info(1, bfin_i2c_board_info1,
                                ARRAY_SIZE(bfin_i2c_board_info1));
-#endif
 #endif
 
        platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
index 3b5430999f4f8f4f3c75eb577a06250b7355b6a4..23d03c52f4b46df8d8a7e5aa7c638a8d5e0d7889 100644 (file)
 #define ANOMALY_05000311 (0)
 #define ANOMALY_05000323 (0)
 #define ANOMALY_05000363 (0)
+#define ANOMALY_05000380 (0)
 #define ANOMALY_05000412 (0)
 #define ANOMALY_05000432 (0)
 #define ANOMALY_05000435 (0)
index f0e569984810e751a682d09909f41e6a5579f654..cd31f72bdd820e70ad22732d89ca17a9e45e62f1 100644 (file)
 
 #define AMGCTLVAL      (V_AMBEN | V_AMCKEN)
 
+#if defined(CONFIG_BF542M)
+# define CONFIG_BF542
+#elif defined(CONFIG_BF544M)
+# define CONFIG_BF544
+#elif defined(CONFIG_BF547M)
+# define CONFIG_BF547
+#elif defined(CONFIG_BF548M)
+# define CONFIG_BF548
+#elif defined(CONFIG_BF549M)
+# define CONFIG_BF549
+#endif
+
 #if defined(CONFIG_BF542)
 # define CPU   "BF542"
 # define CPUID 0x27de
index bba82dc75f16be127fabab1d5d96559d4c57044f..3a2051709787d0c24c8c5b33292a8b6b30014290 100644 (file)
 struct gpio_port_t {
        unsigned short port_fer;
        unsigned short dummy1;
-       unsigned short port_data;
+       unsigned short data;
        unsigned short dummy2;
-       unsigned short port_set;
+       unsigned short data_set;
        unsigned short dummy3;
-       unsigned short port_clear;
+       unsigned short data_clear;
        unsigned short dummy4;
-       unsigned short port_dir_set;
+       unsigned short dir_set;
        unsigned short dummy5;
-       unsigned short port_dir_clear;
+       unsigned short dir_clear;
        unsigned short dummy6;
-       unsigned short port_inen;
+       unsigned short inen;
        unsigned short dummy7;
        unsigned int port_mux;
 };
index 8177a567dcdbd0eae89c16f13e409ea838ea49b2..ffb1d0a44b4d798e9f83df9a2e5e9b4c02b5d155 100644 (file)
 #define P_KEY_COL2     (P_DEFINED | P_IDENT(GPIO_PD14) | P_FUNCT(3))
 #define P_KEY_COL3     (P_DEFINED | P_IDENT(GPIO_PD15) | P_FUNCT(3))
 
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL1
 #define P_SPI0_SCK     (P_DEFINED | P_IDENT(GPIO_PE0) | P_FUNCT(0))
 #define P_SPI0_MISO    (P_DEFINED | P_IDENT(GPIO_PE1) | P_FUNCT(0))
 #define P_SPI0_MOSI    (P_DEFINED | P_IDENT(GPIO_PE2) | P_FUNCT(0))
index d7c509759659b604800ff9b5bca337975f32f6c2..cf922295f4ce61902a1e959c8ae74f5522592121 100644 (file)
 #define DLEN_8              0x0        /* PPI Data Length mask for DLEN=8 */
 #define DLEN(x)        (((x-9) & 0x07) << 11)  /* PPI Data Length (only works for x=10-->x=16) */
 #define POL                  0x0000C000        /* PPI Signal Polarities       */
+#define        POLC            0x4000          /* PPI Clock Polarity */
+#define        POLS            0x8000          /* PPI Frame Sync Polarity */
 
 /* PPI_STATUS Masks */
 #define FLD                 0x00000400 /* Field Indicator   */
index a6ee8206efb6dd9a68337a4fab2afa5fb9d1f97c..2e5ad6347dea74738fd56b3cb04cf8032a9feb3c 100644 (file)
@@ -85,5 +85,6 @@
 #define P_SPI0_MOSI    (P_DONTCARE)
 #define P_SPI0_MISO    (P_DONTCARE)
 #define P_SPI0_SCK     (P_DONTCARE)
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2
 
 #endif /* _MACH_PORTMUX_H_ */
index 5d182abefc7bb25b2f0c361acf5ec6c8b65fa818..9dddb6f8cc855296c5e98213bc45b8d76d123276 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/clocks.h>
 #include <asm/mem_init.h>
 
+#define SDGCTL_WIDTH (1 << 31) /* SDRAM external data path width */
 #define PLL_CTL_VAL \
        (((CONFIG_VCO_MULT & 63) << 9) | CLKIN_HALF | \
         (PLL_BYPASS << 8) | (ANOMALY_05000265 ? 0x8000 : 0))
@@ -76,7 +77,7 @@ void init_clocks(void)
        bfin_write_PLL_DIV(CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
 #ifdef EBIU_SDGCTL
        bfin_write_EBIU_SDRRC(mem_SDRRC);
-       bfin_write_EBIU_SDGCTL(mem_SDGCTL);
+       bfin_write_EBIU_SDGCTL((bfin_read_EBIU_SDGCTL() & SDGCTL_WIDTH) | mem_SDGCTL);
 #else
        bfin_write_EBIU_RSTCTL(bfin_read_EBIU_RSTCTL() & ~(SRREQ));
        do_sync();
index fae77465137457f40e120b2b090e0ffbf5853124..88de053bbe8ed58dcdb6e7b4bad80657a3e011db 100644 (file)
@@ -151,13 +151,6 @@ ENTRY(_ex_syscall)
        jump.s _bfin_return_from_exception;
 ENDPROC(_ex_syscall)
 
-ENTRY(_ex_soft_bp)
-       r7 = retx;
-       r7 += -2;
-       retx = r7;
-       jump.s _ex_trap_c;
-ENDPROC(_ex_soft_bp)
-
 ENTRY(_ex_single_step)
        /* If we just returned from an interrupt, the single step event is
           for the RTI instruction.  */
@@ -1087,7 +1080,7 @@ ENTRY(_ex_table)
         * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined
         */
        .long _ex_syscall       /* 0x00 - User Defined - Linux Syscall */
-       .long _ex_soft_bp       /* 0x01 - User Defined - Software breakpoint */
+       .long _ex_trap_c        /* 0x01 - User Defined - Software breakpoint */
 #ifdef CONFIG_KGDB
        .long _ex_trap_c        /* 0x02 - User Defined - KGDB initial connection
                                                         and break signal trap */
index e1e42c029e15ba3d90dd2f9dbe60fb5a85531d20..698d4c05947e8ba48a21320344a8fc3f93162c00 100644 (file)
 
 __INIT
 
+ENTRY(__init_clear_bss)
+       r2 = r2 - r1;
+       cc = r2 == 0;
+       if cc jump .L_bss_done;
+       r2 >>= 2;
+       p1 = r1;
+       p2 = r2;
+       lsetup (1f, 1f) lc0 = p2;
+1:     [p1++] = r0;
+.L_bss_done:
+       rts;
+ENDPROC(__init_clear_bss)
+
 #define INITIAL_STACK  (L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12)
 
 ENTRY(__start)
@@ -144,6 +157,35 @@ ENTRY(__start)
        call _init_early_exception_vectors;
 #endif
 
+       r0 = 0 (x);
+       /* Zero out all of the fun bss regions */
+#if L1_DATA_A_LENGTH > 0
+       r1.l = __sbss_l1;
+       r1.h = __sbss_l1;
+       r2.l = __ebss_l1;
+       r2.h = __ebss_l1;
+       call __init_clear_bss
+#endif
+#if L1_DATA_B_LENGTH > 0
+       r1.l = __sbss_b_l1;
+       r1.h = __sbss_b_l1;
+       r2.l = __ebss_b_l1;
+       r2.h = __ebss_b_l1;
+       call __init_clear_bss
+#endif
+#if L2_LENGTH > 0
+       r1.l = __sbss_l2;
+       r1.h = __sbss_l2;
+       r2.l = __ebss_l2;
+       r2.h = __ebss_l2;
+       call __init_clear_bss
+#endif
+       r1.l = ___bss_start;
+       r1.h = ___bss_start;
+       r2.l = ___bss_stop;
+       r2.h = ___bss_stop;
+       call __init_clear_bss
+
        /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */
        call _bfin_relocate_l1_mem;
 #ifdef CONFIG_BFIN_KERNEL_CLOCK
@@ -185,19 +227,6 @@ ENDPROC(__start)
 # define WDOG_CTL WDOGA_CTL
 #endif
 
-ENTRY(__init_clear_bss)
-       r2 = r2 - r1;
-       cc = r2 == 0;
-       if cc jump .L_bss_done;
-       r2 >>= 2;
-       p1 = r1;
-       p2 = r2;
-       lsetup (1f, 1f) lc0 = p2;
-1:     [p1++] = r0;
-.L_bss_done:
-       rts;
-ENDPROC(__init_clear_bss)
-
 ENTRY(_real_start)
        /* Enable nested interrupts */
        [--sp] = reti;
@@ -209,35 +238,6 @@ ENTRY(_real_start)
        w[p0] = r0;
        ssync;
 
-       r0 = 0 (x);
-       /* Zero out all of the fun bss regions */
-#if L1_DATA_A_LENGTH > 0
-       r1.l = __sbss_l1;
-       r1.h = __sbss_l1;
-       r2.l = __ebss_l1;
-       r2.h = __ebss_l1;
-       call __init_clear_bss
-#endif
-#if L1_DATA_B_LENGTH > 0
-       r1.l = __sbss_b_l1;
-       r1.h = __sbss_b_l1;
-       r2.l = __ebss_b_l1;
-       r2.h = __ebss_b_l1;
-       call __init_clear_bss
-#endif
-#if L2_LENGTH > 0
-       r1.l = __sbss_l2;
-       r1.h = __sbss_l2;
-       r2.l = __ebss_l2;
-       r2.h = __ebss_l2;
-       call __init_clear_bss
-#endif
-       r1.l = ___bss_start;
-       r1.h = ___bss_start;
-       r2.l = ___bss_stop;
-       r2.h = ___bss_stop;
-       call __init_clear_bss
-
        /* Pass the u-boot arguments to the global value command line */
        R0 = R7;
        call _cmdline_init;
index 473df0f7fa78cdeb896fd404a54b8160f4823804..43c4eb9acb65e11b0ce1c0fdc480cb1849005a4d 100644 (file)
@@ -195,7 +195,7 @@ ENDPROC(_evt_ivhw)
 /* Interrupt routine for evt2 (NMI).
  * We don't actually use this, so just return.
  * For inner circle type details, please see:
- * http://docs.blackfin.uclinux.org/doku.php?id=linux:nmi
+ * http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:nmi
  */
 ENTRY(_evt_nmi)
 .weak _evt_nmi
index 1bba6030dce97e7d3521e6cf43c45e03c9118755..202494568c6c0303b76cafb279b1b06f97fc9963 100644 (file)
@@ -1101,10 +1101,9 @@ int __init init_arch_irq(void)
            IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 |
            IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW;
 
-#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) \
-       || defined(BF538_FAMILY) || defined(CONFIG_BF51x)
+#ifdef SIC_IWR0
        bfin_write_SIC_IWR0(IWR_DISABLE_ALL);
-#if defined(CONFIG_BF52x) || defined(CONFIG_BF51x)
+# ifdef SIC_IWR1
        /* BF52x/BF51x system reset does not properly reset SIC_IWR1 which
         * will screw up the bootrom as it relies on MDMA0/1 waking it
         * up from IDLE instructions.  See this report for more info:
@@ -1114,10 +1113,8 @@ int __init init_arch_irq(void)
                bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11));
        else
                bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
-#else
-       bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
-#endif
-# ifdef CONFIG_BF54x
+# endif
+# ifdef SIC_IWR2
        bfin_write_SIC_IWR2(IWR_DISABLE_ALL);
 # endif
 #else
index d3d70fd67c16190519693867521890acb95a62e9..f48a6aebb49b4e75abb7919a209c742f3e2b4369 100644 (file)
@@ -82,10 +82,9 @@ void bfin_pm_suspend_standby_enter(void)
 
        bfin_pm_standby_restore();
 
-#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x)  || defined(CONFIG_BF561) || \
-       defined(CONFIG_BF538) || defined(CONFIG_BF539) || defined(CONFIG_BF51x)
+#ifdef SIC_IWR0
        bfin_write_SIC_IWR0(IWR_DISABLE_ALL);
-#if defined(CONFIG_BF52x) || defined(CONFIG_BF51x)
+# ifdef SIC_IWR1
        /* BF52x system reset does not properly reset SIC_IWR1 which
         * will screw up the bootrom as it relies on MDMA0/1 waking it
         * up from IDLE instructions.  See this report for more info:
@@ -95,10 +94,8 @@ void bfin_pm_suspend_standby_enter(void)
                bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11));
        else
                bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
-#else
-       bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
-#endif
-# ifdef CONFIG_BF54x
+# endif
+# ifdef SIC_IWR2
        bfin_write_SIC_IWR2(IWR_DISABLE_ALL);
 # endif
 #else
index d98f0f4ff83f22c01df79ffc063d5aaafd8be4a7..6d5e6c5630e3b8a6efa5eccae0d3d5c10ece4516 100644 (file)
@@ -906,7 +906,7 @@ sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
  * @dir:  R/W or both.
  * @attrs: optional dma attributes
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 dma_addr_t
 sba_map_single_attrs(struct device *dev, void *addr, size_t size, int dir,
@@ -1024,7 +1024,7 @@ sba_mark_clean(struct ioc *ioc, dma_addr_t iova, size_t size)
  * @dir:  R/W or both.
  * @attrs: optional dma attributes
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size,
                            int dir, struct dma_attrs *attrs)
@@ -1102,7 +1102,7 @@ EXPORT_SYMBOL(sba_unmap_single_attrs);
  * @size:  number of bytes mapped in driver buffer.
  * @dma_handle:  IOVA of new buffer.
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 void *
 sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags)
@@ -1165,7 +1165,7 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp
  * @vaddr:  virtual address IOVA of "consistent" buffer.
  * @dma_handler:  IO virtual address of "consistent" buffer.
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 void sba_free_coherent (struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle)
 {
@@ -1420,7 +1420,7 @@ sba_coalesce_chunks(struct ioc *ioc, struct device *dev,
  * @dir:  R/W or both.
  * @attrs: optional dma attributes
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, int nents,
                     int dir, struct dma_attrs *attrs)
@@ -1512,7 +1512,7 @@ EXPORT_SYMBOL(sba_map_sg_attrs);
  * @dir:  R/W or both.
  * @attrs: optional dma attributes
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
                        int nents, int dir, struct dma_attrs *attrs)
index c5a214026a775c5d82e27fddd1c85cad2d883598..d0223abbbbd4c464df26e0aed6823de0b827944f 100644 (file)
@@ -443,7 +443,7 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
                size = pci_resource_len(dev, PCI_ROM_RESOURCE);
                addr = ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE],
                               size);
-               image_size = pci_get_rom_size(addr, size);
+               image_size = pci_get_rom_size(dev, addr, size);
                dev->resource[PCI_ROM_RESOURCE].start = (unsigned long) addr;
                dev->resource[PCI_ROM_RESOURCE].end =
                                        (unsigned long) addr + image_size - 1;
index 4e1801bad83a7fdc171a90af0ff3c2df4277f62f..e2eb2da60f963ee3aa7e62c727ef408026b4cd13 100644 (file)
@@ -269,7 +269,7 @@ sn_io_slot_fixup(struct pci_dev *dev)
 
                        rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE),
                                      size + 1);
-                       image_size = pci_get_rom_size(rom, size + 1);
+                       image_size = pci_get_rom_size(dev, rom, size + 1);
                        dev->resource[PCI_ROM_RESOURCE].end =
                                dev->resource[PCI_ROM_RESOURCE].start +
                                image_size - 1;
index 52c80c2a57f208924fb312a1ca1d03f02c4ea57b..600eef3f3ac7db71dc165946e657da08ee79a9ac 100644 (file)
@@ -351,7 +351,7 @@ config SGI_IP27
        select ARC64
        select BOOT_ELF64
        select DEFAULT_SGI_PARTITION
-       select DMA_IP27
+       select DMA_COHERENT
        select SYS_HAS_EARLY_PRINTK
        select HW_HAS_PCI
        select NR_CPUS_DEFAULT_64
@@ -761,9 +761,6 @@ config CFE
 config DMA_COHERENT
        bool
 
-config DMA_IP27
-       bool
-
 config DMA_NONCOHERENT
        bool
        select DMA_NEED_PCI_MAP_STATE
@@ -1368,7 +1365,7 @@ config CPU_SUPPORTS_64BIT_KERNEL
 #
 config HARDWARE_WATCHPOINTS
        bool
-       default y if CPU_MIPS32 || CPU_MIPS64
+       default y if CPU_MIPSR1 || CPU_MIPSR2
 
 menu "Kernel type"
 
index 32880146cbc1dc4aa2361785e5d9c88bf23a77ae..6fd441d16af57e6af53fa410fee70dac5204d66c 100644 (file)
@@ -89,7 +89,7 @@ static struct clock_event_device au1x_rtcmatch2_clockdev = {
        .irq            = AU1000_RTC_MATCH2_INT,
        .set_next_event = au1x_rtcmatch2_set_next_event,
        .set_mode       = au1x_rtcmatch2_set_mode,
-       .cpumask        = CPU_MASK_ALL,
+       .cpumask        = CPU_MASK_ALL_PTR,
 };
 
 static struct irqaction au1x_rtcmatch2_irqaction = {
index e085feddb4a489b0f0220e6f0ea9882d970e5dde..5f4e49ba4713fcc1fdd3040074e04acd24cf255e 100644 (file)
 #include <linux/serial.h>
 #include <linux/types.h>
 #include <linux/string.h>      /* for memset */
-#include <linux/serial.h>
 #include <linux/tty.h>
 #include <linux/time.h>
 #include <linux/platform_device.h>
 #include <linux/serial_core.h>
 #include <linux/serial_8250.h>
-#include <linux/string.h>
 
 #include <asm/processor.h>
 #include <asm/reboot.h>
index 34ea319be94c13cc08384b64b2535b46f119770f..f2baea3039bb8bfe6f95cc9828ff5dd0686b9510 100644 (file)
@@ -53,7 +53,7 @@ CONFIG_GENERIC_TIME=y
 CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
 CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
 CONFIG_ARC=y
-CONFIG_DMA_IP27=y
+CONFIG_DMA_COHERENT=y
 CONFIG_EARLY_PRINTK=y
 CONFIG_SYS_HAS_EARLY_PRINTK=y
 # CONFIG_NO_IOPORT is not set
index c996c3b4d074ddc2c3ed785b7bd9839e4c1cb663..1b332e15ab528522c19e4769c7691435e843dce1 100644 (file)
@@ -50,7 +50,7 @@
 static __inline__ void atomic_add(int i, atomic_t * v)
 {
        if (cpu_has_llsc && R10000_LLSC_WAR) {
-               unsigned long temp;
+               int temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -62,7 +62,7 @@ static __inline__ void atomic_add(int i, atomic_t * v)
                : "=&r" (temp), "=m" (v->counter)
                : "Ir" (i), "m" (v->counter));
        } else if (cpu_has_llsc) {
-               unsigned long temp;
+               int temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -95,7 +95,7 @@ static __inline__ void atomic_add(int i, atomic_t * v)
 static __inline__ void atomic_sub(int i, atomic_t * v)
 {
        if (cpu_has_llsc && R10000_LLSC_WAR) {
-               unsigned long temp;
+               int temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -107,7 +107,7 @@ static __inline__ void atomic_sub(int i, atomic_t * v)
                : "=&r" (temp), "=m" (v->counter)
                : "Ir" (i), "m" (v->counter));
        } else if (cpu_has_llsc) {
-               unsigned long temp;
+               int temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -135,12 +135,12 @@ static __inline__ void atomic_sub(int i, atomic_t * v)
  */
 static __inline__ int atomic_add_return(int i, atomic_t * v)
 {
-       unsigned long result;
+       int result;
 
        smp_llsc_mb();
 
        if (cpu_has_llsc && R10000_LLSC_WAR) {
-               unsigned long temp;
+               int temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -154,7 +154,7 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
                : "Ir" (i), "m" (v->counter)
                : "memory");
        } else if (cpu_has_llsc) {
-               unsigned long temp;
+               int temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -187,12 +187,12 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
 
 static __inline__ int atomic_sub_return(int i, atomic_t * v)
 {
-       unsigned long result;
+       int result;
 
        smp_llsc_mb();
 
        if (cpu_has_llsc && R10000_LLSC_WAR) {
-               unsigned long temp;
+               int temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -206,7 +206,7 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
                : "Ir" (i), "m" (v->counter)
                : "memory");
        } else if (cpu_has_llsc) {
-               unsigned long temp;
+               int temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -247,12 +247,12 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
  */
 static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
 {
-       unsigned long result;
+       int result;
 
        smp_llsc_mb();
 
        if (cpu_has_llsc && R10000_LLSC_WAR) {
-               unsigned long temp;
+               int temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -270,7 +270,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
                : "Ir" (i), "m" (v->counter)
                : "memory");
        } else if (cpu_has_llsc) {
-               unsigned long temp;
+               int temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -429,7 +429,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
 static __inline__ void atomic64_add(long i, atomic64_t * v)
 {
        if (cpu_has_llsc && R10000_LLSC_WAR) {
-               unsigned long temp;
+               long temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -441,7 +441,7 @@ static __inline__ void atomic64_add(long i, atomic64_t * v)
                : "=&r" (temp), "=m" (v->counter)
                : "Ir" (i), "m" (v->counter));
        } else if (cpu_has_llsc) {
-               unsigned long temp;
+               long temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -474,7 +474,7 @@ static __inline__ void atomic64_add(long i, atomic64_t * v)
 static __inline__ void atomic64_sub(long i, atomic64_t * v)
 {
        if (cpu_has_llsc && R10000_LLSC_WAR) {
-               unsigned long temp;
+               long temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -486,7 +486,7 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v)
                : "=&r" (temp), "=m" (v->counter)
                : "Ir" (i), "m" (v->counter));
        } else if (cpu_has_llsc) {
-               unsigned long temp;
+               long temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -514,12 +514,12 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v)
  */
 static __inline__ long atomic64_add_return(long i, atomic64_t * v)
 {
-       unsigned long result;
+       long result;
 
        smp_llsc_mb();
 
        if (cpu_has_llsc && R10000_LLSC_WAR) {
-               unsigned long temp;
+               long temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -533,7 +533,7 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
                : "Ir" (i), "m" (v->counter)
                : "memory");
        } else if (cpu_has_llsc) {
-               unsigned long temp;
+               long temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -566,12 +566,12 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
 
 static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
 {
-       unsigned long result;
+       long result;
 
        smp_llsc_mb();
 
        if (cpu_has_llsc && R10000_LLSC_WAR) {
-               unsigned long temp;
+               long temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -585,7 +585,7 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
                : "Ir" (i), "m" (v->counter)
                : "memory");
        } else if (cpu_has_llsc) {
-               unsigned long temp;
+               long temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -626,12 +626,12 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
  */
 static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
 {
-       unsigned long result;
+       long result;
 
        smp_llsc_mb();
 
        if (cpu_has_llsc && R10000_LLSC_WAR) {
-               unsigned long temp;
+               long temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
@@ -649,7 +649,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
                : "Ir" (i), "m" (v->counter)
                : "memory");
        } else if (cpu_has_llsc) {
-               unsigned long temp;
+               long temp;
 
                __asm__ __volatile__(
                "       .set    mips3                                   \n"
index b5cf6457305a5812bf4a973a03453a6bc53b0527..3cb50d17b62d8062fbbabab24046673c6e183409 100644 (file)
@@ -80,11 +80,8 @@ struct rb532_gpio_reg {
 /* Compact Flash GPIO pin */
 #define CF_GPIO_NUM            13
 
-extern void set_434_reg(unsigned reg_offs, unsigned bit, unsigned len, unsigned val);
-extern unsigned get_434_reg(unsigned reg_offs);
-extern void set_latch_u5(unsigned char or_mask, unsigned char nand_mask);
-extern unsigned char get_latch_u5(void);
 extern void rb532_gpio_set_ilevel(int bit, unsigned gpio);
 extern void rb532_gpio_set_istat(int bit, unsigned gpio);
+extern void rb532_gpio_set_func(unsigned gpio);
 
 #endif /* _RC32434_GPIO_H_ */
index 56738d8ec4e2b46b7e9c864ff99c48529028f28a..023a5b100ed05d617f24fb2c11fa749384c571bf 100644 (file)
@@ -30,4 +30,7 @@
 #define ETH0_RX_OVR_IRQ        (GROUP3_IRQ_BASE + 9)
 #define ETH0_TX_UND_IRQ        (GROUP3_IRQ_BASE + 10)
 
+#define GPIO_MAPPED_IRQ_BASE   GROUP4_IRQ_BASE
+#define GPIO_MAPPED_IRQ_GROUP  4
+
 #endif  /* __ASM_RC32434_IRQ_H */
index f25a8491670329ec0298e97bb8685bea31a7a02b..6dc5f8df1f3e025f22ac893d44b76a25f0da0d8e 100644 (file)
@@ -83,4 +83,7 @@ struct mpmc_device {
        void __iomem    *base;
 };
 
+extern void set_latch_u5(unsigned char or_mask, unsigned char nand_mask);
+extern unsigned char get_latch_u5(void);
+
 #endif  /* __ASM_RC32434_RB_H */
index 1f30d16d46697dcccdd4188524f4eaae91a6c5a9..ce47118e52b70e7265dab3caa00c84f2542cfafb 100644 (file)
@@ -105,7 +105,7 @@ struct pt_watch_regs {
        enum pt_watch_style style;
        union {
                struct mips32_watch_regs mips32;
-               struct mips32_watch_regs mips64;
+               struct mips64_watch_regs mips64;
        };
 };
 
index a275661fa7e1da92bce69be7ee876329c691b1d7..8f77f774a2a01e3b70fee2bae89a1b036c89fc6f 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef _ASM_TERMIOS_H
 #define _ASM_TERMIOS_H
 
+#include <linux/errno.h>
 #include <asm/termbits.h>
 #include <asm/ioctls.h>
 
@@ -94,38 +95,81 @@ struct termio {
 /*
  * Translate a "termio" structure into a "termios". Ugh.
  */
-#define user_termio_to_kernel_termios(termios, termio) \
-({ \
-       unsigned short tmp; \
-       get_user(tmp, &(termio)->c_iflag); \
-       (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
-       get_user(tmp, &(termio)->c_oflag); \
-       (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
-       get_user(tmp, &(termio)->c_cflag); \
-       (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
-       get_user(tmp, &(termio)->c_lflag); \
-       (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
-       get_user((termios)->c_line, &(termio)->c_line); \
-       copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
-})
+static inline int user_termio_to_kernel_termios(struct ktermios *termios,
+       struct termio __user *termio)
+{
+       unsigned short iflag, oflag, cflag, lflag;
+       unsigned int err;
+
+       if (!access_ok(VERIFY_READ, termio, sizeof(struct termio)))
+               return -EFAULT;
+
+       err = __get_user(iflag, &termio->c_iflag);
+       termios->c_iflag = (termios->c_iflag & 0xffff0000) | iflag;
+       err |=__get_user(oflag, &termio->c_oflag);
+       termios->c_oflag = (termios->c_oflag & 0xffff0000) | oflag;
+       err |=__get_user(cflag, &termio->c_cflag);
+       termios->c_cflag = (termios->c_cflag & 0xffff0000) | cflag;
+       err |=__get_user(lflag, &termio->c_lflag);
+       termios->c_lflag = (termios->c_lflag & 0xffff0000) | lflag;
+       err |=__get_user(termios->c_line, &termio->c_line);
+       if (err)
+               return -EFAULT;
+
+       if (__copy_from_user(termios->c_cc, termio->c_cc, NCC))
+               return -EFAULT;
+
+       return 0;
+}
 
 /*
  * Translate a "termios" structure into a "termio". Ugh.
  */
-#define kernel_termios_to_user_termio(termio, termios) \
-({ \
-       put_user((termios)->c_iflag, &(termio)->c_iflag); \
-       put_user((termios)->c_oflag, &(termio)->c_oflag); \
-       put_user((termios)->c_cflag, &(termio)->c_cflag); \
-       put_user((termios)->c_lflag, &(termio)->c_lflag); \
-       put_user((termios)->c_line, &(termio)->c_line); \
-       copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
-})
-
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
-#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
-#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
+static inline int kernel_termios_to_user_termio(struct termio __user *termio,
+       struct ktermios *termios)
+{
+       int err;
+
+       if (!access_ok(VERIFY_WRITE, termio, sizeof(struct termio)))
+               return -EFAULT;
+
+       err = __put_user(termios->c_iflag, &termio->c_iflag);
+       err |= __put_user(termios->c_oflag, &termio->c_oflag);
+       err |= __put_user(termios->c_cflag, &termio->c_cflag);
+       err |= __put_user(termios->c_lflag, &termio->c_lflag);
+       err |= __put_user(termios->c_line, &termio->c_line);
+       if (err)
+               return -EFAULT;
+
+       if (__copy_to_user(termio->c_cc, termios->c_cc, NCC))
+               return -EFAULT;
+
+       return 0;
+}
+
+static inline int user_termios_to_kernel_termios(struct ktermios __user *k,
+       struct termios2 *u)
+{
+       return copy_from_user(k, u, sizeof(struct termios2)) ? -EFAULT : 0;
+}
+
+static inline int kernel_termios_to_user_termios(struct termios2 __user *u,
+       struct ktermios *k)
+{
+       return copy_to_user(u, k, sizeof(struct termios2)) ? -EFAULT : 0;
+}
+
+static inline int user_termios_to_kernel_termios_1(struct ktermios *k,
+       struct termios __user *u)
+{
+       return copy_from_user(k, u, sizeof(struct termios)) ? -EFAULT : 0;
+}
+
+static inline int kernel_termios_to_user_termios_1(struct termios __user *u,
+       struct ktermios *k)
+{
+       return copy_to_user(u, k, sizeof(struct termios)) ? -EFAULT : 0;
+}
 
 #endif /* defined(__KERNEL__) */
 
index 88badb42301066dd22ac9ce4164875cabaadf5cd..964ef7ede2684eaff7d8f8c1ad1e5e83a7b6c651 100644 (file)
@@ -541,5 +541,6 @@ void tx4939_irq_init(void);
 int tx4939_irq(void);
 void tx4939_mtd_init(int ch);
 void tx4939_ata_init(void);
+void tx4939_rtc_init(void);
 
 #endif /* __ASM_TXX9_TX4939_H */
index fb6f73148df2f7c7459648ed110fcdde62145f2a..8882e5766f27ce5b7a8a57932b4b103b7a69eaa7 100644 (file)
@@ -458,7 +458,11 @@ NESTED(nmi_handler, PT_SIZE, sp)
        BUILD_HANDLER fpe fpe fpe silent                /* #15 */
        BUILD_HANDLER mdmx mdmx sti silent              /* #22 */
 #ifdef         CONFIG_HARDWARE_WATCHPOINTS
-       BUILD_HANDLER watch watch sti silent            /* #23 */
+       /*
+        * For watch, interrupts will be enabled after the watch
+        * registers are read.
+        */
+       BUILD_HANDLER watch watch cli silent            /* #23 */
 #else
        BUILD_HANDLER watch watch sti verbose           /* #23 */
 #endif
index 5e77a3a21f98e7926cc789915ad65bbe64911a1a..42461310b185c683b9738fda5af742a74718b5ae 100644 (file)
@@ -79,7 +79,8 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
 
        euid = current_euid();
        retval = -EPERM;
-       if (euid != p->euid && euid != p->uid && !capable(CAP_SYS_NICE)) {
+       if (euid != p->cred->euid && euid != p->cred->uid &&
+           !capable(CAP_SYS_NICE)) {
                read_unlock(&tasklist_lock);
                goto out_unlock;
        }
index f6083c6bfaa4f3b411b06103a3e48936933ee3b9..b2d7041341b8f5afa3e313302c21b90e34e5ea3d 100644 (file)
@@ -944,6 +944,9 @@ asmlinkage void do_mdmx(struct pt_regs *regs)
        force_sig(SIGILL, current);
 }
 
+/*
+ * Called with interrupts disabled.
+ */
 asmlinkage void do_watch(struct pt_regs *regs)
 {
        u32 cause;
@@ -963,9 +966,12 @@ asmlinkage void do_watch(struct pt_regs *regs)
         */
        if (test_tsk_thread_flag(current, TIF_LOAD_WATCH)) {
                mips_read_watch_registers();
+               local_irq_enable();
                force_sig(SIGTRAP, current);
-       } else
+       } else {
                mips_clear_watch_registers();
+               local_irq_enable();
+       }
 }
 
 asmlinkage void do_mcheck(struct pt_regs *regs)
@@ -1582,7 +1588,11 @@ void __init set_handler(unsigned long offset, void *addr, unsigned long size)
 static char panic_null_cerr[] __cpuinitdata =
        "Trying to set NULL cache error exception handler";
 
-/* Install uncached CPU exception handler */
+/*
+ * Install uncached CPU exception handler.
+ * This is suitable only for the cache error exception which is the only
+ * exception handler that is being run uncached.
+ */
 void __cpuinit set_uncached_handler(unsigned long offset, void *addr,
        unsigned long size)
 {
@@ -1593,7 +1603,7 @@ void __cpuinit set_uncached_handler(unsigned long offset, void *addr,
        unsigned long uncached_ebase = TO_UNCAC(ebase);
 #endif
        if (cpu_has_mips_r2)
-               ebase += (read_c0_ebase() & 0x3ffff000);
+               uncached_ebase += (read_c0_ebase() & 0x3ffff000);
 
        if (!addr)
                panic(panic_null_cerr);
index 736d0fb56a949772c546d85b32fc754c0177c499..68853a038d3fecf055daa4707af37c5462aa8cbe 100644 (file)
@@ -21,7 +21,7 @@
  * end of memory on some systems.  It's also a seriously bad idea on non
  * dma-coherent systems.
  */
-#if !defined(CONFIG_DMA_COHERENT) || !defined(CONFIG_DMA_IP27)
+#ifdef CONFIG_DMA_NONCOHERENT
 #undef CONFIG_CPU_HAS_PREFETCH
 #endif
 #ifdef CONFIG_MIPS_MALTA
index c06cccf60becd10ddecd344ff940fe30d064c13f..56a1f85a1ce807504a95d54d49b3d3cab46b33a6 100644 (file)
@@ -21,7 +21,7 @@
  * end of memory on some systems.  It's also a seriously bad idea on non
  * dma-coherent systems.
  */
-#if !defined(CONFIG_DMA_COHERENT) || !defined(CONFIG_DMA_IP27)
+#ifdef CONFIG_DMA_NONCOHERENT
 #undef CONFIG_CPU_HAS_PREFETCH
 #endif
 #ifdef CONFIG_MIPS_MALTA
index 6e99665ae860e540cafee642d5d3daf0c1537738..c43f4b26a69010b63154a734618060c0981b692e 100644 (file)
@@ -618,15 +618,35 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
        if (cpu_has_inclusive_pcaches) {
                if (size >= scache_size)
                        r4k_blast_scache();
-               else
+               else {
+                       unsigned long lsize = cpu_scache_line_size();
+                       unsigned long almask = ~(lsize - 1);
+
+                       /*
+                        * There is no clearly documented alignment requirement
+                        * for the cache instruction on MIPS processors and
+                        * some processors, among them the RM5200 and RM7000
+                        * QED processors will throw an address error for cache
+                        * hit ops with insufficient alignment.  Solved by
+                        * aligning the address to cache line size.
+                        */
+                       cache_op(Hit_Writeback_Inv_SD, addr & almask);
+                       cache_op(Hit_Writeback_Inv_SD,
+                                (addr + size - 1) & almask);
                        blast_inv_scache_range(addr, addr + size);
+               }
                return;
        }
 
        if (cpu_has_safe_index_cacheops && size >= dcache_size) {
                r4k_blast_dcache();
        } else {
+               unsigned long lsize = cpu_dcache_line_size();
+               unsigned long almask = ~(lsize - 1);
+
                R4600_HIT_CACHEOP_WAR_IMPL;
+               cache_op(Hit_Writeback_Inv_D, addr & almask);
+               cache_op(Hit_Writeback_Inv_D, (addr + size - 1)  & almask);
                blast_inv_dcache_range(addr, addr + size);
        }
 
index fa636fc6b7b90403a2a8771ef3c5f023a1a82cd4..55767ad9f00ee4a5aec5be3e984d5a971b808eb9 100644 (file)
@@ -97,7 +97,6 @@ good_area:
                        goto bad_area;
        }
 
-survive:
        /*
         * If for any reason at all we couldn't handle the fault,
         * make sure we exit gracefully rather than endlessly redo
@@ -167,21 +166,13 @@ no_context:
               field,  regs->regs[31]);
        die("Oops", regs);
 
-/*
- * We ran out of memory, or some other thing happened to us that made
- * us unable to handle the page fault gracefully.
- */
 out_of_memory:
-       up_read(&mm->mmap_sem);
-       if (is_global_init(tsk)) {
-               yield();
-               down_read(&mm->mmap_sem);
-               goto survive;
-       }
-       printk("VM: killing process %s\n", tsk->comm);
-       if (user_mode(regs))
-               do_group_exit(SIGKILL);
-       goto no_context;
+       /*
+        * We ran out of memory, call the OOM killer, and return the userspace
+        * (which will retry the fault, or kill us if we got oom-killed).
+        */
+       pagefault_out_of_memory();
+       return;
 
 do_sigbus:
        up_read(&mm->mmap_sem);
index 1c2821e2f494c303ccdee8b823ff5754fcb74abd..71f7d27b0d4cccf28dba3777b0a8848de53f82c4 100644 (file)
@@ -205,6 +205,8 @@ static int __init rc32434_pcibridge_init(void)
 
 static int __init rc32434_pci_init(void)
 {
+       void __iomem *io_map_base;
+
        pr_info("PCI: Initializing PCI\n");
 
        ioport_resource.start = rc32434_res_pci_io1.start;
@@ -212,6 +214,15 @@ static int __init rc32434_pci_init(void)
 
        rc32434_pcibridge_init();
 
+       io_map_base = ioremap(rc32434_res_pci_io1.start,
+               rc32434_res_pci_io1.end - rc32434_res_pci_io1.start + 1);
+
+       if (!io_map_base)
+               return -ENOMEM;
+
+       rc32434_controller.io_map_base =
+               (unsigned long)io_map_base - rc32434_res_pci_io1.start;
+
        register_pci_controller(&rc32434_controller);
        rc32434_sync();
 
index c1c29181bd4641de62977a19107a4d5ad64734c0..4a5f05b662aef219fbbc6dd28b8326b0f6b7c889 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/gpio_keys.h>
 #include <linux/input.h>
+#include <linux/serial_8250.h>
 
 #include <asm/bootinfo.h>
 
 #define ETH0_RX_DMA_ADDR  (DMA0_BASE_ADDR + 0 * DMA_CHAN_OFFSET)
 #define ETH0_TX_DMA_ADDR  (DMA0_BASE_ADDR + 1 * DMA_CHAN_OFFSET)
 
+extern unsigned int idt_cpu_freq;
+
+static struct mpmc_device dev3;
+
+void set_latch_u5(unsigned char or_mask, unsigned char nand_mask)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&dev3.lock, flags);
+
+       dev3.state = (dev3.state | or_mask) & ~nand_mask;
+       writeb(dev3.state, dev3.base);
+
+       spin_unlock_irqrestore(&dev3.lock, flags);
+}
+EXPORT_SYMBOL(set_latch_u5);
+
+unsigned char get_latch_u5(void)
+{
+       return dev3.state;
+}
+EXPORT_SYMBOL(get_latch_u5);
+
 static struct resource korina_dev0_res[] = {
        {
                .name = "korina_regs",
@@ -86,7 +110,7 @@ static struct korina_device korina_dev0_data = {
 static struct platform_device korina_dev0 = {
        .id = -1,
        .name = "korina",
-       .dev.platform_data = &korina_dev0_data,
+       .dev.driver_data = &korina_dev0_data,
        .resource = korina_dev0_res,
        .num_resources = ARRAY_SIZE(korina_dev0_res),
 };
@@ -214,12 +238,32 @@ static struct platform_device rb532_wdt = {
        .num_resources  = ARRAY_SIZE(rb532_wdt_res),
 };
 
+static struct plat_serial8250_port rb532_uart_res[] = {
+       {
+               .membase        = (char *)KSEG1ADDR(REGBASE + UART0BASE),
+               .irq            = UART0_IRQ,
+               .regshift       = 2,
+               .iotype         = UPIO_MEM,
+               .flags          = UPF_BOOT_AUTOCONF,
+       },
+       {
+               .flags          = 0,
+       }
+};
+
+static struct platform_device rb532_uart = {
+       .name              = "serial8250",
+       .id                = PLAT8250_DEV_PLATFORM,
+       .dev.platform_data = &rb532_uart_res,
+};
+
 static struct platform_device *rb532_devs[] = {
        &korina_dev0,
        &nand_slot0,
        &cf_slot0,
        &rb532_led,
        &rb532_button,
+       &rb532_uart,
        &rb532_wdt
 };
 
@@ -291,9 +335,20 @@ static int __init plat_setup_devices(void)
        nand_slot0_res[0].start = readl(IDT434_REG_BASE + DEV2BASE);
        nand_slot0_res[0].end = nand_slot0_res[0].start + 0x1000;
 
+       /* Read and map device controller 3 */
+       dev3.base = ioremap_nocache(readl(IDT434_REG_BASE + DEV3BASE), 1);
+
+       if (!dev3.base) {
+               printk(KERN_ERR "rb532: cannot remap device controller 3\n");
+               return -ENXIO;
+       }
+
        /* Initialise the NAND device */
        rb532_nand_setup();
 
+       /* set the uart clock to the current cpu frequency */
+       rb532_uart_res[0].uartclk = idt_cpu_freq;
+
        return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs));
 }
 
index 0e84c8ab6a3932b39adbfbe2cb8144fae39ba51d..37de05d595e725ebdc59513181d3f43709ce1cb4 100644 (file)
@@ -41,8 +41,6 @@ struct rb532_gpio_chip {
        void __iomem     *regbase;
 };
 
-struct mpmc_device dev3;
-
 static struct resource rb532_gpio_reg0_res[] = {
        {
                .name   = "gpio_reg0",
@@ -52,61 +50,6 @@ static struct resource rb532_gpio_reg0_res[] = {
        }
 };
 
-static struct resource rb532_dev3_ctl_res[] = {
-       {
-               .name   = "dev3_ctl",
-               .start  = REGBASE + DEV3BASE,
-               .end    = REGBASE + DEV3BASE + sizeof(struct dev_reg) - 1,
-               .flags  = IORESOURCE_MEM,
-       }
-};
-
-void set_434_reg(unsigned reg_offs, unsigned bit, unsigned len, unsigned val)
-{
-       unsigned long flags;
-       unsigned data;
-       unsigned i = 0;
-
-       spin_lock_irqsave(&dev3.lock, flags);
-
-       data = readl(IDT434_REG_BASE + reg_offs);
-       for (i = 0; i != len; ++i) {
-               if (val & (1 << i))
-                       data |= (1 << (i + bit));
-               else
-                       data &= ~(1 << (i + bit));
-       }
-       writel(data, (IDT434_REG_BASE + reg_offs));
-
-       spin_unlock_irqrestore(&dev3.lock, flags);
-}
-EXPORT_SYMBOL(set_434_reg);
-
-unsigned get_434_reg(unsigned reg_offs)
-{
-       return readl(IDT434_REG_BASE + reg_offs);
-}
-EXPORT_SYMBOL(get_434_reg);
-
-void set_latch_u5(unsigned char or_mask, unsigned char nand_mask)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(&dev3.lock, flags);
-
-       dev3.state = (dev3.state | or_mask) & ~nand_mask;
-       writel(dev3.state, &dev3.base);
-
-       spin_unlock_irqrestore(&dev3.lock, flags);
-}
-EXPORT_SYMBOL(set_latch_u5);
-
-unsigned char get_latch_u5(void)
-{
-       return dev3.state;
-}
-EXPORT_SYMBOL(get_latch_u5);
-
 /* rb532_set_bit - sanely set a bit
  *
  * bitval: new value for the bit
@@ -119,13 +62,11 @@ static inline void rb532_set_bit(unsigned bitval,
        unsigned long flags;
        u32 val;
 
-       bitval = !!bitval;              /* map parameter to {0,1} */
-
        local_irq_save(flags);
 
        val = readl(ioaddr);
-       val &= ~( ~bitval << offset );   /* unset bit if bitval == 0 */
-       val |=  (  bitval << offset );   /* set bit if bitval == 1 */
+       val &= ~(!bitval << offset);   /* unset bit if bitval == 0 */
+       val |= (!!bitval << offset);   /* set bit if bitval == 1 */
        writel(val, ioaddr);
 
        local_irq_restore(flags);
@@ -171,8 +112,8 @@ static int rb532_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 
        gpch = container_of(chip, struct rb532_gpio_chip, chip);
 
-       if (rb532_get_bit(offset, gpch->regbase + GPIOFUNC))
-               return 1;       /* alternate function, GPIOCFG is ignored */
+       /* disable alternate function in case it's set */
+       rb532_set_bit(0, offset, gpch->regbase + GPIOFUNC);
 
        rb532_set_bit(0, offset, gpch->regbase + GPIOCFG);
        return 0;
@@ -188,8 +129,8 @@ static int rb532_gpio_direction_output(struct gpio_chip *chip,
 
        gpch = container_of(chip, struct rb532_gpio_chip, chip);
 
-       if (rb532_get_bit(offset, gpch->regbase + GPIOFUNC))
-               return 1;       /* alternate function, GPIOCFG is ignored */
+       /* disable alternate function in case it's set */
+       rb532_set_bit(0, offset, gpch->regbase + GPIOFUNC);
 
        /* set the initial output value */
        rb532_set_bit(value, offset, gpch->regbase + GPIOD);
@@ -233,10 +174,11 @@ EXPORT_SYMBOL(rb532_gpio_set_istat);
 /*
  * Configure GPIO alternate function
  */
-static void rb532_gpio_set_func(int bit, unsigned gpio)
+void rb532_gpio_set_func(unsigned gpio)
 {
-       rb532_set_bit(bit, gpio, rb532_gpio_chip->regbase + GPIOFUNC);
+       rb532_set_bit(1, gpio, rb532_gpio_chip->regbase + GPIOFUNC);
 }
+EXPORT_SYMBOL(rb532_gpio_set_func);
 
 int __init rb532_gpio_init(void)
 {
@@ -253,20 +195,6 @@ int __init rb532_gpio_init(void)
        /* Register our GPIO chip */
        gpiochip_add(&rb532_gpio_chip->chip);
 
-       r = rb532_dev3_ctl_res;
-       dev3.base = ioremap_nocache(r->start, r->end - r->start);
-
-       if (!dev3.base) {
-               printk(KERN_ERR "rb532: cannot remap device controller 3\n");
-               return -ENXIO;
-       }
-
-       /* configure CF_GPIO_NUM as CFRDY IRQ source */
-       rb532_gpio_set_func(0, CF_GPIO_NUM);
-       rb532_gpio_direction_input(&rb532_gpio_chip->chip, CF_GPIO_NUM);
-       rb532_gpio_set_ilevel(1, CF_GPIO_NUM);
-       rb532_gpio_set_istat(0, CF_GPIO_NUM);
-
        return 0;
 }
 arch_initcall(rb532_gpio_init);
index 549b46d2fcee3574ac823fd6425ae049c38329bc..53eeb5e7bc5bf4e0b4b3d8efe3f1dbaa1c9e7e9a 100644 (file)
@@ -46,6 +46,7 @@
 #include <asm/system.h>
 
 #include <asm/mach-rc32434/irq.h>
+#include <asm/mach-rc32434/gpio.h>
 
 struct intr_group {
        u32 mask;       /* mask of valid bits in pending/mask registers */
@@ -150,6 +151,9 @@ static void rb532_disable_irq(unsigned int irq_nr)
                mask |= intr_bit;
                WRITE_MASK(addr, mask);
 
+               if (group == GPIO_MAPPED_IRQ_GROUP)
+                       rb532_gpio_set_istat(0, irq_nr - GPIO_MAPPED_IRQ_BASE);
+
                /*
                 * if there are no more interrupts enabled in this
                 * group, disable corresponding IP
@@ -165,12 +169,35 @@ static void rb532_mask_and_ack_irq(unsigned int irq_nr)
        ack_local_irq(group_to_ip(irq_to_group(irq_nr)));
 }
 
+static int rb532_set_type(unsigned int irq_nr, unsigned type)
+{
+       int gpio = irq_nr - GPIO_MAPPED_IRQ_BASE;
+       int group = irq_to_group(irq_nr);
+
+       if (group != GPIO_MAPPED_IRQ_GROUP)
+               return (type == IRQ_TYPE_LEVEL_HIGH) ? 0 : -EINVAL;
+
+       switch (type) {
+       case IRQ_TYPE_LEVEL_HIGH:
+               rb532_gpio_set_ilevel(1, gpio);
+               break;
+       case IRQ_TYPE_LEVEL_LOW:
+               rb532_gpio_set_ilevel(0, gpio);
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
 static struct irq_chip rc32434_irq_type = {
        .name           = "RB532",
        .ack            = rb532_disable_irq,
        .mask           = rb532_disable_irq,
        .mask_ack       = rb532_mask_and_ack_irq,
        .unmask         = rb532_enable_irq,
+       .set_type       = rb532_set_type,
 };
 
 void __init arch_init_irq(void)
index 3e0d7ec3a5795315830f8033a542de360fd1f1b5..00ed19f0bdb56e4a9045ba7e2f7388562978d6a4 100644 (file)
@@ -36,7 +36,7 @@
 extern unsigned int idt_cpu_freq;
 
 static struct uart_port rb532_uart = {
-       .type = PORT_16550A,
+       .flags = UPF_BOOT_AUTOCONF,
        .line = 0,
        .irq = UART0_IRQ,
        .iotype = UPIO_MEM,
index 6c0049a5bbc145d644a7cfc1636d8b807c6728d9..55440967b3a88ddaef9d07cef1e79263f5648d7b 100644 (file)
@@ -435,6 +435,28 @@ void __init tx4939_ata_init(void)
                platform_device_register(&ata1_dev);
 }
 
+void __init tx4939_rtc_init(void)
+{
+       static struct resource res[] = {
+               {
+                       .start = TX4939_RTC_REG & 0xfffffffffULL,
+                       .end = (TX4939_RTC_REG & 0xfffffffffULL) + 0x100 - 1,
+                       .flags = IORESOURCE_MEM,
+               }, {
+                       .start = TXX9_IRQ_BASE + TX4939_IR_RTC,
+                       .flags = IORESOURCE_IRQ,
+               },
+       };
+       static struct platform_device rtc_dev = {
+               .name = "tx4939rtc",
+               .id = -1,
+               .num_resources = ARRAY_SIZE(res),
+               .resource = res,
+       };
+
+       platform_device_register(&rtc_dev);
+}
+
 static void __init tx4939_stop_unused_modules(void)
 {
        __u64 pcfg, rst = 0, ckd = 0;
index 98fbd9391bf8f7daaba63670970feea77665d30d..656603b85b711964db905fa41bc8b454306a60af 100644 (file)
@@ -336,6 +336,7 @@ static void __init rbtx4939_device_init(void)
        rbtx4939_led_setup();
        tx4939_wdt_init();
        tx4939_ata_init();
+       tx4939_rtc_init();
 }
 
 static void __init rbtx4939_setup(void)
index 53af696f23d2fda10025551686d9ce15e01f1f00..da69433809080b2ff41aae083f4312da996becf7 100644 (file)
@@ -5,7 +5,7 @@
 #include <asm/cacheflush.h>
 #include <asm/scatterlist.h>
 
-/* See Documentation/DMA-mapping.txt */
+/* See Documentation/PCI/PCI-DMA-mapping.txt */
 struct hppa_dma_ops {
        int  (*dma_supported)(struct device *dev, u64 mask);
        void *(*alloc_consistent)(struct device *dev, size_t size, dma_addr_t *iova, gfp_t flag);
index ccd61b9567a6e8f837426961ec1c4de231c517f2..df47895db8287e0d520a1575e5a3aeda672e5412 100644 (file)
@@ -2,7 +2,7 @@
 ** PARISC 1.1 Dynamic DMA mapping support.
 ** This implementation is for PA-RISC platforms that do not support
 ** I/O TLBs (aka DMA address translation hardware).
-** See Documentation/DMA-mapping.txt for interface definitions.
+** See Documentation/PCI/PCI-DMA-mapping.txt for interface definitions.
 **
 **      (c) Copyright 1999,2000 Hewlett-Packard Company
 **      (c) Copyright 2000 Grant Grundler
index 99c495ad9c750a6d554e32b31b5617f82de990fb..1239c6132b4ab1c5f4ff13bfc9a1db1d689a1941 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28-rc4
-# Thu Nov 13 02:12:40 2008
+# Linux kernel version: 2.6.29-rc2
+# Mon Jan 26 21:41:58 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -43,7 +43,7 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_PPC=y
 CONFIG_EARLY_PRINTK=y
 CONFIG_GENERIC_NVRAM=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
 CONFIG_ARCH_MAY_HAVE_PC_FDC=y
 CONFIG_PPC_OF=y
 CONFIG_OF=y
@@ -71,14 +71,23 @@ CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_CLASSIC_RCU=y
+# CONFIG_TREE_RCU is not set
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_PREEMPT_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_CGROUPS is not set
 CONFIG_GROUP_SCHED=y
 CONFIG_FAIR_GROUP_SCHED=y
 # CONFIG_RT_GROUP_SCHED is not set
 CONFIG_USER_SCHED=y
 # CONFIG_CGROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
 CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
@@ -110,7 +119,6 @@ CONFIG_SLUB_DEBUG=y
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
 CONFIG_HAVE_IOREMAP_PROT=y
@@ -121,13 +129,11 @@ CONFIG_HAVE_CLK=y
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
 # CONFIG_MODULES is not set
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -143,7 +149,6 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
 # CONFIG_FREEZER is not set
 
 #
@@ -182,9 +187,8 @@ CONFIG_PPC_MPC5200_SIMPLE=y
 # CONFIG_TAU is not set
 # CONFIG_FSL_ULI1575 is not set
 CONFIG_PPC_BESTCOMM=y
-# CONFIG_PPC_BESTCOMM_ATA is not set
 CONFIG_PPC_BESTCOMM_FEC=y
-# CONFIG_PPC_BESTCOMM_GEN_BD is not set
+# CONFIG_SIMPLE_GPIO is not set
 
 #
 # Kernel options
@@ -211,6 +215,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -222,12 +227,14 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_MIGRATION=y
-# CONFIG_RESOURCES_64BIT is not set
 # CONFIG_PHYS_ADDR_T_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
 CONFIG_UNEVICTABLE_LRU=y
+CONFIG_PPC_4K_PAGES=y
+# CONFIG_PPC_16K_PAGES is not set
+# CONFIG_PPC_64K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -268,6 +275,7 @@ CONFIG_NET=y
 #
 # Networking options
 #
+CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -324,6 +332,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
 # CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
 
 #
 # Network testing
@@ -336,6 +345,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 # CONFIG_PHONET is not set
 # CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
 
@@ -426,6 +436,12 @@ CONFIG_MTD_PHYSMAP_OF=y
 # CONFIG_MTD_NAND is not set
 # CONFIG_MTD_ONENAND is not set
 
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+# CONFIG_MTD_QINFO_PROBE is not set
+
 #
 # UBI - Unsorted block images
 #
@@ -514,6 +530,9 @@ CONFIG_LXT_PHY=y
 # CONFIG_BROADCOM_PHY is not set
 # CONFIG_ICPLUS_PHY is not set
 # CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
 # CONFIG_FIXED_PHY is not set
 # CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
@@ -538,6 +557,10 @@ CONFIG_FEC_MPC52xx_MDIO=y
 # CONFIG_WLAN_80211 is not set
 # CONFIG_IWLWIFI_LEDS is not set
 
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
 #
 # USB Network Adapters
 #
@@ -588,8 +611,10 @@ CONFIG_SERIAL_MPC52xx=y
 CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=57600
 CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_HVC_UDBG is not set
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
 # CONFIG_NVRAM is not set
@@ -629,8 +654,6 @@ CONFIG_I2C_MPC=y
 # Miscellaneous I2C Chip support
 #
 # CONFIG_DS1682 is not set
-# CONFIG_EEPROM_AT24 is not set
-# CONFIG_EEPROM_LEGACY is not set
 # CONFIG_SENSORS_PCF8574 is not set
 # CONFIG_PCF8575 is not set
 # CONFIG_SENSORS_PCA9539 is not set
@@ -675,10 +698,12 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_PASIC3 is not set
+# CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
 # CONFIG_REGULATOR is not set
 
 #
@@ -736,6 +761,7 @@ CONFIG_USB_DEVICEFS=y
 # USB Host Controller Drivers
 #
 # CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
 # CONFIG_USB_ISP1760_HCD is not set
 CONFIG_USB_OHCI_HCD=y
@@ -760,18 +786,17 @@ CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
 # CONFIG_USB_TMC is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
 #
 
 #
-# may also be needed; see USB_STORAGE Help for more information
+# see USB_STORAGE Help for more information
 #
 CONFIG_USB_STORAGE=y
 # CONFIG_USB_STORAGE_DEBUG is not set
 # CONFIG_USB_STORAGE_DATAFAB is not set
 # CONFIG_USB_STORAGE_FREECOM is not set
 # CONFIG_USB_STORAGE_ISD200 is not set
-# CONFIG_USB_STORAGE_DPCM is not set
 # CONFIG_USB_STORAGE_USBAT is not set
 # CONFIG_USB_STORAGE_SDDR09 is not set
 # CONFIG_USB_STORAGE_SDDR55 is not set
@@ -817,6 +842,10 @@ CONFIG_USB_STORAGE=y
 # CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_VST is not set
 # CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
 # CONFIG_MMC is not set
 # CONFIG_MEMSTICK is not set
 # CONFIG_NEW_LEDS is not set
@@ -826,7 +855,6 @@ CONFIG_USB_STORAGE=y
 # CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 # CONFIG_STAGING is not set
-CONFIG_STAGING_EXCLUDE_BUILD=y
 
 #
 # File systems
@@ -847,6 +875,7 @@ CONFIG_FS_MBCACHE=y
 CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -883,10 +912,7 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
 # CONFIG_CONFIGFS_FS is not set
-
-#
-# Miscellaneous filesystems
-#
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
@@ -906,6 +932,7 @@ CONFIG_JFFS2_ZLIB=y
 CONFIG_JFFS2_RTIME=y
 # CONFIG_JFFS2_RUBIN is not set
 CONFIG_CRAMFS=y
+# CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_OMFS_FS is not set
@@ -1002,6 +1029,7 @@ CONFIG_NLS_ISO8859_1=y
 # Library routines
 #
 CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
 # CONFIG_CRC_T10DIF is not set
@@ -1053,6 +1081,7 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
 # CONFIG_BOOT_PRINTK_DELAY is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
@@ -1061,6 +1090,8 @@ CONFIG_SCHED_DEBUG=y
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
 
 #
 # Tracers
@@ -1069,11 +1100,13 @@ CONFIG_HAVE_FUNCTION_TRACER=y
 # CONFIG_SCHED_TRACER is not set
 # CONFIG_CONTEXT_SWITCH_TRACER is not set
 # CONFIG_BOOT_TRACER is not set
+# CONFIG_TRACE_BRANCH_PROFILING is not set
 # CONFIG_STACK_TRACER is not set
 # CONFIG_DYNAMIC_PRINTK_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
@@ -1100,11 +1133,15 @@ CONFIG_CRYPTO=y
 #
 # CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD2=y
 CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
 # CONFIG_CRYPTO_CRYPTD is not set
index 9796220032fda43b4ed80d846b20cf967398cecc..b7b88056290660e0337031baef39b934e23c16f5 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28-rc4
-# Thu Nov 13 02:10:16 2008
+# Linux kernel version: 2.6.29-rc2
+# Mon Jan 26 21:41:14 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -43,7 +43,7 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_PPC=y
 CONFIG_EARLY_PRINTK=y
 CONFIG_GENERIC_NVRAM=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
 CONFIG_ARCH_MAY_HAVE_PC_FDC=y
 CONFIG_PPC_OF=y
 CONFIG_OF=y
@@ -72,14 +72,23 @@ CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_CLASSIC_RCU=y
+# CONFIG_TREE_RCU is not set
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_PREEMPT_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_CGROUPS is not set
 CONFIG_GROUP_SCHED=y
 # CONFIG_FAIR_GROUP_SCHED is not set
 # CONFIG_RT_GROUP_SCHED is not set
 CONFIG_USER_SCHED=y
 # CONFIG_CGROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
 CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
@@ -112,7 +121,6 @@ CONFIG_SLUB_DEBUG=y
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
 CONFIG_HAVE_IOREMAP_PROT=y
@@ -123,7 +131,6 @@ CONFIG_HAVE_CLK=y
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
 # CONFIG_MODULE_FORCE_LOAD is not set
@@ -131,11 +138,9 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
-CONFIG_KMOD=y
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -151,7 +156,6 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
 CONFIG_FREEZER=y
 
 #
@@ -192,7 +196,7 @@ CONFIG_PPC_LITE5200=y
 CONFIG_PPC_BESTCOMM=y
 CONFIG_PPC_BESTCOMM_ATA=y
 CONFIG_PPC_BESTCOMM_FEC=y
-CONFIG_PPC_BESTCOMM_GEN_BD=y
+# CONFIG_SIMPLE_GPIO is not set
 
 #
 # Kernel options
@@ -220,6 +224,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -231,12 +236,14 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_MIGRATION=y
-# CONFIG_RESOURCES_64BIT is not set
 # CONFIG_PHYS_ADDR_T_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
 CONFIG_UNEVICTABLE_LRU=y
+CONFIG_PPC_4K_PAGES=y
+# CONFIG_PPC_16K_PAGES is not set
+# CONFIG_PPC_64K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -264,6 +271,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_MSI is not set
 CONFIG_PCI_LEGACY=y
 # CONFIG_PCI_DEBUG is not set
+# CONFIG_PCI_STUB is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -286,6 +294,7 @@ CONFIG_NET=y
 #
 # Networking options
 #
+CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -342,6 +351,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
 # CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
 
 #
 # Network testing
@@ -354,6 +364,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 # CONFIG_PHONET is not set
 # CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
 
@@ -396,13 +407,19 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
 # CONFIG_PHANTOM is not set
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
 # CONFIG_ICS932S401 is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_93CX6 is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -445,6 +462,7 @@ CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SCSI_SRP_ATTRS is not set
 CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
+# CONFIG_SCSI_CXGB3_ISCSI is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
 # CONFIG_SCSI_3W_9XXX is not set
 # CONFIG_SCSI_ACARD is not set
@@ -461,6 +479,8 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_MEGARAID_SAS is not set
 # CONFIG_SCSI_HPTIOP is not set
 # CONFIG_SCSI_BUSLOGIC is not set
+# CONFIG_LIBFC is not set
+# CONFIG_FCOE is not set
 # CONFIG_SCSI_DMX3191D is not set
 # CONFIG_SCSI_EATA is not set
 # CONFIG_SCSI_FUTURE_DOMAIN is not set
@@ -580,6 +600,9 @@ CONFIG_LXT_PHY=y
 # CONFIG_BROADCOM_PHY is not set
 # CONFIG_ICPLUS_PHY is not set
 # CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
 # CONFIG_FIXED_PHY is not set
 # CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
@@ -626,6 +649,7 @@ CONFIG_NETDEV_1000=y
 # CONFIG_JME is not set
 CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
+CONFIG_CHELSIO_T3_DEPENDS=y
 # CONFIG_CHELSIO_T3 is not set
 # CONFIG_ENIC is not set
 # CONFIG_IXGBE is not set
@@ -648,6 +672,10 @@ CONFIG_NETDEV_10000=y
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
 # CONFIG_IWLWIFI_LEDS is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
@@ -695,8 +723,10 @@ CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
 # CONFIG_SERIAL_JSM is not set
 CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_HVC_UDBG is not set
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
 # CONFIG_NVRAM is not set
@@ -762,8 +792,6 @@ CONFIG_I2C_MPC=y
 # Miscellaneous I2C Chip support
 #
 # CONFIG_DS1682 is not set
-# CONFIG_EEPROM_AT24 is not set
-# CONFIG_EEPROM_LEGACY is not set
 # CONFIG_SENSORS_PCF8574 is not set
 # CONFIG_PCF8575 is not set
 # CONFIG_SENSORS_PCA9539 is not set
@@ -796,10 +824,12 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_PASIC3 is not set
+# CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
 # CONFIG_REGULATOR is not set
 
 #
@@ -846,9 +876,13 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 #
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
 #
 # CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
 # CONFIG_UWB is not set
 # CONFIG_MMC is not set
 # CONFIG_MEMSTICK is not set
@@ -860,7 +894,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 # CONFIG_STAGING is not set
-CONFIG_STAGING_EXCLUDE_BUILD=y
 
 #
 # File systems
@@ -881,6 +914,7 @@ CONFIG_FS_MBCACHE=y
 CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -914,10 +948,7 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
 # CONFIG_CONFIGFS_FS is not set
-
-#
-# Miscellaneous filesystems
-#
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
@@ -926,6 +957,7 @@ CONFIG_TMPFS=y
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_OMFS_FS is not set
@@ -967,6 +999,7 @@ CONFIG_MSDOS_PARTITION=y
 # Library routines
 #
 CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
 # CONFIG_CRC_T10DIF is not set
@@ -1016,6 +1049,7 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
 # CONFIG_BOOT_PRINTK_DELAY is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
@@ -1024,6 +1058,8 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
 
 #
 # Tracers
@@ -1032,11 +1068,13 @@ CONFIG_HAVE_FUNCTION_TRACER=y
 # CONFIG_SCHED_TRACER is not set
 # CONFIG_CONTEXT_SWITCH_TRACER is not set
 # CONFIG_BOOT_TRACER is not set
+# CONFIG_TRACE_BRANCH_PROFILING is not set
 # CONFIG_STACK_TRACER is not set
 # CONFIG_DYNAMIC_PRINTK_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
@@ -1063,11 +1101,15 @@ CONFIG_CRYPTO=y
 #
 # CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD2=y
 CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
 # CONFIG_CRYPTO_CRYPTD is not set
index d081e00310578dac8f5a3d0be9ec960fd367e489..fb10f22fd0d21777dff595879b61fdd41e5f5ddd 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28-rc4
-# Thu Nov 13 02:11:02 2008
+# Linux kernel version: 2.6.29-rc2
+# Mon Jan 26 21:42:29 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -43,7 +43,7 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_PPC=y
 CONFIG_EARLY_PRINTK=y
 CONFIG_GENERIC_NVRAM=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
 CONFIG_ARCH_MAY_HAVE_PC_FDC=y
 CONFIG_PPC_OF=y
 CONFIG_OF=y
@@ -71,14 +71,23 @@ CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_CLASSIC_RCU=y
+# CONFIG_TREE_RCU is not set
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_PREEMPT_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_CGROUPS is not set
 CONFIG_GROUP_SCHED=y
 CONFIG_FAIR_GROUP_SCHED=y
 # CONFIG_RT_GROUP_SCHED is not set
 CONFIG_USER_SCHED=y
 # CONFIG_CGROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
 CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
@@ -110,7 +119,6 @@ CONFIG_SLUB_DEBUG=y
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
 CONFIG_HAVE_IOREMAP_PROT=y
@@ -121,13 +129,11 @@ CONFIG_HAVE_CLK=y
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
 # CONFIG_MODULES is not set
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -143,7 +149,6 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
 # CONFIG_FREEZER is not set
 
 #
@@ -182,9 +187,9 @@ CONFIG_PPC_MPC5200_SIMPLE=y
 # CONFIG_TAU is not set
 # CONFIG_FSL_ULI1575 is not set
 CONFIG_PPC_BESTCOMM=y
-# CONFIG_PPC_BESTCOMM_ATA is not set
+CONFIG_PPC_BESTCOMM_ATA=y
 CONFIG_PPC_BESTCOMM_FEC=y
-# CONFIG_PPC_BESTCOMM_GEN_BD is not set
+# CONFIG_SIMPLE_GPIO is not set
 
 #
 # Kernel options
@@ -211,6 +216,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -222,12 +228,14 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_MIGRATION=y
-# CONFIG_RESOURCES_64BIT is not set
 # CONFIG_PHYS_ADDR_T_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
 CONFIG_UNEVICTABLE_LRU=y
+CONFIG_PPC_4K_PAGES=y
+# CONFIG_PPC_16K_PAGES is not set
+# CONFIG_PPC_64K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -268,6 +276,7 @@ CONFIG_NET=y
 #
 # Networking options
 #
+CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -324,6 +333,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
 # CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
 
 #
 # Network testing
@@ -336,6 +346,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 # CONFIG_PHONET is not set
 # CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
 
@@ -426,6 +437,12 @@ CONFIG_MTD_ROM=y
 # CONFIG_MTD_NAND is not set
 # CONFIG_MTD_ONENAND is not set
 
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+# CONFIG_MTD_QINFO_PROBE is not set
+
 #
 # UBI - Unsorted block images
 #
@@ -447,10 +464,16 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_ATA_OVER_ETH is not set
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_ICS932S401 is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+CONFIG_EEPROM_LEGACY=y
+# CONFIG_EEPROM_93CX6 is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -492,6 +515,7 @@ CONFIG_CHR_DEV_SG=y
 # CONFIG_SCSI_SRP_ATTRS is not set
 CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
+# CONFIG_LIBFC is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_DH is not set
 CONFIG_ATA=y
@@ -525,6 +549,9 @@ CONFIG_SMSC_PHY=y
 CONFIG_BROADCOM_PHY=y
 CONFIG_ICPLUS_PHY=y
 # CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
 # CONFIG_FIXED_PHY is not set
 CONFIG_MDIO_BITBANG=y
 CONFIG_NET_ETHERNET=y
@@ -548,6 +575,10 @@ CONFIG_FEC_MPC52xx_MDIO=y
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
 # CONFIG_IWLWIFI_LEDS is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
 # CONFIG_WAN is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
@@ -590,8 +621,10 @@ CONFIG_SERIAL_MPC52xx=y
 CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
 CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_HVC_UDBG is not set
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
 # CONFIG_NVRAM is not set
@@ -629,8 +662,6 @@ CONFIG_I2C_MPC=y
 # Miscellaneous I2C Chip support
 #
 # CONFIG_DS1682 is not set
-# CONFIG_EEPROM_AT24 is not set
-CONFIG_EEPROM_LEGACY=y
 # CONFIG_SENSORS_PCF8574 is not set
 # CONFIG_PCF8575 is not set
 # CONFIG_SENSORS_PCA9539 is not set
@@ -659,6 +690,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_ADT7462 is not set
 # CONFIG_SENSORS_ADT7470 is not set
 # CONFIG_SENSORS_ADT7473 is not set
+# CONFIG_SENSORS_ADT7475 is not set
 # CONFIG_SENSORS_ATXP1 is not set
 # CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_F71805F is not set
@@ -678,6 +710,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_LM92 is not set
 # CONFIG_SENSORS_LM93 is not set
+# CONFIG_SENSORS_LTC4245 is not set
 # CONFIG_SENSORS_MAX1619 is not set
 # CONFIG_SENSORS_MAX6650 is not set
 # CONFIG_SENSORS_PC87360 is not set
@@ -721,10 +754,12 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_PASIC3 is not set
+# CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
 # CONFIG_REGULATOR is not set
 
 #
@@ -835,7 +870,6 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 # CONFIG_STAGING is not set
-CONFIG_STAGING_EXCLUDE_BUILD=y
 
 #
 # File systems
@@ -856,6 +890,7 @@ CONFIG_FS_MBCACHE=y
 CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -892,10 +927,7 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
 # CONFIG_CONFIGFS_FS is not set
-
-#
-# Miscellaneous filesystems
-#
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
@@ -915,6 +947,7 @@ CONFIG_JFFS2_ZLIB=y
 CONFIG_JFFS2_RTIME=y
 # CONFIG_JFFS2_RUBIN is not set
 CONFIG_CRAMFS=y
+# CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_OMFS_FS is not set
@@ -1011,6 +1044,7 @@ CONFIG_NLS_ISO8859_1=y
 # Library routines
 #
 CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
 # CONFIG_CRC_T10DIF is not set
@@ -1062,6 +1096,7 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
 # CONFIG_BOOT_PRINTK_DELAY is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
@@ -1070,6 +1105,8 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
 
 #
 # Tracers
@@ -1078,11 +1115,13 @@ CONFIG_HAVE_FUNCTION_TRACER=y
 # CONFIG_SCHED_TRACER is not set
 # CONFIG_CONTEXT_SWITCH_TRACER is not set
 # CONFIG_BOOT_TRACER is not set
+# CONFIG_TRACE_BRANCH_PROFILING is not set
 # CONFIG_STACK_TRACER is not set
 # CONFIG_DYNAMIC_PRINTK_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
@@ -1109,11 +1148,15 @@ CONFIG_CRYPTO=y
 #
 # CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD2=y
 CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
 # CONFIG_CRYPTO_CRYPTD is not set
index b21b8e8c3a784299981ca38fff194c8ad502e8ba..00944c09a0aed67af3b80bbc2e667c2a4f9213c8 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28-rc4
-# Thu Nov 13 02:13:16 2008
+# Linux kernel version: 2.6.29-rc2
+# Mon Jan 26 21:41:33 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -43,7 +43,7 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_PPC=y
 CONFIG_EARLY_PRINTK=y
 CONFIG_GENERIC_NVRAM=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
 CONFIG_ARCH_MAY_HAVE_PC_FDC=y
 CONFIG_PPC_OF=y
 CONFIG_OF=y
@@ -72,15 +72,24 @@ CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_CLASSIC_RCU=y
+# CONFIG_TREE_RCU is not set
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_PREEMPT_RCU_TRACE is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_CGROUPS is not set
 CONFIG_GROUP_SCHED=y
 CONFIG_FAIR_GROUP_SCHED=y
 # CONFIG_RT_GROUP_SCHED is not set
 CONFIG_USER_SCHED=y
 # CONFIG_CGROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
 CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
@@ -112,7 +121,6 @@ CONFIG_SLAB=y
 # CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 # CONFIG_KPROBES is not set
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
@@ -124,7 +132,6 @@ CONFIG_HAVE_CLK=y
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
 # CONFIG_MODULE_FORCE_LOAD is not set
@@ -132,11 +139,9 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
-CONFIG_KMOD=y
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -152,7 +157,6 @@ CONFIG_IOSCHED_NOOP=y
 # CONFIG_DEFAULT_CFQ is not set
 CONFIG_DEFAULT_NOOP=y
 CONFIG_DEFAULT_IOSCHED="noop"
-CONFIG_CLASSIC_RCU=y
 # CONFIG_FREEZER is not set
 
 #
@@ -191,9 +195,9 @@ CONFIG_PPC_MPC5200_SIMPLE=y
 # CONFIG_TAU is not set
 # CONFIG_FSL_ULI1575 is not set
 CONFIG_PPC_BESTCOMM=y
-CONFIG_PPC_BESTCOMM_ATA=y
+CONFIG_PPC_BESTCOMM_ATA=m
 CONFIG_PPC_BESTCOMM_FEC=y
-CONFIG_PPC_BESTCOMM_GEN_BD=y
+# CONFIG_SIMPLE_GPIO is not set
 
 #
 # Kernel options
@@ -212,7 +216,6 @@ CONFIG_SCHED_HRTICK=y
 # CONFIG_PREEMPT_NONE is not set
 # CONFIG_PREEMPT_VOLUNTARY is not set
 CONFIG_PREEMPT=y
-# CONFIG_PREEMPT_RCU is not set
 CONFIG_BINFMT_ELF=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 # CONFIG_HAVE_AOUT is not set
@@ -222,6 +225,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -233,12 +237,14 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_MIGRATION=y
-# CONFIG_RESOURCES_64BIT is not set
 # CONFIG_PHYS_ADDR_T_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
 CONFIG_UNEVICTABLE_LRU=y
+CONFIG_PPC_4K_PAGES=y
+# CONFIG_PPC_16K_PAGES is not set
+# CONFIG_PPC_64K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -261,6 +267,7 @@ CONFIG_PCI_SYSCALL=y
 CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_MSI is not set
 CONFIG_PCI_LEGACY=y
+# CONFIG_PCI_STUB is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -283,6 +290,7 @@ CONFIG_NET=y
 #
 # Networking options
 #
+CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -333,6 +341,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
 # CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
 
 #
 # Network testing
@@ -345,6 +354,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 # CONFIG_PHONET is not set
 # CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
 
@@ -365,6 +375,7 @@ CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
 # CONFIG_MTD_CONCAT is not set
 CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 # CONFIG_MTD_OF_PARTS is not set
@@ -413,9 +424,7 @@ CONFIG_MTD_CFI_UTIL=y
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
 CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_PHYSMAP_START=0x0
-CONFIG_MTD_PHYSMAP_LEN=0x0
-CONFIG_MTD_PHYSMAP_BANKWIDTH=1
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
 # CONFIG_MTD_PHYSMAP_OF is not set
 # CONFIG_MTD_INTEL_VR_NOR is not set
 # CONFIG_MTD_PLATRAM is not set
@@ -438,6 +447,12 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=1
 # CONFIG_MTD_NAND is not set
 # CONFIG_MTD_ONENAND is not set
 
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+# CONFIG_MTD_QINFO_PROBE is not set
+
 #
 # UBI - Unsorted block images
 #
@@ -587,6 +602,9 @@ CONFIG_PHYLIB=y
 # CONFIG_BROADCOM_PHY is not set
 # CONFIG_ICPLUS_PHY is not set
 # CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
 # CONFIG_FIXED_PHY is not set
 # CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
@@ -620,6 +638,10 @@ CONFIG_FEC_MPC52xx_MDIO=y
 # CONFIG_WLAN_80211 is not set
 # CONFIG_IWLWIFI_LEDS is not set
 
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
 #
 # USB Network Adapters
 #
@@ -675,7 +697,9 @@ CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=9600
 # CONFIG_SERIAL_JSM is not set
 CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
+# CONFIG_HVC_UDBG is not set
 # CONFIG_IPMI_HANDLER is not set
 CONFIG_HW_RANDOM=y
 # CONFIG_NVRAM is not set
@@ -740,8 +764,6 @@ CONFIG_I2C_MPC=y
 # Miscellaneous I2C Chip support
 #
 # CONFIG_DS1682 is not set
-# CONFIG_EEPROM_AT24 is not set
-CONFIG_EEPROM_LEGACY=m
 # CONFIG_SENSORS_PCF8574 is not set
 # CONFIG_PCF8575 is not set
 # CONFIG_SENSORS_PCA9539 is not set
@@ -774,10 +796,12 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_PASIC3 is not set
+# CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
 # CONFIG_REGULATOR is not set
 
 #
@@ -837,6 +861,7 @@ CONFIG_USB_DEVICEFS=y
 #
 # CONFIG_USB_C67X00_HCD is not set
 # CONFIG_USB_EHCI_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
 # CONFIG_USB_ISP1760_HCD is not set
 CONFIG_USB_OHCI_HCD=m
@@ -864,18 +889,17 @@ CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
 # CONFIG_USB_TMC is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
 #
 
 #
-# may also be needed; see USB_STORAGE Help for more information
+# see USB_STORAGE Help for more information
 #
 CONFIG_USB_STORAGE=m
 # CONFIG_USB_STORAGE_DEBUG is not set
 # CONFIG_USB_STORAGE_DATAFAB is not set
 # CONFIG_USB_STORAGE_FREECOM is not set
 # CONFIG_USB_STORAGE_ISD200 is not set
-# CONFIG_USB_STORAGE_DPCM is not set
 # CONFIG_USB_STORAGE_USBAT is not set
 # CONFIG_USB_STORAGE_SDDR09 is not set
 # CONFIG_USB_STORAGE_SDDR55 is not set
@@ -921,6 +945,10 @@ CONFIG_USB_STORAGE=m
 # CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_VST is not set
 # CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
 # CONFIG_UWB is not set
 # CONFIG_MMC is not set
 # CONFIG_MEMSTICK is not set
@@ -983,7 +1011,6 @@ CONFIG_RTC_DRV_PCF8563=m
 # CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 # CONFIG_STAGING is not set
-CONFIG_STAGING_EXCLUDE_BUILD=y
 
 #
 # File systems
@@ -1004,6 +1031,7 @@ CONFIG_FS_MBCACHE=m
 CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
 # CONFIG_DNOTIFY is not set
 # CONFIG_INOTIFY is not set
 # CONFIG_QUOTA is not set
@@ -1039,10 +1067,7 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
 # CONFIG_CONFIGFS_FS is not set
-
-#
-# Miscellaneous filesystems
-#
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
@@ -1062,6 +1087,7 @@ CONFIG_JFFS2_ZLIB=y
 CONFIG_JFFS2_RTIME=y
 # CONFIG_JFFS2_RUBIN is not set
 # CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_OMFS_FS is not set
@@ -1141,6 +1167,7 @@ CONFIG_NLS_ISO8859_1=y
 # Library routines
 #
 CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
 # CONFIG_CRC_T10DIF is not set
@@ -1173,6 +1200,8 @@ CONFIG_FRAME_WARN=1024
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
 
 #
 # Tracers
@@ -1180,6 +1209,7 @@ CONFIG_HAVE_FUNCTION_TRACER=y
 # CONFIG_DYNAMIC_PRINTK_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_IRQSTACKS is not set
 # CONFIG_BOOTX_TEXT is not set
 # CONFIG_PPC_EARLY_DEBUG is not set
index 79954579f5ec6f21919921e75153d733a2de51ca..65237ad6f07e237e05b359aa50eb7e2b491e7237 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28-rc4
-# Thu Nov 13 02:09:30 2008
+# Linux kernel version: 2.6.29-rc2
+# Mon Jan 26 21:42:58 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -43,7 +43,7 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_PPC=y
 CONFIG_EARLY_PRINTK=y
 CONFIG_GENERIC_NVRAM=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
 CONFIG_ARCH_MAY_HAVE_PC_FDC=y
 CONFIG_PPC_OF=y
 CONFIG_OF=y
@@ -71,14 +71,23 @@ CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_CLASSIC_RCU=y
+# CONFIG_TREE_RCU is not set
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_PREEMPT_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_CGROUPS is not set
 CONFIG_GROUP_SCHED=y
 CONFIG_FAIR_GROUP_SCHED=y
 # CONFIG_RT_GROUP_SCHED is not set
 CONFIG_USER_SCHED=y
 # CONFIG_CGROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
 CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
@@ -110,7 +119,6 @@ CONFIG_SLUB_DEBUG=y
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
 CONFIG_HAVE_IOREMAP_PROT=y
@@ -121,7 +129,6 @@ CONFIG_HAVE_CLK=y
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
 # CONFIG_MODULE_FORCE_LOAD is not set
@@ -129,11 +136,9 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 CONFIG_MODVERSIONS=y
 # CONFIG_MODULE_SRCVERSION_ALL is not set
-CONFIG_KMOD=y
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -149,7 +154,6 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
 # CONFIG_FREEZER is not set
 
 #
@@ -188,9 +192,9 @@ CONFIG_PPC_MPC5200_BUGFIX=y
 # CONFIG_TAU is not set
 # CONFIG_FSL_ULI1575 is not set
 CONFIG_PPC_BESTCOMM=y
-# CONFIG_PPC_BESTCOMM_ATA is not set
+CONFIG_PPC_BESTCOMM_ATA=y
 CONFIG_PPC_BESTCOMM_FEC=y
-# CONFIG_PPC_BESTCOMM_GEN_BD is not set
+# CONFIG_SIMPLE_GPIO is not set
 
 #
 # Kernel options
@@ -217,6 +221,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -228,12 +233,14 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_MIGRATION=y
-# CONFIG_RESOURCES_64BIT is not set
 # CONFIG_PHYS_ADDR_T_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
 CONFIG_UNEVICTABLE_LRU=y
+CONFIG_PPC_4K_PAGES=y
+# CONFIG_PPC_16K_PAGES is not set
+# CONFIG_PPC_64K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -274,6 +281,7 @@ CONFIG_NET=y
 #
 # Networking options
 #
+CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -330,6 +338,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
 # CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
 
 #
 # Network testing
@@ -342,6 +351,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 # CONFIG_PHONET is not set
 # CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
 
@@ -364,6 +374,7 @@ CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
 CONFIG_MTD_CONCAT=y
 CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 # CONFIG_MTD_OF_PARTS is not set
@@ -432,6 +443,12 @@ CONFIG_MTD_PHYSMAP_OF=y
 # CONFIG_MTD_NAND is not set
 # CONFIG_MTD_ONENAND is not set
 
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+# CONFIG_MTD_QINFO_PROBE is not set
+
 #
 # UBI - Unsorted block images
 #
@@ -496,6 +513,7 @@ CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SCSI_SRP_ATTRS is not set
 CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
+# CONFIG_LIBFC is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_DH is not set
 CONFIG_ATA=y
@@ -530,6 +548,9 @@ CONFIG_LXT_PHY=y
 # CONFIG_BROADCOM_PHY is not set
 # CONFIG_ICPLUS_PHY is not set
 # CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
 # CONFIG_FIXED_PHY is not set
 # CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
@@ -554,6 +575,10 @@ CONFIG_FEC_MPC52xx_MDIO=y
 # CONFIG_WLAN_80211 is not set
 # CONFIG_IWLWIFI_LEDS is not set
 
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
 #
 # USB Network Adapters
 #
@@ -604,8 +629,10 @@ CONFIG_SERIAL_MPC52xx=y
 CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
 CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_HVC_UDBG is not set
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
 # CONFIG_NVRAM is not set
@@ -645,8 +672,6 @@ CONFIG_I2C_MPC=y
 # Miscellaneous I2C Chip support
 #
 # CONFIG_DS1682 is not set
-# CONFIG_EEPROM_AT24 is not set
-# CONFIG_EEPROM_LEGACY is not set
 # CONFIG_SENSORS_PCF8574 is not set
 # CONFIG_PCF8575 is not set
 # CONFIG_SENSORS_PCA9539 is not set
@@ -675,6 +700,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_ADT7462 is not set
 # CONFIG_SENSORS_ADT7470 is not set
 # CONFIG_SENSORS_ADT7473 is not set
+# CONFIG_SENSORS_ADT7475 is not set
 # CONFIG_SENSORS_ATXP1 is not set
 # CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_F71805F is not set
@@ -694,6 +720,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_LM92 is not set
 # CONFIG_SENSORS_LM93 is not set
+# CONFIG_SENSORS_LTC4245 is not set
 # CONFIG_SENSORS_MAX1619 is not set
 # CONFIG_SENSORS_MAX6650 is not set
 # CONFIG_SENSORS_PC87360 is not set
@@ -742,10 +769,12 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_PASIC3 is not set
+# CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
 # CONFIG_REGULATOR is not set
 
 #
@@ -803,6 +832,7 @@ CONFIG_USB_MON=y
 # USB Host Controller Drivers
 #
 # CONFIG_USB_C67X00_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
 # CONFIG_USB_ISP1760_HCD is not set
 CONFIG_USB_OHCI_HCD=y
@@ -827,18 +857,17 @@ CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
 # CONFIG_USB_TMC is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
 #
 
 #
-# may also be needed; see USB_STORAGE Help for more information
+# see USB_STORAGE Help for more information
 #
 CONFIG_USB_STORAGE=y
 # CONFIG_USB_STORAGE_DEBUG is not set
 # CONFIG_USB_STORAGE_DATAFAB is not set
 # CONFIG_USB_STORAGE_FREECOM is not set
 # CONFIG_USB_STORAGE_ISD200 is not set
-# CONFIG_USB_STORAGE_DPCM is not set
 # CONFIG_USB_STORAGE_USBAT is not set
 # CONFIG_USB_STORAGE_SDDR09 is not set
 # CONFIG_USB_STORAGE_SDDR55 is not set
@@ -884,6 +913,10 @@ CONFIG_USB_STORAGE=y
 # CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_VST is not set
 # CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
 # CONFIG_MMC is not set
 # CONFIG_MEMSTICK is not set
 # CONFIG_NEW_LEDS is not set
@@ -947,7 +980,6 @@ CONFIG_RTC_DRV_DS1307=y
 # CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 # CONFIG_STAGING is not set
-CONFIG_STAGING_EXCLUDE_BUILD=y
 
 #
 # File systems
@@ -968,6 +1000,7 @@ CONFIG_FS_MBCACHE=y
 CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -1004,10 +1037,7 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
 # CONFIG_CONFIGFS_FS is not set
-
-#
-# Miscellaneous filesystems
-#
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
@@ -1027,6 +1057,7 @@ CONFIG_JFFS2_ZLIB=y
 CONFIG_JFFS2_RTIME=y
 # CONFIG_JFFS2_RUBIN is not set
 CONFIG_CRAMFS=y
+# CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_OMFS_FS is not set
@@ -1123,6 +1154,7 @@ CONFIG_NLS_ISO8859_1=y
 # Library routines
 #
 CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
 # CONFIG_CRC_T10DIF is not set
@@ -1174,6 +1206,7 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
 # CONFIG_BOOT_PRINTK_DELAY is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
@@ -1182,6 +1215,8 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
 
 #
 # Tracers
@@ -1190,11 +1225,13 @@ CONFIG_HAVE_FUNCTION_TRACER=y
 # CONFIG_SCHED_TRACER is not set
 # CONFIG_CONTEXT_SWITCH_TRACER is not set
 # CONFIG_BOOT_TRACER is not set
+# CONFIG_TRACE_BRANCH_PROFILING is not set
 # CONFIG_STACK_TRACER is not set
 # CONFIG_DYNAMIC_PRINTK_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
@@ -1221,11 +1258,15 @@ CONFIG_CRYPTO=y
 #
 # CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD2=y
 CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
 # CONFIG_CRYPTO_CRYPTD is not set
index 5ff3de205d6a108f4643c45bd21b0a37d480455f..81afc8b373d7e0498d403544d094b8388470a4e2 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28-rc4
-# Thu Nov 13 02:09:07 2008
+# Linux kernel version: 2.6.29-rc2
+# Mon Jan 26 21:40:44 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -43,7 +43,7 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_PPC=y
 CONFIG_EARLY_PRINTK=y
 CONFIG_GENERIC_NVRAM=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
 CONFIG_ARCH_MAY_HAVE_PC_FDC=y
 CONFIG_PPC_OF=y
 CONFIG_OF=y
@@ -72,10 +72,19 @@ CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
 # CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_CLASSIC_RCU=y
+# CONFIG_TREE_RCU is not set
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_PREEMPT_RCU_TRACE is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_CGROUPS is not set
 # CONFIG_GROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
 CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
@@ -108,7 +117,6 @@ CONFIG_SLUB_DEBUG=y
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
 CONFIG_HAVE_IOREMAP_PROT=y
@@ -119,7 +127,6 @@ CONFIG_HAVE_CLK=y
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
 # CONFIG_MODULE_FORCE_LOAD is not set
@@ -127,11 +134,9 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
-CONFIG_KMOD=y
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_BLK_DEV_INTEGRITY is not set
 
@@ -147,7 +152,6 @@ CONFIG_DEFAULT_AS=y
 # CONFIG_DEFAULT_CFQ is not set
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
 CONFIG_FREEZER=y
 
 #
@@ -192,7 +196,7 @@ CONFIG_RTAS_PROC=y
 CONFIG_PPC_BESTCOMM=y
 CONFIG_PPC_BESTCOMM_ATA=y
 CONFIG_PPC_BESTCOMM_FEC=y
-CONFIG_PPC_BESTCOMM_GEN_BD=y
+# CONFIG_SIMPLE_GPIO is not set
 
 #
 # Kernel options
@@ -220,6 +224,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_ARCH_HAS_WALK_MEMORY=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
 # CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
 CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_POPULATES_NODE_MAP=y
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -231,12 +236,14 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_MIGRATION=y
-# CONFIG_RESOURCES_64BIT is not set
 # CONFIG_PHYS_ADDR_T_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_VIRT_TO_BUS=y
 CONFIG_UNEVICTABLE_LRU=y
+CONFIG_PPC_4K_PAGES=y
+# CONFIG_PPC_16K_PAGES is not set
+# CONFIG_PPC_64K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=11
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -264,6 +271,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_MSI is not set
 CONFIG_PCI_LEGACY=y
 # CONFIG_PCI_DEBUG is not set
+# CONFIG_PCI_STUB is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 # CONFIG_HAS_RAPIDIO is not set
@@ -286,6 +294,7 @@ CONFIG_NET=y
 #
 # Networking options
 #
+CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -342,6 +351,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
 # CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
 
 #
 # Network testing
@@ -354,6 +364,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_AF_RXRPC is not set
 # CONFIG_PHONET is not set
 # CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
 
@@ -376,6 +387,7 @@ CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
 CONFIG_MTD_CONCAT=y
 CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 # CONFIG_MTD_OF_PARTS is not set
@@ -446,6 +458,12 @@ CONFIG_MTD_PHYSMAP_OF=y
 # CONFIG_MTD_NAND is not set
 # CONFIG_MTD_ONENAND is not set
 
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+# CONFIG_MTD_QINFO_PROBE is not set
+
 #
 # UBI - Unsorted block images
 #
@@ -474,13 +492,19 @@ CONFIG_BLK_DEV_RAM_SIZE=32768
 # CONFIG_BLK_DEV_HD is not set
 CONFIG_MISC_DEVICES=y
 # CONFIG_PHANTOM is not set
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
 # CONFIG_ICS932S401 is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_HP_ILO is not set
 # CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_93CX6 is not set
 CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
@@ -539,6 +563,8 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_MEGARAID_SAS is not set
 # CONFIG_SCSI_HPTIOP is not set
 # CONFIG_SCSI_BUSLOGIC is not set
+# CONFIG_LIBFC is not set
+# CONFIG_FCOE is not set
 # CONFIG_SCSI_DMX3191D is not set
 # CONFIG_SCSI_EATA is not set
 # CONFIG_SCSI_FUTURE_DOMAIN is not set
@@ -659,6 +685,9 @@ CONFIG_PHYLIB=y
 # CONFIG_BROADCOM_PHY is not set
 # CONFIG_ICPLUS_PHY is not set
 # CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
 # CONFIG_FIXED_PHY is not set
 # CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
@@ -692,6 +721,10 @@ CONFIG_FEC_MPC52xx_MDIO=y
 # CONFIG_WLAN_80211 is not set
 # CONFIG_IWLWIFI_LEDS is not set
 
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
 #
 # USB Network Adapters
 #
@@ -774,9 +807,11 @@ CONFIG_SERIAL_MPC52xx_CONSOLE=y
 CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
 # CONFIG_SERIAL_JSM is not set
 CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_HVC_RTAS is not set
+# CONFIG_HVC_UDBG is not set
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
 # CONFIG_NVRAM is not set
@@ -844,8 +879,6 @@ CONFIG_I2C_MPC=y
 # Miscellaneous I2C Chip support
 #
 # CONFIG_DS1682 is not set
-# CONFIG_EEPROM_AT24 is not set
-# CONFIG_EEPROM_LEGACY is not set
 # CONFIG_SENSORS_PCF8574 is not set
 # CONFIG_PCF8575 is not set
 # CONFIG_SENSORS_PCA9539 is not set
@@ -874,6 +907,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_ADT7462 is not set
 # CONFIG_SENSORS_ADT7470 is not set
 # CONFIG_SENSORS_ADT7473 is not set
+# CONFIG_SENSORS_ADT7475 is not set
 # CONFIG_SENSORS_ATXP1 is not set
 # CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_I5K_AMB is not set
@@ -894,6 +928,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_LM92 is not set
 # CONFIG_SENSORS_LM93 is not set
+# CONFIG_SENSORS_LTC4245 is not set
 # CONFIG_SENSORS_MAX1619 is not set
 # CONFIG_SENSORS_MAX6650 is not set
 # CONFIG_SENSORS_PC87360 is not set
@@ -953,10 +988,12 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_PASIC3 is not set
+# CONFIG_TWL4030_CORE is not set
 # CONFIG_MFD_TMIO is not set
 # CONFIG_PMIC_DA903X is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
 # CONFIG_REGULATOR is not set
 
 #
@@ -1051,7 +1088,7 @@ CONFIG_LCD_CLASS_DEVICE=m
 # CONFIG_LCD_ILI9320 is not set
 # CONFIG_LCD_PLATFORM is not set
 CONFIG_BACKLIGHT_CLASS_DEVICE=y
-# CONFIG_BACKLIGHT_CORGI is not set
+CONFIG_BACKLIGHT_GENERIC=y
 
 #
 # Display device support
@@ -1093,21 +1130,22 @@ CONFIG_HID_COMPAT=y
 CONFIG_HID_A4TECH=y
 # CONFIG_HID_APPLE is not set
 CONFIG_HID_BELKIN=y
-CONFIG_HID_BRIGHT=y
 CONFIG_HID_CHERRY=y
 # CONFIG_HID_CHICONY is not set
 CONFIG_HID_CYPRESS=y
-CONFIG_HID_DELL=y
 CONFIG_HID_EZKEY=y
 # CONFIG_HID_GYRATION is not set
 # CONFIG_HID_LOGITECH is not set
 # CONFIG_HID_MICROSOFT is not set
 # CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_NTRIG is not set
 # CONFIG_HID_PANTHERLORD is not set
 # CONFIG_HID_PETALYNX is not set
 # CONFIG_HID_SAMSUNG is not set
 # CONFIG_HID_SONY is not set
 # CONFIG_HID_SUNPLUS is not set
+# CONFIG_GREENASIA_FF is not set
+# CONFIG_HID_TOPSEED is not set
 # CONFIG_THRUSTMASTER_FF is not set
 # CONFIG_ZEROPLUS_FF is not set
 CONFIG_USB_SUPPORT=y
@@ -1137,6 +1175,7 @@ CONFIG_USB_MON=y
 #
 # CONFIG_USB_C67X00_HCD is not set
 # CONFIG_USB_EHCI_HCD is not set
+# CONFIG_USB_OXU210HP_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
 # CONFIG_USB_ISP1760_HCD is not set
 CONFIG_USB_OHCI_HCD=y
@@ -1164,18 +1203,17 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 # CONFIG_USB_TMC is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
 #
 
 #
-# may also be needed; see USB_STORAGE Help for more information
+# see USB_STORAGE Help for more information
 #
 CONFIG_USB_STORAGE=y
 # CONFIG_USB_STORAGE_DEBUG is not set
 # CONFIG_USB_STORAGE_DATAFAB is not set
 # CONFIG_USB_STORAGE_FREECOM is not set
 # CONFIG_USB_STORAGE_ISD200 is not set
-# CONFIG_USB_STORAGE_DPCM is not set
 # CONFIG_USB_STORAGE_USBAT is not set
 # CONFIG_USB_STORAGE_SDDR09 is not set
 # CONFIG_USB_STORAGE_SDDR55 is not set
@@ -1222,6 +1260,10 @@ CONFIG_USB_STORAGE=y
 # CONFIG_USB_ISIGHTFW is not set
 # CONFIG_USB_VST is not set
 # CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
 # CONFIG_UWB is not set
 # CONFIG_MMC is not set
 # CONFIG_MEMSTICK is not set
@@ -1243,7 +1285,6 @@ CONFIG_NEW_LEDS=y
 # CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
 # CONFIG_STAGING is not set
-CONFIG_STAGING_EXCLUDE_BUILD=y
 
 #
 # File systems
@@ -1264,6 +1305,7 @@ CONFIG_FS_MBCACHE=y
 CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -1300,10 +1342,7 @@ CONFIG_TMPFS=y
 # CONFIG_TMPFS_POSIX_ACL is not set
 # CONFIG_HUGETLB_PAGE is not set
 # CONFIG_CONFIGFS_FS is not set
-
-#
-# Miscellaneous filesystems
-#
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
@@ -1323,6 +1362,7 @@ CONFIG_JFFS2_ZLIB=y
 CONFIG_JFFS2_RTIME=y
 # CONFIG_JFFS2_RUBIN is not set
 CONFIG_CRAMFS=y
+# CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_OMFS_FS is not set
@@ -1403,6 +1443,7 @@ CONFIG_NLS_ISO8859_1=y
 # Library routines
 #
 CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
 # CONFIG_CRC_T10DIF is not set
@@ -1454,6 +1495,7 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_DEBUG_MEMORY_INIT is not set
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
 # CONFIG_BOOT_PRINTK_DELAY is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
@@ -1462,6 +1504,8 @@ CONFIG_DEBUG_INFO=y
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
 
 #
 # Tracers
@@ -1470,11 +1514,13 @@ CONFIG_HAVE_FUNCTION_TRACER=y
 # CONFIG_SCHED_TRACER is not set
 # CONFIG_CONTEXT_SWITCH_TRACER is not set
 # CONFIG_BOOT_TRACER is not set
+# CONFIG_TRACE_BRANCH_PROFILING is not set
 # CONFIG_STACK_TRACER is not set
 # CONFIG_DYNAMIC_PRINTK_DEBUG is not set
 # CONFIG_SAMPLES is not set
 CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_KGDB is not set
+CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_STACKOVERFLOW is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
@@ -1501,11 +1547,15 @@ CONFIG_CRYPTO=y
 #
 # CONFIG_CRYPTO_FIPS is not set
 CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD2=y
 CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
 CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
 # CONFIG_CRYPTO_GF128MUL is not set
 # CONFIG_CRYPTO_NULL is not set
 # CONFIG_CRYPTO_CRYPTD is not set
index da5a3855a0c474c0619c8d97c07b4f494980f8b8..19b12d2cbb4ba2e97f2aaff19f32a1eb54cecc73 100644 (file)
@@ -16,8 +16,6 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#define DEBUG
-
 #include <linux/kernel.h>
 #include <linux/pci.h>
 #include <linux/string.h>
@@ -258,7 +256,8 @@ int pci_read_irq_line(struct pci_dev *pci_dev)
        } else {
                pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
                         oirq.size, oirq.specifier[0], oirq.specifier[1],
-                   oirq.controller->full_name);
+                        oirq.controller ? oirq.controller->full_name :
+                        "<default>");
 
                virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
                                             oirq.size);
index c3f2c21024e32d09623fbfde61e68d5420a171a5..87ff522f28b5ee2c5f13207acbb66945ba350097 100644 (file)
 #include <linux/kernel.h>
 
 
-/* ======================================================================== */
-/* PCI windows config                                                       */
-/* ======================================================================== */
-
-#define MPC52xx_PCI_TARGET_IO  0xf0000000
-#define MPC52xx_PCI_TARGET_MEM 0x00000000
-
-
 /* ======================================================================== */
 /* Structures mapping & Defines for PCI Unit                                */
 /* ======================================================================== */
@@ -244,7 +236,7 @@ static struct pci_ops mpc52xx_pci_ops = {
 
 static void __init
 mpc52xx_pci_setup(struct pci_controller *hose,
-                  struct mpc52xx_pci __iomem *pci_regs)
+                  struct mpc52xx_pci __iomem *pci_regs, phys_addr_t pci_phys)
 {
        struct resource *res;
        u32 tmp;
@@ -314,10 +306,14 @@ mpc52xx_pci_setup(struct pci_controller *hose,
        /* Set all the IWCR fields at once; they're in the same reg */
        out_be32(&pci_regs->iwcr, MPC52xx_PCI_IWCR_PACK(iwcr0, iwcr1, iwcr2));
 
-       out_be32(&pci_regs->tbatr0,
-               MPC52xx_PCI_TBATR_ENABLE | MPC52xx_PCI_TARGET_IO );
-       out_be32(&pci_regs->tbatr1,
-               MPC52xx_PCI_TBATR_ENABLE | MPC52xx_PCI_TARGET_MEM );
+       /* Map IMMR onto PCI bus */
+       pci_phys &= 0xfffc0000; /* bar0 has only 14 significant bits */
+       out_be32(&pci_regs->tbatr0, MPC52xx_PCI_TBATR_ENABLE | pci_phys);
+       out_be32(&pci_regs->bar0, PCI_BASE_ADDRESS_MEM_PREFETCH | pci_phys);
+
+       /* Map memory onto PCI bus */
+       out_be32(&pci_regs->tbatr1, MPC52xx_PCI_TBATR_ENABLE);
+       out_be32(&pci_regs->bar1, PCI_BASE_ADDRESS_MEM_PREFETCH);
 
        out_be32(&pci_regs->tcr, MPC52xx_PCI_TCR_LD | MPC52xx_PCI_TCR_WCT8);
 
@@ -414,7 +410,7 @@ mpc52xx_add_bridge(struct device_node *node)
 
        /* Finish setting up PCI using values obtained by
         * pci_proces_bridge_OF_ranges */
-       mpc52xx_pci_setup(hose, pci_regs);
+       mpc52xx_pci_setup(hose, pci_regs, rsrc.start);
 
        return 0;
 }
index caf4c33f4e8417afa35e5a72c57a0606fce8555b..7c35787d29b45b22a41c58bb57491137df7f4db4 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/gpio.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/spi_gpio.h>
+#include <media/ov772x.h>
 #include <media/soc_camera_platform.h>
 #include <media/sh_mobile_ceu.h>
 #include <video/sh_mobile_lcdc.h>
@@ -216,7 +217,14 @@ static struct platform_device lcdc_device = {
        },
 };
 
+static void camera_power(int val)
+{
+       gpio_set_value(GPIO_PTZ5, val); /* RST_CAM/RSTB */
+       mdelay(10);
+}
+
 #ifdef CONFIG_I2C
+/* support for the old ncm03j camera */
 static unsigned char camera_ncm03j_magic[] =
 {
        0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8,
@@ -237,6 +245,23 @@ static unsigned char camera_ncm03j_magic[] =
        0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F,
 };
 
+static int camera_probe(void)
+{
+       struct i2c_adapter *a = i2c_get_adapter(0);
+       struct i2c_msg msg;
+       int ret;
+
+       camera_power(1);
+       msg.addr = 0x6e;
+       msg.buf = camera_ncm03j_magic;
+       msg.len = 2;
+       msg.flags = 0;
+       ret = i2c_transfer(a, &msg, 1);
+       camera_power(0);
+
+       return ret;
+}
+
 static int camera_set_capture(struct soc_camera_platform_info *info,
                              int enable)
 {
@@ -245,9 +270,11 @@ static int camera_set_capture(struct soc_camera_platform_info *info,
        int ret = 0;
        int i;
 
+       camera_power(0);
        if (!enable)
                return 0; /* no disable for now */
 
+       camera_power(1);
        for (i = 0; i < ARRAY_SIZE(camera_ncm03j_magic); i += 2) {
                u_int8_t buf[8];
 
@@ -286,8 +313,35 @@ static struct platform_device camera_device = {
                .platform_data  = &camera_info,
        },
 };
+
+static int __init camera_setup(void)
+{
+       if (camera_probe() > 0)
+               platform_device_register(&camera_device);
+
+       return 0;
+}
+late_initcall(camera_setup);
+
 #endif /* CONFIG_I2C */
 
+static int ov7725_power(struct device *dev, int mode)
+{
+       camera_power(0);
+       if (mode)
+               camera_power(1);
+
+       return 0;
+}
+
+static struct ov772x_camera_info ov7725_info = {
+       .buswidth  = SOCAM_DATAWIDTH_8,
+       .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP,
+       .link = {
+               .power  = ov7725_power,
+       },
+};
+
 static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
        .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
        SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8,
@@ -338,9 +392,6 @@ static struct platform_device *ap325rxa_devices[] __initdata = {
        &ap325rxa_nor_flash_device,
        &lcdc_device,
        &ceu_device,
-#ifdef CONFIG_I2C
-       &camera_device,
-#endif
        &nand_flash_device,
        &sdcard_cn3_device,
 };
@@ -349,6 +400,10 @@ static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
        {
                I2C_BOARD_INFO("pcf8563", 0x51),
        },
+       {
+               I2C_BOARD_INFO("ov772x", 0x21),
+               .platform_data = &ov7725_info,
+       },
 };
 
 static struct spi_board_info ap325rxa_spi_devices[] = {
@@ -426,7 +481,7 @@ static int __init ap325rxa_devices_setup(void)
        gpio_request(GPIO_PTZ6, NULL);
        gpio_direction_output(GPIO_PTZ6, 0); /* STBY_CAM */
        gpio_request(GPIO_PTZ5, NULL);
-       gpio_direction_output(GPIO_PTZ5, 1); /* RST_CAM */
+       gpio_direction_output(GPIO_PTZ5, 0); /* RST_CAM */
        gpio_request(GPIO_PTZ4, NULL);
        gpio_direction_output(GPIO_PTZ4, 0); /* SADDR */
 
index 5c423fa8e6b89d8d022bdb95d895e3623f2e686d..352f87d50fdca7f1be524e7009ccb9e5745812df 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28
-# Fri Jan  9 16:54:19 2009
+# Linux kernel version: 2.6.29-rc2
+# Tue Jan 27 11:45:08 2009
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
@@ -45,12 +45,12 @@ CONFIG_BSD_PROCESS_ACCT=y
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_CGROUPS is not set
 CONFIG_GROUP_SCHED=y
 CONFIG_FAIR_GROUP_SCHED=y
 # CONFIG_RT_GROUP_SCHED is not set
 CONFIG_USER_SCHED=y
 # CONFIG_CGROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
 CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
@@ -378,6 +378,7 @@ CONFIG_WIRELESS=y
 # CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 # CONFIG_MAC80211 is not set
+# CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
 
@@ -400,6 +401,7 @@ CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
 CONFIG_MTD_CONCAT=y
 CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 # CONFIG_MTD_AR7_PARTS is not set
@@ -447,9 +449,7 @@ CONFIG_MTD_CFI_UTIL=y
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
 CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_PHYSMAP_START=0xffffffff
-CONFIG_MTD_PHYSMAP_LEN=0
-CONFIG_MTD_PHYSMAP_BANKWIDTH=0
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -479,6 +479,12 @@ CONFIG_MTD_NAND_IDS=y
 CONFIG_MTD_NAND_SH_FLCTL=y
 # CONFIG_MTD_ONENAND is not set
 
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+# CONFIG_MTD_QINFO_PROBE is not set
+
 #
 # UBI - Unsorted block images
 #
@@ -607,6 +613,10 @@ CONFIG_SMSC911X=y
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
 # CONFIG_IWLWIFI_LEDS is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
 # CONFIG_WAN is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
@@ -790,6 +800,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_PMIC_DA903X is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
 # CONFIG_REGULATOR is not set
 
 #
@@ -837,7 +848,7 @@ CONFIG_SOC_CAMERA=y
 # CONFIG_SOC_CAMERA_MT9V022 is not set
 # CONFIG_SOC_CAMERA_TW9910 is not set
 CONFIG_SOC_CAMERA_PLATFORM=y
-# CONFIG_SOC_CAMERA_OV772X is not set
+CONFIG_SOC_CAMERA_OV772X=y
 CONFIG_VIDEO_SH_MOBILE_CEU=y
 # CONFIG_RADIO_ADAPTERS is not set
 # CONFIG_DAB is not set
@@ -1012,6 +1023,7 @@ CONFIG_FS_POSIX_ACL=y
 CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -1060,6 +1072,7 @@ CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_JFFS2_FS is not set
 # CONFIG_UBIFS_FS is not set
 # CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_OMFS_FS is not set
index 7758263514bccc8e5f929961eb0f240abac5f84d..678576796bdfc1c1fdc27f1bbe754fe32323510c 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28
-# Fri Jan  9 17:09:35 2009
+# Linux kernel version: 2.6.29-rc1
+# Thu Jan 22 09:16:16 2009
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
@@ -45,8 +45,12 @@ CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_CGROUPS is not set
 # CONFIG_GROUP_SCHED is not set
+
+#
+# Control Group support
+#
+# CONFIG_CGROUPS is not set
 CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
@@ -389,6 +393,7 @@ CONFIG_WIRELESS_EXT=y
 CONFIG_WIRELESS_EXT_SYSFS=y
 # CONFIG_LIB80211 is not set
 # CONFIG_MAC80211 is not set
+# CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
 
@@ -411,6 +416,7 @@ CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
 CONFIG_MTD_CONCAT=y
 CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 # CONFIG_MTD_AR7_PARTS is not set
@@ -458,9 +464,7 @@ CONFIG_MTD_CFI_UTIL=y
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
 CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_PHYSMAP_START=0xffffffff
-CONFIG_MTD_PHYSMAP_LEN=0
-CONFIG_MTD_PHYSMAP_BANKWIDTH=0
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -487,6 +491,12 @@ CONFIG_MTD_NAND_IDS=y
 CONFIG_MTD_NAND_PLATFORM=y
 # CONFIG_MTD_ONENAND is not set
 
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+# CONFIG_MTD_QINFO_PROBE is not set
+
 #
 # UBI - Unsorted block images
 #
@@ -587,6 +597,10 @@ CONFIG_SMC91X=y
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
 # CONFIG_IWLWIFI_LEDS is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
 # CONFIG_WAN is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
@@ -761,6 +775,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_PMIC_DA903X is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
 # CONFIG_REGULATOR is not set
 
 #
@@ -806,9 +821,9 @@ CONFIG_SOC_CAMERA=y
 # CONFIG_SOC_CAMERA_MT9M111 is not set
 # CONFIG_SOC_CAMERA_MT9T031 is not set
 # CONFIG_SOC_CAMERA_MT9V022 is not set
-# CONFIG_SOC_CAMERA_TW9910 is not set
-CONFIG_SOC_CAMERA_PLATFORM=y
-# CONFIG_SOC_CAMERA_OV772X is not set
+CONFIG_SOC_CAMERA_TW9910=y
+# CONFIG_SOC_CAMERA_PLATFORM is not set
+CONFIG_SOC_CAMERA_OV772X=y
 CONFIG_VIDEO_SH_MOBILE_CEU=y
 # CONFIG_RADIO_ADAPTERS is not set
 # CONFIG_DAB is not set
@@ -866,11 +881,13 @@ CONFIG_USB_GADGET_SELECTED=y
 # CONFIG_USB_GADGET_PXA25X is not set
 # CONFIG_USB_GADGET_PXA27X is not set
 # CONFIG_USB_GADGET_S3C2410 is not set
+# CONFIG_USB_GADGET_IMX is not set
 CONFIG_USB_GADGET_M66592=y
 CONFIG_USB_M66592=y
 CONFIG_SUPERH_BUILT_IN_M66592=y
 # CONFIG_USB_GADGET_AMD5536UDC is not set
 # CONFIG_USB_GADGET_FSL_QE is not set
+# CONFIG_USB_GADGET_CI13XXX is not set
 # CONFIG_USB_GADGET_NET2280 is not set
 # CONFIG_USB_GADGET_GOKU is not set
 # CONFIG_USB_GADGET_DUMMY_HCD is not set
@@ -883,6 +900,11 @@ CONFIG_USB_G_SERIAL=y
 # CONFIG_USB_MIDI_GADGET is not set
 # CONFIG_USB_G_PRINTER is not set
 # CONFIG_USB_CDC_COMPOSITE is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_USB_GPIO_VBUS is not set
 # CONFIG_MMC is not set
 # CONFIG_MEMSTICK is not set
 # CONFIG_NEW_LEDS is not set
@@ -961,6 +983,7 @@ CONFIG_UIO_PDRV_GENIRQ=y
 CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
 # CONFIG_DNOTIFY is not set
 # CONFIG_INOTIFY is not set
 # CONFIG_QUOTA is not set
@@ -1004,6 +1027,7 @@ CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_EFS_FS is not set
 # CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_OMFS_FS is not set
index ee839ee58ac84894515d328b78f1bb73dc43119f..090358a7e1bbd6ff9da88a10282da83662ca9fd4 100644 (file)
 static inline void
 __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
 {
-       int __ex_flag, __res;
+       int __done, __res;
 
        __asm__ __volatile__ (
                "movli.l        @%2, %0 \n"
                "add            #-1, %0 \n"
                "movco.l        %0, @%2 \n"
                "movt           %1      \n"
-               : "=&z" (__res), "=&r" (__ex_flag)
+               : "=&z" (__res), "=&r" (__done)
                : "r" (&(count)->counter)
                : "t");
 
-       __res |= !__ex_flag;
-       if (unlikely(__res != 0))
+       if (unlikely(!__done || __res != 0))
                fail_fn(count);
 }
 
 static inline int
 __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
 {
-       int __ex_flag, __res;
+       int __done, __res;
 
        __asm__ __volatile__ (
                "movli.l        @%2, %0 \n"
                "add            #-1, %0 \n"
                "movco.l        %0, @%2 \n"
                "movt           %1      \n"
-               : "=&z" (__res), "=&r" (__ex_flag)
+               : "=&z" (__res), "=&r" (__done)
                : "r" (&(count)->counter)
                : "t");
 
-       __res |= !__ex_flag;
-       if (unlikely(__res != 0))
+       if (unlikely(!__done || __res != 0))
                __res = fail_fn(count);
 
        return __res;
@@ -61,19 +59,18 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
 static inline void
 __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
 {
-       int __ex_flag, __res;
+       int __done, __res;
 
        __asm__ __volatile__ (
                "movli.l        @%2, %0 \n\t"
                "add            #1, %0  \n\t"
                "movco.l        %0, @%2 \n\t"
                "movt           %1      \n\t"
-               : "=&z" (__res), "=&r" (__ex_flag)
+               : "=&z" (__res), "=&r" (__done)
                : "r" (&(count)->counter)
                : "t");
 
-       __res |= !__ex_flag;
-       if (unlikely(__res <= 0))
+       if (unlikely(!__done || __res <= 0))
                fail_fn(count);
 }
 
index 05a868a71ef5a7502736fd81586c540acc80ffea..5bc34681d99451ae8485a75e4c92b1c24285acbb 100644 (file)
@@ -21,23 +21,10 @@ static inline void syscall_rollback(struct task_struct *task,
         */
 }
 
-static inline bool syscall_has_error(struct pt_regs *regs)
-{
-       return (regs->sr & 0x1) ? true : false;
-}
-static inline void syscall_set_error(struct pt_regs *regs)
-{
-       regs->sr |= 0x1;
-}
-static inline void syscall_clear_error(struct pt_regs *regs)
-{
-       regs->sr &= ~0x1;
-}
-
 static inline long syscall_get_error(struct task_struct *task,
                                     struct pt_regs *regs)
 {
-       return syscall_has_error(regs) ? regs->regs[0] : 0;
+       return IS_ERR_VALUE(regs->regs[0]) ? regs->regs[0] : 0;
 }
 
 static inline long syscall_get_return_value(struct task_struct *task,
@@ -50,13 +37,10 @@ static inline void syscall_set_return_value(struct task_struct *task,
                                            struct pt_regs *regs,
                                            int error, long val)
 {
-       if (error) {
-               syscall_set_error(regs);
+       if (error)
                regs->regs[0] = -error;
-       } else {
-               syscall_clear_error(regs);
+       else
                regs->regs[0] = val;
-       }
 }
 
 static inline void syscall_get_arguments(struct task_struct *task,
index e1143b9784d62d9247760efe5738b8ba4c642d92..c3561ca72bee9fb284dbe52b823da3ca6feadbc0 100644 (file)
@@ -21,23 +21,10 @@ static inline void syscall_rollback(struct task_struct *task,
         */
 }
 
-static inline bool syscall_has_error(struct pt_regs *regs)
-{
-       return (regs->sr & 0x1) ? true : false;
-}
-static inline void syscall_set_error(struct pt_regs *regs)
-{
-       regs->sr |= 0x1;
-}
-static inline void syscall_clear_error(struct pt_regs *regs)
-{
-       regs->sr &= ~0x1;
-}
-
 static inline long syscall_get_error(struct task_struct *task,
                                     struct pt_regs *regs)
 {
-       return syscall_has_error(regs) ? regs->regs[9] : 0;
+       return IS_ERR_VALUE(regs->regs[9]) ? regs->regs[9] : 0;
 }
 
 static inline long syscall_get_return_value(struct task_struct *task,
@@ -50,13 +37,10 @@ static inline void syscall_set_return_value(struct task_struct *task,
                                            struct pt_regs *regs,
                                            int error, long val)
 {
-       if (error) {
-               syscall_set_error(regs);
+       if (error)
                regs->regs[9] = -error;
-       } else {
-               syscall_clear_error(regs);
+       else
                regs->regs[9] = val;
-       }
 }
 
 static inline void syscall_get_arguments(struct task_struct *task,
index 2780917c0088c410491c4729e92727e4ec019d0e..e3ea5411da6d8df6469623005951ef77245ed4fe 100644 (file)
@@ -423,7 +423,7 @@ static int ieee_fpe_handler(struct pt_regs *regs)
                int m;
                unsigned int hx;
 
-               m = (finsn >> 9) & 0x7;
+               m = (finsn >> 8) & 0x7;
                hx = tsk->thread.fpu.hard.fp_regs[m];
 
                if ((tsk->thread.fpu.hard.fpscr & FPSCR_CAUSE_ERROR)
index 5342475085724c3a2de5959e5cda9ea3e9d6f623..370d2cfa34eba0c427da15cc3b35fb7e34078b97 100644 (file)
@@ -262,11 +262,11 @@ void __init setup_bootmem_allocator(unsigned long free_pfn)
                        BOOTMEM_DEFAULT);
 
        /*
-        * reserve physical page 0 - it's a special BIOS page on many boxes,
-        * enabling clean reboots, SMP operation, laptop functions.
+        * Reserve physical pages below CONFIG_ZERO_PAGE_OFFSET.
         */
-       reserve_bootmem(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET,
-                       BOOTMEM_DEFAULT);
+       if (CONFIG_ZERO_PAGE_OFFSET != 0)
+               reserve_bootmem(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET,
+                               BOOTMEM_DEFAULT);
 
        sparse_memory_present_with_active_regions(0);
 
index 77c21bde376aa7d203870969c8571182049df6db..17784e19ae340ec40dbc8c97e79e3790877c98de 100644 (file)
@@ -510,7 +510,6 @@ handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs,
                case -ERESTARTNOHAND:
                no_system_call_restart:
                        regs->regs[0] = -EINTR;
-                       regs->sr |= 1;
                        break;
 
                case -ERESTARTSYS:
@@ -589,8 +588,7 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
 
        signr = get_signal_to_deliver(&info, &ka, regs, NULL);
        if (signr > 0) {
-               if (regs->sr & 1)
-                       handle_syscall_restart(save_r0, regs, &ka.sa);
+               handle_syscall_restart(save_r0, regs, &ka.sa);
 
                /* Whee!  Actually deliver the signal.  */
                if (handle_signal(signr, &ka, &info, oldset,
index b22fdfaaa19188667e3d926d3f8433378e8544df..0663a0ee6021f4ab31c2bb32fd7a24fa82cd9a6a 100644 (file)
@@ -60,7 +60,6 @@ handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa)
                case -ERESTARTNOHAND:
                no_system_call_restart:
                        regs->regs[REG_RET] = -EINTR;
-                       regs->sr |= 1;
                        break;
 
                case -ERESTARTSYS:
@@ -109,8 +108,7 @@ static int do_signal(struct pt_regs *regs, sigset_t *oldset)
 
        signr = get_signal_to_deliver(&info, &ka, regs, 0);
        if (signr > 0) {
-               if (regs->sr & 1)
-                       handle_syscall_restart(regs, &ka.sa);
+               handle_syscall_restart(regs, &ka.sa);
 
                /* Whee!  Actually deliver the signal.  */
                if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
index cbdd0d40e545f0fa0d5cea817a472f46175f5a47..356c8ec928930fc3d4c00487767c94ee321d67b5 100644 (file)
@@ -36,8 +36,7 @@
  */
 
 /*     
- * unsigned int csum_partial(const unsigned char *buf, int len,
- *                           unsigned int sum);
+ * asmlinkage __wsum csum_partial(const void *buf, int len, __wsum sum);
  */
 
 .text
@@ -49,11 +48,31 @@ ENTRY(csum_partial)
           * Fortunately, it is easy to convert 2-byte alignment to 4-byte
           * alignment for the unrolled loop.
           */
-       mov     r5, r1
        mov     r4, r0
-       tst     #2, r0          ! Check alignment.
-       bt      2f              ! Jump if alignment is ok.
+       tst     #3, r0          ! Check alignment.
+       bt/s    2f              ! Jump if alignment is ok.
+        mov    r4, r7          ! Keep a copy to check for alignment
        !
+       tst     #1, r0          ! Check alignment.
+       bt      21f             ! Jump if alignment is boundary of 2bytes.
+
+       ! buf is odd
+       tst     r5, r5
+       add     #-1, r5
+       bt      9f
+       mov.b   @r4+, r0
+       extu.b  r0, r0
+       addc    r0, r6          ! t=0 from previous tst
+       mov     r6, r0
+       shll8   r6
+       shlr16  r0
+       shlr8   r0
+       or      r0, r6
+       mov     r4, r0
+       tst     #2, r0
+       bt      2f
+21:
+       ! buf is 2 byte aligned (len could be 0)
        add     #-2, r5         ! Alignment uses up two bytes.
        cmp/pz  r5              !
        bt/s    1f              ! Jump if we had at least two bytes.
@@ -61,16 +80,17 @@ ENTRY(csum_partial)
        bra     6f
         add    #2, r5          ! r5 was < 2.  Deal with it.
 1:
-       mov     r5, r1          ! Save new len for later use.
        mov.w   @r4+, r0
        extu.w  r0, r0
        addc    r0, r6
        bf      2f
        add     #1, r6
 2:
+       ! buf is 4 byte aligned (len could be 0)
+       mov     r5, r1
        mov     #-5, r0
-       shld    r0, r5
-       tst     r5, r5
+       shld    r0, r1
+       tst     r1, r1
        bt/s    4f              ! if it's =0, go to 4f
         clrt
        .align  2
@@ -92,30 +112,31 @@ ENTRY(csum_partial)
        addc    r0, r6
        addc    r2, r6
        movt    r0
-       dt      r5
+       dt      r1
        bf/s    3b
         cmp/eq #1, r0
-       ! here, we know r5==0
-       addc    r5, r6                  ! add carry to r6
+       ! here, we know r1==0
+       addc    r1, r6                  ! add carry to r6
 4:
-       mov     r1, r0
+       mov     r5, r0
        and     #0x1c, r0
        tst     r0, r0
-       bt/s    6f
-        mov    r0, r5
-       shlr2   r5
+       bt      6f
+       ! 4 bytes or more remaining
+       mov     r0, r1
+       shlr2   r1
        mov     #0, r2
 5:
        addc    r2, r6
        mov.l   @r4+, r2
        movt    r0
-       dt      r5
+       dt      r1
        bf/s    5b
         cmp/eq #1, r0
        addc    r2, r6
-       addc    r5, r6          ! r5==0 here, so it means add carry-bit
+       addc    r1, r6          ! r1==0 here, so it means add carry-bit
 6:
-       mov     r1, r5
+       ! 3 bytes or less remaining
        mov     #3, r0
        and     r0, r5
        tst     r5, r5
@@ -139,8 +160,18 @@ ENTRY(csum_partial)
 8:
        addc    r0, r6
        mov     #0, r0
-       addc    r0, r6 
+       addc    r0, r6
 9:
+       ! Check if the buffer was misaligned, if so realign sum
+       mov     r7, r0
+       tst     #1, r0
+       bt      10f
+       mov     r6, r0
+       shll8   r6
+       shlr16  r0
+       shlr8   r0
+       or      r0, r6
+10:
        rts
         mov    r6, r0
 
index 7da7c13d23c4f10af35b4aa159976f9dfa277808..a11b89ee9ef8f0a9e0758811dd633101adb4b12f 100644 (file)
@@ -17,7 +17,7 @@
 typedef struct {
        /* Dcache line 1 */
        unsigned int    __softirq_pending; /* must be 1st, see rtrap.S */
-       unsigned int    __pad0;
+       unsigned int    __nmi_count;
        unsigned long   clock_tick;     /* %tick's per second */
        unsigned long   __pad;
        unsigned int    __pad1;
index d47d4a1955a974169b8a9bf432915c5d4263807c..1934f2cbf5132a7e7ba5e71e97dc1d1ada6f5589 100644 (file)
@@ -66,9 +66,6 @@ extern void virt_irq_free(unsigned int virt_irq);
 extern void __init init_IRQ(void);
 extern void fixup_irqs(void);
 
-extern int register_perfctr_intr(void (*handler)(struct pt_regs *));
-extern void release_perfctr_intr(void (*handler)(struct pt_regs *));
-
 static inline void set_softint(unsigned long bits)
 {
        __asm__ __volatile__("wr        %0, 0x0, %%set_softint"
@@ -98,5 +95,6 @@ void __trigger_all_cpu_backtrace(void);
 extern void *hardirq_stack[NR_CPUS];
 extern void *softirq_stack[NR_CPUS];
 #define __ARCH_HAS_DO_SOFTIRQ
+#define ARCH_HAS_NMI_WATCHDOG
 
 #endif
index f905b773235a2f977db3383559629d4fbd3e4fda..feb3578e12c4f5ce6a0e0a3d340fe913a7c36501 100644 (file)
@@ -14,6 +14,8 @@ enum die_val {
        DIE_TRAP,
        DIE_TRAP_TL1,
        DIE_CALL,
+       DIE_NMI,
+       DIE_NMIWATCHDOG,
 };
 
 #endif
diff --git a/arch/sparc/include/asm/nmi.h b/arch/sparc/include/asm/nmi.h
new file mode 100644 (file)
index 0000000..fbd546d
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __NMI_H
+#define __NMI_H
+
+extern int __init nmi_init(void);
+extern void perfctr_irq(int irq, struct pt_regs *regs);
+extern void nmi_adjust_hz(unsigned int new_hz);
+
+extern int nmi_usable;
+
+#endif /* __NMI_H */
diff --git a/arch/sparc/include/asm/pcr.h b/arch/sparc/include/asm/pcr.h
new file mode 100644 (file)
index 0000000..a2f5c61
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef __PCR_H
+#define __PCR_H
+
+struct pcr_ops {
+       u64 (*read)(void);
+       void (*write)(u64);
+};
+extern const struct pcr_ops *pcr_ops;
+
+extern void deferred_pcr_work_irq(int irq, struct pt_regs *regs);
+extern void schedule_deferred_pcr_work(void);
+
+#define PCR_PIC_PRIV           0x00000001 /* PIC access is privileged */
+#define PCR_STRACE             0x00000002 /* Trace supervisor events  */
+#define PCR_UTRACE             0x00000004 /* Trace user events        */
+#define PCR_N2_HTRACE          0x00000008 /* Trace hypervisor events  */
+#define PCR_N2_TOE_OV0         0x00000010 /* Trap if PIC 0 overflows  */
+#define PCR_N2_TOE_OV1         0x00000020 /* Trap if PIC 1 overflows  */
+#define PCR_N2_MASK0           0x00003fc0
+#define PCR_N2_MASK0_SHIFT     6
+#define PCR_N2_SL0             0x0003c000
+#define PCR_N2_SL0_SHIFT       14
+#define PCR_N2_OV0             0x00040000
+#define PCR_N2_MASK1           0x07f80000
+#define PCR_N2_MASK1_SHIFT     19
+#define PCR_N2_SL1             0x78000000
+#define PCR_N2_SL1_SHIFT       27
+#define PCR_N2_OV1             0x80000000
+
+extern unsigned int picl_shift;
+
+/* In order to commonize as much of the implementation as
+ * possible, we use PICH as our counter.  Mostly this is
+ * to accomodate Niagara-1 which can only count insn cycles
+ * in PICH.
+ */
+static inline u64 picl_value(unsigned int nmi_hz)
+{
+       u32 delta = local_cpu_data().clock_tick / (nmi_hz << picl_shift);
+
+       return ((u64)((0 - delta) & 0xffffffff)) << 32;
+}
+
+extern u64 pcr_enable;
+
+#endif /* __PCR_H */
index d573820c0ff4fc9bc766687174acdde78d664700..32a7efe76d00ab1367e143be8d93777c47d1d214 100644 (file)
@@ -23,6 +23,7 @@
 #define PIL_SMP_CTX_NEW_VERSION        4
 #define PIL_DEVICE_IRQ         5
 #define PIL_SMP_CALL_FUNC_SNGL 6
+#define PIL_DEFERRED_PCR_WORK  7
 #define PIL_NORMAL_MAX         14
 #define PIL_NMI                        15
 
index 53adcaa0348ba8f50d60c1a7baa1951a858882da..54742e58831c4d78e19bad176145e8ce0bae7d6b 100644 (file)
@@ -52,6 +52,8 @@ obj-$(CONFIG_SPARC64)   += visemul.o
 obj-$(CONFIG_SPARC64)   += hvapi.o
 obj-$(CONFIG_SPARC64)   += sstate.o
 obj-$(CONFIG_SPARC64)   += mdesc.o
+obj-$(CONFIG_SPARC64)  += pcr.o
+obj-$(CONFIG_SPARC64)  += nmi.o
 
 # sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation
 obj-$(CONFIG_SPARC32)     += devres.o
index 32d32b4824f5c6aee4d4eecb15f1a864939fbc83..d85c3dc4953a931acde5fad87db15976a92e0904 100644 (file)
@@ -26,6 +26,7 @@ EXPORT_PER_CPU_SYMBOL(__cpu_data);
 struct cpu_info {
        int psr_vers;
        const char *name;
+       const char *pmu_name;
 };
 
 struct fpu_info {
@@ -45,6 +46,9 @@ struct manufacturer_info {
 #define CPU(ver, _name) \
 { .psr_vers = ver, .name = _name }
 
+#define CPU_PMU(ver, _name, _pmu_name) \
+{ .psr_vers = ver, .name = _name, .pmu_name = _pmu_name }
+
 #define FPU(ver, _name) \
 { .fp_vers = ver, .name = _name }
 
@@ -183,10 +187,10 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
 },{
        0x17,
        .cpu_info = {
-               CPU(0x10, "TI UltraSparc I   (SpitFire)"),
-               CPU(0x11, "TI UltraSparc II  (BlackBird)"),
-               CPU(0x12, "TI UltraSparc IIi (Sabre)"),
-               CPU(0x13, "TI UltraSparc IIe (Hummingbird)"),
+               CPU_PMU(0x10, "TI UltraSparc I   (SpitFire)", "ultra12"),
+               CPU_PMU(0x11, "TI UltraSparc II  (BlackBird)", "ultra12"),
+               CPU_PMU(0x12, "TI UltraSparc IIi (Sabre)", "ultra12"),
+               CPU_PMU(0x13, "TI UltraSparc IIe (Hummingbird)", "ultra12"),
                CPU(-1, NULL)
        },
        .fpu_info = {
@@ -199,7 +203,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
 },{
        0x22,
        .cpu_info = {
-               CPU(0x10, "TI UltraSparc I   (SpitFire)"),
+               CPU_PMU(0x10, "TI UltraSparc I   (SpitFire)", "ultra12"),
                CPU(-1, NULL)
        },
        .fpu_info = {
@@ -209,12 +213,12 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
 },{
        0x3e,
        .cpu_info = {
-               CPU(0x14, "TI UltraSparc III (Cheetah)"),
-               CPU(0x15, "TI UltraSparc III+ (Cheetah+)"),
-               CPU(0x16, "TI UltraSparc IIIi (Jalapeno)"),
-               CPU(0x18, "TI UltraSparc IV (Jaguar)"),
-               CPU(0x19, "TI UltraSparc IV+ (Panther)"),
-               CPU(0x22, "TI UltraSparc IIIi+ (Serrano)"),
+               CPU_PMU(0x14, "TI UltraSparc III (Cheetah)", "ultra3"),
+               CPU_PMU(0x15, "TI UltraSparc III+ (Cheetah+)", "ultra3+"),
+               CPU_PMU(0x16, "TI UltraSparc IIIi (Jalapeno)", "ultra3i"),
+               CPU_PMU(0x18, "TI UltraSparc IV (Jaguar)", "ultra3+"),
+               CPU_PMU(0x19, "TI UltraSparc IV+ (Panther)", "ultra4+"),
+               CPU_PMU(0x22, "TI UltraSparc IIIi+ (Serrano)", "ultra3i"),
                CPU(-1, NULL)
        },
        .fpu_info = {
@@ -234,6 +238,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
 
 const char *sparc_cpu_type;
 const char *sparc_fpu_type;
+const char *sparc_pmu_type;
 
 unsigned int fsr_storage;
 
@@ -244,6 +249,7 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
 
        sparc_cpu_type = NULL;
        sparc_fpu_type = NULL;
+       sparc_pmu_type = NULL;
        manuf = NULL;
 
        for (i = 0; i < ARRAY_SIZE(manufacturer_info); i++)
@@ -263,6 +269,7 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
                {
                        if (cpu->psr_vers == psr_vers) {
                                sparc_cpu_type = cpu->name;
+                               sparc_pmu_type = cpu->pmu_name;
                                sparc_fpu_type = "No FPU";
                                break;
                        }
@@ -290,6 +297,8 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
                       psr_impl, fpu_vers);
                sparc_fpu_type = "Unknown FPU";
        }
+       if (sparc_pmu_type == NULL)
+               sparc_pmu_type = "Unknown PMU";
 }
 
 #ifdef CONFIG_SPARC32
@@ -315,11 +324,13 @@ static void __init sun4v_cpu_probe(void)
        case SUN4V_CHIP_NIAGARA1:
                sparc_cpu_type = "UltraSparc T1 (Niagara)";
                sparc_fpu_type = "UltraSparc T1 integrated FPU";
+               sparc_pmu_type = "niagara";
                break;
 
        case SUN4V_CHIP_NIAGARA2:
                sparc_cpu_type = "UltraSparc T2 (Niagara2)";
                sparc_fpu_type = "UltraSparc T2 integrated FPU";
+               sparc_pmu_type = "niagara2";
                break;
 
        default:
index cab8e02868716d691a38b9bad239ec754dd39134..e289376198eb2be4e722b5cbf1a31d440c580631 100644 (file)
@@ -196,6 +196,11 @@ int show_interrupts(struct seq_file *p, void *v)
                seq_putc(p, '\n');
 skip:
                spin_unlock_irqrestore(&irq_desc[i].lock, flags);
+       } else if (i == NR_IRQS) {
+               seq_printf(p, "NMI: ");
+               for_each_online_cpu(j)
+                       seq_printf(p, "%10u ", cpu_data(j).__nmi_count);
+               seq_printf(p, "     Non-maskable interrupts\n");
        }
        return 0;
 }
@@ -778,69 +783,6 @@ void do_softirq(void)
        local_irq_restore(flags);
 }
 
-static void unhandled_perf_irq(struct pt_regs *regs)
-{
-       unsigned long pcr, pic;
-
-       read_pcr(pcr);
-       read_pic(pic);
-
-       write_pcr(0);
-
-       printk(KERN_EMERG "CPU %d: Got unexpected perf counter IRQ.\n",
-              smp_processor_id());
-       printk(KERN_EMERG "CPU %d: PCR[%016lx] PIC[%016lx]\n",
-              smp_processor_id(), pcr, pic);
-}
-
-/* Almost a direct copy of the powerpc PMC code.  */
-static DEFINE_SPINLOCK(perf_irq_lock);
-static void *perf_irq_owner_caller; /* mostly for debugging */
-static void (*perf_irq)(struct pt_regs *regs) = unhandled_perf_irq;
-
-/* Invoked from level 15 PIL handler in trap table.  */
-void perfctr_irq(int irq, struct pt_regs *regs)
-{
-       clear_softint(1 << irq);
-       perf_irq(regs);
-}
-
-int register_perfctr_intr(void (*handler)(struct pt_regs *))
-{
-       int ret;
-
-       if (!handler)
-               return -EINVAL;
-
-       spin_lock(&perf_irq_lock);
-       if (perf_irq != unhandled_perf_irq) {
-               printk(KERN_WARNING "register_perfctr_intr: "
-                      "perf IRQ busy (reserved by caller %p)\n",
-                      perf_irq_owner_caller);
-               ret = -EBUSY;
-               goto out;
-       }
-
-       perf_irq_owner_caller = __builtin_return_address(0);
-       perf_irq = handler;
-
-       ret = 0;
-out:
-       spin_unlock(&perf_irq_lock);
-
-       return ret;
-}
-EXPORT_SYMBOL_GPL(register_perfctr_intr);
-
-void release_perfctr_intr(void (*handler)(struct pt_regs *))
-{
-       spin_lock(&perf_irq_lock);
-       perf_irq_owner_caller = NULL;
-       perf_irq = unhandled_perf_irq;
-       spin_unlock(&perf_irq_lock);
-}
-EXPORT_SYMBOL_GPL(release_perfctr_intr);
-
 #ifdef CONFIG_HOTPLUG_CPU
 void fixup_irqs(void)
 {
index 81a972e8d8ea17e78fc18a529f4fc7d8640b10ca..15d8a3f645c9e7ba599753f4f94ce84875af7429 100644 (file)
@@ -5,6 +5,7 @@
 
 /* cpu.c */
 extern const char *sparc_cpu_type;
+extern const char *sparc_pmu_type;
 extern const char *sparc_fpu_type;
 
 extern unsigned int fsr_storage;
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c
new file mode 100644 (file)
index 0000000..09f088e
--- /dev/null
@@ -0,0 +1,224 @@
+/* Pseudo NMI support on sparc64 systems.
+ *
+ * Copyright (C) 2009 David S. Miller <davem@davemloft.net>
+ *
+ * The NMI watchdog support and infrastructure is based almost
+ * entirely upon the x86 NMI support code.
+ */
+#include <linux/kernel.h>
+#include <linux/param.h>
+#include <linux/init.h>
+#include <linux/percpu.h>
+#include <linux/nmi.h>
+#include <linux/module.h>
+#include <linux/kprobes.h>
+#include <linux/kernel_stat.h>
+#include <linux/slab.h>
+#include <linux/kdebug.h>
+#include <linux/delay.h>
+#include <linux/smp.h>
+
+#include <asm/ptrace.h>
+#include <asm/local.h>
+#include <asm/pcr.h>
+
+/* We don't have a real NMI on sparc64, but we can fake one
+ * up using profiling counter overflow interrupts and interrupt
+ * levels.
+ *
+ * The profile overflow interrupts at level 15, so we use
+ * level 14 as our IRQ off level.
+ */
+
+static int nmi_watchdog_active;
+static int panic_on_timeout;
+
+int nmi_usable;
+EXPORT_SYMBOL_GPL(nmi_usable);
+
+static unsigned int nmi_hz = HZ;
+
+static DEFINE_PER_CPU(unsigned int, last_irq_sum);
+static DEFINE_PER_CPU(local_t, alert_counter);
+static DEFINE_PER_CPU(int, nmi_touch);
+
+void touch_nmi_watchdog(void)
+{
+       if (nmi_watchdog_active) {
+               int cpu;
+
+               for_each_present_cpu(cpu) {
+                       if (per_cpu(nmi_touch, cpu) != 1)
+                               per_cpu(nmi_touch, cpu) = 1;
+               }
+       }
+
+       touch_softlockup_watchdog();
+}
+EXPORT_SYMBOL(touch_nmi_watchdog);
+
+static void die_nmi(const char *str, struct pt_regs *regs, int do_panic)
+{
+       if (notify_die(DIE_NMIWATCHDOG, str, regs, 0,
+                      pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
+               return;
+
+       console_verbose();
+       bust_spinlocks(1);
+
+       printk(KERN_EMERG "%s", str);
+       printk(" on CPU%d, ip %08lx, registers:\n",
+              smp_processor_id(), regs->tpc);
+       show_regs(regs);
+
+       bust_spinlocks(0);
+
+       if (do_panic || panic_on_oops)
+               panic("Non maskable interrupt");
+
+       local_irq_enable();
+       do_exit(SIGBUS);
+}
+
+notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
+{
+       unsigned int sum, touched = 0;
+       int cpu = smp_processor_id();
+
+       clear_softint(1 << irq);
+       pcr_ops->write(PCR_PIC_PRIV);
+
+       local_cpu_data().__nmi_count++;
+
+       if (notify_die(DIE_NMI, "nmi", regs, 0,
+                      pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
+               touched = 1;
+
+       sum = kstat_irqs_cpu(0, cpu);
+       if (__get_cpu_var(nmi_touch)) {
+               __get_cpu_var(nmi_touch) = 0;
+               touched = 1;
+       }
+       if (!touched && __get_cpu_var(last_irq_sum) == sum) {
+               local_inc(&__get_cpu_var(alert_counter));
+               if (local_read(&__get_cpu_var(alert_counter)) == 5 * nmi_hz)
+                       die_nmi("BUG: NMI Watchdog detected LOCKUP",
+                               regs, panic_on_timeout);
+       } else {
+               __get_cpu_var(last_irq_sum) = sum;
+               local_set(&__get_cpu_var(alert_counter), 0);
+       }
+       if (nmi_usable) {
+               write_pic(picl_value(nmi_hz));
+               pcr_ops->write(pcr_enable);
+       }
+}
+
+static inline unsigned int get_nmi_count(int cpu)
+{
+       return cpu_data(cpu).__nmi_count;
+}
+
+static int endflag __initdata;
+
+static __init void nmi_cpu_busy(void *data)
+{
+       local_irq_enable_in_hardirq();
+       while (endflag == 0)
+               mb();
+}
+
+static void report_broken_nmi(int cpu, int *prev_nmi_count)
+{
+       printk(KERN_CONT "\n");
+
+       printk(KERN_WARNING
+               "WARNING: CPU#%d: NMI appears to be stuck (%d->%d)!\n",
+                       cpu, prev_nmi_count[cpu], get_nmi_count(cpu));
+
+       printk(KERN_WARNING
+               "Please report this to bugzilla.kernel.org,\n");
+       printk(KERN_WARNING
+               "and attach the output of the 'dmesg' command.\n");
+
+       nmi_usable = 0;
+}
+
+static void stop_watchdog(void *unused)
+{
+       pcr_ops->write(PCR_PIC_PRIV);
+}
+
+static int __init check_nmi_watchdog(void)
+{
+       unsigned int *prev_nmi_count;
+       int cpu, err;
+
+       prev_nmi_count = kmalloc(nr_cpu_ids * sizeof(unsigned int), GFP_KERNEL);
+       if (!prev_nmi_count) {
+               err = -ENOMEM;
+               goto error;
+       }
+
+       printk(KERN_INFO "Testing NMI watchdog ... ");
+
+       smp_call_function(nmi_cpu_busy, (void *)&endflag, 0);
+
+       for_each_possible_cpu(cpu)
+               prev_nmi_count[cpu] = get_nmi_count(cpu);
+       local_irq_enable();
+       mdelay((20 * 1000) / nmi_hz); /* wait 20 ticks */
+
+       for_each_online_cpu(cpu) {
+               if (get_nmi_count(cpu) - prev_nmi_count[cpu] <= 5)
+                       report_broken_nmi(cpu, prev_nmi_count);
+       }
+       endflag = 1;
+       if (!nmi_usable) {
+               kfree(prev_nmi_count);
+               err = -ENODEV;
+               goto error;
+       }
+       printk("OK.\n");
+
+       nmi_hz = 1;
+
+       kfree(prev_nmi_count);
+       return 0;
+error:
+       on_each_cpu(stop_watchdog, NULL, 1);
+       return err;
+}
+
+static void start_watchdog(void *unused)
+{
+       pcr_ops->write(PCR_PIC_PRIV);
+       write_pic(picl_value(nmi_hz));
+
+       pcr_ops->write(pcr_enable);
+}
+
+void nmi_adjust_hz(unsigned int new_hz)
+{
+       nmi_hz = new_hz;
+       on_each_cpu(start_watchdog, NULL, 1);
+}
+EXPORT_SYMBOL_GPL(nmi_adjust_hz);
+
+int __init nmi_init(void)
+{
+       nmi_usable = 1;
+
+       on_each_cpu(start_watchdog, NULL, 1);
+
+       return check_nmi_watchdog();
+}
+
+static int __init setup_nmi_watchdog(char *str)
+{
+       if (!strncmp(str, "panic", 5))
+               panic_on_timeout = 1;
+
+       return 0;
+}
+__setup("nmi_watchdog=", setup_nmi_watchdog);
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c
new file mode 100644 (file)
index 0000000..92e0dda
--- /dev/null
@@ -0,0 +1,153 @@
+/* pcr.c: Generic sparc64 performance counter infrastructure.
+ *
+ * Copyright (C) 2009 David S. Miller (davem@davemloft.net)
+ */
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+
+#include <asm/pil.h>
+#include <asm/pcr.h>
+#include <asm/nmi.h>
+
+/* This code is shared between various users of the performance
+ * counters.  Users will be oprofile, pseudo-NMI watchdog, and the
+ * perf_counter support layer.
+ */
+
+#define PCR_SUN4U_ENABLE       (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE)
+#define PCR_N2_ENABLE          (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE | \
+                                PCR_N2_TOE_OV1 | \
+                                (2 << PCR_N2_SL1_SHIFT) | \
+                                (0xff << PCR_N2_MASK1_SHIFT))
+
+u64 pcr_enable;
+unsigned int picl_shift;
+
+/* Performance counter interrupts run unmasked at PIL level 15.
+ * Therefore we can't do things like wakeups and other work
+ * that expects IRQ disabling to be adhered to in locking etc.
+ *
+ * Therefore in such situations we defer the work by signalling
+ * a lower level cpu IRQ.
+ */
+void deferred_pcr_work_irq(int irq, struct pt_regs *regs)
+{
+       clear_softint(1 << PIL_DEFERRED_PCR_WORK);
+}
+
+void schedule_deferred_pcr_work(void)
+{
+       set_softint(1 << PIL_DEFERRED_PCR_WORK);
+}
+
+const struct pcr_ops *pcr_ops;
+EXPORT_SYMBOL_GPL(pcr_ops);
+
+static u64 direct_pcr_read(void)
+{
+       u64 val;
+
+       read_pcr(val);
+       return val;
+}
+
+static void direct_pcr_write(u64 val)
+{
+       write_pcr(val);
+}
+
+static const struct pcr_ops direct_pcr_ops = {
+       .read   = direct_pcr_read,
+       .write  = direct_pcr_write,
+};
+
+static void n2_pcr_write(u64 val)
+{
+       unsigned long ret;
+
+       ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val);
+       if (val != HV_EOK)
+               write_pcr(val);
+}
+
+static const struct pcr_ops n2_pcr_ops = {
+       .read   = direct_pcr_read,
+       .write  = n2_pcr_write,
+};
+
+static unsigned long perf_hsvc_group;
+static unsigned long perf_hsvc_major;
+static unsigned long perf_hsvc_minor;
+
+static int __init register_perf_hsvc(void)
+{
+       if (tlb_type == hypervisor) {
+               switch (sun4v_chip_type) {
+               case SUN4V_CHIP_NIAGARA1:
+                       perf_hsvc_group = HV_GRP_NIAG_PERF;
+                       break;
+
+               case SUN4V_CHIP_NIAGARA2:
+                       perf_hsvc_group = HV_GRP_N2_CPU;
+                       break;
+
+               default:
+                       return -ENODEV;
+               }
+
+
+               perf_hsvc_major = 1;
+               perf_hsvc_minor = 0;
+               if (sun4v_hvapi_register(perf_hsvc_group,
+                                        perf_hsvc_major,
+                                        &perf_hsvc_minor)) {
+                       printk("perfmon: Could not register hvapi.\n");
+                       return -ENODEV;
+               }
+       }
+       return 0;
+}
+
+static void __init unregister_perf_hsvc(void)
+{
+       if (tlb_type != hypervisor)
+               return;
+       sun4v_hvapi_unregister(perf_hsvc_group);
+}
+
+int __init pcr_arch_init(void)
+{
+       int err = register_perf_hsvc();
+
+       if (err)
+               return err;
+
+       switch (tlb_type) {
+       case hypervisor:
+               pcr_ops = &n2_pcr_ops;
+               pcr_enable = PCR_N2_ENABLE;
+               picl_shift = 2;
+               break;
+
+       case cheetah:
+       case cheetah_plus:
+       case spitfire:
+               pcr_ops = &direct_pcr_ops;
+               pcr_enable = PCR_SUN4U_ENABLE;
+               break;
+
+       default:
+               err = -ENODEV;
+               goto out_unregister;
+       }
+
+       return nmi_init();
+
+out_unregister:
+       unregister_perf_hsvc();
+       return err;
+}
+
+arch_initcall(pcr_arch_init);
index cc8b5604442cc0968c6ff96311e9c998e45df86f..a73954b87f0a511ad7431b4b33f82216f22e2b7c 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/cpu.h>
 #include <linux/elfcore.h>
 #include <linux/sysrq.h>
+#include <linux/nmi.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
 
 static void sparc64_yield(int cpu)
 {
-       if (tlb_type != hypervisor)
+       if (tlb_type != hypervisor) {
+               touch_nmi_watchdog();
                return;
+       }
 
        clear_thread_flag(TIF_POLLING_NRFLAG);
        smp_mb__after_clear_bit();
index 49d061f4ae9d43319ed5098d6a8bd3ad309e1636..f2bcfd2967d76e463d183873ce309b4c71e5ca42 100644 (file)
@@ -354,6 +354,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
        seq_printf(m, 
                   "cpu\t\t: %s\n"
                   "fpu\t\t: %s\n"
+                  "pmu\t\t: %s\n"
                   "prom\t\t: %s\n"
                   "type\t\t: %s\n"
                   "ncpus probed\t: %d\n"
@@ -366,6 +367,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
                   ,
                   sparc_cpu_type,
                   sparc_fpu_type,
+                  sparc_pmu_type,
                   prom_version,
                   ((tlb_type == hypervisor) ?
                    "sun4v" :
index ea925503b42e59fa051d591ebf752eb708243c7d..d9bdfb9d5c187468e056afff9e66e8976f20e31d 100644 (file)
@@ -63,7 +63,8 @@ tl0_irq6:     TRAP_IRQ(smp_call_function_single_client, 6)
 #else
 tl0_irq6:      BTRAP(0x46)
 #endif
-tl0_irq7:      BTRAP(0x47) BTRAP(0x48) BTRAP(0x49)
+tl0_irq7:      TRAP_IRQ(deferred_pcr_work_irq, 7)
+tl0_irq8:      BTRAP(0x48) BTRAP(0x49)
 tl0_irq10:     BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d)
 tl0_irq14:     TRAP_IRQ(timer_interrupt, 14)
 tl0_irq15:     TRAP_NMI_IRQ(perfctr_irq, 15)
index a9e474bf63856077826d7ba0974ee887ca8d8c46..4ab8993b0863cda9f432464038daa14b483ae463 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/interrupt.h>
 #include <linux/kprobes.h>
 #include <linux/kdebug.h>
+#include <linux/percpu.h>
 
 #include <asm/page.h>
 #include <asm/pgtable.h>
@@ -224,6 +225,30 @@ cannot_handle:
        unhandled_fault (address, current, regs);
 }
 
+static void noinline bogus_32bit_fault_tpc(struct pt_regs *regs)
+{
+       static int times;
+
+       if (times++ < 10)
+               printk(KERN_ERR "FAULT[%s:%d]: 32-bit process reports "
+                      "64-bit TPC [%lx]\n",
+                      current->comm, current->pid,
+                      regs->tpc);
+       show_regs(regs);
+}
+
+static void noinline bogus_32bit_fault_address(struct pt_regs *regs,
+                                              unsigned long addr)
+{
+       static int times;
+
+       if (times++ < 10)
+               printk(KERN_ERR "FAULT[%s:%d]: 32-bit process "
+                      "reports 64-bit fault address [%lx]\n",
+                      current->comm, current->pid, addr);
+       show_regs(regs);
+}
+
 asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
 {
        struct mm_struct *mm = current->mm;
@@ -244,6 +269,19 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
            (fault_code & FAULT_CODE_DTLB))
                BUG();
 
+       if (test_thread_flag(TIF_32BIT)) {
+               if (!(regs->tstate & TSTATE_PRIV)) {
+                       if (unlikely((regs->tpc >> 32) != 0)) {
+                               bogus_32bit_fault_tpc(regs);
+                               goto intr_or_no_mm;
+                       }
+               }
+               if (unlikely((address >> 32) != 0)) {
+                       bogus_32bit_fault_address(regs, address);
+                       goto intr_or_no_mm;
+               }
+       }
+
        if (regs->tstate & TSTATE_PRIV) {
                unsigned long tpc = regs->tpc;
 
@@ -264,12 +302,6 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
        if (in_atomic() || !mm)
                goto intr_or_no_mm;
 
-       if (test_thread_flag(TIF_32BIT)) {
-               if (!(regs->tstate & TSTATE_PRIV))
-                       regs->tpc &= 0xffffffff;
-               address &= 0xffffffff;
-       }
-
        if (!down_read_trylock(&mm->mmap_sem)) {
                if ((regs->tstate & TSTATE_PRIV) &&
                    !search_exception_tables(regs->tpc)) {
index d6e170c074fc5023b1befcbd7e9525e44f7ad96a..d172f86439b1b8be67b58c0f2ad1b64deb30068e 100644 (file)
 #include <linux/init.h>
  
 #ifdef CONFIG_SPARC64
-#include <asm/hypervisor.h>
-#include <asm/spitfire.h>
-#include <asm/cpudata.h>
-#include <asm/irq.h>
+#include <linux/notifier.h>
+#include <linux/rcupdate.h>
+#include <linux/kdebug.h>
+#include <asm/nmi.h>
 
-static int nmi_enabled;
-
-struct pcr_ops {
-       u64 (*read)(void);
-       void (*write)(u64);
-};
-static const struct pcr_ops *pcr_ops;
-
-static u64 direct_pcr_read(void)
-{
-       u64 val;
-
-       read_pcr(val);
-       return val;
-}
-
-static void direct_pcr_write(u64 val)
-{
-       write_pcr(val);
-}
-
-static const struct pcr_ops direct_pcr_ops = {
-       .read   = direct_pcr_read,
-       .write  = direct_pcr_write,
-};
-
-static void n2_pcr_write(u64 val)
+static int profile_timer_exceptions_notify(struct notifier_block *self,
+                                          unsigned long val, void *data)
 {
-       unsigned long ret;
-
-       ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val);
-       if (val != HV_EOK)
-               write_pcr(val);
-}
-
-static const struct pcr_ops n2_pcr_ops = {
-       .read   = direct_pcr_read,
-       .write  = n2_pcr_write,
-};
-
-/* In order to commonize as much of the implementation as
- * possible, we use PICH as our counter.  Mostly this is
- * to accomodate Niagara-1 which can only count insn cycles
- * in PICH.
- */
-static u64 picl_value(void)
-{
-       u32 delta = local_cpu_data().clock_tick / HZ;
-
-       return ((u64)((0 - delta) & 0xffffffff)) << 32;
-}
-
-#define PCR_PIC_PRIV           0x00000001 /* PIC access is privileged */
-#define PCR_STRACE             0x00000002 /* Trace supervisor events  */
-#define PCR_UTRACE             0x00000004 /* Trace user events        */
-#define PCR_N2_HTRACE          0x00000008 /* Trace hypervisor events  */
-#define PCR_N2_TOE_OV0         0x00000010 /* Trap if PIC 0 overflows  */
-#define PCR_N2_TOE_OV1         0x00000020 /* Trap if PIC 1 overflows  */
-#define PCR_N2_MASK0           0x00003fc0
-#define PCR_N2_MASK0_SHIFT     6
-#define PCR_N2_SL0             0x0003c000
-#define PCR_N2_SL0_SHIFT       14
-#define PCR_N2_OV0             0x00040000
-#define PCR_N2_MASK1           0x07f80000
-#define PCR_N2_MASK1_SHIFT     19
-#define PCR_N2_SL1             0x78000000
-#define PCR_N2_SL1_SHIFT       27
-#define PCR_N2_OV1             0x80000000
-
-#define PCR_SUN4U_ENABLE       (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE)
-#define PCR_N2_ENABLE          (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE | \
-                                PCR_N2_TOE_OV1 | \
-                                (2 << PCR_N2_SL1_SHIFT) | \
-                                (0xff << PCR_N2_MASK1_SHIFT))
-
-static u64 pcr_enable = PCR_SUN4U_ENABLE;
-
-static void nmi_handler(struct pt_regs *regs)
-{
-       pcr_ops->write(PCR_PIC_PRIV);
-
-       if (nmi_enabled) {
-               oprofile_add_sample(regs, 0);
-
-               write_pic(picl_value());
-               pcr_ops->write(pcr_enable);
-       }
-}
-
-/* We count "clock cycle" events in the lower 32-bit PIC.
- * Then configure it such that it overflows every HZ, and thus
- * generates a level 15 interrupt at that frequency.
- */
-static void cpu_nmi_start(void *_unused)
-{
-       pcr_ops->write(PCR_PIC_PRIV);
-       write_pic(picl_value());
-
-       pcr_ops->write(pcr_enable);
-}
+       struct die_args *args = (struct die_args *)data;
+       int ret = NOTIFY_DONE;
 
-static void cpu_nmi_stop(void *_unused)
-{
-       pcr_ops->write(PCR_PIC_PRIV);
-}
-
-static int nmi_start(void)
-{
-       int err = register_perfctr_intr(nmi_handler);
-
-       if (!err) {
-               nmi_enabled = 1;
-               wmb();
-               err = on_each_cpu(cpu_nmi_start, NULL, 1);
-               if (err) {
-                       nmi_enabled = 0;
-                       wmb();
-                       on_each_cpu(cpu_nmi_stop, NULL, 1);
-                       release_perfctr_intr(nmi_handler);
-               }
+       switch (val) {
+       case DIE_NMI:
+               oprofile_add_sample(args->regs, 0);
+               ret = NOTIFY_STOP;
+               break;
+       default:
+               break;
        }
-
-       return err;
-}
-
-static void nmi_stop(void)
-{
-       nmi_enabled = 0;
-       wmb();
-
-       on_each_cpu(cpu_nmi_stop, NULL, 1);
-       release_perfctr_intr(nmi_handler);
-       synchronize_sched();
+       return ret;
 }
 
-static unsigned long perf_hsvc_group;
-static unsigned long perf_hsvc_major;
-static unsigned long perf_hsvc_minor;
+static struct notifier_block profile_timer_exceptions_nb = {
+       .notifier_call  = profile_timer_exceptions_notify,
+};
 
-static int __init register_perf_hsvc(void)
+static int timer_start(void)
 {
-       if (tlb_type == hypervisor) {
-               switch (sun4v_chip_type) {
-               case SUN4V_CHIP_NIAGARA1:
-                       perf_hsvc_group = HV_GRP_NIAG_PERF;
-                       break;
-
-               case SUN4V_CHIP_NIAGARA2:
-                       perf_hsvc_group = HV_GRP_N2_CPU;
-                       break;
-
-               default:
-                       return -ENODEV;
-               }
-
-
-               perf_hsvc_major = 1;
-               perf_hsvc_minor = 0;
-               if (sun4v_hvapi_register(perf_hsvc_group,
-                                        perf_hsvc_major,
-                                        &perf_hsvc_minor)) {
-                       printk("perfmon: Could not register N2 hvapi.\n");
-                       return -ENODEV;
-               }
-       }
+       if (register_die_notifier(&profile_timer_exceptions_nb))
+               return 1;
+       nmi_adjust_hz(HZ);
        return 0;
 }
 
-static void unregister_perf_hsvc(void)
+
+static void timer_stop(void)
 {
-       if (tlb_type != hypervisor)
-               return;
-       sun4v_hvapi_unregister(perf_hsvc_group);
+       nmi_adjust_hz(1);
+       unregister_die_notifier(&profile_timer_exceptions_nb);
+       synchronize_sched();  /* Allow already-started NMIs to complete. */
 }
 
-static int oprofile_nmi_init(struct oprofile_operations *ops)
+static int op_nmi_timer_init(struct oprofile_operations *ops)
 {
-       int err = register_perf_hsvc();
-
-       if (err)
-               return err;
-
-       switch (tlb_type) {
-       case hypervisor:
-               pcr_ops = &n2_pcr_ops;
-               pcr_enable = PCR_N2_ENABLE;
-               break;
-
-       case cheetah:
-       case cheetah_plus:
-               pcr_ops = &direct_pcr_ops;
-               break;
-
-       default:
+       if (!nmi_usable)
                return -ENODEV;
-       }
 
-       ops->create_files = NULL;
-       ops->setup = NULL;
-       ops->shutdown = NULL;
-       ops->start = nmi_start;
-       ops->stop = nmi_stop;
+       ops->start = timer_start;
+       ops->stop = timer_stop;
        ops->cpu_type = "timer";
-
-       printk(KERN_INFO "oprofile: Using perfctr based NMI timer interrupt.\n");
-
+       printk(KERN_INFO "oprofile: Using perfctr NMI timer interrupt.\n");
        return 0;
 }
 #endif
@@ -233,7 +73,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
        int ret = -ENODEV;
 
 #ifdef CONFIG_SPARC64
-       ret = oprofile_nmi_init(ops);
+       ret = op_nmi_timer_init(ops);
        if (!ret)
                return ret;
 #endif
@@ -241,10 +81,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
        return ret;
 }
 
-
 void oprofile_arch_exit(void)
 {
-#ifdef CONFIG_SPARC64
-       unregister_perf_hsvc();
-#endif
 }
index 75115849af330e057c71eecd845e4b799107a077..4a58c8ce3f6960534931409905103aa7465aa9d6 100644 (file)
@@ -269,9 +269,8 @@ void vesa_store_edid(void)
           we genuinely have to assume all registers are destroyed here. */
 
        asm("pushw %%es; movw %2,%%es; "INT10"; popw %%es"
-           : "+a" (ax), "+b" (bx)
-           :  "c" (cx), "D" (di)
-           : "esi");
+           : "+a" (ax), "+b" (bx), "+c" (cx), "+D" (di)
+           : : "esi", "edx");
 
        if (ax != 0x004f)
                return;         /* No EDID */
@@ -285,9 +284,9 @@ void vesa_store_edid(void)
        dx = 0;                 /* EDID block number */
        di =(size_t) &boot_params.edid_info; /* (ES:)Pointer to block */
        asm(INT10
-           : "+a" (ax), "+b" (bx), "+d" (dx), "=m" (boot_params.edid_info)
-           : "c" (cx), "D" (di)
-           : "esi");
+           : "+a" (ax), "+b" (bx), "+d" (dx), "=m" (boot_params.edid_info),
+             "+c" (cx), "+D" (di)
+           : "esi");
 #endif /* CONFIG_FIRMWARE_EDID */
 }
 
index 256b00b61892b2e3049ef8ff65a672df701efc77..5a0d76dc56a46431690702be8f745d6813db4cfc 100644 (file)
@@ -418,9 +418,9 @@ ENTRY(ia32_syscall)
        orl   $TS_COMPAT,TI_status(%r10)
        testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
        jnz ia32_tracesys
-ia32_do_syscall:       
        cmpl $(IA32_NR_syscalls-1),%eax
-       ja  int_ret_from_sys_call       /* ia32_tracesys has set RAX(%rsp) */
+       ja ia32_badsys
+ia32_do_call:
        IA32_ARG_FIXUP
        call *ia32_sys_call_table(,%rax,8) # xxx: rip relative
 ia32_sysret:
@@ -435,7 +435,9 @@ ia32_tracesys:
        call syscall_trace_enter
        LOAD_ARGS32 ARGOFFSET  /* reload args from stack in case ptrace changed it */
        RESTORE_REST
-       jmp ia32_do_syscall
+       cmpl $(IA32_NR_syscalls-1),%eax
+       ja  int_ret_from_sys_call       /* ia32_tracesys has set RAX(%rsp) */
+       jmp ia32_do_call
 END(ia32_syscall)
 
 ia32_badsys:
index 4035357f5b9d6b830a16b09f39d30e90810aae9e..132a134d12f24432a310f66485f6586387f618dd 100644 (file)
@@ -2,8 +2,8 @@
 #define _ASM_X86_DMA_MAPPING_H
 
 /*
- * IOMMU interface. See Documentation/DMA-mapping.txt and DMA-API.txt for
- * documentation.
+ * IOMMU interface. See Documentation/PCI/PCI-DMA-mapping.txt and
+ * Documentation/DMA-API.txt for documentation.
  */
 
 #include <linux/scatterlist.h>
index 3d8ceddbd40729093cf2f303248a9a96202e609d..00d41ce4c84453b4cbdf3659ab91a2d49176eba1 100644 (file)
@@ -49,6 +49,7 @@
 #define E820_RESERVED_KERN        128
 
 #ifndef __ASSEMBLY__
+#include <linux/types.h>
 struct e820entry {
        __u64 addr;     /* start of memory segment */
        __u64 size;     /* size of memory segment */
index b95162af0bf63eba3ec0c0df979bdb861dc0b942..d2e3bf3608af549cb544fddc17c590c139c80733 100644 (file)
@@ -6,7 +6,7 @@
  *
  */
 
-#include <asm/types.h>
+#include <linux/types.h>
 #include <linux/ioctl.h>
 
 /* Architectural interrupt line count. */
index 1d6e17c2f23a3be2ffffebf7f1df19c1786e9dd6..32c6e17b960b7aed994078dc1d5c1fb4e547b2a4 100644 (file)
@@ -3,8 +3,8 @@
 
 #ifdef __x86_64__
 
+#include <linux/types.h>
 #include <asm/ioctls.h>
-#include <asm/types.h>
 
 /*
  * Machine Check support for x86
@@ -115,8 +115,6 @@ extern int mce_notify_user(void);
 
 #endif /* !CONFIG_X86_32 */
 
-
-
 #ifdef CONFIG_X86_MCE
 extern void mcheck_init(struct cpuinfo_x86 *c);
 #else
@@ -126,5 +124,4 @@ extern void stop_mce(void);
 extern void restart_mce(void);
 
 #endif /* __KERNEL__ */
-
 #endif /* _ASM_X86_MCE_H */
index 14080d22edb30221300547c855923089c80b8678..a51ada8467de36ddcf729b7f099455225842d28a 100644 (file)
@@ -23,6 +23,7 @@
 #ifndef _ASM_X86_MTRR_H
 #define _ASM_X86_MTRR_H
 
+#include <linux/types.h>
 #include <linux/ioctl.h>
 #include <linux/errno.h>
 
index 25f1bb8fc626ab00b14ba65fa56e4477e74afd30..8e0f8d199e0587740a51c910184798a8f96968f0 100644 (file)
@@ -83,7 +83,7 @@
 #ifdef CONFIG_X86_PTRACE_BTS
 
 #ifndef __ASSEMBLY__
-#include <asm/types.h>
+#include <linux/types.h>
 
 /* configuration/status structure used in PTRACE_BTS_CONFIG and
    PTRACE_BTS_STATUS commands.
index 0afcb5e58acc51e8cc06959abcf66d0d5a25ea95..ec666491aaa4667753bfbd96e4cf6cbafe2d37ce 100644 (file)
@@ -2,7 +2,7 @@
 #define _ASM_X86_SIGCONTEXT_H
 
 #include <linux/compiler.h>
-#include <asm/types.h>
+#include <linux/types.h>
 
 #define FP_XSTATE_MAGIC1       0x46505853U
 #define FP_XSTATE_MAGIC2       0x46505845U
index 6126188cf3a9faa2aa3fa28bb3358fdd209cc908..ad1478c4ae1297b58ff8f1be6bece331769bb3b3 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _ASM_X86_SIGCONTEXT32_H
 #define _ASM_X86_SIGCONTEXT32_H
 
+#include <linux/types.h>
+
 /* signal context for 32bit programs. */
 
 #define X86_FXSR_MAGIC         0x0000
index 306d4178ffc9b7046a7c4f60b5457936d29e9a6e..557cd9f006612aebbffb5bfb2976330a0fd23403 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _ASM_X86_SWAB_H
 #define _ASM_X86_SWAB_H
 
-#include <asm/types.h>
+#include <linux/types.h>
 #include <linux/compiler.h>
 
 static inline __attribute_const__ __u32 __arch_swab32(__u32 val)
index 707c1f6f95faedfb7db7aed696c45c79461b0ea2..a60c1f3bcb87826ebdfffc15f2ca78488308ba2f 100644 (file)
@@ -156,11 +156,11 @@ static int __init acpi_sleep_setup(char *str)
 #ifdef CONFIG_HIBERNATION
                if (strncmp(str, "s4_nohwsig", 10) == 0)
                        acpi_no_s4_hw_signature();
+               if (strncmp(str, "s4_nonvs", 8) == 0)
+                       acpi_s4_no_nvs();
 #endif
                if (strncmp(str, "old_ordering", 12) == 0)
                        acpi_old_suspend_ordering();
-               if (strncmp(str, "s4_nonvs", 8) == 0)
-                       acpi_s4_no_nvs();
                str = strchr(str, ',');
                if (str != NULL)
                        str += strspn(str, ", \t");
index 4b6df2469fe3ddda97dd7b901171b8bba5c483f0..115449f869ee368f567cfd38bc8605a47944078c 100644 (file)
@@ -1436,7 +1436,7 @@ static int __init detect_init_APIC(void)
        switch (boot_cpu_data.x86_vendor) {
        case X86_VENDOR_AMD:
                if ((boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model > 1) ||
-                   (boot_cpu_data.x86 == 15))
+                   (boot_cpu_data.x86 >= 15))
                        break;
                goto no_apic;
        case X86_VENDOR_INTEL:
index efae3b22a0ff7deda3b211f482553ec5feda43a7..65792c2cc4625f7c44337ddb043bbcd92090aee5 100644 (file)
@@ -245,17 +245,6 @@ config X86_E_POWERSAVER
 
 comment "shared options"
 
-config X86_ACPI_CPUFREQ_PROC_INTF
-       bool "/proc/acpi/processor/../performance interface (deprecated)"
-       depends on PROC_FS
-       depends on X86_ACPI_CPUFREQ || X86_POWERNOW_K7_ACPI || X86_POWERNOW_K8_ACPI
-       help
-         This enables the deprecated /proc/acpi/processor/../performance
-         interface. While it is helpful for debugging, the generic,
-         cross-architecture cpufreq interfaces should be used.
-
-         If in doubt, say N.
-
 config X86_SPEEDSTEP_LIB
        tristate
        default (X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD)
index 549f2ada55f584bd045e13fb1e0c65a029f317e1..430e5c38a5449a93c65e0877d780bbf2cac97884 100644 (file)
@@ -30,7 +30,7 @@
 static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
 {
        /* Unmask CPUID levels if masked: */
-       if (c->x86 == 6 && c->x86_model >= 15) {
+       if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) {
                u64 misc_enable;
 
                rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
index 48533d77be7850c786a0482968ab5ef0d4f4ac51..da299eb85fc09b8086e0dc9e883fcdd1a59db12a 100644 (file)
@@ -36,8 +36,11 @@ static struct _cache_table cache_table[] __cpuinitdata =
 {
        { 0x06, LVL_1_INST, 8 },        /* 4-way set assoc, 32 byte line size */
        { 0x08, LVL_1_INST, 16 },       /* 4-way set assoc, 32 byte line size */
+       { 0x09, LVL_1_INST, 32 },       /* 4-way set assoc, 64 byte line size */
        { 0x0a, LVL_1_DATA, 8 },        /* 2 way set assoc, 32 byte line size */
        { 0x0c, LVL_1_DATA, 16 },       /* 4-way set assoc, 32 byte line size */
+       { 0x0d, LVL_1_DATA, 16 },       /* 4-way set assoc, 64 byte line size */
+       { 0x21, LVL_2,      256 },      /* 8-way set assoc, 64 byte line size */
        { 0x22, LVL_3,      512 },      /* 4-way set assoc, sectored cache, 64 byte line size */
        { 0x23, LVL_3,      1024 },     /* 8-way set assoc, sectored cache, 64 byte line size */
        { 0x25, LVL_3,      2048 },     /* 8-way set assoc, sectored cache, 64 byte line size */
@@ -85,6 +88,18 @@ static struct _cache_table cache_table[] __cpuinitdata =
        { 0x85, LVL_2,    2048 },       /* 8-way set assoc, 32 byte line size */
        { 0x86, LVL_2,     512 },       /* 4-way set assoc, 64 byte line size */
        { 0x87, LVL_2,    1024 },       /* 8-way set assoc, 64 byte line size */
+       { 0xd0, LVL_3,     512 },       /* 4-way set assoc, 64 byte line size */
+       { 0xd1, LVL_3,    1024 },       /* 4-way set assoc, 64 byte line size */
+       { 0xd2, LVL_3,    2048 },       /* 4-way set assoc, 64 byte line size */
+       { 0xd6, LVL_3,    1024 },       /* 8-way set assoc, 64 byte line size */
+       { 0xd7, LVL_3,    2038 },       /* 8-way set assoc, 64 byte line size */
+       { 0xd8, LVL_3,    4096 },       /* 12-way set assoc, 64 byte line size */
+       { 0xdc, LVL_3,    2048 },       /* 12-way set assoc, 64 byte line size */
+       { 0xdd, LVL_3,    4096 },       /* 12-way set assoc, 64 byte line size */
+       { 0xde, LVL_3,    8192 },       /* 12-way set assoc, 64 byte line size */
+       { 0xe2, LVL_3,    2048 },       /* 16-way set assoc, 64 byte line size */
+       { 0xe3, LVL_3,    4096 },       /* 16-way set assoc, 64 byte line size */
+       { 0xe4, LVL_3,    8192 },       /* 16-way set assoc, 64 byte line size */
        { 0x00, 0, 0}
 };
 
index d259e5d2e0546adbec36d55f63b7f2a81f88e002..236a401b82597b0d48217db77ea5c10e692e9b2e 100644 (file)
@@ -1594,8 +1594,7 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
 
        /* kvm/qemu doesn't have mtrr set right, don't trim them all */
        if (!highest_pfn) {
-               WARN(!kvm_para_available(), KERN_WARNING
-                               "WARNING: strange, CPU MTRRs all blank?\n");
+               printk(KERN_INFO "CPU MTRRs all blank - virtualized system.\n");
                return 0;
        }
 
index da91701a2348cd512531716598453ece7ef8cca6..169a120587be7e4e6add63c38ed2e0eb139025dd 100644 (file)
@@ -15,8 +15,8 @@
  * - buffer allocation (memory accounting)
  *
  *
- * Copyright (C) 2007-2008 Intel Corporation.
- * Markus Metzger <markus.t.metzger@intel.com>, 2007-2008
+ * Copyright (C) 2007-2009 Intel Corporation.
+ * Markus Metzger <markus.t.metzger@intel.com>, 2007-2009
  */
 
 
@@ -890,7 +890,7 @@ int ds_set_pebs_reset(struct pebs_tracer *tracer, u64 value)
 }
 
 static const struct ds_configuration ds_cfg_netburst = {
-       .name = "netburst",
+       .name = "Netburst",
        .ctl[dsf_bts]           = (1 << 2) | (1 << 3),
        .ctl[dsf_bts_kernel]    = (1 << 5),
        .ctl[dsf_bts_user]      = (1 << 6),
@@ -904,7 +904,7 @@ static const struct ds_configuration ds_cfg_netburst = {
 #endif
 };
 static const struct ds_configuration ds_cfg_pentium_m = {
-       .name = "pentium m",
+       .name = "Pentium M",
        .ctl[dsf_bts]           = (1 << 6) | (1 << 7),
 
        .sizeof_field           = sizeof(long),
@@ -915,8 +915,8 @@ static const struct ds_configuration ds_cfg_pentium_m = {
        .sizeof_rec[ds_pebs]    = sizeof(long) * 18,
 #endif
 };
-static const struct ds_configuration ds_cfg_core2 = {
-       .name = "core 2",
+static const struct ds_configuration ds_cfg_core2_atom = {
+       .name = "Core 2/Atom",
        .ctl[dsf_bts]           = (1 << 6) | (1 << 7),
        .ctl[dsf_bts_kernel]    = (1 << 9),
        .ctl[dsf_bts_user]      = (1 << 10),
@@ -949,19 +949,22 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
        switch (c->x86) {
        case 0x6:
                switch (c->x86_model) {
-               case 0 ... 0xC:
-                       /* sorry, don't know about them */
-                       break;
-               case 0xD:
-               case 0xE: /* Pentium M */
+               case 0x9:
+               case 0xd: /* Pentium M */
                        ds_configure(&ds_cfg_pentium_m);
                        break;
-               default: /* Core2, Atom, ... */
-                       ds_configure(&ds_cfg_core2);
+               case 0xf:
+               case 0x17: /* Core2 */
+               case 0x1c: /* Atom */
+                       ds_configure(&ds_cfg_core2_atom);
+                       break;
+               case 0x1a: /* i7 */
+               default:
+                       /* sorry, don't know about them */
                        break;
                }
                break;
-       case 0xF:
+       case 0xf:
                switch (c->x86_model) {
                case 0x0:
                case 0x1:
index e28c7a987793cbd25c628c7568fc15ca2c8c39f5..a1346217e43c4d6cc636fa80ca70853970e64417 100644 (file)
@@ -346,6 +346,7 @@ ENTRY(save_args)
        popq_cfi %rax                   /* move return address... */
        mov %gs:pda_irqstackptr,%rsp
        EMPTY_FRAME 0
+       pushq_cfi %rbp                  /* backlink for unwinder */
        pushq_cfi %rax                  /* ... to the new stack */
        /*
         * We entered an interrupt context - irqs are off:
index 1c4a1302536c692dc935acecad4720dbe2395fa9..9b0c480c383bf7c82a2ad6084c4172e58bc6b83d 100644 (file)
@@ -2528,14 +2528,15 @@ static void irq_complete_move(struct irq_desc **descp)
 
        vector = ~get_irq_regs()->orig_ax;
        me = smp_processor_id();
+
+       if (vector == cfg->vector && cpumask_test_cpu(me, cfg->domain)) {
 #ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
                *descp = desc = move_irq_desc(desc, me);
                /* get the new one */
                cfg = desc->chip_data;
 #endif
-
-       if (vector == cfg->vector && cpumask_test_cpu(me, cfg->domain))
                send_cleanup_vector(cfg);
+       }
 }
 #else
 static inline void irq_complete_move(struct irq_desc **descp) {}
index 1507ad4e674d253f93b60e8df9188bd17354a987..10a09c2f1828c102893d71a5add47ae320e2df55 100644 (file)
@@ -78,15 +78,6 @@ void __init init_ISA_irqs(void)
        }
 }
 
-/*
- * IRQ2 is cascade interrupt to second interrupt controller
- */
-static struct irqaction irq2 = {
-       .handler = no_action,
-       .mask = CPU_MASK_NONE,
-       .name = "cascade",
-};
-
 DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
        [0 ... IRQ0_VECTOR - 1] = -1,
        [IRQ0_VECTOR] = 0,
@@ -178,9 +169,6 @@ void __init native_init_IRQ(void)
        alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
 #endif
 
-       if (!acpi_ioapic)
-               setup_irq(2, &irq2);
-
        /* setup after call gates are initialised (usually add in
         * the architecture specific gates)
         */
index 00c2bcd41463e325976a74cbee0fa06f4b6fe85c..d5768b1af08041160e52ea6b70a2f6cd4bb6e476 100644 (file)
@@ -5,7 +5,7 @@
  * This allows to use PCI devices that only support 32bit addresses on systems
  * with more than 4GB.
  *
- * See Documentation/DMA-mapping.txt for the interface specification.
+ * See Documentation/PCI/PCI-DMA-mapping.txt for the interface specification.
  *
  * Copyright 2002 Andi Kleen, SuSE Labs.
  * Subject to the GNU General Public License v2 only.
index a7ed208f81e3e4bbb5ff4e3447d844dc77cd3371..92f1c6f3e19d48b594fa5fcd4694784ae4b324af 100644 (file)
@@ -931,7 +931,7 @@ static void lguest_restart(char *reason)
  * that we can fit comfortably.
  *
  * First we need assembly templates of each of the patchable Guest operations,
- * and these are in lguest_asm.S. */
+ * and these are in i386_head.S. */
 
 /*G:060 We construct a table from the assembler templates: */
 static const struct lguest_insns
@@ -1093,7 +1093,7 @@ __init void lguest_init(void)
        acpi_ht = 0;
 #endif
 
-       /* We set the perferred console to "hvc".  This is the "hypervisor
+       /* We set the preferred console to "hvc".  This is the "hypervisor
         * virtual console" driver written by the PowerPC people, which we also
         * adapted for lguest's use. */
        add_preferred_console("hvc", 0, NULL);
index df167f2656228c83eb58ce2ebd4600074d766e77..a265a7c631901d111a9b907fa105754871a45e5b 100644 (file)
@@ -38,6 +38,15 @@ void __init pre_intr_init_hook(void)
        init_ISA_irqs();
 }
 
+/*
+ * IRQ2 is cascade interrupt to second interrupt controller
+ */
+static struct irqaction irq2 = {
+       .handler = no_action,
+       .mask = CPU_MASK_NONE,
+       .name = "cascade",
+};
+
 /**
  * intr_init_hook - post gate setup interrupt initialisation
  *
@@ -53,6 +62,9 @@ void __init intr_init_hook(void)
                if (x86_quirks->arch_intr_init())
                        return;
        }
+       if (!acpi_ioapic)
+               setup_irq(2, &irq2);
+
 }
 
 /**
index a580b9562e76cc078ab3fd0b2b90c722d10fdf01..d914a7996a6684758f9ba1be29b6e012c88c21eb 100644 (file)
@@ -33,13 +33,23 @@ void __init intr_init_hook(void)
        setup_irq(2, &irq2);
 }
 
-void __init pre_setup_arch_hook(void)
+static void voyager_disable_tsc(void)
 {
        /* Voyagers run their CPUs from independent clocks, so disable
         * the TSC code because we can't sync them */
        setup_clear_cpu_cap(X86_FEATURE_TSC);
 }
 
+void __init pre_setup_arch_hook(void)
+{
+       voyager_disable_tsc();
+}
+
+void __init pre_time_init_hook(void)
+{
+       voyager_disable_tsc();
+}
+
 void __init trap_init_hook(void)
 {
 }
index 9840b7ec749a00dfc7a906e8a9045b76d545650d..7ffcdeec4631fa7b1adf54ec2bbbd71ee98402ba 100644 (file)
@@ -81,7 +81,7 @@ static void enable_local_vic_irq(unsigned int irq);
 static void disable_local_vic_irq(unsigned int irq);
 static void before_handle_vic_irq(unsigned int irq);
 static void after_handle_vic_irq(unsigned int irq);
-static void set_vic_irq_affinity(unsigned int irq, cpumask_t mask);
+static void set_vic_irq_affinity(unsigned int irq, const struct cpumask *mask);
 static void ack_vic_irq(unsigned int irq);
 static void vic_enable_cpi(void);
 static void do_boot_cpu(__u8 cpuid);
@@ -211,8 +211,6 @@ static __u32 cpu_booted_map;
 static cpumask_t smp_commenced_mask = CPU_MASK_NONE;
 
 /* This is for the new dynamic CPU boot code */
-cpumask_t cpu_callin_map = CPU_MASK_NONE;
-cpumask_t cpu_callout_map = CPU_MASK_NONE;
 
 /* The per processor IRQ masks (these are usually kept in sync) */
 static __u16 vic_irq_mask[NR_CPUS] __cacheline_aligned;
@@ -378,7 +376,7 @@ void __init find_smp_config(void)
        cpus_addr(phys_cpu_present_map)[0] |=
            voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK +
                                       3) << 24;
-       cpu_possible_map = phys_cpu_present_map;
+       init_cpu_possible(&phys_cpu_present_map);
        printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n",
               cpus_addr(phys_cpu_present_map)[0]);
        /* Here we set up the VIC to enable SMP */
@@ -1599,16 +1597,16 @@ static void after_handle_vic_irq(unsigned int irq)
  * change the mask and then do an interrupt enable CPI to re-enable on
  * the selected processors */
 
-void set_vic_irq_affinity(unsigned int irq, cpumask_t mask)
+void set_vic_irq_affinity(unsigned int irq, const struct cpumask *mask)
 {
        /* Only extended processors handle interrupts */
        unsigned long real_mask;
        unsigned long irq_mask = 1 << irq;
        int cpu;
 
-       real_mask = cpus_addr(mask)[0] & voyager_extended_vic_processors;
+       real_mask = cpus_addr(*mask)[0] & voyager_extended_vic_processors;
 
-       if (cpus_addr(mask)[0] == 0)
+       if (cpus_addr(*mask)[0] == 0)
                /* can't have no CPUs to accept the interrupt -- extremely
                 * bad things will happen */
                return;
@@ -1750,10 +1748,11 @@ static void __cpuinit voyager_smp_prepare_boot_cpu(void)
        init_gdt(smp_processor_id());
        switch_to_new_gdt();
 
-       cpu_set(smp_processor_id(), cpu_online_map);
-       cpu_set(smp_processor_id(), cpu_callout_map);
-       cpu_set(smp_processor_id(), cpu_possible_map);
-       cpu_set(smp_processor_id(), cpu_present_map);
+       cpu_online_map = cpumask_of_cpu(smp_processor_id());
+       cpu_callout_map = cpumask_of_cpu(smp_processor_id());
+       cpu_callin_map = CPU_MASK_NONE;
+       cpu_present_map = cpumask_of_cpu(smp_processor_id());
+
 }
 
 static int __cpuinit voyager_cpu_up(unsigned int cpu)
@@ -1783,9 +1782,9 @@ void __init smp_setup_processor_id(void)
        x86_write_percpu(cpu_number, hard_smp_processor_id());
 }
 
-static void voyager_send_call_func(cpumask_t callmask)
+static void voyager_send_call_func(const struct cpumask *callmask)
 {
-       __u32 mask = cpus_addr(callmask)[0] & ~(1 << smp_processor_id());
+       __u32 mask = cpus_addr(*callmask)[0] & ~(1 << smp_processor_id());
        send_CPI(mask, VIC_CALL_FUNCTION_CPI);
 }
 
index 90dfae511a41e1dcf7fcf188b94d13c123780606..c76ef1d701c9f48625aed06d4e7b4ec3d98e8862 100644 (file)
@@ -603,8 +603,6 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
 
        si_code = SEGV_MAPERR;
 
-       if (notify_page_fault(regs))
-               return;
        if (unlikely(kmmio_fault(regs, address)))
                return;
 
@@ -634,6 +632,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
                if (spurious_fault(address, error_code))
                        return;
 
+               /* kprobes don't want to hook the spurious faults. */
+               if (notify_page_fault(regs))
+                       return;
                /*
                 * Don't take the mm semaphore here. If we fixup a prefetch
                 * fault we could otherwise deadlock.
@@ -641,6 +642,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
                goto bad_area_nosemaphore;
        }
 
+       /* kprobes don't want to hook the spurious faults. */
+       if (notify_page_fault(regs))
+               return;
 
        /*
         * It's safe to allow irq's after cr2 has been saved and the
index 4064345cf14450557580ca3dbf14b07004f1efc4..fecbce6e7d7c20d1f0af750e2305ef4e9a37a92c 100644 (file)
@@ -572,6 +572,7 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
        case PCI_DEVICE_ID_INTEL_ICH7_1:
        case PCI_DEVICE_ID_INTEL_ICH7_30:
        case PCI_DEVICE_ID_INTEL_ICH7_31:
+       case PCI_DEVICE_ID_INTEL_TGP_LPC:
        case PCI_DEVICE_ID_INTEL_ESB2_0:
        case PCI_DEVICE_ID_INTEL_ICH8_0:
        case PCI_DEVICE_ID_INTEL_ICH8_1:
index 858938241616ab88ff53700a4463c698c11dad3d..fa3e10725d985021d55f9f44beaff3cd05c0ad7a 100644 (file)
@@ -19,8 +19,10 @@ DECLARE_PER_CPU(unsigned long, xen_mc_irq_flags);
    paired with xen_mc_issue() */
 static inline void xen_mc_batch(void)
 {
+       unsigned long flags;
        /* need to disable interrupts until this entry is complete */
-       local_irq_save(__get_cpu_var(xen_mc_irq_flags));
+       local_irq_save(flags);
+       __get_cpu_var(xen_mc_irq_flags) = flags;
 }
 
 static inline struct multicall_space xen_mc_entry(size_t args)
index 8eba4e43bb0c505c9c0e846ddd33caf0f15bfdd7..f7dae57e6cabdcfaaed15762c4d2b7b9889e6c77 100644 (file)
@@ -302,7 +302,7 @@ static void bio_end_empty_barrier(struct bio *bio, int err)
  * Description:
  *    Issue a flush for the block device in question. Caller can supply
  *    room for storing the error offset in case of a flush error, if they
- *    wish to.  Caller must run wait_for_completion() on its own.
+ *    wish to.
  */
 int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector)
 {
index a824e49c0d0ac0567ad8294f6289544fa40553b6..29bcfac6c68853e4e562642dddadc4c8deb17231 100644 (file)
@@ -64,11 +64,12 @@ static struct workqueue_struct *kblockd_workqueue;
 
 static void drive_stat_acct(struct request *rq, int new_io)
 {
+       struct gendisk *disk = rq->rq_disk;
        struct hd_struct *part;
        int rw = rq_data_dir(rq);
        int cpu;
 
-       if (!blk_fs_request(rq) || !rq->rq_disk)
+       if (!blk_fs_request(rq) || !disk || !blk_do_io_stat(disk->queue))
                return;
 
        cpu = part_stat_lock();
@@ -599,8 +600,7 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
        q->request_fn           = rfn;
        q->prep_rq_fn           = NULL;
        q->unplug_fn            = generic_unplug_device;
-       q->queue_flags          = (1 << QUEUE_FLAG_CLUSTER |
-                                  1 << QUEUE_FLAG_STACKABLE);
+       q->queue_flags          = QUEUE_FLAG_DEFAULT;
        q->queue_lock           = lock;
 
        blk_queue_segment_boundary(q, BLK_SEG_BOUNDARY_MASK);
@@ -1125,6 +1125,8 @@ void init_request_from_bio(struct request *req, struct bio *bio)
 
        if (bio_sync(bio))
                req->cmd_flags |= REQ_RW_SYNC;
+       if (bio_unplug(bio))
+               req->cmd_flags |= REQ_UNPLUG;
        if (bio_rw_meta(bio))
                req->cmd_flags |= REQ_RW_META;
 
@@ -1141,6 +1143,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
        int el_ret, nr_sectors;
        const unsigned short prio = bio_prio(bio);
        const int sync = bio_sync(bio);
+       const int unplug = bio_unplug(bio);
        int rw_flags;
 
        nr_sectors = bio_sectors(bio);
@@ -1244,7 +1247,7 @@ get_rq:
                blk_plug_device(q);
        add_request(q, req);
 out:
-       if (sync || blk_queue_nonrot(q))
+       if (unplug || blk_queue_nonrot(q))
                __generic_unplug_device(q);
        spin_unlock_irq(q->queue_lock);
        return 0;
@@ -1448,6 +1451,11 @@ static inline void __generic_make_request(struct bio *bio)
                        err = -EOPNOTSUPP;
                        goto end_io;
                }
+               if (bio_barrier(bio) && bio_has_data(bio) &&
+                   (q->next_ordered == QUEUE_ORDERED_NONE)) {
+                       err = -EOPNOTSUPP;
+                       goto end_io;
+               }
 
                ret = q->make_request_fn(q, bio);
        } while (ret);
@@ -1655,6 +1663,55 @@ void blkdev_dequeue_request(struct request *req)
 }
 EXPORT_SYMBOL(blkdev_dequeue_request);
 
+static void blk_account_io_completion(struct request *req, unsigned int bytes)
+{
+       struct gendisk *disk = req->rq_disk;
+
+       if (!disk || !blk_do_io_stat(disk->queue))
+               return;
+
+       if (blk_fs_request(req)) {
+               const int rw = rq_data_dir(req);
+               struct hd_struct *part;
+               int cpu;
+
+               cpu = part_stat_lock();
+               part = disk_map_sector_rcu(req->rq_disk, req->sector);
+               part_stat_add(cpu, part, sectors[rw], bytes >> 9);
+               part_stat_unlock();
+       }
+}
+
+static void blk_account_io_done(struct request *req)
+{
+       struct gendisk *disk = req->rq_disk;
+
+       if (!disk || !blk_do_io_stat(disk->queue))
+               return;
+
+       /*
+        * Account IO completion.  bar_rq isn't accounted as a normal
+        * IO on queueing nor completion.  Accounting the containing
+        * request is enough.
+        */
+       if (blk_fs_request(req) && req != &req->q->bar_rq) {
+               unsigned long duration = jiffies - req->start_time;
+               const int rw = rq_data_dir(req);
+               struct hd_struct *part;
+               int cpu;
+
+               cpu = part_stat_lock();
+               part = disk_map_sector_rcu(disk, req->sector);
+
+               part_stat_inc(cpu, part, ios[rw]);
+               part_stat_add(cpu, part, ticks[rw], duration);
+               part_round_stats(cpu, part);
+               part_dec_in_flight(part);
+
+               part_stat_unlock();
+       }
+}
+
 /**
  * __end_that_request_first - end I/O on a request
  * @req:      the request being processed
@@ -1690,16 +1747,7 @@ static int __end_that_request_first(struct request *req, int error,
                                (unsigned long long)req->sector);
        }
 
-       if (blk_fs_request(req) && req->rq_disk) {
-               const int rw = rq_data_dir(req);
-               struct hd_struct *part;
-               int cpu;
-
-               cpu = part_stat_lock();
-               part = disk_map_sector_rcu(req->rq_disk, req->sector);
-               part_stat_add(cpu, part, sectors[rw], nr_bytes >> 9);
-               part_stat_unlock();
-       }
+       blk_account_io_completion(req, nr_bytes);
 
        total_bytes = bio_nbytes = 0;
        while ((bio = req->bio) != NULL) {
@@ -1779,8 +1827,6 @@ static int __end_that_request_first(struct request *req, int error,
  */
 static void end_that_request_last(struct request *req, int error)
 {
-       struct gendisk *disk = req->rq_disk;
-
        if (blk_rq_tagged(req))
                blk_queue_end_tag(req->q, req);
 
@@ -1792,27 +1838,7 @@ static void end_that_request_last(struct request *req, int error)
 
        blk_delete_timer(req);
 
-       /*
-        * Account IO completion.  bar_rq isn't accounted as a normal
-        * IO on queueing nor completion.  Accounting the containing
-        * request is enough.
-        */
-       if (disk && blk_fs_request(req) && req != &req->q->bar_rq) {
-               unsigned long duration = jiffies - req->start_time;
-               const int rw = rq_data_dir(req);
-               struct hd_struct *part;
-               int cpu;
-
-               cpu = part_stat_lock();
-               part = disk_map_sector_rcu(disk, req->sector);
-
-               part_stat_inc(cpu, part, ios[rw]);
-               part_stat_add(cpu, part, ticks[rw], duration);
-               part_round_stats(cpu, part);
-               part_dec_in_flight(part);
-
-               part_stat_unlock();
-       }
+       blk_account_io_done(req);
 
        if (req->end_io)
                req->end_io(req, error);
index 61a8e2f8fdd0bbb384fe7eab86860df6f03f4949..91fa8e06b6a57712d716f1c3e9becd2c5118fc1a 100644 (file)
@@ -309,24 +309,24 @@ static struct kobj_type integrity_ktype = {
 /**
  * blk_integrity_register - Register a gendisk as being integrity-capable
  * @disk:      struct gendisk pointer to make integrity-aware
- * @template:  integrity profile
+ * @template:  optional integrity profile to register
  *
  * Description: When a device needs to advertise itself as being able
  * to send/receive integrity metadata it must use this function to
  * register the capability with the block layer.  The template is a
  * blk_integrity struct with values appropriate for the underlying
- * hardware.  See Documentation/block/data-integrity.txt.
+ * hardware.  If template is NULL the new profile is allocated but
+ * not filled out. See Documentation/block/data-integrity.txt.
  */
 int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
 {
        struct blk_integrity *bi;
 
        BUG_ON(disk == NULL);
-       BUG_ON(template == NULL);
 
        if (disk->integrity == NULL) {
                bi = kmem_cache_alloc(integrity_cachep,
-                                               GFP_KERNEL | __GFP_ZERO);
+                                     GFP_KERNEL | __GFP_ZERO);
                if (!bi)
                        return -1;
 
@@ -346,13 +346,16 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
                bi = disk->integrity;
 
        /* Use the provided profile as template */
-       bi->name = template->name;
-       bi->generate_fn = template->generate_fn;
-       bi->verify_fn = template->verify_fn;
-       bi->tuple_size = template->tuple_size;
-       bi->set_tag_fn = template->set_tag_fn;
-       bi->get_tag_fn = template->get_tag_fn;
-       bi->tag_size = template->tag_size;
+       if (template != NULL) {
+               bi->name = template->name;
+               bi->generate_fn = template->generate_fn;
+               bi->verify_fn = template->verify_fn;
+               bi->tuple_size = template->tuple_size;
+               bi->set_tag_fn = template->set_tag_fn;
+               bi->get_tag_fn = template->get_tag_fn;
+               bi->tag_size = template->tag_size;
+       } else
+               bi->name = "unsupported";
 
        return 0;
 }
index a29cb788e408e720b0b8023fca95a9f3d26a3e8c..e29ddfc73cf475d99f95d2daa7d0be58a474d01b 100644 (file)
@@ -130,6 +130,27 @@ static ssize_t queue_max_hw_sectors_show(struct request_queue *q, char *page)
        return queue_var_show(max_hw_sectors_kb, (page));
 }
 
+static ssize_t queue_nonrot_show(struct request_queue *q, char *page)
+{
+       return queue_var_show(!blk_queue_nonrot(q), page);
+}
+
+static ssize_t queue_nonrot_store(struct request_queue *q, const char *page,
+                                 size_t count)
+{
+       unsigned long nm;
+       ssize_t ret = queue_var_store(&nm, page, count);
+
+       spin_lock_irq(q->queue_lock);
+       if (nm)
+               queue_flag_clear(QUEUE_FLAG_NONROT, q);
+       else
+               queue_flag_set(QUEUE_FLAG_NONROT, q);
+       spin_unlock_irq(q->queue_lock);
+
+       return ret;
+}
+
 static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
 {
        return queue_var_show(blk_queue_nomerges(q), page);
@@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(struct request_queue *q, const char *page,
                queue_flag_set(QUEUE_FLAG_NOMERGES, q);
        else
                queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
-
        spin_unlock_irq(q->queue_lock);
+
        return ret;
 }
 
@@ -176,6 +197,27 @@ queue_rq_affinity_store(struct request_queue *q, const char *page, size_t count)
        return ret;
 }
 
+static ssize_t queue_iostats_show(struct request_queue *q, char *page)
+{
+       return queue_var_show(blk_queue_io_stat(q), page);
+}
+
+static ssize_t queue_iostats_store(struct request_queue *q, const char *page,
+                                  size_t count)
+{
+       unsigned long stats;
+       ssize_t ret = queue_var_store(&stats, page, count);
+
+       spin_lock_irq(q->queue_lock);
+       if (stats)
+               queue_flag_set(QUEUE_FLAG_IO_STAT, q);
+       else
+               queue_flag_clear(QUEUE_FLAG_IO_STAT, q);
+       spin_unlock_irq(q->queue_lock);
+
+       return ret;
+}
+
 static struct queue_sysfs_entry queue_requests_entry = {
        .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR },
        .show = queue_requests_show,
@@ -210,6 +252,12 @@ static struct queue_sysfs_entry queue_hw_sector_size_entry = {
        .show = queue_hw_sector_size_show,
 };
 
+static struct queue_sysfs_entry queue_nonrot_entry = {
+       .attr = {.name = "rotational", .mode = S_IRUGO | S_IWUSR },
+       .show = queue_nonrot_show,
+       .store = queue_nonrot_store,
+};
+
 static struct queue_sysfs_entry queue_nomerges_entry = {
        .attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR },
        .show = queue_nomerges_show,
@@ -222,6 +270,12 @@ static struct queue_sysfs_entry queue_rq_affinity_entry = {
        .store = queue_rq_affinity_store,
 };
 
+static struct queue_sysfs_entry queue_iostats_entry = {
+       .attr = {.name = "iostats", .mode = S_IRUGO | S_IWUSR },
+       .show = queue_iostats_show,
+       .store = queue_iostats_store,
+};
+
 static struct attribute *default_attrs[] = {
        &queue_requests_entry.attr,
        &queue_ra_entry.attr,
@@ -229,8 +283,10 @@ static struct attribute *default_attrs[] = {
        &queue_max_sectors_entry.attr,
        &queue_iosched_entry.attr,
        &queue_hw_sector_size_entry.attr,
+       &queue_nonrot_entry.attr,
        &queue_nomerges_entry.attr,
        &queue_rq_affinity_entry.attr,
+       &queue_iostats_entry.attr,
        NULL,
 };
 
index 6e1ed40534e97e78ff0263268b2826344f2207b7..0dce92c37496faf8b187741de6d169869019e9b7 100644 (file)
@@ -108,4 +108,12 @@ static inline int blk_cpu_to_group(int cpu)
 #endif
 }
 
+static inline int blk_do_io_stat(struct request_queue *q)
+{
+       if (q)
+               return blk_queue_io_stat(q);
+
+       return 0;
+}
+
 #endif
index b0a2cae886dbdc4dde9a2efa99345ea2462a54b0..39cc3bfe56e41055793a804e1461dad39045b264 100644 (file)
@@ -187,59 +187,12 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
 
 static struct dentry *blk_tree_root;
 static DEFINE_MUTEX(blk_tree_mutex);
-static unsigned int root_users;
-
-static inline void blk_remove_root(void)
-{
-       if (blk_tree_root) {
-               debugfs_remove(blk_tree_root);
-               blk_tree_root = NULL;
-       }
-}
-
-static void blk_remove_tree(struct dentry *dir)
-{
-       mutex_lock(&blk_tree_mutex);
-       debugfs_remove(dir);
-       if (--root_users == 0)
-               blk_remove_root();
-       mutex_unlock(&blk_tree_mutex);
-}
-
-static struct dentry *blk_create_tree(const char *blk_name)
-{
-       struct dentry *dir = NULL;
-       int created = 0;
-
-       mutex_lock(&blk_tree_mutex);
-
-       if (!blk_tree_root) {
-               blk_tree_root = debugfs_create_dir("block", NULL);
-               if (!blk_tree_root)
-                       goto err;
-               created = 1;
-       }
-
-       dir = debugfs_create_dir(blk_name, blk_tree_root);
-       if (dir)
-               root_users++;
-       else {
-               /* Delete root only if we created it */
-               if (created)
-                       blk_remove_root();
-       }
-
-err:
-       mutex_unlock(&blk_tree_mutex);
-       return dir;
-}
 
 static void blk_trace_cleanup(struct blk_trace *bt)
 {
-       relay_close(bt->rchan);
        debugfs_remove(bt->msg_file);
        debugfs_remove(bt->dropped_file);
-       blk_remove_tree(bt->dir);
+       relay_close(bt->rchan);
        free_percpu(bt->sequence);
        free_percpu(bt->msg_data);
        kfree(bt);
@@ -346,7 +299,18 @@ static int blk_subbuf_start_callback(struct rchan_buf *buf, void *subbuf,
 
 static int blk_remove_buf_file_callback(struct dentry *dentry)
 {
+       struct dentry *parent = dentry->d_parent;
        debugfs_remove(dentry);
+
+       /*
+       * this will fail for all but the last file, but that is ok. what we
+       * care about is the top level buts->name directory going away, when
+       * the last trace file is gone. Then we don't have to rmdir() that
+       * manually on trace stop, so it nicely solves the issue with
+       * force killing of running traces.
+       */
+
+       debugfs_remove(parent);
        return 0;
 }
 
@@ -404,7 +368,15 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
                goto err;
 
        ret = -ENOENT;
-       dir = blk_create_tree(buts->name);
+
+       if (!blk_tree_root) {
+               blk_tree_root = debugfs_create_dir("block", NULL);
+               if (!blk_tree_root)
+                       return -ENOMEM;
+       }
+
+       dir = debugfs_create_dir(buts->name, blk_tree_root);
+
        if (!dir)
                goto err;
 
@@ -458,8 +430,6 @@ probe_err:
        atomic_dec(&blk_probes_ref);
        mutex_unlock(&blk_probe_mutex);
 err:
-       if (dir)
-               blk_remove_tree(dir);
        if (bt) {
                if (bt->msg_file)
                        debugfs_remove(bt->msg_file);
index e8525fa72823a0c88adfd386e84e7b3e5db33af7..664ebfd092ec21f95cedc56b6a5259874db0399c 100644 (file)
@@ -84,6 +84,11 @@ struct cfq_data {
         */
        struct cfq_rb_root service_tree;
        unsigned int busy_queues;
+       /*
+        * Used to track any pending rt requests so we can pre-empt current
+        * non-RT cfqq in service when this value is non-zero.
+        */
+       unsigned int busy_rt_queues;
 
        int rq_in_driver;
        int sync_flight;
@@ -562,6 +567,8 @@ static void cfq_add_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq)
        BUG_ON(cfq_cfqq_on_rr(cfqq));
        cfq_mark_cfqq_on_rr(cfqq);
        cfqd->busy_queues++;
+       if (cfq_class_rt(cfqq))
+               cfqd->busy_rt_queues++;
 
        cfq_resort_rr_list(cfqd, cfqq);
 }
@@ -581,6 +588,8 @@ static void cfq_del_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq)
 
        BUG_ON(!cfqd->busy_queues);
        cfqd->busy_queues--;
+       if (cfq_class_rt(cfqq))
+               cfqd->busy_rt_queues--;
 }
 
 /*
@@ -1004,6 +1013,20 @@ static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd)
        if (cfq_slice_used(cfqq))
                goto expire;
 
+       /*
+        * If we have a RT cfqq waiting, then we pre-empt the current non-rt
+        * cfqq.
+        */
+       if (!cfq_class_rt(cfqq) && cfqd->busy_rt_queues) {
+               /*
+                * We simulate this as cfqq timed out so that it gets to bank
+                * the remaining of its time slice.
+                */
+               cfq_log_cfqq(cfqd, cfqq, "preempt");
+               cfq_slice_expired(cfqd, 1);
+               goto new_queue;
+       }
+
        /*
         * The active queue has requests and isn't expired, allow it to
         * dispatch.
@@ -1067,6 +1090,13 @@ __cfq_dispatch_requests(struct cfq_data *cfqd, struct cfq_queue *cfqq,
                if (RB_EMPTY_ROOT(&cfqq->sort_list))
                        break;
 
+               /*
+                * If there is a non-empty RT cfqq waiting for current
+                * cfqq's timeslice to complete, pre-empt this cfqq
+                */
+               if (!cfq_class_rt(cfqq) && cfqd->busy_rt_queues)
+                       break;
+
        } while (dispatched < max_dispatch);
 
        /*
@@ -1801,6 +1831,12 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
        if (rq_is_meta(rq) && !cfqq->meta_pending)
                return 1;
 
+       /*
+        * Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice.
+        */
+       if (cfq_class_rt(new_cfqq) && !cfq_class_rt(cfqq))
+               return 1;
+
        if (!cfqd->active_cic || !cfq_cfqq_wait_request(cfqq))
                return 0;
 
@@ -1870,7 +1906,8 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
                /*
                 * not the active queue - expire current slice if it is
                 * idle and has expired it's mean thinktime or this new queue
-                * has some old slice time left and is of higher priority
+                * has some old slice time left and is of higher priority or
+                * this new queue is RT and the current one is BE
                 */
                cfq_preempt_queue(cfqd, cfqq);
                cfq_mark_cfqq_must_dispatch(cfqq);
index d7f9839ba264d34fd0159ba1b70289530129ba4c..a7799a99f2d9a192b2b98ed5e0bdb5d5c9796f56 100644 (file)
@@ -9,6 +9,7 @@ menuconfig ACPI
        depends on PCI
        depends on PM
        select PNP
+       select CPU_IDLE
        default y
        ---help---
          Advanced Configuration and Power Interface (ACPI) support for 
@@ -287,7 +288,7 @@ config ACPI_CONTAINER
          support physical cpu/memory hot-plug.
 
          If one selects "m", this driver can be loaded with
-         "modprobe acpi_container".
+         "modprobe container".
 
 config ACPI_HOTPLUG_MEMORY
        tristate "Memory Hotplug"
index 9684cc827930c7e4682aab1d16ae98fcdbb12ab1..22ce489857202b73fa13d293367fa35e346f5d7a 100644 (file)
@@ -538,10 +538,9 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
                        if (ACPI_FAILURE(status)) {
                                ACPI_WARNING((AE_INFO,
                                              "Truncating %u table entries!",
-                                             (unsigned)
-                                             (acpi_gbl_root_table_list.size -
-                                              acpi_gbl_root_table_list.
-                                              count)));
+                                             (unsigned) (table_count -
+                                              (acpi_gbl_root_table_list.
+                                              count - 2))));
                                break;
                        }
                }
index da9450bc60f7062e05f0f0ba385572525e5a4f23..9c9897dbe9071ae83d56b994b1f3c03de1ab2e91 100644 (file)
@@ -116,9 +116,9 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       /* Default return value is SUPPORTED */
+       /* Default return value is 0, NOT-SUPPORTED */
 
-       return_desc->integer.value = ACPI_UINT32_MAX;
+       return_desc->integer.value = 0;
        walk_state->return_desc = return_desc;
 
        /* Compare input string to static table of supported interfaces */
@@ -127,10 +127,8 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
                if (!ACPI_STRCMP
                    (string_desc->string.pointer,
                     acpi_interfaces_supported[i])) {
-
-                       /* The interface is supported */
-
-                       return_ACPI_STATUS(AE_OK);
+                       return_desc->integer.value = ACPI_UINT32_MAX;
+                       goto done;
                }
        }
 
@@ -141,15 +139,14 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
         */
        status = acpi_os_validate_interface(string_desc->string.pointer);
        if (ACPI_SUCCESS(status)) {
-
-               /* The interface is supported */
-
-               return_ACPI_STATUS(AE_OK);
+               return_desc->integer.value = ACPI_UINT32_MAX;
        }
 
-       /* The interface is not supported */
+done:
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, "ACPI: BIOS _OSI(%s) %ssupported\n",
+               string_desc->string.pointer,
+               return_desc->integer.value == 0 ? "not-" : ""));
 
-       return_desc->integer.value = 0;
        return_ACPI_STATUS(AE_OK);
 }
 
index 17020c12623c727c7c8ff0a18e7602bf18a85c5a..fe0cdf83641a3b5a0ddcf022e520941c1be10d92 100644 (file)
@@ -163,7 +163,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
        case ACPI_NOTIFY_BUS_CHECK:
                /* Fall through */
        case ACPI_NOTIFY_DEVICE_CHECK:
-               printk("Container driver received %s event\n",
+               printk(KERN_WARNING "Container driver received %s event\n",
                       (type == ACPI_NOTIFY_BUS_CHECK) ?
                       "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK");
                status = acpi_bus_get_device(handle, &device);
@@ -174,7 +174,8 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
                                        kobject_uevent(&device->dev.kobj,
                                                       KOBJ_ONLINE);
                                else
-                                       printk("Failed to add container\n");
+                                       printk(KERN_WARNING
+                                              "Failed to add container\n");
                        }
                } else {
                        if (ACPI_SUCCESS(status)) {
index 5b30b8d91d716126cdd3305d61ee8fd625eea016..35094f230b1e339d2d969ca27cb89816c7d3d9de 100644 (file)
@@ -855,10 +855,14 @@ fdd_out:
 static ssize_t show_docked(struct device *dev,
                           struct device_attribute *attr, char *buf)
 {
+       struct acpi_device *tmp;
+
        struct dock_station *dock_station = *((struct dock_station **)
                dev->platform_data);
-       return snprintf(buf, PAGE_SIZE, "%d\n", dock_present(dock_station));
 
+       if (ACPI_SUCCESS(acpi_bus_get_device(dock_station->handle, &tmp)))
+               return snprintf(buf, PAGE_SIZE, "1\n");
+       return snprintf(buf, PAGE_SIZE, "0\n");
 }
 static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);
 
@@ -984,7 +988,7 @@ static int dock_add(acpi_handle handle)
 
        ret = device_create_file(&dock_device->dev, &dev_attr_docked);
        if (ret) {
-               printk("Error %d adding sysfs file\n", ret);
+               printk(KERN_ERR "Error %d adding sysfs file\n", ret);
                platform_device_unregister(dock_device);
                kfree(dock_station);
                dock_station = NULL;
@@ -992,7 +996,7 @@ static int dock_add(acpi_handle handle)
        }
        ret = device_create_file(&dock_device->dev, &dev_attr_undock);
        if (ret) {
-               printk("Error %d adding sysfs file\n", ret);
+               printk(KERN_ERR "Error %d adding sysfs file\n", ret);
                device_remove_file(&dock_device->dev, &dev_attr_docked);
                platform_device_unregister(dock_device);
                kfree(dock_station);
@@ -1001,7 +1005,7 @@ static int dock_add(acpi_handle handle)
        }
        ret = device_create_file(&dock_device->dev, &dev_attr_uid);
        if (ret) {
-               printk("Error %d adding sysfs file\n", ret);
+               printk(KERN_ERR "Error %d adding sysfs file\n", ret);
                device_remove_file(&dock_device->dev, &dev_attr_docked);
                device_remove_file(&dock_device->dev, &dev_attr_undock);
                platform_device_unregister(dock_device);
@@ -1011,7 +1015,7 @@ static int dock_add(acpi_handle handle)
        }
        ret = device_create_file(&dock_device->dev, &dev_attr_flags);
        if (ret) {
-               printk("Error %d adding sysfs file\n", ret);
+               printk(KERN_ERR "Error %d adding sysfs file\n", ret);
                device_remove_file(&dock_device->dev, &dev_attr_docked);
                device_remove_file(&dock_device->dev, &dev_attr_undock);
                device_remove_file(&dock_device->dev, &dev_attr_uid);
index a2b82c90a6838eaff23a83cd30e741e0c3422e2a..5c2f5d343be6185fc552c0181c194429fdccb027 100644 (file)
@@ -982,7 +982,7 @@ int __init acpi_ec_ecdt_probe(void)
                saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);
                if (!saved_ec)
                        return -ENOMEM;
-               memcpy(&saved_ec, boot_ec, sizeof(saved_ec));
+               memcpy(saved_ec, boot_ec, sizeof(*saved_ec));
        /* fall through */
        }
        /* This workaround is needed only on some broken machines,
index adec3d15810a347d7ef6bf4cabc1b84d950ec1b1..5479b9f42513a17d7ab27aa8ed48d3035d547651 100644 (file)
@@ -255,12 +255,12 @@ static int acpi_platform_notify(struct device *dev)
        }
        type = acpi_get_bus_type(dev->bus);
        if (!type) {
-               DBG("No ACPI bus support for %s\n", dev->bus_id);
+               DBG("No ACPI bus support for %s\n", dev_name(dev));
                ret = -EINVAL;
                goto end;
        }
        if ((ret = type->find_device(dev, &handle)) != 0)
-               DBG("Can't get handler for %s\n", dev->bus_id);
+               DBG("Can't get handler for %s\n", dev_name(dev));
       end:
        if (!ret)
                acpi_bind_one(dev, handle);
@@ -271,10 +271,10 @@ static int acpi_platform_notify(struct device *dev)
 
                acpi_get_name(dev->archdata.acpi_handle,
                              ACPI_FULL_PATHNAME, &buffer);
-               DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer);
+               DBG("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer);
                kfree(buffer.pointer);
        } else
-               DBG("Device %s -> No ACPI support\n", dev->bus_id);
+               DBG("Device %s -> No ACPI support\n", dev_name(dev));
 #endif
 
        return ret;
index 6729a4992f2bd73543a561f36454f037db01298d..b3193ec0a2ef36eae859111a525a1d5931590b78 100644 (file)
@@ -228,10 +228,10 @@ void acpi_os_vprintf(const char *fmt, va_list args)
        if (acpi_in_debugger) {
                kdb_printf("%s", buffer);
        } else {
-               printk("%s", buffer);
+               printk(KERN_CONT "%s", buffer);
        }
 #else
-       printk("%s", buffer);
+       printk(KERN_CONT "%s", buffer);
 #endif
 }
 
@@ -1317,6 +1317,54 @@ acpi_os_validate_interface (char *interface)
        return AE_SUPPORT;
 }
 
+#ifdef CONFIG_X86
+
+struct aml_port_desc {
+       uint    start;
+       uint    end;
+       char*   name;
+       char    warned;
+};
+
+static struct aml_port_desc aml_invalid_port_list[] = {
+       {0x20, 0x21, "PIC0", 0},
+       {0xA0, 0xA1, "PIC1", 0},
+       {0x4D0, 0x4D1, "ELCR", 0}
+};
+
+/*
+ * valid_aml_io_address()
+ *
+ * if valid, return true
+ * else invalid, warn once, return false
+ */
+static bool valid_aml_io_address(uint address, uint length)
+{
+       int i;
+       int entries = sizeof(aml_invalid_port_list) / sizeof(struct aml_port_desc);
+
+       for (i = 0; i < entries; ++i) {
+               if ((address >= aml_invalid_port_list[i].start &&
+                       address <= aml_invalid_port_list[i].end) ||
+                       (address + length >= aml_invalid_port_list[i].start &&
+                       address  + length <= aml_invalid_port_list[i].end))
+               {
+                       if (!aml_invalid_port_list[i].warned)
+                       {
+                               printk(KERN_ERR "ACPI: Denied BIOS AML access"
+                                       " to invalid port 0x%x+0x%x (%s)\n",
+                                       address, length,
+                                       aml_invalid_port_list[i].name);
+                               aml_invalid_port_list[i].warned = 1;
+                       }
+                       return false;   /* invalid */
+               }
+       }
+       return true;    /* valid */
+}
+#else
+static inline bool valid_aml_io_address(uint address, uint length) { return true; }
+#endif
 /******************************************************************************
  *
  * FUNCTION:    acpi_os_validate_address
@@ -1346,6 +1394,8 @@ acpi_os_validate_address (
 
        switch (space_id) {
        case ACPI_ADR_SPACE_SYSTEM_IO:
+               if (!valid_aml_io_address(address, length))
+                       return AE_AML_ILLEGAL_ADDRESS;
        case ACPI_ADR_SPACE_SYSTEM_MEMORY:
                /* Only interference checks against SystemIO and SytemMemory
                   are needed */
index 1c6e73c7865edcb4fca3dbe0f2f5964a12c22f9f..6c772ca76bd1a52f1e3758193022068bd8a29d12 100644 (file)
@@ -593,7 +593,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
                return -ENODEV;
        } else {
                acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING;
-               printk(PREFIX "%s [%s] enabled at IRQ %d\n",
+               printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n",
                       acpi_device_name(link->device),
                       acpi_device_bid(link->device), link->irq.active);
        }
index 66a9d81455628454f628496415f4bbee495732b4..7bc22a471fe36c384647c5adff2bd3eaf10dd930 100644 (file)
@@ -66,43 +66,17 @@ ACPI_MODULE_NAME("processor_idle");
 #define ACPI_PROCESSOR_FILE_POWER      "power"
 #define US_TO_PM_TIMER_TICKS(t)                ((t * (PM_TIMER_FREQUENCY/1000)) / 1000)
 #define PM_TIMER_TICK_NS               (1000000000ULL/PM_TIMER_FREQUENCY)
-#ifndef CONFIG_CPU_IDLE
-#define C2_OVERHEAD                    4       /* 1us (3.579 ticks per us) */
-#define C3_OVERHEAD                    4       /* 1us (3.579 ticks per us) */
-static void (*pm_idle_save) (void) __read_mostly;
-#else
 #define C2_OVERHEAD                    1       /* 1us */
 #define C3_OVERHEAD                    1       /* 1us */
-#endif
 #define PM_TIMER_TICKS_TO_US(p)                (((p) * 1000)/(PM_TIMER_FREQUENCY/1000))
 
 static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
-#ifdef CONFIG_CPU_IDLE
 module_param(max_cstate, uint, 0000);
-#else
-module_param(max_cstate, uint, 0644);
-#endif
 static unsigned int nocst __read_mostly;
 module_param(nocst, uint, 0000);
 
-#ifndef CONFIG_CPU_IDLE
-/*
- * bm_history -- bit-mask with a bit per jiffy of bus-master activity
- * 1000 HZ: 0xFFFFFFFF: 32 jiffies = 32ms
- * 800 HZ: 0xFFFFFFFF: 32 jiffies = 40ms
- * 100 HZ: 0x0000000F: 4 jiffies = 40ms
- * reduce history for more aggressive entry into C3
- */
-static unsigned int bm_history __read_mostly =
-    (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1));
-module_param(bm_history, uint, 0644);
-
-static int acpi_processor_set_power_policy(struct acpi_processor *pr);
-
-#else  /* CONFIG_CPU_IDLE */
 static unsigned int latency_factor __read_mostly = 2;
 module_param(latency_factor, uint, 0644);
-#endif
 
 /*
  * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3.
@@ -224,71 +198,6 @@ static void acpi_safe_halt(void)
        current_thread_info()->status |= TS_POLLING;
 }
 
-#ifndef CONFIG_CPU_IDLE
-
-static void
-acpi_processor_power_activate(struct acpi_processor *pr,
-                             struct acpi_processor_cx *new)
-{
-       struct acpi_processor_cx *old;
-
-       if (!pr || !new)
-               return;
-
-       old = pr->power.state;
-
-       if (old)
-               old->promotion.count = 0;
-       new->demotion.count = 0;
-
-       /* Cleanup from old state. */
-       if (old) {
-               switch (old->type) {
-               case ACPI_STATE_C3:
-                       /* Disable bus master reload */
-                       if (new->type != ACPI_STATE_C3 && pr->flags.bm_check)
-                               acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0);
-                       break;
-               }
-       }
-
-       /* Prepare to use new state. */
-       switch (new->type) {
-       case ACPI_STATE_C3:
-               /* Enable bus master reload */
-               if (old->type != ACPI_STATE_C3 && pr->flags.bm_check)
-                       acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1);
-               break;
-       }
-
-       pr->power.state = new;
-
-       return;
-}
-
-static atomic_t c3_cpu_count;
-
-/* Common C-state entry for C2, C3, .. */
-static void acpi_cstate_enter(struct acpi_processor_cx *cstate)
-{
-       /* Don't trace irqs off for idle */
-       stop_critical_timings();
-       if (cstate->entry_method == ACPI_CSTATE_FFH) {
-               /* Call into architectural FFH based C-state */
-               acpi_processor_ffh_cstate_enter(cstate);
-       } else {
-               int unused;
-               /* IO port based C-state */
-               inb(cstate->address);
-               /* Dummy wait op - must do something useless after P_LVL2 read
-                  because chipsets cannot guarantee that STPCLK# signal
-                  gets asserted in time to freeze execution properly. */
-               unused = inl(acpi_gbl_FADT.xpm_timer_block.address);
-       }
-       start_critical_timings();
-}
-#endif /* !CONFIG_CPU_IDLE */
-
 #ifdef ARCH_APICTIMER_STOPS_ON_C3
 
 /*
@@ -390,421 +299,6 @@ static int tsc_halts_in_c(int state)
 }
 #endif
 
-#ifndef CONFIG_CPU_IDLE
-static void acpi_processor_idle(void)
-{
-       struct acpi_processor *pr = NULL;
-       struct acpi_processor_cx *cx = NULL;
-       struct acpi_processor_cx *next_state = NULL;
-       int sleep_ticks = 0;
-       u32 t1, t2 = 0;
-
-       /*
-        * Interrupts must be disabled during bus mastering calculations and
-        * for C2/C3 transitions.
-        */
-       local_irq_disable();
-
-       pr = __get_cpu_var(processors);
-       if (!pr) {
-               local_irq_enable();
-               return;
-       }
-
-       /*
-        * Check whether we truly need to go idle, or should
-        * reschedule:
-        */
-       if (unlikely(need_resched())) {
-               local_irq_enable();
-               return;
-       }
-
-       cx = pr->power.state;
-       if (!cx || acpi_idle_suspend) {
-               if (pm_idle_save) {
-                       pm_idle_save(); /* enables IRQs */
-               } else {
-                       acpi_safe_halt();
-                       local_irq_enable();
-               }
-
-               return;
-       }
-
-       /*
-        * Check BM Activity
-        * -----------------
-        * Check for bus mastering activity (if required), record, and check
-        * for demotion.
-        */
-       if (pr->flags.bm_check) {
-               u32 bm_status = 0;
-               unsigned long diff = jiffies - pr->power.bm_check_timestamp;
-
-               if (diff > 31)
-                       diff = 31;
-
-               pr->power.bm_activity <<= diff;
-
-               acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status);
-               if (bm_status) {
-                       pr->power.bm_activity |= 0x1;
-                       acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1);
-               }
-               /*
-                * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect
-                * the true state of bus mastering activity; forcing us to
-                * manually check the BMIDEA bit of each IDE channel.
-                */
-               else if (errata.piix4.bmisx) {
-                       if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01)
-                           || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01))
-                               pr->power.bm_activity |= 0x1;
-               }
-
-               pr->power.bm_check_timestamp = jiffies;
-
-               /*
-                * If bus mastering is or was active this jiffy, demote
-                * to avoid a faulty transition.  Note that the processor
-                * won't enter a low-power state during this call (to this
-                * function) but should upon the next.
-                *
-                * TBD: A better policy might be to fallback to the demotion
-                *      state (use it for this quantum only) istead of
-                *      demoting -- and rely on duration as our sole demotion
-                *      qualification.  This may, however, introduce DMA
-                *      issues (e.g. floppy DMA transfer overrun/underrun).
-                */
-               if ((pr->power.bm_activity & 0x1) &&
-                   cx->demotion.threshold.bm) {
-                       local_irq_enable();
-                       next_state = cx->demotion.state;
-                       goto end;
-               }
-       }
-
-#ifdef CONFIG_HOTPLUG_CPU
-       /*
-        * Check for P_LVL2_UP flag before entering C2 and above on
-        * an SMP system. We do it here instead of doing it at _CST/P_LVL
-        * detection phase, to work cleanly with logical CPU hotplug.
-        */
-       if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
-           !pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
-               cx = &pr->power.states[ACPI_STATE_C1];
-#endif
-
-       /*
-        * Sleep:
-        * ------
-        * Invoke the current Cx state to put the processor to sleep.
-        */
-       if (cx->type == ACPI_STATE_C2 || cx->type == ACPI_STATE_C3) {
-               current_thread_info()->status &= ~TS_POLLING;
-               /*
-                * TS_POLLING-cleared state must be visible before we
-                * test NEED_RESCHED:
-                */
-               smp_mb();
-               if (need_resched()) {
-                       current_thread_info()->status |= TS_POLLING;
-                       local_irq_enable();
-                       return;
-               }
-       }
-
-       switch (cx->type) {
-
-       case ACPI_STATE_C1:
-               /*
-                * Invoke C1.
-                * Use the appropriate idle routine, the one that would
-                * be used without acpi C-states.
-                */
-               if (pm_idle_save) {
-                       pm_idle_save(); /* enables IRQs */
-               } else {
-                       acpi_safe_halt();
-                       local_irq_enable();
-               }
-
-               /*
-                * TBD: Can't get time duration while in C1, as resumes
-                *      go to an ISR rather than here.  Need to instrument
-                *      base interrupt handler.
-                *
-                * Note: the TSC better not stop in C1, sched_clock() will
-                *       skew otherwise.
-                */
-               sleep_ticks = 0xFFFFFFFF;
-
-               break;
-
-       case ACPI_STATE_C2:
-               /* Get start time (ticks) */
-               t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
-               /* Tell the scheduler that we are going deep-idle: */
-               sched_clock_idle_sleep_event();
-               /* Invoke C2 */
-               acpi_state_timer_broadcast(pr, cx, 1);
-               acpi_cstate_enter(cx);
-               /* Get end time (ticks) */
-               t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
-
-#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
-               /* TSC halts in C2, so notify users */
-               if (tsc_halts_in_c(ACPI_STATE_C2))
-                       mark_tsc_unstable("possible TSC halt in C2");
-#endif
-               /* Compute time (ticks) that we were actually asleep */
-               sleep_ticks = ticks_elapsed(t1, t2);
-
-               /* Tell the scheduler how much we idled: */
-               sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
-
-               /* Re-enable interrupts */
-               local_irq_enable();
-               /* Do not account our idle-switching overhead: */
-               sleep_ticks -= cx->latency_ticks + C2_OVERHEAD;
-
-               current_thread_info()->status |= TS_POLLING;
-               acpi_state_timer_broadcast(pr, cx, 0);
-               break;
-
-       case ACPI_STATE_C3:
-               acpi_unlazy_tlb(smp_processor_id());
-               /*
-                * Must be done before busmaster disable as we might
-                * need to access HPET !
-                */
-               acpi_state_timer_broadcast(pr, cx, 1);
-               /*
-                * disable bus master
-                * bm_check implies we need ARB_DIS
-                * !bm_check implies we need cache flush
-                * bm_control implies whether we can do ARB_DIS
-                *
-                * That leaves a case where bm_check is set and bm_control is
-                * not set. In that case we cannot do much, we enter C3
-                * without doing anything.
-                */
-               if (pr->flags.bm_check && pr->flags.bm_control) {
-                       if (atomic_inc_return(&c3_cpu_count) ==
-                           num_online_cpus()) {
-                               /*
-                                * All CPUs are trying to go to C3
-                                * Disable bus master arbitration
-                                */
-                               acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1);
-                       }
-               } else if (!pr->flags.bm_check) {
-                       /* SMP with no shared cache... Invalidate cache  */
-                       ACPI_FLUSH_CPU_CACHE();
-               }
-
-               /* Get start time (ticks) */
-               t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
-               /* Invoke C3 */
-               /* Tell the scheduler that we are going deep-idle: */
-               sched_clock_idle_sleep_event();
-               acpi_cstate_enter(cx);
-               /* Get end time (ticks) */
-               t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
-               if (pr->flags.bm_check && pr->flags.bm_control) {
-                       /* Enable bus master arbitration */
-                       atomic_dec(&c3_cpu_count);
-                       acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
-               }
-
-#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
-               /* TSC halts in C3, so notify users */
-               if (tsc_halts_in_c(ACPI_STATE_C3))
-                       mark_tsc_unstable("TSC halts in C3");
-#endif
-               /* Compute time (ticks) that we were actually asleep */
-               sleep_ticks = ticks_elapsed(t1, t2);
-               /* Tell the scheduler how much we idled: */
-               sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
-
-               /* Re-enable interrupts */
-               local_irq_enable();
-               /* Do not account our idle-switching overhead: */
-               sleep_ticks -= cx->latency_ticks + C3_OVERHEAD;
-
-               current_thread_info()->status |= TS_POLLING;
-               acpi_state_timer_broadcast(pr, cx, 0);
-               break;
-
-       default:
-               local_irq_enable();
-               return;
-       }
-       cx->usage++;
-       if ((cx->type != ACPI_STATE_C1) && (sleep_ticks > 0))
-               cx->time += sleep_ticks;
-
-       next_state = pr->power.state;
-
-#ifdef CONFIG_HOTPLUG_CPU
-       /* Don't do promotion/demotion */
-       if ((cx->type == ACPI_STATE_C1) && (num_online_cpus() > 1) &&
-           !pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) {
-               next_state = cx;
-               goto end;
-       }
-#endif
-
-       /*
-        * Promotion?
-        * ----------
-        * Track the number of longs (time asleep is greater than threshold)
-        * and promote when the count threshold is reached.  Note that bus
-        * mastering activity may prevent promotions.
-        * Do not promote above max_cstate.
-        */
-       if (cx->promotion.state &&
-           ((cx->promotion.state - pr->power.states) <= max_cstate)) {
-               if (sleep_ticks > cx->promotion.threshold.ticks &&
-                 cx->promotion.state->latency <=
-                               pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)) {
-                       cx->promotion.count++;
-                       cx->demotion.count = 0;
-                       if (cx->promotion.count >=
-                           cx->promotion.threshold.count) {
-                               if (pr->flags.bm_check) {
-                                       if (!
-                                           (pr->power.bm_activity & cx->
-                                            promotion.threshold.bm)) {
-                                               next_state =
-                                                   cx->promotion.state;
-                                               goto end;
-                                       }
-                               } else {
-                                       next_state = cx->promotion.state;
-                                       goto end;
-                               }
-                       }
-               }
-       }
-
-       /*
-        * Demotion?
-        * ---------
-        * Track the number of shorts (time asleep is less than time threshold)
-        * and demote when the usage threshold is reached.
-        */
-       if (cx->demotion.state) {
-               if (sleep_ticks < cx->demotion.threshold.ticks) {
-                       cx->demotion.count++;
-                       cx->promotion.count = 0;
-                       if (cx->demotion.count >= cx->demotion.threshold.count) {
-                               next_state = cx->demotion.state;
-                               goto end;
-                       }
-               }
-       }
-
-      end:
-       /*
-        * Demote if current state exceeds max_cstate
-        * or if the latency of the current state is unacceptable
-        */
-       if ((pr->power.state - pr->power.states) > max_cstate ||
-               pr->power.state->latency >
-                               pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)) {
-               if (cx->demotion.state)
-                       next_state = cx->demotion.state;
-       }
-
-       /*
-        * New Cx State?
-        * -------------
-        * If we're going to start using a new Cx state we must clean up
-        * from the previous and prepare to use the new.
-        */
-       if (next_state != pr->power.state)
-               acpi_processor_power_activate(pr, next_state);
-}
-
-static int acpi_processor_set_power_policy(struct acpi_processor *pr)
-{
-       unsigned int i;
-       unsigned int state_is_set = 0;
-       struct acpi_processor_cx *lower = NULL;
-       struct acpi_processor_cx *higher = NULL;
-       struct acpi_processor_cx *cx;
-
-
-       if (!pr)
-               return -EINVAL;
-
-       /*
-        * This function sets the default Cx state policy (OS idle handler).
-        * Our scheme is to promote quickly to C2 but more conservatively
-        * to C3.  We're favoring C2  for its characteristics of low latency
-        * (quick response), good power savings, and ability to allow bus
-        * mastering activity.  Note that the Cx state policy is completely
-        * customizable and can be altered dynamically.
-        */
-
-       /* startup state */
-       for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
-               cx = &pr->power.states[i];
-               if (!cx->valid)
-                       continue;
-
-               if (!state_is_set)
-                       pr->power.state = cx;
-               state_is_set++;
-               break;
-       }
-
-       if (!state_is_set)
-               return -ENODEV;
-
-       /* demotion */
-       for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
-               cx = &pr->power.states[i];
-               if (!cx->valid)
-                       continue;
-
-               if (lower) {
-                       cx->demotion.state = lower;
-                       cx->demotion.threshold.ticks = cx->latency_ticks;
-                       cx->demotion.threshold.count = 1;
-                       if (cx->type == ACPI_STATE_C3)
-                               cx->demotion.threshold.bm = bm_history;
-               }
-
-               lower = cx;
-       }
-
-       /* promotion */
-       for (i = (ACPI_PROCESSOR_MAX_POWER - 1); i > 0; i--) {
-               cx = &pr->power.states[i];
-               if (!cx->valid)
-                       continue;
-
-               if (higher) {
-                       cx->promotion.state = higher;
-                       cx->promotion.threshold.ticks = cx->latency_ticks;
-                       if (cx->type >= ACPI_STATE_C2)
-                               cx->promotion.threshold.count = 4;
-                       else
-                               cx->promotion.threshold.count = 10;
-                       if (higher->type == ACPI_STATE_C3)
-                               cx->promotion.threshold.bm = bm_history;
-               }
-
-               higher = cx;
-       }
-
-       return 0;
-}
-#endif /* !CONFIG_CPU_IDLE */
-
 static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
 {
 
@@ -1047,11 +541,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
         */
        cx->valid = 1;
 
-#ifndef CONFIG_CPU_IDLE
-       cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
-#else
        cx->latency_ticks = cx->latency;
-#endif
 
        return;
 }
@@ -1121,7 +611,6 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
                                          " for C3 to be enabled on SMP systems\n"));
                        return;
                }
-               acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0);
        }
 
        /*
@@ -1132,11 +621,16 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
         */
        cx->valid = 1;
 
-#ifndef CONFIG_CPU_IDLE
-       cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
-#else
        cx->latency_ticks = cx->latency;
-#endif
+       /*
+        * On older chipsets, BM_RLD needs to be set
+        * in order for Bus Master activity to wake the
+        * system from C3.  Newer chipsets handle DMA
+        * during C3 automatically and BM_RLD is a NOP.
+        * In either case, the proper way to
+        * handle BM_RLD is to set it and leave it set.
+        */
+       acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1);
 
        return;
 }
@@ -1201,20 +695,6 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
 
        pr->power.count = acpi_processor_power_verify(pr);
 
-#ifndef CONFIG_CPU_IDLE
-       /*
-        * Set Default Policy
-        * ------------------
-        * Now that we know which states are supported, set the default
-        * policy.  Note that this policy can be changed dynamically
-        * (e.g. encourage deeper sleeps to conserve battery life when
-        * not on AC).
-        */
-       result = acpi_processor_set_power_policy(pr);
-       if (result)
-               return result;
-#endif
-
        /*
         * if one state of type C2 or C3 is available, mark this
         * CPU as being "idle manageable"
@@ -1312,69 +792,6 @@ static const struct file_operations acpi_processor_power_fops = {
        .release = single_release,
 };
 
-#ifndef CONFIG_CPU_IDLE
-
-int acpi_processor_cst_has_changed(struct acpi_processor *pr)
-{
-       int result = 0;
-
-       if (boot_option_idle_override)
-               return 0;
-
-       if (!pr)
-               return -EINVAL;
-
-       if (nocst) {
-               return -ENODEV;
-       }
-
-       if (!pr->flags.power_setup_done)
-               return -ENODEV;
-
-       /*
-        * Fall back to the default idle loop, when pm_idle_save had
-        * been initialized.
-        */
-       if (pm_idle_save) {
-               pm_idle = pm_idle_save;
-               /* Relies on interrupts forcing exit from idle. */
-               synchronize_sched();
-       }
-
-       pr->flags.power = 0;
-       result = acpi_processor_get_power_info(pr);
-       if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
-               pm_idle = acpi_processor_idle;
-
-       return result;
-}
-
-#ifdef CONFIG_SMP
-static void smp_callback(void *v)
-{
-       /* we already woke the CPU up, nothing more to do */
-}
-
-/*
- * This function gets called when a part of the kernel has a new latency
- * requirement.  This means we need to get all processors out of their C-state,
- * and then recalculate a new suitable C-state. Just do a cross-cpu IPI; that
- * wakes them all right up.
- */
-static int acpi_processor_latency_notify(struct notifier_block *b,
-               unsigned long l, void *v)
-{
-       smp_call_function(smp_callback, NULL, 1);
-       return NOTIFY_OK;
-}
-
-static struct notifier_block acpi_processor_latency_notifier = {
-       .notifier_call = acpi_processor_latency_notify,
-};
-
-#endif
-
-#else /* CONFIG_CPU_IDLE */
 
 /**
  * acpi_idle_bm_check - checks if bus master activity was detected
@@ -1383,7 +800,7 @@ static int acpi_idle_bm_check(void)
 {
        u32 bm_status = 0;
 
-       acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status);
+       acpi_get_register_unlocked(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status);
        if (bm_status)
                acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1);
        /*
@@ -1399,25 +816,6 @@ static int acpi_idle_bm_check(void)
        return bm_status;
 }
 
-/**
- * acpi_idle_update_bm_rld - updates the BM_RLD bit depending on target state
- * @pr: the processor
- * @target: the new target state
- */
-static inline void acpi_idle_update_bm_rld(struct acpi_processor *pr,
-                                          struct acpi_processor_cx *target)
-{
-       if (pr->flags.bm_rld_set && target->type != ACPI_STATE_C3) {
-               acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0);
-               pr->flags.bm_rld_set = 0;
-       }
-
-       if (!pr->flags.bm_rld_set && target->type == ACPI_STATE_C3) {
-               acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1);
-               pr->flags.bm_rld_set = 1;
-       }
-}
-
 /**
  * acpi_idle_do_entry - a helper function that does C2 and C3 type entry
  * @cx: cstate data
@@ -1473,9 +871,6 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
                return 0;
        }
 
-       if (pr->flags.bm_check)
-               acpi_idle_update_bm_rld(pr, cx);
-
        t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
        acpi_idle_do_entry(cx);
        t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
@@ -1527,9 +922,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
         */
        acpi_state_timer_broadcast(pr, cx, 1);
 
-       if (pr->flags.bm_check)
-               acpi_idle_update_bm_rld(pr, cx);
-
        if (cx->type == ACPI_STATE_C3)
                ACPI_FLUSH_CPU_CACHE();
 
@@ -1621,8 +1013,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
         */
        acpi_state_timer_broadcast(pr, cx, 1);
 
-       acpi_idle_update_bm_rld(pr, cx);
-
        /*
         * disable bus master
         * bm_check implies we need ARB_DIS
@@ -1795,8 +1185,6 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
        return ret;
 }
 
-#endif /* CONFIG_CPU_IDLE */
-
 int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
                              struct acpi_device *device)
 {
@@ -1825,10 +1213,6 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
                               "ACPI: processor limited to max C-state %d\n",
                               max_cstate);
                first_run++;
-#if !defined(CONFIG_CPU_IDLE) && defined(CONFIG_SMP)
-               pm_qos_add_notifier(PM_QOS_CPU_DMA_LATENCY,
-                               &acpi_processor_latency_notifier);
-#endif
        }
 
        if (!pr)
@@ -1852,11 +1236,9 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
         * platforms that only support C1.
         */
        if (pr->flags.power) {
-#ifdef CONFIG_CPU_IDLE
                acpi_processor_setup_cpuidle(pr);
                if (cpuidle_register_device(&pr->power.dev))
                        return -EIO;
-#endif
 
                printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id);
                for (i = 1; i <= pr->power.count; i++)
@@ -1864,13 +1246,6 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
                                printk(" C%d[C%d]", i,
                                       pr->power.states[i].type);
                printk(")\n");
-
-#ifndef CONFIG_CPU_IDLE
-               if (pr->id == 0) {
-                       pm_idle_save = pm_idle;
-                       pm_idle = acpi_processor_idle;
-               }
-#endif
        }
 
        /* 'power' [R] */
@@ -1889,34 +1264,12 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
        if (boot_option_idle_override)
                return 0;
 
-#ifdef CONFIG_CPU_IDLE
        cpuidle_unregister_device(&pr->power.dev);
-#endif
        pr->flags.power_setup_done = 0;
 
        if (acpi_device_dir(device))
                remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,
                                  acpi_device_dir(device));
 
-#ifndef CONFIG_CPU_IDLE
-
-       /* Unregister the idle handler when processor #0 is removed. */
-       if (pr->id == 0) {
-               if (pm_idle_save)
-                       pm_idle = pm_idle_save;
-
-               /*
-                * We are about to unload the current idle thread pm callback
-                * (pm_idle), Wait for all processors to update cached/local
-                * copies of pm_idle before proceeding.
-                */
-               cpu_idle_wait();
-#ifdef CONFIG_SMP
-               pm_qos_remove_notifier(PM_QOS_CPU_DMA_LATENCY,
-                               &acpi_processor_latency_notifier);
-#endif
-       }
-#endif
-
        return 0;
 }
index 846e227592d48770787672223a4c37c37ec6468c..9cc769b587ff7bbe061ae0c5ab5cc66d67e62ae5 100644 (file)
 #include <linux/init.h>
 #include <linux/cpufreq.h>
 
-#ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-#include <linux/mutex.h>
-
-#include <asm/uaccess.h>
-#endif
-
 #ifdef CONFIG_X86
 #include <asm/cpufeature.h>
 #endif
@@ -434,96 +426,6 @@ int acpi_processor_notify_smm(struct module *calling_module)
 
 EXPORT_SYMBOL(acpi_processor_notify_smm);
 
-#ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF
-/* /proc/acpi/processor/../performance interface (DEPRECATED) */
-
-static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file);
-static struct file_operations acpi_processor_perf_fops = {
-       .owner = THIS_MODULE,
-       .open = acpi_processor_perf_open_fs,
-       .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
-};
-
-static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset)
-{
-       struct acpi_processor *pr = seq->private;
-       int i;
-
-
-       if (!pr)
-               goto end;
-
-       if (!pr->performance) {
-               seq_puts(seq, "<not supported>\n");
-               goto end;
-       }
-
-       seq_printf(seq, "state count:             %d\n"
-                  "active state:            P%d\n",
-                  pr->performance->state_count, pr->performance->state);
-
-       seq_puts(seq, "states:\n");
-       for (i = 0; i < pr->performance->state_count; i++)
-               seq_printf(seq,
-                          "   %cP%d:                  %d MHz, %d mW, %d uS\n",
-                          (i == pr->performance->state ? '*' : ' '), i,
-                          (u32) pr->performance->states[i].core_frequency,
-                          (u32) pr->performance->states[i].power,
-                          (u32) pr->performance->states[i].transition_latency);
-
-      end:
-       return 0;
-}
-
-static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file)
-{
-       return single_open(file, acpi_processor_perf_seq_show,
-                          PDE(inode)->data);
-}
-
-static void acpi_cpufreq_add_file(struct acpi_processor *pr)
-{
-       struct acpi_device *device = NULL;
-
-
-       if (acpi_bus_get_device(pr->handle, &device))
-               return;
-
-       /* add file 'performance' [R/W] */
-       proc_create_data(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO,
-                        acpi_device_dir(device),
-                        &acpi_processor_perf_fops, acpi_driver_data(device));
-       return;
-}
-
-static void acpi_cpufreq_remove_file(struct acpi_processor *pr)
-{
-       struct acpi_device *device = NULL;
-
-
-       if (acpi_bus_get_device(pr->handle, &device))
-               return;
-
-       /* remove file 'performance' */
-       remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE,
-                         acpi_device_dir(device));
-
-       return;
-}
-
-#else
-static void acpi_cpufreq_add_file(struct acpi_processor *pr)
-{
-       return;
-}
-static void acpi_cpufreq_remove_file(struct acpi_processor *pr)
-{
-       return;
-}
-#endif                         /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */
-
 static int acpi_processor_get_psd(struct acpi_processor        *pr)
 {
        int result = 0;
@@ -747,14 +649,12 @@ err_ret:
 }
 EXPORT_SYMBOL(acpi_processor_preregister_performance);
 
-
 int
 acpi_processor_register_performance(struct acpi_processor_performance
                                    *performance, unsigned int cpu)
 {
        struct acpi_processor *pr;
 
-
        if (!(acpi_processor_ppc_status & PPC_REGISTERED))
                return -EINVAL;
 
@@ -781,8 +681,6 @@ acpi_processor_register_performance(struct acpi_processor_performance
                return -EIO;
        }
 
-       acpi_cpufreq_add_file(pr);
-
        mutex_unlock(&performance_mutex);
        return 0;
 }
@@ -795,7 +693,6 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
 {
        struct acpi_processor *pr;
 
-
        mutex_lock(&performance_mutex);
 
        pr = per_cpu(processors, cpu);
@@ -808,8 +705,6 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
                kfree(pr->performance->states);
        pr->performance = NULL;
 
-       acpi_cpufreq_remove_file(pr);
-
        mutex_unlock(&performance_mutex);
 
        return;
index 7e3c609cbef27194c13dbacc7c036956e0217b73..519266654f06cf60bbd6712ee51836abb22fe198 100644 (file)
@@ -90,31 +90,6 @@ void __init acpi_old_suspend_ordering(void)
        old_suspend_ordering = true;
 }
 
-/*
- * According to the ACPI specification the BIOS should make sure that ACPI is
- * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states.  Still,
- * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI
- * on such systems during resume.  Unfortunately that doesn't help in
- * particularly pathological cases in which SCI_EN has to be set directly on
- * resume, although the specification states very clearly that this flag is
- * owned by the hardware.  The set_sci_en_on_resume variable will be set in such
- * cases.
- */
-static bool set_sci_en_on_resume;
-/*
- * The ACPI specification wants us to save NVS memory regions during hibernation
- * and to restore them during the subsequent resume.  However, it is not certain
- * if this mechanism is going to work on all machines, so we allow the user to
- * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line
- * option.
- */
-static bool s4_no_nvs;
-
-void __init acpi_s4_no_nvs(void)
-{
-       s4_no_nvs = true;
-}
-
 /**
  *     acpi_pm_disable_gpes - Disable the GPEs.
  */
@@ -193,6 +168,18 @@ static void acpi_pm_end(void)
 #endif /* CONFIG_ACPI_SLEEP */
 
 #ifdef CONFIG_SUSPEND
+/*
+ * According to the ACPI specification the BIOS should make sure that ACPI is
+ * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states.  Still,
+ * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI
+ * on such systems during resume.  Unfortunately that doesn't help in
+ * particularly pathological cases in which SCI_EN has to be set directly on
+ * resume, although the specification states very clearly that this flag is
+ * owned by the hardware.  The set_sci_en_on_resume variable will be set in such
+ * cases.
+ */
+static bool set_sci_en_on_resume;
+
 extern void do_suspend_lowlevel(void);
 
 static u32 acpi_suspend_states[] = {
@@ -396,6 +383,20 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
 #endif /* CONFIG_SUSPEND */
 
 #ifdef CONFIG_HIBERNATION
+/*
+ * The ACPI specification wants us to save NVS memory regions during hibernation
+ * and to restore them during the subsequent resume.  However, it is not certain
+ * if this mechanism is going to work on all machines, so we allow the user to
+ * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line
+ * option.
+ */
+static bool s4_no_nvs;
+
+void __init acpi_s4_no_nvs(void)
+{
+       s4_no_nvs = true;
+}
+
 static unsigned long s4_hardware_signature;
 static struct acpi_table_facs *facs;
 static bool nosigcheck;
@@ -679,7 +680,7 @@ static void acpi_power_off_prepare(void)
 static void acpi_power_off(void)
 {
        /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
-       printk("%s called\n", __func__);
+       printk(KERN_DEBUG "%s called\n", __func__);
        local_irq_disable();
        acpi_enable_wakeup_device(ACPI_STATE_S5);
        acpi_enter_sleep_state(ACPI_STATE_S5);
index 775c97a282bd0d036bdcee72e192d502e8ba08ea..a8852952fac409de6550b467d5d49b4f7e5ace07 100644 (file)
@@ -293,7 +293,12 @@ static void __init check_multiple_madt(void)
 
 int __init acpi_table_init(void)
 {
-       acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
+       acpi_status status;
+
+       status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
+       if (ACPI_FAILURE(status))
+               return 1;
+
        check_multiple_madt();
        return 0;
 }
index f261737636da7a5550c6ac26ab3d178c6220ab9a..bb5ed059114aa296e826b91f8b35083ccc773028 100644 (file)
@@ -1020,7 +1020,7 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
        }
 
        seq_printf(seq, "levels: ");
-       for (i = 0; i < dev->brightness->count; i++)
+       for (i = 2; i < dev->brightness->count; i++)
                seq_printf(seq, " %d", dev->brightness->levels[i]);
        seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr);
 
@@ -1059,7 +1059,7 @@ acpi_video_device_write_brightness(struct file *file,
                return -EFAULT;
 
        /* validate through the list of available levels */
-       for (i = 0; i < dev->brightness->count; i++)
+       for (i = 2; i < dev->brightness->count; i++)
                if (level == dev->brightness->levels[i]) {
                        if (ACPI_SUCCESS
                            (acpi_video_device_lcd_set_level(dev, level)))
@@ -1260,7 +1260,7 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
                        printk(KERN_WARNING PREFIX
                               "This indicates a BIOS bug. Please contact the manufacturer.\n");
                }
-               printk("%llx\n", options);
+               printk(KERN_WARNING "%llx\n", options);
                seq_printf(seq, "can POST: <integrated video>");
                if (options & 2)
                        seq_printf(seq, " <PCI video>");
@@ -1712,7 +1712,7 @@ acpi_video_get_next_level(struct acpi_video_device *device,
        max = max_below = 0;
        min = min_above = 255;
        /* Find closest level to level_current */
-       for (i = 0; i < device->brightness->count; i++) {
+       for (i = 2; i < device->brightness->count; i++) {
                l = device->brightness->levels[i];
                if (abs(l - level_current) < abs(delta)) {
                        delta = l - level_current;
@@ -1722,7 +1722,7 @@ acpi_video_get_next_level(struct acpi_video_device *device,
        }
        /* Ajust level_current to closest available level */
        level_current += delta;
-       for (i = 0; i < device->brightness->count; i++) {
+       for (i = 2; i < device->brightness->count; i++) {
                l = device->brightness->levels[i];
                if (l < min)
                        min = l;
@@ -2006,6 +2006,12 @@ static int acpi_video_bus_add(struct acpi_device *device)
                        device->pnp.bus_id[3] = '0' + instance;
                instance ++;
        }
+       /* a hack to fix the duplicate name "VGA" problem on Pa 3553 */
+       if (!strcmp(device->pnp.bus_id, "VGA")) {
+               if (instance)
+                       device->pnp.bus_id[3] = '0' + instance;
+               instance++;
+       }
 
        video->device = device;
        strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
index 77bba4c083cbe60efb19a714265a7cc44730212b..a603bbf9b1b706caf37a15b94eb8b6ecb4a3e8dc 100644 (file)
 #define EM_MSG_LED_VALUE_ON           0x00010000
 
 static int ahci_skip_host_reset;
+static int ahci_ignore_sss;
+
 module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444);
 MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)");
 
+module_param_named(ignore_sss, ahci_ignore_sss, int, 0444);
+MODULE_PARM_DESC(ignore_sss, "Ignore staggered spinup flag (0=don't ignore, 1=ignore)");
+
 static int ahci_enable_alpm(struct ata_port *ap,
                enum link_pm policy);
 static void ahci_disable_alpm(struct ata_port *ap);
@@ -2692,8 +2697,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        host->iomap = pcim_iomap_table(pdev);
        host->private_data = hpriv;
 
-       if (!(hpriv->cap & HOST_CAP_SSS))
+       if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss)
                host->flags |= ATA_HOST_PARALLEL_SCAN;
+       else
+               printk(KERN_INFO "ahci: SSS flag set, parallel bus scan disabled\n");
 
        if (pi.flags & ATA_FLAG_EM)
                ahci_reset_em(host);
index 88c242856dae999861f6864e9d70e064035a82b0..9fbf0595f3d44fd3f51d1339c9bbe127db7fa698 100644 (file)
@@ -164,6 +164,11 @@ MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
 
 
+static bool ata_sstatus_online(u32 sstatus)
+{
+       return (sstatus & 0xf) == 0x3;
+}
+
 /**
  *     ata_link_next - link iteration helper
  *     @link: the previous link, NULL to start
@@ -1015,18 +1020,6 @@ static const char *sata_spd_string(unsigned int spd)
        return spd_str[spd - 1];
 }
 
-void ata_dev_disable(struct ata_device *dev)
-{
-       if (ata_dev_enabled(dev)) {
-               if (ata_msg_drv(dev->link->ap))
-                       ata_dev_printk(dev, KERN_WARNING, "disabled\n");
-               ata_acpi_on_disable(dev);
-               ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 |
-                                            ATA_DNXFER_QUIET);
-               dev->class++;
-       }
-}
-
 static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy)
 {
        struct ata_link *link = dev->link;
@@ -2239,6 +2232,40 @@ retry:
        return rc;
 }
 
+static int ata_do_link_spd_horkage(struct ata_device *dev)
+{
+       struct ata_link *plink = ata_dev_phys_link(dev);
+       u32 target, target_limit;
+
+       if (!sata_scr_valid(plink))
+               return 0;
+
+       if (dev->horkage & ATA_HORKAGE_1_5_GBPS)
+               target = 1;
+       else
+               return 0;
+
+       target_limit = (1 << target) - 1;
+
+       /* if already on stricter limit, no need to push further */
+       if (plink->sata_spd_limit <= target_limit)
+               return 0;
+
+       plink->sata_spd_limit = target_limit;
+
+       /* Request another EH round by returning -EAGAIN if link is
+        * going faster than the target speed.  Forward progress is
+        * guaranteed by setting sata_spd_limit to target_limit above.
+        */
+       if (plink->sata_spd > target) {
+               ata_dev_printk(dev, KERN_INFO,
+                              "applying link speed limit horkage to %s\n",
+                              sata_spd_string(target));
+               return -EAGAIN;
+       }
+       return 0;
+}
+
 static inline u8 ata_dev_knobble(struct ata_device *dev)
 {
        struct ata_port *ap = dev->link->ap;
@@ -2329,6 +2356,10 @@ int ata_dev_configure(struct ata_device *dev)
                return 0;
        }
 
+       rc = ata_do_link_spd_horkage(dev);
+       if (rc)
+               return rc;
+
        /* let ACPI work its magic */
        rc = ata_acpi_on_devcfg(dev);
        if (rc)
@@ -2784,7 +2815,7 @@ int ata_bus_probe(struct ata_port *ap)
                        /* This is the last chance, better to slow
                         * down than lose it.
                         */
-                       sata_down_spd_limit(&ap->link);
+                       sata_down_spd_limit(&ap->link, 0);
                        ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
                }
        }
@@ -2880,21 +2911,27 @@ void ata_port_disable(struct ata_port *ap)
 /**
  *     sata_down_spd_limit - adjust SATA spd limit downward
  *     @link: Link to adjust SATA spd limit for
+ *     @spd_limit: Additional limit
  *
  *     Adjust SATA spd limit of @link downward.  Note that this
  *     function only adjusts the limit.  The change must be applied
  *     using sata_set_spd().
  *
+ *     If @spd_limit is non-zero, the speed is limited to equal to or
+ *     lower than @spd_limit if such speed is supported.  If
+ *     @spd_limit is slower than any supported speed, only the lowest
+ *     supported speed is allowed.
+ *
  *     LOCKING:
  *     Inherited from caller.
  *
  *     RETURNS:
  *     0 on success, negative errno on failure
  */
-int sata_down_spd_limit(struct ata_link *link)
+int sata_down_spd_limit(struct ata_link *link, u32 spd_limit)
 {
        u32 sstatus, spd, mask;
-       int rc, highbit;
+       int rc, bit;
 
        if (!sata_scr_valid(link))
                return -EOPNOTSUPP;
@@ -2903,7 +2940,7 @@ int sata_down_spd_limit(struct ata_link *link)
         * If not, use cached value in link->sata_spd.
         */
        rc = sata_scr_read(link, SCR_STATUS, &sstatus);
-       if (rc == 0)
+       if (rc == 0 && ata_sstatus_online(sstatus))
                spd = (sstatus >> 4) & 0xf;
        else
                spd = link->sata_spd;
@@ -2913,8 +2950,8 @@ int sata_down_spd_limit(struct ata_link *link)
                return -EINVAL;
 
        /* unconditionally mask off the highest bit */
-       highbit = fls(mask) - 1;
-       mask &= ~(1 << highbit);
+       bit = fls(mask) - 1;
+       mask &= ~(1 << bit);
 
        /* Mask off all speeds higher than or equal to the current
         * one.  Force 1.5Gbps if current SPD is not available.
@@ -2928,6 +2965,15 @@ int sata_down_spd_limit(struct ata_link *link)
        if (!mask)
                return -EINVAL;
 
+       if (spd_limit) {
+               if (mask & ((1 << spd_limit) - 1))
+                       mask &= (1 << spd_limit) - 1;
+               else {
+                       bit = ffs(mask) - 1;
+                       mask = 1 << bit;
+               }
+       }
+
        link->sata_spd_limit = mask;
 
        ata_link_printk(link, KERN_WARNING, "limiting SATA link speed to %s\n",
@@ -4215,6 +4261,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        /* Devices that do not need bridging limits applied */
        { "MTRON MSP-SATA*",            NULL,   ATA_HORKAGE_BRIDGE_OK, },
 
+       /* Devices which aren't very happy with higher link speeds */
+       { "WD My Book",                 NULL,   ATA_HORKAGE_1_5_GBPS, },
+
        /* End Marker */
        { }
 };
@@ -4709,8 +4758,7 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
 
 /**
  *     ata_qc_new - Request an available ATA command, for queueing
- *     @ap: Port associated with device @dev
- *     @dev: Device from whom we request an available command structure
+ *     @ap: target port
  *
  *     LOCKING:
  *     None.
@@ -5175,7 +5223,7 @@ bool ata_phys_link_online(struct ata_link *link)
        u32 sstatus;
 
        if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 &&
-           (sstatus & 0xf) == 0x3)
+           ata_sstatus_online(sstatus))
                return true;
        return false;
 }
@@ -5199,7 +5247,7 @@ bool ata_phys_link_offline(struct ata_link *link)
        u32 sstatus;
 
        if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 &&
-           (sstatus & 0xf) != 0x3)
+           !ata_sstatus_online(sstatus))
                return true;
        return false;
 }
@@ -5412,8 +5460,8 @@ void ata_dev_init(struct ata_device *dev)
        dev->horkage = 0;
        spin_unlock_irqrestore(ap->lock, flags);
 
-       memset((void *)dev + ATA_DEVICE_CLEAR_OFFSET, 0,
-              sizeof(*dev) - ATA_DEVICE_CLEAR_OFFSET);
+       memset((void *)dev + ATA_DEVICE_CLEAR_BEGIN, 0,
+              ATA_DEVICE_CLEAR_END - ATA_DEVICE_CLEAR_BEGIN);
        dev->pio_mask = UINT_MAX;
        dev->mwdma_mask = UINT_MAX;
        dev->udma_mask = UINT_MAX;
index 8147a838637094cc16d0217fe8c8ac135edc9c0a..ce2ef04753390b2c95dacd591662efd3c1800ebb 100644 (file)
@@ -82,6 +82,10 @@ enum {
        ATA_EH_FASTDRAIN_INTERVAL       =  3000,
 
        ATA_EH_UA_TRIES                 = 5,
+
+       /* probe speed down parameters, see ata_eh_schedule_probe() */
+       ATA_EH_PROBE_TRIAL_INTERVAL     = 60000,        /* 1 min */
+       ATA_EH_PROBE_TRIALS             = 2,
 };
 
 /* The following table determines how we sequence resets.  Each entry
@@ -1175,6 +1179,32 @@ void ata_eh_qc_retry(struct ata_queued_cmd *qc)
        __ata_eh_qc_complete(qc);
 }
 
+/**
+ *     ata_dev_disable - disable ATA device
+ *     @dev: ATA device to disable
+ *
+ *     Disable @dev.
+ *
+ *     Locking:
+ *     EH context.
+ */
+void ata_dev_disable(struct ata_device *dev)
+{
+       if (!ata_dev_enabled(dev))
+               return;
+
+       if (ata_msg_drv(dev->link->ap))
+               ata_dev_printk(dev, KERN_WARNING, "disabled\n");
+       ata_acpi_on_disable(dev);
+       ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | ATA_DNXFER_QUIET);
+       dev->class++;
+
+       /* From now till the next successful probe, ering is used to
+        * track probe failures.  Clear accumulated device error info.
+        */
+       ata_ering_clear(&dev->ering);
+}
+
 /**
  *     ata_eh_detach_dev - detach ATA device
  *     @dev: ATA device to detach
@@ -1849,7 +1879,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev,
        /* speed down? */
        if (verdict & ATA_EH_SPDN_SPEED_DOWN) {
                /* speed down SATA link speed if possible */
-               if (sata_down_spd_limit(link) == 0) {
+               if (sata_down_spd_limit(link, 0) == 0) {
                        action |= ATA_EH_RESET;
                        goto done;
                }
@@ -2601,11 +2631,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
        }
 
        if (try == max_tries - 1) {
-               sata_down_spd_limit(link);
+               sata_down_spd_limit(link, 0);
                if (slave)
-                       sata_down_spd_limit(slave);
+                       sata_down_spd_limit(slave, 0);
        } else if (rc == -EPIPE)
-               sata_down_spd_limit(failed_link);
+               sata_down_spd_limit(failed_link, 0);
 
        if (hardreset)
                reset = hardreset;
@@ -2744,6 +2774,8 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
                                                     readid_flags, dev->id);
                        switch (rc) {
                        case 0:
+                               /* clear error info accumulated during probe */
+                               ata_ering_clear(&dev->ering);
                                new_mask |= 1 << dev->devno;
                                break;
                        case -ENOENT:
@@ -2947,9 +2979,24 @@ static int ata_eh_skip_recovery(struct ata_link *link)
        return 1;
 }
 
+static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg)
+{
+       u64 interval = msecs_to_jiffies(ATA_EH_PROBE_TRIAL_INTERVAL);
+       u64 now = get_jiffies_64();
+       int *trials = void_arg;
+
+       if (ent->timestamp < now - min(now, interval))
+               return -1;
+
+       (*trials)++;
+       return 0;
+}
+
 static int ata_eh_schedule_probe(struct ata_device *dev)
 {
        struct ata_eh_context *ehc = &dev->link->eh_context;
+       struct ata_link *link = ata_dev_phys_link(dev);
+       int trials = 0;
 
        if (!(ehc->i.probe_mask & (1 << dev->devno)) ||
            (ehc->did_probe_mask & (1 << dev->devno)))
@@ -2962,6 +3009,25 @@ static int ata_eh_schedule_probe(struct ata_device *dev)
        ehc->saved_xfer_mode[dev->devno] = 0;
        ehc->saved_ncq_enabled &= ~(1 << dev->devno);
 
+       /* Record and count probe trials on the ering.  The specific
+        * error mask used is irrelevant.  Because a successful device
+        * detection clears the ering, this count accumulates only if
+        * there are consecutive failed probes.
+        *
+        * If the count is equal to or higher than ATA_EH_PROBE_TRIALS
+        * in the last ATA_EH_PROBE_TRIAL_INTERVAL, link speed is
+        * forced to 1.5Gbps.
+        *
+        * This is to work around cases where failed link speed
+        * negotiation results in device misdetection leading to
+        * infinite DEVXCHG or PHRDY CHG events.
+        */
+       ata_ering_record(&dev->ering, 0, AC_ERR_OTHER);
+       ata_ering_map(&dev->ering, ata_count_probe_trials_cb, &trials);
+
+       if (trials > ATA_EH_PROBE_TRIALS)
+               sata_down_spd_limit(link, 1);
+
        return 1;
 }
 
@@ -2969,7 +3035,11 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
 {
        struct ata_eh_context *ehc = &dev->link->eh_context;
 
-       ehc->tries[dev->devno]--;
+       /* -EAGAIN from EH routine indicates retry without prejudice.
+        * The requester is responsible for ensuring forward progress.
+        */
+       if (err != -EAGAIN)
+               ehc->tries[dev->devno]--;
 
        switch (err) {
        case -ENODEV:
@@ -2979,12 +3049,13 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
                /* give it just one more chance */
                ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1);
        case -EIO:
-               if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) {
+               if (ehc->tries[dev->devno] == 1) {
                        /* This is the last chance, better to slow
                         * down than lose it.
                         */
-                       sata_down_spd_limit(ata_dev_phys_link(dev));
-                       ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
+                       sata_down_spd_limit(ata_dev_phys_link(dev), 0);
+                       if (dev->pio_mode > XFER_PIO_0)
+                               ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
                }
        }
 
index 98ca07a2db87e22a49895e8d1bfd48c332875f49..619f2c33950e5dab2692cae7fdb3df0310310417 100644 (file)
@@ -729,7 +729,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
                if (tries) {
                        /* consecutive revalidation failures? speed down */
                        if (reval_failed)
-                               sata_down_spd_limit(link);
+                               sata_down_spd_limit(link, 0);
                        else
                                reval_failed = 1;
 
index 3c4c5ae277ba583074a2f407fe5cf25caf2b0320..b9747fa59e542866e4659c6648d2f448beb9f9a7 100644 (file)
@@ -415,6 +415,7 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
 
 /**
  *     ata_get_identity - Handler for HDIO_GET_IDENTITY ioctl
+ *     @ap: target port
  *     @sdev: SCSI device to get identify data for
  *     @arg: User buffer area for identify data
  *
index fe2839e58774f01b86b589e3aa59a9c140e0c0d2..cea8014cd87e80614765d68aa5cfee5e83e814ca 100644 (file)
@@ -79,7 +79,6 @@ extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
                           u64 block, u32 n_block, unsigned int tf_flags,
                           unsigned int tag);
 extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev);
-extern void ata_dev_disable(struct ata_device *dev);
 extern void ata_pio_queue_task(struct ata_port *ap, void *data,
                               unsigned long delay);
 extern void ata_port_flush_task(struct ata_port *ap);
@@ -100,7 +99,7 @@ extern int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags);
 extern int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
                              unsigned int readid_flags);
 extern int ata_dev_configure(struct ata_device *dev);
-extern int sata_down_spd_limit(struct ata_link *link);
+extern int sata_down_spd_limit(struct ata_link *link, u32 spd_limit);
 extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel);
 extern void ata_sg_clean(struct ata_queued_cmd *qc);
 extern void ata_qc_free(struct ata_queued_cmd *qc);
@@ -160,6 +159,7 @@ extern void ata_scsi_error(struct Scsi_Host *host);
 extern void ata_port_wait_eh(struct ata_port *ap);
 extern void ata_eh_fastdrain_timerfn(unsigned long arg);
 extern void ata_qc_schedule_eh(struct ata_queued_cmd *qc);
+extern void ata_dev_disable(struct ata_device *dev);
 extern void ata_eh_detach_dev(struct ata_device *dev);
 extern void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev,
                               unsigned int action);
index 3080f371222cd6158df812dfc2e98dc030c09a64..f1b26f7c8e4d2353cdf79b34157bfffbbfe9a1d1 100644 (file)
@@ -12,7 +12,7 @@
  *
  * Probe code based on drivers/ide/legacy/qd65xx.c
  * Rewritten from the work of Colten Edwards <pje120@cs.usask.ca> by
- * Samuel Thibault <samuel.thibault@fnac.net>
+ * Samuel Thibault <samuel.thibault@ens-lyon.org>
  */
 
 #include <linux/kernel.h>
index f2d8a020ea53cb329bc8e2c846e752a33011099f..4ae1a4138b47078072bedf2e889338e6bd8a0cb2 100644 (file)
@@ -663,8 +663,8 @@ static const struct pci_device_id mv_pci_tbl[] = {
        { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
        /* RocketRAID 1720/174x have different identifiers */
        { PCI_VDEVICE(TTI, 0x1720), chip_6042 },
-       { PCI_VDEVICE(TTI, 0x1740), chip_508x },
-       { PCI_VDEVICE(TTI, 0x1742), chip_508x },
+       { PCI_VDEVICE(TTI, 0x1740), chip_6042 },
+       { PCI_VDEVICE(TTI, 0x1742), chip_6042 },
 
        { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
        { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
index c49ad0e61b6f2550a8b3f0b84122aa6f0bc0b40b..444af0415ca167b67f91adbf6ae24a5507c78987 100644 (file)
@@ -436,11 +436,16 @@ static struct ata_port_operations nv_nf2_ops = {
        .hardreset              = nv_noclassify_hardreset,
 };
 
-/* CK804 finally gets hardreset right */
+/* For initial probing after boot and hot plugging, hardreset mostly
+ * works fine on CK804 but curiously, reprobing on the initial port by
+ * rescanning or rmmod/insmod fails to acquire the initial D2H Reg FIS
+ * in somewhat undeterministic way.  Use noclassify hardreset.
+ */
 static struct ata_port_operations nv_ck804_ops = {
        .inherits               = &nv_common_ops,
        .freeze                 = nv_ck804_freeze,
        .thaw                   = nv_ck804_thaw,
+       .hardreset              = nv_noclassify_hardreset,
        .host_stop              = nv_ck804_host_stop,
 };
 
index bfd55b085ae63f55065ca85833b2a48fa6721dd6..d0091609e210bde14a9c5eb85c0ab9f26dd3b087 100644 (file)
@@ -44,6 +44,7 @@
 #include <linux/device.h>
 #include <scsi/scsi_host.h>
 #include <linux/libata.h>
+#include <linux/dmi.h>
 
 #define DRV_NAME       "sata_sil"
 #define DRV_VERSION    "2.4"
@@ -323,7 +324,7 @@ static void sil_fill_sg(struct ata_queued_cmd *qc)
 
                prd->addr = cpu_to_le32(addr);
                prd->flags_len = cpu_to_le32(sg_len);
-               VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, sg_len);
+               VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", si, addr, sg_len);
 
                last_prd = prd;
                prd++;
index 55e530942ab0a705c452028c133e8eed15a5fdb6..f3eae630e5899707e485396b3d427255ef9964d1 100644 (file)
@@ -1280,7 +1280,7 @@ EXPORT_SYMBOL_GPL(__root_device_register);
 
 /**
  * root_device_unregister - unregister and free a root device
- * @root: device going away.
+ * @dev: device going away
  *
  * This function unregisters and cleans up a device that was created by
  * root_device_register().
index f5be8081cd8187e87a5e3d85254abefc2be1e85b..735bbe2be51aaf73819078c543320c5fc9111bbc 100644 (file)
@@ -761,7 +761,7 @@ source "drivers/char/hw_random/Kconfig"
 
 config NVRAM
        tristate "/dev/nvram support"
-       depends on ATARI || X86 || ARM || GENERIC_NVRAM
+       depends on ATARI || X86 || (ARM && RTC_DRV_CMOS) || GENERIC_NVRAM
        ---help---
          If you say Y here and create a character special file /dev/nvram
          with major number 10 and minor number 144 using mknod ("man mknod"),
index f29fbe9b8ed7f27d775902a245d5a79d34f4e515..cb8ca5698963017d03ff6ed625ec41f0d0a6c062 100644 (file)
@@ -268,7 +268,7 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t
 
        /* Allocate a new buffer before freeing the old one ... */
        multiplier = use_unicode ? 3 : 1;  /* chars can take up to 3 bytes */
-       bp = kmalloc((sel_end-sel_start)/2*multiplier+1, GFP_KERNEL);
+       bp = kmalloc(((sel_end-sel_start)/2+1)*multiplier, GFP_KERNEL);
        if (!bp) {
                printk(KERN_WARNING "selection: kmalloc() failed\n");
                clear_selection();
index b60be7b0decf277f3220898a27906ed0c4d7e79b..f146e90404fa984586513966ed3a87033e01a0b3 100644 (file)
@@ -1713,8 +1713,8 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
                for (i = 0; i < SX_NBOARDS; i++)
                        sx_dprintk(SX_DEBUG_FIRMWARE, "<%x> ", boards[i].flags);
                sx_dprintk(SX_DEBUG_FIRMWARE, "\n");
-               unlock_kernel();
-               return -EIO;
+               rc = -EIO;
+               goto out;
        }
 
        switch (cmd) {
@@ -1747,7 +1747,8 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
                break;
        case SXIO_DO_RAMTEST:
                if (sx_initialized)     /* Already initialized: better not ramtest the board.  */
-                       return -EPERM;
+                       rc = -EPERM;
+                       break;
                if (IS_SX_BOARD(board)) {
                        rc = do_memtest(board, 0, 0x7000);
                        if (!rc)
@@ -1844,6 +1845,7 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
                rc = -ENOTTY;
                break;
        }
+out:
        unlock_kernel();
        func_exit();
        return rc;
index 55433849bfa67a30a1cbddd5724f076057f476a4..33bd7534751820841d19732a5d5e79b4dea9adbf 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/device.h>
 #include <linux/dca.h>
 
-#define DCA_VERSION "1.4"
+#define DCA_VERSION "1.8"
 
 MODULE_VERSION(DCA_VERSION);
 MODULE_LICENSE("GPL");
@@ -60,16 +60,17 @@ int dca_add_requester(struct device *dev)
 {
        struct dca_provider *dca;
        int err, slot = -ENODEV;
+       unsigned long flags;
 
        if (!dev)
                return -EFAULT;
 
-       spin_lock(&dca_lock);
+       spin_lock_irqsave(&dca_lock, flags);
 
        /* check if the requester has not been added already */
        dca = dca_find_provider_by_dev(dev);
        if (dca) {
-               spin_unlock(&dca_lock);
+               spin_unlock_irqrestore(&dca_lock, flags);
                return -EEXIST;
        }
 
@@ -78,19 +79,21 @@ int dca_add_requester(struct device *dev)
                if (slot >= 0)
                        break;
        }
-       if (slot < 0) {
-               spin_unlock(&dca_lock);
+
+       spin_unlock_irqrestore(&dca_lock, flags);
+
+       if (slot < 0)
                return slot;
-       }
 
        err = dca_sysfs_add_req(dca, dev, slot);
        if (err) {
-               dca->ops->remove_requester(dca, dev);
-               spin_unlock(&dca_lock);
+               spin_lock_irqsave(&dca_lock, flags);
+               if (dca == dca_find_provider_by_dev(dev))
+                       dca->ops->remove_requester(dca, dev);
+               spin_unlock_irqrestore(&dca_lock, flags);
                return err;
        }
 
-       spin_unlock(&dca_lock);
        return 0;
 }
 EXPORT_SYMBOL_GPL(dca_add_requester);
@@ -103,25 +106,25 @@ int dca_remove_requester(struct device *dev)
 {
        struct dca_provider *dca;
        int slot;
+       unsigned long flags;
 
        if (!dev)
                return -EFAULT;
 
-       spin_lock(&dca_lock);
+       spin_lock_irqsave(&dca_lock, flags);
        dca = dca_find_provider_by_dev(dev);
        if (!dca) {
-               spin_unlock(&dca_lock);
+               spin_unlock_irqrestore(&dca_lock, flags);
                return -ENODEV;
        }
        slot = dca->ops->remove_requester(dca, dev);
-       if (slot < 0) {
-               spin_unlock(&dca_lock);
+       spin_unlock_irqrestore(&dca_lock, flags);
+
+       if (slot < 0)
                return slot;
-       }
 
        dca_sysfs_remove_req(dca, slot);
 
-       spin_unlock(&dca_lock);
        return 0;
 }
 EXPORT_SYMBOL_GPL(dca_remove_requester);
@@ -135,17 +138,18 @@ u8 dca_common_get_tag(struct device *dev, int cpu)
 {
        struct dca_provider *dca;
        u8 tag;
+       unsigned long flags;
 
-       spin_lock(&dca_lock);
+       spin_lock_irqsave(&dca_lock, flags);
 
        dca = dca_find_provider_by_dev(dev);
        if (!dca) {
-               spin_unlock(&dca_lock);
+               spin_unlock_irqrestore(&dca_lock, flags);
                return -ENODEV;
        }
        tag = dca->ops->get_tag(dca, dev, cpu);
 
-       spin_unlock(&dca_lock);
+       spin_unlock_irqrestore(&dca_lock, flags);
        return tag;
 }
 
@@ -217,11 +221,16 @@ static BLOCKING_NOTIFIER_HEAD(dca_provider_chain);
 int register_dca_provider(struct dca_provider *dca, struct device *dev)
 {
        int err;
+       unsigned long flags;
 
        err = dca_sysfs_add_provider(dca, dev);
        if (err)
                return err;
+
+       spin_lock_irqsave(&dca_lock, flags);
        list_add(&dca->node, &dca_providers);
+       spin_unlock_irqrestore(&dca_lock, flags);
+
        blocking_notifier_call_chain(&dca_provider_chain,
                                     DCA_PROVIDER_ADD, NULL);
        return 0;
@@ -234,9 +243,15 @@ EXPORT_SYMBOL_GPL(register_dca_provider);
  */
 void unregister_dca_provider(struct dca_provider *dca)
 {
+       unsigned long flags;
+
        blocking_notifier_call_chain(&dca_provider_chain,
                                     DCA_PROVIDER_REMOVE, NULL);
+
+       spin_lock_irqsave(&dca_lock, flags);
        list_del(&dca->node);
+       spin_unlock_irqrestore(&dca_lock, flags);
+
        dca_sysfs_remove_provider(dca);
 }
 EXPORT_SYMBOL_GPL(unregister_dca_provider);
index 6bd91a15d5e6a8397f9aa0988c510cb97f11df4b..a5dd7a665aa89e1551dd89653af01234a0d2adc8 100644 (file)
@@ -232,7 +232,7 @@ fw_card_bm_work(struct work_struct *work)
        root_id = root_node->node_id;
        grace = time_after(jiffies, card->reset_jiffies + DIV_ROUND_UP(HZ, 10));
 
-       if (card->bm_generation + 1 == generation ||
+       if (is_next_generation(generation, card->bm_generation) ||
            (card->bm_generation != generation && grace)) {
                /*
                 * This first step is to figure out who is IRM and
@@ -412,6 +412,7 @@ fw_card_add(struct fw_card *card,
 {
        u32 *config_rom;
        size_t length;
+       int err;
 
        card->max_receive = max_receive;
        card->link_speed = link_speed;
@@ -422,7 +423,13 @@ fw_card_add(struct fw_card *card,
        list_add_tail(&card->link, &card_list);
        mutex_unlock(&card_mutex);
 
-       return card->driver->enable(card, config_rom, length);
+       err = card->driver->enable(card, config_rom, length);
+       if (err < 0) {
+               mutex_lock(&card_mutex);
+               list_del(&card->link);
+               mutex_unlock(&card_mutex);
+       }
+       return err;
 }
 EXPORT_SYMBOL(fw_card_add);
 
@@ -512,7 +519,7 @@ fw_core_remove_card(struct fw_card *card)
        fw_core_initiate_bus_reset(card, 1);
 
        mutex_lock(&card_mutex);
-       list_del(&card->link);
+       list_del_init(&card->link);
        mutex_unlock(&card_mutex);
 
        /* Set up the dummy driver. */
index 2af5a8d1e012112ceacd08c69b50ae2c3fc202ea..bf53acb45652ad161319955204da767c0e7edfc3 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/device.h>
 #include <linux/delay.h>
 #include <linux/idr.h>
+#include <linux/jiffies.h>
 #include <linux/string.h>
 #include <linux/rwsem.h>
 #include <linux/semaphore.h>
@@ -634,12 +635,39 @@ struct fw_device *fw_device_get_by_devt(dev_t devt)
        return device;
 }
 
+/*
+ * These defines control the retry behavior for reading the config
+ * rom.  It shouldn't be necessary to tweak these; if the device
+ * doesn't respond to a config rom read within 10 seconds, it's not
+ * going to respond at all.  As for the initial delay, a lot of
+ * devices will be able to respond within half a second after bus
+ * reset.  On the other hand, it's not really worth being more
+ * aggressive than that, since it scales pretty well; if 10 devices
+ * are plugged in, they're all getting read within one second.
+ */
+
+#define MAX_RETRIES    10
+#define RETRY_DELAY    (3 * HZ)
+#define INITIAL_DELAY  (HZ / 2)
+#define SHUTDOWN_DELAY (2 * HZ)
+
 static void fw_device_shutdown(struct work_struct *work)
 {
        struct fw_device *device =
                container_of(work, struct fw_device, work.work);
        int minor = MINOR(device->device.devt);
 
+       if (time_is_after_jiffies(device->card->reset_jiffies + SHUTDOWN_DELAY)
+           && !list_empty(&device->card->link)) {
+               schedule_delayed_work(&device->work, SHUTDOWN_DELAY);
+               return;
+       }
+
+       if (atomic_cmpxchg(&device->state,
+                          FW_DEVICE_GONE,
+                          FW_DEVICE_SHUTDOWN) != FW_DEVICE_GONE)
+               return;
+
        fw_device_cdev_remove(device);
        device_for_each_child(&device->device, NULL, shutdown_unit);
        device_unregister(&device->device);
@@ -647,6 +675,7 @@ static void fw_device_shutdown(struct work_struct *work)
        down_write(&fw_device_rwsem);
        idr_remove(&fw_device_idr, minor);
        up_write(&fw_device_rwsem);
+
        fw_device_put(device);
 }
 
@@ -654,25 +683,63 @@ static struct device_type fw_device_type = {
        .release        = fw_device_release,
 };
 
+static void fw_device_update(struct work_struct *work);
+
 /*
- * These defines control the retry behavior for reading the config
- * rom.  It shouldn't be necessary to tweak these; if the device
- * doesn't respond to a config rom read within 10 seconds, it's not
- * going to respond at all.  As for the initial delay, a lot of
- * devices will be able to respond within half a second after bus
- * reset.  On the other hand, it's not really worth being more
- * aggressive than that, since it scales pretty well; if 10 devices
- * are plugged in, they're all getting read within one second.
+ * If a device was pending for deletion because its node went away but its
+ * bus info block and root directory header matches that of a newly discovered
+ * device, revive the existing fw_device.
+ * The newly allocated fw_device becomes obsolete instead.
  */
+static int lookup_existing_device(struct device *dev, void *data)
+{
+       struct fw_device *old = fw_device(dev);
+       struct fw_device *new = data;
+       struct fw_card *card = new->card;
+       int match = 0;
+
+       down_read(&fw_device_rwsem); /* serialize config_rom access */
+       spin_lock_irq(&card->lock);  /* serialize node access */
+
+       if (memcmp(old->config_rom, new->config_rom, 6 * 4) == 0 &&
+           atomic_cmpxchg(&old->state,
+                          FW_DEVICE_GONE,
+                          FW_DEVICE_RUNNING) == FW_DEVICE_GONE) {
+               struct fw_node *current_node = new->node;
+               struct fw_node *obsolete_node = old->node;
+
+               new->node = obsolete_node;
+               new->node->data = new;
+               old->node = current_node;
+               old->node->data = old;
+
+               old->max_speed = new->max_speed;
+               old->node_id = current_node->node_id;
+               smp_wmb();  /* update node_id before generation */
+               old->generation = card->generation;
+               old->config_rom_retries = 0;
+               fw_notify("rediscovered device %s\n", dev_name(dev));
 
-#define MAX_RETRIES    10
-#define RETRY_DELAY    (3 * HZ)
-#define INITIAL_DELAY  (HZ / 2)
+               PREPARE_DELAYED_WORK(&old->work, fw_device_update);
+               schedule_delayed_work(&old->work, 0);
+
+               if (current_node == card->root_node)
+                       fw_schedule_bm_work(card, 0);
+
+               match = 1;
+       }
+
+       spin_unlock_irq(&card->lock);
+       up_read(&fw_device_rwsem);
+
+       return match;
+}
 
 static void fw_device_init(struct work_struct *work)
 {
        struct fw_device *device =
                container_of(work, struct fw_device, work.work);
+       struct device *revived_dev;
        int minor, err;
 
        /*
@@ -696,6 +763,15 @@ static void fw_device_init(struct work_struct *work)
                return;
        }
 
+       revived_dev = device_find_child(device->card->device,
+                                       device, lookup_existing_device);
+       if (revived_dev) {
+               put_device(revived_dev);
+               fw_device_release(&device->device);
+
+               return;
+       }
+
        device_initialize(&device->device);
 
        fw_device_get(device);
@@ -734,9 +810,10 @@ static void fw_device_init(struct work_struct *work)
         * fw_node_event().
         */
        if (atomic_cmpxchg(&device->state,
-                   FW_DEVICE_INITIALIZING,
-                   FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN) {
-               fw_device_shutdown(work);
+                          FW_DEVICE_INITIALIZING,
+                          FW_DEVICE_RUNNING) == FW_DEVICE_GONE) {
+               PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown);
+               schedule_delayed_work(&device->work, SHUTDOWN_DELAY);
        } else {
                if (device->config_rom_retries)
                        fw_notify("created device %s: GUID %08x%08x, S%d00, "
@@ -847,8 +924,8 @@ static void fw_device_refresh(struct work_struct *work)
 
        case REREAD_BIB_UNCHANGED:
                if (atomic_cmpxchg(&device->state,
-                           FW_DEVICE_INITIALIZING,
-                           FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN)
+                                  FW_DEVICE_INITIALIZING,
+                                  FW_DEVICE_RUNNING) == FW_DEVICE_GONE)
                        goto gone;
 
                fw_device_update(work);
@@ -879,8 +956,8 @@ static void fw_device_refresh(struct work_struct *work)
        create_units(device);
 
        if (atomic_cmpxchg(&device->state,
-                   FW_DEVICE_INITIALIZING,
-                   FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN)
+                          FW_DEVICE_INITIALIZING,
+                          FW_DEVICE_RUNNING) == FW_DEVICE_GONE)
                goto gone;
 
        fw_notify("refreshed device %s\n", dev_name(&device->device));
@@ -890,8 +967,9 @@ static void fw_device_refresh(struct work_struct *work)
  give_up:
        fw_notify("giving up on refresh of device %s\n", dev_name(&device->device));
  gone:
-       atomic_set(&device->state, FW_DEVICE_SHUTDOWN);
-       fw_device_shutdown(work);
+       atomic_set(&device->state, FW_DEVICE_GONE);
+       PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown);
+       schedule_delayed_work(&device->work, SHUTDOWN_DELAY);
  out:
        if (node_id == card->root_node->node_id)
                fw_schedule_bm_work(card, 0);
@@ -995,9 +1073,10 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
                 */
                device = node->data;
                if (atomic_xchg(&device->state,
-                               FW_DEVICE_SHUTDOWN) == FW_DEVICE_RUNNING) {
+                               FW_DEVICE_GONE) == FW_DEVICE_RUNNING) {
                        PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown);
-                       schedule_delayed_work(&device->work, 0);
+                       schedule_delayed_work(&device->work,
+                               list_empty(&card->link) ? 0 : SHUTDOWN_DELAY);
                }
                break;
        }
index df51732608d96270a86611c541aaec8cdb7a2150..8ef6ec2ca21cbc43288affa50a9cea19e7fbd5ae 100644 (file)
@@ -28,6 +28,7 @@
 enum fw_device_state {
        FW_DEVICE_INITIALIZING,
        FW_DEVICE_RUNNING,
+       FW_DEVICE_GONE,
        FW_DEVICE_SHUTDOWN,
 };
 
index ab9c01e462ef64a197c72250fed471b361477f02..6d19828a93a5a458e8254a1d33b4bd3d5fd59f0a 100644 (file)
@@ -226,7 +226,7 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card)
 #define CONTEXT_DEAD   0x0800
 #define CONTEXT_ACTIVE 0x0400
 
-#define OHCI1394_MAX_AT_REQ_RETRIES    0x2
+#define OHCI1394_MAX_AT_REQ_RETRIES    0xf
 #define OHCI1394_MAX_AT_RESP_RETRIES   0x2
 #define OHCI1394_MAX_PHYS_RESP_RETRIES 0x8
 
@@ -896,11 +896,11 @@ static void context_stop(struct context *ctx)
        for (i = 0; i < 10; i++) {
                reg = reg_read(ctx->ohci, CONTROL_SET(ctx->regs));
                if ((reg & CONTEXT_ACTIVE) == 0)
-                       break;
+                       return;
 
-               fw_notify("context_stop: still active (0x%08x)\n", reg);
                mdelay(1);
        }
+       fw_error("Error: DMA context still active (0x%08x)\n", reg);
 }
 
 struct driver_data {
index e88d5067448c8039d6107f171612c7d3add58e0d..c71c4419d9e82bd0cdaa07b591f7b6c722b5d1de 100644 (file)
@@ -168,6 +168,7 @@ struct sbp2_target {
        int address_high;
        unsigned int workarounds;
        unsigned int mgt_orb_timeout;
+       unsigned int max_payload;
 
        int dont_block; /* counter for each logical unit */
        int blocked;    /* ditto */
@@ -310,14 +311,16 @@ struct sbp2_command_orb {
        dma_addr_t page_table_bus;
 };
 
+#define SBP2_ROM_VALUE_WILDCARD ~0         /* match all */
+#define SBP2_ROM_VALUE_MISSING  0xff000000 /* not present in the unit dir. */
+
 /*
  * List of devices with known bugs.
  *
  * The firmware_revision field, masked with 0xffff00, is the best
  * indicator for the type of bridge chip of a device.  It yields a few
  * false positives but this did not break correctly behaving devices
- * so far.  We use ~0 as a wildcard, since the 24 bit values we get
- * from the config rom can never match that.
+ * so far.
  */
 static const struct {
        u32 firmware_revision;
@@ -339,33 +342,35 @@ static const struct {
        },
        /* Initio bridges, actually only needed for some older ones */ {
                .firmware_revision      = 0x000200,
-               .model                  = ~0,
+               .model                  = SBP2_ROM_VALUE_WILDCARD,
                .workarounds            = SBP2_WORKAROUND_INQUIRY_36,
        },
        /* PL-3507 bridge with Prolific firmware */ {
                .firmware_revision      = 0x012800,
-               .model                  = ~0,
+               .model                  = SBP2_ROM_VALUE_WILDCARD,
                .workarounds            = SBP2_WORKAROUND_POWER_CONDITION,
        },
        /* Symbios bridge */ {
                .firmware_revision      = 0xa0b800,
-               .model                  = ~0,
+               .model                  = SBP2_ROM_VALUE_WILDCARD,
                .workarounds            = SBP2_WORKAROUND_128K_MAX_TRANS,
        },
        /* Datafab MD2-FW2 with Symbios/LSILogic SYM13FW500 bridge */ {
                .firmware_revision      = 0x002600,
-               .model                  = ~0,
+               .model                  = SBP2_ROM_VALUE_WILDCARD,
                .workarounds            = SBP2_WORKAROUND_128K_MAX_TRANS,
        },
-
        /*
-        * There are iPods (2nd gen, 3rd gen) with model_id == 0, but
-        * these iPods do not feature the read_capacity bug according
-        * to one report.  Read_capacity behaviour as well as model_id
-        * could change due to Apple-supplied firmware updates though.
+        * iPod 2nd generation: needs 128k max transfer size workaround
+        * iPod 3rd generation: needs fix capacity workaround
         */
-
-       /* iPod 4th generation. */ {
+       {
+               .firmware_revision      = 0x0a2700,
+               .model                  = 0x000000,
+               .workarounds            = SBP2_WORKAROUND_128K_MAX_TRANS |
+                                         SBP2_WORKAROUND_FIX_CAPACITY,
+       },
+       /* iPod 4th generation */ {
                .firmware_revision      = 0x0a2700,
                .model                  = 0x000021,
                .workarounds            = SBP2_WORKAROUND_FIX_CAPACITY,
@@ -1092,7 +1097,7 @@ static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model,
                        continue;
 
                if (sbp2_workarounds_table[i].model != model &&
-                   sbp2_workarounds_table[i].model != ~0)
+                   sbp2_workarounds_table[i].model != SBP2_ROM_VALUE_WILDCARD)
                        continue;
 
                w |= sbp2_workarounds_table[i].workarounds;
@@ -1142,20 +1147,28 @@ static int sbp2_probe(struct device *dev)
        fw_device_get(device);
        fw_unit_get(unit);
 
-       /* Initialize to values that won't match anything in our table. */
-       firmware_revision = 0xff000000;
-       model = 0xff000000;
-
        /* implicit directory ID */
        tgt->directory_id = ((unit->directory - device->config_rom) * 4
                             + CSR_CONFIG_ROM) & 0xffffff;
 
+       firmware_revision = SBP2_ROM_VALUE_MISSING;
+       model             = SBP2_ROM_VALUE_MISSING;
+
        if (sbp2_scan_unit_dir(tgt, unit->directory, &model,
                               &firmware_revision) < 0)
                goto fail_tgt_put;
 
        sbp2_init_workarounds(tgt, model, firmware_revision);
 
+       /*
+        * At S100 we can do 512 bytes per packet, at S200 1024 bytes,
+        * and so on up to 4096 bytes.  The SBP-2 max_payload field
+        * specifies the max payload size as 2 ^ (max_payload + 2), so
+        * if we set this to max_speed + 7, we get the right value.
+        */
+       tgt->max_payload = min(device->max_speed + 7, 10U);
+       tgt->max_payload = min(tgt->max_payload, device->card->max_receive - 1);
+
        /* Do the login in a workqueue so we can easily reschedule retries. */
        list_for_each_entry(lu, &tgt->lu_list, link)
                sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
@@ -1273,6 +1286,19 @@ static struct fw_driver sbp2_driver = {
        .id_table = sbp2_id_table,
 };
 
+static void sbp2_unmap_scatterlist(struct device *card_device,
+                                  struct sbp2_command_orb *orb)
+{
+       if (scsi_sg_count(orb->cmd))
+               dma_unmap_sg(card_device, scsi_sglist(orb->cmd),
+                            scsi_sg_count(orb->cmd),
+                            orb->cmd->sc_data_direction);
+
+       if (orb->request.misc & cpu_to_be32(COMMAND_ORB_PAGE_TABLE_PRESENT))
+               dma_unmap_single(card_device, orb->page_table_bus,
+                                sizeof(orb->page_table), DMA_TO_DEVICE);
+}
+
 static unsigned int
 sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data)
 {
@@ -1352,15 +1378,7 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
 
        dma_unmap_single(device->card->device, orb->base.request_bus,
                         sizeof(orb->request), DMA_TO_DEVICE);
-
-       if (scsi_sg_count(orb->cmd) > 0)
-               dma_unmap_sg(device->card->device, scsi_sglist(orb->cmd),
-                            scsi_sg_count(orb->cmd),
-                            orb->cmd->sc_data_direction);
-
-       if (orb->page_table_bus != 0)
-               dma_unmap_single(device->card->device, orb->page_table_bus,
-                                sizeof(orb->page_table), DMA_TO_DEVICE);
+       sbp2_unmap_scatterlist(device->card->device, orb);
 
        orb->cmd->result = result;
        orb->done(orb->cmd);
@@ -1434,7 +1452,6 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
        struct sbp2_logical_unit *lu = cmd->device->hostdata;
        struct fw_device *device = fw_device(lu->tgt->unit->device.parent);
        struct sbp2_command_orb *orb;
-       unsigned int max_payload;
        int generation, retval = SCSI_MLQUEUE_HOST_BUSY;
 
        /*
@@ -1462,17 +1479,9 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
        orb->done = done;
        orb->cmd  = cmd;
 
-       orb->request.next.high   = cpu_to_be32(SBP2_ORB_NULL);
-       /*
-        * At speed 100 we can do 512 bytes per packet, at speed 200,
-        * 1024 bytes per packet etc.  The SBP-2 max_payload field
-        * specifies the max payload size as 2 ^ (max_payload + 2), so
-        * if we set this to max_speed + 7, we get the right value.
-        */
-       max_payload = min(device->max_speed + 7,
-                         device->card->max_receive - 1);
+       orb->request.next.high = cpu_to_be32(SBP2_ORB_NULL);
        orb->request.misc = cpu_to_be32(
-               COMMAND_ORB_MAX_PAYLOAD(max_payload) |
+               COMMAND_ORB_MAX_PAYLOAD(lu->tgt->max_payload) |
                COMMAND_ORB_SPEED(device->max_speed) |
                COMMAND_ORB_NOTIFY);
 
@@ -1491,8 +1500,10 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
        orb->base.request_bus =
                dma_map_single(device->card->device, &orb->request,
                               sizeof(orb->request), DMA_TO_DEVICE);
-       if (dma_mapping_error(device->card->device, orb->base.request_bus))
+       if (dma_mapping_error(device->card->device, orb->base.request_bus)) {
+               sbp2_unmap_scatterlist(device->card->device, orb);
                goto out;
+       }
 
        sbp2_send_orb(&orb->base, lu, lu->tgt->node_id, generation,
                      lu->command_block_agent_address + SBP2_ORB_POINTER);
index c9be6e6948c4aec745e71a3cd25e4990ebf65f57..8dd6703b55cd00702f64f84272d3d523d7112ec6 100644 (file)
@@ -518,6 +518,18 @@ fw_core_handle_bus_reset(struct fw_card *card,
        struct fw_node *local_node;
        unsigned long flags;
 
+       /*
+        * If the selfID buffer is not the immediate successor of the
+        * previously processed one, we cannot reliably compare the
+        * old and new topologies.
+        */
+       if (!is_next_generation(generation, card->generation) &&
+           card->local_node != NULL) {
+               fw_notify("skipped bus generations, destroying all nodes\n");
+               fw_destroy_nodes(card);
+               card->bm_retries = 0;
+       }
+
        spin_lock_irqsave(&card->lock, flags);
 
        card->node_id = node_id;
index c9ab12a15f6eb2974fd65e9b98b3e41d3c72faa0..1d78e9cc5940a5a2c51be2c8724157bd25b5369f 100644 (file)
@@ -275,6 +275,15 @@ static inline void fw_card_put(struct fw_card *card)
 
 extern void fw_schedule_bm_work(struct fw_card *card, unsigned long delay);
 
+/*
+ * Check whether new_generation is the immediate successor of old_generation.
+ * Take counter roll-over at 255 (as per to OHCI) into account.
+ */
+static inline bool is_next_generation(int new_generation, int old_generation)
+{
+       return (new_generation & 0xff) == ((old_generation + 1) & 0xff);
+}
+
 /*
  * The iso packet format allows for an immediate header/payload part
  * stored in 'header' immediately after the packet info plus an
index 35e7aea4222c478ffc9b93263a339fd0526ab201..42fb2fd24c0c03cd20b21dab5038fde07d3be30c 100644 (file)
@@ -789,6 +789,7 @@ int gpio_request(unsigned gpio, const char *label)
        } else {
                status = -EBUSY;
                module_put(chip->owner);
+               goto done;
        }
 
        if (chip->request) {
index 9da5814528749a82b4ef12a1b13134d34635557b..6915fb82d0b0ea6aaa4a5c82b1ac5cf61b572e74 100644 (file)
@@ -136,7 +136,7 @@ drm_gem_object_alloc(struct drm_device *dev, size_t size)
        obj = kcalloc(1, sizeof(*obj), GFP_KERNEL);
 
        obj->dev = dev;
-       obj->filp = shmem_file_setup("drm mm object", size, 0);
+       obj->filp = shmem_file_setup("drm mm object", size, VM_NORESERVE);
        if (IS_ERR(obj->filp)) {
                kfree(obj);
                return NULL;
index 6b1148fc2cbebeb0999f5b597bde87a44b97c8c3..b36a5214d8dfafe32767990d34cf61362e16ffb3 100644 (file)
@@ -311,7 +311,7 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
        if (dev_priv->panel_fixed_mode != NULL) {
                struct drm_display_mode *mode;
 
-               mutex_unlock(&dev->mode_config.mutex);
+               mutex_lock(&dev->mode_config.mutex);
                mode = drm_mode_duplicate(dev, dev_priv->panel_fixed_mode);
                drm_mode_probed_add(connector, mode);
                mutex_unlock(&dev->mode_config.mutex);
index 5d7640e49dc5a8c126902954d716896058f70bcc..6cad69ed21c558c908b68fb9751a381a92cf0eae 100644 (file)
@@ -1218,6 +1218,7 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
 }
 EXPORT_SYMBOL_GPL(hid_connect);
 
+/* a list of devices for which there is a specialized driver on HID bus */
 static const struct hid_device_id hid_blacklist[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
        { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
@@ -1476,6 +1477,7 @@ static struct bus_type hid_bus_type = {
        .uevent         = hid_uevent,
 };
 
+/* a list of devices that shouldn't be handled by HID core at all */
 static const struct hid_device_id hid_ignore_list[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302) },
@@ -1606,6 +1608,8 @@ static const struct hid_device_id hid_ignore_list[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD4) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD5) },
        { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) },
        { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) },
        { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
index acc1abc834a471e1cf61789950a027b8c6c1e7ab..e899f510ebeb5c474c1e682f874559ea9f690e79 100644 (file)
 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD      0x0038
 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2     0x0036
 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3     0x0034
+#define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD4     0x0044
+#define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD5     0x0045
 
 #define USB_VENDOR_ID_SUN              0x0430
 #define USB_DEVICE_ID_RARITAN_KVM_DONGLE       0xcdab
index d718b1607d0f78f505419b911a0fb86df62e1e17..25b10dcad90d52c38dce6069397a1df19f13c8d0 100644 (file)
@@ -30,7 +30,7 @@
 #define MS_NOGET       0x10
 
 /*
- * Microsoft Wireless Desktop Receiver (Model 1028) has several
+ * Microsoft Wireless Desktop Receiver (Model 1028) has
  * 'Usage Min/Max' where it ought to have 'Physical Min/Max'
  */
 static void ms_report_fixup(struct hid_device *hdev, __u8 *rdesc,
@@ -38,17 +38,12 @@ static void ms_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 {
        unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
 
-       if ((quirks & MS_RDESC) && rsize == 571 && rdesc[284] == 0x19 &&
-                       rdesc[286] == 0x2a && rdesc[304] == 0x19 &&
-                       rdesc[306] == 0x29 && rdesc[352] == 0x1a &&
-                       rdesc[355] == 0x2a && rdesc[557] == 0x19 &&
+       if ((quirks & MS_RDESC) && rsize == 571 && rdesc[557] == 0x19 &&
                        rdesc[559] == 0x29) {
                dev_info(&hdev->dev, "fixing up Microsoft Wireless Receiver "
                                "Model 1028 report descriptor\n");
-               rdesc[284] = rdesc[304] = rdesc[557] = 0x35;
-               rdesc[352] = 0x36;
-               rdesc[286] = rdesc[355] = 0x46;
-               rdesc[306] = rdesc[559] = 0x45;
+               rdesc[557] = 0x35;
+               rdesc[559] = 0x45;
        }
 }
 
index d73eea382ab3879c93a0c74db2833d47ead87f6f..4940e4d70c2d1ef6ef02804cc45222c7e5201c60 100644 (file)
@@ -656,7 +656,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
        case HIDIOCGSTRING:
                mutex_lock(&hiddev->existancelock);
-               if (!hiddev->exist)
+               if (hiddev->exist)
                        r = hiddev_ioctl_string(hiddev, cmd, user_arg);
                else
                        r = -ENODEV;
index e301862365889e1e2750d1514807a45d6489644b..678e34b01e524d9c20fbe99b8c5473e1135a40db 100644 (file)
@@ -83,7 +83,7 @@
 /*
  * Temperature sensors keys (sp78 - 2 bytes).
  */
-static const char* temperature_sensors_sets[][36] = {
+static const char *temperature_sensors_sets[][41] = {
 /* Set 0: Macbook Pro */
        { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H",
          "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL },
@@ -135,6 +135,13 @@ static const char* temperature_sensors_sets[][36] = {
        { "TB0T", "TB1S", "TB1T", "TB2S", "TB2T", "TC0D", "TN0D", "TTF0",
          "TV0P", "TVFP", "TW0P", "Th0P", "Tp0P", "Tp1P", "TpFP", "Ts0P",
          "Ts0S", NULL },
+/* Set 16: Mac Pro 3,1 (2 x Quad-Core) */
+       { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P",
+         "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "TH0P", "TH1P",
+         "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S", "TM1P",
+         "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P", "TM9S",
+         "TN0C", "TN0D", "TN0H", "TS0C", "Tp0C", "Tp1C", "Tv0S", "Tv1S",
+         NULL },
 };
 
 /* List of keys used to read/write fan speeds */
@@ -1153,6 +1160,16 @@ static SENSOR_DEVICE_ATTR(temp34_input, S_IRUGO,
                                        applesmc_show_temperature, NULL, 33);
 static SENSOR_DEVICE_ATTR(temp35_input, S_IRUGO,
                                        applesmc_show_temperature, NULL, 34);
+static SENSOR_DEVICE_ATTR(temp36_input, S_IRUGO,
+                                       applesmc_show_temperature, NULL, 35);
+static SENSOR_DEVICE_ATTR(temp37_input, S_IRUGO,
+                                       applesmc_show_temperature, NULL, 36);
+static SENSOR_DEVICE_ATTR(temp38_input, S_IRUGO,
+                                       applesmc_show_temperature, NULL, 37);
+static SENSOR_DEVICE_ATTR(temp39_input, S_IRUGO,
+                                       applesmc_show_temperature, NULL, 38);
+static SENSOR_DEVICE_ATTR(temp40_input, S_IRUGO,
+                                       applesmc_show_temperature, NULL, 39);
 
 static struct attribute *temperature_attributes[] = {
        &sensor_dev_attr_temp1_input.dev_attr.attr,
@@ -1190,6 +1207,11 @@ static struct attribute *temperature_attributes[] = {
        &sensor_dev_attr_temp33_input.dev_attr.attr,
        &sensor_dev_attr_temp34_input.dev_attr.attr,
        &sensor_dev_attr_temp35_input.dev_attr.attr,
+       &sensor_dev_attr_temp36_input.dev_attr.attr,
+       &sensor_dev_attr_temp37_input.dev_attr.attr,
+       &sensor_dev_attr_temp38_input.dev_attr.attr,
+       &sensor_dev_attr_temp39_input.dev_attr.attr,
+       &sensor_dev_attr_temp40_input.dev_attr.attr,
        NULL
 };
 
@@ -1312,6 +1334,8 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = {
        { .accelerometer = 0, .light = 0, .temperature_set = 14 },
 /* MacBook Air 2,1: accelerometer, backlight and temperature set 15 */
        { .accelerometer = 1, .light = 1, .temperature_set = 15 },
+/* MacPro3,1: temperature set 16 */
+       { .accelerometer = 0, .light = 0, .temperature_set = 16 },
 };
 
 /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
@@ -1369,6 +1393,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
          DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
          DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") },
                &applesmc_dmi_data[4]},
+       { applesmc_dmi_match, "Apple MacPro3", {
+         DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
+         DMI_MATCH(DMI_PRODUCT_NAME, "MacPro3") },
+               &applesmc_dmi_data[16]},
        { applesmc_dmi_match, "Apple MacPro", {
          DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
          DMI_MATCH(DMI_PRODUCT_NAME, "MacPro") },
index 03705240000f7755e9773d6ec0492a3a2a27f63b..abf4dfc8ec229c874b286acb4942278c50a138c1 100644 (file)
@@ -153,7 +153,10 @@ static struct axis_conversion lis3lv02d_axis_y_inverted = {1, -2, 3};
 static struct axis_conversion lis3lv02d_axis_x_inverted = {-1, 2, 3};
 static struct axis_conversion lis3lv02d_axis_z_inverted = {1, 2, -3};
 static struct axis_conversion lis3lv02d_axis_xy_rotated_left = {-2, 1, 3};
+static struct axis_conversion lis3lv02d_axis_xy_rotated_left_usd = {-2, 1, -3};
 static struct axis_conversion lis3lv02d_axis_xy_swap_inverted = {-2, -1, 3};
+static struct axis_conversion lis3lv02d_axis_xy_rotated_right = {2, -1, 3};
+static struct axis_conversion lis3lv02d_axis_xy_swap_yz_inverted = {2, -1, -3};
 
 #define AXIS_DMI_MATCH(_ident, _name, _axis) {         \
        .ident = _ident,                                \
@@ -172,10 +175,12 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
        AXIS_DMI_MATCH("NC2510", "HP Compaq 2510", y_inverted),
        AXIS_DMI_MATCH("NC8510", "HP Compaq 8510", xy_swap_inverted),
        AXIS_DMI_MATCH("HP2133", "HP 2133", xy_rotated_left),
+       AXIS_DMI_MATCH("NC653x", "HP Compaq 653", xy_rotated_left_usd),
+       AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd),
+       AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right),
+       AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted),
        { NULL, }
 /* Laptop models without axis info (yet):
- * "NC651xx" "HP Compaq 651"
- * "NC671xx" "HP Compaq 671"
  * "NC6910" "HP Compaq 6910"
  * HP Compaq 8710x Notebook PC / Mobile Workstation
  * "NC2400" "HP Compaq nc2400"
index b1c6f68d98ced4b48388d7d90268f1cfff91498f..3dad2299d9c57e9b22ec420bb180c93d975b1e77 100644 (file)
@@ -465,6 +465,16 @@ config BLK_DEV_CS5535
 
          It is safe to say Y to this question.
 
+config BLK_DEV_CS5536
+       tristate "CS5536 chipset support"
+       depends on X86_32
+       select BLK_DEV_IDEDMA_PCI
+       help
+         This option enables support for the AMD CS5536
+         companion chip used with the Geode LX processor family.
+
+         If unsure, say N.
+
 config BLK_DEV_HPT366
        tristate "HPT36X/37X chipset support"
        select BLK_DEV_IDEDMA_PCI
index c2b9c93f009511f5b6f6780f0bfd9e8199a28e7e..d0e3d7d5b4672bf9874a1832b7fff2aaf5239007 100644 (file)
@@ -43,6 +43,7 @@ obj-$(CONFIG_BLK_DEV_CMD64X)          += cmd64x.o
 obj-$(CONFIG_BLK_DEV_CS5520)           += cs5520.o
 obj-$(CONFIG_BLK_DEV_CS5530)           += cs5530.o
 obj-$(CONFIG_BLK_DEV_CS5535)           += cs5535.o
+obj-$(CONFIG_BLK_DEV_CS5536)           += cs5536.o
 obj-$(CONFIG_BLK_DEV_SC1200)           += sc1200.o
 obj-$(CONFIG_BLK_DEV_CY82C693)         += cy82c693.o
 obj-$(CONFIG_BLK_DEV_DELKIN)           += delkin_cb.o
diff --git a/drivers/ide/cs5536.c b/drivers/ide/cs5536.c
new file mode 100644 (file)
index 0000000..7a62db7
--- /dev/null
@@ -0,0 +1,308 @@
+/*
+ * CS5536 PATA support
+ * (C) 2007 Martin K. Petersen <mkp@mkp.net>
+ * (C) 2009 Bartlomiej Zolnierkiewicz
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Documentation:
+ *     Available from AMD web site.
+ *
+ * The IDE timing registers for the CS5536 live in the Geode Machine
+ * Specific Register file and not PCI config space.  Most BIOSes
+ * virtualize the PCI registers so the chip looks like a standard IDE
+ * controller.  Unfortunately not all implementations get this right.
+ * In particular some have problems with unaligned accesses to the
+ * virtualized PCI registers.  This driver always does full dword
+ * writes to work around the issue.  Also, in case of a bad BIOS this
+ * driver can be loaded with the "msr=1" parameter which forces using
+ * the Machine Specific Registers to configure the device.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/init.h>
+#include <linux/ide.h>
+#include <asm/msr.h>
+
+#define DRV_NAME       "cs5536"
+
+enum {
+       MSR_IDE_CFG             = 0x51300010,
+       PCI_IDE_CFG             = 0x40,
+
+       CFG                     = 0,
+       DTC                     = 2,
+       CAST                    = 3,
+       ETC                     = 4,
+
+       IDE_CFG_CHANEN          = (1 << 1),
+       IDE_CFG_CABLE           = (1 << 17) | (1 << 16),
+
+       IDE_D0_SHIFT            = 24,
+       IDE_D1_SHIFT            = 16,
+       IDE_DRV_MASK            = 0xff,
+
+       IDE_CAST_D0_SHIFT       = 6,
+       IDE_CAST_D1_SHIFT       = 4,
+       IDE_CAST_DRV_MASK       = 0x3,
+
+       IDE_CAST_CMD_SHIFT      = 24,
+       IDE_CAST_CMD_MASK       = 0xff,
+
+       IDE_ETC_UDMA_MASK       = 0xc0,
+};
+
+static int use_msr;
+
+static int cs5536_read(struct pci_dev *pdev, int reg, u32 *val)
+{
+       if (unlikely(use_msr)) {
+               u32 dummy;
+
+               rdmsr(MSR_IDE_CFG + reg, *val, dummy);
+               return 0;
+       }
+
+       return pci_read_config_dword(pdev, PCI_IDE_CFG + reg * 4, val);
+}
+
+static int cs5536_write(struct pci_dev *pdev, int reg, int val)
+{
+       if (unlikely(use_msr)) {
+               wrmsr(MSR_IDE_CFG + reg, val, 0);
+               return 0;
+       }
+
+       return pci_write_config_dword(pdev, PCI_IDE_CFG + reg * 4, val);
+}
+
+static void cs5536_program_dtc(ide_drive_t *drive, u8 tim)
+{
+       struct pci_dev *pdev = to_pci_dev(drive->hwif->dev);
+       int dshift = (drive->dn & 1) ? IDE_D1_SHIFT : IDE_D0_SHIFT;
+       u32 dtc;
+
+       cs5536_read(pdev, DTC, &dtc);
+       dtc &= ~(IDE_DRV_MASK << dshift);
+       dtc |= tim << dshift;
+       cs5536_write(pdev, DTC, dtc);
+}
+
+/**
+ *     cs5536_cable_detect     -       detect cable type
+ *     @hwif: Port to detect on
+ *
+ *     Perform cable detection for ATA66 capable cable.
+ *
+ *     Returns a cable type.
+ */
+
+static u8 cs5536_cable_detect(ide_hwif_t *hwif)
+{
+       struct pci_dev *pdev = to_pci_dev(hwif->dev);
+       u32 cfg;
+
+       cs5536_read(pdev, CFG, &cfg);
+
+       if (cfg & IDE_CFG_CABLE)
+               return ATA_CBL_PATA80;
+       else
+               return ATA_CBL_PATA40;
+}
+
+/**
+ *     cs5536_set_pio_mode             -       PIO timing setup
+ *     @drive: ATA device
+ *     @pio: PIO mode number
+ */
+
+static void cs5536_set_pio_mode(ide_drive_t *drive, const u8 pio)
+{
+       static const u8 drv_timings[5] = {
+               0x98, 0x55, 0x32, 0x21, 0x20,
+       };
+
+       static const u8 addr_timings[5] = {
+               0x2, 0x1, 0x0, 0x0, 0x0,
+       };
+
+       static const u8 cmd_timings[5] = {
+               0x99, 0x92, 0x90, 0x22, 0x20,
+       };
+
+       struct pci_dev *pdev = to_pci_dev(drive->hwif->dev);
+       ide_drive_t *pair = ide_get_pair_dev(drive);
+       int cshift = (drive->dn & 1) ? IDE_CAST_D1_SHIFT : IDE_CAST_D0_SHIFT;
+       u32 cast;
+       u8 cmd_pio = pio;
+
+       if (pair)
+               cmd_pio = min(pio, ide_get_best_pio_mode(pair, 255, 4));
+
+       drive->drive_data &= (IDE_DRV_MASK << 8);
+       drive->drive_data |= drv_timings[pio];
+
+       cs5536_program_dtc(drive, drv_timings[pio]);
+
+       cs5536_read(pdev, CAST, &cast);
+
+       cast &= ~(IDE_CAST_DRV_MASK << cshift);
+       cast |= addr_timings[pio] << cshift;
+
+       cast &= ~(IDE_CAST_CMD_MASK << IDE_CAST_CMD_SHIFT);
+       cast |= cmd_timings[cmd_pio] << IDE_CAST_CMD_SHIFT;
+
+       cs5536_write(pdev, CAST, cast);
+}
+
+/**
+ *     cs5536_set_dma_mode             -       DMA timing setup
+ *     @drive: ATA device
+ *     @mode: DMA mode
+ */
+
+static void cs5536_set_dma_mode(ide_drive_t *drive, const u8 mode)
+{
+       static const u8 udma_timings[6] = {
+               0xc2, 0xc1, 0xc0, 0xc4, 0xc5, 0xc6,
+       };
+
+       static const u8 mwdma_timings[3] = {
+               0x67, 0x21, 0x20,
+       };
+
+       struct pci_dev *pdev = to_pci_dev(drive->hwif->dev);
+       int dshift = (drive->dn & 1) ? IDE_D1_SHIFT : IDE_D0_SHIFT;
+       u32 etc;
+
+       cs5536_read(pdev, ETC, &etc);
+
+       if (mode >= XFER_UDMA_0) {
+               etc &= ~(IDE_DRV_MASK << dshift);
+               etc |= udma_timings[mode - XFER_UDMA_0] << dshift;
+       } else { /* MWDMA */
+               etc &= ~(IDE_ETC_UDMA_MASK << dshift);
+               drive->drive_data &= IDE_DRV_MASK;
+               drive->drive_data |= mwdma_timings[mode - XFER_MW_DMA_0] << 8;
+       }
+
+       cs5536_write(pdev, ETC, etc);
+}
+
+static void cs5536_dma_start(ide_drive_t *drive)
+{
+       if (drive->current_speed < XFER_UDMA_0 &&
+           (drive->drive_data >> 8) != (drive->drive_data & IDE_DRV_MASK))
+               cs5536_program_dtc(drive, drive->drive_data >> 8);
+
+       ide_dma_start(drive);
+}
+
+static int cs5536_dma_end(ide_drive_t *drive)
+{
+       int ret = ide_dma_end(drive);
+
+       if (drive->current_speed < XFER_UDMA_0 &&
+           (drive->drive_data >> 8) != (drive->drive_data & IDE_DRV_MASK))
+               cs5536_program_dtc(drive, drive->drive_data & IDE_DRV_MASK);
+
+       return ret;
+}
+
+static const struct ide_port_ops cs5536_port_ops = {
+       .set_pio_mode           = cs5536_set_pio_mode,
+       .set_dma_mode           = cs5536_set_dma_mode,
+       .cable_detect           = cs5536_cable_detect,
+};
+
+static const struct ide_dma_ops cs5536_dma_ops = {
+       .dma_host_set           = ide_dma_host_set,
+       .dma_setup              = ide_dma_setup,
+       .dma_exec_cmd           = ide_dma_exec_cmd,
+       .dma_start              = cs5536_dma_start,
+       .dma_end                = cs5536_dma_end,
+       .dma_test_irq           = ide_dma_test_irq,
+       .dma_lost_irq           = ide_dma_lost_irq,
+       .dma_timeout            = ide_dma_timeout,
+};
+
+static const struct ide_port_info cs5536_info = {
+       .name           = DRV_NAME,
+       .port_ops       = &cs5536_port_ops,
+       .dma_ops        = &cs5536_dma_ops,
+       .host_flags     = IDE_HFLAG_SINGLE,
+       .pio_mask       = ATA_PIO4,
+       .mwdma_mask     = ATA_MWDMA2,
+       .udma_mask      = ATA_UDMA5,
+};
+
+/**
+ *     cs5536_init_one
+ *     @dev: PCI device
+ *     @id: Entry in match table
+ */
+
+static int cs5536_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+{
+       u32 cfg;
+
+       if (use_msr)
+               printk(KERN_INFO DRV_NAME ": Using MSR regs instead of PCI\n");
+
+       cs5536_read(dev, CFG, &cfg);
+
+       if ((cfg & IDE_CFG_CHANEN) == 0) {
+               printk(KERN_ERR DRV_NAME ": disabled by BIOS\n");
+               return -ENODEV;
+       }
+
+       return ide_pci_init_one(dev, &cs5536_info, NULL);
+}
+
+static const struct pci_device_id cs5536_pci_tbl[] = {
+       { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), },
+       { },
+};
+
+static struct pci_driver cs5536_pci_driver = {
+       .name           = DRV_NAME,
+       .id_table       = cs5536_pci_tbl,
+       .probe          = cs5536_init_one,
+       .remove         = ide_pci_remove,
+       .suspend        = ide_pci_suspend,
+       .resume         = ide_pci_resume,
+};
+
+static int __init cs5536_init(void)
+{
+       return pci_register_driver(&cs5536_pci_driver);
+}
+
+static void __exit cs5536_exit(void)
+{
+       pci_unregister_driver(&cs5536_pci_driver);
+}
+
+MODULE_AUTHOR("Martin K. Petersen, Bartlomiej Zolnierkiewicz");
+MODULE_DESCRIPTION("low-level driver for the CS5536 IDE controller");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(pci, cs5536_pci_tbl);
+
+module_param_named(msr, use_msr, int, 0644);
+MODULE_PARM_DESC(msr, "Force using MSR to configure IDE function (Default: 0)");
+
+module_init(cs5536_init);
+module_exit(cs5536_exit);
index 97a35c667aee73e1127052680559b5376e156dff..415d7e24f2b64784c0d8c887958777bea150078a 100644 (file)
@@ -534,7 +534,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
                d.dma_ops = NULL;
        }
 
-       ret = ide_host_register(host, NULL, hws);
+       ret = ide_host_register(host, &d, hws);
        if (ret)
                goto err_free;
 
index d8f295bdad766c560200065acdf263ac53a77caf..ec7d07fa570a8ab706f06b1ed6c6d506ed86b011 100644 (file)
@@ -282,7 +282,7 @@ static int do_drive_get_GTF(ide_drive_t *drive,
        port = hwif->channel ? drive->dn - 2: drive->dn;
 
        DEBPRINT("ENTER: %s at %s, port#: %d, hard_port#: %d\n",
-                hwif->name, dev->bus_id, port, hwif->channel);
+                hwif->name, dev_name(dev), port, hwif->channel);
 
        if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) {
                DEBPRINT("%s drive %d:%d not present\n",
index cae69372cf45c81e51bbe14b57aa08e3f3466f94..0bfeb0c79d6e8e172cdbb5fd3af9a9df084351c5 100644 (file)
@@ -787,6 +787,9 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
                if (blk_fs_request(rq)) {
                        ide_end_request(drive, 1, rq->nr_sectors);
                        return ide_stopped;
+               } else if (rq->cmd_type == REQ_TYPE_ATA_PC && !rq->bio) {
+                       ide_end_request(drive, 1, 1);
+                       return ide_stopped;
                }
                goto end_request;
        }
index cc163319dfbdbe1812cb00c6a9fb0e72b957eda6..9ee51adf567faefd6ade2873a41444a1d44ca961 100644 (file)
@@ -418,11 +418,14 @@ void ide_map_sg(ide_drive_t *drive, struct request *rq)
        ide_hwif_t *hwif = drive->hwif;
        struct scatterlist *sg = hwif->sg_table;
 
-       if (rq->cmd_type != REQ_TYPE_ATA_TASKFILE) {
-               hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg);
-       } else {
+       if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
                sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE);
                hwif->sg_nents = 1;
+       } else if (!rq->bio) {
+               sg_init_one(sg, rq->data, rq->data_len);
+               hwif->sg_nents = 1;
+       } else {
+               hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg);
        }
 }
 
index 0db1ed9f5fc2d44330dd18b3c5294931939bc6b1..ce0818a993f68a42bf445bc79dea4eaa0ccc94da 100644 (file)
@@ -1467,6 +1467,30 @@ struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws)
 }
 EXPORT_SYMBOL_GPL(ide_host_alloc);
 
+static void ide_port_free(ide_hwif_t *hwif)
+{
+       ide_port_free_devices(hwif);
+       ide_free_port_slot(hwif->index);
+       kfree(hwif);
+}
+
+static void ide_disable_port(ide_hwif_t *hwif)
+{
+       struct ide_host *host = hwif->host;
+       int i;
+
+       printk(KERN_INFO "%s: disabling port\n", hwif->name);
+
+       for (i = 0; i < MAX_HOST_PORTS; i++) {
+               if (host->ports[i] == hwif) {
+                       host->ports[i] = NULL;
+                       host->n_ports--;
+               }
+       }
+
+       ide_port_free(hwif);
+}
+
 int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
                      hw_regs_t **hws)
 {
@@ -1507,8 +1531,12 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
                        hwif->present = 1;
 
                if (hwif->chipset != ide_4drives || !hwif->mate ||
-                   !hwif->mate->present)
-                       ide_register_port(hwif);
+                   !hwif->mate->present) {
+                       if (ide_register_port(hwif)) {
+                               ide_disable_port(hwif);
+                               continue;
+                       }
+               }
 
                if (hwif->present)
                        ide_port_tune_devices(hwif);
@@ -1521,7 +1549,8 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
                if (hwif_init(hwif) == 0) {
                        printk(KERN_INFO "%s: failed to initialize IDE "
                                         "interface\n", hwif->name);
-                       hwif->present = 0;
+                       device_unregister(&hwif->gendev);
+                       ide_disable_port(hwif);
                        continue;
                }
 
@@ -1660,12 +1689,8 @@ void ide_host_free(struct ide_host *host)
        int i;
 
        ide_host_for_each_port(i, hwif, host) {
-               if (hwif == NULL)
-                       continue;
-
-               ide_port_free_devices(hwif);
-               ide_free_port_slot(hwif->index);
-               kfree(hwif);
+               if (hwif)
+                       ide_port_free(hwif);
        }
 
        kfree(host);
index 5b2e3af43c4b0c98daa54859a78055f819db5ace..08c4fa35e9b19481df1ac94b4772599b2fe57036 100644 (file)
@@ -16,7 +16,7 @@
 
 /*
  * Rewritten from the work of Colten Edwards <pje120@cs.usask.ca> by
- * Samuel Thibault <samuel.thibault@fnac.net>
+ * Samuel Thibault <samuel.thibault@ens-lyon.org>
  */
 
 #include <linux/module.h>
index 6636f9665d169e8cf3c9beabe4b0e8867314138a..d7e67a1a1dcc43d0f2fa097f46b8cac7d8cf32c4 100644 (file)
@@ -4,7 +4,7 @@
 
 /*
  * Authors:    Petr Soucek <petr@ryston.cz>
- *             Samuel Thibault <samuel.thibault@fnac.net>
+ *             Samuel Thibault <samuel.thibault@ens-lyon.org>
  */
 
 /* truncates a in [b,c] */
index 882f6f07c4764cdcacb5e3d90c008586897faae2..40b0812a045c9e339171af4960ae6ff0ba890c60 100644 (file)
@@ -261,9 +261,9 @@ static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq)
                                bcount = cur_len;
                        /*
                         * This workaround for zero count seems required.
-                        * (standard ide_build_dmatable do it too)
+                        * (standard ide_build_dmatable does it too)
                         */
-                       if ((bcount & 0xffff) == 0x0000)
+                       if (bcount == 0x10000)
                                bcount = 0x8000;
                        *table++ = bcount & 0xffff;
                        *table++ = cur_addr;
index 703c3eeb20a86dad977333548e7ae2915daa3c9f..6092fe3f409d7c82e2273d1e626fc926c86ce360 100644 (file)
@@ -448,6 +448,11 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
                d.host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS;
 #endif
 
+#ifdef CONFIG_AMIGAONE
+       if (machine_is(amigaone))
+               d.host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS;
+#endif
+
        d.udma_mask = via_config->udma_mask;
 
        vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
index a329e6bd5d2d47b26f147f8a8169234b95e94600..3838bc4acabac07b01b2c7b2488d07d825aa28ae 100644 (file)
@@ -1823,6 +1823,10 @@ static int dv1394_open(struct inode *inode, struct file *file)
 
 #endif
 
+       printk(KERN_INFO "%s: NOTE, the dv1394 interface is unsupported "
+              "and will not be available in the new firewire driver stack. "
+              "Try libraw1394 based programs instead.\n", current->comm);
+
        return 0;
 }
 
@@ -2567,10 +2571,6 @@ static int __init dv1394_init_module(void)
 {
        int ret;
 
-       printk(KERN_WARNING
-              "NOTE: The dv1394 driver is unsupported and may be removed in a "
-              "future Linux release. Use raw1394 instead.\n");
-
        cdev_init(&dv1394_cdev, &dv1394_fops);
        dv1394_cdev.owner = THIS_MODULE;
        ret = cdev_add(&dv1394_cdev, IEEE1394_DV1394_DEV, 16);
index e0ae0d3d747ff1a9e053919bb887bebeadc21d98..af320e2c50793c6bb39995a55a1caa9f79897504 100644 (file)
@@ -54,9 +54,7 @@
 #define IEEE1394_SPEED_800     0x03
 #define IEEE1394_SPEED_1600    0x04
 #define IEEE1394_SPEED_3200    0x05
-
-/* The current highest tested speed supported by the subsystem */
-#define IEEE1394_SPEED_MAX     IEEE1394_SPEED_800
+#define IEEE1394_SPEED_MAX     IEEE1394_SPEED_3200
 
 /* Maps speed values above to a string representation */
 extern const char *hpsb_speedto_str[];
index dcdb71a7718d304451b7aebaedf5bf1dfdd877c8..2beb8d94f7bd3b7584c2c30003c98892b97d3e43 100644 (file)
@@ -338,6 +338,7 @@ static void build_speed_map(struct hpsb_host *host, int nodecount)
        u8 cldcnt[nodecount];
        u8 *map = host->speed_map;
        u8 *speedcap = host->speed;
+       u8 local_link_speed = host->csr.lnk_spd;
        struct selfid *sid;
        struct ext_selfid *esid;
        int i, j, n;
@@ -373,8 +374,8 @@ static void build_speed_map(struct hpsb_host *host, int nodecount)
                        if (sid->port2 == SELFID_PORT_CHILD) cldcnt[n]++;
 
                        speedcap[n] = sid->speed;
-                       if (speedcap[n] > host->csr.lnk_spd)
-                               speedcap[n] = host->csr.lnk_spd;
+                       if (speedcap[n] > local_link_speed)
+                               speedcap[n] = local_link_speed;
                        n--;
                }
        }
@@ -407,12 +408,11 @@ static void build_speed_map(struct hpsb_host *host, int nodecount)
                }
        }
 
-#if SELFID_SPEED_UNKNOWN != IEEE1394_SPEED_MAX
-       /* assume maximum speed for 1394b PHYs, nodemgr will correct it */
-       for (n = 0; n < nodecount; n++)
-               if (speedcap[n] == SELFID_SPEED_UNKNOWN)
-                       speedcap[n] = IEEE1394_SPEED_MAX;
-#endif
+       /* assume a maximum speed for 1394b PHYs, nodemgr will correct it */
+       if (local_link_speed > SELFID_SPEED_UNKNOWN)
+               for (i = 0; i < nodecount; i++)
+                       if (speedcap[i] == SELFID_SPEED_UNKNOWN)
+                               speedcap[i] = local_link_speed;
 }
 
 
index 4320bf010495c3bb7eabc0c76bfd600ecd3588da..7fb8ab9780ae4e8e717965a9353a88bc4accb0c5 100644 (file)
@@ -26,7 +26,7 @@
 
 #define OHCI1394_DRIVER_NAME      "ohci1394"
 
-#define OHCI1394_MAX_AT_REQ_RETRIES    0x2
+#define OHCI1394_MAX_AT_REQ_RETRIES    0xf
 #define OHCI1394_MAX_AT_RESP_RETRIES   0x2
 #define OHCI1394_MAX_PHYS_RESP_RETRIES 0x8
 #define OHCI1394_MAX_SELF_ID_ERRORS    16
index ab1034ccb7fb67fbb7c8924f0d188c2a4311e41e..f3fd8657ce4b62c6d12180c779c7e2bac6996f60 100644 (file)
  */
 static int sbp2_max_speed = IEEE1394_SPEED_MAX;
 module_param_named(max_speed, sbp2_max_speed, int, 0644);
-MODULE_PARM_DESC(max_speed, "Force max speed "
-                "(3 = 800Mb/s, 2 = 400Mb/s, 1 = 200Mb/s, 0 = 100Mb/s)");
+MODULE_PARM_DESC(max_speed, "Limit data transfer speed (5 <= 3200, "
+                "4 <= 1600, 3 <= 800, 2 <= 400, 1 <= 200, 0 = 100 Mb/s)");
 
 /*
  * Set serialize_io to 0 or N to use dynamically appended lists of command ORBs.
@@ -256,7 +256,7 @@ static int sbp2_set_busy_timeout(struct sbp2_lu *);
 static int sbp2_max_speed_and_size(struct sbp2_lu *);
 
 
-static const u8 sbp2_speedto_max_payload[] = { 0x7, 0x8, 0x9, 0xA, 0xB, 0xC };
+static const u8 sbp2_speedto_max_payload[] = { 0x7, 0x8, 0x9, 0xa, 0xa, 0xa };
 
 static DEFINE_RWLOCK(sbp2_hi_logical_units_lock);
 
@@ -347,8 +347,8 @@ static struct scsi_host_template sbp2_shost_template = {
        .sdev_attrs              = sbp2_sysfs_sdev_attrs,
 };
 
-/* for match-all entries in sbp2_workarounds_table */
-#define SBP2_ROM_VALUE_WILDCARD 0x1000000
+#define SBP2_ROM_VALUE_WILDCARD ~0         /* match all */
+#define SBP2_ROM_VALUE_MISSING  0xff000000 /* not present in the unit dir. */
 
 /*
  * List of devices with known bugs.
@@ -359,60 +359,70 @@ static struct scsi_host_template sbp2_shost_template = {
  */
 static const struct {
        u32 firmware_revision;
-       u32 model_id;
+       u32 model;
        unsigned workarounds;
 } sbp2_workarounds_table[] = {
        /* DViCO Momobay CX-1 with TSB42AA9 bridge */ {
                .firmware_revision      = 0x002800,
-               .model_id               = 0x001010,
+               .model                  = 0x001010,
                .workarounds            = SBP2_WORKAROUND_INQUIRY_36 |
                                          SBP2_WORKAROUND_MODE_SENSE_8 |
                                          SBP2_WORKAROUND_POWER_CONDITION,
        },
        /* DViCO Momobay FX-3A with TSB42AA9A bridge */ {
                .firmware_revision      = 0x002800,
-               .model_id               = 0x000000,
+               .model                  = 0x000000,
                .workarounds            = SBP2_WORKAROUND_DELAY_INQUIRY |
                                          SBP2_WORKAROUND_POWER_CONDITION,
        },
        /* Initio bridges, actually only needed for some older ones */ {
                .firmware_revision      = 0x000200,
-               .model_id               = SBP2_ROM_VALUE_WILDCARD,
+               .model                  = SBP2_ROM_VALUE_WILDCARD,
                .workarounds            = SBP2_WORKAROUND_INQUIRY_36,
        },
        /* PL-3507 bridge with Prolific firmware */ {
                .firmware_revision      = 0x012800,
-               .model_id               = SBP2_ROM_VALUE_WILDCARD,
+               .model                  = SBP2_ROM_VALUE_WILDCARD,
                .workarounds            = SBP2_WORKAROUND_POWER_CONDITION,
        },
        /* Symbios bridge */ {
                .firmware_revision      = 0xa0b800,
-               .model_id               = SBP2_ROM_VALUE_WILDCARD,
+               .model                  = SBP2_ROM_VALUE_WILDCARD,
                .workarounds            = SBP2_WORKAROUND_128K_MAX_TRANS,
        },
        /* Datafab MD2-FW2 with Symbios/LSILogic SYM13FW500 bridge */ {
                .firmware_revision      = 0x002600,
-               .model_id               = SBP2_ROM_VALUE_WILDCARD,
+               .model                  = SBP2_ROM_VALUE_WILDCARD,
                .workarounds            = SBP2_WORKAROUND_128K_MAX_TRANS,
        },
+       /*
+        * iPod 2nd generation: needs 128k max transfer size workaround
+        * iPod 3rd generation: needs fix capacity workaround
+        */
+       {
+               .firmware_revision      = 0x0a2700,
+               .model                  = 0x000000,
+               .workarounds            = SBP2_WORKAROUND_128K_MAX_TRANS |
+                                         SBP2_WORKAROUND_FIX_CAPACITY,
+       },
        /* iPod 4th generation */ {
                .firmware_revision      = 0x0a2700,
-               .model_id               = 0x000021,
+               .model                  = 0x000021,
                .workarounds            = SBP2_WORKAROUND_FIX_CAPACITY,
        },
        /* iPod mini */ {
                .firmware_revision      = 0x0a2700,
-               .model_id               = 0x000022,
+               .model                  = 0x000022,
                .workarounds            = SBP2_WORKAROUND_FIX_CAPACITY,
        },
        /* iPod mini */ {
                .firmware_revision      = 0x0a2700,
-               .model_id               = 0x000023,
+               .model                  = 0x000023,
                .workarounds            = SBP2_WORKAROUND_FIX_CAPACITY,
        },
        /* iPod Photo */ {
                .firmware_revision      = 0x0a2700,
-               .model_id               = 0x00007e,
+               .model                  = 0x00007e,
                .workarounds            = SBP2_WORKAROUND_FIX_CAPACITY,
        }
 };
@@ -1341,13 +1351,15 @@ static void sbp2_parse_unit_directory(struct sbp2_lu *lu,
        struct csr1212_keyval *kv;
        struct csr1212_dentry *dentry;
        u64 management_agent_addr;
-       u32 unit_characteristics, firmware_revision;
+       u32 unit_characteristics, firmware_revision, model;
        unsigned workarounds;
        int i;
 
        management_agent_addr = 0;
        unit_characteristics = 0;
-       firmware_revision = 0;
+       firmware_revision = SBP2_ROM_VALUE_MISSING;
+       model = ud->flags & UNIT_DIRECTORY_MODEL_ID ?
+                               ud->model_id : SBP2_ROM_VALUE_MISSING;
 
        csr1212_for_each_dir_entry(ud->ne->csr, kv, ud->ud_kv, dentry) {
                switch (kv->key.id) {
@@ -1388,9 +1400,9 @@ static void sbp2_parse_unit_directory(struct sbp2_lu *lu,
                            sbp2_workarounds_table[i].firmware_revision !=
                            (firmware_revision & 0xffff00))
                                continue;
-                       if (sbp2_workarounds_table[i].model_id !=
+                       if (sbp2_workarounds_table[i].model !=
                            SBP2_ROM_VALUE_WILDCARD &&
-                           sbp2_workarounds_table[i].model_id != ud->model_id)
+                           sbp2_workarounds_table[i].model != model)
                                continue;
                        workarounds |= sbp2_workarounds_table[i].workarounds;
                        break;
@@ -1403,7 +1415,7 @@ static void sbp2_parse_unit_directory(struct sbp2_lu *lu,
                          NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid),
                          workarounds, firmware_revision,
                          ud->vendor_id ? ud->vendor_id : ud->ne->vendor_id,
-                         ud->model_id);
+                         model);
 
        /* We would need one SCSI host template for each target to adjust
         * max_sectors on the fly, therefore warn only. */
index 90663e01a56e0d4544b944da2fd81e5052a05a2f..60156dfdc608cf5e8d45e40ec34a51d09a084664 100644 (file)
@@ -224,7 +224,7 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user)
                        break;
 
                /* If the Guest asked to be stopped, we sleep.  The Guest's
-                * clock timer or LHCALL_BREAK from the Waker will wake us. */
+                * clock timer or LHREQ_BREAK from the Waker will wake us. */
                if (cpu->halted) {
                        set_current_state(TASK_INTERRUPTIBLE);
                        schedule();
index 34bc017b8b3cda17ac4ee8f6e720ea85eb782628..b8ee103eed5f503e44ad5ebb27aab75e81ba5bec 100644 (file)
@@ -307,9 +307,8 @@ static int close(struct inode *inode, struct file *file)
         * kmalloc()ed string, either of which is ok to hand to kfree(). */
        if (!IS_ERR(lg->dead))
                kfree(lg->dead);
-       /* We clear the entire structure, which also marks it as free for the
-        * next user. */
-       memset(lg, 0, sizeof(*lg));
+       /* Free the memory allocated to the lguest_struct */
+       kfree(lg);
        /* Release lock and exit. */
        mutex_unlock(&lguest_lock);
 
index 1e3aea9eecf18009f4ff0bc2e4c474914e1bcf74..09658b218474a3a8f676995f02e59fdfa10693b0 100644 (file)
@@ -25,13 +25,13 @@ static inline dev_info_t *which_dev(mddev_t *mddev, sector_t sector)
 {
        dev_info_t *hash;
        linear_conf_t *conf = mddev_to_conf(mddev);
+       sector_t idx = sector >> conf->sector_shift;
 
        /*
         * sector_div(a,b) returns the remainer and sets a to a/b
         */
-       sector >>= conf->sector_shift;
-       (void)sector_div(sector, conf->spacing);
-       hash = conf->hash_table[sector];
+       (void)sector_div(idx, conf->spacing);
+       hash = conf->hash_table[idx];
 
        while (sector >= hash->num_sectors + hash->start_sector)
                hash++;
index 41e2509bf896c9356f9f9bd55f93f811120d7639..4495104f6c9f33297727891510e667db46ac29ac 100644 (file)
@@ -1481,6 +1481,11 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
                if (find_rdev_nr(mddev, rdev->desc_nr))
                        return -EBUSY;
        }
+       if (mddev->max_disks && rdev->desc_nr >= mddev->max_disks) {
+               printk(KERN_WARNING "md: %s: array is limited to %d devices\n",
+                      mdname(mddev), mddev->max_disks);
+               return -EBUSY;
+       }
        bdevname(rdev->bdev,b);
        while ( (s=strchr(b, '/')) != NULL)
                *s = '!';
@@ -2441,6 +2446,15 @@ static void analyze_sbs(mddev_t * mddev)
 
        i = 0;
        rdev_for_each(rdev, tmp, mddev) {
+               if (rdev->desc_nr >= mddev->max_disks ||
+                   i > mddev->max_disks) {
+                       printk(KERN_WARNING
+                              "md: %s: %s: only %d devices permitted\n",
+                              mdname(mddev), bdevname(rdev->bdev, b),
+                              mddev->max_disks);
+                       kick_rdev_from_array(rdev);
+                       continue;
+               }
                if (rdev != freshest)
                        if (super_types[mddev->major_version].
                            validate_super(mddev, rdev)) {
@@ -4614,13 +4628,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
         * noticed in interrupt contexts ...
         */
 
-       if (rdev->desc_nr == mddev->max_disks) {
-               printk(KERN_WARNING "%s: can not hot-add to full array!\n",
-                       mdname(mddev));
-               err = -EBUSY;
-               goto abort_unbind_export;
-       }
-
        rdev->raid_disk = -1;
 
        md_update_sb(mddev, 1);
@@ -4634,9 +4641,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
        md_new_event(mddev);
        return 0;
 
-abort_unbind_export:
-       unbind_rdev_from_array(rdev);
-
 abort_export:
        export_rdev(rdev);
        return err;
index 7b4f5f7155d8726705c1f42757f68dd1de869624..01e3cffd03b8fd28dae613614f3efd10c04f2416 100644 (file)
@@ -1640,7 +1640,8 @@ static void raid1d(mddev_t *mddev)
                        }
 
                        bio = r1_bio->bios[r1_bio->read_disk];
-                       if ((disk=read_balance(conf, r1_bio)) == -1) {
+                       if ((disk=read_balance(conf, r1_bio)) == -1 ||
+                           disk == r1_bio->read_disk) {
                                printk(KERN_ALERT "raid1: %s: unrecoverable I/O"
                                       " read error for block %llu\n",
                                       bdevname(bio->bi_bdev,b),
index 6098b626811fac4baa0e89f40b0e45e371c9b56f..47fee05eaefbab9a67492f5c97067a5874fa341e 100644 (file)
@@ -576,6 +576,7 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
                vv->vflip = c->value;
                break;
        default: {
+               mutex_unlock(&dev->lock);
                return -EINVAL;
        }
        }
index 64379f2bf2370eaf221d33aea24a7c946ab75f5a..3ec28945c26f21b7e0d7cc8d48c772aba35c384d 100644 (file)
@@ -657,7 +657,7 @@ static int mxl5007t_get_status(struct dvb_frontend *fe, u32 *status)
 {
        struct mxl5007t_state *state = fe->tuner_priv;
        int rf_locked, ref_locked;
-       s32 rf_input_level;
+       s32 rf_input_level = 0;
        int ret;
 
        if (fe->ops.i2c_gate_ctrl)
index 98ee16773ff2e204e82f3501f0f0ed45d123b844..7e3aeaa7370f3a6ed3bf45700694e1c6fddae322 100644 (file)
@@ -93,6 +93,9 @@ struct dvb_ca_slot {
        /* current state of the CAM */
        int slot_state;
 
+       /* mutex used for serializing access to one CI slot */
+       struct mutex slot_lock;
+
        /* Number of CAMCHANGES that have occurred since last processing */
        atomic_t camchange_count;
 
@@ -711,14 +714,20 @@ static int dvb_ca_en50221_write_data(struct dvb_ca_private *ca, int slot, u8 * b
        dprintk("%s\n", __func__);
 
 
-       // sanity check
+       /* sanity check */
        if (bytes_write > ca->slot_info[slot].link_buf_size)
                return -EINVAL;
 
-       /* check if interface is actually waiting for us to read from it, or if a read is in progress */
+       /* it is possible we are dealing with a single buffer implementation,
+          thus if there is data available for read or if there is even a read
+          already in progress, we do nothing but awake the kernel thread to
+          process the data if necessary. */
        if ((status = ca->pub->read_cam_control(ca->pub, slot, CTRLIF_STATUS)) < 0)
                goto exitnowrite;
        if (status & (STATUSREG_DA | STATUSREG_RE)) {
+               if (status & STATUSREG_DA)
+                       dvb_ca_en50221_thread_wakeup(ca);
+
                status = -EAGAIN;
                goto exitnowrite;
        }
@@ -987,6 +996,8 @@ static int dvb_ca_en50221_thread(void *data)
                /* go through all the slots processing them */
                for (slot = 0; slot < ca->slot_count; slot++) {
 
+                       mutex_lock(&ca->slot_info[slot].slot_lock);
+
                        // check the cam status + deal with CAMCHANGEs
                        while (dvb_ca_en50221_check_camstatus(ca, slot)) {
                                /* clear down an old CI slot if necessary */
@@ -1122,7 +1133,7 @@ static int dvb_ca_en50221_thread(void *data)
 
                        case DVB_CA_SLOTSTATE_RUNNING:
                                if (!ca->open)
-                                       continue;
+                                       break;
 
                                // poll slots for data
                                pktcount = 0;
@@ -1146,6 +1157,8 @@ static int dvb_ca_en50221_thread(void *data)
                                }
                                break;
                        }
+
+                       mutex_unlock(&ca->slot_info[slot].slot_lock);
                }
        }
 
@@ -1181,6 +1194,7 @@ static int dvb_ca_en50221_io_do_ioctl(struct inode *inode, struct file *file,
        switch (cmd) {
        case CA_RESET:
                for (slot = 0; slot < ca->slot_count; slot++) {
+                       mutex_lock(&ca->slot_info[slot].slot_lock);
                        if (ca->slot_info[slot].slot_state != DVB_CA_SLOTSTATE_NONE) {
                                dvb_ca_en50221_slot_shutdown(ca, slot);
                                if (ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE)
@@ -1188,6 +1202,7 @@ static int dvb_ca_en50221_io_do_ioctl(struct inode *inode, struct file *file,
                                                                     slot,
                                                                     DVB_CA_EN50221_CAMCHANGE_INSERTED);
                        }
+                       mutex_unlock(&ca->slot_info[slot].slot_lock);
                }
                ca->next_read_slot = 0;
                dvb_ca_en50221_thread_wakeup(ca);
@@ -1308,7 +1323,9 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file,
                                goto exit;
                        }
 
+                       mutex_lock(&ca->slot_info[slot].slot_lock);
                        status = dvb_ca_en50221_write_data(ca, slot, fragbuf, fraglen + 2);
+                       mutex_unlock(&ca->slot_info[slot].slot_lock);
                        if (status == (fraglen + 2)) {
                                written = 1;
                                break;
@@ -1664,6 +1681,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
                ca->slot_info[i].slot_state = DVB_CA_SLOTSTATE_NONE;
                atomic_set(&ca->slot_info[i].camchange_count, 0);
                ca->slot_info[i].camchange_type = DVB_CA_EN50221_CAMCHANGE_REMOVED;
+               mutex_init(&ca->slot_info[i].slot_lock);
        }
 
        if (signal_pending(current)) {
index 8467e63ddc0d256c2dda250f49786979f06e53b6..7df2e141187a9183d6ab46bba817c6a985319e10 100644 (file)
@@ -45,8 +45,10 @@ struct dvb_ca_en50221 {
        /* the module owning this structure */
        struct module* owner;
 
-       /* NOTE: the read_*, write_* and poll_slot_status functions must use locks as
-        * they may be called from several threads at once */
+       /* NOTE: the read_*, write_* and poll_slot_status functions will be
+        * called for different slots concurrently and need to use locks where
+        * and if appropriate. There will be no concurrent access to one slot.
+        */
 
        /* functions for accessing attribute memory on the CAM */
        int (*read_attribute_mem)(struct dvb_ca_en50221* ca, int slot, int address);
index b1a9c4cdec93ee27f8eec60f6f7dcf5774836c4e..199ece0d48837125da59e7495e81ad2035f47a47 100644 (file)
@@ -220,7 +220,7 @@ static int af9005_get_post_vit_ber(struct dvb_frontend *fe,
                                   u16 * abort_count)
 {
        u32 loc_cw_count = 0, loc_err_count;
-       u16 loc_abort_count;
+       u16 loc_abort_count = 0;
        int ret;
 
        ret =
index e1e9aa5c6b843991c13ba4286ed92d650b728e97..6a97a40d3dfbcf63dc793df361451cb9e0f29607 100644 (file)
@@ -694,7 +694,12 @@ static int af9015_read_config(struct usb_device *udev)
 
        /* IR remote controller */
        req.addr = AF9015_EEPROM_IR_MODE;
-       ret = af9015_rw_udev(udev, &req);
+       /* first message will timeout often due to possible hw bug */
+       for (i = 0; i < 4; i++) {
+               ret = af9015_rw_udev(udev, &req);
+               if (!ret)
+                       break;
+       }
        if (ret)
                goto error;
        deb_info("%s: IR mode:%d\n", __func__, val);
@@ -835,18 +840,19 @@ static int af9015_read_config(struct usb_device *udev)
        if (!dvb_usb_af9015_dual_mode)
                af9015_config.dual_mode = 0;
 
-       /* set buffer size according to USB port speed */
+       /* Set adapter0 buffer size according to USB port speed, adapter1 buffer
+          size can be static because it is enabled only USB2.0 */
        for (i = 0; i < af9015_properties_count; i++) {
                /* USB1.1 set smaller buffersize and disable 2nd adapter */
                if (udev->speed == USB_SPEED_FULL) {
-                       af9015_properties[i].adapter->stream.u.bulk.buffersize =
-                               TS_USB11_MAX_PACKET_SIZE;
+                       af9015_properties[i].adapter[0].stream.u.bulk.buffersize
+                               TS_USB11_MAX_PACKET_SIZE;
                        /* disable 2nd adapter because we don't have
                           PID-filters */
                        af9015_config.dual_mode = 0;
                } else {
-                       af9015_properties[i].adapter->stream.u.bulk.buffersize =
-                               TS_USB20_MAX_PACKET_SIZE;
+                       af9015_properties[i].adapter[0].stream.u.bulk.buffersize
+                               TS_USB20_MAX_PACKET_SIZE;
                }
        }
 
@@ -1254,6 +1260,12 @@ static struct dvb_usb_device_properties af9015_properties[] = {
                                        .type = USB_BULK,
                                        .count = 6,
                                        .endpoint = 0x85,
+                                       .u = {
+                                               .bulk = {
+                                                       .buffersize =
+                                               TS_USB20_MAX_PACKET_SIZE,
+                                               }
+                                       }
                                },
                        }
                },
@@ -1353,6 +1365,12 @@ static struct dvb_usb_device_properties af9015_properties[] = {
                                        .type = USB_BULK,
                                        .count = 6,
                                        .endpoint = 0x85,
+                                       .u = {
+                                               .bulk = {
+                                                       .buffersize =
+                                               TS_USB20_MAX_PACKET_SIZE,
+                                               }
+                                       }
                                },
                        }
                },
index 3917327889117bcff8cf27f315c8a3d70fcb27c7..635d30a55078d52c76804581cddb6ae4ee0a485c 100644 (file)
@@ -1393,6 +1393,9 @@ struct usb_device_id dib0700_usb_id_table[] = {
        { USB_DEVICE(USB_VID_ASUS,      USB_PID_ASUS_U3000H) },
 /* 40 */{ USB_DEVICE(USB_VID_PINNACLE,  USB_PID_PINNACLE_PCTV801E) },
        { USB_DEVICE(USB_VID_PINNACLE,  USB_PID_PINNACLE_PCTV801E_SE) },
+       { USB_DEVICE(USB_VID_TERRATEC,  USB_PID_TERRATEC_CINERGY_T_EXPRESS) },
+       { USB_DEVICE(USB_VID_TERRATEC,
+                       USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },
        { 0 }           /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
@@ -1537,7 +1540,8 @@ struct dvb_usb_device_properties dib0700_devices[] = {
                        {   "DiBcom STK7700D reference design",
                                { &dib0700_usb_id_table[14], NULL },
                                { NULL },
-                       }
+                       },
+
                },
 
                .rc_interval      = DEFAULT_RC_INTERVAL,
@@ -1557,7 +1561,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
                        },
                },
 
-               .num_device_descs = 2,
+               .num_device_descs = 3,
                .devices = {
                        {   "ASUS My Cinema U3000 Mini DVBT Tuner",
                                { &dib0700_usb_id_table[23], NULL },
@@ -1566,6 +1570,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
                        {   "Yuan EC372S",
                                { &dib0700_usb_id_table[31], NULL },
                                { NULL },
+                       },
+                       {   "Terratec Cinergy T Express",
+                               { &dib0700_usb_id_table[42], NULL },
+                               { NULL },
                        }
                },
 
@@ -1653,7 +1661,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
                        }
                },
 
-               .num_device_descs = 4,
+               .num_device_descs = 5,
                .devices = {
                        {   "DiBcom STK7070PD reference design",
                                { &dib0700_usb_id_table[17], NULL },
@@ -1670,6 +1678,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
                        {   "Hauppauge Nova-TD-500 (84xxx)",
                                { &dib0700_usb_id_table[36], NULL },
                                { NULL },
+                       },
+                       {  "Terratec Cinergy DT USB XS Diversity",
+                               { &dib0700_usb_id_table[43], NULL },
+                               { NULL },
                        }
                }
        }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
index a4fca3fca5eede1e7c1c4913a7905d72738b804b..0db0c06ee6f2dcf0783eafb3982a14c37643d110 100644 (file)
 #define USB_PID_AVERMEDIA_A309                         0xa309
 #define USB_PID_TECHNOTREND_CONNECT_S2400               0x3006
 #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY       0x005a
+#define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2     0x0081
 #define USB_PID_TERRATEC_CINERGY_HT_USB_XE             0x0058
 #define USB_PID_TERRATEC_CINERGY_HT_EXPRESS            0x0060
+#define USB_PID_TERRATEC_CINERGY_T_EXPRESS             0x0062
 #define USB_PID_TERRATEC_CINERGY_T_XXS                 0x0078
 #define USB_PID_PINNACLE_EXPRESSCARD_320CX             0x022e
 #define USB_PID_PINNACLE_PCTV2000E                     0x022c
index ec4e08dbc699c78a31432a470d1292d1261ca312..1e81e713df635db0e310d3419c557c5bcce56fb1 100644 (file)
@@ -646,7 +646,7 @@ static int drx_tune(struct drx397xD_state *s,
        u32 edi = 0, ebx = 0, ebp = 0, edx = 0;
        u16 v20 = 0, v1E = 0, v16 = 0, v14 = 0, v12 = 0, v10 = 0, v0E = 0;
 
-       int rc, df_tuner;
+       int rc, df_tuner = 0;
        int a, b, c, d;
        pr_debug("%s %d\n", __func__, s->config.d60);
 
index cf4d8936bb83f515b49cbb300c9a892bb24a28fb..3e08d985d6e50cf2f1fb36df3169274c74b22dcb 100644 (file)
@@ -545,9 +545,6 @@ static int s5h1409_set_frontend(struct dvb_frontend *fe,
 
        s5h1409_enable_modulation(fe, p->u.vsb.modulation);
 
-       /* Allow the demod to settle */
-       msleep(100);
-
        if (fe->ops.tuner_ops.set_params) {
                if (fe->ops.i2c_gate_ctrl)
                        fe->ops.i2c_gate_ctrl(fe, 1);
@@ -562,6 +559,10 @@ static int s5h1409_set_frontend(struct dvb_frontend *fe,
                s5h1409_set_qam_interleave_mode(fe);
        }
 
+       /* Issue a reset to the demod so it knows to resync against the
+          newly tuned frequency */
+       s5h1409_softreset(fe);
+
        return 0;
 }
 
index 83dc7e12d5f0a3c8763788ab2a408032e89c00bd..a67d1775a43ceb2f6cdb17e1dcb8ecba55fb95d4 100644 (file)
@@ -31,6 +31,8 @@ inline u32 stb0899_do_div(u64 n, u32 d)
        return n;
 }
 
+#if 0
+/* These functions are currently unused */
 /*
  * stb0899_calc_srate
  * Compute symbol rate
@@ -63,6 +65,7 @@ static u32 stb0899_get_srate(struct stb0899_state *state)
 
        return stb0899_calc_srate(internal->master_clk, sfr);
 }
+#endif
 
 /*
  * stb0899_set_srate
index 1638e1d9f538011e49a193b6ce52dbf86464d274..83e9e7750c8cb1e382ddda99e901f7fef1514d48 100644 (file)
@@ -470,6 +470,7 @@ static void frontend_init(struct budget *budget)
                budget->dvb_frontend = dvb_attach(l64781_attach, &grundig_29504_401_config, &budget->i2c_adap);
                if (budget->dvb_frontend) {
                        budget->dvb_frontend->ops.tuner_ops.set_params = grundig_29504_401_tuner_set_params;
+                       budget->dvb_frontend->tuner_priv = NULL;
                        break;
                }
                break;
index 0aa96df80fc2bad8337263e1c23cc9b234f78885..d91e0638448fce9adb1a25d5e0091bf5804ae3f9 100644 (file)
@@ -1384,7 +1384,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec)
 static int ttusb_dec_init_stb(struct ttusb_dec *dec)
 {
        int result;
-       unsigned int mode, model, version;
+       unsigned int mode = 0, model = 0, version = 0;
 
        dprintk("%s\n", __func__);
 
index 0747dc8862b095718e3dba02bd32be898227f829..fdfc7bf86b9e15c498ea4fc57eef55f304e6f67c 100644 (file)
@@ -194,10 +194,10 @@ static int amradio_start(struct amradio_device *radio)
                return retval;
        }
 
-       mutex_unlock(&radio->lock);
-
        radio->muted = 0;
 
+       mutex_unlock(&radio->lock);
+
        return retval;
 }
 
@@ -230,10 +230,10 @@ static int amradio_stop(struct amradio_device *radio)
                return retval;
        }
 
-       mutex_unlock(&radio->lock);
-
        radio->muted = 1;
 
+       mutex_unlock(&radio->lock);
+
        return retval;
 }
 
@@ -284,10 +284,10 @@ static int amradio_setfreq(struct amradio_device *radio, int freq)
                return retval;
        }
 
-       mutex_unlock(&radio->lock);
-
        radio->stereo = 0;
 
+       mutex_unlock(&radio->lock);
+
        return retval;
 }
 
index 14bebf8a116ffe2b4afc6546bc80eb66ef2b110d..87e91072627ad934fec33920defb54fa05b1d64e 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/i2c.h>
index 8f1db57bd1dd8cefc4fcd7b55865429ec04491bd..bfe25841dbf483239777cd72dddcbafb8e087a39 100644 (file)
@@ -1586,7 +1586,8 @@ static int mpeg_open(struct file *file)
        lock_kernel();
        list_for_each(list, &cx23885_devlist) {
                h = list_entry(list, struct cx23885_dev, devlist);
-               if (h->v4l_device->minor == minor) {
+               if (h->v4l_device &&
+                   h->v4l_device->minor == minor) {
                        dev = h;
                        break;
                }
index 2d81c4d043403297b504a2b77b5a17560cde31c7..eaa11893bfe918f23e1ca7403179c7d2ec975680 100644 (file)
@@ -730,12 +730,13 @@ static int video_open(struct file *file)
        lock_kernel();
        list_for_each(list, &cx23885_devlist) {
                h = list_entry(list, struct cx23885_dev, devlist);
-               if (h->video_dev->minor == minor) {
+               if (h->video_dev &&
+                   h->video_dev->minor == minor) {
                        dev  = h;
                        type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                }
                if (h->vbi_dev &&
-                  h->vbi_dev->minor == minor) {
+                   h->vbi_dev->minor == minor) {
                        dev  = h;
                        type = V4L2_BUF_TYPE_VBI_CAPTURE;
                }
index 88f2fd32bfe357617f82f011df18a9c31ddf7997..25eb3bec9e5d9dde1ef7051482dbc7d7e2e7c94a 100644 (file)
@@ -1382,6 +1382,14 @@ static int cx25840_log_status(struct v4l2_subdev *sd)
 
 static int cx25840_command(struct i2c_client *client, unsigned cmd, void *arg)
 {
+       /* ignore this command */
+       if (cmd == TUNER_SET_TYPE_ADDR || cmd == TUNER_SET_CONFIG)
+               return 0;
+
+       /* Old-style drivers rely on initialization on first use, so
+          call the init whenever a command is issued to this driver.
+          New-style drivers using v4l2_subdev should call init explicitly. */
+       cx25840_init(i2c_get_clientdata(client), 0);
        return v4l2_subdev_command(i2c_get_clientdata(client), cmd, arg);
 }
 
index 613dfea4ff3e551a6cd0ab51d79c623b3902fdbf..aef5297534af95f7101ec065040f68cdf222bca7 100644 (file)
@@ -614,34 +614,41 @@ static struct stv0288_config tevii_tuner_earda_config = {
        .set_ts_params = cx24116_set_ts_param,
 };
 
-static int dvb_register(struct cx8802_dev *dev)
+static int cx8802_alloc_frontends(struct cx8802_dev *dev)
 {
        struct cx88_core *core = dev->core;
-       struct videobuf_dvb_frontend *fe0, *fe1 = NULL;
-       int mfe_shared = 0; /* bus not shared by default */
+       struct videobuf_dvb_frontend *fe = NULL;
        int i;
 
-       if (0 != core->i2c_rc) {
-               printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name);
-               goto frontend_detach;
-       }
-
-       if (!core->board.num_frontends)
-               return -EINVAL;
-
        mutex_init(&dev->frontends.lock);
        INIT_LIST_HEAD(&dev->frontends.felist);
 
+       if (!core->board.num_frontends)
+               return -ENODEV;
+
        printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__,
                         core->board.num_frontends);
        for (i = 1; i <= core->board.num_frontends; i++) {
-               fe0 = videobuf_dvb_alloc_frontend(&dev->frontends, i);
-               if (!fe0) {
+               fe = videobuf_dvb_alloc_frontend(&dev->frontends, i);
+               if (!fe) {
                        printk(KERN_ERR "%s() failed to alloc\n", __func__);
                        videobuf_dvb_dealloc_frontends(&dev->frontends);
-                       goto frontend_detach;
+                       return -ENOMEM;
                }
        }
+       return 0;
+}
+
+static int dvb_register(struct cx8802_dev *dev)
+{
+       struct cx88_core *core = dev->core;
+       struct videobuf_dvb_frontend *fe0, *fe1 = NULL;
+       int mfe_shared = 0; /* bus not shared by default */
+
+       if (0 != core->i2c_rc) {
+               printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name);
+               goto frontend_detach;
+       }
 
        /* Get the first frontend */
        fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
@@ -1243,6 +1250,8 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
        struct cx88_core *core = drv->core;
        struct cx8802_dev *dev = drv->core->dvbdev;
        int err;
+       struct videobuf_dvb_frontend *fe;
+       int i;
 
        dprintk( 1, "%s\n", __func__);
        dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
@@ -1258,39 +1267,34 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
        /* If vp3054 isn't enabled, a stub will just return 0 */
        err = vp3054_i2c_probe(dev);
        if (0 != err)
-               goto fail_probe;
+               goto fail_core;
 
        /* dvb stuff */
        printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name);
        dev->ts_gen_cntrl = 0x0c;
 
+       err = cx8802_alloc_frontends(dev);
+       if (err)
+               goto fail_core;
+
        err = -ENODEV;
-       if (core->board.num_frontends) {
-               struct videobuf_dvb_frontend *fe;
-               int i;
-
-               for (i = 1; i <= core->board.num_frontends; i++) {
-                       fe = videobuf_dvb_get_frontend(&core->dvbdev->frontends, i);
-                       if (fe == NULL) {
-                               printk(KERN_ERR "%s() failed to get frontend(%d)\n",
+       for (i = 1; i <= core->board.num_frontends; i++) {
+               fe = videobuf_dvb_get_frontend(&core->dvbdev->frontends, i);
+               if (fe == NULL) {
+                       printk(KERN_ERR "%s() failed to get frontend(%d)\n",
                                        __func__, i);
-                               goto fail_probe;
-                       }
-                       videobuf_queue_sg_init(&fe->dvb.dvbq, &dvb_qops,
+                       goto fail_probe;
+               }
+               videobuf_queue_sg_init(&fe->dvb.dvbq, &dvb_qops,
                                    &dev->pci->dev, &dev->slock,
                                    V4L2_BUF_TYPE_VIDEO_CAPTURE,
                                    V4L2_FIELD_TOP,
                                    sizeof(struct cx88_buffer),
                                    dev);
-                       /* init struct videobuf_dvb */
-                       fe->dvb.name = dev->core->name;
-               }
-       } else {
-               /* no frontends allocated */
-               printk(KERN_ERR "%s/2 .num_frontends should be non-zero\n",
-                       core->name);
-               goto fail_core;
+               /* init struct videobuf_dvb */
+               fe->dvb.name = dev->core->name;
        }
+
        err = dvb_register(dev);
        if (err)
                /* frontends/adapter de-allocated in dvb_register */
index 60a8b3187f14bd0e0c097caafd4fa6adceaf5e85..6025fdd233445857d571632126399566acbc6a0b 100644 (file)
@@ -336,8 +336,8 @@ struct cx88_core {
        /* config info -- dvb */
 #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
        int                        (*prev_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
-       void                       (*gate_ctrl)(struct cx88_core  *core, int open);
 #endif
+       void                       (*gate_ctrl)(struct cx88_core  *core, int open);
 
        /* state info */
        struct task_struct         *kthread;
index 94378ccb7505845d157920e4f81d9154eee6f35f..5d882a44e3eee5444c00062f3e5edf70b118cc4e 100644 (file)
@@ -62,9 +62,15 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev)
 
        dprintk("Stopping isoc\n");
        for (i = 0; i < EM28XX_AUDIO_BUFS; i++) {
-               usb_unlink_urb(dev->adev.urb[i]);
+               if (!irqs_disabled())
+                       usb_kill_urb(dev->adev.urb[i]);
+               else
+                       usb_unlink_urb(dev->adev.urb[i]);
                usb_free_urb(dev->adev.urb[i]);
                dev->adev.urb[i] = NULL;
+
+               kfree(dev->adev.transfer_buffer[i]);
+               dev->adev.transfer_buffer[i] = NULL;
        }
 
        return 0;
@@ -389,11 +395,15 @@ static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream,
 static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream
                                                    *substream)
 {
-       struct em28xx *dev;
+       unsigned long flags;
 
+       struct em28xx *dev;
        snd_pcm_uframes_t hwptr_done;
+
        dev = snd_pcm_substream_chip(substream);
+       spin_lock_irqsave(&dev->adev.slock, flags);
        hwptr_done = dev->adev.hwptr_done_capture;
+       spin_unlock_irqrestore(&dev->adev.slock, flags);
 
        return hwptr_done;
 }
index ef9bf008a924731f9f7e4728087d0a5050606e26..3b3ca3f46d52e1f78e67a94dc831d0565be92dd4 100644 (file)
@@ -102,6 +102,18 @@ static struct em28xx_reg_seq em2880_msi_digivox_ad_analog[] = {
 /* Board  - EM2870 Kworld 355u
    Analog - No input analog */
 
+static struct em28xx_reg_seq kworld_330u_analog[] = {
+       {EM28XX_R08_GPIO,       0x6d,   ~EM_GPIO_4,     10},
+       {EM2880_R04_GPO,        0x00,   0xff,           10},
+       { -1,                   -1,     -1,             -1},
+};
+
+static struct em28xx_reg_seq kworld_330u_digital[] = {
+       {EM28XX_R08_GPIO,       0x6e,   ~EM_GPIO_4,     10},
+       {EM2880_R04_GPO,        0x08,   0xff,           10},
+       { -1,                   -1,     -1,             -1},
+};
+
 /* Callback for the most boards */
 static struct em28xx_reg_seq default_tuner_gpio[] = {
        {EM28XX_R08_GPIO,       EM_GPIO_4,      EM_GPIO_4,      10},
@@ -1177,29 +1189,33 @@ struct em28xx_board em28xx_boards[] = {
                        .gpio     = hauppauge_wintv_hvr_900_analog,
                } },
        },
-       [EM2883_BOARD_KWORLD_HYBRID_A316] = {
+       [EM2883_BOARD_KWORLD_HYBRID_330U] = {
                .name         = "Kworld PlusTV HD Hybrid 330",
                .tuner_type   = TUNER_XC2028,
                .tuner_gpio   = default_tuner_gpio,
                .decoder      = EM28XX_TVP5150,
                .mts_firmware = 1,
                .has_dvb      = 1,
-               .dvb_gpio     = default_digital,
+               .dvb_gpio     = kworld_330u_digital,
+               .xclk             = EM28XX_XCLK_FREQUENCY_12MHZ,
+               .i2c_speed        = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_EEPROM_ON_BOARD | EM28XX_I2C_EEPROM_KEY_VALID,
                .input        = { {
                        .type     = EM28XX_VMUX_TELEVISION,
                        .vmux     = TVP5150_COMPOSITE0,
                        .amux     = EM28XX_AMUX_VIDEO,
-                       .gpio     = default_analog,
+                       .gpio     = kworld_330u_analog,
+                       .aout     = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
                }, {
                        .type     = EM28XX_VMUX_COMPOSITE1,
                        .vmux     = TVP5150_COMPOSITE1,
                        .amux     = EM28XX_AMUX_LINE_IN,
-                       .gpio     = hauppauge_wintv_hvr_900_analog,
+                       .gpio     = kworld_330u_analog,
+                       .aout     = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
                }, {
                        .type     = EM28XX_VMUX_SVIDEO,
                        .vmux     = TVP5150_SVIDEO,
                        .amux     = EM28XX_AMUX_LINE_IN,
-                       .gpio     = hauppauge_wintv_hvr_900_analog,
+                       .gpio     = kworld_330u_analog,
                } },
        },
        [EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = {
@@ -1249,7 +1265,7 @@ struct usb_device_id em28xx_id_table [] = {
        { USB_DEVICE(0xeb1a, 0xe310),
                        .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
        { USB_DEVICE(0xeb1a, 0xa316),
-                       .driver_info = EM2883_BOARD_KWORLD_HYBRID_A316 },
+                       .driver_info = EM2883_BOARD_KWORLD_HYBRID_330U },
        { USB_DEVICE(0xeb1a, 0xe320),
                        .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
        { USB_DEVICE(0xeb1a, 0xe323),
@@ -1526,6 +1542,10 @@ static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
                /* FIXME: Better to specify the needed IF */
                ctl->demod = XC3028_FE_DEFAULT;
                break;
+       case EM2883_BOARD_KWORLD_HYBRID_330U:
+               ctl->demod = XC3028_FE_CHINA;
+               ctl->fname = XC2028_DEFAULT_FIRMWARE;
+               break;
        default:
                ctl->demod = XC3028_FE_OREN538;
        }
index eb5fb05fab22b5ade17e07f9697549e1dbaa9dd3..94fb1b639a2e4c52762544a0cefb34b9486909b4 100644 (file)
@@ -438,6 +438,10 @@ int em28xx_audio_analog_set(struct em28xx *dev)
        if (dev->audio_mode.ac97 != EM28XX_NO_AC97) {
                int vol;
 
+               em28xx_write_ac97(dev, AC97_POWER_DOWN_CTRL, 0x4200);
+               em28xx_write_ac97(dev, AC97_EXT_AUD_CTRL, 0x0031);
+               em28xx_write_ac97(dev, AC97_PCM_IN_SRATE, 0xbb80);
+
                /* LSB: left channel - both channels with the same level */
                vol = (0x1f - dev->volume) | ((0x1f - dev->volume) << 8);
 
@@ -454,6 +458,15 @@ int em28xx_audio_analog_set(struct em28xx *dev)
                                em28xx_warn("couldn't setup AC97 register %d\n",
                                     outputs[i].reg);
                }
+
+               if (dev->ctl_aoutput & EM28XX_AOUT_PCM_IN) {
+                       int sel = ac97_return_record_select(dev->ctl_aoutput);
+
+                       /* Use the same input for both left and right channels */
+                       sel |= (sel << 8);
+
+                       em28xx_write_ac97(dev, AC97_RECORD_SELECT, sel);
+               }
        }
 
        return ret;
@@ -847,8 +860,11 @@ void em28xx_uninit_isoc(struct em28xx *dev)
        for (i = 0; i < dev->isoc_ctl.num_bufs; i++) {
                urb = dev->isoc_ctl.urb[i];
                if (urb) {
-                       usb_kill_urb(urb);
-                       usb_unlink_urb(urb);
+                       if (!irqs_disabled())
+                               usb_kill_urb(urb);
+                       else
+                               usb_unlink_urb(urb);
+
                        if (dev->isoc_ctl.transfer_buffer[i]) {
                                usb_buffer_free(dev->udev,
                                        urb->transfer_buffer_length,
index d38cb21834d9dd790d36bfb7c48e3b691fd5154b..9ad8527b3fda0b15c005edbe4ace40492687fde5 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "lgdt330x.h"
 #include "zl10353.h"
+#include "s5h1409.h"
 #ifdef EM28XX_DRX397XD_SUPPORT
 #include "drx397xD.h"
 #endif
@@ -232,6 +233,15 @@ static struct zl10353_config em28xx_zl10353_with_xc3028 = {
        .if2 = 45600,
 };
 
+static struct s5h1409_config em28xx_s5h1409_with_xc3028 = {
+       .demod_address = 0x32 >> 1,
+       .output_mode   = S5H1409_PARALLEL_OUTPUT,
+       .gpio          = S5H1409_GPIO_OFF,
+       .inversion     = S5H1409_INVERSION_OFF,
+       .status_mode   = S5H1409_DEMODLOCKING,
+       .mpeg_timing   = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK
+};
+
 #ifdef EM28XX_DRX397XD_SUPPORT
 /* [TODO] djh - not sure yet what the device config needs to contain */
 static struct drx397xD_config em28xx_drx397xD_with_xc3028 = {
@@ -412,7 +422,6 @@ static int dvb_init(struct em28xx *dev)
        case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
        case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
        case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
-       case EM2883_BOARD_KWORLD_HYBRID_A316:
        case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
                dvb->frontend = dvb_attach(lgdt330x_attach,
                                           &em2880_lgdt3303_dev,
@@ -433,6 +442,15 @@ static int dvb_init(struct em28xx *dev)
                        goto out_free;
                }
                break;
+       case EM2883_BOARD_KWORLD_HYBRID_330U:
+               dvb->frontend = dvb_attach(s5h1409_attach,
+                                          &em28xx_s5h1409_with_xc3028,
+                                          &dev->i2c_adap);
+               if (attach_xc3028(0x61, dev) < 0) {
+                       result = -EINVAL;
+                       goto out_free;
+               }
+               break;
        case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
 #ifdef EM28XX_DRX397XD_SUPPORT
                /* We don't have the config structure properly populated, so
index 416b691c33c1eafd382420fbc7dbb1af79ff64f3..8e61b2ca9167810b3b8db9f6f7b982be41bd369e 100644 (file)
@@ -886,10 +886,10 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
        if (0 == INPUT(i)->type)
                return -EINVAL;
 
-       mutex_lock(&dev->lock);
-
-       video_mux(dev, i);
+       dev->ctl_input = i;
 
+       mutex_lock(&dev->lock);
+       video_mux(dev, dev->ctl_input);
        mutex_unlock(&dev->lock);
        return 0;
 }
@@ -939,6 +939,12 @@ static int vidioc_s_audio(struct file *file, void *priv, struct v4l2_audio *a)
        struct em28xx_fh   *fh  = priv;
        struct em28xx      *dev = fh->dev;
 
+
+       if (a->index >= MAX_EM28XX_INPUT)
+               return -EINVAL;
+       if (0 == INPUT(a->index)->type)
+               return -EINVAL;
+
        mutex_lock(&dev->lock);
 
        dev->ctl_ainput = INPUT(a->index)->amux;
@@ -1950,6 +1956,7 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev,
 
 int em28xx_register_analog_devices(struct em28xx *dev)
 {
+      u8 val;
        int ret;
 
        printk(KERN_INFO "%s: v4l2 driver version %d.%d.%d\n",
@@ -1957,34 +1964,34 @@ int em28xx_register_analog_devices(struct em28xx *dev)
                (EM28XX_VERSION_CODE >> 16) & 0xff,
                (EM28XX_VERSION_CODE >> 8) & 0xff, EM28XX_VERSION_CODE & 0xff);
 
+       /* set default norm */
+       dev->norm = em28xx_video_template.current_norm;
+       dev->width = norm_maxw(dev);
+       dev->height = norm_maxh(dev);
+       dev->interlaced = EM28XX_INTERLACED_DEFAULT;
+       dev->hscale = 0;
+       dev->vscale = 0;
+       dev->ctl_input = 0;
+
        /* Analog specific initialization */
        dev->format = &format[0];
-       video_mux(dev, 0);
+       video_mux(dev, dev->ctl_input);
+
+       /* Audio defaults */
+       dev->mute = 1;
+       dev->volume = 0x1f;
 
        /* enable vbi capturing */
 
 /*     em28xx_write_reg(dev, EM28XX_R0E_AUDIOSRC, 0xc0); audio register */
-/*     em28xx_write_reg(dev, EM28XX_R0F_XCLK, 0x80); clk register */
+       val = (u8)em28xx_read_reg(dev, EM28XX_R0F_XCLK);
+       em28xx_write_reg(dev, EM28XX_R0F_XCLK, (EM28XX_XCLK_AUDIO_UNMUTE | val));
        em28xx_write_reg(dev, EM28XX_R11_VINCTRL, 0x51);
 
-       dev->mute = 1;          /* maybe not the right place... */
-       dev->volume = 0x1f;
-
        em28xx_set_outfmt(dev);
        em28xx_colorlevels_set_default(dev);
        em28xx_compression_disable(dev);
 
-       /* set default norm */
-       dev->norm = em28xx_video_template.current_norm;
-       dev->width = norm_maxw(dev);
-       dev->height = norm_maxh(dev);
-       dev->interlaced = EM28XX_INTERLACED_DEFAULT;
-       dev->hscale = 0;
-       dev->vscale = 0;
-
-       /* FIXME: This is a very bad hack! Not all devices have TV on input 2 */
-       dev->ctl_input = 2;
-
        /* allocate and fill video video_device struct */
        dev->vdev = em28xx_vdev_init(dev, &em28xx_video_template, "video");
        if (!dev->vdev) {
index 6c6b94aa05b2ca2377d0672c3149095cd38661e1..dd2cd36fb1bbdcc1cab644e12b56b96e30d0041a 100644 (file)
@@ -94,7 +94,7 @@
 #define EM2882_BOARD_KWORLD_VS_DVBT              54
 #define EM2882_BOARD_TERRATEC_HYBRID_XS                  55
 #define EM2882_BOARD_PINNACLE_HYBRID_PRO         56
-#define EM2883_BOARD_KWORLD_HYBRID_A316                  57
+#define EM2883_BOARD_KWORLD_HYBRID_330U                  57
 #define EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU     58
 #define EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850     60
 #define EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2    61
@@ -300,13 +300,32 @@ enum em28xx_amux {
 };
 
 enum em28xx_aout {
+       /* AC97 outputs */
        EM28XX_AOUT_MASTER = 1 << 0,
        EM28XX_AOUT_LINE   = 1 << 1,
        EM28XX_AOUT_MONO   = 1 << 2,
        EM28XX_AOUT_LFE    = 1 << 3,
        EM28XX_AOUT_SURR   = 1 << 4,
+
+       /* PCM IN Mixer - used by AC97_RECORD_SELECT register */
+       EM28XX_AOUT_PCM_IN = 1 << 7,
+
+       /* Bits 10-8 are used to indicate the PCM IN record select */
+       EM28XX_AOUT_PCM_MIC_PCM = 0 << 8,
+       EM28XX_AOUT_PCM_CD      = 1 << 8,
+       EM28XX_AOUT_PCM_VIDEO   = 2 << 8,
+       EM28XX_AOUT_PCM_AUX     = 3 << 8,
+       EM28XX_AOUT_PCM_LINE    = 4 << 8,
+       EM28XX_AOUT_PCM_STEREO  = 5 << 8,
+       EM28XX_AOUT_PCM_MONO    = 6 << 8,
+       EM28XX_AOUT_PCM_PHONE   = 7 << 8,
 };
 
+static inline int ac97_return_record_select(int a_out)
+{
+       return (a_out & 0x700) >> 8;
+}
+
 struct em28xx_reg_seq {
        int reg;
        unsigned char val, mask;
index 5e36b9a4ae3ea289ee016af8041230ef622ef0bf..2ed24527ecd61cea70287dd668725445799ee4fa 100644 (file)
@@ -423,7 +423,8 @@ static void destroy_urbs(struct gspca_dev *gspca_dev)
                        break;
 
                gspca_dev->urb[i] = NULL;
-               usb_kill_urb(urb);
+               if (!gspca_dev->present)
+                       usb_kill_urb(urb);
                if (urb->transfer_buffer != NULL)
                        usb_buffer_free(gspca_dev->dev,
                                        urb->transfer_buffer_length,
@@ -1950,7 +1951,6 @@ void gspca_disconnect(struct usb_interface *intf)
        struct gspca_dev *gspca_dev = usb_get_intfdata(intf);
 
        gspca_dev->present = 0;
-       gspca_dev->streaming = 0;
 
        usb_set_intfdata(intf, NULL);
 
index e8e5921cdc346dd8b26efa1ad93cc01f1791acdb..c46c990987f9b417a263e51782eb0ec3915b05a0 100644 (file)
@@ -949,8 +949,10 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
        itv->instance = atomic_inc_return(&ivtv_instance) - 1;
 
        retval = v4l2_device_register(&dev->dev, &itv->device);
-       if (retval)
+       if (retval) {
+               kfree(itv);
                return retval;
+       }
        /* "ivtv + PCI ID" is a bit of a mouthful, so use
           "ivtv + instance" instead. */
        snprintf(itv->device.name, sizeof(itv->device.name),
index 39fbc970f43de09da5d45fd6951b82af337a2775..0d810189dd87836861e1974267137e6325e5b7e4 100644 (file)
@@ -62,7 +62,6 @@
 #include <linux/poll.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
-#include <linux/version.h>
 #include <asm/io.h>
 
 #include "pwc.h"
index d6848f7a503b5874e58259696f69f8033f89b407..05221d47dd4c9e464db5483c94d52435acd764b6 100644 (file)
@@ -149,7 +149,7 @@ static const struct i2c_reg_value saa7127_init_config_common[] = {
        { SAA7127_REG_COPYGEN_0,                        0x77 },
        { SAA7127_REG_COPYGEN_1,                        0x41 },
        { SAA7127_REG_COPYGEN_2,                        0x00 }, /* Macrovision enable/disable */
-       { SAA7127_REG_OUTPUT_PORT_CONTROL,              0x9e },
+       { SAA7127_REG_OUTPUT_PORT_CONTROL,              0xbf },
        { SAA7127_REG_GAIN_LUMINANCE_RGB,               0x00 },
        { SAA7127_REG_GAIN_COLORDIFF_RGB,               0x00 },
        { SAA7127_REG_INPUT_PORT_CONTROL_1,             0x80 }, /* for color bars */
@@ -488,12 +488,18 @@ static int saa7127_set_output_type(struct v4l2_subdev *sd, int output)
                break;
 
        case SAA7127_OUTPUT_TYPE_COMPOSITE:
-               state->reg_2d = 0x08;   /* 00001000 CVBS only, RGB DAC's off (high impedance mode) */
+               if (state->ident == V4L2_IDENT_SAA7129)
+                       state->reg_2d = 0x20;   /* CVBS only */
+               else
+                       state->reg_2d = 0x08;   /* 00001000 CVBS only, RGB DAC's off (high impedance mode) */
                state->reg_3a = 0x13;   /* by default switch YUV to RGB-matrix on */
                break;
 
        case SAA7127_OUTPUT_TYPE_SVIDEO:
-               state->reg_2d = 0xff;   /* 11111111  croma -> R, luma -> CVBS + G + B */
+               if (state->ident == V4L2_IDENT_SAA7129)
+                       state->reg_2d = 0x18;   /* Y + C */
+               else
+                       state->reg_2d = 0xff;   /*11111111  croma -> R, luma -> CVBS + G + B */
                state->reg_3a = 0x13;   /* by default switch YUV to RGB-matrix on */
                break;
 
@@ -508,7 +514,10 @@ static int saa7127_set_output_type(struct v4l2_subdev *sd, int output)
                break;
 
        case SAA7127_OUTPUT_TYPE_BOTH:
-               state->reg_2d = 0xbf;
+               if (state->ident == V4L2_IDENT_SAA7129)
+                       state->reg_2d = 0x38;
+               else
+                       state->reg_2d = 0xbf;
                state->reg_3a = 0x13;   /* by default switch YUV to RGB-matrix on */
                break;
 
@@ -731,24 +740,6 @@ static int saa7127_probe(struct i2c_client *client,
                return -ENODEV;
        }
 
-       /* Configure Encoder */
-
-       v4l2_dbg(1, debug, sd, "Configuring encoder\n");
-       saa7127_write_inittab(sd, saa7127_init_config_common);
-       saa7127_set_std(sd, V4L2_STD_NTSC);
-       saa7127_set_output_type(sd, SAA7127_OUTPUT_TYPE_BOTH);
-       saa7127_set_vps(sd, &vbi);
-       saa7127_set_wss(sd, &vbi);
-       saa7127_set_cc(sd, &vbi);
-       saa7127_set_xds(sd, &vbi);
-       if (test_image == 1)
-               /* The Encoder has an internal Colorbar generator */
-               /* This can be used for debugging */
-               saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_TEST_IMAGE);
-       else
-               saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_NORMAL);
-       saa7127_set_video_enable(sd, 1);
-
        if (id->driver_data) {  /* Chip type is already known */
                state->ident = id->driver_data;
        } else {                /* Needs detection */
@@ -770,6 +761,23 @@ static int saa7127_probe(struct i2c_client *client,
 
        v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name,
                        client->addr << 1, client->adapter->name);
+
+       v4l2_dbg(1, debug, sd, "Configuring encoder\n");
+       saa7127_write_inittab(sd, saa7127_init_config_common);
+       saa7127_set_std(sd, V4L2_STD_NTSC);
+       saa7127_set_output_type(sd, SAA7127_OUTPUT_TYPE_BOTH);
+       saa7127_set_vps(sd, &vbi);
+       saa7127_set_wss(sd, &vbi);
+       saa7127_set_cc(sd, &vbi);
+       saa7127_set_xds(sd, &vbi);
+       if (test_image == 1)
+               /* The Encoder has an internal Colorbar generator */
+               /* This can be used for debugging */
+               saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_TEST_IMAGE);
+       else
+               saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_NORMAL);
+       saa7127_set_video_enable(sd, 1);
+
        if (state->ident == V4L2_IDENT_SAA7129)
                saa7127_write_inittab(sd, saa7129_init_config_extra);
        return 0;
index 26194a0ce927c4e414c66c89dbabf29d8a00fdbd..c750d3dd57d20c2f8a858c342ada09b21fd1b1c1 100644 (file)
@@ -1089,7 +1089,11 @@ static int saa7134_alsa_init(void)
 
        list_for_each(list,&saa7134_devlist) {
                dev = list_entry(list, struct saa7134_dev, devlist);
-               alsa_device_init(dev);
+               if (dev->pci->device == PCI_DEVICE_ID_PHILIPS_SAA7130)
+                       printk(KERN_INFO "%s/alsa: %s doesn't support digital audio\n",
+                               dev->name, saa7134_boards[dev->board].name);
+               else
+                       alsa_device_init(dev);
        }
 
        if (dev == NULL)
index dfbe08a9ad9b8517f4a234ecc86d8c1af52ef98f..99221d726edb373603c6d75789459b3209b03b9b 100644 (file)
@@ -660,6 +660,10 @@ static int saa7134_hwinit1(struct saa7134_dev *dev)
 
        saa_writel(SAA7134_IRQ1, 0);
        saa_writel(SAA7134_IRQ2, 0);
+
+       /* Clear any stale IRQ reports */
+       saa_writel(SAA7134_IRQ_REPORT, saa_readl(SAA7134_IRQ_REPORT));
+
        mutex_init(&dev->lock);
        spin_lock_init(&dev->slock);
 
index 454ad1dd7507a5f523b8513ef10988cd06d6b81f..88c5e942f751806d414b753234dee9d984fb197a 100644 (file)
@@ -30,7 +30,6 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index 56f0c0eb500facd70b7657f5f05cc8d432a25671..00c6cbe06ab0e047d7132b8cb3f699a3ee4049fe 100644 (file)
@@ -242,7 +242,7 @@ static int tda9875_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 static int tda9875_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 {
        struct tda9875 *t = to_state(sd);
-       int chvol=0, volume, balance, left, right;
+       int chvol = 0, volume = 0, balance = 0, left, right;
 
        switch (ctrl->id) {
        case V4L2_CID_AUDIO_VOLUME:
index 3b0b84c2e451524b2465effa64754c5db3b7d4be..78277abb733be27074074e671e9abfaad7ffb169 100644 (file)
@@ -427,6 +427,9 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
        const char *t_fmt_name2[8] = { " none", "", "", "", "", "", "", "" };
 
        memset(tvee, 0, sizeof(*tvee));
+       tvee->tuner_type = TUNER_ABSENT;
+       tvee->tuner2_type = TUNER_ABSENT;
+
        done = len = beenhere = 0;
 
        /* Different eeprom start offsets for em28xx, cx2388x and cx23418 */
index ac9aa40d09f60ea05f0b613a42d8095b6664e428..8e23aa53c29ac7e06ac54c646fb5a97397a663d0 100644 (file)
@@ -1401,7 +1401,7 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
 
        decoder->pdata = client->dev.platform_data;
        if (!decoder->pdata) {
-               v4l_err(client, "No platform data\n!!");
+               v4l_err(client, "No platform data!!\n");
                return -ENODEV;
        }
        /*
index 4f16effb530fd61f33328e57028f67ec8c39faf4..f4522bb0891666742231012f5cc23d9cd519b35e 100644 (file)
@@ -21,7 +21,6 @@
  */
 
 
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/i2c.h>
index 4b712f69d1b715c1fddce33e9cadb7f531ccf62d..a5fb74bf2407901052a468b9f24dee8be598f2d6 100644 (file)
@@ -21,7 +21,6 @@
  * 02110-1301, USA.
  */
 
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/i2c.h>
index 9907b9aff2b9228bc9aecb92305c7d4418563d8f..6b66ae4f430f04889768575758f06596262d0ded 100644 (file)
@@ -157,7 +157,7 @@ usbvision_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num)
        struct i2c_msg *pmsg;
        struct usb_usbvision *usbvision;
        int i, ret;
-       unsigned char addr;
+       unsigned char addr = 0;
 
        usbvision = (struct usb_usbvision *)i2c_get_adapdata(i2c_adap);
 
index 2208165aa6f0c27db68994b1f3dacce55912fc26..d2576f6391c06f4c643c96f9b0ffc0051e5fa124 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *      uvc_ctrl.c  --  USB Video Class driver - Controls
  *
- *      Copyright (C) 2005-2008
+ *      Copyright (C) 2005-2009
  *          Laurent Pinchart (laurent.pinchart@skynet.be)
  *
  *      This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/version.h>
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/uaccess.h>
@@ -29,7 +28,7 @@
 #define UVC_CTRL_DATA_BACKUP   1
 
 /* ------------------------------------------------------------------------
- * Control, formats, ...
+ * Controls
  */
 
 static struct uvc_control_info uvc_ctrls[] = {
@@ -635,7 +634,7 @@ static __s32 uvc_get_le_value(struct uvc_control_mapping *mapping,
                mask = (1 << bits) - 1;
        }
 
-       /* Sign-extend the value if needed */
+       /* Sign-extend the value if needed. */
        if (mapping->data_type == UVC_CTRL_DATA_TYPE_SIGNED)
                value |= -(value & (1 << (mapping->size - 1)));
 
index 89d8bd10a8521b6c108d219470bdebf7850d6651..b12873265cc56c5c811a6cba514305f8e6534a3d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *      uvc_driver.c  --  USB Video Class driver
  *
- *      Copyright (C) 2005-2008
+ *      Copyright (C) 2005-2009
  *          Laurent Pinchart (laurent.pinchart@skynet.be)
  *
  *      This program is free software; you can redistribute it and/or modify
@@ -24,7 +24,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/version.h>
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/usb.h>
@@ -49,7 +48,7 @@ static unsigned int uvc_quirks_param;
 unsigned int uvc_trace_param;
 
 /* ------------------------------------------------------------------------
- * Control, formats, ...
+ * Video formats
  */
 
 static struct uvc_format_desc uvc_fmts[] = {
@@ -474,7 +473,7 @@ static int uvc_parse_format(struct uvc_device *dev,
 
                /* Several UVC chipsets screw up dwMaxVideoFrameBufferSize
                 * completely. Observed behaviours range from setting the
-                * value to 1.1x the actual frame size of hardwiring the
+                * value to 1.1x the actual frame size to hardwiring the
                 * 16 low bits to 0. This results in a higher than necessary
                 * memory usage as well as a wrong image size information. For
                 * uncompressed formats this can be fixed by computing the
@@ -487,7 +486,7 @@ static int uvc_parse_format(struct uvc_device *dev,
                /* Some bogus devices report dwMinFrameInterval equal to
                 * dwMaxFrameInterval and have dwFrameIntervalStep set to
                 * zero. Setting all null intervals to 1 fixes the problem and
-                * some other divisions by zero which could happen.
+                * some other divisions by zero that could happen.
                 */
                for (i = 0; i < n; ++i) {
                        interval = get_unaligned_le32(&buffer[26+4*i]);
@@ -1200,13 +1199,13 @@ static void uvc_unregister_video(struct uvc_device *dev)
  * Scan the UVC descriptors to locate a chain starting at an Output Terminal
  * and containing the following units:
  *
- * - a USB Streaming Output Terminal
+ * - one Output Terminal (USB Streaming or Display)
  * - zero or one Processing Unit
  * - zero, one or mode single-input Selector Units
  * - zero or one multiple-input Selector Units, provided all inputs are
  *   connected to input terminals
  * - zero, one or mode single-input Extension Units
- * - one Camera Input Terminal, or one or more External terminals.
+ * - one or more Input Terminals (Camera, External or USB Streaming)
  *
  * A side forward scan is made on each detected entity to check for additional
  * extension units.
@@ -1531,10 +1530,6 @@ static int uvc_register_video(struct uvc_device *dev)
 
        /* Set the driver data before calling video_register_device, otherwise
         * uvc_v4l2_open might race us.
-        *
-        * FIXME: usb_set_intfdata hasn't been called so far. Is that a
-        *        problem ? Does any function which could be called here get
-        *        a pointer to the usb_interface ?
         */
        dev->video.vdev = vdev;
        video_set_drvdata(vdev, &dev->video);
@@ -1569,7 +1564,7 @@ void uvc_delete(struct kref *kref)
        struct uvc_device *dev = container_of(kref, struct uvc_device, kref);
        struct list_head *p, *n;
 
-       /* Unregister the video device */
+       /* Unregister the video device. */
        uvc_unregister_video(dev);
        usb_put_intf(dev->intf);
        usb_put_dev(dev->udev);
@@ -1612,7 +1607,7 @@ static int uvc_probe(struct usb_interface *intf,
                uvc_trace(UVC_TRACE_PROBE, "Probing generic UVC device %s\n",
                                udev->devpath);
 
-       /* Allocate memory for the device and initialize it */
+       /* Allocate memory for the device and initialize it. */
        if ((dev = kzalloc(sizeof *dev, GFP_KERNEL)) == NULL)
                return -ENOMEM;
 
@@ -1633,14 +1628,14 @@ static int uvc_probe(struct usb_interface *intf,
                        le16_to_cpu(udev->descriptor.idVendor),
                        le16_to_cpu(udev->descriptor.idProduct));
 
-       /* Parse the Video Class control descriptor */
+       /* Parse the Video Class control descriptor. */
        if (uvc_parse_control(dev) < 0) {
                uvc_trace(UVC_TRACE_PROBE, "Unable to parse UVC "
                        "descriptors.\n");
                goto error;
        }
 
-       uvc_printk(KERN_INFO, "Found UVC %u.%02u device %s (%04x:%04x)\n",
+       uvc_printk(KERN_INFO, "Found UVC %u.%02x device %s (%04x:%04x)\n",
                dev->uvc_version >> 8, dev->uvc_version & 0xff,
                udev->product ? udev->product : "<unnamed>",
                le16_to_cpu(udev->descriptor.idVendor),
@@ -1653,18 +1648,18 @@ static int uvc_probe(struct usb_interface *intf,
                        "linux-uvc-devel mailing list.\n");
        }
 
-       /* Initialize controls */
+       /* Initialize controls. */
        if (uvc_ctrl_init_device(dev) < 0)
                goto error;
 
-       /* Register the video devices */
+       /* Register the video devices. */
        if (uvc_register_video(dev) < 0)
                goto error;
 
-       /* Save our data pointer in the interface data */
+       /* Save our data pointer in the interface data. */
        usb_set_intfdata(intf, dev);
 
-       /* Initialize the interrupt URB */
+       /* Initialize the interrupt URB. */
        if ((ret = uvc_status_init(dev)) < 0) {
                uvc_printk(KERN_INFO, "Unable to initialize the status "
                        "endpoint (%d), status interrupt will not be "
@@ -1839,24 +1834,24 @@ static struct usb_device_id uvc_ids[] = {
          .bInterfaceSubClass   = 1,
          .bInterfaceProtocol   = 0 },
        /* Apple Built-In iSight */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
+       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
          .idVendor             = 0x05ac,
          .idProduct            = 0x8501,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = 0,
+         .bInterfaceClass      = USB_CLASS_VIDEO,
+         .bInterfaceSubClass   = 1,
+         .bInterfaceProtocol   = 0,
          .driver_info          = UVC_QUIRK_PROBE_MINMAX
                                | UVC_QUIRK_BUILTIN_ISIGHT },
        /* Genesys Logic USB 2.0 PC Camera */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
+       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x05e3,
-         .idProduct            = 0x0505,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = 0,
-         .driver_info          = UVC_QUIRK_STREAM_NO_FID },
+         .idVendor             = 0x05e3,
+         .idProduct            = 0x0505,
+         .bInterfaceClass      = USB_CLASS_VIDEO,
+         .bInterfaceSubClass   = 1,
+         .bInterfaceProtocol   = 0,
+         .driver_info          = UVC_QUIRK_STREAM_NO_FID },
        /* MT6227 */
        { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
index 37bdefdbead511ea671190effe1912ee5e4d057b..436f462685a09adb3e959e1f92c5b5f3bb0ae9eb 100644 (file)
@@ -3,6 +3,8 @@
  *
  *     Copyright (C) 2006-2007
  *             Ivan N. Zlatev <contact@i-nz.net>
+ *     Copyright (C) 2008-2009
+ *             Laurent Pinchart <laurent.pinchart@skynet.be>
  *
  *      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
index 42546342e97d08b2f46263df98fbb07f02f18b97..0155752e4a5aea54140c55044a266df1099b8575 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *      uvc_queue.c  --  USB Video Class driver - Buffers management
  *
- *      Copyright (C) 2005-2008
+ *      Copyright (C) 2005-2009
  *          Laurent Pinchart (laurent.pinchart@skynet.be)
  *
  *      This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/version.h>
 #include <linux/mm.h>
 #include <linux/list.h>
 #include <linux/module.h>
  * to user space will return -EBUSY.
  *
  * Video buffers are managed using two queues. However, unlike most USB video
- * drivers which use an in queue and an out queue, we use a main queue which
- * holds all queued buffers (both 'empty' and 'done' buffers), and an irq
- * queue which holds empty buffers. This design (copied from video-buf)
- * minimizes locking in interrupt, as only one queue is shared between
- * interrupt and user contexts.
+ * drivers that use an in queue and an out queue, we use a main queue to hold
+ * all queued buffers (both 'empty' and 'done' buffers), and an irq queue to
+ * hold empty buffers. This design (copied from video-buf) minimizes locking
+ * in interrupt, as only one queue is shared between interrupt and user
+ * contexts.
  *
  * Use cases
  * ---------
  *
- * Unless stated otherwise, all operations which modify the irq buffers queue
+ * Unless stated otherwise, all operations that modify the irq buffers queue
  * are protected by the irq spinlock.
  *
  * 1. The user queues the buffers, starts streaming and dequeues a buffer.
  *
  *    The buffers are added to the main and irq queues. Both operations are
- *    protected by the queue lock, and the latert is protected by the irq
+ *    protected by the queue lock, and the later is protected by the irq
  *    spinlock as well.
  *
  *    The completion handler fetches a buffer from the irq queue and fills it
@@ -60,7 +59,7 @@
  *    returns immediately.
  *
  *    When the buffer is full, the completion handler removes it from the irq
- *    queue, marks it as ready (UVC_BUF_STATE_DONE) and wake its wait queue.
+ *    queue, marks it as ready (UVC_BUF_STATE_DONE) and wakes its wait queue.
  *    At that point, any process waiting on the buffer will be woken up. If a
  *    process tries to dequeue a buffer after it has been marked ready, the
  *    dequeing will succeed immediately.
@@ -91,8 +90,8 @@ void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type)
 /*
  * Allocate the video buffers.
  *
- * Pages are reserved to make sure they will not be swaped, as they will be
- * filled in URB completion handler.
+ * Pages are reserved to make sure they will not be swapped, as they will be
+ * filled in the URB completion handler.
  *
  * Buffers will be individually mapped, so they must all be page aligned.
  */
@@ -210,8 +209,8 @@ int uvc_query_buffer(struct uvc_video_queue *queue,
        __uvc_query_buffer(&queue->buffer[v4l2_buf->index], v4l2_buf);
 
 done:
-       mutex_unlock(&queue->mutex);
-       return ret;
+       mutex_unlock(&queue->mutex);
+       return ret;
 }
 
 /*
@@ -236,7 +235,7 @@ int uvc_queue_buffer(struct uvc_video_queue *queue,
        }
 
        mutex_lock(&queue->mutex);
-       if (v4l2_buf->index >= queue->count)  {
+       if (v4l2_buf->index >= queue->count) {
                uvc_trace(UVC_TRACE_CAPTURE, "[E] Out of range index.\n");
                ret = -EINVAL;
                goto done;
@@ -429,7 +428,7 @@ done:
  * Cancel the video buffers queue.
  *
  * Cancelling the queue marks all buffers on the irq queue as erroneous,
- * wakes them up and remove them from the queue.
+ * wakes them up and removes them from the queue.
  *
  * If the disconnect parameter is set, further calls to uvc_queue_buffer will
  * fail with -ENODEV.
index 5d60b264d59a1d2f7d2a3b41c224023cc5aff40e..c1e4ae27c61388f9c70c529badef2dfc9dd0808d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *      uvc_status.c  --  USB Video Class driver - Status endpoint
  *
- *      Copyright (C) 2007-2008
+ *      Copyright (C) 2007-2009
  *          Laurent Pinchart (laurent.pinchart@skynet.be)
  *
  *      This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/version.h>
 #include <linux/input.h>
 #include <linux/usb.h>
 #include <linux/usb/input.h>
index fa150fff2c10964e0ea8c2b9deb0ac22a98a96a3..d681519d0c8ae1ffa380352f85819c59ee44450f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *      uvc_v4l2.c  --  USB Video Class driver - V4L2 API
  *
- *      Copyright (C) 2005-2008
+ *      Copyright (C) 2005-2009
  *          Laurent Pinchart (laurent.pinchart@skynet.be)
  *
  *      This program is free software; you can redistribute it and/or modify
@@ -37,7 +37,7 @@
  * must be grouped (for instance the Red Balance, Blue Balance and Do White
  * Balance V4L2 controls use the White Balance Component UVC control) or
  * otherwise translated. The approach we take here is to use a translation
- * table for the controls which can be mapped directly, and handle the others
+ * table for the controls that can be mapped directly, and handle the others
  * manually.
  */
 static int uvc_v4l2_query_menu(struct uvc_video_device *video,
@@ -189,7 +189,7 @@ static int uvc_v4l2_try_format(struct uvc_video_device *video,
                probe->dwMaxVideoFrameSize =
                        video->streaming->ctrl.dwMaxVideoFrameSize;
 
-       /* Probe the device */
+       /* Probe the device. */
        if ((ret = uvc_probe_video(video, probe)) < 0)
                goto done;
 
@@ -354,11 +354,11 @@ static int uvc_v4l2_set_streamparm(struct uvc_video_device *video,
  *
  * Each open instance of a UVC device can either be in a privileged or
  * unprivileged state. Only a single instance can be in a privileged state at
- * a given time. Trying to perform an operation which requires privileges will
+ * a given time. Trying to perform an operation that requires privileges will
  * automatically acquire the required privileges if possible, or return -EBUSY
  * otherwise. Privileges are dismissed when closing the instance.
  *
- * Operations which require privileges are:
+ * Operations that require privileges are:
  *
  * - VIDIOC_S_INPUT
  * - VIDIOC_S_PARM
index e7c31995527f3d520d50283b8246e5cc5a312b6c..9bc4705be78d8ebb893a9dd24d2e6215c344507f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *      uvc_video.c  --  USB Video Class driver - Video handling
  *
- *      Copyright (C) 2005-2008
+ *      Copyright (C) 2005-2009
  *          Laurent Pinchart (laurent.pinchart@skynet.be)
  *
  *      This program is free software; you can redistribute it and/or modify
@@ -12,7 +12,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/version.h>
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/usb.h>
@@ -115,7 +114,7 @@ static int uvc_get_video_ctrl(struct uvc_video_device *video,
                ctrl->wCompQuality = le16_to_cpup((__le16 *)data);
                ret = 0;
                goto out;
-       } else if (query == GET_DEF && probe == 1) {
+       } else if (query == GET_DEF && probe == 1 && ret != size) {
                /* Many cameras don't support the GET_DEF request on their
                 * video probe control. Warn once and return, the caller will
                 * fall back to GET_CUR.
@@ -160,7 +159,7 @@ static int uvc_get_video_ctrl(struct uvc_video_device *video,
        }
 
        /* Some broken devices return a null or wrong dwMaxVideoFrameSize.
-        * Try to get the value from the format and frame descriptor.
+        * Try to get the value from the format and frame descriptors.
         */
        uvc_fixup_buffer_size(video, ctrl);
        ret = 0;
@@ -191,9 +190,6 @@ static int uvc_set_video_ctrl(struct uvc_video_device *video,
        *(__le16 *)&data[12] = cpu_to_le16(ctrl->wCompQuality);
        *(__le16 *)&data[14] = cpu_to_le16(ctrl->wCompWindowSize);
        *(__le16 *)&data[16] = cpu_to_le16(ctrl->wDelay);
-       /* Note: Some of the fields below are not required for IN devices (see
-        * UVC spec, 4.3.1.1), but we still copy them in case support for OUT
-        * devices is added in the future. */
        put_unaligned_le32(ctrl->dwMaxVideoFrameSize, &data[18]);
        put_unaligned_le32(ctrl->dwMaxPayloadTransferSize, &data[22]);
 
@@ -400,7 +396,7 @@ static int uvc_video_decode_start(struct uvc_video_device *video,
         *
         * Empty buffers (bytesused == 0) don't trigger end of frame detection
         * as it doesn't make sense to return an empty buffer. This also
-        * avoids detecting and of frame conditions at FID toggling if the
+        * avoids detecting end of frame conditions at FID toggling if the
         * previous payload had the EOF bit set.
         */
        if (fid != video->last_fid && buf->buf.bytesused != 0) {
@@ -453,6 +449,17 @@ static void uvc_video_decode_end(struct uvc_video_device *video,
        }
 }
 
+/* Video payload encoding is handled by uvc_video_encode_header() and
+ * uvc_video_encode_data(). Only bulk transfers are currently supported.
+ *
+ * uvc_video_encode_header is called at the start of a payload. It adds header
+ * data to the transfer buffer and returns the header size. As the only known
+ * UVC output device transfers a whole frame in a single payload, the EOF bit
+ * is always set in the header.
+ *
+ * uvc_video_encode_data is called for every URB and copies the data from the
+ * video buffer to the transfer buffer.
+ */
 static int uvc_video_encode_header(struct uvc_video_device *video,
                struct uvc_buffer *buf, __u8 *data, int len)
 {
@@ -953,7 +960,7 @@ int uvc_video_suspend(struct uvc_video_device *video)
 }
 
 /*
- * Reconfigure the video interface and restart streaming if it was enable
+ * Reconfigure the video interface and restart streaming if it was enabled
  * before suspend.
  *
  * If an error occurs, disable the video queue. This will wake all pending
@@ -985,8 +992,8 @@ int uvc_video_resume(struct uvc_video_device *video)
  */
 
 /*
- * Initialize the UVC video device by retrieving the default format and
- * committing it.
+ * Initialize the UVC video device by switching to alternate setting 0 and
+ * retrieve the default format.
  *
  * Some cameras (namely the Fuji Finepix) set the format and frame
  * indexes to zero. The UVC standard doesn't clearly make this a spec
@@ -1014,7 +1021,7 @@ int uvc_video_init(struct uvc_video_device *video)
         */
        usb_set_interface(video->dev->udev, video->streaming->intfnum, 0);
 
-       /* Some webcams don't suport GET_DEF request on the probe control. We
+       /* Some webcams don't suport GET_DEF requests on the probe control. We
         * fall back to GET_CUR if GET_DEF fails.
         */
        if ((ret = uvc_get_video_ctrl(video, probe, 1, GET_DEF)) < 0 &&
index bcf4361dc1bc8ffd543e5f1533d0b85d413da076..027947ea9b6eb497bc1263f07680902d08bec5ba 100644 (file)
@@ -72,149 +72,149 @@ struct uvc_xu_control {
  * UVC constants
  */
 
-#define SC_UNDEFINED                    0x00
-#define SC_VIDEOCONTROL                 0x01
-#define SC_VIDEOSTREAMING               0x02
-#define SC_VIDEO_INTERFACE_COLLECTION   0x03
+#define SC_UNDEFINED                   0x00
+#define SC_VIDEOCONTROL                        0x01
+#define SC_VIDEOSTREAMING              0x02
+#define SC_VIDEO_INTERFACE_COLLECTION  0x03
 
-#define PC_PROTOCOL_UNDEFINED           0x00
+#define PC_PROTOCOL_UNDEFINED          0x00
 
-#define CS_UNDEFINED                    0x20
-#define CS_DEVICE                       0x21
-#define CS_CONFIGURATION                0x22
-#define CS_STRING                       0x23
-#define CS_INTERFACE                    0x24
-#define CS_ENDPOINT                     0x25
+#define CS_UNDEFINED                   0x20
+#define CS_DEVICE                      0x21
+#define CS_CONFIGURATION               0x22
+#define CS_STRING                      0x23
+#define CS_INTERFACE                   0x24
+#define CS_ENDPOINT                    0x25
 
 /* VideoControl class specific interface descriptor */
-#define VC_DESCRIPTOR_UNDEFINED         0x00
-#define VC_HEADER                       0x01
-#define VC_INPUT_TERMINAL               0x02
-#define VC_OUTPUT_TERMINAL              0x03
-#define VC_SELECTOR_UNIT                0x04
-#define VC_PROCESSING_UNIT              0x05
-#define VC_EXTENSION_UNIT               0x06
+#define VC_DESCRIPTOR_UNDEFINED                0x00
+#define VC_HEADER                      0x01
+#define VC_INPUT_TERMINAL              0x02
+#define VC_OUTPUT_TERMINAL             0x03
+#define VC_SELECTOR_UNIT               0x04
+#define VC_PROCESSING_UNIT             0x05
+#define VC_EXTENSION_UNIT              0x06
 
 /* VideoStreaming class specific interface descriptor */
-#define VS_UNDEFINED                    0x00
-#define VS_INPUT_HEADER                 0x01
-#define VS_OUTPUT_HEADER                0x02
-#define VS_STILL_IMAGE_FRAME            0x03
-#define VS_FORMAT_UNCOMPRESSED          0x04
-#define VS_FRAME_UNCOMPRESSED           0x05
-#define VS_FORMAT_MJPEG                 0x06
-#define VS_FRAME_MJPEG                  0x07
-#define VS_FORMAT_MPEG2TS               0x0a
-#define VS_FORMAT_DV                    0x0c
-#define VS_COLORFORMAT                  0x0d
-#define VS_FORMAT_FRAME_BASED           0x10
-#define VS_FRAME_FRAME_BASED            0x11
-#define VS_FORMAT_STREAM_BASED          0x12
+#define VS_UNDEFINED                   0x00
+#define VS_INPUT_HEADER                        0x01
+#define VS_OUTPUT_HEADER               0x02
+#define VS_STILL_IMAGE_FRAME           0x03
+#define VS_FORMAT_UNCOMPRESSED         0x04
+#define VS_FRAME_UNCOMPRESSED          0x05
+#define VS_FORMAT_MJPEG                        0x06
+#define VS_FRAME_MJPEG                 0x07
+#define VS_FORMAT_MPEG2TS              0x0a
+#define VS_FORMAT_DV                   0x0c
+#define VS_COLORFORMAT                 0x0d
+#define VS_FORMAT_FRAME_BASED          0x10
+#define VS_FRAME_FRAME_BASED           0x11
+#define VS_FORMAT_STREAM_BASED         0x12
 
 /* Endpoint type */
-#define EP_UNDEFINED                    0x00
-#define EP_GENERAL                      0x01
-#define EP_ENDPOINT                     0x02
-#define EP_INTERRUPT                    0x03
+#define EP_UNDEFINED                   0x00
+#define EP_GENERAL                     0x01
+#define EP_ENDPOINT                    0x02
+#define EP_INTERRUPT                   0x03
 
 /* Request codes */
-#define RC_UNDEFINED                    0x00
-#define SET_CUR                         0x01
-#define GET_CUR                         0x81
-#define GET_MIN                         0x82
-#define GET_MAX                         0x83
-#define GET_RES                         0x84
-#define GET_LEN                         0x85
-#define GET_INFO                        0x86
-#define GET_DEF                         0x87
+#define RC_UNDEFINED                   0x00
+#define SET_CUR                                0x01
+#define GET_CUR                                0x81
+#define GET_MIN                                0x82
+#define GET_MAX                                0x83
+#define GET_RES                                0x84
+#define GET_LEN                                0x85
+#define GET_INFO                       0x86
+#define GET_DEF                                0x87
 
 /* VideoControl interface controls */
-#define VC_CONTROL_UNDEFINED            0x00
-#define VC_VIDEO_POWER_MODE_CONTROL     0x01
-#define VC_REQUEST_ERROR_CODE_CONTROL   0x02
+#define VC_CONTROL_UNDEFINED           0x00
+#define VC_VIDEO_POWER_MODE_CONTROL    0x01
+#define VC_REQUEST_ERROR_CODE_CONTROL  0x02
 
 /* Terminal controls */
-#define TE_CONTROL_UNDEFINED            0x00
+#define TE_CONTROL_UNDEFINED           0x00
 
 /* Selector Unit controls */
-#define SU_CONTROL_UNDEFINED            0x00
-#define SU_INPUT_SELECT_CONTROL         0x01
+#define SU_CONTROL_UNDEFINED           0x00
+#define SU_INPUT_SELECT_CONTROL                0x01
 
 /* Camera Terminal controls */
-#define CT_CONTROL_UNDEFINED                           0x00
-#define CT_SCANNING_MODE_CONTROL                       0x01
-#define CT_AE_MODE_CONTROL                             0x02
-#define CT_AE_PRIORITY_CONTROL                         0x03
-#define CT_EXPOSURE_TIME_ABSOLUTE_CONTROL               0x04
-#define CT_EXPOSURE_TIME_RELATIVE_CONTROL               0x05
-#define CT_FOCUS_ABSOLUTE_CONTROL                      0x06
-#define CT_FOCUS_RELATIVE_CONTROL                      0x07
-#define CT_FOCUS_AUTO_CONTROL                          0x08
-#define CT_IRIS_ABSOLUTE_CONTROL                       0x09
-#define CT_IRIS_RELATIVE_CONTROL                       0x0a
-#define CT_ZOOM_ABSOLUTE_CONTROL                       0x0b
-#define CT_ZOOM_RELATIVE_CONTROL                       0x0c
-#define CT_PANTILT_ABSOLUTE_CONTROL                    0x0d
-#define CT_PANTILT_RELATIVE_CONTROL                    0x0e
-#define CT_ROLL_ABSOLUTE_CONTROL                       0x0f
-#define CT_ROLL_RELATIVE_CONTROL                       0x10
-#define CT_PRIVACY_CONTROL                             0x11
+#define CT_CONTROL_UNDEFINED                           0x00
+#define CT_SCANNING_MODE_CONTROL                       0x01
+#define CT_AE_MODE_CONTROL                             0x02
+#define CT_AE_PRIORITY_CONTROL                         0x03
+#define CT_EXPOSURE_TIME_ABSOLUTE_CONTROL              0x04
+#define CT_EXPOSURE_TIME_RELATIVE_CONTROL              0x05
+#define CT_FOCUS_ABSOLUTE_CONTROL                      0x06
+#define CT_FOCUS_RELATIVE_CONTROL                      0x07
+#define CT_FOCUS_AUTO_CONTROL                          0x08
+#define CT_IRIS_ABSOLUTE_CONTROL                       0x09
+#define CT_IRIS_RELATIVE_CONTROL                       0x0a
+#define CT_ZOOM_ABSOLUTE_CONTROL                       0x0b
+#define CT_ZOOM_RELATIVE_CONTROL                       0x0c
+#define CT_PANTILT_ABSOLUTE_CONTROL                    0x0d
+#define CT_PANTILT_RELATIVE_CONTROL                    0x0e
+#define CT_ROLL_ABSOLUTE_CONTROL                       0x0f
+#define CT_ROLL_RELATIVE_CONTROL                       0x10
+#define CT_PRIVACY_CONTROL                             0x11
 
 /* Processing Unit controls */
-#define PU_CONTROL_UNDEFINED                           0x00
-#define PU_BACKLIGHT_COMPENSATION_CONTROL               0x01
-#define PU_BRIGHTNESS_CONTROL                          0x02
-#define PU_CONTRAST_CONTROL                            0x03
-#define PU_GAIN_CONTROL                                0x04
-#define PU_POWER_LINE_FREQUENCY_CONTROL                0x05
-#define PU_HUE_CONTROL                                 0x06
-#define PU_SATURATION_CONTROL                          0x07
-#define PU_SHARPNESS_CONTROL                           0x08
-#define PU_GAMMA_CONTROL                               0x09
-#define PU_WHITE_BALANCE_TEMPERATURE_CONTROL            0x0a
-#define PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL       0x0b
-#define PU_WHITE_BALANCE_COMPONENT_CONTROL              0x0c
-#define PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL         0x0d
-#define PU_DIGITAL_MULTIPLIER_CONTROL                  0x0e
-#define PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL             0x0f
-#define PU_HUE_AUTO_CONTROL                            0x10
-#define PU_ANALOG_VIDEO_STANDARD_CONTROL                0x11
-#define PU_ANALOG_LOCK_STATUS_CONTROL                  0x12
+#define PU_CONTROL_UNDEFINED                           0x00
+#define PU_BACKLIGHT_COMPENSATION_CONTROL              0x01
+#define PU_BRIGHTNESS_CONTROL                          0x02
+#define PU_CONTRAST_CONTROL                            0x03
+#define PU_GAIN_CONTROL                                        0x04
+#define PU_POWER_LINE_FREQUENCY_CONTROL                        0x05
+#define PU_HUE_CONTROL                                 0x06
+#define PU_SATURATION_CONTROL                          0x07
+#define PU_SHARPNESS_CONTROL                           0x08
+#define PU_GAMMA_CONTROL                               0x09
+#define PU_WHITE_BALANCE_TEMPERATURE_CONTROL           0x0a
+#define PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL      0x0b
+#define PU_WHITE_BALANCE_COMPONENT_CONTROL             0x0c
+#define PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL                0x0d
+#define PU_DIGITAL_MULTIPLIER_CONTROL                  0x0e
+#define PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL            0x0f
+#define PU_HUE_AUTO_CONTROL                            0x10
+#define PU_ANALOG_VIDEO_STANDARD_CONTROL               0x11
+#define PU_ANALOG_LOCK_STATUS_CONTROL                  0x12
 
 #define LXU_MOTOR_PANTILT_RELATIVE_CONTROL             0x01
 #define LXU_MOTOR_PANTILT_RESET_CONTROL                        0x02
 #define LXU_MOTOR_FOCUS_MOTOR_CONTROL                  0x03
 
 /* VideoStreaming interface controls */
-#define VS_CONTROL_UNDEFINED            0x00
-#define VS_PROBE_CONTROL                0x01
-#define VS_COMMIT_CONTROL               0x02
-#define VS_STILL_PROBE_CONTROL          0x03
-#define VS_STILL_COMMIT_CONTROL         0x04
-#define VS_STILL_IMAGE_TRIGGER_CONTROL  0x05
-#define VS_STREAM_ERROR_CODE_CONTROL    0x06
-#define VS_GENERATE_KEY_FRAME_CONTROL   0x07
-#define VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08
-#define VS_SYNC_DELAY_CONTROL           0x09
-
-#define TT_VENDOR_SPECIFIC              0x0100
-#define TT_STREAMING                    0x0101
+#define VS_CONTROL_UNDEFINED           0x00
+#define VS_PROBE_CONTROL               0x01
+#define VS_COMMIT_CONTROL              0x02
+#define VS_STILL_PROBE_CONTROL         0x03
+#define VS_STILL_COMMIT_CONTROL                0x04
+#define VS_STILL_IMAGE_TRIGGER_CONTROL 0x05
+#define VS_STREAM_ERROR_CODE_CONTROL   0x06
+#define VS_GENERATE_KEY_FRAME_CONTROL  0x07
+#define VS_UPDATE_FRAME_SEGMENT_CONTROL        0x08
+#define VS_SYNC_DELAY_CONTROL          0x09
+
+#define TT_VENDOR_SPECIFIC             0x0100
+#define TT_STREAMING                   0x0101
 
 /* Input Terminal types */
-#define ITT_VENDOR_SPECIFIC             0x0200
-#define ITT_CAMERA                      0x0201
-#define ITT_MEDIA_TRANSPORT_INPUT       0x0202
+#define ITT_VENDOR_SPECIFIC            0x0200
+#define ITT_CAMERA                     0x0201
+#define ITT_MEDIA_TRANSPORT_INPUT      0x0202
 
 /* Output Terminal types */
-#define OTT_VENDOR_SPECIFIC             0x0300
-#define OTT_DISPLAY                     0x0301
-#define OTT_MEDIA_TRANSPORT_OUTPUT      0x0302
+#define OTT_VENDOR_SPECIFIC            0x0300
+#define OTT_DISPLAY                    0x0301
+#define OTT_MEDIA_TRANSPORT_OUTPUT     0x0302
 
 /* External Terminal types */
-#define EXTERNAL_VENDOR_SPECIFIC        0x0400
-#define COMPOSITE_CONNECTOR             0x0401
-#define SVIDEO_CONNECTOR                0x0402
-#define COMPONENT_CONNECTOR             0x0403
+#define EXTERNAL_VENDOR_SPECIFIC       0x0400
+#define COMPOSITE_CONNECTOR            0x0401
+#define SVIDEO_CONNECTOR               0x0402
+#define COMPONENT_CONNECTOR            0x0403
 
 #define UVC_TERM_INPUT                 0x0000
 #define UVC_TERM_OUTPUT                        0x8000
@@ -541,11 +541,11 @@ struct uvc_streaming {
 };
 
 enum uvc_buffer_state {
-       UVC_BUF_STATE_IDLE       = 0,
-       UVC_BUF_STATE_QUEUED     = 1,
-       UVC_BUF_STATE_ACTIVE     = 2,
-       UVC_BUF_STATE_DONE       = 3,
-       UVC_BUF_STATE_ERROR      = 4,
+       UVC_BUF_STATE_IDLE      = 0,
+       UVC_BUF_STATE_QUEUED    = 1,
+       UVC_BUF_STATE_ACTIVE    = 2,
+       UVC_BUF_STATE_DONE      = 3,
+       UVC_BUF_STATE_ERROR     = 4,
 };
 
 struct uvc_buffer {
index fbe9cc0d433a29cf16a33d89a55a001596ad0c5e..21208805ea9bb67991de26a14738cf2b486247d2 100644 (file)
@@ -28,13 +28,13 @@ int v4l2_subdev_command(struct v4l2_subdev *sd, unsigned cmd, void *arg)
 {
        switch (cmd) {
        case VIDIOC_QUERYCTRL:
-               return v4l2_subdev_call(sd, core, querymenu, arg);
+               return v4l2_subdev_call(sd, core, queryctrl, arg);
        case VIDIOC_G_CTRL:
                return v4l2_subdev_call(sd, core, g_ctrl, arg);
        case VIDIOC_S_CTRL:
                return v4l2_subdev_call(sd, core, s_ctrl, arg);
        case VIDIOC_QUERYMENU:
-               return v4l2_subdev_call(sd, core, queryctrl, arg);
+               return v4l2_subdev_call(sd, core, querymenu, arg);
        case VIDIOC_LOG_STATUS:
                return v4l2_subdev_call(sd, core, log_status);
        case VIDIOC_DBG_G_CHIP_IDENT:
index 46b7ad477ceb5caece92b5e0cab3d601895bf2ce..e873a916250f4dbfbca98370413eb064a9c3f81b 100644 (file)
@@ -349,7 +349,6 @@ struct card_info {
        u16 i2c_decoder, i2c_encoder;                   /* I2C types */
        u16 video_vfe, video_codec;                     /* videocodec types */
        u16 audio_chip;                                 /* audio type */
-       u16 vendor_id, device_id;       /* subsystem vendor/device ID */
 
        int inputs;             /* number of video inputs */
        struct input {
@@ -401,7 +400,6 @@ struct zoran {
        char name[32];          /* name of this device */
        struct pci_dev *pci_dev;        /* PCI device */
        unsigned char revision; /* revision of zr36057 */
-       unsigned int zr36057_adr;       /* bus address of IO mem returned by PCI BIOS */
        unsigned char __iomem *zr36057_mem;/* pointer to mapped IO memory */
 
        spinlock_t spinlock;    /* Spinlock */
@@ -490,16 +488,10 @@ struct zoran {
        wait_queue_head_t test_q;
 };
 
-/*The following should be done in more portable way. It depends on define
-  of _ALPHA_BUZ in the Makefile.*/
-
-#ifdef _ALPHA_BUZ
-#define btwrite(dat,adr)    writel((dat), zr->zr36057_adr+(adr))
-#define btread(adr)         readl(zr->zr36057_adr+(adr))
-#else
+/* There was something called _ALPHA_BUZ that used the PCI address instead of
+ * the kernel iomapped address for btread/btwrite.  */
 #define btwrite(dat,adr)    writel((dat), zr->zr36057_mem+(adr))
 #define btread(adr)         readl(zr->zr36057_mem+(adr))
-#endif
 
 #define btand(dat,adr)      btwrite((dat) & btread(adr), adr)
 #define btor(dat,adr)       btwrite((dat) | btread(adr), adr)
index 05f39195372e00def2749ee47428db426f63c7a1..5d2f090aa0f82c12aa3adec4daed69bffea4d63a 100644 (file)
 
 extern const struct zoran_format zoran_formats[];
 
-static int card[BUZ_MAX] = { -1, -1, -1, -1 };
+static int card[BUZ_MAX] = { [0 ... (BUZ_MAX-1)] = -1 };
 module_param_array(card, int, NULL, 0444);
-MODULE_PARM_DESC(card, "The type of card");
+MODULE_PARM_DESC(card, "Card type");
 
-static int encoder[BUZ_MAX] = { -1, -1, -1, -1 };
+static int encoder[BUZ_MAX] = { [0 ... (BUZ_MAX-1)] = -1 };
 module_param_array(encoder, int, NULL, 0444);
-MODULE_PARM_DESC(encoder, "i2c TV encoder");
+MODULE_PARM_DESC(encoder, "Video encoder chip");
 
-static int decoder[BUZ_MAX] = { -1, -1, -1, -1 };
+static int decoder[BUZ_MAX] = { [0 ... (BUZ_MAX-1)] = -1 };
 module_param_array(decoder, int, NULL, 0444);
-MODULE_PARM_DESC(decoder, "i2c TV decoder");
+MODULE_PARM_DESC(decoder, "Video decoder chip");
 
 /*
    The video mem address of the video card.
@@ -104,9 +104,9 @@ module_param(default_norm, int, 0444);
 MODULE_PARM_DESC(default_norm, "Default norm (0=PAL, 1=NTSC, 2=SECAM)");
 
 /* /dev/videoN, -1 for autodetect */
-static int video_nr[BUZ_MAX] = {-1, -1, -1, -1};
+static int video_nr[BUZ_MAX] = { [0 ... (BUZ_MAX-1)] = -1 };
 module_param_array(video_nr, int, NULL, 0444);
-MODULE_PARM_DESC(video_nr, "video device number (-1=Auto)");
+MODULE_PARM_DESC(video_nr, "Video device number (-1=Auto)");
 
 /*
    Number and size of grab buffers for Video 4 Linux
@@ -153,9 +153,21 @@ MODULE_DESCRIPTION("Zoran-36057/36067 JPEG codec driver");
 MODULE_AUTHOR("Serguei Miridonov");
 MODULE_LICENSE("GPL");
 
+#define ZR_DEVICE(subven, subdev, data)        { \
+       .vendor = PCI_VENDOR_ID_ZORAN, .device = PCI_DEVICE_ID_ZORAN_36057, \
+       .subvendor = (subven), .subdevice = (subdev), .driver_data = (data) }
+
+static struct pci_device_id zr36067_pci_tbl[] = {
+       ZR_DEVICE(PCI_VENDOR_ID_MIRO, PCI_DEVICE_ID_MIRO_DC10PLUS, DC10plus),
+       ZR_DEVICE(PCI_VENDOR_ID_MIRO, PCI_DEVICE_ID_MIRO_DC30PLUS, DC30plus),
+       ZR_DEVICE(PCI_VENDOR_ID_ELECTRONICDESIGNGMBH, PCI_DEVICE_ID_LML_33R10, LML33R10),
+       ZR_DEVICE(PCI_VENDOR_ID_IOMEGA, PCI_DEVICE_ID_IOMEGA_BUZ, BUZ),
+       ZR_DEVICE(PCI_ANY_ID, PCI_ANY_ID, NUM_CARDS),
+       {0}
+};
+MODULE_DEVICE_TABLE(pci, zr36067_pci_tbl);
 
-int zoran_num;                 /* number of Buzs in use */
-struct zoran *zoran[BUZ_MAX];
+static unsigned int zoran_num;         /* number of cards found */
 
 /* videocodec bus functions ZR36060 */
 static u32
@@ -472,8 +484,6 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = {
        }, {
                .type = DC10plus,
                .name = "DC10plus",
-               .vendor_id = PCI_VENDOR_ID_MIRO,
-               .device_id = PCI_DEVICE_ID_MIRO_DC10PLUS,
                .i2c_decoder = I2C_DRIVERID_SAA7110,
                .i2c_encoder = I2C_DRIVERID_ADV7175,
                .video_codec = CODEC_TYPE_ZR36060,
@@ -531,8 +541,6 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = {
        }, {
                .type = DC30plus,
                .name = "DC30plus",
-               .vendor_id = PCI_VENDOR_ID_MIRO,
-               .device_id = PCI_DEVICE_ID_MIRO_DC30PLUS,
                .i2c_decoder = I2C_DRIVERID_VPX3220,
                .i2c_encoder = I2C_DRIVERID_ADV7175,
                .video_codec = CODEC_TYPE_ZR36050,
@@ -589,8 +597,6 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = {
        }, {
                .type = LML33R10,
                .name = "LML33R10",
-               .vendor_id = PCI_VENDOR_ID_ELECTRONICDESIGNGMBH,
-               .device_id = PCI_DEVICE_ID_LML_33R10,
                .i2c_decoder = I2C_DRIVERID_SAA7114,
                .i2c_encoder = I2C_DRIVERID_ADV7170,
                .video_codec = CODEC_TYPE_ZR36060,
@@ -618,8 +624,6 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = {
        }, {
                .type = BUZ,
                .name = "Buz",
-               .vendor_id = PCI_VENDOR_ID_IOMEGA,
-               .device_id = PCI_DEVICE_ID_IOMEGA_BUZ,
                .i2c_decoder = I2C_DRIVERID_SAA7111A,
                .i2c_encoder = I2C_DRIVERID_SAA7185B,
                .video_codec = CODEC_TYPE_ZR36060,
@@ -649,8 +653,6 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = {
                .name = "6-Eyes",
                /* AverMedia chose not to brand the 6-Eyes. Thus it
                   can't be autodetected, and requires card=x. */
-               .vendor_id = -1,
-               .device_id = -1,
                .i2c_decoder = I2C_DRIVERID_KS0127,
                .i2c_encoder = I2C_DRIVERID_BT866,
                .video_codec = CODEC_TYPE_ZR36060,
@@ -1138,7 +1140,8 @@ zr36057_init (struct zoran *zr)
        strcpy(zr->video_dev->name, ZR_DEVNAME(zr));
        err = video_register_device(zr->video_dev, VFL_TYPE_GRABBER, video_nr[zr->id]);
        if (err < 0)
-               goto exit_unregister;
+               goto exit_free;
+       video_set_drvdata(zr->video_dev, zr);
 
        zoran_init_hardware(zr);
        if (zr36067_debug > 2)
@@ -1153,19 +1156,19 @@ zr36057_init (struct zoran *zr)
        zr->initialized = 1;
        return 0;
 
-exit_unregister:
-       zoran_unregister_i2c(zr);
 exit_free:
        kfree(zr->stat_com);
        kfree(zr->video_dev);
        return err;
 }
 
-static void
-zoran_release (struct zoran *zr)
+static void __devexit zoran_remove(struct pci_dev *pdev)
 {
+       struct zoran *zr = pci_get_drvdata(pdev);
+
        if (!zr->initialized)
                goto exit_free;
+
        /* unregister videocodec bus */
        if (zr->codec) {
                struct videocodec_master *master = zr->codec->master_data;
@@ -1194,6 +1197,7 @@ zoran_release (struct zoran *zr)
        pci_disable_device(zr->pci_dev);
        video_unregister_device(zr->video_dev);
 exit_free:
+       pci_set_drvdata(pdev, NULL);
        kfree(zr);
 }
 
@@ -1256,338 +1260,329 @@ zoran_setup_videocodec (struct zoran *zr,
  *   Scan for a Buz card (actually for the PCI controller ZR36057),
  *   request the irq and map the io memory
  */
-static int __devinit
-find_zr36057 (void)
+static int __devinit zoran_probe(struct pci_dev *pdev,
+                                const struct pci_device_id *ent)
 {
        unsigned char latency, need_latency;
        struct zoran *zr;
-       struct pci_dev *dev = NULL;
        int result;
        struct videocodec_master *master_vfe = NULL;
        struct videocodec_master *master_codec = NULL;
        int card_num;
        char *i2c_enc_name, *i2c_dec_name, *codec_name, *vfe_name;
+       unsigned int nr;
 
-       zoran_num = 0;
-       while (zoran_num < BUZ_MAX &&
-              (dev = pci_get_device(PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36057, dev)) != NULL) {
-               card_num = card[zoran_num];
-               zr = kzalloc(sizeof(struct zoran), GFP_KERNEL);
-               if (!zr) {
-                       dprintk(1,
-                               KERN_ERR
-                               "%s: find_zr36057() - kzalloc failed\n",
-                               ZORAN_NAME);
-                       continue;
-               }
-               zr->pci_dev = dev;
-               //zr->zr36057_mem = NULL;
-               zr->id = zoran_num;
-               snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "MJPEG[%u]", zr->id);
-               spin_lock_init(&zr->spinlock);
-               mutex_init(&zr->resource_lock);
-               if (pci_enable_device(dev))
-                       goto zr_free_mem;
-               zr->zr36057_adr = pci_resource_start(zr->pci_dev, 0);
-               pci_read_config_byte(zr->pci_dev, PCI_CLASS_REVISION,
-                                    &zr->revision);
-               if (zr->revision < 2) {
-                       dprintk(1,
-                               KERN_INFO
-                               "%s: Zoran ZR36057 (rev %d) irq: %d, memory: 0x%08x.\n",
-                               ZR_DEVNAME(zr), zr->revision, zr->pci_dev->irq,
-                               zr->zr36057_adr);
 
-                       if (card_num == -1) {
-                               dprintk(1,
-                                       KERN_ERR
-                                       "%s: find_zr36057() - no card specified, please use the card=X insmod option\n",
-                                       ZR_DEVNAME(zr));
-                               goto zr_free_mem;
-                       }
-               } else {
-                       int i;
-                       unsigned short ss_vendor, ss_device;
+       nr = zoran_num++;
+       if (nr >= BUZ_MAX) {
+               dprintk(1,
+                       KERN_ERR
+                       "%s: driver limited to %d card(s) maximum\n",
+                       ZORAN_NAME, BUZ_MAX);
+               return -ENOENT;
+       }
 
-                       ss_vendor = zr->pci_dev->subsystem_vendor;
-                       ss_device = zr->pci_dev->subsystem_device;
+       zr = kzalloc(sizeof(struct zoran), GFP_KERNEL);
+       if (!zr) {
+               dprintk(1,
+                       KERN_ERR
+                       "%s: find_zr36057() - kzalloc failed\n",
+                       ZORAN_NAME);
+               return -ENOMEM;
+       }
+       zr->pci_dev = pdev;
+       zr->id = nr;
+       snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "MJPEG[%u]", zr->id);
+       spin_lock_init(&zr->spinlock);
+       mutex_init(&zr->resource_lock);
+       if (pci_enable_device(pdev))
+               goto zr_free_mem;
+       pci_read_config_byte(zr->pci_dev, PCI_CLASS_REVISION, &zr->revision);
+
+       dprintk(1,
+               KERN_INFO
+               "%s: Zoran ZR360%c7 (rev %d), irq: %d, memory: 0x%08llx\n",
+               ZR_DEVNAME(zr), zr->revision < 2 ? '5' : '6', zr->revision,
+               zr->pci_dev->irq, (uint64_t)pci_resource_start(zr->pci_dev, 0));
+       if (zr->revision >= 2) {
+               dprintk(1,
+                       KERN_INFO
+                       "%s: Subsystem vendor=0x%04x id=0x%04x\n",
+                       ZR_DEVNAME(zr), zr->pci_dev->subsystem_vendor,
+                       zr->pci_dev->subsystem_device);
+       }
+
+       /* Use auto-detected card type? */
+       if (card[nr] == -1) {
+               if (zr->revision < 2) {
                        dprintk(1,
-                               KERN_INFO
-                               "%s: Zoran ZR36067 (rev %d) irq: %d, memory: 0x%08x\n",
-                               ZR_DEVNAME(zr), zr->revision, zr->pci_dev->irq,
-                               zr->zr36057_adr);
+                               KERN_ERR
+                               "%s: No card type specified, please use the card=X module parameter\n",
+                               ZR_DEVNAME(zr));
                        dprintk(1,
-                               KERN_INFO
-                               "%s: subsystem vendor=0x%04x id=0x%04x\n",
-                               ZR_DEVNAME(zr), ss_vendor, ss_device);
-                       if (card_num == -1) {
-                               dprintk(3,
-                                       KERN_DEBUG
-                                       "%s: find_zr36057() - trying to autodetect card type\n",
-                                       ZR_DEVNAME(zr));
-                               for (i=0;i<NUM_CARDS;i++) {
-                                       if (ss_vendor == zoran_cards[i].vendor_id &&
-                                           ss_device == zoran_cards[i].device_id) {
-                                               dprintk(3,
-                                                       KERN_DEBUG
-                                                       "%s: find_zr36057() - card %s detected\n",
-                                                       ZR_DEVNAME(zr),
-                                                       zoran_cards[i].name);
-                                               card_num = i;
-                                               break;
-                                       }
-                               }
-                               if (i == NUM_CARDS) {
-                                       dprintk(1,
-                                               KERN_ERR
-                                               "%s: find_zr36057() - unknown card\n",
-                                               ZR_DEVNAME(zr));
-                                       goto zr_free_mem;
-                               }
-                       }
-               }
-
-               if (card_num < 0 || card_num >= NUM_CARDS) {
-                       dprintk(2,
                                KERN_ERR
-                               "%s: find_zr36057() - invalid cardnum %d\n",
-                               ZR_DEVNAME(zr), card_num);
+                               "%s: It is not possible to auto-detect ZR36057 based cards\n",
+                               ZR_DEVNAME(zr));
                        goto zr_free_mem;
                }
 
-               /* even though we make this a non pointer and thus
-                * theoretically allow for making changes to this struct
-                * on a per-individual card basis at runtime, this is
-                * strongly discouraged. This structure is intended to
-                * keep general card information, no settings or anything */
-               zr->card = zoran_cards[card_num];
-               snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)),
-                        "%s[%u]", zr->card.name, zr->id);
-
-               zr->zr36057_mem = ioremap_nocache(zr->zr36057_adr, 0x1000);
-               if (!zr->zr36057_mem) {
+               card_num = ent->driver_data;
+               if (card_num >= NUM_CARDS) {
                        dprintk(1,
                                KERN_ERR
-                               "%s: find_zr36057() - ioremap failed\n",
+                               "%s: Unknown card, try specifying card=X module parameter\n",
                                ZR_DEVNAME(zr));
                        goto zr_free_mem;
                }
-
-               result = request_irq(zr->pci_dev->irq,
-                                    zoran_irq,
-                                    IRQF_SHARED | IRQF_DISABLED,
-                                    ZR_DEVNAME(zr),
-                                    (void *) zr);
-               if (result < 0) {
-                       if (result == -EINVAL) {
-                               dprintk(1,
-                                       KERN_ERR
-                                       "%s: find_zr36057() - bad irq number or handler\n",
-                                       ZR_DEVNAME(zr));
-                       } else if (result == -EBUSY) {
-                               dprintk(1,
-                                       KERN_ERR
-                                       "%s: find_zr36057() - IRQ %d busy, change your PnP config in BIOS\n",
-                                       ZR_DEVNAME(zr), zr->pci_dev->irq);
-                       } else {
-                               dprintk(1,
-                                       KERN_ERR
-                                       "%s: find_zr36057() - can't assign irq, error code %d\n",
-                                       ZR_DEVNAME(zr), result);
-                       }
-                       goto zr_unmap;
-               }
-
-               /* set PCI latency timer */
-               pci_read_config_byte(zr->pci_dev, PCI_LATENCY_TIMER,
-                                    &latency);
-               need_latency = zr->revision > 1 ? 32 : 48;
-               if (latency != need_latency) {
-                       dprintk(2,
-                               KERN_INFO
-                               "%s: Changing PCI latency from %d to %d.\n",
-                               ZR_DEVNAME(zr), latency, need_latency);
-                       pci_write_config_byte(zr->pci_dev,
-                                             PCI_LATENCY_TIMER,
-                                             need_latency);
+               dprintk(3,
+                       KERN_DEBUG
+                       "%s: %s() - card %s detected\n",
+                       ZR_DEVNAME(zr), __func__, zoran_cards[card_num].name);
+       } else {
+               card_num = card[nr];
+               if (card_num >= NUM_CARDS || card_num < 0) {
+                       dprintk(1,
+                               KERN_ERR
+                               "%s: User specified card type %d out of range (0 .. %d)\n",
+                               ZR_DEVNAME(zr), card_num, NUM_CARDS - 1);
+                       goto zr_free_mem;
                }
+       }
 
-               zr36057_restart(zr);
-               /* i2c */
-               dprintk(2, KERN_INFO "%s: Initializing i2c bus...\n",
-                       ZR_DEVNAME(zr));
+       /* even though we make this a non pointer and thus
+        * theoretically allow for making changes to this struct
+        * on a per-individual card basis at runtime, this is
+        * strongly discouraged. This structure is intended to
+        * keep general card information, no settings or anything */
+       zr->card = zoran_cards[card_num];
+       snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)),
+                "%s[%u]", zr->card.name, zr->id);
+
+       zr->zr36057_mem = pci_ioremap_bar(zr->pci_dev, 0);
+       if (!zr->zr36057_mem) {
+               dprintk(1,
+                       KERN_ERR
+                       "%s: %s() - ioremap failed\n",
+                       ZR_DEVNAME(zr), __func__);
+               goto zr_free_mem;
+       }
 
-               /* i2c decoder */
-               if (decoder[zr->id] != -1) {
-                       i2c_dec_name = i2cid_to_modulename(decoder[zr->id]);
-                       zr->card.i2c_decoder = decoder[zr->id];
-               } else if (zr->card.i2c_decoder != 0) {
-                       i2c_dec_name =
-                               i2cid_to_modulename(zr->card.i2c_decoder);
+       result = request_irq(zr->pci_dev->irq, zoran_irq,
+                            IRQF_SHARED | IRQF_DISABLED, ZR_DEVNAME(zr), zr);
+       if (result < 0) {
+               if (result == -EINVAL) {
+                       dprintk(1,
+                               KERN_ERR
+                               "%s: find_zr36057() - bad irq number or handler\n",
+                               ZR_DEVNAME(zr));
+               } else if (result == -EBUSY) {
+                       dprintk(1,
+                               KERN_ERR
+                               "%s: find_zr36057() - IRQ %d busy, change your PnP config in BIOS\n",
+                               ZR_DEVNAME(zr), zr->pci_dev->irq);
                } else {
-                       i2c_dec_name = NULL;
+                       dprintk(1,
+                               KERN_ERR
+                               "%s: find_zr36057() - can't assign irq, error code %d\n",
+                               ZR_DEVNAME(zr), result);
                }
+               goto zr_unmap;
+       }
 
-               if (i2c_dec_name) {
-                       if ((result = request_module(i2c_dec_name)) < 0) {
-                               dprintk(1,
-                                       KERN_ERR
-                                       "%s: failed to load module %s: %d\n",
-                                       ZR_DEVNAME(zr), i2c_dec_name, result);
-                       }
-               }
+       /* set PCI latency timer */
+       pci_read_config_byte(zr->pci_dev, PCI_LATENCY_TIMER,
+                            &latency);
+       need_latency = zr->revision > 1 ? 32 : 48;
+       if (latency != need_latency) {
+               dprintk(2,
+                       KERN_INFO
+                       "%s: Changing PCI latency from %d to %d\n",
+                       ZR_DEVNAME(zr), latency, need_latency);
+               pci_write_config_byte(zr->pci_dev, PCI_LATENCY_TIMER,
+                                     need_latency);
+       }
 
-               /* i2c encoder */
-               if (encoder[zr->id] != -1) {
-                       i2c_enc_name = i2cid_to_modulename(encoder[zr->id]);
-                       zr->card.i2c_encoder = encoder[zr->id];
-               } else if (zr->card.i2c_encoder != 0) {
-                       i2c_enc_name =
-                               i2cid_to_modulename(zr->card.i2c_encoder);
-               } else {
-                       i2c_enc_name = NULL;
-               }
+       zr36057_restart(zr);
+       /* i2c */
+       dprintk(2, KERN_INFO "%s: Initializing i2c bus...\n",
+               ZR_DEVNAME(zr));
+
+       /* i2c decoder */
+       if (decoder[zr->id] != -1) {
+               i2c_dec_name = i2cid_to_modulename(decoder[zr->id]);
+               zr->card.i2c_decoder = decoder[zr->id];
+       } else if (zr->card.i2c_decoder != 0) {
+               i2c_dec_name = i2cid_to_modulename(zr->card.i2c_decoder);
+       } else {
+               i2c_dec_name = NULL;
+       }
 
-               if (i2c_enc_name) {
-                       if ((result = request_module(i2c_enc_name)) < 0) {
-                               dprintk(1,
-                                       KERN_ERR
-                                       "%s: failed to load module %s: %d\n",
-                                       ZR_DEVNAME(zr), i2c_enc_name, result);
-                       }
+       if (i2c_dec_name) {
+               result = request_module(i2c_dec_name);
+               if (result < 0) {
+                       dprintk(1,
+                               KERN_ERR
+                               "%s: failed to load module %s: %d\n",
+                               ZR_DEVNAME(zr), i2c_dec_name, result);
                }
+       }
+
+       /* i2c encoder */
+       if (encoder[zr->id] != -1) {
+               i2c_enc_name = i2cid_to_modulename(encoder[zr->id]);
+               zr->card.i2c_encoder = encoder[zr->id];
+       } else if (zr->card.i2c_encoder != 0) {
+               i2c_enc_name = i2cid_to_modulename(zr->card.i2c_encoder);
+       } else {
+               i2c_enc_name = NULL;
+       }
 
-               if (zoran_register_i2c(zr) < 0) {
+       if (i2c_enc_name) {
+               result = request_module(i2c_enc_name);
+               if (result < 0) {
                        dprintk(1,
                                KERN_ERR
-                               "%s: find_zr36057() - can't initialize i2c bus\n",
-                               ZR_DEVNAME(zr));
-                       goto zr_free_irq;
+                               "%s: failed to load module %s: %d\n",
+                               ZR_DEVNAME(zr), i2c_enc_name, result);
                }
+       }
 
-               dprintk(2,
-                       KERN_INFO "%s: Initializing videocodec bus...\n",
+       if (zoran_register_i2c(zr) < 0) {
+               dprintk(1,
+                       KERN_ERR
+                       "%s: find_zr36057() - can't initialize i2c bus\n",
                        ZR_DEVNAME(zr));
+               goto zr_free_irq;
+       }
 
-               if (zr->card.video_codec != 0 &&
-                   (codec_name =
-                    codecid_to_modulename(zr->card.video_codec)) != NULL) {
-                       if ((result = request_module(codec_name)) < 0) {
+       dprintk(2,
+               KERN_INFO "%s: Initializing videocodec bus...\n",
+               ZR_DEVNAME(zr));
+
+       if (zr->card.video_codec) {
+               codec_name = codecid_to_modulename(zr->card.video_codec);
+               if (codec_name) {
+                       result = request_module(codec_name);
+                       if (result) {
                                dprintk(1,
                                        KERN_ERR
                                        "%s: failed to load modules %s: %d\n",
                                        ZR_DEVNAME(zr), codec_name, result);
                        }
                }
-               if (zr->card.video_vfe != 0 &&
-                   (vfe_name =
-                    codecid_to_modulename(zr->card.video_vfe)) != NULL) {
-                       if ((result = request_module(vfe_name)) < 0) {
+       }
+       if (zr->card.video_vfe) {
+               vfe_name = codecid_to_modulename(zr->card.video_vfe);
+               if (vfe_name) {
+                       result = request_module(vfe_name);
+                       if (result < 0) {
                                dprintk(1,
                                        KERN_ERR
                                        "%s: failed to load modules %s: %d\n",
                                        ZR_DEVNAME(zr), vfe_name, result);
                        }
                }
+       }
 
-               /* reset JPEG codec */
-               jpeg_codec_sleep(zr, 1);
-               jpeg_codec_reset(zr);
-               /* video bus enabled */
-               /* display codec revision */
-               if (zr->card.video_codec != 0) {
-                       master_codec = zoran_setup_videocodec(zr,
-                                                             zr->card.video_codec);
-                       if (!master_codec)
-                               goto zr_unreg_i2c;
-                       zr->codec = videocodec_attach(master_codec);
-                       if (!zr->codec) {
-                               dprintk(1,
-                                       KERN_ERR
-                                       "%s: find_zr36057() - no codec found\n",
-                                       ZR_DEVNAME(zr));
-                               goto zr_free_codec;
-                       }
-                       if (zr->codec->type != zr->card.video_codec) {
-                               dprintk(1,
-                                       KERN_ERR
-                                       "%s: find_zr36057() - wrong codec\n",
-                                       ZR_DEVNAME(zr));
-                               goto zr_detach_codec;
-                       }
+       /* reset JPEG codec */
+       jpeg_codec_sleep(zr, 1);
+       jpeg_codec_reset(zr);
+       /* video bus enabled */
+       /* display codec revision */
+       if (zr->card.video_codec != 0) {
+               master_codec = zoran_setup_videocodec(zr, zr->card.video_codec);
+               if (!master_codec)
+                       goto zr_unreg_i2c;
+               zr->codec = videocodec_attach(master_codec);
+               if (!zr->codec) {
+                       dprintk(1,
+                               KERN_ERR
+                               "%s: find_zr36057() - no codec found\n",
+                               ZR_DEVNAME(zr));
+                       goto zr_free_codec;
                }
-               if (zr->card.video_vfe != 0) {
-                       master_vfe = zoran_setup_videocodec(zr,
-                                                           zr->card.video_vfe);
-                       if (!master_vfe)
-                               goto zr_detach_codec;
-                       zr->vfe = videocodec_attach(master_vfe);
-                       if (!zr->vfe) {
-                               dprintk(1,
-                                       KERN_ERR
-                                       "%s: find_zr36057() - no VFE found\n",
-                                       ZR_DEVNAME(zr));
-                               goto zr_free_vfe;
-                       }
-                       if (zr->vfe->type != zr->card.video_vfe) {
-                               dprintk(1,
-                                       KERN_ERR
-                                       "%s: find_zr36057() = wrong VFE\n",
-                                       ZR_DEVNAME(zr));
-                               goto zr_detach_vfe;
-                       }
+               if (zr->codec->type != zr->card.video_codec) {
+                       dprintk(1,
+                               KERN_ERR
+                               "%s: find_zr36057() - wrong codec\n",
+                               ZR_DEVNAME(zr));
+                       goto zr_detach_codec;
+               }
+       }
+       if (zr->card.video_vfe != 0) {
+               master_vfe = zoran_setup_videocodec(zr, zr->card.video_vfe);
+               if (!master_vfe)
+                       goto zr_detach_codec;
+               zr->vfe = videocodec_attach(master_vfe);
+               if (!zr->vfe) {
+                       dprintk(1,
+                               KERN_ERR
+                               "%s: find_zr36057() - no VFE found\n",
+                               ZR_DEVNAME(zr));
+                       goto zr_free_vfe;
+               }
+               if (zr->vfe->type != zr->card.video_vfe) {
+                       dprintk(1,
+                               KERN_ERR
+                               "%s: find_zr36057() = wrong VFE\n",
+                               ZR_DEVNAME(zr));
+                       goto zr_detach_vfe;
                }
-               /* Success so keep the pci_dev referenced */
-               pci_dev_get(zr->pci_dev);
-               zoran[zoran_num++] = zr;
-               continue;
-
-               // Init errors
-             zr_detach_vfe:
-               videocodec_detach(zr->vfe);
-             zr_free_vfe:
-               kfree(master_vfe);
-             zr_detach_codec:
-               videocodec_detach(zr->codec);
-             zr_free_codec:
-               kfree(master_codec);
-             zr_unreg_i2c:
-               zoran_unregister_i2c(zr);
-             zr_free_irq:
-               btwrite(0, ZR36057_SPGPPCR);
-               free_irq(zr->pci_dev->irq, zr);
-             zr_unmap:
-               iounmap(zr->zr36057_mem);
-             zr_free_mem:
-               kfree(zr);
-               continue;
        }
-       if (dev)        /* Clean up ref count on early exit */
-               pci_dev_put(dev);
 
-       if (zoran_num == 0) {
-               dprintk(1, KERN_INFO "No known MJPEG cards found.\n");
+       /* take care of Natoma chipset and a revision 1 zr36057 */
+       if ((pci_pci_problems & PCIPCI_NATOMA) && zr->revision <= 1) {
+               zr->jpg_buffers.need_contiguous = 1;
+               dprintk(1,
+                       KERN_INFO
+                       "%s: ZR36057/Natoma bug, max. buffer size is 128K\n",
+                       ZR_DEVNAME(zr));
        }
-       return zoran_num;
+
+       if (zr36057_init(zr) < 0)
+               goto zr_detach_vfe;
+
+       zoran_proc_init(zr);
+
+       pci_set_drvdata(pdev, zr);
+
+       return 0;
+
+zr_detach_vfe:
+       videocodec_detach(zr->vfe);
+zr_free_vfe:
+       kfree(master_vfe);
+zr_detach_codec:
+       videocodec_detach(zr->codec);
+zr_free_codec:
+       kfree(master_codec);
+zr_unreg_i2c:
+       zoran_unregister_i2c(zr);
+zr_free_irq:
+       btwrite(0, ZR36057_SPGPPCR);
+       free_irq(zr->pci_dev->irq, zr);
+zr_unmap:
+       iounmap(zr->zr36057_mem);
+zr_free_mem:
+       kfree(zr);
+
+       return -ENODEV;
 }
 
-static int __init
-init_dc10_cards (void)
+static struct pci_driver zoran_driver = {
+       .name = "zr36067",
+       .id_table = zr36067_pci_tbl,
+       .probe = zoran_probe,
+       .remove = zoran_remove,
+};
+
+static int __init zoran_init(void)
 {
-       int i;
+       int res;
 
-       memset(zoran, 0, sizeof(zoran));
        printk(KERN_INFO "Zoran MJPEG board driver version %d.%d.%d\n",
               MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION);
 
-       /* Look for cards */
-       if (find_zr36057() < 0) {
-               return -EIO;
-       }
-       if (zoran_num == 0)
-               return -ENODEV;
-       dprintk(1, KERN_INFO "%s: %d card(s) found\n", ZORAN_NAME,
-               zoran_num);
        /* check the parameters we have been given, adjust if necessary */
        if (v4l_nbufs < 2)
                v4l_nbufs = 2;
@@ -1629,37 +1624,22 @@ init_dc10_cards (void)
                        ZORAN_NAME);
        }
 
-       /* take care of Natoma chipset and a revision 1 zr36057 */
-       for (i = 0; i < zoran_num; i++) {
-               struct zoran *zr = zoran[i];
-
-               if ((pci_pci_problems & PCIPCI_NATOMA) && zr->revision <= 1) {
-                       zr->jpg_buffers.need_contiguous = 1;
-                       dprintk(1,
-                               KERN_INFO
-                               "%s: ZR36057/Natoma bug, max. buffer size is 128K\n",
-                               ZR_DEVNAME(zr));
-               }
-
-               if (zr36057_init(zr) < 0) {
-                       for (i = 0; i < zoran_num; i++)
-                               zoran_release(zoran[i]);
-                       return -EIO;
-               }
-               zoran_proc_init(zr);
+       res = pci_register_driver(&zoran_driver);
+       if (res) {
+               dprintk(1,
+                       KERN_ERR
+                       "%s: Unable to register ZR36057 driver\n",
+                       ZORAN_NAME);
+               return res;
        }
 
        return 0;
 }
 
-static void __exit
-unload_dc10_cards (void)
+static void __exit zoran_exit(void)
 {
-       int i;
-
-       for (i = 0; i < zoran_num; i++)
-               zoran_release(zoran[i]);
+       pci_unregister_driver(&zoran_driver);
 }
 
-module_init(init_dc10_cards);
-module_exit(unload_dc10_cards);
+module_init(zoran_init);
+module_exit(zoran_exit);
index e4dc9d29b404f6691447b27426d46482cd50ca1f..4507bdc5e3385d27be3ef23652390c66c28b8056 100644 (file)
@@ -40,8 +40,6 @@ extern int zr36067_debug;
 
 /* Anybody who uses more than four? */
 #define BUZ_MAX 4
-extern int zoran_num;
-extern struct zoran *zoran[BUZ_MAX];
 
 extern struct video_device zoran_template;
 
index b58b9dda715ccedb80cb4c67a42d8c0b9816a903..120ef235e63d07a3d8a3a9c16ae03006bcbdc4cf 100644 (file)
@@ -1196,83 +1196,54 @@ zoran_close_end_session (struct file *file)
  *   Open a zoran card. Right now the flags stuff is just playing
  */
 
-static int
-zoran_open(struct file  *file)
+static int zoran_open(struct file *file)
 {
-       unsigned int minor = video_devdata(file)->minor;
-       struct zoran *zr = NULL;
+       struct zoran *zr = video_drvdata(file);
        struct zoran_fh *fh;
-       int i, res, first_open = 0, have_module_locks = 0;
+       int res, first_open = 0;
 
-       lock_kernel();
-       /* find the device */
-       for (i = 0; i < zoran_num; i++) {
-               if (zoran[i]->video_dev->minor == minor) {
-                       zr = zoran[i];
-                       break;
-               }
-       }
+       dprintk(2, KERN_INFO "%s: zoran_open(%s, pid=[%d]), users(-)=%d\n",
+               ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user + 1);
 
-       if (!zr) {
-               dprintk(1, KERN_ERR "%s: device not found!\n", ZORAN_NAME);
-               res = -ENODEV;
-               goto open_unlock_and_return;
-       }
+       lock_kernel();
 
        /* see fs/device.c - the kernel already locks during open(),
         * so locking ourselves only causes deadlocks */
        /*mutex_lock(&zr->resource_lock);*/
 
+       if (zr->user >= 2048) {
+               dprintk(1, KERN_ERR "%s: too many users (%d) on device\n",
+                       ZR_DEVNAME(zr), zr->user);
+               res = -EBUSY;
+               goto fail_unlock;
+       }
+
        if (!zr->decoder) {
                dprintk(1,
                        KERN_ERR "%s: no TV decoder loaded for device!\n",
                        ZR_DEVNAME(zr));
                res = -EIO;
-               goto open_unlock_and_return;
+               goto fail_unlock;
        }
 
-       /* try to grab a module lock */
-       if (!try_module_get(THIS_MODULE)) {
-               dprintk(1,
-                       KERN_ERR
-                       "%s: failed to acquire my own lock! PANIC!\n",
-                       ZR_DEVNAME(zr));
-               res = -ENODEV;
-               goto open_unlock_and_return;
-       }
        if (!try_module_get(zr->decoder->driver->driver.owner)) {
                dprintk(1,
                        KERN_ERR
-                       "%s: failed to grab ownership of i2c decoder\n",
+                       "%s: failed to grab ownership of video decoder\n",
                        ZR_DEVNAME(zr));
                res = -EIO;
-               module_put(THIS_MODULE);
-               goto open_unlock_and_return;
+               goto fail_unlock;
        }
        if (zr->encoder &&
            !try_module_get(zr->encoder->driver->driver.owner)) {
                dprintk(1,
                        KERN_ERR
-                       "%s: failed to grab ownership of i2c encoder\n",
+                       "%s: failed to grab ownership of video encoder\n",
                        ZR_DEVNAME(zr));
                res = -EIO;
-               module_put(zr->decoder->driver->driver.owner);
-               module_put(THIS_MODULE);
-               goto open_unlock_and_return;
+               goto fail_decoder;
        }
 
-       have_module_locks = 1;
-
-       if (zr->user >= 2048) {
-               dprintk(1, KERN_ERR "%s: too many users (%d) on device\n",
-                       ZR_DEVNAME(zr), zr->user);
-               res = -EBUSY;
-               goto open_unlock_and_return;
-       }
-
-       dprintk(1, KERN_INFO "%s: zoran_open(%s, pid=[%d]), users(-)=%d\n",
-               ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user);
-
        /* now, create the open()-specific file_ops struct */
        fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL);
        if (!fh) {
@@ -1281,7 +1252,7 @@ zoran_open(struct file  *file)
                        "%s: zoran_open() - allocation of zoran_fh failed\n",
                        ZR_DEVNAME(zr));
                res = -ENOMEM;
-               goto open_unlock_and_return;
+               goto fail_encoder;
        }
        /* used to be BUZ_MAX_WIDTH/HEIGHT, but that gives overflows
         * on norm-change! */
@@ -1292,9 +1263,8 @@ zoran_open(struct file  *file)
                        KERN_ERR
                        "%s: zoran_open() - allocation of overlay_mask failed\n",
                        ZR_DEVNAME(zr));
-               kfree(fh);
                res = -ENOMEM;
-               goto open_unlock_and_return;
+               goto fail_fh;
        }
 
        if (zr->user++ == 0)
@@ -1319,22 +1289,19 @@ zoran_open(struct file  *file)
 
        return 0;
 
-open_unlock_and_return:
-       /* if we grabbed locks, release them accordingly */
-       if (have_module_locks) {
-               module_put(zr->decoder->driver->driver.owner);
-               if (zr->encoder) {
-                       module_put(zr->encoder->driver->driver.owner);
-               }
-               module_put(THIS_MODULE);
-       }
-
-       /* if there's no device found, we didn't obtain the lock either */
-       if (zr) {
-               /*mutex_unlock(&zr->resource_lock);*/
-       }
+fail_fh:
+       kfree(fh);
+fail_encoder:
+       if (zr->encoder)
+               module_put(zr->encoder->driver->driver.owner);
+fail_decoder:
+       module_put(zr->decoder->driver->driver.owner);
+fail_unlock:
        unlock_kernel();
 
+       dprintk(2, KERN_INFO "%s: open failed (%d), users(-)=%d\n",
+               ZR_DEVNAME(zr), res, zr->user);
+
        return res;
 }
 
@@ -1344,8 +1311,8 @@ zoran_close(struct file  *file)
        struct zoran_fh *fh = file->private_data;
        struct zoran *zr = fh->zr;
 
-       dprintk(1, KERN_INFO "%s: zoran_close(%s, pid=[%d]), users(+)=%d\n",
-               ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user);
+       dprintk(2, KERN_INFO "%s: zoran_close(%s, pid=[%d]), users(+)=%d\n",
+               ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user - 1);
 
        /* kernel locks (fs/device.c), so don't do that ourselves
         * (prevents deadlocks) */
@@ -1391,10 +1358,8 @@ zoran_close(struct file  *file)
 
        /* release locks on the i2c modules */
        module_put(zr->decoder->driver->driver.owner);
-       if (zr->encoder) {
-                module_put(zr->encoder->driver->driver.owner);
-       }
-       module_put(THIS_MODULE);
+       if (zr->encoder)
+               module_put(zr->encoder->driver->driver.owner);
 
        /*mutex_unlock(&zr->resource_lock);*/
 
index 24508e28e3fb87aae68d01d4fd2c8922201aefc0..ea9488e7ad6d60a7d8b80d90083d2cbe83d7beef 100644 (file)
@@ -626,7 +626,6 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
        }
 
        if (client->irq) {
-               set_irq_handler(client->irq, handle_level_irq);
                ret = request_irq(client->irq, pcf50633_irq,
                                IRQF_TRIGGER_LOW, "pcf50633", pcf);
 
index 920fa20622e0e7986c105cf53fef6fb196493862..3c74d733ee39414bc1f3eff8b35d52754f134173 100644 (file)
@@ -231,6 +231,7 @@ config DELL_LAPTOP
        depends on EXPERIMENTAL
        depends on BACKLIGHT_CLASS_DEVICE
        depends on RFKILL
+       depends on POWER_SUPPLY
        default n
        ---help---
        This driver adds support for rfkill and backlight control to Dell
index bf5e4d065436a2153c76ff13ef6adae2f2604a49..558bf3f2c27698154a6088c43a8daa781577c42b 100644 (file)
@@ -35,7 +35,7 @@ struct ssc_device *ssc_request(unsigned int ssc_num)
 
        if (!ssc_valid) {
                spin_unlock(&user_lock);
-               dev_dbg(&ssc->pdev->dev, "could not find requested device\n");
+               pr_err("ssc: ssc%d platform device is missing\n", ssc_num);
                return ERR_PTR(-ENODEV);
        }
 
index 05e298289238f77c2418094d06ef494bc944ed53..f26667a7abf7c6ce0e7a3a911d7bb193f2489859 100644 (file)
@@ -207,7 +207,7 @@ static void ilo_ccb_close(struct pci_dev *pdev, struct ccb_data *data)
                  &device_ccb->recv_ctrl);
 
        /* give iLO some time to process stop request */
-       for (retries = 1000; retries > 0; retries--) {
+       for (retries = MAX_WAIT; retries > 0; retries--) {
                doorbell_set(driver_ccb);
                udelay(1);
                if (!(ioread32(&device_ccb->send_ctrl) & (1 << CTRL_BITPOS_A))
@@ -309,7 +309,7 @@ static int ilo_ccb_open(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)
        doorbell_clr(driver_ccb);
 
        /* make sure iLO is really handling requests */
-       for (i = 1000; i > 0; i--) {
+       for (i = MAX_WAIT; i > 0; i--) {
                if (ilo_pkt_dequeue(hw, driver_ccb, SENDQ, &pkt_id, NULL, NULL))
                        break;
                udelay(1);
@@ -326,7 +326,7 @@ static int ilo_ccb_open(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)
 
        return 0;
 free:
-       pci_free_consistent(pdev, data->dma_size, data->dma_va, data->dma_pa);
+       ilo_ccb_close(pdev, data);
 out:
        return error;
 }
@@ -758,7 +758,7 @@ static void __exit ilo_exit(void)
        class_destroy(ilo_class);
 }
 
-MODULE_VERSION("0.05");
+MODULE_VERSION("0.06");
 MODULE_ALIAS(ILO_NAME);
 MODULE_DESCRIPTION(ILO_NAME);
 MODULE_AUTHOR("David Altobelli <david.altobelli@hp.com>");
index a281207696c1b8286f5c9ee08e7f24b504647a61..b64a20ef07e3cc6e7280386b5dc462233e1fd99a 100644 (file)
@@ -19,6 +19,8 @@
 #define MAX_ILO_DEV    1
 /* max number of files */
 #define MAX_OPEN       (MAX_CCB * MAX_ILO_DEV)
+/* spin counter for open/close delay */
+#define MAX_WAIT       10000
 
 /*
  * Per device, used to track global memory allocations.
index a5bd658c2e83b13a5d9dee5805a71eb191750e21..275b78896a73622362b6b53b5776db6fe20245d5 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2004-2008 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2004-2009 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
 /*
@@ -514,7 +514,8 @@ struct xpc_channel_uv {
                                                /* partition's notify mq */
 
        struct xpc_send_msg_slot_uv *send_msg_slots;
-       struct xpc_notify_mq_msg_uv *recv_msg_slots;
+       void *recv_msg_slots;   /* each slot will hold a xpc_notify_mq_msg_uv */
+                               /* structure plus the user's payload */
 
        struct xpc_fifo_head_uv msg_slot_free_list;
        struct xpc_fifo_head_uv recv_msg_list;  /* deliverable payloads */
index 9cd2ebe2a3b68be08e61c3afdff17702fe1442e4..45fd653dbe311b5d5c775e8ae8ee753a04b769c7 100644 (file)
@@ -49,9 +49,6 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
 
                if (ch->flags & (XPC_C_CONNECTED | XPC_C_DISCONNECTING))
                        return;
-
-               DBUG_ON(ch->local_msgqueue == NULL);
-               DBUG_ON(ch->remote_msgqueue == NULL);
        }
 
        if (!(ch->flags & XPC_C_OPENREPLY)) {
index 82fb9958f22f7bc7b6bcfb03e31d7c66de7beb57..2e975762c32b42224f80234ccf4f8caddb34cfb4 100644 (file)
@@ -1106,8 +1106,6 @@ xpc_process_activate_IRQ_rcvd_sn2(void)
        int n_IRQs_expected;
        int n_IRQs_detected;
 
-       DBUG_ON(xpc_activate_IRQ_rcvd == 0);
-
        spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
        n_IRQs_expected = xpc_activate_IRQ_rcvd;
        xpc_activate_IRQ_rcvd = 0;
@@ -1726,6 +1724,7 @@ xpc_clear_local_msgqueue_flags_sn2(struct xpc_channel *ch)
                msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->local_msgqueue +
                                             (get % ch->local_nentries) *
                                             ch->entry_size);
+               DBUG_ON(!(msg->flags & XPC_M_SN2_READY));
                msg->flags = 0;
        } while (++get < ch_sn2->remote_GP.get);
 }
@@ -1740,11 +1739,18 @@ xpc_clear_remote_msgqueue_flags_sn2(struct xpc_channel *ch)
        struct xpc_msg_sn2 *msg;
        s64 put;
 
-       put = ch_sn2->w_remote_GP.put;
+       /* flags are zeroed when the buffer is allocated */
+       if (ch_sn2->remote_GP.put < ch->remote_nentries)
+               return;
+
+       put = max(ch_sn2->w_remote_GP.put, ch->remote_nentries);
        do {
                msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->remote_msgqueue +
                                             (put % ch->remote_nentries) *
                                             ch->entry_size);
+               DBUG_ON(!(msg->flags & XPC_M_SN2_READY));
+               DBUG_ON(!(msg->flags & XPC_M_SN2_DONE));
+               DBUG_ON(msg->number != put - ch->remote_nentries);
                msg->flags = 0;
        } while (++put < ch_sn2->remote_GP.put);
 }
@@ -1836,6 +1842,7 @@ xpc_process_msg_chctl_flags_sn2(struct xpc_partition *part, int ch_number)
                 */
                xpc_clear_remote_msgqueue_flags_sn2(ch);
 
+               smp_wmb(); /* ensure flags have been cleared before bte_copy */
                ch_sn2->w_remote_GP.put = ch_sn2->remote_GP.put;
 
                dev_dbg(xpc_chan, "w_remote_GP.put changed to %ld, partid=%d, "
@@ -1934,7 +1941,7 @@ xpc_get_deliverable_payload_sn2(struct xpc_channel *ch)
                        break;
 
                get = ch_sn2->w_local_GP.get;
-               rmb();  /* guarantee that .get loads before .put */
+               smp_rmb();      /* guarantee that .get loads before .put */
                if (get == ch_sn2->w_remote_GP.put)
                        break;
 
@@ -1956,11 +1963,13 @@ xpc_get_deliverable_payload_sn2(struct xpc_channel *ch)
 
                        msg = xpc_pull_remote_msg_sn2(ch, get);
 
-                       DBUG_ON(msg != NULL && msg->number != get);
-                       DBUG_ON(msg != NULL && (msg->flags & XPC_M_SN2_DONE));
-                       DBUG_ON(msg != NULL && !(msg->flags & XPC_M_SN2_READY));
+                       if (msg != NULL) {
+                               DBUG_ON(msg->number != get);
+                               DBUG_ON(msg->flags & XPC_M_SN2_DONE);
+                               DBUG_ON(!(msg->flags & XPC_M_SN2_READY));
 
-                       payload = &msg->payload;
+                               payload = &msg->payload;
+                       }
                        break;
                }
 
@@ -2053,7 +2062,7 @@ xpc_allocate_msg_sn2(struct xpc_channel *ch, u32 flags,
        while (1) {
 
                put = ch_sn2->w_local_GP.put;
-               rmb();  /* guarantee that .put loads before .get */
+               smp_rmb();      /* guarantee that .put loads before .get */
                if (put - ch_sn2->w_remote_GP.get < ch->local_nentries) {
 
                        /* There are available message entries. We need to try
@@ -2186,7 +2195,7 @@ xpc_send_payload_sn2(struct xpc_channel *ch, u32 flags, void *payload,
         * The preceding store of msg->flags must occur before the following
         * load of local_GP->put.
         */
-       mb();
+       smp_mb();
 
        /* see if the message is next in line to be sent, if so send it */
 
@@ -2277,8 +2286,9 @@ xpc_received_payload_sn2(struct xpc_channel *ch, void *payload)
        dev_dbg(xpc_chan, "msg=0x%p, msg_number=%ld, partid=%d, channel=%d\n",
                (void *)msg, msg_number, ch->partid, ch->number);
 
-       DBUG_ON((((u64)msg - (u64)ch->remote_msgqueue) / ch->entry_size) !=
+       DBUG_ON((((u64)msg - (u64)ch->sn.sn2.remote_msgqueue) / ch->entry_size) !=
                msg_number % ch->remote_nentries);
+       DBUG_ON(!(msg->flags & XPC_M_SN2_READY));
        DBUG_ON(msg->flags & XPC_M_SN2_DONE);
 
        msg->flags |= XPC_M_SN2_DONE;
@@ -2287,7 +2297,7 @@ xpc_received_payload_sn2(struct xpc_channel *ch, void *payload)
         * The preceding store of msg->flags must occur before the following
         * load of local_GP->get.
         */
-       mb();
+       smp_mb();
 
        /*
         * See if this message is next in line to be acknowledged as having
index 91a55b1b1037011c5e403b19dac8c710d18632d5..29c0502a96b26fd9e9436d65f133136ccfce5410 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2008-2009 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
 /*
@@ -1010,8 +1010,8 @@ xpc_allocate_recv_msg_slot_uv(struct xpc_channel *ch)
                        continue;
 
                for (entry = 0; entry < nentries; entry++) {
-                       msg_slot = ch_uv->recv_msg_slots + entry *
-                           ch->entry_size;
+                       msg_slot = ch_uv->recv_msg_slots +
+                           entry * ch->entry_size;
 
                        msg_slot->hdr.msg_slot_number = entry;
                }
@@ -1308,9 +1308,8 @@ xpc_handle_notify_mq_msg_uv(struct xpc_partition *part,
        /* we're dealing with a normal message sent via the notify_mq */
        ch_uv = &ch->sn.uv;
 
-       msg_slot = (struct xpc_notify_mq_msg_uv *)((u64)ch_uv->recv_msg_slots +
-                   (msg->hdr.msg_slot_number % ch->remote_nentries) *
-                   ch->entry_size);
+       msg_slot = ch_uv->recv_msg_slots +
+           (msg->hdr.msg_slot_number % ch->remote_nentries) * ch->entry_size;
 
        BUG_ON(msg->hdr.msg_slot_number != msg_slot->hdr.msg_slot_number);
        BUG_ON(msg_slot->hdr.size != 0);
@@ -1423,7 +1422,7 @@ xpc_send_payload_uv(struct xpc_channel *ch, u32 flags, void *payload,
                atomic_inc(&ch->n_to_notify);
 
                msg_slot->key = key;
-               wmb(); /* a non-NULL func must hit memory after the key */
+               smp_wmb(); /* a non-NULL func must hit memory after the key */
                msg_slot->func = func;
 
                if (ch->flags & XPC_C_DISCONNECTING) {
index 7957f525b2f45e661ce026c3ec0670dc2c420aef..6faefcffcb53beb920541702ad1b574e4d578a5f 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 1999-2008 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 1999-2009 Silicon Graphics, Inc. All rights reserved.
  */
 
 /*
@@ -551,6 +551,7 @@ xpnet_init(void)
 
        netif_carrier_off(xpnet_device);
 
+       xpnet_device->netdev_ops = &xpnet_netdev_ops;
        xpnet_device->mtu = XPNET_DEF_MTU;
 
        /*
index d320dd9186f5a6620a040695a574fd90f1f6effa..ff8836306e77176cee4c3ddef4b458726b76a0dd 100644 (file)
@@ -146,6 +146,16 @@ config MMC_IMX
 
          If unsure, say N.
 
+config MMC_MXC
+       tristate "Freescale i.MX2/3 Multimedia Card Interface support"
+       depends on ARCH_MXC
+       help
+         This selects the Freescale i.MX2/3 Multimedia card Interface.
+         If you have a i.MX platform with a Multimedia Card slot,
+         say Y or M here.
+
+         If unsure, say N.
+
 config MMC_TIFM_SD
        tristate "TI Flash Media MMC/SD Interface support  (EXPERIMENTAL)"
        depends on EXPERIMENTAL && PCI
index 98cab84829b89ef73e388dcaffaabcd9e37f9b25..dedec55861d94f9352b7919969a269efe5be86e4 100644 (file)
@@ -9,6 +9,7 @@ endif
 obj-$(CONFIG_MMC_ARMMMCI)      += mmci.o
 obj-$(CONFIG_MMC_PXA)          += pxamci.o
 obj-$(CONFIG_MMC_IMX)          += imxmmc.o
+obj-$(CONFIG_MMC_MXC)          += mxcmmc.o
 obj-$(CONFIG_MMC_SDHCI)                += sdhci.o
 obj-$(CONFIG_MMC_SDHCI_PCI)    += sdhci-pci.o
 obj-$(CONFIG_MMC_RICOH_MMC)    += ricoh_mmc.o
index 1bcbdd6763ace8d1dc3a91db7a5b1d0c76a67b63..2909bbc8ad009aa751522087618f3886d9853019 100644 (file)
@@ -430,6 +430,8 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
                                clk = 255;
                        host->cclk = host->mclk / (2 * (clk + 1));
                }
+               if (host->hw_designer == 0x80)
+                       clk |= MCI_FCEN; /* Bug fix in ST IP block */
                clk |= MCI_CLK_ENABLE;
        }
 
@@ -440,15 +442,27 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        case MMC_POWER_OFF:
                break;
        case MMC_POWER_UP:
-               pwr |= MCI_PWR_UP;
-               break;
+               /* The ST version does not have this, fall through to POWER_ON */
+               if (host->hw_designer != 0x80) {
+                       pwr |= MCI_PWR_UP;
+                       break;
+               }
        case MMC_POWER_ON:
                pwr |= MCI_PWR_ON;
                break;
        }
 
-       if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN)
-               pwr |= MCI_ROD;
+       if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN) {
+               if (host->hw_designer != 0x80)
+                       pwr |= MCI_ROD;
+               else {
+                       /*
+                        * The ST Micro variant use the ROD bit for something
+                        * else and only has OD (Open Drain).
+                        */
+                       pwr |= MCI_OD;
+               }
+       }
 
        writel(clk, host->base + MMCICLOCK);
 
@@ -500,6 +514,12 @@ static int mmci_probe(struct amba_device *dev, void *id)
        }
 
        host = mmc_priv(mmc);
+       /* Bits 12 thru 19 is the designer */
+       host->hw_designer = (dev->periphid >> 12) & 0xff;
+       /* Bits 20 thru 23 is the revison */
+       host->hw_revision = (dev->periphid >> 20) & 0xf;
+       DBG(host, "designer ID = 0x%02x\n", host->hw_designer);
+       DBG(host, "revision = 0x%01x\n", host->hw_revision);
        host->clk = clk_get(&dev->dev, NULL);
        if (IS_ERR(host->clk)) {
                ret = PTR_ERR(host->clk);
@@ -693,6 +713,15 @@ static struct amba_id mmci_ids[] = {
                .id     = 0x00041181,
                .mask   = 0x000fffff,
        },
+       /* ST Micro variants */
+       {
+               .id     = 0x00180180,
+               .mask   = 0x00ffffff,
+       },
+       {
+               .id     = 0x00280180,
+               .mask   = 0x00ffffff,
+       },
        { 0, 0 },
 };
 
index 0f39c490f022086dc6e8c8cd99c789252ae6ea27..0441bac1c0eca66de761c353fb69370c74382ca0 100644 (file)
 #define MCI_PWR_OFF            0x00
 #define MCI_PWR_UP             0x02
 #define MCI_PWR_ON             0x03
+#define MCI_DATA2DIREN         (1 << 2)
+#define MCI_CMDDIREN           (1 << 3)
+#define MCI_DATA0DIREN         (1 << 4)
+#define MCI_DATA31DIREN                (1 << 5)
 #define MCI_OD                 (1 << 6)
 #define MCI_ROD                        (1 << 7)
+/* The ST Micro version does not have ROD */
+#define MCI_FBCLKEN            (1 << 7)
+#define MCI_DATA74DIREN                (1 << 8)
 
 #define MMCICLOCK              0x004
 #define MCI_CLK_ENABLE         (1 << 8)
 #define MCI_CLK_PWRSAVE                (1 << 9)
 #define MCI_CLK_BYPASS         (1 << 10)
+#define MCI_WIDE_BUS           (1 << 11)
+/* HW flow control on the ST Micro version */
+#define MCI_FCEN               (1 << 13)
 
 #define MMCIARGUMENT           0x008
 #define MMCICOMMAND            0x00c
 #define MCI_CPSM_INTERRUPT     (1 << 8)
 #define MCI_CPSM_PENDING       (1 << 9)
 #define MCI_CPSM_ENABLE                (1 << 10)
+#define MCI_SDIO_SUSP          (1 << 11)
+#define MCI_ENCMD_COMPL                (1 << 12)
+#define MCI_NIEN               (1 << 13)
+#define MCI_CE_ATACMD          (1 << 14)
 
 #define MMCIRESPCMD            0x010
 #define MMCIRESPONSE0          0x014
 #define MCI_DPSM_DIRECTION     (1 << 1)
 #define MCI_DPSM_MODE          (1 << 2)
 #define MCI_DPSM_DMAENABLE     (1 << 3)
+#define MCI_DPSM_BLOCKSIZE     (1 << 4)
+#define MCI_DPSM_RWSTART       (1 << 8)
+#define MCI_DPSM_RWSTOP                (1 << 9)
+#define MCI_DPSM_RWMOD         (1 << 10)
+#define MCI_DPSM_SDIOEN                (1 << 11)
 
 #define MMCIDATACNT            0x030
 #define MMCISTATUS             0x034
@@ -63,6 +82,8 @@
 #define MCI_RXFIFOEMPTY                (1 << 19)
 #define MCI_TXDATAAVLBL                (1 << 20)
 #define MCI_RXDATAAVLBL                (1 << 21)
+#define MCI_SDIOIT             (1 << 22)
+#define MCI_CEATAEND           (1 << 23)
 
 #define MMCICLEAR              0x038
 #define MCI_CMDCRCFAILCLR      (1 << 0)
@@ -75,6 +96,8 @@
 #define MCI_CMDSENTCLR         (1 << 7)
 #define MCI_DATAENDCLR         (1 << 8)
 #define MCI_DATABLOCKENDCLR    (1 << 10)
+#define MCI_SDIOITC            (1 << 22)
+#define MCI_CEATAENDC          (1 << 23)
 
 #define MMCIMASK0              0x03c
 #define MCI_CMDCRCFAILMASK     (1 << 0)
 #define MCI_RXFIFOEMPTYMASK    (1 << 19)
 #define MCI_TXDATAAVLBLMASK    (1 << 20)
 #define MCI_RXDATAAVLBLMASK    (1 << 21)
+#define MCI_SDIOITMASK         (1 << 22)
+#define MCI_CEATAENDMASK       (1 << 23)
 
 #define MMCIMASK1              0x040
 #define MMCIFIFOCNT            0x048
@@ -136,6 +161,9 @@ struct mmci_host {
        u32                     pwr;
        struct mmc_platform_data *plat;
 
+       u8                      hw_designer;
+       u8                      hw_revision:4;
+
        struct timer_list       timer;
        unsigned int            oldstat;
 
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
new file mode 100644 (file)
index 0000000..dda0be4
--- /dev/null
@@ -0,0 +1,880 @@
+/*
+ *  linux/drivers/mmc/host/mxcmmc.c - Freescale i.MX MMCI driver
+ *
+ *  This is a driver for the SDHC controller found in Freescale MX2/MX3
+ *  SoCs. It is basically the same hardware as found on MX1 (imxmmc.c).
+ *  Unlike the hardware found on MX1, this hardware just works and does
+ *  not need all the quirks found in imxmmc.c, hence the seperate driver.
+ *
+ *  Copyright (C) 2008 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
+ *  Copyright (C) 2006 Pavel Pisa, PiKRON <ppisa@pikron.com>
+ *
+ *  derived from pxamci.c by 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
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/blkdev.h>
+#include <linux/dma-mapping.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/card.h>
+#include <linux/delay.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
+
+#include <asm/dma.h>
+#include <asm/irq.h>
+#include <asm/sizes.h>
+#include <mach/mmc.h>
+
+#ifdef CONFIG_ARCH_MX2
+#include <mach/dma-mx1-mx2.h>
+#define HAS_DMA
+#endif
+
+#define DRIVER_NAME "imx-mmc"
+
+#define MMC_REG_STR_STP_CLK            0x00
+#define MMC_REG_STATUS                 0x04
+#define MMC_REG_CLK_RATE               0x08
+#define MMC_REG_CMD_DAT_CONT           0x0C
+#define MMC_REG_RES_TO                 0x10
+#define MMC_REG_READ_TO                        0x14
+#define MMC_REG_BLK_LEN                        0x18
+#define MMC_REG_NOB                    0x1C
+#define MMC_REG_REV_NO                 0x20
+#define MMC_REG_INT_CNTR               0x24
+#define MMC_REG_CMD                    0x28
+#define MMC_REG_ARG                    0x2C
+#define MMC_REG_RES_FIFO               0x34
+#define MMC_REG_BUFFER_ACCESS          0x38
+
+#define STR_STP_CLK_RESET               (1 << 3)
+#define STR_STP_CLK_START_CLK           (1 << 1)
+#define STR_STP_CLK_STOP_CLK            (1 << 0)
+
+#define STATUS_CARD_INSERTION          (1 << 31)
+#define STATUS_CARD_REMOVAL            (1 << 30)
+#define STATUS_YBUF_EMPTY              (1 << 29)
+#define STATUS_XBUF_EMPTY              (1 << 28)
+#define STATUS_YBUF_FULL               (1 << 27)
+#define STATUS_XBUF_FULL               (1 << 26)
+#define STATUS_BUF_UND_RUN             (1 << 25)
+#define STATUS_BUF_OVFL                        (1 << 24)
+#define STATUS_SDIO_INT_ACTIVE         (1 << 14)
+#define STATUS_END_CMD_RESP            (1 << 13)
+#define STATUS_WRITE_OP_DONE           (1 << 12)
+#define STATUS_DATA_TRANS_DONE         (1 << 11)
+#define STATUS_READ_OP_DONE            (1 << 11)
+#define STATUS_WR_CRC_ERROR_CODE_MASK  (3 << 10)
+#define STATUS_CARD_BUS_CLK_RUN                (1 << 8)
+#define STATUS_BUF_READ_RDY            (1 << 7)
+#define STATUS_BUF_WRITE_RDY           (1 << 6)
+#define STATUS_RESP_CRC_ERR            (1 << 5)
+#define STATUS_CRC_READ_ERR            (1 << 3)
+#define STATUS_CRC_WRITE_ERR           (1 << 2)
+#define STATUS_TIME_OUT_RESP           (1 << 1)
+#define STATUS_TIME_OUT_READ           (1 << 0)
+#define STATUS_ERR_MASK                        0x2f
+
+#define CMD_DAT_CONT_CMD_RESP_LONG_OFF (1 << 12)
+#define CMD_DAT_CONT_STOP_READWAIT     (1 << 11)
+#define CMD_DAT_CONT_START_READWAIT    (1 << 10)
+#define CMD_DAT_CONT_BUS_WIDTH_4       (2 << 8)
+#define CMD_DAT_CONT_INIT              (1 << 7)
+#define CMD_DAT_CONT_WRITE             (1 << 4)
+#define CMD_DAT_CONT_DATA_ENABLE       (1 << 3)
+#define CMD_DAT_CONT_RESPONSE_48BIT_CRC        (1 << 0)
+#define CMD_DAT_CONT_RESPONSE_136BIT   (2 << 0)
+#define CMD_DAT_CONT_RESPONSE_48BIT    (3 << 0)
+
+#define INT_SDIO_INT_WKP_EN            (1 << 18)
+#define INT_CARD_INSERTION_WKP_EN      (1 << 17)
+#define INT_CARD_REMOVAL_WKP_EN                (1 << 16)
+#define INT_CARD_INSERTION_EN          (1 << 15)
+#define INT_CARD_REMOVAL_EN            (1 << 14)
+#define INT_SDIO_IRQ_EN                        (1 << 13)
+#define INT_DAT0_EN                    (1 << 12)
+#define INT_BUF_READ_EN                        (1 << 4)
+#define INT_BUF_WRITE_EN               (1 << 3)
+#define INT_END_CMD_RES_EN             (1 << 2)
+#define INT_WRITE_OP_DONE_EN           (1 << 1)
+#define INT_READ_OP_EN                 (1 << 0)
+
+struct mxcmci_host {
+       struct mmc_host         *mmc;
+       struct resource         *res;
+       void __iomem            *base;
+       int                     irq;
+       int                     detect_irq;
+       int                     dma;
+       int                     do_dma;
+       unsigned int            power_mode;
+       struct imxmmc_platform_data *pdata;
+
+       struct mmc_request      *req;
+       struct mmc_command      *cmd;
+       struct mmc_data         *data;
+
+       unsigned int            dma_nents;
+       unsigned int            datasize;
+       unsigned int            dma_dir;
+
+       u16                     rev_no;
+       unsigned int            cmdat;
+
+       struct clk              *clk;
+
+       int                     clock;
+
+       struct work_struct      datawork;
+};
+
+static inline int mxcmci_use_dma(struct mxcmci_host *host)
+{
+       return host->do_dma;
+}
+
+static void mxcmci_softreset(struct mxcmci_host *host)
+{
+       int i;
+
+       /* reset sequence */
+       writew(STR_STP_CLK_RESET, host->base + MMC_REG_STR_STP_CLK);
+       writew(STR_STP_CLK_RESET | STR_STP_CLK_START_CLK,
+                       host->base + MMC_REG_STR_STP_CLK);
+
+       for (i = 0; i < 8; i++)
+               writew(STR_STP_CLK_START_CLK, host->base + MMC_REG_STR_STP_CLK);
+
+       writew(0xff, host->base + MMC_REG_RES_TO);
+}
+
+static void mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
+{
+       unsigned int nob = data->blocks;
+       unsigned int blksz = data->blksz;
+       unsigned int datasize = nob * blksz;
+#ifdef HAS_DMA
+       struct scatterlist *sg;
+       int i;
+#endif
+       if (data->flags & MMC_DATA_STREAM)
+               nob = 0xffff;
+
+       host->data = data;
+       data->bytes_xfered = 0;
+
+       writew(nob, host->base + MMC_REG_NOB);
+       writew(blksz, host->base + MMC_REG_BLK_LEN);
+       host->datasize = datasize;
+
+#ifdef HAS_DMA
+       for_each_sg(data->sg, sg, data->sg_len, i) {
+               if (sg->offset & 3 || sg->length & 3) {
+                       host->do_dma = 0;
+                       return;
+               }
+       }
+
+       if (data->flags & MMC_DATA_READ) {
+               host->dma_dir = DMA_FROM_DEVICE;
+               host->dma_nents = dma_map_sg(mmc_dev(host->mmc), data->sg,
+                                            data->sg_len,  host->dma_dir);
+
+               imx_dma_setup_sg(host->dma, data->sg, host->dma_nents, datasize,
+                                host->res->start + MMC_REG_BUFFER_ACCESS,
+                                DMA_MODE_READ);
+       } else {
+               host->dma_dir = DMA_TO_DEVICE;
+               host->dma_nents = dma_map_sg(mmc_dev(host->mmc), data->sg,
+                                            data->sg_len,  host->dma_dir);
+
+               imx_dma_setup_sg(host->dma, data->sg, host->dma_nents, datasize,
+                                host->res->start + MMC_REG_BUFFER_ACCESS,
+                                DMA_MODE_WRITE);
+       }
+
+       wmb();
+
+       imx_dma_enable(host->dma);
+#endif /* HAS_DMA */
+}
+
+static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_command *cmd,
+               unsigned int cmdat)
+{
+       WARN_ON(host->cmd != NULL);
+       host->cmd = cmd;
+
+       switch (mmc_resp_type(cmd)) {
+       case MMC_RSP_R1: /* short CRC, OPCODE */
+       case MMC_RSP_R1B:/* short CRC, OPCODE, BUSY */
+               cmdat |= CMD_DAT_CONT_RESPONSE_48BIT_CRC;
+               break;
+       case MMC_RSP_R2: /* long 136 bit + CRC */
+               cmdat |= CMD_DAT_CONT_RESPONSE_136BIT;
+               break;
+       case MMC_RSP_R3: /* short */
+               cmdat |= CMD_DAT_CONT_RESPONSE_48BIT;
+               break;
+       case MMC_RSP_NONE:
+               break;
+       default:
+               dev_err(mmc_dev(host->mmc), "unhandled response type 0x%x\n",
+                               mmc_resp_type(cmd));
+               cmd->error = -EINVAL;
+               return -EINVAL;
+       }
+
+       if (mxcmci_use_dma(host))
+               writel(INT_READ_OP_EN | INT_WRITE_OP_DONE_EN |
+                               INT_END_CMD_RES_EN,
+                               host->base + MMC_REG_INT_CNTR);
+       else
+               writel(INT_END_CMD_RES_EN, host->base + MMC_REG_INT_CNTR);
+
+       writew(cmd->opcode, host->base + MMC_REG_CMD);
+       writel(cmd->arg, host->base + MMC_REG_ARG);
+       writew(cmdat, host->base + MMC_REG_CMD_DAT_CONT);
+
+       return 0;
+}
+
+static void mxcmci_finish_request(struct mxcmci_host *host,
+               struct mmc_request *req)
+{
+       writel(0, host->base + MMC_REG_INT_CNTR);
+
+       host->req = NULL;
+       host->cmd = NULL;
+       host->data = NULL;
+
+       mmc_request_done(host->mmc, req);
+}
+
+static int mxcmci_finish_data(struct mxcmci_host *host, unsigned int stat)
+{
+       struct mmc_data *data = host->data;
+       int data_error;
+
+#ifdef HAS_DMA
+       if (mxcmci_use_dma(host)) {
+               imx_dma_disable(host->dma);
+               dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->dma_nents,
+                               host->dma_dir);
+       }
+#endif
+
+       if (stat & STATUS_ERR_MASK) {
+               dev_dbg(mmc_dev(host->mmc), "request failed. status: 0x%08x\n",
+                               stat);
+               if (stat & STATUS_CRC_READ_ERR) {
+                       data->error = -EILSEQ;
+               } else if (stat & STATUS_CRC_WRITE_ERR) {
+                       u32 err_code = (stat >> 9) & 0x3;
+                       if (err_code == 2) /* No CRC response */
+                               data->error = -ETIMEDOUT;
+                       else
+                               data->error = -EILSEQ;
+               } else if (stat & STATUS_TIME_OUT_READ) {
+                       data->error = -ETIMEDOUT;
+               } else {
+                       data->error = -EIO;
+               }
+       } else {
+               data->bytes_xfered = host->datasize;
+       }
+
+       data_error = data->error;
+
+       host->data = NULL;
+
+       return data_error;
+}
+
+static void mxcmci_read_response(struct mxcmci_host *host, unsigned int stat)
+{
+       struct mmc_command *cmd = host->cmd;
+       int i;
+       u32 a, b, c;
+
+       if (!cmd)
+               return;
+
+       if (stat & STATUS_TIME_OUT_RESP) {
+               dev_dbg(mmc_dev(host->mmc), "CMD TIMEOUT\n");
+               cmd->error = -ETIMEDOUT;
+       } else if (stat & STATUS_RESP_CRC_ERR && cmd->flags & MMC_RSP_CRC) {
+               dev_dbg(mmc_dev(host->mmc), "cmd crc error\n");
+               cmd->error = -EILSEQ;
+       }
+
+       if (cmd->flags & MMC_RSP_PRESENT) {
+               if (cmd->flags & MMC_RSP_136) {
+                       for (i = 0; i < 4; i++) {
+                               a = readw(host->base + MMC_REG_RES_FIFO);
+                               b = readw(host->base + MMC_REG_RES_FIFO);
+                               cmd->resp[i] = a << 16 | b;
+                       }
+               } else {
+                       a = readw(host->base + MMC_REG_RES_FIFO);
+                       b = readw(host->base + MMC_REG_RES_FIFO);
+                       c = readw(host->base + MMC_REG_RES_FIFO);
+                       cmd->resp[0] = a << 24 | b << 8 | c >> 8;
+               }
+       }
+}
+
+static int mxcmci_poll_status(struct mxcmci_host *host, u32 mask)
+{
+       u32 stat;
+       unsigned long timeout = jiffies + HZ;
+
+       do {
+               stat = readl(host->base + MMC_REG_STATUS);
+               if (stat & STATUS_ERR_MASK)
+                       return stat;
+               if (time_after(jiffies, timeout))
+                       return STATUS_TIME_OUT_READ;
+               if (stat & mask)
+                       return 0;
+               cpu_relax();
+       } while (1);
+}
+
+static int mxcmci_pull(struct mxcmci_host *host, void *_buf, int bytes)
+{
+       unsigned int stat;
+       u32 *buf = _buf;
+
+       while (bytes > 3) {
+               stat = mxcmci_poll_status(host,
+                               STATUS_BUF_READ_RDY | STATUS_READ_OP_DONE);
+               if (stat)
+                       return stat;
+               *buf++ = readl(host->base + MMC_REG_BUFFER_ACCESS);
+               bytes -= 4;
+       }
+
+       if (bytes) {
+               u8 *b = (u8 *)buf;
+               u32 tmp;
+
+               stat = mxcmci_poll_status(host,
+                               STATUS_BUF_READ_RDY | STATUS_READ_OP_DONE);
+               if (stat)
+                       return stat;
+               tmp = readl(host->base + MMC_REG_BUFFER_ACCESS);
+               memcpy(b, &tmp, bytes);
+       }
+
+       return 0;
+}
+
+static int mxcmci_push(struct mxcmci_host *host, void *_buf, int bytes)
+{
+       unsigned int stat;
+       u32 *buf = _buf;
+
+       while (bytes > 3) {
+               stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY);
+               if (stat)
+                       return stat;
+               writel(*buf++, host->base + MMC_REG_BUFFER_ACCESS);
+               bytes -= 4;
+       }
+
+       if (bytes) {
+               u8 *b = (u8 *)buf;
+               u32 tmp;
+
+               stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY);
+               if (stat)
+                       return stat;
+
+               memcpy(&tmp, b, bytes);
+               writel(tmp, host->base + MMC_REG_BUFFER_ACCESS);
+       }
+
+       stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY);
+       if (stat)
+               return stat;
+
+       return 0;
+}
+
+static int mxcmci_transfer_data(struct mxcmci_host *host)
+{
+       struct mmc_data *data = host->req->data;
+       struct scatterlist *sg;
+       int stat, i;
+
+       host->datasize = 0;
+
+       host->data = data;
+       host->datasize = 0;
+
+       if (data->flags & MMC_DATA_READ) {
+               for_each_sg(data->sg, sg, data->sg_len, i) {
+                       stat = mxcmci_pull(host, sg_virt(sg), sg->length);
+                       if (stat)
+                               return stat;
+                       host->datasize += sg->length;
+               }
+       } else {
+               for_each_sg(data->sg, sg, data->sg_len, i) {
+                       stat = mxcmci_push(host, sg_virt(sg), sg->length);
+                       if (stat)
+                               return stat;
+                       host->datasize += sg->length;
+               }
+               stat = mxcmci_poll_status(host, STATUS_WRITE_OP_DONE);
+               if (stat)
+                       return stat;
+       }
+       return 0;
+}
+
+static void mxcmci_datawork(struct work_struct *work)
+{
+       struct mxcmci_host *host = container_of(work, struct mxcmci_host,
+                                                 datawork);
+       int datastat = mxcmci_transfer_data(host);
+       mxcmci_finish_data(host, datastat);
+
+       if (host->req->stop) {
+               if (mxcmci_start_cmd(host, host->req->stop, 0)) {
+                       mxcmci_finish_request(host, host->req);
+                       return;
+               }
+       } else {
+               mxcmci_finish_request(host, host->req);
+       }
+}
+
+#ifdef HAS_DMA
+static void mxcmci_data_done(struct mxcmci_host *host, unsigned int stat)
+{
+       struct mmc_data *data = host->data;
+       int data_error;
+
+       if (!data)
+               return;
+
+       data_error = mxcmci_finish_data(host, stat);
+
+       mxcmci_read_response(host, stat);
+       host->cmd = NULL;
+
+       if (host->req->stop) {
+               if (mxcmci_start_cmd(host, host->req->stop, 0)) {
+                       mxcmci_finish_request(host, host->req);
+                       return;
+               }
+       } else {
+               mxcmci_finish_request(host, host->req);
+       }
+}
+#endif /* HAS_DMA */
+
+static void mxcmci_cmd_done(struct mxcmci_host *host, unsigned int stat)
+{
+       mxcmci_read_response(host, stat);
+       host->cmd = NULL;
+
+       if (!host->data && host->req) {
+               mxcmci_finish_request(host, host->req);
+               return;
+       }
+
+       /* For the DMA case the DMA engine handles the data transfer
+        * automatically. For non DMA we have to to it ourselves.
+        * Don't do it in interrupt context though.
+        */
+       if (!mxcmci_use_dma(host) && host->data)
+               schedule_work(&host->datawork);
+
+}
+
+static irqreturn_t mxcmci_irq(int irq, void *devid)
+{
+       struct mxcmci_host *host = devid;
+       u32 stat;
+
+       stat = readl(host->base + MMC_REG_STATUS);
+       writel(stat, host->base + MMC_REG_STATUS);
+
+       dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat);
+
+       if (stat & STATUS_END_CMD_RESP)
+               mxcmci_cmd_done(host, stat);
+#ifdef HAS_DMA
+       if (mxcmci_use_dma(host) &&
+                 (stat & (STATUS_DATA_TRANS_DONE | STATUS_WRITE_OP_DONE)))
+               mxcmci_data_done(host, stat);
+#endif
+       return IRQ_HANDLED;
+}
+
+static void mxcmci_request(struct mmc_host *mmc, struct mmc_request *req)
+{
+       struct mxcmci_host *host = mmc_priv(mmc);
+       unsigned int cmdat = host->cmdat;
+
+       WARN_ON(host->req != NULL);
+
+       host->req = req;
+       host->cmdat &= ~CMD_DAT_CONT_INIT;
+#ifdef HAS_DMA
+       host->do_dma = 1;
+#endif
+       if (req->data) {
+               mxcmci_setup_data(host, req->data);
+
+               cmdat |= CMD_DAT_CONT_DATA_ENABLE;
+
+               if (req->data->flags & MMC_DATA_WRITE)
+                       cmdat |= CMD_DAT_CONT_WRITE;
+       }
+
+       if (mxcmci_start_cmd(host, req->cmd, cmdat))
+               mxcmci_finish_request(host, req);
+}
+
+static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios)
+{
+       unsigned int divider;
+       int prescaler = 0;
+       unsigned int clk_in = clk_get_rate(host->clk);
+
+       while (prescaler <= 0x800) {
+               for (divider = 1; divider <= 0xF; divider++) {
+                       int x;
+
+                       x = (clk_in / (divider + 1));
+
+                       if (prescaler)
+                               x /= (prescaler * 2);
+
+                       if (x <= clk_ios)
+                               break;
+               }
+               if (divider < 0x10)
+                       break;
+
+               if (prescaler == 0)
+                       prescaler = 1;
+               else
+                       prescaler <<= 1;
+       }
+
+       writew((prescaler << 4) | divider, host->base + MMC_REG_CLK_RATE);
+
+       dev_dbg(mmc_dev(host->mmc), "scaler: %d divider: %d in: %d out: %d\n",
+                       prescaler, divider, clk_in, clk_ios);
+}
+
+static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
+{
+       struct mxcmci_host *host = mmc_priv(mmc);
+#ifdef HAS_DMA
+       unsigned int blen;
+       /*
+        * use burstlen of 64 in 4 bit mode (--> reg value  0)
+        * use burstlen of 16 in 1 bit mode (--> reg value 16)
+        */
+       if (ios->bus_width == MMC_BUS_WIDTH_4)
+               blen = 0;
+       else
+               blen = 16;
+
+       imx_dma_config_burstlen(host->dma, blen);
+#endif
+       if (ios->bus_width == MMC_BUS_WIDTH_4)
+               host->cmdat |= CMD_DAT_CONT_BUS_WIDTH_4;
+       else
+               host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4;
+
+       if (host->power_mode != ios->power_mode) {
+               if (host->pdata && host->pdata->setpower)
+                       host->pdata->setpower(mmc_dev(mmc), ios->vdd);
+               host->power_mode = ios->power_mode;
+               if (ios->power_mode == MMC_POWER_ON)
+                       host->cmdat |= CMD_DAT_CONT_INIT;
+       }
+
+       if (ios->clock) {
+               mxcmci_set_clk_rate(host, ios->clock);
+               writew(STR_STP_CLK_START_CLK, host->base + MMC_REG_STR_STP_CLK);
+       } else {
+               writew(STR_STP_CLK_STOP_CLK, host->base + MMC_REG_STR_STP_CLK);
+       }
+
+       host->clock = ios->clock;
+}
+
+static irqreturn_t mxcmci_detect_irq(int irq, void *data)
+{
+       struct mmc_host *mmc = data;
+
+       dev_dbg(mmc_dev(mmc), "%s\n", __func__);
+
+       mmc_detect_change(mmc, msecs_to_jiffies(250));
+       return IRQ_HANDLED;
+}
+
+static int mxcmci_get_ro(struct mmc_host *mmc)
+{
+       struct mxcmci_host *host = mmc_priv(mmc);
+
+       if (host->pdata && host->pdata->get_ro)
+               return !!host->pdata->get_ro(mmc_dev(mmc));
+       /*
+        * Board doesn't support read only detection; let the mmc core
+        * decide what to do.
+        */
+       return -ENOSYS;
+}
+
+
+static const struct mmc_host_ops mxcmci_ops = {
+       .request        = mxcmci_request,
+       .set_ios        = mxcmci_set_ios,
+       .get_ro         = mxcmci_get_ro,
+};
+
+static int mxcmci_probe(struct platform_device *pdev)
+{
+       struct mmc_host *mmc;
+       struct mxcmci_host *host = NULL;
+       struct resource *r;
+       int ret = 0, irq;
+
+       printk(KERN_INFO "i.MX SDHC driver\n");
+
+       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       irq = platform_get_irq(pdev, 0);
+       if (!r || irq < 0)
+               return -EINVAL;
+
+       r = request_mem_region(r->start, resource_size(r), pdev->name);
+       if (!r)
+               return -EBUSY;
+
+       mmc = mmc_alloc_host(sizeof(struct mxcmci_host), &pdev->dev);
+       if (!mmc) {
+               ret = -ENOMEM;
+               goto out_release_mem;
+       }
+
+       mmc->ops = &mxcmci_ops;
+       mmc->caps = MMC_CAP_4_BIT_DATA;
+
+       /* MMC core transfer sizes tunable parameters */
+       mmc->max_hw_segs = 64;
+       mmc->max_phys_segs = 64;
+       mmc->max_blk_size = 2048;
+       mmc->max_blk_count = 65535;
+       mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
+       mmc->max_seg_size = mmc->max_seg_size;
+
+       host = mmc_priv(mmc);
+       host->base = ioremap(r->start, resource_size(r));
+       if (!host->base) {
+               ret = -ENOMEM;
+               goto out_free;
+       }
+
+       host->mmc = mmc;
+       host->pdata = pdev->dev.platform_data;
+
+       if (host->pdata && host->pdata->ocr_avail)
+               mmc->ocr_avail = host->pdata->ocr_avail;
+       else
+               mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
+
+       host->res = r;
+       host->irq = irq;
+
+       host->clk = clk_get(&pdev->dev, "sdhc_clk");
+       if (IS_ERR(host->clk)) {
+               ret = PTR_ERR(host->clk);
+               goto out_iounmap;
+       }
+       clk_enable(host->clk);
+
+       mxcmci_softreset(host);
+
+       host->rev_no = readw(host->base + MMC_REG_REV_NO);
+       if (host->rev_no != 0x400) {
+               ret = -ENODEV;
+               dev_err(mmc_dev(host->mmc), "wrong rev.no. 0x%08x. aborting.\n",
+                       host->rev_no);
+               goto out_clk_put;
+       }
+
+       mmc->f_min = clk_get_rate(host->clk) >> 7;
+       mmc->f_max = clk_get_rate(host->clk) >> 1;
+
+       /* recommended in data sheet */
+       writew(0x2db4, host->base + MMC_REG_READ_TO);
+
+       writel(0, host->base + MMC_REG_INT_CNTR);
+
+#ifdef HAS_DMA
+       host->dma = imx_dma_request_by_prio(DRIVER_NAME, DMA_PRIO_LOW);
+       if (host->dma < 0) {
+               dev_err(mmc_dev(host->mmc), "imx_dma_request_by_prio failed\n");
+               ret = -EBUSY;
+               goto out_clk_put;
+       }
+
+       r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+       if (!r) {
+               ret = -EINVAL;
+               goto out_free_dma;
+       }
+
+       ret = imx_dma_config_channel(host->dma,
+                                    IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_FIFO,
+                                    IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR,
+                                    r->start, 0);
+       if (ret) {
+               dev_err(mmc_dev(host->mmc), "failed to config DMA channel\n");
+               goto out_free_dma;
+       }
+#endif
+       INIT_WORK(&host->datawork, mxcmci_datawork);
+
+       ret = request_irq(host->irq, mxcmci_irq, 0, DRIVER_NAME, host);
+       if (ret)
+               goto out_free_dma;
+
+       platform_set_drvdata(pdev, mmc);
+
+       if (host->pdata && host->pdata->init) {
+               ret = host->pdata->init(&pdev->dev, mxcmci_detect_irq,
+                               host->mmc);
+               if (ret)
+                       goto out_free_irq;
+       }
+
+       mmc_add_host(mmc);
+
+       return 0;
+
+out_free_irq:
+       free_irq(host->irq, host);
+out_free_dma:
+#ifdef HAS_DMA
+       imx_dma_free(host->dma);
+#endif
+out_clk_put:
+       clk_disable(host->clk);
+       clk_put(host->clk);
+out_iounmap:
+       iounmap(host->base);
+out_free:
+       mmc_free_host(mmc);
+out_release_mem:
+       release_mem_region(host->res->start, resource_size(host->res));
+       return ret;
+}
+
+static int mxcmci_remove(struct platform_device *pdev)
+{
+       struct mmc_host *mmc = platform_get_drvdata(pdev);
+       struct mxcmci_host *host = mmc_priv(mmc);
+
+       platform_set_drvdata(pdev, NULL);
+
+       mmc_remove_host(mmc);
+
+       if (host->pdata && host->pdata->exit)
+               host->pdata->exit(&pdev->dev, mmc);
+
+       free_irq(host->irq, host);
+       iounmap(host->base);
+#ifdef HAS_DMA
+       imx_dma_free(host->dma);
+#endif
+       clk_disable(host->clk);
+       clk_put(host->clk);
+
+       release_mem_region(host->res->start, resource_size(host->res));
+       release_resource(host->res);
+
+       mmc_free_host(mmc);
+
+       return 0;
+}
+
+#ifdef CONFIG_PM
+static int mxcmci_suspend(struct platform_device *dev, pm_message_t state)
+{
+       struct mmc_host *mmc = platform_get_drvdata(dev);
+       int ret = 0;
+
+       if (mmc)
+               ret = mmc_suspend_host(mmc, state);
+
+       return ret;
+}
+
+static int mxcmci_resume(struct platform_device *dev)
+{
+       struct mmc_host *mmc = platform_get_drvdata(dev);
+       struct mxcmci_host *host;
+       int ret = 0;
+
+       if (mmc) {
+               host = mmc_priv(mmc);
+               ret = mmc_resume_host(mmc);
+       }
+
+       return ret;
+}
+#else
+#define mxcmci_suspend  NULL
+#define mxcmci_resume   NULL
+#endif /* CONFIG_PM */
+
+static struct platform_driver mxcmci_driver = {
+       .probe          = mxcmci_probe,
+       .remove         = mxcmci_remove,
+       .suspend        = mxcmci_suspend,
+       .resume         = mxcmci_resume,
+       .driver         = {
+               .name           = DRIVER_NAME,
+               .owner          = THIS_MODULE,
+       }
+};
+
+static int __init mxcmci_init(void)
+{
+       return platform_driver_register(&mxcmci_driver);
+}
+
+static void __exit mxcmci_exit(void)
+{
+       platform_driver_unregister(&mxcmci_driver);
+}
+
+module_init(mxcmci_init);
+module_exit(mxcmci_exit);
+
+MODULE_DESCRIPTION("i.MX Multimedia Card Interface Driver");
+MODULE_AUTHOR("Sascha Hauer, Pengutronix");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:imx-mmc");
index 3c5483b75da47ac9e3b2ed4ef0428d1cbff970aa..9702ad3774cf90ae1065d2d8d2a8e271c240aaae 100644 (file)
@@ -180,7 +180,15 @@ static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data)
        else
                DALGN &= ~(1 << host->dma);
        DDADR(host->dma) = host->sg_dma;
-       DCSR(host->dma) = DCSR_RUN;
+
+       /*
+        * workaround for erratum #91:
+        * only start DMA now if we are doing a read,
+        * otherwise we wait until CMD/RESP has finished
+        * before starting DMA.
+        */
+       if (!cpu_is_pxa27x() || data->flags & MMC_DATA_READ)
+               DCSR(host->dma) = DCSR_RUN;
 }
 
 static void pxamci_start_cmd(struct pxamci_host *host, struct mmc_command *cmd, unsigned int cmdat)
@@ -251,23 +259,28 @@ static int pxamci_cmd_done(struct pxamci_host *host, unsigned int stat)
        if (stat & STAT_TIME_OUT_RESPONSE) {
                cmd->error = -ETIMEDOUT;
        } else if (stat & STAT_RES_CRC_ERR && cmd->flags & MMC_RSP_CRC) {
-#ifdef CONFIG_PXA27x
                /*
                 * workaround for erratum #42:
                 * Intel PXA27x Family Processor Specification Update Rev 001
                 * A bogus CRC error can appear if the msb of a 136 bit
                 * response is a one.
                 */
-               if (cmd->flags & MMC_RSP_136 && cmd->resp[0] & 0x80000000) {
+               if (cpu_is_pxa27x() &&
+                   (cmd->flags & MMC_RSP_136 && cmd->resp[0] & 0x80000000))
                        pr_debug("ignoring CRC from command %d - *risky*\n", cmd->opcode);
-               } else
-#endif
-               cmd->error = -EILSEQ;
+               else
+                       cmd->error = -EILSEQ;
        }
 
        pxamci_disable_irq(host, END_CMD_RES);
        if (host->data && !cmd->error) {
                pxamci_enable_irq(host, DATA_TRAN_DONE);
+               /*
+                * workaround for erratum #91, if doing write
+                * enable DMA late
+                */
+               if (cpu_is_pxa27x() && host->data->flags & MMC_DATA_WRITE)
+                       DCSR(host->dma) = DCSR_RUN;
        } else {
                pxamci_finish_request(host, host->mrq);
        }
index be9e7b32b34e91fd790a9c196b37d7abc6976934..f62790513322f632ad47062c7bd222f38f015c3d 100644 (file)
@@ -196,7 +196,7 @@ static void __devexit ricoh_mmc_remove(struct pci_dev *pdev)
        pci_set_drvdata(pdev, NULL);
 }
 
-static int ricoh_mmc_suspend(struct pci_dev *pdev, pm_message_t state)
+static int ricoh_mmc_suspend_late(struct pci_dev *pdev, pm_message_t state)
 {
        struct pci_dev *fw_dev = NULL;
 
@@ -210,7 +210,7 @@ static int ricoh_mmc_suspend(struct pci_dev *pdev, pm_message_t state)
        return 0;
 }
 
-static int ricoh_mmc_resume(struct pci_dev *pdev)
+static int ricoh_mmc_resume_early(struct pci_dev *pdev)
 {
        struct pci_dev *fw_dev = NULL;
 
@@ -229,8 +229,8 @@ static struct pci_driver ricoh_mmc_driver = {
        .id_table =     pci_ids,
        .probe =        ricoh_mmc_probe,
        .remove =       __devexit_p(ricoh_mmc_remove),
-       .suspend =      ricoh_mmc_suspend,
-       .resume =       ricoh_mmc_resume,
+       .suspend_late = ricoh_mmc_suspend_late,
+       .resume_early = ricoh_mmc_resume_early,
 };
 
 /*****************************************************************************\
index 7df6bbf0e4d9337e8ea01da8f93b1821577ca8c3..6f6a0f6dafd6106b9042f27d892758ecee45916c 100644 (file)
@@ -453,7 +453,7 @@ static struct platform_driver sa1100_mtd_driver = {
        .resume         = sa1100_mtd_resume,
        .shutdown       = sa1100_mtd_shutdown,
        .driver         = {
-               .name   = "flash",
+               .name   = "sa1100-mtd",
                .owner  = THIS_MODULE,
        },
 };
@@ -474,4 +474,4 @@ module_exit(sa1100_mtd_exit);
 MODULE_AUTHOR("Nicolas Pitre");
 MODULE_DESCRIPTION("SA1100 CFI map driver");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:flash");
+MODULE_ALIAS("platform:sa1100-mtd");
index 1e2ee22edeffe2b4f0d36f2ec3026f74b6b49462..2246f154e2f7a6f57317cf2232070f39ada5d4dc 100644 (file)
@@ -33,16 +33,6 @@ config MTD_UBI_DEBUG_DISABLE_BGT
          This option switches the background thread off by default. The thread
          may be also be enabled/disabled via UBI sysfs.
 
-config MTD_UBI_DEBUG_USERSPACE_IO
-       bool "Direct user-space write/erase support"
-       default n
-       depends on MTD_UBI_DEBUG
-       help
-         By default, users cannot directly write and erase individual
-         eraseblocks of dynamic volumes, and have to use update operation
-         instead. This option enables this capability - it is very useful for
-         debugging and testing.
-
 config MTD_UBI_DEBUG_EMULATE_BITFLIPS
        bool "Emulate flash bit-flips"
        depends on MTD_UBI_DEBUG
index 9082768cc6c3850df4c9290e5f7487e795bc4e88..4048db83aef6b28569b3e481147d5765e8785552 100644 (file)
@@ -263,8 +263,12 @@ static ssize_t dev_attribute_show(struct device *dev,
        return ret;
 }
 
-/* Fake "release" method for UBI devices */
-static void dev_release(struct device *dev) { }
+static void dev_release(struct device *dev)
+{
+       struct ubi_device *ubi = container_of(dev, struct ubi_device, dev);
+
+       kfree(ubi);
+}
 
 /**
  * ubi_sysfs_init - initialize sysfs for an UBI device.
@@ -380,7 +384,7 @@ static void free_user_volumes(struct ubi_device *ubi)
  */
 static int uif_init(struct ubi_device *ubi)
 {
-       int i, err, do_free = 0;
+       int i, err;
        dev_t dev;
 
        sprintf(ubi->ubi_name, UBI_NAME_STR "%d", ubi->ubi_num);
@@ -427,13 +431,10 @@ static int uif_init(struct ubi_device *ubi)
 
 out_volumes:
        kill_volumes(ubi);
-       do_free = 0;
 out_sysfs:
        ubi_sysfs_close(ubi);
        cdev_del(&ubi->cdev);
 out_unreg:
-       if (do_free)
-               free_user_volumes(ubi);
        unregister_chrdev_region(ubi->cdev.dev, ubi->vtbl_slots + 1);
        ubi_err("cannot initialize UBI %s, error %d", ubi->ubi_name, err);
        return err;
@@ -947,6 +948,12 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
        if (ubi->bgt_thread)
                kthread_stop(ubi->bgt_thread);
 
+       /*
+        * Get a reference to the device in order to prevent 'dev_release()'
+        * from freeing @ubi object.
+        */
+       get_device(&ubi->dev);
+
        uif_close(ubi);
        ubi_wl_close(ubi);
        free_internal_volumes(ubi);
@@ -958,7 +965,7 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
        vfree(ubi->dbg_peb_buf);
 #endif
        ubi_msg("mtd%d is detached from ubi%d", ubi->mtd->index, ubi->ubi_num);
-       kfree(ubi);
+       put_device(&ubi->dev);
        return 0;
 }
 
index 98cf31ed081438fc8ee05521cc7bc8c07f82a45d..e63c8fc3df3a08c9faeca3357f3e94e0ef0760dd 100644 (file)
@@ -40,9 +40,9 @@
 #include <linux/ioctl.h>
 #include <linux/capability.h>
 #include <linux/uaccess.h>
-#include <linux/smp_lock.h>
+#include <linux/compat.h>
+#include <linux/math64.h>
 #include <mtd/ubi-user.h>
-#include <asm/div64.h>
 #include "ubi.h"
 
 /**
@@ -195,7 +195,6 @@ static ssize_t vol_cdev_read(struct file *file, __user char *buf, size_t count,
        int err, lnum, off, len,  tbuf_size;
        size_t count_save = count;
        void *tbuf;
-       uint64_t tmp;
 
        dbg_gen("read %zd bytes from offset %lld of volume %d",
                count, *offp, vol->vol_id);
@@ -225,10 +224,7 @@ static ssize_t vol_cdev_read(struct file *file, __user char *buf, size_t count,
                return -ENOMEM;
 
        len = count > tbuf_size ? tbuf_size : count;
-
-       tmp = *offp;
-       off = do_div(tmp, vol->usable_leb_size);
-       lnum = tmp;
+       lnum = div_u64_rem(*offp, vol->usable_leb_size, &off);
 
        do {
                cond_resched();
@@ -263,12 +259,9 @@ static ssize_t vol_cdev_read(struct file *file, __user char *buf, size_t count,
        return err ? err : count_save - count;
 }
 
-#ifdef CONFIG_MTD_UBI_DEBUG_USERSPACE_IO
-
 /*
  * This function allows to directly write to dynamic UBI volumes, without
- * issuing the volume update operation. Available only as a debugging feature.
- * Very useful for testing UBI.
+ * issuing the volume update operation.
  */
 static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf,
                                     size_t count, loff_t *offp)
@@ -279,7 +272,9 @@ static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf,
        int lnum, off, len, tbuf_size, err = 0;
        size_t count_save = count;
        char *tbuf;
-       uint64_t tmp;
+
+       if (!vol->direct_writes)
+               return -EPERM;
 
        dbg_gen("requested: write %zd bytes to offset %lld of volume %u",
                count, *offp, vol->vol_id);
@@ -287,10 +282,7 @@ static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf,
        if (vol->vol_type == UBI_STATIC_VOLUME)
                return -EROFS;
 
-       tmp = *offp;
-       off = do_div(tmp, vol->usable_leb_size);
-       lnum = tmp;
-
+       lnum = div_u64_rem(*offp, vol->usable_leb_size, &off);
        if (off & (ubi->min_io_size - 1)) {
                dbg_err("unaligned position");
                return -EINVAL;
@@ -347,10 +339,6 @@ static ssize_t vol_cdev_direct_write(struct file *file, const char __user *buf,
        return err ? err : count_save - count;
 }
 
-#else
-#define vol_cdev_direct_write(file, buf, count, offp) (-EPERM)
-#endif /* CONFIG_MTD_UBI_DEBUG_USERSPACE_IO */
-
 static ssize_t vol_cdev_write(struct file *file, const char __user *buf,
                              size_t count, loff_t *offp)
 {
@@ -402,8 +390,8 @@ static ssize_t vol_cdev_write(struct file *file, const char __user *buf,
        return count;
 }
 
-static int vol_cdev_ioctl(struct inode *inode, struct file *file,
-                         unsigned int cmd, unsigned long arg)
+static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
+                          unsigned long arg)
 {
        int err = 0;
        struct ubi_volume_desc *desc = file->private_data;
@@ -487,7 +475,6 @@ static int vol_cdev_ioctl(struct inode *inode, struct file *file,
                break;
        }
 
-#ifdef CONFIG_MTD_UBI_DEBUG_USERSPACE_IO
        /* Logical eraseblock erasure command */
        case UBI_IOCEBER:
        {
@@ -518,13 +505,77 @@ static int vol_cdev_ioctl(struct inode *inode, struct file *file,
                err = ubi_wl_flush(ubi);
                break;
        }
-#endif
+
+       /* Logical eraseblock map command */
+       case UBI_IOCEBMAP:
+       {
+               struct ubi_map_req req;
+
+               err = copy_from_user(&req, argp, sizeof(struct ubi_map_req));
+               if (err) {
+                       err = -EFAULT;
+                       break;
+               }
+               err = ubi_leb_map(desc, req.lnum, req.dtype);
+               break;
+       }
+
+       /* Logical eraseblock un-map command */
+       case UBI_IOCEBUNMAP:
+       {
+               int32_t lnum;
+
+               err = get_user(lnum, (__user int32_t *)argp);
+               if (err) {
+                       err = -EFAULT;
+                       break;
+               }
+               err = ubi_leb_unmap(desc, lnum);
+               break;
+       }
+
+       /* Check if logical eraseblock is mapped command */
+       case UBI_IOCEBISMAP:
+       {
+               int32_t lnum;
+
+               err = get_user(lnum, (__user int32_t *)argp);
+               if (err) {
+                       err = -EFAULT;
+                       break;
+               }
+               err = ubi_is_mapped(desc, lnum);
+               break;
+       }
+
+       /* Set volume property command*/
+       case UBI_IOCSETPROP:
+       {
+               struct ubi_set_prop_req req;
+
+               err = copy_from_user(&req, argp,
+                               sizeof(struct ubi_set_prop_req));
+               if (err) {
+                       err = -EFAULT;
+                       break;
+               }
+               switch (req.property) {
+               case UBI_PROP_DIRECT_WRITE:
+                       mutex_lock(&ubi->volumes_mutex);
+                       desc->vol->direct_writes = !!req.value;
+                       mutex_unlock(&ubi->volumes_mutex);
+                       break;
+               default:
+                       err = -EINVAL;
+                       break;
+               }
+               break;
+       }
 
        default:
                err = -ENOTTY;
                break;
        }
-
        return err;
 }
 
@@ -762,8 +813,8 @@ out_free:
        return err;
 }
 
-static int ubi_cdev_ioctl(struct inode *inode, struct file *file,
-                         unsigned int cmd, unsigned long arg)
+static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
+                          unsigned long arg)
 {
        int err = 0;
        struct ubi_device *ubi;
@@ -773,7 +824,7 @@ static int ubi_cdev_ioctl(struct inode *inode, struct file *file,
        if (!capable(CAP_SYS_RESOURCE))
                return -EPERM;
 
-       ubi = ubi_get_by_major(imajor(inode));
+       ubi = ubi_get_by_major(imajor(file->f_mapping->host));
        if (!ubi)
                return -ENODEV;
 
@@ -843,7 +894,6 @@ static int ubi_cdev_ioctl(struct inode *inode, struct file *file,
        case UBI_IOCRSVOL:
        {
                int pebs;
-               uint64_t tmp;
                struct ubi_rsvol_req req;
 
                dbg_gen("re-size volume");
@@ -863,9 +913,8 @@ static int ubi_cdev_ioctl(struct inode *inode, struct file *file,
                        break;
                }
 
-               tmp = req.bytes;
-               pebs = !!do_div(tmp, desc->vol->usable_leb_size);
-               pebs += tmp;
+               pebs = div_u64(req.bytes + desc->vol->usable_leb_size - 1,
+                              desc->vol->usable_leb_size);
 
                mutex_lock(&ubi->volumes_mutex);
                err = ubi_resize_volume(desc, pebs);
@@ -909,8 +958,8 @@ static int ubi_cdev_ioctl(struct inode *inode, struct file *file,
        return err;
 }
 
-static int ctrl_cdev_ioctl(struct inode *inode, struct file *file,
-                          unsigned int cmd, unsigned long arg)
+static long ctrl_cdev_ioctl(struct file *file, unsigned int cmd,
+                           unsigned long arg)
 {
        int err = 0;
        void __user *argp = (void __user *)arg;
@@ -986,26 +1035,59 @@ static int ctrl_cdev_ioctl(struct inode *inode, struct file *file,
        return err;
 }
 
-/* UBI control character device operations */
-struct file_operations ubi_ctrl_cdev_operations = {
-       .ioctl = ctrl_cdev_ioctl,
-       .owner = THIS_MODULE,
+#ifdef CONFIG_COMPAT
+static long vol_cdev_compat_ioctl(struct file *file, unsigned int cmd,
+                                 unsigned long arg)
+{
+       unsigned long translated_arg = (unsigned long)compat_ptr(arg);
+
+       return vol_cdev_ioctl(file, cmd, translated_arg);
+}
+
+static long ubi_cdev_compat_ioctl(struct file *file, unsigned int cmd,
+                                 unsigned long arg)
+{
+       unsigned long translated_arg = (unsigned long)compat_ptr(arg);
+
+       return ubi_cdev_ioctl(file, cmd, translated_arg);
+}
+
+static long ctrl_cdev_compat_ioctl(struct file *file, unsigned int cmd,
+                                  unsigned long arg)
+{
+       unsigned long translated_arg = (unsigned long)compat_ptr(arg);
+
+       return ctrl_cdev_ioctl(file, cmd, translated_arg);
+}
+#else
+#define vol_cdev_compat_ioctl  NULL
+#define ubi_cdev_compat_ioctl  NULL
+#define ctrl_cdev_compat_ioctl NULL
+#endif
+
+/* UBI volume character device operations */
+const struct file_operations ubi_vol_cdev_operations = {
+       .owner          = THIS_MODULE,
+       .open           = vol_cdev_open,
+       .release        = vol_cdev_release,
+       .llseek         = vol_cdev_llseek,
+       .read           = vol_cdev_read,
+       .write          = vol_cdev_write,
+       .unlocked_ioctl = vol_cdev_ioctl,
+       .compat_ioctl   = vol_cdev_compat_ioctl,
 };
 
 /* UBI character device operations */
-struct file_operations ubi_cdev_operations = {
-       .owner = THIS_MODULE,
-       .ioctl = ubi_cdev_ioctl,
-       .llseek = no_llseek,
+const struct file_operations ubi_cdev_operations = {
+       .owner          = THIS_MODULE,
+       .llseek         = no_llseek,
+       .unlocked_ioctl = ubi_cdev_ioctl,
+       .compat_ioctl   = ubi_cdev_compat_ioctl,
 };
 
-/* UBI volume character device operations */
-struct file_operations ubi_vol_cdev_operations = {
-       .owner   = THIS_MODULE,
-       .open    = vol_cdev_open,
-       .release = vol_cdev_release,
-       .llseek  = vol_cdev_llseek,
-       .read    = vol_cdev_read,
-       .write   = vol_cdev_write,
-       .ioctl   = vol_cdev_ioctl,
+/* UBI control character device operations */
+const struct file_operations ubi_ctrl_cdev_operations = {
+       .owner          = THIS_MODULE,
+       .unlocked_ioctl = ctrl_cdev_ioctl,
+       .compat_ioctl   = ctrl_cdev_compat_ioctl,
 };
index 6dd4f5e77f82bf2408de09fdc52b33888602bc20..49cd55ade9c80961ea0d1a622ea37c8726b937e2 100644 (file)
@@ -28,7 +28,7 @@
  * eraseblock size is equivalent to the logical eraseblock size of the volume.
  */
 
-#include <asm/div64.h>
+#include <linux/math64.h>
 #include "ubi.h"
 
 /**
@@ -109,7 +109,6 @@ static int gluebi_read(struct mtd_info *mtd, loff_t from, size_t len,
        int err = 0, lnum, offs, total_read;
        struct ubi_volume *vol;
        struct ubi_device *ubi;
-       uint64_t tmp = from;
 
        dbg_gen("read %zd bytes from offset %lld", len, from);
 
@@ -119,9 +118,7 @@ static int gluebi_read(struct mtd_info *mtd, loff_t from, size_t len,
        vol = container_of(mtd, struct ubi_volume, gluebi_mtd);
        ubi = vol->ubi;
 
-       offs = do_div(tmp, mtd->erasesize);
-       lnum = tmp;
-
+       lnum = div_u64_rem(from, mtd->erasesize, &offs);
        total_read = len;
        while (total_read) {
                size_t to_read = mtd->erasesize - offs;
@@ -160,7 +157,6 @@ static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len,
        int err = 0, lnum, offs, total_written;
        struct ubi_volume *vol;
        struct ubi_device *ubi;
-       uint64_t tmp = to;
 
        dbg_gen("write %zd bytes to offset %lld", len, to);
 
@@ -173,8 +169,7 @@ static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len,
        if (ubi->ro_mode)
                return -EROFS;
 
-       offs = do_div(tmp, mtd->erasesize);
-       lnum = tmp;
+       lnum = div_u64_rem(to, mtd->erasesize, &offs);
 
        if (len % mtd->writesize || offs % mtd->writesize)
                return -EINVAL;
index ecde202a5a12f21705731be7564ce3f2e36d9fd0..c3d653ba5ca0153c45ccbfd21a6d106bfa1b6220 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <linux/err.h>
 #include <linux/crc32.h>
-#include <asm/div64.h>
+#include <linux/math64.h>
 #include "ubi.h"
 
 #ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
@@ -904,10 +904,8 @@ struct ubi_scan_info *ubi_scan(struct ubi_device *ubi)
        dbg_msg("scanning is finished");
 
        /* Calculate mean erase counter */
-       if (si->ec_count) {
-               do_div(si->ec_sum, si->ec_count);
-               si->mean_ec = si->ec_sum;
-       }
+       if (si->ec_count)
+               si->mean_ec = div_u64(si->ec_sum, si->ec_count);
 
        if (si->is_empty)
                ubi_msg("empty MTD device detected");
index 4a8ec485c91d97c76b2abd8fe63e5f82603d0313..c055511bb1b20a7201bbb2c3bc5bf9a0ddf15ddb 100644 (file)
@@ -206,6 +206,7 @@ struct ubi_volume_desc;
  * @upd_marker: %1 if the update marker is set for this volume
  * @updating: %1 if the volume is being updated
  * @changing_leb: %1 if the atomic LEB change ioctl command is in progress
+ * @direct_writes: %1 if direct writes are enabled for this volume
  *
  * @gluebi_desc: gluebi UBI volume descriptor
  * @gluebi_refcount: reference count of the gluebi MTD device
@@ -253,6 +254,7 @@ struct ubi_volume {
        unsigned int upd_marker:1;
        unsigned int updating:1;
        unsigned int changing_leb:1;
+       unsigned int direct_writes:1;
 
 #ifdef CONFIG_MTD_UBI_GLUEBI
        /*
@@ -304,7 +306,8 @@ struct ubi_wl_entry;
  * @vtbl_size: size of the volume table in bytes
  * @vtbl: in-RAM volume table copy
  * @volumes_mutex: protects on-flash volume table and serializes volume
- *                 changes, like creation, deletion, update, re-size and re-name
+ *                 changes, like creation, deletion, update, re-size,
+ *                 re-name and set property
  *
  * @max_ec: current highest erase counter value
  * @mean_ec: current mean erase counter value
@@ -449,9 +452,9 @@ struct ubi_device {
 };
 
 extern struct kmem_cache *ubi_wl_entry_slab;
-extern struct file_operations ubi_ctrl_cdev_operations;
-extern struct file_operations ubi_cdev_operations;
-extern struct file_operations ubi_vol_cdev_operations;
+extern const struct file_operations ubi_ctrl_cdev_operations;
+extern const struct file_operations ubi_cdev_operations;
+extern const struct file_operations ubi_vol_cdev_operations;
 extern struct class *ubi_class;
 extern struct mutex ubi_devices_mutex;
 
index 8b89cc18ff0b69753326dbe48b87015726cf3cc1..6b4d1ae891ae81a187b9073b79e1ac29c1aad6e5 100644 (file)
@@ -40,7 +40,7 @@
 
 #include <linux/err.h>
 #include <linux/uaccess.h>
-#include <asm/div64.h>
+#include <linux/math64.h>
 #include "ubi.h"
 
 /**
@@ -89,7 +89,6 @@ static int clear_update_marker(struct ubi_device *ubi, struct ubi_volume *vol,
                               long long bytes)
 {
        int err;
-       uint64_t tmp;
        struct ubi_vtbl_record vtbl_rec;
 
        dbg_gen("clear update marker for volume %d", vol->vol_id);
@@ -101,9 +100,9 @@ static int clear_update_marker(struct ubi_device *ubi, struct ubi_volume *vol,
 
        if (vol->vol_type == UBI_STATIC_VOLUME) {
                vol->corrupted = 0;
-               vol->used_bytes = tmp = bytes;
-               vol->last_eb_bytes = do_div(tmp, vol->usable_leb_size);
-               vol->used_ebs = tmp;
+               vol->used_bytes = bytes;
+               vol->used_ebs = div_u64_rem(bytes, vol->usable_leb_size,
+                                           &vol->last_eb_bytes);
                if (vol->last_eb_bytes)
                        vol->used_ebs += 1;
                else
@@ -131,7 +130,6 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
                     long long bytes)
 {
        int i, err;
-       uint64_t tmp;
 
        dbg_gen("start update of volume %d, %llu bytes", vol->vol_id, bytes);
        ubi_assert(!vol->updating && !vol->changing_leb);
@@ -161,9 +159,8 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
        if (!vol->upd_buf)
                return -ENOMEM;
 
-       tmp = bytes;
-       vol->upd_ebs = !!do_div(tmp, vol->usable_leb_size);
-       vol->upd_ebs += tmp;
+       vol->upd_ebs = div_u64(bytes + vol->usable_leb_size - 1,
+                              vol->usable_leb_size);
        vol->upd_bytes = bytes;
        vol->upd_received = 0;
        return 0;
@@ -282,7 +279,6 @@ static int write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
 int ubi_more_update_data(struct ubi_device *ubi, struct ubi_volume *vol,
                         const void __user *buf, int count)
 {
-       uint64_t tmp;
        int lnum, offs, err = 0, len, to_write = count;
 
        dbg_gen("write %d of %lld bytes, %lld already passed",
@@ -291,10 +287,7 @@ int ubi_more_update_data(struct ubi_device *ubi, struct ubi_volume *vol,
        if (ubi->ro_mode)
                return -EROFS;
 
-       tmp = vol->upd_received;
-       offs = do_div(tmp, vol->usable_leb_size);
-       lnum = tmp;
-
+       lnum = div_u64_rem(vol->upd_received,  vol->usable_leb_size, &offs);
        if (vol->upd_received + count > vol->upd_bytes)
                to_write = count = vol->upd_bytes - vol->upd_received;
 
index 22e1d7398fce36b83166940f085fae37126a3d18..df5483562b7a71d9d3e6c36238edb55a2107df66 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include <linux/err.h>
-#include <asm/div64.h>
+#include <linux/math64.h>
 #include "ubi.h"
 
 #ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
@@ -205,7 +205,6 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
        int i, err, vol_id = req->vol_id, do_free = 1;
        struct ubi_volume *vol;
        struct ubi_vtbl_record vtbl_rec;
-       uint64_t bytes;
        dev_t dev;
 
        if (ubi->ro_mode)
@@ -255,10 +254,8 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
 
        /* Calculate how many eraseblocks are requested */
        vol->usable_leb_size = ubi->leb_size - ubi->leb_size % req->alignment;
-       bytes = req->bytes;
-       if (do_div(bytes, vol->usable_leb_size))
-               vol->reserved_pebs = 1;
-       vol->reserved_pebs += bytes;
+       vol->reserved_pebs += div_u64(req->bytes + vol->usable_leb_size - 1,
+                                     vol->usable_leb_size);
 
        /* Reserve physical eraseblocks */
        if (vol->reserved_pebs > ubi->avail_pebs) {
@@ -301,10 +298,10 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
                vol->used_bytes =
                        (long long)vol->used_ebs * vol->usable_leb_size;
        } else {
-               bytes = vol->used_bytes;
-               vol->last_eb_bytes = do_div(bytes, vol->usable_leb_size);
-               vol->used_ebs = bytes;
-               if (vol->last_eb_bytes)
+               vol->used_ebs = div_u64_rem(vol->used_bytes,
+                                           vol->usable_leb_size,
+                                           &vol->last_eb_bytes);
+               if (vol->last_eb_bytes != 0)
                        vol->used_ebs += 1;
                else
                        vol->last_eb_bytes = vol->usable_leb_size;
index d15d8b79d8e5332891134ab5bb1424aa83b66388..54b52e5b1821bbcd196b3f2f70cea19c51a5ec37 100644 (file)
@@ -646,7 +646,7 @@ static const struct net_device_ops etherh_netdev_ops = {
        .ndo_get_stats          = ei_get_stats,
        .ndo_set_multicast_list = ei_set_multicast_list,
        .ndo_validate_addr      = eth_validate_addr,
-       .ndo_set_mac_address    = eth_set_mac_addr,
+       .ndo_set_mac_address    = eth_mac_addr,
        .ndo_change_mtu         = eth_change_mtu,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller    = ei_poll,
index 840b3d1a22f5d53f5db94ec6cb04c7b2dc981df0..bbbc3bb08aa54a2bcb52e80b7c9df860d1a42f16 100644 (file)
@@ -806,7 +806,7 @@ static int cas_reset_mii_phy(struct cas *cp)
 
        cas_phy_write(cp, MII_BMCR, BMCR_RESET);
        udelay(100);
-       while (limit--) {
+       while (--limit) {
                val = cas_phy_read(cp, MII_BMCR);
                if ((val & BMCR_RESET) == 0)
                        break;
@@ -979,7 +979,7 @@ static void cas_phy_init(struct cas *cp)
                writel(val, cp->regs + REG_PCS_MII_CTRL);
 
                limit = STOP_TRIES;
-               while (limit-- > 0) {
+               while (--limit > 0) {
                        udelay(10);
                        if ((readl(cp->regs + REG_PCS_MII_CTRL) &
                             PCS_MII_RESET) == 0)
index 379a1324db4e9c0709e1f56207b10d4567fdd9c7..d31791f602924ca176c51ee612130b1b6d73967b 100644 (file)
@@ -2276,8 +2276,7 @@ no_mem:
                } else if ((len = ntohl(r->len_cq)) != 0) {
                        struct sge_fl *fl;
 
-                       if (eth)
-                               lro = qs->lro_enabled && is_eth_tcp(rss_hi);
+                       lro &= eth && is_eth_tcp(rss_hi);
 
                        fl = (len & F_RSPD_FLQ) ? &qs->fl[1] : &qs->fl[0];
                        if (fl->use_pages) {
index 26474c92193f705a3b66e413fa5773da38ce87f2..6bd63cc67b3ec37eec06275368b5685300cd9b79 100644 (file)
@@ -31,7 +31,7 @@
 
 char e1000_driver_name[] = "e1000";
 static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
-#define DRV_VERSION "7.3.20-k3-NAPI"
+#define DRV_VERSION "7.3.21-k3-NAPI"
 const char e1000_driver_version[] = DRV_VERSION;
 static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
 
@@ -940,7 +940,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
                err = pci_enable_device(pdev);
        } else {
                bars = pci_select_bars(pdev, IORESOURCE_MEM);
-               err = pci_enable_device(pdev);
+               err = pci_enable_device_mem(pdev);
        }
        if (err)
                return err;
@@ -3712,7 +3712,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
        struct e1000_hw *hw = &adapter->hw;
        u32 rctl, icr = er32(ICR);
 
-       if (unlikely(!icr))
+       if (unlikely((!icr) || test_bit(__E1000_RESETTING, &adapter->flags)))
                return IRQ_NONE;  /* Not our interrupt */
 
        /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
index 3f7eab42aef12b14e10c8e874894d3c1b1490093..acae2d8cd688f879dbc56dbfebf46b1369a8f4f5 100644 (file)
@@ -351,6 +351,9 @@ static int gfar_probe(struct of_device *ofdev,
        /* Reset MAC layer */
        gfar_write(&priv->regs->maccfg1, MACCFG1_SOFT_RESET);
 
+       /* We need to delay at least 3 TX clocks */
+       udelay(2);
+
        tempval = (MACCFG1_TX_FLOW | MACCFG1_RX_FLOW);
        gfar_write(&priv->regs->maccfg1, tempval);
 
index b1a83344acc75de952a5b4ed3345448595875d33..eaa86897f5c391109713c60e1761f32fecd65c38 100644 (file)
@@ -312,7 +312,7 @@ extern const char gfar_driver_version[];
 #define ATTRELI_EI(x) (x)
 
 #define BD_LFLAG(flags) ((flags) << 16)
-#define BD_LENGTH_MASK         0x00ff
+#define BD_LENGTH_MASK         0x0000ffff
 
 /* TxBD status field bits */
 #define TXBD_READY             0x8000
index f3706e415b45323e8de205581b6ed4a57e8ea51b..f49a426ad681c1996f7675f8e993eb784e4981af 100644 (file)
@@ -234,6 +234,8 @@ static int gfar_mdio_probe(struct of_device *ofdev,
        if (NULL == new_bus)
                return -ENOMEM;
 
+       device_init_wakeup(&ofdev->dev, 1);
+
        new_bus->name = "Gianfar MII Bus",
        new_bus->read = &gfar_mdio_read,
        new_bus->write = &gfar_mdio_write,
index c40cd8df2212089e2f810bd1f25e0f6354dc42f3..ac9d964e59ec7c4a2f067f025559a9374b544938 100644 (file)
@@ -60,7 +60,7 @@ int emac_mii_reset_phy(struct mii_phy *phy)
 
        udelay(300);
 
-       while (limit--) {
+       while (--limit) {
                val = phy_read(phy, MII_BMCR);
                if (val >= 0 && (val & BMCR_RESET) == 0)
                        break;
@@ -84,7 +84,7 @@ int emac_mii_reset_gpcs(struct mii_phy *phy)
 
        udelay(300);
 
-       while (limit--) {
+       while (--limit) {
                val = gpcs_phy_read(phy, MII_BMCR);
                if (val >= 0 && (val & BMCR_RESET) == 0)
                        break;
index f5e2e7235fcbf197a5d427b49df86cef9d3d7c8b..13ca73f96ec6e397971ab9b7dbb42924430e8408 100644 (file)
@@ -699,11 +699,18 @@ static s32 igb_check_for_link_82575(struct e1000_hw *hw)
 
        /* SGMII link check is done through the PCS register. */
        if ((hw->phy.media_type != e1000_media_type_copper) ||
-           (igb_sgmii_active_82575(hw)))
+           (igb_sgmii_active_82575(hw))) {
                ret_val = igb_get_pcs_speed_and_duplex_82575(hw, &speed,
                                                             &duplex);
-       else
+               /*
+                * Use this flag to determine if link needs to be checked or
+                * not.  If  we have link clear the flag so that we do not
+                * continue to check for link.
+                */
+               hw->mac.get_link_status = !hw->mac.serdes_has_link;
+       } else {
                ret_val = igb_check_for_copper_link(hw);
+       }
 
        return ret_val;
 }
index 5a27825cc48a3de22be22fdfd32bd455778549b7..aebef8e48e76ebd80d6cd22e7fd5468f7bf6e181 100644 (file)
@@ -300,11 +300,10 @@ struct igb_adapter {
 
 #define IGB_FLAG_HAS_MSI           (1 << 0)
 #define IGB_FLAG_MSI_ENABLE        (1 << 1)
-#define IGB_FLAG_HAS_DCA           (1 << 2)
-#define IGB_FLAG_DCA_ENABLED       (1 << 3)
-#define IGB_FLAG_IN_NETPOLL        (1 << 5)
-#define IGB_FLAG_QUAD_PORT_A       (1 << 6)
-#define IGB_FLAG_NEED_CTX_IDX      (1 << 7)
+#define IGB_FLAG_DCA_ENABLED       (1 << 2)
+#define IGB_FLAG_IN_NETPOLL        (1 << 3)
+#define IGB_FLAG_QUAD_PORT_A       (1 << 4)
+#define IGB_FLAG_NEED_CTX_IDX      (1 << 5)
 
 enum e1000_state_t {
        __IGB_TESTING,
index b82b0fb2056c6122f5ad0be865fe6b6988d82c44..a50db5398fa52a297c07b78dddc5c6502c406f39 100644 (file)
@@ -206,10 +206,11 @@ static int __init igb_init_module(void)
 
        global_quad_port_a = 0;
 
-       ret = pci_register_driver(&igb_driver);
 #ifdef CONFIG_IGB_DCA
        dca_register_notify(&dca_notifier);
 #endif
+
+       ret = pci_register_driver(&igb_driver);
        return ret;
 }
 
@@ -1156,11 +1157,10 @@ static int __devinit igb_probe(struct pci_dev *pdev,
 
        /* set flags */
        switch (hw->mac.type) {
-       case e1000_82576:
        case e1000_82575:
-               adapter->flags |= IGB_FLAG_HAS_DCA;
                adapter->flags |= IGB_FLAG_NEED_CTX_IDX;
                break;
+       case e1000_82576:
        default:
                break;
        }
@@ -1310,8 +1310,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
                goto err_register;
 
 #ifdef CONFIG_IGB_DCA
-       if ((adapter->flags & IGB_FLAG_HAS_DCA) &&
-           (dca_add_requester(&pdev->dev) == 0)) {
+       if (dca_add_requester(&pdev->dev) == 0) {
                adapter->flags |= IGB_FLAG_DCA_ENABLED;
                dev_info(&pdev->dev, "DCA enabled\n");
                /* Always use CB2 mode, difference is masked
@@ -1835,11 +1834,11 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
        rctl |= E1000_RCTL_SECRC;
 
        /*
-        * disable store bad packets, long packet enable, and clear size bits.
+        * disable store bad packets and clear size bits.
         */
-       rctl &= ~(E1000_RCTL_SBP | E1000_RCTL_LPE | E1000_RCTL_SZ_256);
+       rctl &= ~(E1000_RCTL_SBP | E1000_RCTL_SZ_256);
 
-       if (adapter->netdev->mtu > ETH_DATA_LEN)
+       /* enable LPE when to prevent packets larger than max_frame_size */
                rctl |= E1000_RCTL_LPE;
 
        /* Setup buffer sizes */
@@ -1865,7 +1864,7 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
         */
        /* allocations using alloc_page take too long for regular MTU
         * so only enable packet split for jumbo frames */
-       if (rctl & E1000_RCTL_LPE) {
+       if (adapter->netdev->mtu > ETH_DATA_LEN) {
                adapter->rx_ps_hdr_size = IGB_RXBUFFER_128;
                srrctl |= adapter->rx_ps_hdr_size <<
                         E1000_SRRCTL_BSIZEHDRSIZE_SHIFT;
@@ -3473,19 +3472,16 @@ static int __igb_notify_dca(struct device *dev, void *data)
        struct e1000_hw *hw = &adapter->hw;
        unsigned long event = *(unsigned long *)data;
 
-       if (!(adapter->flags & IGB_FLAG_HAS_DCA))
-               goto out;
-
        switch (event) {
        case DCA_PROVIDER_ADD:
                /* if already enabled, don't do it again */
                if (adapter->flags & IGB_FLAG_DCA_ENABLED)
                        break;
-               adapter->flags |= IGB_FLAG_DCA_ENABLED;
                /* Always use CB2 mode, difference is masked
                 * in the CB driver. */
                wr32(E1000_DCA_CTRL, 2);
                if (dca_add_requester(dev) == 0) {
+                       adapter->flags |= IGB_FLAG_DCA_ENABLED;
                        dev_info(&adapter->pdev->dev, "DCA enabled\n");
                        igb_setup_dca(adapter);
                        break;
@@ -3502,7 +3498,7 @@ static int __igb_notify_dca(struct device *dev, void *data)
                }
                break;
        }
-out:
+
        return 0;
 }
 
index a75a31005fd3d4ffe540a6d69533f8cfa4072f85..9c78c963b7219799f3cb155091ba5f0f4b2db27a 100644 (file)
 #define MAX_CMD_DESCRIPTORS_HOST       1024
 #define MAX_RCV_DESCRIPTORS_1G         2048
 #define MAX_RCV_DESCRIPTORS_10G                4096
-#define MAX_JUMBO_RCV_DESCRIPTORS      512
+#define MAX_JUMBO_RCV_DESCRIPTORS      1024
 #define MAX_LRO_RCV_DESCRIPTORS                8
 #define MAX_RCVSTATUS_DESCRIPTORS      MAX_RCV_DESCRIPTORS
 #define MAX_JUMBO_RCV_DESC     MAX_JUMBO_RCV_DESCRIPTORS
index ca7c8d8050c998b158e451efe975be219b549771..ffd37bea1628b43452cf2749be07e5c9376591dc 100644 (file)
@@ -947,8 +947,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
        }
        for (i = 0; i < n; i++) {
                if (netxen_rom_fast_read(adapter, 8*i + 4*offset, &val) != 0 ||
-               netxen_rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0)
+               netxen_rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0) {
+                       kfree(buf);
                        return -EIO;
+               }
 
                buf[i].addr = addr;
                buf[i].data = val;
index c38ed777f0a890a60f6092bea0ec0efb197b8e98..a6999403f37b27c63eb770a23e521f9517362a96 100644 (file)
@@ -586,7 +586,7 @@ static int pcnet_config(struct pcmcia_device *link)
     }
 
     if ((link->conf.ConfigBase == 0x03c0)
-       && (link->manf_id == 0x149) && (link->card_id = 0xc1ab)) {
+       && (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) {
        printk(KERN_INFO "pcnet_cs: this is an AX88190 card!\n");
        printk(KERN_INFO "pcnet_cs: use axnet_cs instead.\n");
        goto failed;
index ec2314246682af0946bbe97475b3947670401383..335da4831ab3ecfa5d142d572e6374a5b63f1800 100644 (file)
@@ -2168,7 +2168,7 @@ static void gelic_wl_connected_event(struct gelic_wl_info *wl,
                complete(&wl->assoc_done);
                netif_carrier_on(port_to_netdev(wl_port(wl)));
        } else
-               pr_debug("%s: event %#lx under wpa\n",
+               pr_debug("%s: event %#llx under wpa\n",
                                 __func__, event);
 }
 
index c1dadadfab183998c21462168b6680aa870b4934..e6fdce9206cc994863c7d0e451558700310ade77 100644 (file)
@@ -787,12 +787,12 @@ struct mbox_params {
 
 struct flash_params {
        u8 dev_id_str[4];
-       u16 size;
-       u16 csum;
-       u16 ver;
-       u16 sub_dev_id;
+       __le16 size;
+       __le16 csum;
+       __le16 ver;
+       __le16 sub_dev_id;
        u8 mac_addr[6];
-       u16 res;
+       __le16 res;
 };
 
 
index 45421c8b601061cf3eed7e83c2ee9791842b2c6c..3d1d7b6e55aa9153d2fddd8b032f6cc5b8346f4b 100644 (file)
@@ -641,7 +641,7 @@ static void ql_enable_all_completion_interrupts(struct ql_adapter *qdev)
 
 }
 
-static int ql_read_flash_word(struct ql_adapter *qdev, int offset, u32 *data)
+static int ql_read_flash_word(struct ql_adapter *qdev, int offset, __le32 *data)
 {
        int status = 0;
        /* wait for reg to come ready */
@@ -656,8 +656,11 @@ static int ql_read_flash_word(struct ql_adapter *qdev, int offset, u32 *data)
                        FLASH_ADDR, FLASH_ADDR_RDY, FLASH_ADDR_ERR);
        if (status)
                goto exit;
-       /* get the data */
-       *data = ql_read32(qdev, FLASH_DATA);
+        /* This data is stored on flash as an array of
+        * __le32.  Since ql_read32() returns cpu endian
+        * we need to swap it back.
+        */
+       *data = cpu_to_le32(ql_read32(qdev, FLASH_DATA));
 exit:
        return status;
 }
@@ -666,13 +669,20 @@ static int ql_get_flash_params(struct ql_adapter *qdev)
 {
        int i;
        int status;
-       u32 *p = (u32 *)&qdev->flash;
+       __le32 *p = (__le32 *)&qdev->flash;
+       u32 offset = 0;
+
+       /* Second function's parameters follow the first
+        * function's.
+        */
+       if (qdev->func)
+               offset = sizeof(qdev->flash) / sizeof(u32);
 
        if (ql_sem_spinlock(qdev, SEM_FLASH_MASK))
                return -ETIMEDOUT;
 
        for (i = 0; i < sizeof(qdev->flash) / sizeof(u32); i++, p++) {
-               status = ql_read_flash_word(qdev, i, p);
+               status = ql_read_flash_word(qdev, i+offset, p);
                if (status) {
                        QPRINTK(qdev, IFUP, ERR, "Error reading flash.\n");
                        goto exit;
@@ -3826,7 +3836,7 @@ static int qlge_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct net_device *ndev = pci_get_drvdata(pdev);
        struct ql_adapter *qdev = netdev_priv(ndev);
-       int err;
+       int err, i;
 
        netif_device_detach(ndev);
 
@@ -3836,6 +3846,9 @@ static int qlge_suspend(struct pci_dev *pdev, pm_message_t state)
                        return err;
        }
 
+       for (i = qdev->rss_ring_first_cq_id; i < qdev->rx_ring_count; i++)
+               netif_napi_del(&qdev->rx_ring[i].napi);
+
        err = pci_save_state(pdev);
        if (err)
                return err;
index 72fd9e97c190f0ebc5e43b0f259db775b6287916..b2dcdb5ed8bde1b3ca424ad17fb310c4b5a2ba5e 100644 (file)
@@ -438,7 +438,6 @@ static void r6040_down(struct net_device *dev)
 {
        struct r6040_private *lp = netdev_priv(dev);
        void __iomem *ioaddr = lp->base;
-       struct pci_dev *pdev = lp->pdev;
        int limit = 2048;
        u16 *adrp;
        u16 cmd;
index 7673fd92eaf5f15f413ecd50d56f914d5de078c7..ab0e09bf154d1f1fe2fdab401465e31cccdb2918 100644 (file)
@@ -676,9 +676,8 @@ static int efx_init_port(struct efx_nic *efx)
        rc = efx->phy_op->init(efx);
        if (rc)
                return rc;
-       efx->phy_op->reconfigure(efx);
-
        mutex_lock(&efx->mac_lock);
+       efx->phy_op->reconfigure(efx);
        rc = falcon_switch_mac(efx);
        mutex_unlock(&efx->mac_lock);
        if (rc)
@@ -686,7 +685,7 @@ static int efx_init_port(struct efx_nic *efx)
        efx->mac_op->reconfigure(efx);
 
        efx->port_initialized = true;
-       efx->stats_enabled = true;
+       efx_stats_enable(efx);
        return 0;
 
 fail:
@@ -735,6 +734,7 @@ static void efx_fini_port(struct efx_nic *efx)
        if (!efx->port_initialized)
                return;
 
+       efx_stats_disable(efx);
        efx->phy_op->fini(efx);
        efx->port_initialized = false;
 
@@ -1361,6 +1361,20 @@ static int efx_net_stop(struct net_device *net_dev)
        return 0;
 }
 
+void efx_stats_disable(struct efx_nic *efx)
+{
+       spin_lock(&efx->stats_lock);
+       ++efx->stats_disable_count;
+       spin_unlock(&efx->stats_lock);
+}
+
+void efx_stats_enable(struct efx_nic *efx)
+{
+       spin_lock(&efx->stats_lock);
+       --efx->stats_disable_count;
+       spin_unlock(&efx->stats_lock);
+}
+
 /* Context: process, dev_base_lock or RTNL held, non-blocking. */
 static struct net_device_stats *efx_net_stats(struct net_device *net_dev)
 {
@@ -1369,12 +1383,12 @@ static struct net_device_stats *efx_net_stats(struct net_device *net_dev)
        struct net_device_stats *stats = &net_dev->stats;
 
        /* Update stats if possible, but do not wait if another thread
-        * is updating them (or resetting the NIC); slightly stale
-        * stats are acceptable.
+        * is updating them or if MAC stats fetches are temporarily
+        * disabled; slightly stale stats are acceptable.
         */
        if (!spin_trylock(&efx->stats_lock))
                return stats;
-       if (efx->stats_enabled) {
+       if (!efx->stats_disable_count) {
                efx->mac_op->update_stats(efx);
                falcon_update_nic_stats(efx);
        }
@@ -1622,16 +1636,12 @@ static void efx_unregister_netdev(struct efx_nic *efx)
 
 /* Tears down the entire software state and most of the hardware state
  * before reset.  */
-void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd)
+void efx_reset_down(struct efx_nic *efx, enum reset_type method,
+                   struct ethtool_cmd *ecmd)
 {
        EFX_ASSERT_RESET_SERIALISED(efx);
 
-       /* The net_dev->get_stats handler is quite slow, and will fail
-        * if a fetch is pending over reset. Serialise against it. */
-       spin_lock(&efx->stats_lock);
-       efx->stats_enabled = false;
-       spin_unlock(&efx->stats_lock);
-
+       efx_stats_disable(efx);
        efx_stop_all(efx);
        mutex_lock(&efx->mac_lock);
        mutex_lock(&efx->spi_lock);
@@ -1639,6 +1649,8 @@ void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd)
        efx->phy_op->get_settings(efx, ecmd);
 
        efx_fini_channels(efx);
+       if (efx->port_initialized && method != RESET_TYPE_INVISIBLE)
+               efx->phy_op->fini(efx);
 }
 
 /* This function will always ensure that the locks acquired in
@@ -1646,7 +1658,8 @@ void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd)
  * that we were unable to reinitialise the hardware, and the
  * driver should be disabled. If ok is false, then the rx and tx
  * engines are not restarted, pending a RESET_DISABLE. */
-int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd, bool ok)
+int efx_reset_up(struct efx_nic *efx, enum reset_type method,
+                struct ethtool_cmd *ecmd, bool ok)
 {
        int rc;
 
@@ -1658,6 +1671,15 @@ int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd, bool ok)
                ok = false;
        }
 
+       if (efx->port_initialized && method != RESET_TYPE_INVISIBLE) {
+               if (ok) {
+                       rc = efx->phy_op->init(efx);
+                       if (rc)
+                               ok = false;
+               } else
+                       efx->port_initialized = false;
+       }
+
        if (ok) {
                efx_init_channels(efx);
 
@@ -1670,7 +1692,7 @@ int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd, bool ok)
 
        if (ok) {
                efx_start_all(efx);
-               efx->stats_enabled = true;
+               efx_stats_enable(efx);
        }
        return rc;
 }
@@ -1702,7 +1724,7 @@ static int efx_reset(struct efx_nic *efx)
 
        EFX_INFO(efx, "resetting (%d)\n", method);
 
-       efx_reset_down(efx, &ecmd);
+       efx_reset_down(efx, method, &ecmd);
 
        rc = falcon_reset_hw(efx, method);
        if (rc) {
@@ -1721,10 +1743,10 @@ static int efx_reset(struct efx_nic *efx)
 
        /* Leave device stopped if necessary */
        if (method == RESET_TYPE_DISABLE) {
-               efx_reset_up(efx, &ecmd, false);
+               efx_reset_up(efx, method, &ecmd, false);
                rc = -EIO;
        } else {
-               rc = efx_reset_up(efx, &ecmd, true);
+               rc = efx_reset_up(efx, method, &ecmd, true);
        }
 
 out_disable:
@@ -1876,6 +1898,7 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
        efx->rx_checksum_enabled = true;
        spin_lock_init(&efx->netif_stop_lock);
        spin_lock_init(&efx->stats_lock);
+       efx->stats_disable_count = 1;
        mutex_init(&efx->mac_lock);
        efx->mac_op = &efx_dummy_mac_operations;
        efx->phy_op = &efx_dummy_phy_operations;
index 0dd7a532c78a4b06a5c92209d763313570983556..55d0f131b0e90d83dda988ee81ee73a9d97b63f0 100644 (file)
@@ -36,13 +36,16 @@ extern void efx_process_channel_now(struct efx_channel *channel);
 extern void efx_flush_queues(struct efx_nic *efx);
 
 /* Ports */
+extern void efx_stats_disable(struct efx_nic *efx);
+extern void efx_stats_enable(struct efx_nic *efx);
 extern void efx_reconfigure_port(struct efx_nic *efx);
 extern void __efx_reconfigure_port(struct efx_nic *efx);
 
 /* Reset handling */
-extern void efx_reset_down(struct efx_nic *efx, struct ethtool_cmd *ecmd);
-extern int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd,
-                       bool ok);
+extern void efx_reset_down(struct efx_nic *efx, enum reset_type method,
+                          struct ethtool_cmd *ecmd);
+extern int efx_reset_up(struct efx_nic *efx, enum reset_type method,
+                       struct ethtool_cmd *ecmd, bool ok);
 
 /* Global */
 extern void efx_schedule_reset(struct efx_nic *efx, enum reset_type type);
index 53d259e90187ae8017c664ef55579329a745608b..7b5924c039b31508069591b2dd977e8417614525 100644 (file)
@@ -219,9 +219,6 @@ int efx_ethtool_set_settings(struct net_device *net_dev,
        struct efx_nic *efx = netdev_priv(net_dev);
        int rc;
 
-       if (EFX_WORKAROUND_13963(efx) && !ecmd->autoneg)
-               return -EINVAL;
-
        /* Falcon GMAC does not support 1000Mbps HD */
        if (ecmd->speed == SPEED_1000 && ecmd->duplex != DUPLEX_FULL) {
                EFX_LOG(efx, "rejecting unsupported 1000Mbps HD"
index 5b9f2d9cc4edba62d03fb14a57effa802361e267..d5378e60fcddfcb44cb5223abb11b6a1f75a34e6 100644 (file)
@@ -824,10 +824,6 @@ static void falcon_handle_rx_not_ok(struct efx_rx_queue *rx_queue,
                            rx_ev_pause_frm ? " [PAUSE]" : "");
        }
 #endif
-
-       if (unlikely(rx_ev_eth_crc_err && EFX_WORKAROUND_10750(efx) &&
-                    efx->phy_type == PHY_TYPE_SFX7101))
-               tenxpress_crc_err(efx);
 }
 
 /* Handle receive events that are not in-order. */
@@ -1887,7 +1883,7 @@ static int falcon_reset_macs(struct efx_nic *efx)
 
        /* MAC stats will fail whilst the TX fifo is draining. Serialise
         * the drain sequence with the statistics fetch */
-       spin_lock(&efx->stats_lock);
+       efx_stats_disable(efx);
 
        falcon_read(efx, &reg, MAC0_CTRL_REG_KER);
        EFX_SET_OWORD_FIELD(reg, TXFIFO_DRAIN_EN_B0, 1);
@@ -1917,7 +1913,7 @@ static int falcon_reset_macs(struct efx_nic *efx)
                udelay(10);
        }
 
-       spin_unlock(&efx->stats_lock);
+       efx_stats_enable(efx);
 
        /* If we've reset the EM block and the link is up, then
         * we'll have to kick the XAUI link so the PHY can recover */
@@ -2277,6 +2273,10 @@ int falcon_switch_mac(struct efx_nic *efx)
        struct efx_mac_operations *old_mac_op = efx->mac_op;
        efx_oword_t nic_stat;
        unsigned strap_val;
+       int rc = 0;
+
+       /* Don't try to fetch MAC stats while we're switching MACs */
+       efx_stats_disable(efx);
 
        /* Internal loopbacks override the phy speed setting */
        if (efx->loopback_mode == LOOPBACK_GMAC) {
@@ -2287,16 +2287,12 @@ int falcon_switch_mac(struct efx_nic *efx)
                efx->link_fd = true;
        }
 
+       WARN_ON(!mutex_is_locked(&efx->mac_lock));
        efx->mac_op = (EFX_IS10G(efx) ?
                       &falcon_xmac_operations : &falcon_gmac_operations);
-       if (old_mac_op == efx->mac_op)
-               return 0;
-
-       WARN_ON(!mutex_is_locked(&efx->mac_lock));
-
-       /* Not all macs support a mac-level link state */
-       efx->mac_up = true;
 
+       /* Always push the NIC_STAT_REG setting even if the mac hasn't
+        * changed, because this function is run post online reset */
        falcon_read(efx, &nic_stat, NIC_STAT_REG);
        strap_val = EFX_IS10G(efx) ? 5 : 3;
        if (falcon_rev(efx) >= FALCON_REV_B0) {
@@ -2309,9 +2305,17 @@ int falcon_switch_mac(struct efx_nic *efx)
                BUG_ON(EFX_OWORD_FIELD(nic_stat, STRAP_PINS) != strap_val);
        }
 
+       if (old_mac_op == efx->mac_op)
+               goto out;
 
        EFX_LOG(efx, "selected %cMAC\n", EFX_IS10G(efx) ? 'X' : 'G');
-       return falcon_reset_macs(efx);
+       /* Not all macs support a mac-level link state */
+       efx->mac_up = true;
+
+       rc = falcon_reset_macs(efx);
+out:
+       efx_stats_enable(efx);
+       return rc;
 }
 
 /* This call is responsible for hooking in the MAC and PHY operations */
index f6a16428113dd3d61b0376a9ccd84df84c0262e4..f9e2f95c3b48c9a8a175d422b68bbaf03bb6c6b1 100644 (file)
@@ -15,6 +15,7 @@
 #include "net_driver.h"
 #include "mdio_10g.h"
 #include "boards.h"
+#include "workarounds.h"
 
 int mdio_clause45_reset_mmd(struct efx_nic *port, int mmd,
                            int spins, int spintime)
@@ -179,17 +180,12 @@ bool mdio_clause45_links_ok(struct efx_nic *efx, unsigned int mmd_mask)
                return false;
        else if (efx_phy_mode_disabled(efx->phy_mode))
                return false;
-       else if (efx->loopback_mode == LOOPBACK_PHYXS) {
+       else if (efx->loopback_mode == LOOPBACK_PHYXS)
                mmd_mask &= ~(MDIO_MMDREG_DEVS_PHYXS |
                              MDIO_MMDREG_DEVS_PCS |
                              MDIO_MMDREG_DEVS_PMAPMD |
                              MDIO_MMDREG_DEVS_AN);
-               if (!mmd_mask) {
-                       reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PHYXS,
-                                                MDIO_PHYXS_STATUS2);
-                       return !(reg & (1 << MDIO_PHYXS_STATUS2_RX_FAULT_LBN));
-               }
-       } else if (efx->loopback_mode == LOOPBACK_PCS)
+       else if (efx->loopback_mode == LOOPBACK_PCS)
                mmd_mask &= ~(MDIO_MMDREG_DEVS_PCS |
                              MDIO_MMDREG_DEVS_PMAPMD |
                              MDIO_MMDREG_DEVS_AN);
@@ -197,6 +193,13 @@ bool mdio_clause45_links_ok(struct efx_nic *efx, unsigned int mmd_mask)
                mmd_mask &= ~(MDIO_MMDREG_DEVS_PMAPMD |
                              MDIO_MMDREG_DEVS_AN);
 
+       if (!mmd_mask) {
+               /* Use presence of XGMII faults in leui of link state */
+               reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PHYXS,
+                                        MDIO_PHYXS_STATUS2);
+               return !(reg & (1 << MDIO_PHYXS_STATUS2_RX_FAULT_LBN));
+       }
+
        while (mmd_mask) {
                if (mmd_mask & 1) {
                        /* Double reads because link state is latched, and a
@@ -263,7 +266,7 @@ void mdio_clause45_set_mmds_lpower(struct efx_nic *efx,
        }
 }
 
-static u32 mdio_clause45_get_an(struct efx_nic *efx, u16 addr, u32 xnp)
+static u32 mdio_clause45_get_an(struct efx_nic *efx, u16 addr)
 {
        int phy_id = efx->mii.phy_id;
        u32 result = 0;
@@ -278,9 +281,6 @@ static u32 mdio_clause45_get_an(struct efx_nic *efx, u16 addr, u32 xnp)
                result |= ADVERTISED_100baseT_Half;
        if (reg & ADVERTISE_100FULL)
                result |= ADVERTISED_100baseT_Full;
-       if (reg & LPA_RESV)
-               result |= xnp;
-
        return result;
 }
 
@@ -310,7 +310,7 @@ void mdio_clause45_get_settings(struct efx_nic *efx,
  */
 void mdio_clause45_get_settings_ext(struct efx_nic *efx,
                                    struct ethtool_cmd *ecmd,
-                                   u32 xnp, u32 xnp_lpa)
+                                   u32 npage_adv, u32 npage_lpa)
 {
        int phy_id = efx->mii.phy_id;
        int reg;
@@ -361,8 +361,8 @@ void mdio_clause45_get_settings_ext(struct efx_nic *efx,
                        ecmd->autoneg = AUTONEG_ENABLE;
                        ecmd->advertising |=
                                ADVERTISED_Autoneg |
-                               mdio_clause45_get_an(efx,
-                                                    MDIO_AN_ADVERTISE, xnp);
+                               mdio_clause45_get_an(efx, MDIO_AN_ADVERTISE) |
+                               npage_adv;
                } else
                        ecmd->autoneg = AUTONEG_DISABLE;
        } else
@@ -371,27 +371,30 @@ void mdio_clause45_get_settings_ext(struct efx_nic *efx,
        if (ecmd->autoneg) {
                /* If AN is complete, report best common mode,
                 * otherwise report best advertised mode. */
-               u32 common = ecmd->advertising;
+               u32 modes = 0;
                if (mdio_clause45_read(efx, phy_id, MDIO_MMD_AN,
                                       MDIO_MMDREG_STAT1) &
-                   (1 << MDIO_AN_STATUS_AN_DONE_LBN)) {
-                       common &= mdio_clause45_get_an(efx, MDIO_AN_LPA,
-                                                      xnp_lpa);
-               }
-               if (common & ADVERTISED_10000baseT_Full) {
+                   (1 << MDIO_AN_STATUS_AN_DONE_LBN))
+                       modes = (ecmd->advertising &
+                                (mdio_clause45_get_an(efx, MDIO_AN_LPA) |
+                                 npage_lpa));
+               if (modes == 0)
+                       modes = ecmd->advertising;
+
+               if (modes & ADVERTISED_10000baseT_Full) {
                        ecmd->speed = SPEED_10000;
                        ecmd->duplex = DUPLEX_FULL;
-               } else if (common & (ADVERTISED_1000baseT_Full |
-                                    ADVERTISED_1000baseT_Half)) {
+               } else if (modes & (ADVERTISED_1000baseT_Full |
+                                   ADVERTISED_1000baseT_Half)) {
                        ecmd->speed = SPEED_1000;
-                       ecmd->duplex = !!(common & ADVERTISED_1000baseT_Full);
-               } else if (common & (ADVERTISED_100baseT_Full |
-                                    ADVERTISED_100baseT_Half)) {
+                       ecmd->duplex = !!(modes & ADVERTISED_1000baseT_Full);
+               } else if (modes & (ADVERTISED_100baseT_Full |
+                                   ADVERTISED_100baseT_Half)) {
                        ecmd->speed = SPEED_100;
-                       ecmd->duplex = !!(common & ADVERTISED_100baseT_Full);
+                       ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full);
                } else {
                        ecmd->speed = SPEED_10;
-                       ecmd->duplex = !!(common & ADVERTISED_10baseT_Full);
+                       ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full);
                }
        } else {
                /* Report forced settings */
@@ -415,7 +418,7 @@ int mdio_clause45_set_settings(struct efx_nic *efx,
        int phy_id = efx->mii.phy_id;
        struct ethtool_cmd prev;
        u32 required;
-       int ctrl1_bits, reg;
+       int reg;
 
        efx->phy_op->get_settings(efx, &prev);
 
@@ -430,99 +433,83 @@ int mdio_clause45_set_settings(struct efx_nic *efx,
        if (prev.port != PORT_TP || ecmd->port != PORT_TP)
                return -EINVAL;
 
-       /* Check that PHY supports these settings and work out the
-        * basic control bits */
-       if (ecmd->duplex) {
+       /* Check that PHY supports these settings */
+       if (ecmd->autoneg) {
+               required = SUPPORTED_Autoneg;
+       } else if (ecmd->duplex) {
                switch (ecmd->speed) {
-               case SPEED_10:
-                       ctrl1_bits = BMCR_FULLDPLX;
-                       required = SUPPORTED_10baseT_Full;
-                       break;
-               case SPEED_100:
-                       ctrl1_bits = BMCR_SPEED100 | BMCR_FULLDPLX;
-                       required = SUPPORTED_100baseT_Full;
-                       break;
-               case SPEED_1000:
-                       ctrl1_bits = BMCR_SPEED1000 | BMCR_FULLDPLX;
-                       required = SUPPORTED_1000baseT_Full;
-                       break;
-               case SPEED_10000:
-                       ctrl1_bits = (BMCR_SPEED1000 | BMCR_SPEED100 |
-                                     BMCR_FULLDPLX);
-                       required = SUPPORTED_10000baseT_Full;
-                       break;
-               default:
-                       return -EINVAL;
+               case SPEED_10:  required = SUPPORTED_10baseT_Full;  break;
+               case SPEED_100: required = SUPPORTED_100baseT_Full; break;
+               default:        return -EINVAL;
                }
        } else {
                switch (ecmd->speed) {
-               case SPEED_10:
-                       ctrl1_bits = 0;
-                       required = SUPPORTED_10baseT_Half;
-                       break;
-               case SPEED_100:
-                       ctrl1_bits = BMCR_SPEED100;
-                       required = SUPPORTED_100baseT_Half;
-                       break;
-               case SPEED_1000:
-                       ctrl1_bits = BMCR_SPEED1000;
-                       required = SUPPORTED_1000baseT_Half;
-                       break;
-               default:
-                       return -EINVAL;
+               case SPEED_10:  required = SUPPORTED_10baseT_Half;  break;
+               case SPEED_100: required = SUPPORTED_100baseT_Half; break;
+               default:        return -EINVAL;
                }
        }
-       if (ecmd->autoneg)
-               required |= SUPPORTED_Autoneg;
        required |= ecmd->advertising;
        if (required & ~prev.supported)
                return -EINVAL;
 
-       /* Set the basic control bits */
-       reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD,
-                                MDIO_MMDREG_CTRL1);
-       reg &= ~(BMCR_SPEED1000 | BMCR_SPEED100 | BMCR_FULLDPLX | 0x003c);
-       reg |= ctrl1_bits;
-       mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD, MDIO_MMDREG_CTRL1,
-                           reg);
-
-       /* Set the AN registers */
-       if (ecmd->autoneg != prev.autoneg ||
-           ecmd->advertising != prev.advertising) {
-               bool xnp = false;
-
-               if (efx->phy_op->set_xnp_advertise)
-                       xnp = efx->phy_op->set_xnp_advertise(efx,
-                                                            ecmd->advertising);
-
-               if (ecmd->autoneg) {
-                       reg = 0;
-                       if (ecmd->advertising & ADVERTISED_10baseT_Half)
-                               reg |= ADVERTISE_10HALF;
-                       if (ecmd->advertising & ADVERTISED_10baseT_Full)
-                               reg |= ADVERTISE_10FULL;
-                       if (ecmd->advertising & ADVERTISED_100baseT_Half)
-                               reg |= ADVERTISE_100HALF;
-                       if (ecmd->advertising & ADVERTISED_100baseT_Full)
-                               reg |= ADVERTISE_100FULL;
-                       if (xnp)
-                               reg |= ADVERTISE_RESV;
-                       mdio_clause45_write(efx, phy_id, MDIO_MMD_AN,
-                                           MDIO_AN_ADVERTISE, reg);
-               }
+       if (ecmd->autoneg) {
+               bool xnp = (ecmd->advertising & ADVERTISED_10000baseT_Full
+                           || EFX_WORKAROUND_13204(efx));
+
+               /* Set up the base page */
+               reg = ADVERTISE_CSMA;
+               if (ecmd->advertising & ADVERTISED_10baseT_Half)
+                       reg |= ADVERTISE_10HALF;
+               if (ecmd->advertising & ADVERTISED_10baseT_Full)
+                       reg |= ADVERTISE_10FULL;
+               if (ecmd->advertising & ADVERTISED_100baseT_Half)
+                       reg |= ADVERTISE_100HALF;
+               if (ecmd->advertising & ADVERTISED_100baseT_Full)
+                       reg |= ADVERTISE_100FULL;
+               if (xnp)
+                       reg |= ADVERTISE_RESV;
+               else if (ecmd->advertising & (ADVERTISED_1000baseT_Half |
+                                             ADVERTISED_1000baseT_Full))
+                       reg |= ADVERTISE_NPAGE;
+               reg |= efx_fc_advertise(efx->wanted_fc);
+               mdio_clause45_write(efx, phy_id, MDIO_MMD_AN,
+                                   MDIO_AN_ADVERTISE, reg);
+
+               /* Set up the (extended) next page if necessary */
+               if (efx->phy_op->set_npage_adv)
+                       efx->phy_op->set_npage_adv(efx, ecmd->advertising);
 
+               /* Enable and restart AN */
                reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN,
                                         MDIO_MMDREG_CTRL1);
-               if (ecmd->autoneg)
-                       reg |= BMCR_ANENABLE | BMCR_ANRESTART;
-               else
-                       reg &= ~BMCR_ANENABLE;
+               reg |= BMCR_ANENABLE;
+               if (!(EFX_WORKAROUND_15195(efx) &&
+                     LOOPBACK_MASK(efx) & efx->phy_op->loopbacks))
+                       reg |= BMCR_ANRESTART;
                if (xnp)
                        reg |= 1 << MDIO_AN_CTRL_XNP_LBN;
                else
                        reg &= ~(1 << MDIO_AN_CTRL_XNP_LBN);
                mdio_clause45_write(efx, phy_id, MDIO_MMD_AN,
                                    MDIO_MMDREG_CTRL1, reg);
+       } else {
+               /* Disable AN */
+               mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_AN,
+                                      MDIO_MMDREG_CTRL1,
+                                      __ffs(BMCR_ANENABLE), false);
+
+               /* Set the basic control bits */
+               reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD,
+                                        MDIO_MMDREG_CTRL1);
+               reg &= ~(BMCR_SPEED1000 | BMCR_SPEED100 | BMCR_FULLDPLX |
+                        0x003c);
+               if (ecmd->speed == SPEED_100)
+                       reg |= BMCR_SPEED100;
+               if (ecmd->duplex)
+                       reg |= BMCR_FULLDPLX;
+               mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD,
+                                   MDIO_MMDREG_CTRL1, reg);
        }
 
        return 0;
index 09bf801d0569a2199c79d89007bc7518e0163cdc..8ba49773ce7e19a9f4b14ca319510b0eb0aff133 100644 (file)
 #define MDIO_AN_XNP                    22
 #define MDIO_AN_LPA_XNP                        25
 
-#define MDIO_AN_10GBT_ADVERTISE                32
+#define MDIO_AN_10GBT_CTRL             32
+#define MDIO_AN_10GBT_CTRL_ADV_10G_LBN 12
 #define MDIO_AN_10GBT_STATUS           (33)
 #define MDIO_AN_10GBT_STATUS_MS_FLT_LBN (15) /* MASTER/SLAVE config fault */
 #define MDIO_AN_10GBT_STATUS_MS_LBN     (14) /* MASTER/SLAVE config */
index 5f255f75754e526f6df041d8665908c59fba6e53..e019ad1fb9a0c7db773c0e7f1446078d3eaee2b0 100644 (file)
@@ -566,7 +566,7 @@ struct efx_mac_operations {
  * @poll: Poll for hardware state. Serialised by the mac_lock.
  * @get_settings: Get ethtool settings. Serialised by the mac_lock.
  * @set_settings: Set ethtool settings. Serialised by the mac_lock.
- * @set_xnp_advertise: Set abilities advertised in Extended Next Page
+ * @set_npage_adv: Set abilities advertised in (Extended) Next Page
  *     (only needed where AN bit is set in mmds)
  * @num_tests: Number of PHY-specific tests/results
  * @test_names: Names of the tests/results
@@ -586,7 +586,7 @@ struct efx_phy_operations {
                              struct ethtool_cmd *ecmd);
        int (*set_settings) (struct efx_nic *efx,
                             struct ethtool_cmd *ecmd);
-       bool (*set_xnp_advertise) (struct efx_nic *efx, u32);
+       void (*set_npage_adv) (struct efx_nic *efx, u32);
        u32 num_tests;
        const char *const *test_names;
        int (*run_tests) (struct efx_nic *efx, int *results, unsigned flags);
@@ -754,8 +754,7 @@ union efx_multicast_hash {
  *     &struct net_device_stats.
  * @stats_buffer: DMA buffer for statistics
  * @stats_lock: Statistics update lock. Serialises statistics fetches
- * @stats_enabled: Temporarily disable statistics fetches.
- *     Serialised by @stats_lock
+ * @stats_disable_count: Nest count for disabling statistics fetches
  * @mac_op: MAC interface
  * @mac_address: Permanent MAC address
  * @phy_type: PHY type
@@ -837,7 +836,7 @@ struct efx_nic {
        struct efx_mac_stats mac_stats;
        struct efx_buffer stats_buffer;
        spinlock_t stats_lock;
-       bool stats_enabled;
+       unsigned int stats_disable_count;
 
        struct efx_mac_operations *mac_op;
        unsigned char mac_address[ETH_ALEN];
index 58c493ef81bb09f5aa5d5120c4bf417a28ab8246..07e855c148bc3ce6c0eb409ff1cc87ad5e8faf84 100644 (file)
@@ -17,7 +17,6 @@ extern struct efx_phy_operations falcon_sfx7101_phy_ops;
 extern struct efx_phy_operations falcon_sft9001_phy_ops;
 
 extern void tenxpress_phy_blink(struct efx_nic *efx, bool blink);
-extern void tenxpress_crc_err(struct efx_nic *efx);
 
 /****************************************************************************
  * Exported functions from the driver for XFP optical PHYs
index dba0d64d50cd07aeffe70c7b6af614d755d43989..0a598084c5133a64cdb4dd4bb342b2fedc976b66 100644 (file)
@@ -665,6 +665,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
 {
        enum efx_loopback_mode loopback_mode = efx->loopback_mode;
        int phy_mode = efx->phy_mode;
+       enum reset_type reset_method = RESET_TYPE_INVISIBLE;
        struct ethtool_cmd ecmd;
        struct efx_channel *channel;
        int rc_test = 0, rc_reset = 0, rc;
@@ -718,21 +719,21 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
        mutex_unlock(&efx->mac_lock);
 
        /* free up all consumers of SRAM (including all the queues) */
-       efx_reset_down(efx, &ecmd);
+       efx_reset_down(efx, reset_method, &ecmd);
 
        rc = efx_test_chip(efx, tests);
        if (rc && !rc_test)
                rc_test = rc;
 
        /* reset the chip to recover from the register test */
-       rc_reset = falcon_reset_hw(efx, RESET_TYPE_ALL);
+       rc_reset = falcon_reset_hw(efx, reset_method);
 
        /* Ensure that the phy is powered and out of loopback
         * for the bist and loopback tests */
        efx->phy_mode &= ~PHY_MODE_LOW_POWER;
        efx->loopback_mode = LOOPBACK_NONE;
 
-       rc = efx_reset_up(efx, &ecmd, rc_reset == 0);
+       rc = efx_reset_up(efx, reset_method, &ecmd, rc_reset == 0);
        if (rc && !rc_reset)
                rc_reset = rc;
 
index 16b80acb999204f9ce81f110e3fac11e39b2e4c6..cb25ae5b257ae96a0d4da7b90aeea521a4d74299 100644 (file)
@@ -186,19 +186,22 @@ static int sfn4111t_reset(struct efx_nic *efx)
 {
        efx_oword_t reg;
 
-       /* GPIO pins are also used for I2C, so block that temporarily */
+       /* GPIO 3 and the GPIO register are shared with I2C, so block that */
        mutex_lock(&efx->i2c_adap.bus_lock);
 
+       /* Pull RST_N (GPIO 2) low then let it up again, setting the
+        * FLASH_CFG_1 strap (GPIO 3) appropriately.  Only change the
+        * output enables; the output levels should always be 0 (low)
+        * and we rely on external pull-ups. */
        falcon_read(efx, &reg, GPIO_CTL_REG_KER);
        EFX_SET_OWORD_FIELD(reg, GPIO2_OEN, true);
-       EFX_SET_OWORD_FIELD(reg, GPIO2_OUT, false);
        falcon_write(efx, &reg, GPIO_CTL_REG_KER);
        msleep(1000);
-       EFX_SET_OWORD_FIELD(reg, GPIO2_OUT, true);
-       EFX_SET_OWORD_FIELD(reg, GPIO3_OEN, true);
-       EFX_SET_OWORD_FIELD(reg, GPIO3_OUT,
-                           !(efx->phy_mode & PHY_MODE_SPECIAL));
+       EFX_SET_OWORD_FIELD(reg, GPIO2_OEN, false);
+       EFX_SET_OWORD_FIELD(reg, GPIO3_OEN,
+                           !!(efx->phy_mode & PHY_MODE_SPECIAL));
        falcon_write(efx, &reg, GPIO_CTL_REG_KER);
+       msleep(1);
 
        mutex_unlock(&efx->i2c_adap.bus_lock);
 
@@ -232,12 +235,18 @@ static ssize_t set_phy_flash_cfg(struct device *dev,
        } else if (efx->state != STATE_RUNNING || netif_running(efx->net_dev)) {
                err = -EBUSY;
        } else {
+               /* Reset the PHY, reconfigure the MAC and enable/disable
+                * MAC stats accordingly. */
                efx->phy_mode = new_mode;
+               if (new_mode & PHY_MODE_SPECIAL)
+                       efx_stats_disable(efx);
                if (efx->board_info.type == EFX_BOARD_SFE4001)
                        err = sfe4001_poweron(efx);
                else
                        err = sfn4111t_reset(efx);
                efx_reconfigure_port(efx);
+               if (!(new_mode & PHY_MODE_SPECIAL))
+                       efx_stats_enable(efx);
        }
        rtnl_unlock();
 
@@ -326,6 +335,11 @@ int sfe4001_init(struct efx_nic *efx)
        efx->board_info.monitor = sfe4001_check_hw;
        efx->board_info.fini = sfe4001_fini;
 
+       if (efx->phy_mode & PHY_MODE_SPECIAL) {
+               /* PHY won't generate a 156.25 MHz clock and MAC stats fetch
+                * will fail. */
+               efx_stats_disable(efx);
+       }
        rc = sfe4001_poweron(efx);
        if (rc)
                goto fail_ioexp;
@@ -372,17 +386,25 @@ static void sfn4111t_fini(struct efx_nic *efx)
        i2c_unregister_device(efx->board_info.hwmon_client);
 }
 
-static struct i2c_board_info sfn4111t_hwmon_info = {
+static struct i2c_board_info sfn4111t_a0_hwmon_info = {
        I2C_BOARD_INFO("max6647", 0x4e),
        .irq            = -1,
 };
 
+static struct i2c_board_info sfn4111t_r5_hwmon_info = {
+       I2C_BOARD_INFO("max6646", 0x4d),
+       .irq            = -1,
+};
+
 int sfn4111t_init(struct efx_nic *efx)
 {
        int rc;
 
        efx->board_info.hwmon_client =
-               i2c_new_device(&efx->i2c_adap, &sfn4111t_hwmon_info);
+               i2c_new_device(&efx->i2c_adap,
+                              (efx->board_info.minor < 5) ?
+                              &sfn4111t_a0_hwmon_info :
+                              &sfn4111t_r5_hwmon_info);
        if (!efx->board_info.hwmon_client)
                return -EIO;
 
@@ -394,8 +416,10 @@ int sfn4111t_init(struct efx_nic *efx)
        if (rc)
                goto fail_hwmon;
 
-       if (efx->phy_mode & PHY_MODE_SPECIAL)
+       if (efx->phy_mode & PHY_MODE_SPECIAL) {
+               efx_stats_disable(efx);
                sfn4111t_reset(efx);
+       }
 
        return 0;
 
index 9ecb77da954527a9dff367f4aa0b4674e7f94d17..f0efd246962cf01e2a9639b6fdb4421e8a3e1438 100644 (file)
@@ -67,6 +67,8 @@
 #define PMA_PMD_EXT_CLK312_WIDTH 1
 #define PMA_PMD_EXT_LPOWER_LBN  12
 #define PMA_PMD_EXT_LPOWER_WIDTH 1
+#define PMA_PMD_EXT_ROBUST_LBN 14
+#define PMA_PMD_EXT_ROBUST_WIDTH 1
 #define PMA_PMD_EXT_SSR_LBN    15
 #define PMA_PMD_EXT_SSR_WIDTH  1
 
 #define C22EXT_STATUS_LINK_LBN  2
 #define C22EXT_STATUS_LINK_WIDTH 1
 
-#define C22EXT_MSTSLV_REG       49162
-#define C22EXT_MSTSLV_1000_HD_LBN 10
-#define C22EXT_MSTSLV_1000_HD_WIDTH 1
-#define C22EXT_MSTSLV_1000_FD_LBN 11
-#define C22EXT_MSTSLV_1000_FD_WIDTH 1
+#define C22EXT_MSTSLV_CTRL                     49161
+#define C22EXT_MSTSLV_CTRL_ADV_1000_HD_LBN     8
+#define C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN     9
+
+#define C22EXT_MSTSLV_STATUS                   49162
+#define C22EXT_MSTSLV_STATUS_LP_1000_HD_LBN    10
+#define C22EXT_MSTSLV_STATUS_LP_1000_FD_LBN    11
 
 /* Time to wait between powering down the LNPGA and turning off the power
  * rails */
 #define LNPGA_PDOWN_WAIT       (HZ / 5)
 
-static int crc_error_reset_threshold = 100;
-module_param(crc_error_reset_threshold, int, 0644);
-MODULE_PARM_DESC(crc_error_reset_threshold,
-                "Max number of CRC errors before XAUI reset");
-
 struct tenxpress_phy_data {
        enum efx_loopback_mode loopback_mode;
-       atomic_t bad_crc_count;
        enum efx_phy_mode phy_mode;
        int bad_lp_tries;
 };
 
-void tenxpress_crc_err(struct efx_nic *efx)
-{
-       struct tenxpress_phy_data *phy_data = efx->phy_data;
-       if (phy_data != NULL)
-               atomic_inc(&phy_data->bad_crc_count);
-}
-
 static ssize_t show_phy_short_reach(struct device *dev,
                                    struct device_attribute *attr, char *buf)
 {
@@ -284,7 +275,9 @@ static int tenxpress_init(struct efx_nic *efx)
                                         PMA_PMD_XCONTROL_REG);
                reg |= ((1 << PMA_PMD_EXT_GMII_EN_LBN) |
                        (1 << PMA_PMD_EXT_CLK_OUT_LBN) |
-                       (1 << PMA_PMD_EXT_CLK312_LBN));
+                       (1 << PMA_PMD_EXT_CLK312_LBN) |
+                       (1 << PMA_PMD_EXT_ROBUST_LBN));
+
                mdio_clause45_write(efx, phy_id, MDIO_MMD_PMAPMD,
                                    PMA_PMD_XCONTROL_REG, reg);
                mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT,
@@ -346,6 +339,7 @@ static int tenxpress_phy_init(struct efx_nic *efx)
        rc = tenxpress_init(efx);
        if (rc < 0)
                goto fail;
+       mdio_clause45_set_pause(efx);
 
        if (efx->phy_type == PHY_TYPE_SFT9001B) {
                rc = device_create_file(&efx->pci_dev->dev,
@@ -376,8 +370,8 @@ static int tenxpress_special_reset(struct efx_nic *efx)
 
        /* The XGMAC clock is driven from the SFC7101/SFT9001 312MHz clock, so
         * a special software reset can glitch the XGMAC sufficiently for stats
-        * requests to fail. Since we don't often special_reset, just lock. */
-       spin_lock(&efx->stats_lock);
+        * requests to fail. */
+       efx_stats_disable(efx);
 
        /* Initiate reset */
        reg = mdio_clause45_read(efx, efx->mii.phy_id,
@@ -392,17 +386,17 @@ static int tenxpress_special_reset(struct efx_nic *efx)
        rc = mdio_clause45_wait_reset_mmds(efx,
                                           TENXPRESS_REQUIRED_DEVS);
        if (rc < 0)
-               goto unlock;
+               goto out;
 
        /* Try and reconfigure the device */
        rc = tenxpress_init(efx);
        if (rc < 0)
-               goto unlock;
+               goto out;
 
        /* Wait for the XGXS state machine to churn */
        mdelay(10);
-unlock:
-       spin_unlock(&efx->stats_lock);
+out:
+       efx_stats_enable(efx);
        return rc;
 }
 
@@ -520,7 +514,7 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx)
 {
        struct tenxpress_phy_data *phy_data = efx->phy_data;
        struct ethtool_cmd ecmd;
-       bool phy_mode_change, loop_reset, loop_toggle, loopback;
+       bool phy_mode_change, loop_reset;
 
        if (efx->phy_mode & (PHY_MODE_OFF | PHY_MODE_SPECIAL)) {
                phy_data->phy_mode = efx->phy_mode;
@@ -531,12 +525,10 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx)
 
        phy_mode_change = (efx->phy_mode == PHY_MODE_NORMAL &&
                           phy_data->phy_mode != PHY_MODE_NORMAL);
-       loopback = LOOPBACK_MASK(efx) & efx->phy_op->loopbacks;
-       loop_toggle = LOOPBACK_CHANGED(phy_data, efx, efx->phy_op->loopbacks);
        loop_reset = (LOOPBACK_OUT_OF(phy_data, efx, efx->phy_op->loopbacks) ||
                      LOOPBACK_CHANGED(phy_data, efx, 1 << LOOPBACK_GPHY));
 
-       if (loop_reset || loop_toggle || loopback || phy_mode_change) {
+       if (loop_reset || phy_mode_change) {
                int rc;
 
                efx->phy_op->get_settings(efx, &ecmd);
@@ -551,20 +543,6 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx)
                                falcon_reset_xaui(efx);
                }
 
-               if (efx->phy_type != PHY_TYPE_SFX7101) {
-                       /* Only change autoneg once, on coming out or
-                        * going into loopback */
-                       if (loop_toggle)
-                               ecmd.autoneg = !loopback;
-                       if (loopback) {
-                               ecmd.duplex = DUPLEX_FULL;
-                               if (efx->loopback_mode == LOOPBACK_GPHY)
-                                       ecmd.speed = SPEED_1000;
-                               else
-                                       ecmd.speed = SPEED_10000;
-                       }
-               }
-
                rc = efx->phy_op->set_settings(efx, &ecmd);
                WARN_ON(rc);
        }
@@ -623,13 +601,6 @@ static void tenxpress_phy_poll(struct efx_nic *efx)
 
        if (phy_data->phy_mode != PHY_MODE_NORMAL)
                return;
-
-       if (EFX_WORKAROUND_10750(efx) &&
-           atomic_read(&phy_data->bad_crc_count) > crc_error_reset_threshold) {
-               EFX_ERR(efx, "Resetting XAUI due to too many CRC errors\n");
-               falcon_reset_xaui(efx);
-               atomic_set(&phy_data->bad_crc_count, 0);
-       }
 }
 
 static void tenxpress_phy_fini(struct efx_nic *efx)
@@ -772,107 +743,76 @@ reset:
        return rc;
 }
 
-static u32 tenxpress_get_xnp_lpa(struct efx_nic *efx)
+static void
+tenxpress_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
 {
-       int phy = efx->mii.phy_id;
-       u32 lpa = 0;
+       int phy_id = efx->mii.phy_id;
+       u32 adv = 0, lpa = 0;
        int reg;
 
        if (efx->phy_type != PHY_TYPE_SFX7101) {
-               reg = mdio_clause45_read(efx, phy, MDIO_MMD_C22EXT,
-                                        C22EXT_MSTSLV_REG);
-               if (reg & (1 << C22EXT_MSTSLV_1000_HD_LBN))
+               reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_C22EXT,
+                                        C22EXT_MSTSLV_CTRL);
+               if (reg & (1 << C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN))
+                       adv |= ADVERTISED_1000baseT_Full;
+               reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_C22EXT,
+                                        C22EXT_MSTSLV_STATUS);
+               if (reg & (1 << C22EXT_MSTSLV_STATUS_LP_1000_HD_LBN))
                        lpa |= ADVERTISED_1000baseT_Half;
-               if (reg & (1 << C22EXT_MSTSLV_1000_FD_LBN))
+               if (reg & (1 << C22EXT_MSTSLV_STATUS_LP_1000_FD_LBN))
                        lpa |= ADVERTISED_1000baseT_Full;
        }
-       reg = mdio_clause45_read(efx, phy, MDIO_MMD_AN, MDIO_AN_10GBT_STATUS);
+       reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN,
+                                MDIO_AN_10GBT_CTRL);
+       if (reg & (1 << MDIO_AN_10GBT_CTRL_ADV_10G_LBN))
+               adv |= ADVERTISED_10000baseT_Full;
+       reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN,
+                                MDIO_AN_10GBT_STATUS);
        if (reg & (1 << MDIO_AN_10GBT_STATUS_LP_10G_LBN))
                lpa |= ADVERTISED_10000baseT_Full;
-       return lpa;
-}
 
-static void sfx7101_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
-{
-       mdio_clause45_get_settings_ext(efx, ecmd, ADVERTISED_10000baseT_Full,
-                                      tenxpress_get_xnp_lpa(efx));
-       ecmd->supported |= SUPPORTED_10000baseT_Full;
-       ecmd->advertising |= ADVERTISED_10000baseT_Full;
+       mdio_clause45_get_settings_ext(efx, ecmd, adv, lpa);
+
+       if (efx->phy_type != PHY_TYPE_SFX7101)
+               ecmd->supported |= (SUPPORTED_100baseT_Full |
+                                   SUPPORTED_1000baseT_Full);
+
+       /* In loopback, the PHY automatically brings up the correct interface,
+        * but doesn't advertise the correct speed. So override it */
+       if (efx->loopback_mode == LOOPBACK_GPHY)
+               ecmd->speed = SPEED_1000;
+       else if (LOOPBACK_MASK(efx) & efx->phy_op->loopbacks)
+               ecmd->speed = SPEED_10000;
 }
 
-static void sft9001_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
+static int tenxpress_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
 {
-       int phy_id = efx->mii.phy_id;
-       u32 xnp_adv = 0;
-       int reg;
-
-       reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD,
-                                PMA_PMD_SPEED_ENABLE_REG);
-       if (EFX_WORKAROUND_13204(efx) && (reg & (1 << PMA_PMD_100TX_ADV_LBN)))
-               xnp_adv |= ADVERTISED_100baseT_Full;
-       if (reg & (1 << PMA_PMD_1000T_ADV_LBN))
-               xnp_adv |= ADVERTISED_1000baseT_Full;
-       if (reg & (1 << PMA_PMD_10000T_ADV_LBN))
-               xnp_adv |= ADVERTISED_10000baseT_Full;
-
-       mdio_clause45_get_settings_ext(efx, ecmd, xnp_adv,
-                                      tenxpress_get_xnp_lpa(efx));
-
-       ecmd->supported |= (SUPPORTED_100baseT_Half |
-                           SUPPORTED_100baseT_Full |
-                           SUPPORTED_1000baseT_Full);
+       if (!ecmd->autoneg)
+               return -EINVAL;
 
-       /* Use the vendor defined C22ext register for duplex settings */
-       if (ecmd->speed != SPEED_10000 && !ecmd->autoneg) {
-               reg = mdio_clause45_read(efx, phy_id, MDIO_MMD_C22EXT,
-                                        GPHY_XCONTROL_REG);
-               ecmd->duplex = (reg & (1 << GPHY_DUPLEX_LBN) ?
-                               DUPLEX_FULL : DUPLEX_HALF);
-       }
+       return mdio_clause45_set_settings(efx, ecmd);
 }
 
-static int sft9001_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
+static void sfx7101_set_npage_adv(struct efx_nic *efx, u32 advertising)
 {
-       int phy_id = efx->mii.phy_id;
-       int rc;
-
-       rc = mdio_clause45_set_settings(efx, ecmd);
-       if (rc)
-               return rc;
-
-       if (ecmd->speed != SPEED_10000 && !ecmd->autoneg)
-               mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT,
-                                      GPHY_XCONTROL_REG, GPHY_DUPLEX_LBN,
-                                      ecmd->duplex == DUPLEX_FULL);
-
-       return rc;
+       mdio_clause45_set_flag(efx, efx->mii.phy_id, MDIO_MMD_AN,
+                              MDIO_AN_10GBT_CTRL,
+                              MDIO_AN_10GBT_CTRL_ADV_10G_LBN,
+                              advertising & ADVERTISED_10000baseT_Full);
 }
 
-static bool sft9001_set_xnp_advertise(struct efx_nic *efx, u32 advertising)
+static void sft9001_set_npage_adv(struct efx_nic *efx, u32 advertising)
 {
-       int phy = efx->mii.phy_id;
-       int reg = mdio_clause45_read(efx, phy, MDIO_MMD_PMAPMD,
-                                    PMA_PMD_SPEED_ENABLE_REG);
-       bool enabled;
-
-       reg &= ~((1 << 2) | (1 << 3));
-       if (EFX_WORKAROUND_13204(efx) &&
-           (advertising & ADVERTISED_100baseT_Full))
-               reg |= 1 << PMA_PMD_100TX_ADV_LBN;
-       if (advertising & ADVERTISED_1000baseT_Full)
-               reg |= 1 << PMA_PMD_1000T_ADV_LBN;
-       if (advertising & ADVERTISED_10000baseT_Full)
-               reg |= 1 << PMA_PMD_10000T_ADV_LBN;
-       mdio_clause45_write(efx, phy, MDIO_MMD_PMAPMD,
-                           PMA_PMD_SPEED_ENABLE_REG, reg);
-
-       enabled = (advertising &
-                  (ADVERTISED_1000baseT_Half |
-                   ADVERTISED_1000baseT_Full |
-                   ADVERTISED_10000baseT_Full));
-       if (EFX_WORKAROUND_13204(efx))
-               enabled |= (advertising & ADVERTISED_100baseT_Full);
-       return enabled;
+       int phy_id = efx->mii.phy_id;
+
+       mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_C22EXT,
+                              C22EXT_MSTSLV_CTRL,
+                              C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN,
+                              advertising & ADVERTISED_1000baseT_Full);
+       mdio_clause45_set_flag(efx, phy_id, MDIO_MMD_AN,
+                              MDIO_AN_10GBT_CTRL,
+                              MDIO_AN_10GBT_CTRL_ADV_10G_LBN,
+                              advertising & ADVERTISED_10000baseT_Full);
 }
 
 struct efx_phy_operations falcon_sfx7101_phy_ops = {
@@ -882,8 +822,9 @@ struct efx_phy_operations falcon_sfx7101_phy_ops = {
        .poll             = tenxpress_phy_poll,
        .fini             = tenxpress_phy_fini,
        .clear_interrupt  = efx_port_dummy_op_void,
-       .get_settings     = sfx7101_get_settings,
-       .set_settings     = mdio_clause45_set_settings,
+       .get_settings     = tenxpress_get_settings,
+       .set_settings     = tenxpress_set_settings,
+       .set_npage_adv    = sfx7101_set_npage_adv,
        .num_tests        = ARRAY_SIZE(sfx7101_test_names),
        .test_names       = sfx7101_test_names,
        .run_tests        = sfx7101_run_tests,
@@ -898,9 +839,9 @@ struct efx_phy_operations falcon_sft9001_phy_ops = {
        .poll             = tenxpress_phy_poll,
        .fini             = tenxpress_phy_fini,
        .clear_interrupt  = efx_port_dummy_op_void,
-       .get_settings     = sft9001_get_settings,
-       .set_settings     = sft9001_set_settings,
-       .set_xnp_advertise = sft9001_set_xnp_advertise,
+       .get_settings     = tenxpress_get_settings,
+       .set_settings     = tenxpress_set_settings,
+       .set_npage_adv    = sft9001_set_npage_adv,
        .num_tests        = ARRAY_SIZE(sft9001_test_names),
        .test_names       = sft9001_test_names,
        .run_tests        = sft9001_run_tests,
index 82e03e1d73713ad2cc5c7dbbc110627fb21abe15..78de68f4a95b47a1c1712615db98cb5965dcb955 100644 (file)
@@ -18,8 +18,8 @@
 #define EFX_WORKAROUND_ALWAYS(efx) 1
 #define EFX_WORKAROUND_FALCON_A(efx) (falcon_rev(efx) <= FALCON_REV_A1)
 #define EFX_WORKAROUND_10G(efx) EFX_IS10G(efx)
-#define EFX_WORKAROUND_SFX7101(efx) ((efx)->phy_type == PHY_TYPE_SFX7101)
-#define EFX_WORKAROUND_SFT9001A(efx) ((efx)->phy_type == PHY_TYPE_SFT9001A)
+#define EFX_WORKAROUND_SFT9001(efx) ((efx)->phy_type == PHY_TYPE_SFT9001A || \
+                                    (efx)->phy_type == PHY_TYPE_SFT9001B)
 
 /* XAUI resets if link not detected */
 #define EFX_WORKAROUND_5147 EFX_WORKAROUND_ALWAYS
@@ -29,8 +29,6 @@
 #define EFX_WORKAROUND_7884 EFX_WORKAROUND_10G
 /* TX pkt parser problem with <= 16 byte TXes */
 #define EFX_WORKAROUND_9141 EFX_WORKAROUND_ALWAYS
-/* Low rate CRC errors require XAUI reset */
-#define EFX_WORKAROUND_10750 EFX_WORKAROUND_SFX7101
 /* TX_EV_PKT_ERR can be caused by a dangling TX descriptor
  * or a PCIe error (bug 11028) */
 #define EFX_WORKAROUND_10727 EFX_WORKAROUND_ALWAYS
@@ -55,8 +53,8 @@
 #define EFX_WORKAROUND_8071 EFX_WORKAROUND_FALCON_A
 
 /* Need to send XNP pages for 100BaseT */
-#define EFX_WORKAROUND_13204 EFX_WORKAROUND_SFT9001A
-/* Need to keep AN enabled */
-#define EFX_WORKAROUND_13963 EFX_WORKAROUND_SFT9001A
+#define EFX_WORKAROUND_13204 EFX_WORKAROUND_SFT9001
+/* Don't restart AN in near-side loopback */
+#define EFX_WORKAROUND_15195 EFX_WORKAROUND_SFT9001
 
 #endif /* EFX_WORKAROUNDS_H */
index 607efeaf0bc5cd00949fcdb3feaf7ec7f2b03305..9a00e5566af74db199d2625db4903ecd58e3b9e8 100644 (file)
@@ -1003,9 +1003,9 @@ static int skfp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                break;
        case SKFP_CLR_STATS:    /* Zero out the driver statistics */
                if (!capable(CAP_NET_ADMIN)) {
-                       memset(&lp->MacStat, 0, sizeof(lp->MacStat));
-               } else {
                        status = -EPERM;
+               } else {
+                       memset(&lp->MacStat, 0, sizeof(lp->MacStat));
                }
                break;
        default:
index 3668e81e474ddbe3f83438378527e5af12cdb2d5..994703cc0db32c87229f7754f1a246c1cc44d9ea 100644 (file)
@@ -1403,9 +1403,6 @@ static int sky2_up(struct net_device *dev)
 
        }
 
-       if (netif_msg_ifup(sky2))
-               printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
-
        netif_carrier_off(dev);
 
        /* must be power of 2 */
@@ -1484,6 +1481,9 @@ static int sky2_up(struct net_device *dev)
        sky2_write32(hw, B0_IMSK, imask);
 
        sky2_set_multicast(dev);
+
+       if (netif_msg_ifup(sky2))
+               printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
        return 0;
 
 err_out:
index bf3aa2a1effed6fa6301fc675d01bbf33e9d72fd..223cde0d43be8a6674f956cea35e3a490530cfdb 100644 (file)
@@ -220,9 +220,9 @@ static void smc911x_reset(struct net_device *dev)
 
        /* make sure EEPROM has finished loading before setting GPIO_CFG */
        timeout=1000;
-       while ( timeout-- && (SMC_GET_E2P_CMD(lp) & E2P_CMD_EPC_BUSY_)) {
+       while (--timeout && (SMC_GET_E2P_CMD(lp) & E2P_CMD_EPC_BUSY_))
                udelay(10);
-       }
+
        if (timeout == 0){
                PRINTK("%s: smc911x_reset timeout waiting for EEPROM busy\n", dev->name);
                return;
index f513bdf1c887682f0dbeccb6f50f0c0bdb4a83a1..783c1a7b869e62c20ccf1981cbe3000f5eaddf56 100644 (file)
@@ -953,7 +953,7 @@ smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes)
                do {
                        udelay(1);
                        val = smsc911x_reg_read(pdata, RX_DP_CTRL);
-               } while (timeout-- && (val & RX_DP_CTRL_RX_FFWD_));
+               } while (--timeout && (val & RX_DP_CTRL_RX_FFWD_));
 
                if (unlikely(timeout == 0))
                        SMSC_WARNING(HW, "Timed out waiting for "
index c14a4c6452c7ef6fa7e1fb08fb71f32bcb74a6b2..a1e4b3895b339d0a007ec07483e6039bf1d212d0 100644 (file)
@@ -498,7 +498,7 @@ static void smsc9420_check_mac_address(struct net_device *dev)
 static void smsc9420_stop_tx(struct smsc9420_pdata *pd)
 {
        u32 dmac_control, mac_cr, dma_intr_ena;
-       int timeOut = 1000;
+       int timeout = 1000;
 
        /* disable TX DMAC */
        dmac_control = smsc9420_reg_read(pd, DMAC_CONTROL);
@@ -506,13 +506,13 @@ static void smsc9420_stop_tx(struct smsc9420_pdata *pd)
        smsc9420_reg_write(pd, DMAC_CONTROL, dmac_control);
 
        /* Wait max 10ms for transmit process to stop */
-       while (timeOut--) {
+       while (--timeout) {
                if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_TS_)
                        break;
                udelay(10);
        }
 
-       if (!timeOut)
+       if (!timeout)
                smsc_warn(IFDOWN, "TX DMAC failed to stop");
 
        /* ACK Tx DMAC stop bit */
@@ -596,7 +596,7 @@ static void smsc9420_free_rx_ring(struct smsc9420_pdata *pd)
 
 static void smsc9420_stop_rx(struct smsc9420_pdata *pd)
 {
-       int timeOut = 1000;
+       int timeout = 1000;
        u32 mac_cr, dmac_control, dma_intr_ena;
 
        /* mask RX DMAC interrupts */
@@ -617,13 +617,13 @@ static void smsc9420_stop_rx(struct smsc9420_pdata *pd)
        smsc9420_pci_flush_write(pd);
 
        /* wait up to 10ms for receive to stop */
-       while (timeOut--) {
+       while (--timeout) {
                if (smsc9420_reg_read(pd, DMAC_STATUS) & DMAC_STS_RS_)
                        break;
                udelay(10);
        }
 
-       if (!timeOut)
+       if (!timeout)
                smsc_warn(IFDOWN, "RX DMAC did not stop! timeout.");
 
        /* ACK the Rx DMAC stop bit */
@@ -1378,6 +1378,7 @@ static int smsc9420_open(struct net_device *dev)
 
        /* test the IRQ connection to the ISR */
        smsc_dbg(IFUP, "Testing ISR using IRQ %d", dev->irq);
+       pd->software_irq_signal = false;
 
        spin_lock_irqsave(&pd->int_lock, flags);
        /* configure interrupt deassertion timer and enable interrupts */
@@ -1393,8 +1394,6 @@ static int smsc9420_open(struct net_device *dev)
        smsc9420_pci_flush_write(pd);
 
        timeout = 1000;
-       pd->software_irq_signal = false;
-       smp_wmb();
        while (timeout--) {
                if (pd->software_irq_signal)
                        break;
index 86c765d83de1148239ced6790c2aabd820685b87..b17efa9cc530f660e3166e77c6db9d5a401c9b57 100644 (file)
@@ -148,7 +148,7 @@ static u16 __phy_read(struct gem *gp, int phy_addr, int reg)
        cmd |= (MIF_FRAME_TAMSB);
        writel(cmd, gp->regs + MIF_FRAME);
 
-       while (limit--) {
+       while (--limit) {
                cmd = readl(gp->regs + MIF_FRAME);
                if (cmd & MIF_FRAME_TALSB)
                        break;
index 61843fd5752517344f03e78c758f87cd795c4f0b..78f8cee5fd7428b96e447e568d07c0cafb959f47 100644 (file)
@@ -79,7 +79,7 @@ static int reset_one_mii_phy(struct mii_phy* phy, int phy_id)
 
        udelay(100);
 
-       while (limit--) {
+       while (--limit) {
                val = __phy_read(phy, phy_id, MII_BMCR);
                if ((val & BMCR_RESET) == 0)
                        break;
index 6e8f377355fe8a6e98ab28676c0fa09671bc501a..fe0c3f2445621cf2ae5b5625f8b805db8593afc0 100644 (file)
@@ -227,7 +227,7 @@ static int qe_init(struct sunqe *qep, int from_irq)
        if (!(sbus_readb(mregs + MREGS_PHYCONFIG) & MREGS_PHYCONFIG_LTESTDIS)) {
                int tries = 50;
 
-               while (tries--) {
+               while (--tries) {
                        u8 tmp;
 
                        mdelay(5);
index 75461dbd487657bd8e6a8002499db7c54fe2d774..a9fd2b2ccaf6be90517b491bbb78f8e013fb3939 100644 (file)
@@ -1237,7 +1237,7 @@ static void tsi108_init_phy(struct net_device *dev)
        spin_lock_irqsave(&phy_lock, flags);
 
        tsi108_write_mii(data, MII_BMCR, BMCR_RESET);
-       while (i--){
+       while (--i) {
                if(!(tsi108_read_mii(data, MII_BMCR) & BMCR_RESET))
                        break;
                udelay(10);
index 1210fb3748a74e7dfb085fb7cf4aa874a6455504..db7d5e11855d009b07aeb8a3e247c69e3f45a8ed 100644 (file)
@@ -9,6 +9,11 @@
 
        Please refer to Documentation/DocBook/tulip-user.{pdf,ps,html}
        for more information on this driver.
+
+       DC21143 manual "21143 PCI/CardBus 10/100Mb/s Ethernet LAN Controller
+       Hardware Reference Manual" is currently available at :
+       http://developer.intel.com/design/network/manuals/278074.htm
+
        Please submit bugs to http://bugzilla.kernel.org/ .
 */
 
@@ -32,7 +37,11 @@ void t21142_media_task(struct work_struct *work)
        int csr12 = ioread32(ioaddr + CSR12);
        int next_tick = 60*HZ;
        int new_csr6 = 0;
+       int csr14 = ioread32(ioaddr + CSR14);
 
+       /* CSR12[LS10,LS100] are not reliable during autonegotiation */
+       if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000)
+               csr12 |= 6;
        if (tulip_debug > 2)
                printk(KERN_INFO"%s: 21143 negotiation status %8.8x, %s.\n",
                           dev->name, csr12, medianame[dev->if_port]);
@@ -76,7 +85,7 @@ void t21142_media_task(struct work_struct *work)
                        new_csr6 = 0x83860000;
                        dev->if_port = 3;
                        iowrite32(0, ioaddr + CSR13);
-                       iowrite32(0x0003FF7F, ioaddr + CSR14);
+                       iowrite32(0x0003FFFF, ioaddr + CSR14);
                        iowrite16(8, ioaddr + CSR15);
                        iowrite32(1, ioaddr + CSR13);
                }
@@ -132,10 +141,14 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
        struct tulip_private *tp = netdev_priv(dev);
        void __iomem *ioaddr = tp->base_addr;
        int csr12 = ioread32(ioaddr + CSR12);
+       int csr14 = ioread32(ioaddr + CSR14);
 
+       /* CSR12[LS10,LS100] are not reliable during autonegotiation */
+       if ((csr14 & 0x80) && (csr12 & 0x7000) != 0x5000)
+               csr12 |= 6;
        if (tulip_debug > 1)
                printk(KERN_INFO"%s: 21143 link status interrupt %8.8x, CSR5 %x, "
-                          "%8.8x.\n", dev->name, csr12, csr5, ioread32(ioaddr + CSR14));
+                          "%8.8x.\n", dev->name, csr12, csr5, csr14);
 
        /* If NWay finished and we have a negotiated partner capability. */
        if (tp->nway  &&  !tp->nwayset  &&  (csr12 & 0x7000) == 0x5000) {
@@ -143,7 +156,9 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
                int negotiated = tp->sym_advertise & (csr12 >> 16);
                tp->lpar = csr12 >> 16;
                tp->nwayset = 1;
-               if (negotiated & 0x0100)                dev->if_port = 5;
+               /* If partner cannot negotiate, it is 10Mbps Half Duplex */
+               if (!(csr12 & 0x8000))          dev->if_port = 0;
+               else if (negotiated & 0x0100)   dev->if_port = 5;
                else if (negotiated & 0x0080)   dev->if_port = 3;
                else if (negotiated & 0x0040)   dev->if_port = 4;
                else if (negotiated & 0x0020)   dev->if_port = 0;
@@ -214,7 +229,7 @@ void t21142_lnk_change(struct net_device *dev, int csr5)
                        tp->timer.expires = RUN_AT(3*HZ);
                        add_timer(&tp->timer);
                } else if (dev->if_port == 5)
-                       iowrite32(ioread32(ioaddr + CSR14) & ~0x080, ioaddr + CSR14);
+                       iowrite32(csr14 & ~0x080, ioaddr + CSR14);
        } else if (dev->if_port == 0  ||  dev->if_port == 4) {
                if ((csr12 & 4) == 0)
                        printk(KERN_INFO"%s: 21143 10baseT link beat good.\n",
index d5d53b633cf81885c2fb30842ae2eb222baf1c57..0bf2114738bea563192d58bec9c9347b43112516 100644 (file)
@@ -392,7 +392,7 @@ static void de_rx (struct de_private *de)
        unsigned drop = 0;
        int rc;
 
-       while (rx_work--) {
+       while (--rx_work) {
                u32 status, len;
                dma_addr_t mapping;
                struct sk_buff *skb, *copy_skb;
index 11441225bf413b8d21ec1835452070d64b26caec..e87986867ba5b3042be2434f5620ca662242c1b8 100644 (file)
@@ -1536,6 +1536,11 @@ static void adjust_link(struct net_device *dev)
 static int init_phy(struct net_device *dev)
 {
        struct ucc_geth_private *priv = netdev_priv(dev);
+       struct device_node *np = priv->node;
+       struct device_node *phy, *mdio;
+       const phandle *ph;
+       char bus_name[MII_BUS_ID_SIZE];
+       const unsigned int *id;
        struct phy_device *phydev;
        char phy_id[BUS_ID_SIZE];
 
@@ -1543,8 +1548,18 @@ static int init_phy(struct net_device *dev)
        priv->oldspeed = 0;
        priv->oldduplex = -1;
 
-       snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, priv->ug_info->mdio_bus,
-                priv->ug_info->phy_address);
+       ph = of_get_property(np, "phy-handle", NULL);
+       phy = of_find_node_by_phandle(*ph);
+       mdio = of_get_parent(phy);
+
+       id = of_get_property(phy, "reg", NULL);
+
+       of_node_put(phy);
+       of_node_put(mdio);
+
+       uec_mdio_bus_name(bus_name, mdio);
+       snprintf(phy_id, sizeof(phy_id), "%s:%02x",
+                                bus_name, *id);
 
        phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface);
 
@@ -3748,6 +3763,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
 
        ugeth->ug_info = ug_info;
        ugeth->dev = dev;
+       ugeth->node = np;
 
        return 0;
 }
index 8f699cb773ee0cbac5c6795dcf83d2acceb6ce64..16cbe42ba43c9b0f8097222306324498da489abe 100644 (file)
@@ -1186,6 +1186,8 @@ struct ucc_geth_private {
        int oldspeed;
        int oldduplex;
        int oldlink;
+
+       struct device_node *node;
 };
 
 void uec_set_ethtool_ops(struct net_device *netdev);
index c001d261366b84c3ffe782b7f2f6d216107b94de..54635911305c2357f66a5705fdb76e0539742876 100644 (file)
@@ -156,7 +156,7 @@ static int uec_mdio_probe(struct of_device *ofdev, const struct of_device_id *ma
        if (err)
                goto reg_map_fail;
 
-       snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start);
+       uec_mdio_bus_name(new_bus->id, np);
 
        new_bus->irq = kmalloc(32 * sizeof(int), GFP_KERNEL);
 
@@ -283,3 +283,13 @@ void uec_mdio_exit(void)
 {
        of_unregister_platform_driver(&uec_mdio_driver);
 }
+
+void uec_mdio_bus_name(char *name, struct device_node *np)
+{
+        const u32 *reg;
+
+        reg = of_get_property(np, "reg", NULL);
+
+        snprintf(name, MII_BUS_ID_SIZE, "%s@%x", np->name, reg ? *reg : 0);
+}
+
index 1e45b2028a50c7f07d43d955979afd760acf42b4..840cf80235b7a7ab3993e0a07df7481bb1f6c7a9 100644 (file)
@@ -97,4 +97,5 @@ int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
 int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
 int __init uec_mdio_init(void);
 void uec_mdio_exit(void);
+void uec_mdio_bus_name(char *name, struct device_node *np);
 #endif                         /* __UEC_MII_H */
index 0d0fa91c025130fa96637d70a89b2cc101b89233..fe98acaead976a1bdd6c5158377500e0a14a32b2 100644 (file)
@@ -455,6 +455,7 @@ static const struct usb_device_id hso_ids[] = {
        {icon321_port_device(0x0af0, 0xd033)},  /* Icon-322 */
        {USB_DEVICE(0x0af0, 0x7301)},           /* GE40x */
        {USB_DEVICE(0x0af0, 0x7361)},           /* GE40x */
+       {USB_DEVICE(0x0af0, 0x7381)},           /* GE40x */
        {USB_DEVICE(0x0af0, 0x7401)},           /* GI 0401 */
        {USB_DEVICE(0x0af0, 0x7501)},           /* GTM 382 */
        {USB_DEVICE(0x0af0, 0x7601)},           /* GE40x */
@@ -462,7 +463,8 @@ static const struct usb_device_id hso_ids[] = {
        {USB_DEVICE(0x0af0, 0x7801)},
        {USB_DEVICE(0x0af0, 0x7901)},
        {USB_DEVICE(0x0af0, 0x7361)},
-       {icon321_port_device(0x0af0, 0xd051)},
+       {USB_DEVICE(0x0af0, 0xd057)},
+       {USB_DEVICE(0x0af0, 0xd055)},
        {}
 };
 MODULE_DEVICE_TABLE(usb, hso_ids);
index 63ef2a8905fb1b836061882e5ff2ff2ac46f9d91..c68808336c8c4d84e90e03a8d0649592b72c1626 100644 (file)
@@ -287,7 +287,7 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi)
                skb_put(skb, MAX_PACKET_LEN);
 
                hdr = skb_vnet_hdr(skb);
-               sg_init_one(sg, hdr, sizeof(*hdr));
+               sg_set_buf(sg, hdr, sizeof(*hdr));
 
                if (vi->big_packets) {
                        for (i = 0; i < MAX_SKB_FRAGS; i++) {
@@ -488,9 +488,9 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
 
        /* Encode metadata header at front. */
        if (vi->mergeable_rx_bufs)
-               sg_init_one(sg, mhdr, sizeof(*mhdr));
+               sg_set_buf(sg, mhdr, sizeof(*mhdr));
        else
-               sg_init_one(sg, hdr, sizeof(*hdr));
+               sg_set_buf(sg, hdr, sizeof(*hdr));
 
        num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;
 
index 626632985977e6df2949613f564db4e60ab27a27..9b81af3f80a96d22e38aebf9f46419b5a1c8a37a 100644 (file)
@@ -234,20 +234,6 @@ struct dentry *debugfs_create_i2400m_reset(
                                   &fops_i2400m_reset);
 }
 
-/*
- * Debug levels control; see debug.h
- */
-struct d_level D_LEVEL[] = {
-       D_SUBMODULE_DEFINE(control),
-       D_SUBMODULE_DEFINE(driver),
-       D_SUBMODULE_DEFINE(debugfs),
-       D_SUBMODULE_DEFINE(fw),
-       D_SUBMODULE_DEFINE(netdev),
-       D_SUBMODULE_DEFINE(rfkill),
-       D_SUBMODULE_DEFINE(rx),
-       D_SUBMODULE_DEFINE(tx),
-};
-size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
 
 #define __debugfs_register(prefix, name, parent)                       \
 do {                                                                   \
index 5f98047e18cf88e4a6266cf57c757d13a6cd4c87..e80a0b65a7549d4fb2fec512a363586aac65f04b 100644 (file)
@@ -707,6 +707,22 @@ void i2400m_release(struct i2400m *i2400m)
 EXPORT_SYMBOL_GPL(i2400m_release);
 
 
+/*
+ * Debug levels control; see debug.h
+ */
+struct d_level D_LEVEL[] = {
+       D_SUBMODULE_DEFINE(control),
+       D_SUBMODULE_DEFINE(driver),
+       D_SUBMODULE_DEFINE(debugfs),
+       D_SUBMODULE_DEFINE(fw),
+       D_SUBMODULE_DEFINE(netdev),
+       D_SUBMODULE_DEFINE(rfkill),
+       D_SUBMODULE_DEFINE(rx),
+       D_SUBMODULE_DEFINE(tx),
+};
+size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
+
+
 static
 int __init i2400m_driver_init(void)
 {
index 8ef87356e083f28241db4298c1a0a0384732f340..a533ed60bb4d739da8a5cc41318b9de8b4b98c27 100644 (file)
@@ -1028,6 +1028,8 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
  * it's done by reseting the chip.  To accomplish this we must
  * first cleanup any pending DMA, then restart stuff after a la
  * ath5k_init.
+ *
+ * Called with sc->lock.
  */
 static int
 ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan)
@@ -2814,11 +2816,17 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct ath5k_softc *sc = hw->priv;
        struct ieee80211_conf *conf = &hw->conf;
+       int ret;
+
+       mutex_lock(&sc->lock);
 
        sc->bintval = conf->beacon_int;
        sc->power_level = conf->power_level;
 
-       return ath5k_chan_set(sc, conf->channel);
+       ret = ath5k_chan_set(sc, conf->channel);
+
+       mutex_unlock(&sc->lock);
+       return ret;
 }
 
 static int
index 0dc8eed16404dc717623536b91868a7749bc7498..c01ea48da5fe5b7b949407b57745f5843fb3276e 100644 (file)
@@ -1719,6 +1719,10 @@ static int iwl_read_ucode(struct iwl_priv *priv)
        priv->ucode_data_backup.len = data_size;
        iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
 
+       if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr ||
+           !priv->ucode_data_backup.v_addr)
+               goto err_pci_alloc;
+
        /* Initialization instructions and data */
        if (init_size && init_data_size) {
                priv->ucode_init.len = init_size;
@@ -4038,6 +4042,7 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
                priv->is_open = 1;
        }
 
+       pci_save_state(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
 
        return 0;
@@ -4048,6 +4053,7 @@ static int iwl_pci_resume(struct pci_dev *pdev)
        struct iwl_priv *priv = pci_get_drvdata(pdev);
 
        pci_set_power_state(pdev, PCI_D0);
+       pci_restore_state(pdev);
 
        if (priv->is_open)
                iwl_mac_start(priv->hw);
index 412f66bac1afc0f4024169b719f179405345a86e..70a8b21ca39b91216fe0c535a06021dfd9e30d2a 100644 (file)
@@ -480,6 +480,9 @@ void iwl_clear_stations_table(struct iwl_priv *priv)
        priv->num_stations = 0;
        memset(priv->stations, 0, sizeof(priv->stations));
 
+       /* clean ucode key table bit map */
+       priv->ucode_key_table = 0;
+
        spin_unlock_irqrestore(&priv->sta_lock, flags);
 }
 EXPORT_SYMBOL(iwl_clear_stations_table);
index 95d01984c80ed13c746499b97da040fc3e3f65e4..5b44d322b99f18481e299fb26326c1066e281732 100644 (file)
@@ -8143,6 +8143,7 @@ static int iwl3945_pci_suspend(struct pci_dev *pdev, pm_message_t state)
                priv->is_open = 1;
        }
 
+       pci_save_state(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
 
        return 0;
@@ -8153,6 +8154,7 @@ static int iwl3945_pci_resume(struct pci_dev *pdev)
        struct iwl3945_priv *priv = pci_get_drvdata(pdev);
 
        pci_set_power_state(pdev, PCI_D0);
+       pci_restore_state(pdev);
 
        if (priv->is_open)
                iwl3945_mac_start(priv->hw);
index 4e75e8e7fa909036e89fca107f8acbad06e4d70c..78df281b297a4604fd2e10e8b3bf67d3f9c1990a 100644 (file)
@@ -285,7 +285,10 @@ static void rtl8225_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
        ofdm_power = priv->channels[channel - 1].hw_value >> 4;
 
        cck_power = min(cck_power, (u8)11);
-       ofdm_power = min(ofdm_power, (u8)35);
+       if (ofdm_power > (u8)15)
+               ofdm_power = 25;
+       else
+               ofdm_power += 10;
 
        rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
                         rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1);
@@ -536,7 +539,10 @@ static void rtl8225z2_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
        cck_power += priv->txpwr_base & 0xF;
        cck_power = min(cck_power, (u8)35);
 
-       ofdm_power = min(ofdm_power, (u8)15);
+       if (ofdm_power > (u8)15)
+               ofdm_power = 25;
+       else
+               ofdm_power += 10;
        ofdm_power += priv->txpwr_base >> 4;
        ofdm_power = min(ofdm_power, (u8)35);
 
index 3fac8f81d59d4df607efb7871e9bce0f595c182a..a70cf16ee1ade57e64f51aed4c21b4ebbd6ac1b9 100644 (file)
@@ -668,7 +668,7 @@ sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
  * @dev: instance of PCI owned by the driver that's asking
  * @mask:  number of address bits this PCI device can handle
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 static int sba_dma_supported( struct device *dev, u64 mask)
 {
@@ -680,8 +680,8 @@ static int sba_dma_supported( struct device *dev, u64 mask)
                return(0);
        }
 
-       /* Documentation/DMA-mapping.txt tells drivers to try 64-bit first,
-        * then fall back to 32-bit if that fails.
+       /* Documentation/PCI/PCI-DMA-mapping.txt tells drivers to try 64-bit
+        * first, then fall back to 32-bit if that fails.
         * We are just "encouraging" 32-bit DMA masks here since we can
         * never allow IOMMU bypass unless we add special support for ZX1.
         */
@@ -706,7 +706,7 @@ static int sba_dma_supported( struct device *dev, u64 mask)
  * @size:  number of bytes to map in driver buffer.
  * @direction:  R/W or both.
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 static dma_addr_t
 sba_map_single(struct device *dev, void *addr, size_t size,
@@ -785,7 +785,7 @@ sba_map_single(struct device *dev, void *addr, size_t size,
  * @size:  number of bytes mapped in driver buffer.
  * @direction:  R/W or both.
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 static void
 sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
@@ -861,7 +861,7 @@ sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
  * @size:  number of bytes mapped in driver buffer.
  * @dma_handle:  IOVA of new buffer.
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 static void *sba_alloc_consistent(struct device *hwdev, size_t size,
                                        dma_addr_t *dma_handle, gfp_t gfp)
@@ -892,7 +892,7 @@ static void *sba_alloc_consistent(struct device *hwdev, size_t size,
  * @vaddr:  virtual address IOVA of "consistent" buffer.
  * @dma_handler:  IO virtual address of "consistent" buffer.
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 static void
 sba_free_consistent(struct device *hwdev, size_t size, void *vaddr,
@@ -927,7 +927,7 @@ int dump_run_sg = 0;
  * @nents:  number of entries in list
  * @direction:  R/W or both.
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 static int
 sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
@@ -1011,7 +1011,7 @@ sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
  * @nents:  number of entries in list
  * @direction:  R/W or both.
  *
- * See Documentation/DMA-mapping.txt
+ * See Documentation/PCI/PCI-DMA-mapping.txt
  */
 static void 
 sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
index e31fb91652cefac2c60475a9ccf81f8751f988a6..2aa117c8cd879521111ddf71b4c7cf5b4b1e28f2 100644 (file)
@@ -5,11 +5,15 @@
 obj-$(CONFIG_HOTPLUG_PCI)              += pci_hotplug.o
 obj-$(CONFIG_HOTPLUG_PCI_COMPAQ)       += cpqphp.o
 obj-$(CONFIG_HOTPLUG_PCI_IBM)          += ibmphp.o
+
+# pciehp should be linked before acpiphp in order to allow the native driver
+# to attempt to bind first. We can then fall back to generic support.
+
+obj-$(CONFIG_HOTPLUG_PCI_PCIE)         += pciehp.o
 obj-$(CONFIG_HOTPLUG_PCI_ACPI)         += acpiphp.o
 obj-$(CONFIG_HOTPLUG_PCI_ACPI_IBM)     += acpiphp_ibm.o
 obj-$(CONFIG_HOTPLUG_PCI_CPCI_ZT5550)  += cpcihp_zt5550.o
 obj-$(CONFIG_HOTPLUG_PCI_CPCI_GENERIC) += cpcihp_generic.o
-obj-$(CONFIG_HOTPLUG_PCI_PCIE)         += pciehp.o
 obj-$(CONFIG_HOTPLUG_PCI_SHPC)         += shpchp.o
 obj-$(CONFIG_HOTPLUG_PCI_RPA)          += rpaphp.o
 obj-$(CONFIG_HOTPLUG_PCI_RPA_DLPAR)    += rpadlpar_io.o
index b0e7de9e536d385e7e0d06dd0262f88537b06004..d8649e12729863f67f406b86af873b89bc58062f 100644 (file)
@@ -195,13 +195,13 @@ static void remove_slot_worker(struct work_struct *work)
  * Tries hard not to re-enable already existing devices;
  * also handles scanning of subfunctions.
  */
-static void pci_rescan_slot(struct pci_dev *temp)
+static int pci_rescan_slot(struct pci_dev *temp)
 {
        struct pci_bus *bus = temp->bus;
        struct pci_dev *dev;
        int func;
-       int retval;
        u8 hdr_type;
+       int count = 0;
 
        if (!pci_read_config_byte(temp, PCI_HEADER_TYPE, &hdr_type)) {
                temp->hdr_type = hdr_type & 0x7f;
@@ -213,17 +213,12 @@ static void pci_rescan_slot(struct pci_dev *temp)
                                dbg("New device on %s function %x:%x\n",
                                        bus->name, temp->devfn >> 3,
                                        temp->devfn & 7);
-                               retval = pci_bus_add_device(dev);
-                               if (retval)
-                                       dev_err(&dev->dev, "error adding "
-                                               "device, continuing.\n");
-                               else
-                                       add_slot(dev);
+                               count++;
                        }
                }
                /* multifunction device? */
                if (!(hdr_type & 0x80))
-                       return;
+                       return count;
 
                /* continue scanning for other functions */
                for (func = 1, temp->devfn++; func < 8; func++, temp->devfn++) {
@@ -239,16 +234,13 @@ static void pci_rescan_slot(struct pci_dev *temp)
                                        dbg("New device on %s function %x:%x\n",
                                                bus->name, temp->devfn >> 3,
                                                temp->devfn & 7);
-                                       retval = pci_bus_add_device(dev);
-                                       if (retval)
-                                               dev_err(&dev->dev, "error adding "
-                                                       "device, continuing.\n");
-                                       else
-                                               add_slot(dev);
+                                       count++;
                                }
                        }
                }
        }
+
+       return count;
 }
 
 
@@ -262,6 +254,8 @@ static void pci_rescan_bus(const struct pci_bus *bus)
 {
        unsigned int devfn;
        struct pci_dev *dev;
+       int retval;
+       int found = 0;
        dev = alloc_pci_dev();
        if (!dev)
                return;
@@ -270,7 +264,23 @@ static void pci_rescan_bus(const struct pci_bus *bus)
        dev->sysdata = bus->sysdata;
        for (devfn = 0; devfn < 0x100; devfn += 8) {
                dev->devfn = devfn;
-               pci_rescan_slot(dev);
+               found += pci_rescan_slot(dev);
+       }
+
+       if (found) {
+               pci_bus_assign_resources(bus);
+               list_for_each_entry(dev, &bus->devices, bus_list) {
+                       /* Skip already-added devices */
+                       if (dev->is_added)
+                                       continue;
+                       retval = pci_bus_add_device(dev);
+                       if (retval)
+                               dev_err(&dev->dev,
+                                       "Error adding device, continuing\n");
+                       else
+                               add_slot(dev);
+               }
+               pci_bus_add_devices(bus);
        }
        kfree(dev);
 }
index 896a15d70f5b3060a587b52ca2ecbb9dbaadcd9e..44f15ff70c1d4f5f6c135d68367cbfb57b31783e 100644 (file)
@@ -103,6 +103,16 @@ static void msix_set_enable(struct pci_dev *dev, int enable)
        }
 }
 
+/*
+ * Essentially, this is ((1 << (1 << x)) - 1), but without the
+ * undefinedness of a << 32.
+ */
+static inline __attribute_const__ u32 msi_mask(unsigned x)
+{
+       static const u32 mask[] = { 1, 2, 4, 0xf, 0xff, 0xffff, 0xffffffff };
+       return mask[x];
+}
+
 static void msix_flush_writes(struct irq_desc *desc)
 {
        struct msi_desc *entry;
@@ -407,8 +417,7 @@ static int msi_capability_init(struct pci_dev *dev)
 
                /* All MSIs are unmasked by default, Mask them all */
                pci_read_config_dword(dev, base, &maskbits);
-               temp = (1 << multi_msi_capable(control));
-               temp = ((temp - 1) & ~temp);
+               temp = msi_mask((control & PCI_MSI_FLAGS_QMASK) >> 1);
                maskbits |= temp;
                pci_write_config_dword(dev, base, maskbits);
                entry->msi_attrib.maskbits_mask = temp;
index 9de07b75b993b0e81346cd516c2021849d50901e..93eac14235854c648e6e895c51f063b8af68e152 100644 (file)
@@ -355,6 +355,8 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
        int i = 0;
 
        if (drv && drv->suspend) {
+               pci_power_t prev = pci_dev->current_state;
+
                pci_dev->state_saved = false;
 
                i = drv->suspend(pci_dev, state);
@@ -365,8 +367,13 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
                if (pci_dev->state_saved)
                        goto Fixup;
 
-               if (WARN_ON_ONCE(pci_dev->current_state != PCI_D0))
+               if (pci_dev->current_state != PCI_D0
+                   && pci_dev->current_state != PCI_UNKNOWN) {
+                       WARN_ONCE(pci_dev->current_state != prev,
+                               "PCI PM: Device state not saved by %pF\n",
+                               drv->suspend);
                        goto Fixup;
+               }
        }
 
        pci_save_state(pci_dev);
@@ -419,38 +426,24 @@ static int pci_legacy_resume(struct device *dev)
 static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev)
 {
        pci_restore_standard_config(pci_dev);
+       pci_dev->state_saved = false;
        pci_fixup_device(pci_fixup_resume_early, pci_dev);
 }
 
-static int pci_pm_default_resume(struct pci_dev *pci_dev)
+static void pci_pm_default_resume(struct pci_dev *pci_dev)
 {
        pci_fixup_device(pci_fixup_resume, pci_dev);
 
        if (!pci_is_bridge(pci_dev))
                pci_enable_wake(pci_dev, PCI_D0, false);
-
-       return pci_pm_reenable_device(pci_dev);
-}
-
-static void pci_pm_default_suspend_generic(struct pci_dev *pci_dev)
-{
-       /* If device is enabled at this point, disable it */
-       pci_disable_enabled_device(pci_dev);
-       /*
-        * Save state with interrupts enabled, because in principle the bus the
-        * device is on may be put into a low power state after this code runs.
-        */
-       pci_save_state(pci_dev);
 }
 
 static void pci_pm_default_suspend(struct pci_dev *pci_dev)
 {
-       pci_pm_default_suspend_generic(pci_dev);
-
+       /* Disable non-bridge devices without PM support */
        if (!pci_is_bridge(pci_dev))
-               pci_prepare_to_sleep(pci_dev);
-
-       pci_fixup_device(pci_fixup_suspend, pci_dev);
+               pci_disable_enabled_device(pci_dev);
+       pci_save_state(pci_dev);
 }
 
 static bool pci_has_legacy_pm_support(struct pci_dev *pci_dev)
@@ -495,21 +488,49 @@ static void pci_pm_complete(struct device *dev)
 static int pci_pm_suspend(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
-       int error = 0;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_SUSPEND);
 
-       if (drv && drv->pm && drv->pm->suspend) {
-               error = drv->pm->suspend(dev);
-               suspend_report_result(drv->pm->suspend, error);
+       if (!pm) {
+               pci_pm_default_suspend(pci_dev);
+               goto Fixup;
        }
 
-       if (!error)
-               pci_pm_default_suspend(pci_dev);
+       pci_dev->state_saved = false;
 
-       return error;
+       if (pm->suspend) {
+               pci_power_t prev = pci_dev->current_state;
+               int error;
+
+               error = pm->suspend(dev);
+               suspend_report_result(pm->suspend, error);
+               if (error)
+                       return error;
+
+               if (pci_dev->state_saved)
+                       goto Fixup;
+
+               if (pci_dev->current_state != PCI_D0
+                   && pci_dev->current_state != PCI_UNKNOWN) {
+                       WARN_ONCE(pci_dev->current_state != prev,
+                               "PCI PM: State of device not saved by %pF\n",
+                               pm->suspend);
+                       goto Fixup;
+               }
+       }
+
+       if (!pci_dev->state_saved) {
+               pci_save_state(pci_dev);
+               if (!pci_is_bridge(pci_dev))
+                       pci_prepare_to_sleep(pci_dev);
+       }
+
+ Fixup:
+       pci_fixup_device(pci_fixup_suspend, pci_dev);
+
+       return 0;
 }
 
 static int pci_pm_suspend_noirq(struct device *dev)
@@ -552,18 +573,29 @@ static int pci_pm_resume_noirq(struct device *dev)
 static int pci_pm_resume(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
        int error = 0;
 
+       /*
+        * This is necessary for the suspend error path in which resume is
+        * called without restoring the standard config registers of the device.
+        */
+       if (pci_dev->state_saved)
+               pci_restore_standard_config(pci_dev);
+
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_resume(dev);
 
-       error = pci_pm_default_resume(pci_dev);
+       pci_pm_default_resume(pci_dev);
 
-       if (!error && drv && drv->pm && drv->pm->resume)
-               error = drv->pm->resume(dev);
+       if (pm) {
+               if (pm->resume)
+                       error = pm->resume(dev);
+       } else {
+               pci_pm_reenable_device(pci_dev);
+       }
 
-       return error;
+       return 0;
 }
 
 #else /* !CONFIG_SUSPEND */
@@ -580,21 +612,31 @@ static int pci_pm_resume(struct device *dev)
 static int pci_pm_freeze(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
-       int error = 0;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_FREEZE);
 
-       if (drv && drv->pm && drv->pm->freeze) {
-               error = drv->pm->freeze(dev);
-               suspend_report_result(drv->pm->freeze, error);
+       if (!pm) {
+               pci_pm_default_suspend(pci_dev);
+               return 0;
+       }
+
+       pci_dev->state_saved = false;
+
+       if (pm->freeze) {
+               int error;
+
+               error = pm->freeze(dev);
+               suspend_report_result(pm->freeze, error);
+               if (error)
+                       return error;
        }
 
-       if (!error)
-               pci_pm_default_suspend_generic(pci_dev);
+       if (!pci_dev->state_saved)
+               pci_save_state(pci_dev);
 
-       return error;
+       return 0;
 }
 
 static int pci_pm_freeze_noirq(struct device *dev)
@@ -637,16 +679,18 @@ static int pci_pm_thaw_noirq(struct device *dev)
 static int pci_pm_thaw(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
        int error = 0;
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_resume(dev);
 
-       pci_pm_reenable_device(pci_dev);
-
-       if (drv && drv->pm && drv->pm->thaw)
-               error =  drv->pm->thaw(dev);
+       if (pm) {
+               if (pm->thaw)
+                       error = pm->thaw(dev);
+       } else {
+               pci_pm_reenable_device(pci_dev);
+       }
 
        return error;
 }
@@ -654,19 +698,29 @@ static int pci_pm_thaw(struct device *dev)
 static int pci_pm_poweroff(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
        int error = 0;
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_HIBERNATE);
 
-       if (drv && drv->pm && drv->pm->poweroff) {
-               error = drv->pm->poweroff(dev);
-               suspend_report_result(drv->pm->poweroff, error);
+       if (!pm) {
+               pci_pm_default_suspend(pci_dev);
+               goto Fixup;
        }
 
-       if (!error)
-               pci_pm_default_suspend(pci_dev);
+       pci_dev->state_saved = false;
+
+       if (pm->poweroff) {
+               error = pm->poweroff(dev);
+               suspend_report_result(pm->poweroff, error);
+       }
+
+       if (!pci_dev->state_saved && !pci_is_bridge(pci_dev))
+               pci_prepare_to_sleep(pci_dev);
+
+ Fixup:
+       pci_fixup_device(pci_fixup_suspend, pci_dev);
 
        return error;
 }
@@ -707,16 +761,27 @@ static int pci_pm_restore_noirq(struct device *dev)
 static int pci_pm_restore(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
        int error = 0;
 
+       /*
+        * This is necessary for the hibernation error path in which restore is
+        * called without restoring the standard config registers of the device.
+        */
+       if (pci_dev->state_saved)
+               pci_restore_standard_config(pci_dev);
+
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_resume(dev);
 
-       error = pci_pm_default_resume(pci_dev);
+       pci_pm_default_resume(pci_dev);
 
-       if (!error && drv && drv->pm && drv->pm->restore)
-               error = drv->pm->restore(dev);
+       if (pm) {
+               if (pm->restore)
+                       error = pm->restore(dev);
+       } else {
+               pci_pm_reenable_device(pci_dev);
+       }
 
        return error;
 }
index db7ec14fa7191828d91f58eb903bfc94cd60ef8c..dfc4e0ddf241b57a93c8e94d3f81a583a772074c 100644 (file)
@@ -768,8 +768,8 @@ pci_read_rom(struct kobject *kobj, struct bin_attribute *bin_attr,
                return -EINVAL;
        
        rom = pci_map_rom(pdev, &size); /* size starts out as PCI window size */
-       if (!rom)
-               return 0;
+       if (!rom || !size)
+               return -EIO;
                
        if (off >= size)
                count = 0;
index 17bd9325a245333f4400676ceed18fe58d2f6a34..e3efe6b19ee79210e2885f03b1d21995e2125abb 100644 (file)
@@ -1393,35 +1393,35 @@ int pci_restore_standard_config(struct pci_dev *dev)
        pci_power_t prev_state;
        int error;
 
-       pci_restore_state(dev);
        pci_update_current_state(dev, PCI_D0);
 
        prev_state = dev->current_state;
        if (prev_state == PCI_D0)
-               return 0;
+               goto Restore;
 
        error = pci_raw_set_power_state(dev, PCI_D0, false);
        if (error)
                return error;
 
-       if (pci_is_bridge(dev)) {
-               if (prev_state > PCI_D1)
-                       mdelay(PCI_PM_BUS_WAIT);
-       } else {
-               switch(prev_state) {
-               case PCI_D3cold:
-               case PCI_D3hot:
-                       mdelay(pci_pm_d3_delay);
-                       break;
-               case PCI_D2:
-                       udelay(PCI_PM_D2_DELAY);
-                       break;
-               }
+       /*
+        * This assumes that we won't get a bus in B2 or B3 from the BIOS, but
+        * we've made this assumption forever and it appears to be universally
+        * satisfied.
+        */
+       switch(prev_state) {
+       case PCI_D3cold:
+       case PCI_D3hot:
+               mdelay(pci_pm_d3_delay);
+               break;
+       case PCI_D2:
+               udelay(PCI_PM_D2_DELAY);
+               break;
        }
 
-       dev->current_state = PCI_D0;
+       pci_update_current_state(dev, PCI_D0);
 
-       return 0;
+ Restore:
+       return dev->state_saved ? pci_restore_state(dev) : 0;
 }
 
 /**
index 586b6f75910da268b3a90e462ca470f010d73e76..b0367f168af4b95ff549bdad6b31fa1a9548e113 100644 (file)
@@ -718,9 +718,9 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
 
        /*
         * All PCIe functions are in one slot, remove one function will remove
-        * the the whole slot, so just wait
+        * the whole slot, so just wait until we are the last function left.
         */
-       if (!list_empty(&parent->subordinate->devices))
+       if (!list_is_last(&pdev->bus_list, &parent->subordinate->devices))
                goto out;
 
        /* All functions are removed, so just disable ASPM for the link */
index 99a914a027f8530dc3abe923d3edf33d46bd1a3b..f9b874eaeb9f80daea9f7eff884574cf7f749008 100644 (file)
@@ -55,25 +55,13 @@ static int pcie_portdrv_suspend(struct pci_dev *dev, pm_message_t state)
 
 }
 
-static int pcie_portdrv_suspend_late(struct pci_dev *dev, pm_message_t state)
-{
-       return pci_save_state(dev);
-}
-
-static int pcie_portdrv_resume_early(struct pci_dev *dev)
-{
-       return pci_restore_state(dev);
-}
-
 static int pcie_portdrv_resume(struct pci_dev *dev)
 {
-       pcie_portdrv_restore_config(dev);
+       pci_set_master(dev);
        return pcie_port_device_resume(dev);
 }
 #else
 #define pcie_portdrv_suspend NULL
-#define pcie_portdrv_suspend_late NULL
-#define pcie_portdrv_resume_early NULL
 #define pcie_portdrv_resume NULL
 #endif
 
@@ -292,8 +280,6 @@ static struct pci_driver pcie_portdriver = {
        .remove         = pcie_portdrv_remove,
 
        .suspend        = pcie_portdrv_suspend,
-       .suspend_late   = pcie_portdrv_suspend_late,
-       .resume_early   = pcie_portdrv_resume_early,
        .resume         = pcie_portdrv_resume,
 
        .err_handler    = &pcie_portdrv_err_handler,
index 132a78159b60e51bc988dc17acbaec5725e0ed98..29cbe47f219f8c39f2b3f66490a272f339b1f9d5 100644 (file)
@@ -63,7 +63,7 @@ void pci_disable_rom(struct pci_dev *pdev)
  * The PCI window size could be much larger than the
  * actual image size.
  */
-size_t pci_get_rom_size(void __iomem *rom, size_t size)
+size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
 {
        void __iomem *image;
        int last_image;
@@ -72,8 +72,10 @@ size_t pci_get_rom_size(void __iomem *rom, size_t size)
        do {
                void __iomem *pds;
                /* Standard PCI ROMs start out with these bytes 55 AA */
-               if (readb(image) != 0x55)
+               if (readb(image) != 0x55) {
+                       dev_err(&pdev->dev, "Invalid ROM contents\n");
                        break;
+               }
                if (readb(image + 1) != 0xAA)
                        break;
                /* get the PCI data structure and check its signature */
@@ -159,7 +161,7 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
         * size is much larger than the actual size of the ROM.
         * True size is important if the ROM is going to be copied.
         */
-       *size = pci_get_rom_size(rom, *size);
+       *size = pci_get_rom_size(pdev, rom, *size);
        return rom;
 }
 
index 1a266d4ab5f18ec52d8451185adcf66a3cd892d6..94363115a42a69502d8ddd3f029984fd62aa07b6 100644 (file)
@@ -42,6 +42,7 @@ config ASUS_LAPTOP
        depends on LEDS_CLASS
        depends on NEW_LEDS
        depends on BACKLIGHT_CLASS_DEVICE
+       depends on INPUT
        ---help---
          This is the new Linux driver for Asus laptops. It may also support some
          MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate
index 8fb8b35910482dc796841a410f01b47c7db8736d..56af6cf385b0ec0bb05c2e2789cd740c5f75ad69 100644 (file)
@@ -46,6 +46,7 @@
 #include <acpi/acpi_drivers.h>
 #include <acpi/acpi_bus.h>
 #include <asm/uaccess.h>
+#include <linux/input.h>
 
 #define ASUS_LAPTOP_VERSION "0.42"
 
@@ -181,6 +182,8 @@ struct asus_hotk {
        u8 light_level;         //light sensor level
        u8 light_switch;        //light sensor switch value
        u16 event_count[128];   //count for each event TODO make this better
+       struct input_dev *inputdev;
+       u16 *keycode_map;
 };
 
 /*
@@ -250,6 +253,37 @@ ASUS_LED(rled, "record");
 ASUS_LED(pled, "phone");
 ASUS_LED(gled, "gaming");
 
+struct key_entry {
+       char type;
+       u8 code;
+       u16 keycode;
+};
+
+enum { KE_KEY, KE_END };
+
+static struct key_entry asus_keymap[] = {
+       {KE_KEY, 0x30, KEY_VOLUMEUP},
+       {KE_KEY, 0x31, KEY_VOLUMEDOWN},
+       {KE_KEY, 0x32, KEY_MUTE},
+       {KE_KEY, 0x33, KEY_SWITCHVIDEOMODE},
+       {KE_KEY, 0x34, KEY_SWITCHVIDEOMODE},
+       {KE_KEY, 0x40, KEY_PREVIOUSSONG},
+       {KE_KEY, 0x41, KEY_NEXTSONG},
+       {KE_KEY, 0x43, KEY_STOP},
+       {KE_KEY, 0x45, KEY_PLAYPAUSE},
+       {KE_KEY, 0x50, KEY_EMAIL},
+       {KE_KEY, 0x51, KEY_WWW},
+       {KE_KEY, 0x5C, BTN_EXTRA},  /* Performance */
+       {KE_KEY, 0x5D, KEY_WLAN},
+       {KE_KEY, 0x61, KEY_SWITCHVIDEOMODE},
+       {KE_KEY, 0x6B, BTN_TOUCH}, /* Lock Mouse */
+       {KE_KEY, 0x82, KEY_CAMERA},
+       {KE_KEY, 0x8A, KEY_TV},
+       {KE_KEY, 0x95, KEY_MEDIA},
+       {KE_KEY, 0x99, KEY_PHONE},
+       {KE_END, 0},
+};
+
 /*
  * This function evaluates an ACPI method, given an int as parameter, the
  * method is searched within the scope of the handle, can be NULL. The output
@@ -720,8 +754,68 @@ static ssize_t store_gps(struct device *dev, struct device_attribute *attr,
        return store_status(buf, count, NULL, GPS_ON);
 }
 
+/*
+ * Hotkey functions
+ */
+static struct key_entry *asus_get_entry_by_scancode(int code)
+{
+       struct key_entry *key;
+
+       for (key = asus_keymap; key->type != KE_END; key++)
+               if (code == key->code)
+                       return key;
+
+       return NULL;
+}
+
+static struct key_entry *asus_get_entry_by_keycode(int code)
+{
+       struct key_entry *key;
+
+       for (key = asus_keymap; key->type != KE_END; key++)
+               if (code == key->keycode && key->type == KE_KEY)
+                       return key;
+
+       return NULL;
+}
+
+static int asus_getkeycode(struct input_dev *dev, int scancode, int *keycode)
+{
+       struct key_entry *key = asus_get_entry_by_scancode(scancode);
+
+       if (key && key->type == KE_KEY) {
+               *keycode = key->keycode;
+               return 0;
+       }
+
+       return -EINVAL;
+}
+
+static int asus_setkeycode(struct input_dev *dev, int scancode, int keycode)
+{
+       struct key_entry *key;
+       int old_keycode;
+
+       if (keycode < 0 || keycode > KEY_MAX)
+               return -EINVAL;
+
+       key = asus_get_entry_by_scancode(scancode);
+       if (key && key->type == KE_KEY) {
+               old_keycode = key->keycode;
+               key->keycode = keycode;
+               set_bit(keycode, dev->keybit);
+               if (!asus_get_entry_by_keycode(old_keycode))
+                       clear_bit(old_keycode, dev->keybit);
+               return 0;
+       }
+
+       return -EINVAL;
+}
+
 static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
 {
+       static struct key_entry *key;
+
        /* TODO Find a better way to handle events count. */
        if (!hotk)
                return;
@@ -738,10 +832,24 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
                lcd_blank(FB_BLANK_POWERDOWN);
        }
 
-       acpi_bus_generate_proc_event(hotk->device, event,
-                               hotk->event_count[event % 128]++);
-
-       return;
+       acpi_bus_generate_netlink_event(hotk->device->pnp.device_class,
+                                       dev_name(&hotk->device->dev), event,
+                                       hotk->event_count[event % 128]++);
+
+       if (hotk->inputdev) {
+               key = asus_get_entry_by_scancode(event);
+               if (!key)
+                       return ;
+
+               switch (key->type) {
+               case KE_KEY:
+                       input_report_key(hotk->inputdev, key->keycode, 1);
+                       input_sync(hotk->inputdev);
+                       input_report_key(hotk->inputdev, key->keycode, 0);
+                       input_sync(hotk->inputdev);
+                       break;
+               }
+       }
 }
 
 #define ASUS_CREATE_DEVICE_ATTR(_name)                                 \
@@ -959,6 +1067,38 @@ static int asus_hotk_get_info(void)
        return AE_OK;
 }
 
+static int asus_input_init(void)
+{
+       const struct key_entry *key;
+       int result;
+
+       hotk->inputdev = input_allocate_device();
+       if (!hotk->inputdev) {
+               printk(ASUS_INFO "Unable to allocate input device\n");
+               return 0;
+       }
+       hotk->inputdev->name = "Asus Laptop extra buttons";
+       hotk->inputdev->phys = ASUS_HOTK_FILE "/input0";
+       hotk->inputdev->id.bustype = BUS_HOST;
+       hotk->inputdev->getkeycode = asus_getkeycode;
+       hotk->inputdev->setkeycode = asus_setkeycode;
+
+       for (key = asus_keymap; key->type != KE_END; key++) {
+               switch (key->type) {
+               case KE_KEY:
+                       set_bit(EV_KEY, hotk->inputdev->evbit);
+                       set_bit(key->keycode, hotk->inputdev->keybit);
+                       break;
+               }
+       }
+       result = input_register_device(hotk->inputdev);
+       if (result) {
+               printk(ASUS_INFO "Unable to register input device\n");
+               input_free_device(hotk->inputdev);
+       }
+       return result;
+}
+
 static int asus_hotk_check(void)
 {
        int result = 0;
@@ -1044,7 +1184,7 @@ static int asus_hotk_add(struct acpi_device *device)
        /* GPS is on by default */
        write_status(NULL, 1, GPS_ON);
 
-      end:
+end:
        if (result) {
                kfree(hotk->name);
                kfree(hotk);
@@ -1091,10 +1231,17 @@ static void asus_led_exit(void)
        ASUS_LED_UNREGISTER(gled);
 }
 
+static void asus_input_exit(void)
+{
+       if (hotk->inputdev)
+               input_unregister_device(hotk->inputdev);
+}
+
 static void __exit asus_laptop_exit(void)
 {
        asus_backlight_exit();
        asus_led_exit();
+       asus_input_exit();
 
        acpi_bus_unregister_driver(&asus_hotk_driver);
        sysfs_remove_group(&asuspf_device->dev.kobj, &asuspf_attribute_group);
@@ -1216,6 +1363,10 @@ static int __init asus_laptop_init(void)
                printk(ASUS_INFO "Brightness ignored, must be controlled by "
                       "ACPI video driver\n");
 
+       result = asus_input_init();
+       if (result)
+               goto fail_input;
+
        result = asus_led_init(dev);
        if (result)
                goto fail_led;
@@ -1242,22 +1393,25 @@ static int __init asus_laptop_init(void)
 
        return 0;
 
-      fail_sysfs:
+fail_sysfs:
        platform_device_del(asuspf_device);
 
-      fail_platform_device2:
+fail_platform_device2:
        platform_device_put(asuspf_device);
 
-      fail_platform_device1:
+fail_platform_device1:
        platform_driver_unregister(&asuspf_driver);
 
-      fail_platform_driver:
+fail_platform_driver:
        asus_led_exit();
 
-      fail_led:
+fail_led:
+       asus_input_exit();
+
+fail_input:
        asus_backlight_exit();
 
-      fail_backlight:
+fail_backlight:
 
        return result;
 }
index 1e74988c7b2d2859871ca335d16af235a3ca7e6f..d63f26e666a4c0c369d340f7f90646d48a814c59 100644 (file)
@@ -143,6 +143,7 @@ struct asus_hotk {
                                                         S1300N, S5200N*/
                A4S,            /* Z81sp */
                F3Sa,           /* (Centrino) */
+               R1F,
                END_MODEL
        } model;                /* Models currently supported */
        u16 event_count[128];   /* Count for each event TODO make this better */
@@ -420,7 +421,18 @@ static struct model_data model_conf[END_MODEL] = {
                .display_get    = "\\ADVG",
                .display_set    = "SDSP",
        },
-
+       {
+               .name = "R1F",
+               .mt_bt_switch = "BLED",
+               .mt_mled = "MLED",
+               .mt_wled = "WLED",
+               .mt_lcd_switch = "\\Q10",
+               .lcd_status = "\\GP06",
+               .brightness_set = "SPLV",
+               .brightness_get = "GPLV",
+               .display_set = "SDSP",
+               .display_get = "\\INFB"
+       }
 };
 
 /* procdir we use */
@@ -1165,6 +1177,8 @@ static int asus_model_match(char *model)
                return W3V;
        else if (strncmp(model, "W5A", 3) == 0)
                return W5A;
+       else if (strncmp(model, "R1F", 3) == 0)
+               return R1F;
        else if (strncmp(model, "A4S", 3) == 0)
                return A4S;
        else if (strncmp(model, "F3Sa", 4) == 0)
index 9d93cb971e59a16df9ff014844d6a250983d6cd9..786ed8661cb08bb51e5f373904c5cc00fbf28159 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/uaccess.h>
 #include <linux/input.h>
 #include <linux/rfkill.h>
+#include <linux/pci.h>
 
 #define EEEPC_LAPTOP_VERSION   "0.1"
 
@@ -161,6 +162,10 @@ static struct key_entry eeepc_keymap[] = {
        {KE_KEY, 0x13, KEY_MUTE },
        {KE_KEY, 0x14, KEY_VOLUMEDOWN },
        {KE_KEY, 0x15, KEY_VOLUMEUP },
+       {KE_KEY, 0x1a, KEY_COFFEE },
+       {KE_KEY, 0x1b, KEY_ZOOM },
+       {KE_KEY, 0x1c, KEY_PROG2 },
+       {KE_KEY, 0x1d, KEY_PROG3 },
        {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE },
        {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE },
        {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE },
@@ -510,7 +515,43 @@ static int eeepc_hotk_check(void)
 static void notify_brn(void)
 {
        struct backlight_device *bd = eeepc_backlight_device;
-       bd->props.brightness = read_brightness(bd);
+       if (bd)
+               bd->props.brightness = read_brightness(bd);
+}
+
+static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
+{
+       struct pci_dev *dev;
+       struct pci_bus *bus = pci_find_bus(0, 1);
+
+       if (event != ACPI_NOTIFY_BUS_CHECK)
+               return;
+
+       if (!bus) {
+               printk(EEEPC_WARNING "Unable to find PCI bus 1?\n");
+               return;
+       }
+
+       if (get_acpi(CM_ASL_WLAN) == 1) {
+               dev = pci_get_slot(bus, 0);
+               if (dev) {
+                       /* Device already present */
+                       pci_dev_put(dev);
+                       return;
+               }
+               dev = pci_scan_single_device(bus, 0);
+               if (dev) {
+                       pci_bus_assign_resources(bus);
+                       if (pci_bus_add_device(dev))
+                               printk(EEEPC_ERR "Unable to hotplug wifi\n");
+               }
+       } else {
+               dev = pci_get_slot(bus, 0);
+               if (dev) {
+                       pci_remove_bus_device(dev);
+                       pci_dev_put(dev);
+               }
+       }
 }
 
 static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
@@ -520,8 +561,9 @@ static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
                return;
        if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
                notify_brn();
-       acpi_bus_generate_proc_event(ehotk->device, event,
-                                    ehotk->event_count[event % 128]++);
+       acpi_bus_generate_netlink_event(ehotk->device->pnp.device_class,
+                                       dev_name(&ehotk->device->dev), event,
+                                       ehotk->event_count[event % 128]++);
        if (ehotk->inputdev) {
                key = eepc_get_entry_by_scancode(event);
                if (key) {
@@ -539,6 +581,45 @@ static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
        }
 }
 
+static int eeepc_register_rfkill_notifier(char *node)
+{
+       acpi_status status = AE_OK;
+       acpi_handle handle;
+
+       status = acpi_get_handle(NULL, node, &handle);
+
+       if (ACPI_SUCCESS(status)) {
+               status = acpi_install_notify_handler(handle,
+                                                    ACPI_SYSTEM_NOTIFY,
+                                                    eeepc_rfkill_notify,
+                                                    NULL);
+               if (ACPI_FAILURE(status))
+                       printk(EEEPC_WARNING
+                              "Failed to register notify on %s\n", node);
+       } else
+               return -ENODEV;
+
+       return 0;
+}
+
+static void eeepc_unregister_rfkill_notifier(char *node)
+{
+       acpi_status status = AE_OK;
+       acpi_handle handle;
+
+       status = acpi_get_handle(NULL, node, &handle);
+
+       if (ACPI_SUCCESS(status)) {
+               status = acpi_remove_notify_handler(handle,
+                                                    ACPI_SYSTEM_NOTIFY,
+                                                    eeepc_rfkill_notify);
+               if (ACPI_FAILURE(status))
+                       printk(EEEPC_ERR
+                              "Error removing rfkill notify handler %s\n",
+                               node);
+       }
+}
+
 static int eeepc_hotk_add(struct acpi_device *device)
 {
        acpi_status status = AE_OK;
@@ -558,7 +639,7 @@ static int eeepc_hotk_add(struct acpi_device *device)
        ehotk->device = device;
        result = eeepc_hotk_check();
        if (result)
-               goto end;
+               goto ehotk_fail;
        status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
                                             eeepc_hotk_notify, ehotk);
        if (ACPI_FAILURE(status))
@@ -569,18 +650,25 @@ static int eeepc_hotk_add(struct acpi_device *device)
                                                           RFKILL_TYPE_WLAN);
 
                if (!ehotk->eeepc_wlan_rfkill)
-                       goto end;
+                       goto wlan_fail;
 
                ehotk->eeepc_wlan_rfkill->name = "eeepc-wlan";
                ehotk->eeepc_wlan_rfkill->toggle_radio = eeepc_wlan_rfkill_set;
                ehotk->eeepc_wlan_rfkill->get_state = eeepc_wlan_rfkill_state;
-               if (get_acpi(CM_ASL_WLAN) == 1)
+               if (get_acpi(CM_ASL_WLAN) == 1) {
                        ehotk->eeepc_wlan_rfkill->state =
                                RFKILL_STATE_UNBLOCKED;
-               else
+                       rfkill_set_default(RFKILL_TYPE_WLAN,
+                                          RFKILL_STATE_UNBLOCKED);
+               } else {
                        ehotk->eeepc_wlan_rfkill->state =
                                RFKILL_STATE_SOFT_BLOCKED;
-               rfkill_register(ehotk->eeepc_wlan_rfkill);
+                       rfkill_set_default(RFKILL_TYPE_WLAN,
+                                          RFKILL_STATE_SOFT_BLOCKED);
+               }
+               result = rfkill_register(ehotk->eeepc_wlan_rfkill);
+               if (result)
+                       goto wlan_fail;
        }
 
        if (get_acpi(CM_ASL_BLUETOOTH) != -1) {
@@ -588,27 +676,47 @@ static int eeepc_hotk_add(struct acpi_device *device)
                        rfkill_allocate(&device->dev, RFKILL_TYPE_BLUETOOTH);
 
                if (!ehotk->eeepc_bluetooth_rfkill)
-                       goto end;
+                       goto bluetooth_fail;
 
                ehotk->eeepc_bluetooth_rfkill->name = "eeepc-bluetooth";
                ehotk->eeepc_bluetooth_rfkill->toggle_radio =
                        eeepc_bluetooth_rfkill_set;
                ehotk->eeepc_bluetooth_rfkill->get_state =
                        eeepc_bluetooth_rfkill_state;
-               if (get_acpi(CM_ASL_BLUETOOTH) == 1)
+               if (get_acpi(CM_ASL_BLUETOOTH) == 1) {
                        ehotk->eeepc_bluetooth_rfkill->state =
                                RFKILL_STATE_UNBLOCKED;
-               else
+                       rfkill_set_default(RFKILL_TYPE_BLUETOOTH,
+                                          RFKILL_STATE_UNBLOCKED);
+               } else {
                        ehotk->eeepc_bluetooth_rfkill->state =
                                RFKILL_STATE_SOFT_BLOCKED;
-               rfkill_register(ehotk->eeepc_bluetooth_rfkill);
-       }
+                       rfkill_set_default(RFKILL_TYPE_BLUETOOTH,
+                                          RFKILL_STATE_SOFT_BLOCKED);
+               }
 
- end:
-       if (result) {
-               kfree(ehotk);
-               ehotk = NULL;
+               result = rfkill_register(ehotk->eeepc_bluetooth_rfkill);
+               if (result)
+                       goto bluetooth_fail;
        }
+
+       eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6");
+       eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7");
+
+       return 0;
+
+ bluetooth_fail:
+       if (ehotk->eeepc_bluetooth_rfkill)
+               rfkill_free(ehotk->eeepc_bluetooth_rfkill);
+       rfkill_unregister(ehotk->eeepc_wlan_rfkill);
+       ehotk->eeepc_wlan_rfkill = NULL;
+ wlan_fail:
+       if (ehotk->eeepc_wlan_rfkill)
+               rfkill_free(ehotk->eeepc_wlan_rfkill);
+ ehotk_fail:
+       kfree(ehotk);
+       ehotk = NULL;
+
        return result;
 }
 
@@ -622,6 +730,10 @@ static int eeepc_hotk_remove(struct acpi_device *device, int type)
                                            eeepc_hotk_notify);
        if (ACPI_FAILURE(status))
                printk(EEEPC_ERR "Error removing notify handler\n");
+
+       eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6");
+       eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7");
+
        kfree(ehotk);
        return 0;
 }
@@ -737,13 +849,21 @@ static void eeepc_backlight_exit(void)
 {
        if (eeepc_backlight_device)
                backlight_device_unregister(eeepc_backlight_device);
-       if (ehotk->inputdev)
-               input_unregister_device(ehotk->inputdev);
+       eeepc_backlight_device = NULL;
+}
+
+static void eeepc_rfkill_exit(void)
+{
        if (ehotk->eeepc_wlan_rfkill)
                rfkill_unregister(ehotk->eeepc_wlan_rfkill);
        if (ehotk->eeepc_bluetooth_rfkill)
                rfkill_unregister(ehotk->eeepc_bluetooth_rfkill);
-       eeepc_backlight_device = NULL;
+}
+
+static void eeepc_input_exit(void)
+{
+       if (ehotk->inputdev)
+               input_unregister_device(ehotk->inputdev);
 }
 
 static void eeepc_hwmon_exit(void)
@@ -762,6 +882,8 @@ static void eeepc_hwmon_exit(void)
 static void __exit eeepc_laptop_exit(void)
 {
        eeepc_backlight_exit();
+       eeepc_rfkill_exit();
+       eeepc_input_exit();
        eeepc_hwmon_exit();
        acpi_bus_unregister_driver(&eeepc_hotk_driver);
        sysfs_remove_group(&platform_device->dev.kobj,
@@ -865,6 +987,8 @@ fail_platform_driver:
 fail_hwmon:
        eeepc_backlight_exit();
 fail_backlight:
+       eeepc_input_exit();
+       eeepc_rfkill_exit();
        return result;
 }
 
index 7c789f0a94d71333be04a71ae0bf7e5ef64d0169..f41135f2fb299dea3efbd6cc68a6479ce7a5002a 100644 (file)
@@ -382,6 +382,11 @@ static int __init hp_wmi_input_setup(void)
                case KE_SW:
                        set_bit(EV_SW, hp_wmi_input_dev->evbit);
                        set_bit(key->keycode, hp_wmi_input_dev->swbit);
+
+                       /* Set initial dock state */
+                       input_report_switch(hp_wmi_input_dev, key->keycode,
+                                           hp_wmi_dock_state());
+                       input_sync(hp_wmi_input_dev);
                        break;
                }
        }
@@ -441,6 +446,7 @@ static int __init hp_wmi_bios_setup(struct platform_device *device)
                bluetooth_rfkill->toggle_radio = hp_wmi_bluetooth_set;
                bluetooth_rfkill->user_claim_unsupported = 1;
                err = rfkill_register(bluetooth_rfkill);
+               if (err)
                        goto register_bluetooth_error;
        }
 
@@ -457,9 +463,11 @@ static int __init hp_wmi_bios_setup(struct platform_device *device)
 
        return 0;
 register_wwan_err:
-       rfkill_unregister(bluetooth_rfkill);
+       if (bluetooth_rfkill)
+               rfkill_unregister(bluetooth_rfkill);
 register_bluetooth_error:
-       rfkill_unregister(wifi_rfkill);
+       if (wifi_rfkill)
+               rfkill_unregister(wifi_rfkill);
 add_sysfs_error:
        cleanup_sysfs(device);
        return err;
index f30db367c82eed36540b9db55f7e6b9abb72267b..c47a44dcb702abf97f52ce86fec941a9f5a17318 100644 (file)
@@ -507,7 +507,7 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 
        hkey_num = result & 0xf;
 
-       if (hkey_num < 0 || hkey_num > ARRAY_SIZE(pcc->keymap)) {
+       if (hkey_num < 0 || hkey_num >= ARRAY_SIZE(pcc->keymap)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
                                  "hotkey number out of range: %d\n",
                                  hkey_num));
index 366565aba865380672a3ed0e2e04e07b98d40238..c175e38a4cd56477e364ade9e5b4295b0b76142b 100644 (file)
@@ -152,11 +152,7 @@ static void __exit bq24022_exit(void)
        platform_driver_unregister(&bq24022_driver);
 }
 
-/*
- * make sure this is probed before gpio_vbus and pda_power,
- * but after asic3 or other GPIO expander drivers.
- */
-subsys_initcall(bq24022_init);
+module_init(bq24022_init);
 module_exit(bq24022_exit);
 
 MODULE_AUTHOR("Philipp Zabel");
index 7aa35248181bd4b021e5d638343e1bfd57459030..5056e23e441471f658276c802300d5a8aba3355f 100644 (file)
@@ -1435,7 +1435,7 @@ int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
        struct platform_device *pdev;
        int ret;
 
-       if (lednum > ARRAY_SIZE(wm8350->pmic.led) || lednum < 0) {
+       if (lednum >= ARRAY_SIZE(wm8350->pmic.led) || lednum < 0) {
                dev_err(wm8350->dev, "Invalid LED index %d\n", lednum);
                return -ENODEV;
        }
index cced4d108319600c24321021a3740a003df4cf84..81450fbd8b1246c3bca1841f8cd314af79264081 100644 (file)
@@ -241,6 +241,12 @@ config RTC_DRV_M41T80_WDT
          If you say Y here you will get support for the
          watchdog timer in the ST M41T60 and M41T80 RTC chips series.
 
+config RTC_DRV_DM355EVM
+       tristate "TI DaVinci DM355 EVM RTC"
+       depends on MFD_DM355EVM_MSP
+       help
+         Supports the RTC firmware in the MSP430 on the DM355 EVM.
+
 config RTC_DRV_TWL92330
        boolean "TI TWL92330/Menelaus"
        depends on MENELAUS
index 6e28021abb9d9494cf65b839de6f23a07014df91..0e697aa51caa5a2d8f891772ed793dd1d69d2f45 100644 (file)
@@ -23,6 +23,7 @@ obj-$(CONFIG_RTC_DRV_AT91SAM9)        += rtc-at91sam9.o
 obj-$(CONFIG_RTC_DRV_AU1XXX)   += rtc-au1xxx.o
 obj-$(CONFIG_RTC_DRV_BFIN)     += rtc-bfin.o
 obj-$(CONFIG_RTC_DRV_CMOS)     += rtc-cmos.o
+obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o
 obj-$(CONFIG_RTC_DRV_DS1216)   += rtc-ds1216.o
 obj-$(CONFIG_RTC_DRV_DS1286)   += rtc-ds1286.o
 obj-$(CONFIG_RTC_DRV_DS1302)   += rtc-ds1302.o
diff --git a/drivers/rtc/rtc-dm355evm.c b/drivers/rtc/rtc-dm355evm.c
new file mode 100644 (file)
index 0000000..58d4e18
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * rtc-dm355evm.c - access battery-backed counter in MSP430 firmware
+ *
+ * Copyright (c) 2008 by David Brownell
+ *
+ * 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/kernel.h>
+#include <linux/init.h>
+#include <linux/rtc.h>
+#include <linux/platform_device.h>
+
+#include <linux/i2c/dm355evm_msp.h>
+
+
+/*
+ * The MSP430 firmware on the DM355 EVM uses a watch crystal to feed
+ * a 1 Hz counter.  When a backup battery is supplied, that makes a
+ * reasonable RTC for applications where alarms and non-NTP drift
+ * compensation aren't important.
+ *
+ * The only real glitch is the inability to read or write all four
+ * counter bytes atomically:  the count may increment in the middle
+ * of an operation, causing trouble when the LSB rolls over.
+ *
+ * This driver was tested with firmware revision A4.
+ */
+union evm_time {
+       u8      bytes[4];
+       u32     value;
+};
+
+static int dm355evm_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+       union evm_time  time;
+       int             status;
+       int             tries = 0;
+
+       do {
+               /*
+                * Read LSB(0) to MSB(3) bytes.  Defend against the counter
+                * rolling over by re-reading until the value is stable,
+                * and assuming the four reads take at most a few seconds.
+                */
+               status = dm355evm_msp_read(DM355EVM_MSP_RTC_0);
+               if (status < 0)
+                       return status;
+               if (tries && time.bytes[0] == status)
+                       break;
+               time.bytes[0] = status;
+
+               status = dm355evm_msp_read(DM355EVM_MSP_RTC_1);
+               if (status < 0)
+                       return status;
+               if (tries && time.bytes[1] == status)
+                       break;
+               time.bytes[1] = status;
+
+               status = dm355evm_msp_read(DM355EVM_MSP_RTC_2);
+               if (status < 0)
+                       return status;
+               if (tries && time.bytes[2] == status)
+                       break;
+               time.bytes[2] = status;
+
+               status = dm355evm_msp_read(DM355EVM_MSP_RTC_3);
+               if (status < 0)
+                       return status;
+               if (tries && time.bytes[3] == status)
+                       break;
+               time.bytes[3] = status;
+
+       } while (++tries < 5);
+
+       dev_dbg(dev, "read timestamp %08x\n", time.value);
+
+       rtc_time_to_tm(le32_to_cpu(time.value), tm);
+       return 0;
+}
+
+static int dm355evm_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+       union evm_time  time;
+       unsigned long   value;
+       int             status;
+
+       rtc_tm_to_time(tm, &value);
+       time.value = cpu_to_le32(value);
+
+       dev_dbg(dev, "write timestamp %08x\n", time.value);
+
+       /*
+        * REVISIT handle non-atomic writes ... maybe just retry until
+        * byte[1] sticks (no rollover)?
+        */
+       status = dm355evm_msp_write(time.bytes[0], DM355EVM_MSP_RTC_0);
+       if (status < 0)
+               return status;
+
+       status = dm355evm_msp_write(time.bytes[1], DM355EVM_MSP_RTC_1);
+       if (status < 0)
+               return status;
+
+       status = dm355evm_msp_write(time.bytes[2], DM355EVM_MSP_RTC_2);
+       if (status < 0)
+               return status;
+
+       status = dm355evm_msp_write(time.bytes[3], DM355EVM_MSP_RTC_3);
+       if (status < 0)
+               return status;
+
+       return 0;
+}
+
+static struct rtc_class_ops dm355evm_rtc_ops = {
+       .read_time      = dm355evm_rtc_read_time,
+       .set_time       = dm355evm_rtc_set_time,
+};
+
+/*----------------------------------------------------------------------*/
+
+static int __devinit dm355evm_rtc_probe(struct platform_device *pdev)
+{
+       struct rtc_device *rtc;
+
+       rtc = rtc_device_register(pdev->name,
+                                 &pdev->dev, &dm355evm_rtc_ops, THIS_MODULE);
+       if (IS_ERR(rtc)) {
+               dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
+                       PTR_ERR(rtc));
+               return PTR_ERR(rtc);
+       }
+       platform_set_drvdata(pdev, rtc);
+
+       return 0;
+}
+
+static int __devexit dm355evm_rtc_remove(struct platform_device *pdev)
+{
+       struct rtc_device *rtc = platform_get_drvdata(pdev);
+
+       rtc_device_unregister(rtc);
+       platform_set_drvdata(pdev, NULL);
+       return 0;
+}
+
+/*
+ * I2C is used to talk to the MSP430, but this platform device is
+ * exposed by an MFD driver that manages I2C communications.
+ */
+static struct platform_driver rtc_dm355evm_driver = {
+       .probe          = dm355evm_rtc_probe,
+       .remove         = __devexit_p(dm355evm_rtc_remove),
+       .driver         = {
+               .owner  = THIS_MODULE,
+               .name   = "rtc-dm355evm",
+       },
+};
+
+static int __init dm355evm_rtc_init(void)
+{
+       return platform_driver_register(&rtc_dm355evm_driver);
+}
+module_init(dm355evm_rtc_init);
+
+static void __exit dm355evm_rtc_exit(void)
+{
+       platform_driver_unregister(&rtc_dm355evm_driver);
+}
+module_exit(dm355evm_rtc_exit);
+
+MODULE_LICENSE("GPL");
index e54b5c619bdf9827734194b474204da0cdff4fbe..e01b955db077e6be2a60387ec9a4b6777dd80692 100644 (file)
@@ -122,7 +122,6 @@ static const struct rtc_class_ops ds1390_rtc_ops = {
 
 static int __devinit ds1390_probe(struct spi_device *spi)
 {
-       struct rtc_device *rtc;
        unsigned char tmp;
        struct ds1390 *chip;
        int res;
index 3547558d2caf87290d81505c0181e353029ddd6b..324c74d2f6660939d42b62dd2b5239de1395877a 100644 (file)
@@ -161,6 +161,11 @@ static void jsm_tty_stop_rx(struct uart_port *port)
        channel->ch_bd->bd_ops->disable_receiver(channel);
 }
 
+static void jsm_tty_enable_ms(struct uart_port *port)
+{
+       /* Nothing needed */
+}
+
 static void jsm_tty_break(struct uart_port *port, int break_state)
 {
        unsigned long lock_flags;
@@ -345,6 +350,7 @@ static struct uart_ops jsm_ops = {
        .start_tx       = jsm_tty_start_tx,
        .send_xchar     = jsm_tty_send_xchar,
        .stop_rx        = jsm_tty_stop_rx,
+       .enable_ms      = jsm_tty_enable_ms,
        .break_ctl      = jsm_tty_break,
        .startup        = jsm_tty_open,
        .shutdown       = jsm_tty_close,
index a75b0db3726c2cbbddccfe3942badeabc23a70f5..20f36da62475aacb34d0dfbf5913b3b237562535 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef AGNX_H_
 #define AGNX_H_
 
+#include <linux/io.h>
+
 #include "xmit.h"
 
 #define PFX                            KBUILD_MODNAME ": "
index 8e2b4ca0651d0e60b97ac40f92bd0e3e2124363b..f516140ca976a97a915cca23d6048a711aa60121 100644 (file)
@@ -531,7 +531,7 @@ static int __devinit dma_test(struct ape_dev *ape, struct pci_dev *dev)
         goto fail;
 
        /* allocate and map coherently-cached memory for a DMA-able buffer */
-       /* @see 2.6.26.2/Documentation/DMA-mapping.txt line 318 */
+       /* @see Documentation/PCI/PCI-DMA-mapping.txt, near line 318 */
        buffer_virt = (u8 *)pci_alloc_consistent(dev, PAGE_SIZE * 4, &buffer_bus);
        if (!buffer_virt) {
                printk(KERN_DEBUG "Could not allocate coherent DMA buffer.\n");
@@ -846,7 +846,7 @@ static int __devinit probe(struct pci_dev *dev, const struct pci_device_id *id)
 
 #if 1 // @todo For now, disable 64-bit, because I do not understand the implications (DAC!)
        /* query for DMA transfer */
-       /* @see Documentation/DMA-mapping.txt */
+       /* @see Documentation/PCI/PCI-DMA-mapping.txt */
        if (!pci_set_dma_mask(dev, DMA_64BIT_MASK)) {
                pci_set_consistent_dma_mask(dev, DMA_64BIT_MASK);
                /* use 64-bit DMA */
index 6a4ceacb33f52de341fc75bbd28b6ddb18145e04..758131cad08a3e36e374a497f3f83d4f5dc08547 100644 (file)
@@ -319,6 +319,7 @@ int task_get_unused_fd_flags(struct task_struct *tsk, int flags)
        int fd, error;
        struct fdtable *fdt;
        unsigned long rlim_cur;
+       unsigned long irqs;
 
        if (files == NULL)
                return -ESRCH;
@@ -335,12 +336,11 @@ repeat:
         * N.B. For clone tasks sharing a files structure, this test
         * will limit the total number of files that can be opened.
         */
-       rcu_read_lock();
-       if (tsk->signal)
+       rlim_cur = 0;
+       if (lock_task_sighand(tsk, &irqs)) {
                rlim_cur = tsk->signal->rlim[RLIMIT_NOFILE].rlim_cur;
-       else
-               rlim_cur = 0;
-       rcu_read_unlock();
+               unlock_task_sighand(tsk, &irqs);
+       }
        if (fd >= rlim_cur)
                goto out;
 
@@ -2649,14 +2649,14 @@ static void binder_vma_open(struct vm_area_struct *vma)
 {
        struct binder_proc *proc = vma->vm_private_data;
        if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
-               printk(KERN_INFO "binder: %d open vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", proc->pid, vma->vm_start, vma->vm_end, (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, vma->vm_page_prot.pgprot);
+               printk(KERN_INFO "binder: %d open vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", proc->pid, vma->vm_start, vma->vm_end, (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, pgprot_val(vma->vm_page_prot));
        dump_stack();
 }
 static void binder_vma_close(struct vm_area_struct *vma)
 {
        struct binder_proc *proc = vma->vm_private_data;
        if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
-               printk(KERN_INFO "binder: %d close vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", proc->pid, vma->vm_start, vma->vm_end, (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, vma->vm_page_prot.pgprot);
+               printk(KERN_INFO "binder: %d close vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", proc->pid, vma->vm_start, vma->vm_end, (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, pgprot_val(vma->vm_page_prot));
        proc->vma = NULL;
 }
 
@@ -2677,7 +2677,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
                vma->vm_end = vma->vm_start + SZ_4M;
 
        if (binder_debug_mask & BINDER_DEBUG_OPEN_CLOSE)
-               printk(KERN_INFO "binder_mmap: %d %lx-%lx (%ld K) vma %lx pagep %lx\n", proc->pid, vma->vm_start, vma->vm_end, (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, vma->vm_page_prot.pgprot);
+               printk(KERN_INFO "binder_mmap: %d %lx-%lx (%ld K) vma %lx pagep %lx\n", proc->pid, vma->vm_start, vma->vm_end, (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, pgprot_val(vma->vm_page_prot));
 
        if (vma->vm_flags & FORBIDDEN_MMAP_FLAGS) {
                ret = -EPERM;
diff --git a/drivers/staging/android/lowmemorykiller.txt b/drivers/staging/android/lowmemorykiller.txt
new file mode 100644 (file)
index 0000000..bd5c0c0
--- /dev/null
@@ -0,0 +1,16 @@
+The lowmemorykiller driver lets user-space specify a set of memory thresholds
+where processes with a range of oom_adj values will get killed. Specify the
+minimum oom_adj values in /sys/module/lowmemorykiller/parameters/adj and the
+number of free pages in /sys/module/lowmemorykiller/parameters/minfree. Both
+files take a comma separated list of numbers in ascending order.
+
+For example, write "0,8" to /sys/module/lowmemorykiller/parameters/adj and
+"1024,4096" to /sys/module/lowmemorykiller/parameters/minfree to kill processes
+with a oom_adj value of 8 or higher when the free memory drops below 4096 pages
+and kill processes with a oom_adj value of 0 or higher when the free memory
+drops below 1024 pages.
+
+The driver considers memory used for caches to be free, but if a large
+percentage of the cached memory is locked this can be very inaccurate
+and processes may not get killed until the normal oom killer is triggered.
+
index bea68c9fc942ec4f63281f19bc72081671ab79da..903270cbbe0201d28df7cfe1ba0038249c494b21 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/platform_device.h>
 #include <linux/hrtimer.h>
 #include <linux/err.h>
-#include <asm/arch/gpio.h>
+#include <linux/gpio.h>
 
 #include "timed_gpio.h"
 
@@ -49,7 +49,8 @@ static ssize_t gpio_enable_show(struct device *dev, struct device_attribute *att
 
        if (hrtimer_active(&gpio_data->timer)) {
                ktime_t r = hrtimer_get_remaining(&gpio_data->timer);
-               remaining = r.tv.sec * 1000 + r.tv.nsec / 1000000;
+               struct timeval t = ktime_to_timeval(r);
+               remaining = t.tv_sec * 1000 + t.tv_usec;
        } else
                remaining = 0;
 
index b501bfb9c7548139b7de560a93d9497a3cfa8a90..b47ca1e7e383325ef24adbc8d408e116180704af 100644 (file)
@@ -1,6 +1,7 @@
 config COMEDI
        tristate "Data Acquision support (comedi)"
        default N
+       depends on m
        ---help---
          Enable support a wide range of data acquision devices
          for Linux.
index 6def83fa2c9666746b50c77d414a62638b800667..923af22a4686158a823bb6665125f2a7607e48d4 100644 (file)
@@ -4,6 +4,7 @@
 
 menuconfig MEILHAUS
        tristate "Meilhaus support"
+       depends on m
        ---help---
          If you have a Meilhaus card, say Y (or M) here.
 
@@ -18,7 +19,7 @@ if MEILHAUS
 config ME0600
        tristate "Meilhaus ME-600 support"
        default n
-       depends on PCI
+       depends on PCI && m
        help
          This driver supports the Meilhaus ME-600 family of boards
          that do data collection and multipurpose I/O.
@@ -29,7 +30,7 @@ config ME0600
 config ME0900
        tristate "Meilhaus ME-900 support"
        default n
-       depends on PCI
+       depends on PCI && m
        help
          This driver supports the Meilhaus ME-900 family of boards
          that do data collection and multipurpose I/O.
@@ -40,7 +41,7 @@ config ME0900
 config ME1000
        tristate "Meilhaus ME-1000 support"
        default n
-       depends on PCI
+       depends on PCI && m
        help
          This driver supports the Meilhaus ME-1000 family of boards
          that do data collection and multipurpose I/O.
@@ -51,7 +52,7 @@ config ME1000
 config ME1400
        tristate "Meilhaus ME-1400 support"
        default n
-       depends on PCI
+       depends on PCI && m
        help
          This driver supports the Meilhaus ME-1400 family of boards
          that do data collection and multipurpose I/O.
@@ -62,7 +63,7 @@ config ME1400
 config ME1600
        tristate "Meilhaus ME-1600 support"
        default n
-       depends on PCI
+       depends on PCI && m
        help
          This driver supports the Meilhaus ME-1600 family of boards
          that do data collection and multipurpose I/O.
@@ -73,7 +74,7 @@ config ME1600
 config ME4600
        tristate "Meilhaus ME-4600 support"
        default n
-       depends on PCI
+       depends on PCI && m
        help
          This driver supports the Meilhaus ME-4600 family of boards
          that do data collection and multipurpose I/O.
@@ -84,7 +85,7 @@ config ME4600
 config ME6000
        tristate "Meilhaus ME-6000 support"
        default n
-       depends on PCI
+       depends on PCI && m
        help
          This driver supports the Meilhaus ME-6000 family of boards
          that do data collection and multipurpose I/O.
@@ -95,7 +96,7 @@ config ME6000
 config ME8100
        tristate "Meilhaus ME-8100 support"
        default n
-       depends on PCI
+       depends on PCI && m
        help
          This driver supports the Meilhaus ME-8100 family of boards
          that do data collection and multipurpose I/O.
@@ -106,7 +107,7 @@ config ME8100
 config ME8200
        tristate "Meilhaus ME-8200 support"
        default n
-       depends on PCI
+       depends on PCI && m
        help
          This driver supports the Meilhaus ME-8200 family of boards
          that do data collection and multipurpose I/O.
@@ -117,7 +118,7 @@ config ME8200
 config MEDUMMY
        tristate "Meilhaus dummy driver"
        default n
-       depends on PCI
+       depends on PCI && m
        help
          This provides a dummy driver for the Meilhaus driver package
 
index ec343ef53a85c63b54393a06f4ee95c77e1dc12c..0d111ddfabb22c15408b14b891c094022fe85225 100644 (file)
@@ -1026,7 +1026,7 @@ static int poch_ioctl(struct inode *inode, struct file *filp,
                }
                break;
        case POCH_IOC_GET_COUNTERS:
-               if (access_ok(VERIFY_WRITE, argp, sizeof(struct poch_counters)))
+               if (!access_ok(VERIFY_WRITE, argp, sizeof(struct poch_counters)))
                        return -EFAULT;
 
                spin_lock_irq(&channel->counters_lock);
index 72e209276ea74b6af2bef0b439f053ff3689c9b6..22f93dd0ba034ac741dcba70642fbf5272957070 100644 (file)
@@ -406,8 +406,20 @@ void usbip_start_threads(struct usbip_device *ud)
        /*
         * threads are invoked per one device (per one connection).
         */
-       kernel_thread(usbip_thread, (void *)&ud->tcp_rx, 0);
-       kernel_thread(usbip_thread, (void *)&ud->tcp_tx, 0);
+       int retval;
+
+       retval = kernel_thread(usbip_thread, (void *)&ud->tcp_rx, 0);
+       if (retval < 0) {
+               printk(KERN_ERR "Creating tcp_rx thread for ud %p failed.\n",
+                               ud);
+               return;
+       }
+       retval = kernel_thread(usbip_thread, (void *)&ud->tcp_tx, 0);
+       if (retval < 0) {
+               printk(KERN_ERR "Creating tcp_tx thread for ud %p failed.\n",
+                               ud);
+               return;
+       }
 
        /* confirm threads are starting */
        wait_for_completion(&ud->tcp_rx.thread_done);
index 577c0d29849d10d200e3a9f7656198a740677f54..2291c5f5af5152b3aadcf029f48fcc73dd05fba6 100644 (file)
@@ -170,12 +170,17 @@ void asl_stop(struct whc *whc)
 void asl_update(struct whc *whc, uint32_t wusbcmd)
 {
        struct wusbhc *wusbhc = &whc->wusbhc;
+       long t;
 
        mutex_lock(&wusbhc->mutex);
        if (wusbhc->active) {
                whc_write_wusbcmd(whc, wusbcmd, wusbcmd);
-               wait_event(whc->async_list_wq,
-                          (le_readl(whc->base + WUSBCMD) & WUSBCMD_ASYNC_UPDATED) == 0);
+               t = wait_event_timeout(
+                       whc->async_list_wq,
+                       (le_readl(whc->base + WUSBCMD) & WUSBCMD_ASYNC_UPDATED) == 0,
+                       msecs_to_jiffies(1000));
+               if (t == 0)
+                       whc_hw_error(whc, "ASL update timeout");
        }
        mutex_unlock(&wusbhc->mutex);
 }
index d498e72032174dc66e9f00c09541f49267f00028..6afa2e379160ac01a3c0337f8599437590421ffc 100644 (file)
@@ -87,3 +87,18 @@ out:
 
        return ret;
 }
+
+/**
+ * whc_hw_error - recover from a hardware error
+ * @whc:    the WHCI HC that broke.
+ * @reason: a description of the failure.
+ *
+ * Recover from broken hardware with a full reset.
+ */
+void whc_hw_error(struct whc *whc, const char *reason)
+{
+       struct wusbhc *wusbhc = &whc->wusbhc;
+
+       dev_err(&whc->umc->dev, "hardware error: %s\n", reason);
+       wusbhc_reset_all(wusbhc);
+}
index 2ae5abf69a6a0693dfea85e3be1f861874efec78..7dc85a0bee7c2f563c3c89f8e7d5aa9229ffd4df 100644 (file)
@@ -183,12 +183,17 @@ void pzl_stop(struct whc *whc)
 void pzl_update(struct whc *whc, uint32_t wusbcmd)
 {
        struct wusbhc *wusbhc = &whc->wusbhc;
+       long t;
 
        mutex_lock(&wusbhc->mutex);
        if (wusbhc->active) {
                whc_write_wusbcmd(whc, wusbcmd, wusbcmd);
-               wait_event(whc->periodic_list_wq,
-                          (le_readl(whc->base + WUSBCMD) & WUSBCMD_PERIODIC_UPDATED) == 0);
+               t = wait_event_timeout(
+                       whc->periodic_list_wq,
+                       (le_readl(whc->base + WUSBCMD) & WUSBCMD_PERIODIC_UPDATED) == 0,
+                       msecs_to_jiffies(1000));
+               if (t == 0)
+                       whc_hw_error(whc, "PZL update timeout");
        }
        mutex_unlock(&wusbhc->mutex);
 }
index 0f3540f04f5316b9a071f9d4d6a49fc3860bb0b9..d3543a181dc9d7eacbb0a99bbd52fadecd8ee433 100644 (file)
@@ -137,6 +137,7 @@ void whc_clean_up(struct whc *whc);
 /* hw.c */
 void whc_write_wusbcmd(struct whc *whc, u32 mask, u32 val);
 int whc_do_gencmd(struct whc *whc, u32 cmd, u32 params, void *addr, size_t len);
+void whc_hw_error(struct whc *whc, const char *reason);
 
 /* wusb.c */
 int whc_wusbhc_start(struct wusbhc *wusbhc);
index e2e7e4bc84635319f763201366c4fb37fc6ef741..8e18141bb2e08d550351f3f8b1b0b91b6f2409db 100644 (file)
@@ -386,6 +386,7 @@ static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc,
                          | USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED);
        port->change |= USB_PORT_STAT_C_CONNECTION | USB_PORT_STAT_C_ENABLE;
        if (wusb_dev) {
+               dev_dbg(wusbhc->dev, "disconnecting device from port %d\n", wusb_dev->port_idx);
                if (!list_empty(&wusb_dev->cack_node))
                        list_del_init(&wusb_dev->cack_node);
                /* For the one in cack_add() */
index 3937bf6f8cefcb4fdf3a9e7ec07eb70058f335d5..9fe4246cecb98d5bb5fa2cb77ca23bd3bae90c9e 100644 (file)
@@ -100,6 +100,9 @@ static int wusbhc_rh_port_reset(struct wusbhc *wusbhc, u8 port_idx)
        struct wusb_port *port = wusb_port_by_idx(wusbhc, port_idx);
        struct wusb_dev *wusb_dev = port->wusb_dev;
 
+       if (wusb_dev == NULL)
+               return -ENOTCONN;
+
        port->status |= USB_PORT_STAT_RESET;
        port->change |= USB_PORT_STAT_C_RESET;
 
index c8185e6b0cd51b89e706393b43d50090e3a8d5d3..c13cec7dcbc5ee6cdfa6a6ee0ff29280de910ce3 100644 (file)
@@ -15,7 +15,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-#include <linux/version.h>
 #include <linux/kernel.h>
 #include <linux/uwb.h>
 
index 2b4f9406789d0d7eb2e4deadb9446bd22208dd1b..4f5ca99a04b9de20c513b015e84e7b6d0ad972e3 100644 (file)
@@ -66,14 +66,14 @@ static void uwb_rc_set_drp_cmd_done(struct uwb_rc *rc, void *arg,
        } else
                dev_err(&rc->uwb_dev.dev, "SET-DRP-IE: timeout\n");
 
-       spin_lock(&rc->rsvs_lock);
+       spin_lock_bh(&rc->rsvs_lock);
        if (rc->set_drp_ie_pending > 1) {
                rc->set_drp_ie_pending = 0;
                uwb_rsv_queue_update(rc);       
        } else {
                rc->set_drp_ie_pending = 0;     
        }
-       spin_unlock(&rc->rsvs_lock);
+       spin_unlock_bh(&rc->rsvs_lock);
 }
 
 /**
index ec6eecb32f30de583a7920450075004861665158..6b76f4bb4cc7dc5a25da658c0cc2d006ba3662f0 100644 (file)
@@ -114,7 +114,8 @@ void uwb_rsv_dump(char *text, struct uwb_rsv *rsv)
                devaddr = rsv->target.devaddr;
        uwb_dev_addr_print(target, sizeof(target), &devaddr);
 
-       dev_dbg(dev, "rsv %s -> %s: %s\n", owner, target, uwb_rsv_state_str(rsv->state));
+       dev_dbg(dev, "rsv %s %s -> %s: %s\n",
+               text, owner, target, uwb_rsv_state_str(rsv->state));
 }
 
 static void uwb_rsv_release(struct kref *kref)
@@ -511,8 +512,7 @@ void uwb_rsv_remove(struct uwb_rsv *rsv)
 
        if (uwb_rsv_is_owner(rsv))
                uwb_rsv_put_stream(rsv);
-       
-       del_timer_sync(&rsv->timer);
+
        uwb_dev_put(rsv->owner);
        if (rsv->target.type == UWB_RSV_TARGET_DEV)
                uwb_dev_put(rsv->target.dev);
@@ -870,7 +870,7 @@ void uwb_rsv_queue_update(struct uwb_rc *rc)
  */
 void uwb_rsv_sched_update(struct uwb_rc *rc)
 {
-       spin_lock(&rc->rsvs_lock);
+       spin_lock_bh(&rc->rsvs_lock);
        if (!delayed_work_pending(&rc->rsv_update_work)) {
                if (rc->set_drp_ie_pending > 0) {
                        rc->set_drp_ie_pending++;
@@ -879,7 +879,7 @@ void uwb_rsv_sched_update(struct uwb_rc *rc)
                uwb_rsv_queue_update(rc);
        }
 unlock:
-       spin_unlock(&rc->rsvs_lock);
+       spin_unlock_bh(&rc->rsvs_lock);
 }
 
 /*
@@ -943,13 +943,22 @@ void uwb_rsv_remove_all(struct uwb_rc *rc)
 
        mutex_lock(&rc->rsvs_mutex);
        list_for_each_entry_safe(rsv, t, &rc->reservations, rc_node) {
-               uwb_rsv_remove(rsv);
+               if (rsv->state != UWB_RSV_STATE_NONE)
+                       uwb_rsv_set_state(rsv, UWB_RSV_STATE_NONE);
+               del_timer_sync(&rsv->timer);
        }
        /* Cancel any postponed update. */
        rc->set_drp_ie_pending = 0;
        mutex_unlock(&rc->rsvs_mutex);
 
        cancel_delayed_work_sync(&rc->rsv_update_work);
+       flush_workqueue(rc->rsv_workq);
+
+       mutex_lock(&rc->rsvs_mutex);
+       list_for_each_entry_safe(rsv, t, &rc->reservations, rc_node) {
+               uwb_rsv_remove(rsv);
+       }
+       mutex_unlock(&rc->rsvs_mutex);
 }
 
 void uwb_rsv_init(struct uwb_rc *rc)
index c94f71980c1bb10e09bac976f37551412f5c5837..f0267706cb458701ed1a754dddf73276ee28872a 100644 (file)
@@ -41,7 +41,7 @@ menuconfig FB
          You need an utility program called fbset to make full use of frame
          buffer devices. Please read <file:Documentation/fb/framebuffer.txt>
          and the Framebuffer-HOWTO at
-         <http://www.tahallah.demon.co.uk/programming/prog.html> for more
+         <http://www.munted.org.uk/programming/Framebuffer-HOWTO-1.2.html> for more
          information.
 
          Say Y here and to the driver for your graphics board below if you
index db16112cf197c0199df67949f68b3ebf07e7107c..e6e299feb51bd5151eba736e03309d89da1d29ae 100644 (file)
@@ -1475,7 +1475,7 @@ static int aty128fb_set_par(struct fb_info *info)
        aty128_set_pll(&par->pll, par);
        aty128_set_fifo(&par->fifo_reg, par);
 
-       config = aty_ld_le32(CONFIG_CNTL) & ~3;
+       config = aty_ld_le32(CNFG_CNTL) & ~3;
 
 #if defined(__BIG_ENDIAN)
        if (par->crtc.bpp == 32)
@@ -1484,7 +1484,7 @@ static int aty128fb_set_par(struct fb_info *info)
                config |= 1;    /* make aperture do 16 bit swapping */
 #endif
 
-       aty_st_le32(CONFIG_CNTL, config);
+       aty_st_le32(CNFG_CNTL, config);
        aty_st_8(CRTC_EXT_CNTL + 1, 0); /* turn the video back on */
 
        info->fix.line_length = (par->crtc.vxres * par->crtc.bpp) >> 3;
@@ -1875,7 +1875,7 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i
        u32 dac;
 
        /* Get the chip revision */
-       chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F;
+       chip_rev = (aty_ld_le32(CNFG_CNTL) >> 16) & 0x1F;
 
        strcpy(video_card, "Rage128 XX ");
        video_card[8] = ent->device >> 8;
@@ -2057,7 +2057,7 @@ static int __devinit aty128_probe(struct pci_dev *pdev, const struct pci_device_
 
        /* Grab memory size from the card */
        // How does this relate to the resource length from the PCI hardware?
-       par->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF;
+       par->vram_size = aty_ld_le32(CNFG_MEMSIZE) & 0x03FFFFFF;
 
        /* Virtualize the framebuffer */
        info->screen_base = ioremap(fb_addr, par->vram_size);
@@ -2374,6 +2374,8 @@ static void aty128_set_suspend(struct aty128fb_par *par, int suspend)
        /* Set the chip into the appropriate suspend mode (we use D2,
         * D3 would require a complete re-initialisation of the chip,
         * including PCI config registers, clocks, AGP configuration, ...)
+        *
+        * For resume, the core will have already brought us back to D0
         */
        if (suspend) {
                /* Make sure CRTC2 is reset. Remove that the day we decide to
@@ -2391,17 +2393,9 @@ static void aty128_set_suspend(struct aty128fb_par *par, int suspend)
                aty_st_le32(BUS_CNTL1, 0x00000010);
                aty_st_le32(MEM_POWER_MISC, 0x0c830000);
                mdelay(100);
-               pci_read_config_word(pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command);
+
                /* Switch PCI power management to D2 */
-               pci_write_config_word(pdev, par->pm_reg+PCI_PM_CTRL,
-                       (pwr_command & ~PCI_PM_CTRL_STATE_MASK) | 2);
-               pci_read_config_word(pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command);
-       } else {
-               /* Switch back PCI power management to D0 */
-               mdelay(100);
-               pci_write_config_word(pdev, par->pm_reg+PCI_PM_CTRL, 0);
-               pci_read_config_word(pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command);
-               mdelay(100);
+               pci_set_power_state(pdev, PCI_D2);
        }
 }
 
@@ -2410,6 +2404,12 @@ static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        struct fb_info *info = pci_get_drvdata(pdev);
        struct aty128fb_par *par = info->par;
 
+       /* Because we may change PCI D state ourselves, we need to
+        * first save the config space content so the core can
+        * restore it properly on resume.
+        */
+       pci_save_state(pdev);
+
        /* We don't do anything but D2, for now we return 0, but
         * we may want to change that. How do we know if the BIOS
         * can properly take care of D3 ? Also, with swsusp, we
@@ -2476,6 +2476,11 @@ static int aty128_do_resume(struct pci_dev *pdev)
        if (pdev->dev.power.power_state.event == PM_EVENT_ON)
                return 0;
 
+       /* PCI state will have been restored by the core, so
+        * we should be in D0 now with our config space fully
+        * restored
+        */
+
        /* Wakeup chip */
        aty128_set_suspend(par, 0);
        par->asleep = 0;
index cc6b470073daa3085c0694a77909fcebec10fd6e..1207c208a30b32f243a6ab4ec952d811d69fe248 100644 (file)
 #if defined(CONFIG_PM) || defined(CONFIG_PMAC_BACKLIGHT) || \
 defined (CONFIG_FB_ATY_GENERIC_LCD) || defined(CONFIG_FB_ATY_BACKLIGHT)
 static const u32 lt_lcd_regs[] = {
-       CONFIG_PANEL_LG,
+       CNFG_PANEL_LG,
        LCD_GEN_CNTL_LG,
        DSTN_CONTROL_LG,
        HFB_PITCH_ADDR_LG,
@@ -446,7 +446,7 @@ static int __devinit correct_chipset(struct atyfb_par *par)
        par->pll_limits.ecp_max = aty_chips[i].ecp_max;
        par->features = aty_chips[i].features;
 
-       chip_id = aty_ld_le32(CONFIG_CHIP_ID, par);
+       chip_id = aty_ld_le32(CNFG_CHIP_ID, par);
        type = chip_id & CFG_CHIP_TYPE;
        rev = (chip_id & CFG_CHIP_REV) >> 24;
 
@@ -629,7 +629,7 @@ static void aty_get_crtc(const struct atyfb_par *par, struct crtc *crtc)
                    crtc->lcd_index = aty_ld_le32(LCD_INDEX, par);
                    aty_st_le32(LCD_INDEX, crtc->lcd_index, par);
                }
-               crtc->lcd_config_panel = aty_ld_lcd(CONFIG_PANEL, par);
+               crtc->lcd_config_panel = aty_ld_lcd(CNFG_PANEL, par);
                crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par);
 
 
@@ -676,7 +676,7 @@ static void aty_set_crtc(const struct atyfb_par *par, const struct crtc *crtc)
                aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl & ~(CRTC_EXT_DISP_EN | CRTC_EN), par);
 
                /* update non-shadow registers first */
-               aty_st_lcd(CONFIG_PANEL, crtc->lcd_config_panel, par);
+               aty_st_lcd(CNFG_PANEL, crtc->lcd_config_panel, par);
                aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl &
                        ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN), par);
 
@@ -858,7 +858,7 @@ static int aty_var_to_crtc(const struct fb_info *info,
                if (!M64_HAS(MOBIL_BUS))
                        crtc->lcd_index |= CRTC2_DISPLAY_DIS;
 
-               crtc->lcd_config_panel = aty_ld_lcd(CONFIG_PANEL, par) | 0x4000;
+               crtc->lcd_config_panel = aty_ld_lcd(CNFG_PANEL, par) | 0x4000;
                crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par) & ~CRTC_RW_SELECT;
 
                crtc->lcd_gen_cntl &=
@@ -1978,7 +1978,7 @@ static int aty_power_mgmt(int sleep, struct atyfb_par *par)
 
        return timeout ? 0 : -EIO;
 }
-#endif
+#endif /* CONFIG_PPC_PMAC */
 
 static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 {
@@ -2002,9 +2002,15 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        par->asleep = 1;
        par->lock_blank = 1;
 
+       /* Because we may change PCI D state ourselves, we need to
+        * first save the config space content so the core can
+        * restore it properly on resume.
+        */
+       pci_save_state(pdev);
+
 #ifdef CONFIG_PPC_PMAC
        /* Set chip to "suspend" mode */
-       if (aty_power_mgmt(1, par)) {
+       if (machine_is(powermac) && aty_power_mgmt(1, par)) {
                par->asleep = 0;
                par->lock_blank = 0;
                atyfb_blank(FB_BLANK_UNBLANK, info);
@@ -2047,11 +2053,15 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
 
        acquire_console_sem();
 
+       /* PCI state will have been restored by the core, so
+        * we should be in D0 now with our config space fully
+        * restored
+        */
+
 #ifdef CONFIG_PPC_PMAC
-       if (pdev->dev.power.power_state.event == 2)
+       if (machine_is(powermac) &&
+           pdev->dev.power.power_state.event == PM_EVENT_SUSPEND)
                aty_power_mgmt(0, par);
-#else
-       pci_set_power_state(pdev, PCI_D0);
 #endif
 
        aty_resume_chip(info);
@@ -2254,7 +2264,7 @@ static int __devinit aty_init(struct fb_info *info)
        if (!M64_HAS(INTEGRATED)) {
                u32 stat0;
                u8 dac_type, dac_subtype, clk_type;
-               stat0 = aty_ld_le32(CONFIG_STAT0, par);
+               stat0 = aty_ld_le32(CNFG_STAT0, par);
                par->bus_type = (stat0 >> 0) & 0x07;
                par->ram_type = (stat0 >> 3) & 0x07;
                ramname = aty_gx_ram[par->ram_type];
@@ -2324,7 +2334,7 @@ static int __devinit aty_init(struct fb_info *info)
                par->dac_ops = &aty_dac_ct;
                par->pll_ops = &aty_pll_ct;
                par->bus_type = PCI;
-               par->ram_type = (aty_ld_le32(CONFIG_STAT0, par) & 0x07);
+               par->ram_type = (aty_ld_le32(CNFG_STAT0, par) & 0x07);
                ramname = aty_ct_ram[par->ram_type];
                /* for many chips, the mclk is 67 MHz for SDRAM, 63 MHz otherwise */
                if (par->pll_limits.mclk == 67 && par->ram_type < SDRAM)
@@ -2433,7 +2443,7 @@ static int __devinit aty_init(struct fb_info *info)
                }
 
        if (M64_HAS(MAGIC_VRAM_SIZE)) {
-               if (aty_ld_le32(CONFIG_STAT1, par) & 0x40000000)
+               if (aty_ld_le32(CNFG_STAT1, par) & 0x40000000)
                        info->fix.smem_len += 0x400000;
        }
 
@@ -2946,7 +2956,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
                 * Fix PROMs idea of MEM_CNTL settings...
                 */
                mem = aty_ld_le32(MEM_CNTL, par);
-               chip_id = aty_ld_le32(CONFIG_CHIP_ID, par);
+               chip_id = aty_ld_le32(CNFG_CHIP_ID, par);
                if (((chip_id & CFG_CHIP_TYPE) == VT_CHIP_ID) && !((chip_id >> 24) & 1)) {
                        switch (mem & 0x0f) {
                        case 3:
@@ -2964,7 +2974,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
                        default:
                                break;
                        }
-                       if ((aty_ld_le32(CONFIG_STAT0, par) & 7) >= SDRAM)
+                       if ((aty_ld_le32(CNFG_STAT0, par) & 7) >= SDRAM)
                                mem &= ~(0x00700000);
                }
                mem &= ~(0xcf80e000);   /* Turn off all undocumented bits. */
@@ -3572,7 +3582,7 @@ static int __init atyfb_atari_probe(void)
                }
 
                /* Fake pci_id for correct_chipset() */
-               switch (aty_ld_le32(CONFIG_CHIP_ID, par) & CFG_CHIP_TYPE) {
+               switch (aty_ld_le32(CNFG_CHIP_ID, par) & CFG_CHIP_TYPE) {
                case 0x00d7:
                        par->pci_id = PCI_CHIP_MACH64GX;
                        break;
index c50c7cf26fe9d82b27acbd3f0312841392c19d74..2745b853948529415b885a91a5104c3d6e3ad026 100644 (file)
@@ -8,6 +8,9 @@
 #include <asm/io.h>
 #include <video/mach64.h>
 #include "atyfb.h"
+#ifdef CONFIG_PPC
+#include <asm/machdep.h>
+#endif
 
 #undef DEBUG
 
@@ -536,6 +539,14 @@ static int __devinit aty_init_pll_ct(const struct fb_info *info,
        pll->ct.xclk_post_div_real = postdividers[xpost_div];
        pll->ct.mclk_fb_div = q * pll->ct.xclk_post_div_real / 8;
 
+#ifdef CONFIG_PPC
+       if (machine_is(powermac)) {
+               /* Override PLL_EXT_CNTL & 0x07. */
+               pll->ct.xclk_post_div = xpost_div;
+               pll->ct.xclk_ref_div = 1;
+       }
+#endif
+
 #ifdef DEBUG
        pllmclk = (1000000 * pll->ct.mclk_fb_mult * pll->ct.mclk_fb_div) /
                        (par->ref_clk_per * pll->ct.pll_ref_div);
index d0f1a7fc2c9df7da492102db83247624c94dac9f..16bb7e3c0310eb83a105101fa59c22c910b9adf7 100644 (file)
@@ -1936,8 +1936,8 @@ static void fixup_memory_mappings(struct radeonfb_info *rinfo)
        OUTREG(CRTC_GEN_CNTL, save_crtc_gen_cntl | CRTC_DISP_REQ_EN_B);
        mdelay(100);
 
-       aper_base = INREG(CONFIG_APER_0_BASE);
-       aper_size = INREG(CONFIG_APER_SIZE);
+       aper_base = INREG(CNFG_APER_0_BASE);
+       aper_size = INREG(CNFG_APER_SIZE);
 
 #ifdef SET_MC_FB_FROM_APERTURE
        /* Set framebuffer to be at the same address as set in PCI BAR */
@@ -2024,11 +2024,11 @@ static void radeon_identify_vram(struct radeonfb_info *rinfo)
                      ~CRTC_H_CUTOFF_ACTIVE_EN);
           }
         } else {
-          tmp = INREG(CONFIG_MEMSIZE);
+          tmp = INREG(CNFG_MEMSIZE);
         }
 
        /* mem size is bits [28:0], mask off the rest */
-       rinfo->video_ram = tmp & CONFIG_MEMSIZE_MASK;
+       rinfo->video_ram = tmp & CNFG_MEMSIZE_MASK;
 
        /*
         * Hack to get around some busted production M6's
@@ -2228,7 +2228,7 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev,
         */
        rinfo->errata = 0;
        if (rinfo->family == CHIP_FAMILY_R300 &&
-           (INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK)
+           (INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK)
            == CFG_ATI_REV_A11)
                rinfo->errata |= CHIP_ERRATA_R300_CG;
 
index 675abdafc2d8d047741ed3b8fdf2c0291343440c..ca5f0dc28546ec742f33d77579aa472556aa1375 100644 (file)
@@ -333,7 +333,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo)
        if (!rinfo->has_CRTC2) {
                 tmp = INPLL(pllSCLK_CNTL);
 
-               if ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) > CFG_ATI_REV_A13)
+               if ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) > CFG_ATI_REV_A13)
                     tmp &= ~(SCLK_CNTL__FORCE_CP       | SCLK_CNTL__FORCE_RB);
                 tmp &= ~(SCLK_CNTL__FORCE_HDP          | SCLK_CNTL__FORCE_DISP1 |
                         SCLK_CNTL__FORCE_TOP           | SCLK_CNTL__FORCE_SE   |
@@ -468,9 +468,9 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo)
 
        /*RAGE_6::A11 A12 A12N1 A13, RV250::A11 A12, R300*/
        if ((rinfo->family == CHIP_FAMILY_RV250 &&
-            ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) ||
+            ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) ||
            ((rinfo->family == CHIP_FAMILY_RV100) &&
-            ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) <= CFG_ATI_REV_A13))) {
+            ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) <= CFG_ATI_REV_A13))) {
                tmp |= SCLK_CNTL__FORCE_CP;
                tmp |= SCLK_CNTL__FORCE_VIP;
        }
@@ -486,7 +486,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo)
                /* RV200::A11 A12 RV250::A11 A12 */
                if (((rinfo->family == CHIP_FAMILY_RV200) ||
                     (rinfo->family == CHIP_FAMILY_RV250)) &&
-                   ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13))
+                   ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13))
                        tmp |= SCLK_MORE_CNTL__FORCEON;
 
                OUTPLL(pllSCLK_MORE_CNTL, tmp);
@@ -497,7 +497,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo)
        /* RV200::A11 A12, RV250::A11 A12 */
        if (((rinfo->family == CHIP_FAMILY_RV200) ||
             (rinfo->family == CHIP_FAMILY_RV250)) &&
-           ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) {
+           ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) {
                tmp = INPLL(pllPLL_PWRMGT_CNTL);
                tmp |= PLL_PWRMGT_CNTL__TCL_BYPASS_DISABLE;
                OUTPLL(pllPLL_PWRMGT_CNTL, tmp);
@@ -702,7 +702,7 @@ static void radeon_pm_restore_regs(struct radeonfb_info *rinfo)
        OUTREG(DISPLAY_BASE_ADDR, rinfo->save_regs[31]);
        OUTREG(MC_AGP_LOCATION, rinfo->save_regs[32]);
        OUTREG(CRTC2_DISPLAY_BASE_ADDR, rinfo->save_regs[33]);
-       OUTREG(CONFIG_MEMSIZE, rinfo->video_ram);
+       OUTREG(CNFG_MEMSIZE, rinfo->video_ram);
 
        OUTREG(DISP_MISC_CNTL, rinfo->save_regs[9]);
        OUTREG(DISP_PWR_MAN, rinfo->save_regs[10]);
@@ -1723,7 +1723,7 @@ static void radeon_reinitialize_M10(struct radeonfb_info *rinfo)
        OUTREG(CRTC2_DISPLAY_BASE_ADDR, rinfo->save_regs[33]);
        OUTREG(MC_FB_LOCATION, rinfo->save_regs[30]);
        OUTREG(OV0_BASE_ADDR, rinfo->save_regs[80]);
-       OUTREG(CONFIG_MEMSIZE, rinfo->video_ram);
+       OUTREG(CNFG_MEMSIZE, rinfo->video_ram);
        OUTREG(BUS_CNTL, rinfo->save_regs[36]);
        OUTREG(BUS_CNTL1, rinfo->save_regs[14]);
        OUTREG(MPP_TB_CONFIG, rinfo->save_regs[37]);
@@ -1961,7 +1961,7 @@ static void radeon_pm_m9p_reconfigure_mc(struct radeonfb_info *rinfo)
        OUTMC(rinfo, ixMC_CHP_IO_CNTL_B1, rinfo->save_regs[68] /*0x141555ff*/);
        OUTMC(rinfo, ixMC_IMP_CNTL_0, rinfo->save_regs[71] /*0x00009249*/);
        OUTREG(MC_IND_INDEX, 0);
-       OUTREG(CONFIG_MEMSIZE, rinfo->video_ram);
+       OUTREG(CNFG_MEMSIZE, rinfo->video_ram);
 
        mdelay(20);
 }
@@ -2361,7 +2361,7 @@ static void radeon_reinitialize_QW(struct radeonfb_info *rinfo)
        OUTMC(rinfo, ixMC_IMP_CNTL_0, 0x00009249);
        OUTREG(MC_IND_INDEX, 0);
 
-       OUTREG(CONFIG_MEMSIZE, rinfo->video_ram);
+       OUTREG(CNFG_MEMSIZE, rinfo->video_ram);
 
        radeon_pm_full_reset_sdram(rinfo);
 
@@ -2509,9 +2509,7 @@ static void radeon_reinitialize_QW(struct radeonfb_info *rinfo)
 
 static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
 {
-       u16 pwr_cmd;
        u32 tmp;
-       int i;
 
        if (!rinfo->pm_reg)
                return;
@@ -2557,32 +2555,14 @@ static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
                        }
                }
 
-               for (i = 0; i < 64; ++i)
-                       pci_read_config_dword(rinfo->pdev, i * 4,
-                                             &rinfo->cfg_save[i]);
-
                /* Switch PCI power management to D2. */
                pci_disable_device(rinfo->pdev);
-               for (;;) {
-                       pci_read_config_word(
-                               rinfo->pdev, rinfo->pm_reg+PCI_PM_CTRL,
-                               &pwr_cmd);
-                       if (pwr_cmd & 2)
-                               break;                  
-                       pci_write_config_word(
-                               rinfo->pdev, rinfo->pm_reg+PCI_PM_CTRL,
-                               (pwr_cmd & ~PCI_PM_CTRL_STATE_MASK) | 2);
-                       mdelay(500);
-               }
+               pci_save_state(rinfo->pdev);
+               pci_set_power_state(rinfo->pdev, PCI_D2);
        } else {
                printk(KERN_DEBUG "radeonfb (%s): switching to D0 state...\n",
                       pci_name(rinfo->pdev));
 
-               /* Switch back PCI powermanagment to D0 */
-               mdelay(200);
-               pci_write_config_word(rinfo->pdev, rinfo->pm_reg+PCI_PM_CTRL, 0);
-               mdelay(500);
-
                if (rinfo->family <= CHIP_FAMILY_RV250) {
                        /* Reset the SDRAM controller  */
                        radeon_pm_full_reset_sdram(rinfo);
@@ -2598,37 +2578,10 @@ static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
        }
 }
 
-static int radeon_restore_pci_cfg(struct radeonfb_info *rinfo)
-{
-       int i;
-       static u32 radeon_cfg_after_resume[64];
-
-       for (i = 0; i < 64; ++i)
-               pci_read_config_dword(rinfo->pdev, i * 4,
-                                     &radeon_cfg_after_resume[i]);
-
-       if (radeon_cfg_after_resume[PCI_BASE_ADDRESS_0/4]
-           == rinfo->cfg_save[PCI_BASE_ADDRESS_0/4])
-               return 0;       /* assume everything is ok */
-
-       for (i = PCI_BASE_ADDRESS_0/4; i < 64; ++i) {
-               if (radeon_cfg_after_resume[i] != rinfo->cfg_save[i])
-                       pci_write_config_dword(rinfo->pdev, i * 4,
-                                              rinfo->cfg_save[i]);
-       }
-       pci_write_config_word(rinfo->pdev, PCI_CACHE_LINE_SIZE,
-                             rinfo->cfg_save[PCI_CACHE_LINE_SIZE/4]);
-       pci_write_config_word(rinfo->pdev, PCI_COMMAND,
-                             rinfo->cfg_save[PCI_COMMAND/4]);
-       return 1;
-}
-
-
 int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
         struct fb_info *info = pci_get_drvdata(pdev);
         struct radeonfb_info *rinfo = info->par;
-       int i;
 
        if (mesg.event == pdev->dev.power.power_state.event)
                return 0;
@@ -2674,6 +2627,11 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
        pmac_suspend_agp_for_card(pdev);
 #endif /* CONFIG_PPC_PMAC */
 
+       /* It's unclear whether or when the generic code will do that, so let's
+        * do it ourselves. We save state before we do any power management
+        */
+       pci_save_state(pdev);
+
        /* If we support wakeup from poweroff, we save all regs we can including cfg
         * space
         */
@@ -2698,9 +2656,6 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
                        mdelay(20);
                        OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_DIGON));
                }
-               // FIXME: Use PCI layer
-               for (i = 0; i < 64; ++i)
-                       pci_read_config_dword(pdev, i * 4, &rinfo->cfg_save[i]);
                pci_disable_device(pdev);
        }
        /* If we support D2, we go to it (should be fixed later with a flag forcing
@@ -2717,6 +2672,13 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
        return 0;
 }
 
+static int radeon_check_power_loss(struct radeonfb_info *rinfo)
+{
+       return rinfo->save_regs[4] != INPLL(CLK_PIN_CNTL) ||
+              rinfo->save_regs[2] != INPLL(MCLK_CNTL) ||
+              rinfo->save_regs[3] != INPLL(SCLK_CNTL);
+}
+
 int radeonfb_pci_resume(struct pci_dev *pdev)
 {
         struct fb_info *info = pci_get_drvdata(pdev);
@@ -2735,20 +2697,13 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
        printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n",
               pci_name(pdev), pdev->dev.power.power_state.event);
 
-
-       if (pci_enable_device(pdev)) {
-               rc = -ENODEV;
-               printk(KERN_ERR "radeonfb (%s): can't enable PCI device !\n",
-                      pci_name(pdev));
-               goto bail;
-       }
-       pci_set_master(pdev);
-
+       /* PCI state will have been restored by the core, so
+        * we should be in D0 now with our config space fully
+        * restored
+        */
        if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
-               /* Wakeup chip. Check from config space if we were powered off
-                * (todo: additionally, check CLK_PIN_CNTL too)
-                */
-               if ((rinfo->pm_mode & radeon_pm_off) && radeon_restore_pci_cfg(rinfo)) {
+               /* Wakeup chip */
+               if ((rinfo->pm_mode & radeon_pm_off) && radeon_check_power_loss(rinfo)) {
                        if (rinfo->reinit_func != NULL)
                                rinfo->reinit_func(rinfo);
                        else {
index 3ea1b00fdd22ae66e882fc764359920ab8a609c5..7351e66c7f54e6d385740838ec4eb6f4c17af613 100644 (file)
@@ -361,8 +361,6 @@ struct radeonfb_info {
 #ifdef CONFIG_FB_RADEON_I2C
        struct radeon_i2c_chan  i2c[4];
 #endif
-
-       u32                     cfg_save[64];
 };
 
 
index 363b3cb2f01b263ffd2b14b50c8bbdd694b7656f..63d75949816544149506cd9ddd750d0793b81cf4 100644 (file)
@@ -18,7 +18,7 @@ obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o
 obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
 obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o
 obj-$(CONFIG_BACKLIGHT_PWM)    += pwm_bl.o
-obj-$(CONFIG_BACKLIGHT_DA903X) += da903x.o
+obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o
 obj-$(CONFIG_BACKLIGHT_MBP_NVIDIA) += mbp_nvidia_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
index 91b78e691505d715b67de8c990f48ea8a1b420ea..f53b9f1d6aba23830d3b5c1a551054cf9f8b4538 100644 (file)
@@ -250,10 +250,6 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info)
        int rc, size = cmap->len * sizeof(u16);
        struct fb_cmap umap;
 
-       if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&
-                               !info->fbops->fb_setcmap))
-               return -EINVAL;
-
        memset(&umap, 0, sizeof(struct fb_cmap));
        rc = fb_alloc_cmap(&umap, cmap->len, cmap->transp != NULL);
        if (rc)
@@ -262,11 +258,23 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info)
            copy_from_user(umap.green, cmap->green, size) ||
            copy_from_user(umap.blue, cmap->blue, size) ||
            (cmap->transp && copy_from_user(umap.transp, cmap->transp, size))) {
-               fb_dealloc_cmap(&umap);
-               return -EFAULT;
+               rc = -EFAULT;
+               goto out;
        }
        umap.start = cmap->start;
+       if (!lock_fb_info(info)) {
+               rc = -ENODEV;
+               goto out;
+       }
+       if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&
+                               !info->fbops->fb_setcmap)) {
+               rc = -EINVAL;
+               goto out1;
+       }
        rc = fb_set_cmap(&umap, info);
+out1:
+       unlock_fb_info(info);
+out:
        fb_dealloc_cmap(&umap);
        return rc;
 }
index 756efeb91abc09bc3635387840f2b686f724d1fc..cfd9dce1ce0b666627b6306e0eb693f669e154f5 100644 (file)
@@ -1013,132 +1013,139 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
        struct fb_var_screeninfo var;
        struct fb_fix_screeninfo fix;
        struct fb_con2fbmap con2fb;
+       struct fb_cmap cmap_from;
        struct fb_cmap_user cmap;
        struct fb_event event;
        void __user *argp = (void __user *)arg;
        long ret = 0;
 
-       fb = info->fbops;
-       if (!fb)
-               return -ENODEV;
-
        switch (cmd) {
        case FBIOGET_VSCREENINFO:
-               ret = copy_to_user(argp, &info->var,
-                                   sizeof(var)) ? -EFAULT : 0;
+               if (!lock_fb_info(info))
+                       return -ENODEV;
+               var = info->var;
+               unlock_fb_info(info);
+
+               ret = copy_to_user(argp, &var, sizeof(var)) ? -EFAULT : 0;
                break;
        case FBIOPUT_VSCREENINFO:
-               if (copy_from_user(&var, argp, sizeof(var))) {
-                       ret =  -EFAULT;
-                       break;
-               }
+               if (copy_from_user(&var, argp, sizeof(var)))
+                       return -EFAULT;
+               if (!lock_fb_info(info))
+                       return -ENODEV;
                acquire_console_sem();
                info->flags |= FBINFO_MISC_USEREVENT;
                ret = fb_set_var(info, &var);
                info->flags &= ~FBINFO_MISC_USEREVENT;
                release_console_sem();
-               if (ret == 0 && copy_to_user(argp, &var, sizeof(var)))
+               unlock_fb_info(info);
+               if (!ret && copy_to_user(argp, &var, sizeof(var)))
                        ret = -EFAULT;
                break;
        case FBIOGET_FSCREENINFO:
-               ret = copy_to_user(argp, &info->fix,
-                                   sizeof(fix)) ? -EFAULT : 0;
+               if (!lock_fb_info(info))
+                       return -ENODEV;
+               fix = info->fix;
+               unlock_fb_info(info);
+
+               ret = copy_to_user(argp, &fix, sizeof(fix)) ? -EFAULT : 0;
                break;
        case FBIOPUTCMAP:
                if (copy_from_user(&cmap, argp, sizeof(cmap)))
-                       ret = -EFAULT;
-               else
-                       ret = fb_set_user_cmap(&cmap, info);
+                       return -EFAULT;
+               ret = fb_set_user_cmap(&cmap, info);
                break;
        case FBIOGETCMAP:
                if (copy_from_user(&cmap, argp, sizeof(cmap)))
-                       ret = -EFAULT;
-               else
-                       ret = fb_cmap_to_user(&info->cmap, &cmap);
+                       return -EFAULT;
+               if (!lock_fb_info(info))
+                       return -ENODEV;
+               cmap_from = info->cmap;
+               unlock_fb_info(info);
+               ret = fb_cmap_to_user(&cmap_from, &cmap);
                break;
        case FBIOPAN_DISPLAY:
-               if (copy_from_user(&var, argp, sizeof(var))) {
-                       ret = -EFAULT;
-                       break;
-               }
+               if (copy_from_user(&var, argp, sizeof(var)))
+                       return -EFAULT;
+               if (!lock_fb_info(info))
+                       return -ENODEV;
                acquire_console_sem();
                ret = fb_pan_display(info, &var);
                release_console_sem();
+               unlock_fb_info(info);
                if (ret == 0 && copy_to_user(argp, &var, sizeof(var)))
-                       ret = -EFAULT;
+                       return -EFAULT;
                break;
        case FBIO_CURSOR:
                ret = -EINVAL;
                break;
        case FBIOGET_CON2FBMAP:
                if (copy_from_user(&con2fb, argp, sizeof(con2fb)))
-                       ret = -EFAULT;
-               else if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
-                       ret = -EINVAL;
-               else {
-                       con2fb.framebuffer = -1;
-                       event.info = info;
-                       event.data = &con2fb;
-                       fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP,
-                                                               &event);
-                       ret = copy_to_user(argp, &con2fb,
-                                   sizeof(con2fb)) ? -EFAULT : 0;
-               }
+                       return -EFAULT;
+               if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
+                       return -EINVAL;
+               con2fb.framebuffer = -1;
+               event.data = &con2fb;
+
+               if (!lock_fb_info(info))
+                       return -ENODEV;
+               event.info = info;
+               fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event);
+               unlock_fb_info(info);
+
+               ret = copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0;
                break;
        case FBIOPUT_CON2FBMAP:
-               if (copy_from_user(&con2fb, argp, sizeof(con2fb))) {
-                       ret = -EFAULT;
-                       break;
-               }
-               if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) {
-                       ret = -EINVAL;
-                       break;
-               }
-               if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX) {
-                       ret = -EINVAL;
-                       break;
-               }
+               if (copy_from_user(&con2fb, argp, sizeof(con2fb)))
+                       return -EFAULT;
+               if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
+                       return -EINVAL;
+               if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX)
+                       return -EINVAL;
                if (!registered_fb[con2fb.framebuffer])
                        request_module("fb%d", con2fb.framebuffer);
                if (!registered_fb[con2fb.framebuffer]) {
                        ret = -EINVAL;
                        break;
                }
-               event.info = info;
                event.data = &con2fb;
+               if (!lock_fb_info(info))
+                       return -ENODEV;
+               event.info = info;
                ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP,
                                              &event);
+               unlock_fb_info(info);
                break;
        case FBIOBLANK:
+               if (!lock_fb_info(info))
+                       return -ENODEV;
                acquire_console_sem();
                info->flags |= FBINFO_MISC_USEREVENT;
                ret = fb_blank(info, arg);
                info->flags &= ~FBINFO_MISC_USEREVENT;
                release_console_sem();
-               break;;
+               unlock_fb_info(info);
+               break;
        default:
-               if (fb->fb_ioctl == NULL)
-                       ret = -ENOTTY;
-               else
+               if (!lock_fb_info(info))
+                       return -ENODEV;
+               fb = info->fbops;
+               if (fb->fb_ioctl)
                        ret = fb->fb_ioctl(info, cmd, arg);
+               else
+                       ret = -ENOTTY;
+               unlock_fb_info(info);
        }
        return ret;
 }
 
 static long fb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-__acquires(&info->lock)
-__releases(&info->lock)
 {
        struct inode *inode = file->f_path.dentry->d_inode;
        int fbidx = iminor(inode);
-       struct fb_info *info;
-       long ret;
+       struct fb_info *info = registered_fb[fbidx];
 
-       info = registered_fb[fbidx];
-       mutex_lock(&info->lock);
-       ret = do_fb_ioctl(info, cmd, arg);
-       mutex_unlock(&info->lock);
-       return ret;
+       return do_fb_ioctl(info, cmd, arg);
 }
 
 #ifdef CONFIG_COMPAT
@@ -1257,8 +1264,6 @@ static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd,
 
 static long fb_compat_ioctl(struct file *file, unsigned int cmd,
                            unsigned long arg)
-__acquires(&info->lock)
-__releases(&info->lock)
 {
        struct inode *inode = file->f_path.dentry->d_inode;
        int fbidx = iminor(inode);
@@ -1266,7 +1271,6 @@ __releases(&info->lock)
        struct fb_ops *fb = info->fbops;
        long ret = -ENOIOCTLCMD;
 
-       mutex_lock(&info->lock);
        switch(cmd) {
        case FBIOGET_VSCREENINFO:
        case FBIOPUT_VSCREENINFO:
@@ -1292,7 +1296,6 @@ __releases(&info->lock)
                        ret = fb->fb_compat_ioctl(info, cmd, arg);
                break;
        }
-       mutex_unlock(&info->lock);
        return ret;
 }
 #endif
index bef6b45e8a5ce4baaa0e1373338d5f02e879bbb0..330aacbdec1f7b48fd2774f19e5788461463f07a 100644 (file)
@@ -192,7 +192,7 @@ static irqreturn_t vp_interrupt(int irq, void *opaque)
                drv = container_of(vp_dev->vdev.dev.driver,
                                   struct virtio_driver, driver);
 
-               if (drv->config_changed)
+               if (drv && drv->config_changed)
                        drv->config_changed(&vp_dev->vdev);
        }
 
index 2ba8f95516a0b023c8afce948b757e2884b3cb21..efa4b363ce72ae9527ece6351bb172b568f98880 100644 (file)
@@ -498,7 +498,7 @@ static ssize_t store_target_kb(struct sys_device *dev,
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       target_bytes = memparse(buf, &endchar);
+       target_bytes = simple_strtoull(buf, &endchar, 0) * 1024;
 
        balloon_set_new_target(target_bytes >> PAGE_SHIFT);
 
@@ -508,8 +508,39 @@ static ssize_t store_target_kb(struct sys_device *dev,
 static SYSDEV_ATTR(target_kb, S_IRUGO | S_IWUSR,
                   show_target_kb, store_target_kb);
 
+
+static ssize_t show_target(struct sys_device *dev, struct sysdev_attribute *attr,
+                             char *buf)
+{
+       return sprintf(buf, "%llu\n",
+                      (u64)balloon_stats.target_pages << PAGE_SHIFT);
+}
+
+static ssize_t store_target(struct sys_device *dev,
+                           struct sysdev_attribute *attr,
+                           const char *buf,
+                           size_t count)
+{
+       char *endchar;
+       unsigned long long target_bytes;
+
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
+
+       target_bytes = memparse(buf, &endchar);
+
+       balloon_set_new_target(target_bytes >> PAGE_SHIFT);
+
+       return count;
+}
+
+static SYSDEV_ATTR(target, S_IRUGO | S_IWUSR,
+                  show_target, store_target);
+
+
 static struct sysdev_attribute *balloon_attrs[] = {
        &attr_target_kb,
+       &attr_target,
 };
 
 static struct attribute *balloon_info_attrs[] = {
index e3ff2b9e602fd8fc8d35b24ae5a6dad841bc05f1..33b7235f853b2d46a7a685d805163d57ee0ef505 100644 (file)
@@ -1208,9 +1208,11 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
         * check for an ELF header.  If we find one, dump the first page to
         * aid in determining what was mapped here.
         */
-       if (FILTER(ELF_HEADERS) && vma->vm_file != NULL && vma->vm_pgoff == 0) {
+       if (FILTER(ELF_HEADERS) &&
+           vma->vm_pgoff == 0 && (vma->vm_flags & VM_READ)) {
                u32 __user *header = (u32 __user *) vma->vm_start;
                u32 word;
+               mm_segment_t fs = get_fs();
                /*
                 * Doing it this way gets the constant folded by GCC.
                 */
@@ -1223,7 +1225,15 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
                magic.elfmag[EI_MAG1] = ELFMAG1;
                magic.elfmag[EI_MAG2] = ELFMAG2;
                magic.elfmag[EI_MAG3] = ELFMAG3;
-               if (get_user(word, header) == 0 && word == magic.cmp)
+               /*
+                * Switch to the user "segment" for get_user(),
+                * then put back what elf_core_dump() had in place.
+                */
+               set_fs(USER_DS);
+               if (unlikely(get_user(word, header)))
+                       word = 0;
+               set_fs(fs);
+               if (word == magic.cmp)
                        return PAGE_SIZE;
        }
 
index 77ebc3c263d6549b5934017b3adfacd7752dc802..549b0144da118ee2dd13f11b77cbf5fcf1ab2626 100644 (file)
@@ -140,7 +140,6 @@ int bio_integrity_add_page(struct bio *bio, struct page *page,
 
        iv = bip_vec_idx(bip, bip->bip_vcnt);
        BUG_ON(iv == NULL);
-       BUG_ON(iv->bv_page != NULL);
 
        iv->bv_page = page;
        iv->bv_len = len;
@@ -465,7 +464,7 @@ static int bio_integrity_verify(struct bio *bio)
 
                if (ret) {
                        kunmap_atomic(kaddr, KM_USER0);
-                       break;
+                       return ret;
                }
 
                sectors = bv->bv_len / bi->sector_size;
@@ -493,18 +492,13 @@ static void bio_integrity_verify_fn(struct work_struct *work)
        struct bio_integrity_payload *bip =
                container_of(work, struct bio_integrity_payload, bip_work);
        struct bio *bio = bip->bip_bio;
-       int error = bip->bip_error;
+       int error;
 
-       if (bio_integrity_verify(bio)) {
-               clear_bit(BIO_UPTODATE, &bio->bi_flags);
-               error = -EIO;
-       }
+       error = bio_integrity_verify(bio);
 
        /* Restore original bio completion handler */
        bio->bi_end_io = bip->bip_end_io;
-
-       if (bio->bi_end_io)
-               bio->bi_end_io(bio, error);
+       bio_endio(bio, error);
 }
 
 /**
@@ -525,7 +519,17 @@ void bio_integrity_endio(struct bio *bio, int error)
 
        BUG_ON(bip->bip_bio != bio);
 
-       bip->bip_error = error;
+       /* In case of an I/O error there is no point in verifying the
+        * integrity metadata.  Restore original bio end_io handler
+        * and run it.
+        */
+       if (error) {
+               bio->bi_end_io = bip->bip_end_io;
+               bio_endio(bio, error);
+
+               return;
+       }
+
        INIT_WORK(&bip->bip_work, bio_integrity_verify_fn);
        queue_work(kintegrityd_wq, &bip->bip_work);
 }
index f8fcf999ea1b1e11d2bb92730961b764216ce1c0..7bb3c020e570d9a1e0d2d640f6c9127df8e57a01 100644 (file)
@@ -16,3 +16,16 @@ config BTRFS_FS
          module will be called btrfs.
 
          If unsure, say N.
+
+config BTRFS_FS_POSIX_ACL
+       bool "Btrfs POSIX Access Control Lists"
+       depends on BTRFS_FS
+       select FS_POSIX_ACL
+       help
+         POSIX Access Control Lists (ACLs) support permissions for users and
+         groups beyond the owner/group/world scheme.
+
+         To learn more about Access Control Lists, visit the POSIX ACLs for
+         Linux website <http://acl.bestbits.at/>.
+
+         If you don't know what Access Control Lists are, say N
index 8e2fec05dbe0c084df02625a6c0342ee2fee1176..c84ca1f5259a5408f538d8254f939677567924a4 100644 (file)
  * Boston, MA 021110-1307, USA.
  */
 
-#include <linux/version.h>
 #include <linux/kthread.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
-# include <linux/freezer.h>
+#include <linux/freezer.h>
+#include <linux/ftrace.h>
 #include "async-thread.h"
 
 #define WORK_QUEUED_BIT 0
@@ -143,6 +143,7 @@ static int worker_loop(void *arg)
        struct btrfs_work *work;
        do {
                spin_lock_irq(&worker->lock);
+again_locked:
                while (!list_empty(&worker->pending)) {
                        cur = worker->pending.next;
                        work = list_entry(cur, struct btrfs_work, list);
@@ -165,14 +166,50 @@ static int worker_loop(void *arg)
                        check_idle_worker(worker);
 
                }
-               worker->working = 0;
                if (freezing(current)) {
+                       worker->working = 0;
+                       spin_unlock_irq(&worker->lock);
                        refrigerator();
                } else {
-                       set_current_state(TASK_INTERRUPTIBLE);
                        spin_unlock_irq(&worker->lock);
-                       if (!kthread_should_stop())
+                       if (!kthread_should_stop()) {
+                               cpu_relax();
+                               /*
+                                * we've dropped the lock, did someone else
+                                * jump_in?
+                                */
+                               smp_mb();
+                               if (!list_empty(&worker->pending))
+                                       continue;
+
+                               /*
+                                * this short schedule allows more work to
+                                * come in without the queue functions
+                                * needing to go through wake_up_process()
+                                *
+                                * worker->working is still 1, so nobody
+                                * is going to try and wake us up
+                                */
+                               schedule_timeout(1);
+                               smp_mb();
+                               if (!list_empty(&worker->pending))
+                                       continue;
+
+                               /* still no more work?, sleep for real */
+                               spin_lock_irq(&worker->lock);
+                               set_current_state(TASK_INTERRUPTIBLE);
+                               if (!list_empty(&worker->pending))
+                                       goto again_locked;
+
+                               /*
+                                * this makes sure we get a wakeup when someone
+                                * adds something new to the queue
+                                */
+                               worker->working = 0;
+                               spin_unlock_irq(&worker->lock);
+
                                schedule();
+                       }
                        __set_current_state(TASK_RUNNING);
                }
        } while (!kthread_should_stop());
@@ -350,13 +387,14 @@ int btrfs_requeue_work(struct btrfs_work *work)
 {
        struct btrfs_worker_thread *worker = work->worker;
        unsigned long flags;
+       int wake = 0;
 
        if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags))
                goto out;
 
        spin_lock_irqsave(&worker->lock, flags);
-       atomic_inc(&worker->num_pending);
        list_add_tail(&work->list, &worker->pending);
+       atomic_inc(&worker->num_pending);
 
        /* by definition we're busy, take ourselves off the idle
         * list
@@ -368,10 +406,16 @@ int btrfs_requeue_work(struct btrfs_work *work)
                               &worker->workers->worker_list);
                spin_unlock_irqrestore(&worker->workers->lock, flags);
        }
+       if (!worker->working) {
+               wake = 1;
+               worker->working = 1;
+       }
 
        spin_unlock_irqrestore(&worker->lock, flags);
-
+       if (wake)
+               wake_up_process(worker->task);
 out:
+
        return 0;
 }
 
@@ -398,9 +442,10 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work)
        }
 
        spin_lock_irqsave(&worker->lock, flags);
+
+       list_add_tail(&work->list, &worker->pending);
        atomic_inc(&worker->num_pending);
        check_busy_worker(worker);
-       list_add_tail(&work->list, &worker->pending);
 
        /*
         * avoid calling into wake_up_process if this thread has already
index ee848d8585d9b97be41e1d37c8363b0d31408b49..ab07627084f13c4f84c39c39d802b258dbc181ab 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/swap.h>
 #include <linux/writeback.h>
 #include <linux/bit_spinlock.h>
-#include <linux/version.h>
 #include <linux/pagevec.h>
 #include "compat.h"
 #include "ctree.h"
index 9e46c07768167f53f9ae0c9b6ffdb5ce8641f56e..551177c0011ae90d3e2c0460340071ea97158b50 100644 (file)
@@ -54,6 +54,31 @@ struct btrfs_path *btrfs_alloc_path(void)
        return path;
 }
 
+/*
+ * set all locked nodes in the path to blocking locks.  This should
+ * be done before scheduling
+ */
+noinline void btrfs_set_path_blocking(struct btrfs_path *p)
+{
+       int i;
+       for (i = 0; i < BTRFS_MAX_LEVEL; i++) {
+               if (p->nodes[i] && p->locks[i])
+                       btrfs_set_lock_blocking(p->nodes[i]);
+       }
+}
+
+/*
+ * reset all the locked nodes in the patch to spinning locks.
+ */
+noinline void btrfs_clear_path_blocking(struct btrfs_path *p)
+{
+       int i;
+       for (i = 0; i < BTRFS_MAX_LEVEL; i++) {
+               if (p->nodes[i] && p->locks[i])
+                       btrfs_clear_lock_blocking(p->nodes[i]);
+       }
+}
+
 /* this also releases the path */
 void btrfs_free_path(struct btrfs_path *p)
 {
@@ -272,6 +297,8 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
        if (IS_ERR(cow))
                return PTR_ERR(cow);
 
+       /* cow is set to blocking by btrfs_init_new_buffer */
+
        copy_extent_buffer(cow, buf, 0, 0, cow->len);
        btrfs_set_header_bytenr(cow, cow->start);
        btrfs_set_header_generation(cow, trans->transid);
@@ -388,17 +415,20 @@ noinline int btrfs_cow_block(struct btrfs_trans_handle *trans,
                WARN_ON(1);
        }
 
-       spin_lock(&root->fs_info->hash_lock);
        if (btrfs_header_generation(buf) == trans->transid &&
            btrfs_header_owner(buf) == root->root_key.objectid &&
            !btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) {
                *cow_ret = buf;
-               spin_unlock(&root->fs_info->hash_lock);
                WARN_ON(prealloc_dest);
                return 0;
        }
-       spin_unlock(&root->fs_info->hash_lock);
+
        search_start = buf->start & ~((u64)(1024 * 1024 * 1024) - 1);
+
+       if (parent)
+               btrfs_set_lock_blocking(parent);
+       btrfs_set_lock_blocking(buf);
+
        ret = __btrfs_cow_block(trans, root, buf, parent,
                                 parent_slot, cow_ret, search_start, 0,
                                 prealloc_dest);
@@ -504,6 +534,8 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
        if (parent_nritems == 1)
                return 0;
 
+       btrfs_set_lock_blocking(parent);
+
        for (i = start_slot; i < end_slot; i++) {
                int close = 1;
 
@@ -564,6 +596,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
                        search_start = last_block;
 
                btrfs_tree_lock(cur);
+               btrfs_set_lock_blocking(cur);
                err = __btrfs_cow_block(trans, root, cur, parent, i,
                                        &cur, search_start,
                                        min(16 * blocksize,
@@ -862,6 +895,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
                return 0;
 
        mid = path->nodes[level];
+
        WARN_ON(!path->locks[level]);
        WARN_ON(btrfs_header_generation(mid) != trans->transid);
 
@@ -884,6 +918,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
                /* promote the child to a root */
                child = read_node_slot(root, mid, 0);
                btrfs_tree_lock(child);
+               btrfs_set_lock_blocking(child);
                BUG_ON(!child);
                ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0);
                BUG_ON(ret);
@@ -900,6 +935,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
 
                add_root_to_dirty_list(root);
                btrfs_tree_unlock(child);
+
                path->locks[level] = 0;
                path->nodes[level] = NULL;
                clean_tree_block(trans, root, mid);
@@ -924,6 +960,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
        left = read_node_slot(root, parent, pslot - 1);
        if (left) {
                btrfs_tree_lock(left);
+               btrfs_set_lock_blocking(left);
                wret = btrfs_cow_block(trans, root, left,
                                       parent, pslot - 1, &left, 0);
                if (wret) {
@@ -934,6 +971,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
        right = read_node_slot(root, parent, pslot + 1);
        if (right) {
                btrfs_tree_lock(right);
+               btrfs_set_lock_blocking(right);
                wret = btrfs_cow_block(trans, root, right,
                                       parent, pslot + 1, &right, 0);
                if (wret) {
@@ -1109,6 +1147,8 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
                u32 left_nr;
 
                btrfs_tree_lock(left);
+               btrfs_set_lock_blocking(left);
+
                left_nr = btrfs_header_nritems(left);
                if (left_nr >= BTRFS_NODEPTRS_PER_BLOCK(root) - 1) {
                        wret = 1;
@@ -1155,7 +1195,10 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
         */
        if (right) {
                u32 right_nr;
+
                btrfs_tree_lock(right);
+               btrfs_set_lock_blocking(right);
+
                right_nr = btrfs_header_nritems(right);
                if (right_nr >= BTRFS_NODEPTRS_PER_BLOCK(root) - 1) {
                        wret = 1;
@@ -1210,8 +1253,7 @@ static noinline void reada_for_search(struct btrfs_root *root,
        struct btrfs_disk_key disk_key;
        u32 nritems;
        u64 search;
-       u64 lowest_read;
-       u64 highest_read;
+       u64 target;
        u64 nread = 0;
        int direction = path->reada;
        struct extent_buffer *eb;
@@ -1235,8 +1277,7 @@ static noinline void reada_for_search(struct btrfs_root *root,
                return;
        }
 
-       highest_read = search;
-       lowest_read = search;
+       target = search;
 
        nritems = btrfs_header_nritems(node);
        nr = slot;
@@ -1256,27 +1297,80 @@ static noinline void reada_for_search(struct btrfs_root *root,
                                break;
                }
                search = btrfs_node_blockptr(node, nr);
-               if ((search >= lowest_read && search <= highest_read) ||
-                   (search < lowest_read && lowest_read - search <= 16384) ||
-                   (search > highest_read && search - highest_read <= 16384)) {
+               if ((search <= target && target - search <= 65536) ||
+                   (search > target && search - target <= 65536)) {
                        readahead_tree_block(root, search, blocksize,
                                     btrfs_node_ptr_generation(node, nr));
                        nread += blocksize;
                }
                nscan++;
-               if (path->reada < 2 && (nread > (64 * 1024) || nscan > 32))
+               if ((nread > 65536 || nscan > 32))
                        break;
+       }
+}
 
-               if (nread > (256 * 1024) || nscan > 128)
-                       break;
+/*
+ * returns -EAGAIN if it had to drop the path, or zero if everything was in
+ * cache
+ */
+static noinline int reada_for_balance(struct btrfs_root *root,
+                                     struct btrfs_path *path, int level)
+{
+       int slot;
+       int nritems;
+       struct extent_buffer *parent;
+       struct extent_buffer *eb;
+       u64 gen;
+       u64 block1 = 0;
+       u64 block2 = 0;
+       int ret = 0;
+       int blocksize;
 
-               if (search < lowest_read)
-                       lowest_read = search;
-               if (search > highest_read)
-                       highest_read = search;
+       parent = path->nodes[level - 1];
+       if (!parent)
+               return 0;
+
+       nritems = btrfs_header_nritems(parent);
+       slot = path->slots[level];
+       blocksize = btrfs_level_size(root, level);
+
+       if (slot > 0) {
+               block1 = btrfs_node_blockptr(parent, slot - 1);
+               gen = btrfs_node_ptr_generation(parent, slot - 1);
+               eb = btrfs_find_tree_block(root, block1, blocksize);
+               if (eb && btrfs_buffer_uptodate(eb, gen))
+                       block1 = 0;
+               free_extent_buffer(eb);
+       }
+       if (slot < nritems) {
+               block2 = btrfs_node_blockptr(parent, slot + 1);
+               gen = btrfs_node_ptr_generation(parent, slot + 1);
+               eb = btrfs_find_tree_block(root, block2, blocksize);
+               if (eb && btrfs_buffer_uptodate(eb, gen))
+                       block2 = 0;
+               free_extent_buffer(eb);
+       }
+       if (block1 || block2) {
+               ret = -EAGAIN;
+               btrfs_release_path(root, path);
+               if (block1)
+                       readahead_tree_block(root, block1, blocksize, 0);
+               if (block2)
+                       readahead_tree_block(root, block2, blocksize, 0);
+
+               if (block1) {
+                       eb = read_tree_block(root, block1, blocksize, 0);
+                       free_extent_buffer(eb);
+               }
+               if (block1) {
+                       eb = read_tree_block(root, block2, blocksize, 0);
+                       free_extent_buffer(eb);
+               }
        }
+       return ret;
 }
 
+
 /*
  * when we walk down the tree, it is usually safe to unlock the higher layers
  * in the tree.  The exceptions are when our path goes through slot 0, because
@@ -1327,6 +1421,32 @@ static noinline void unlock_up(struct btrfs_path *path, int level,
        }
 }
 
+/*
+ * This releases any locks held in the path starting at level and
+ * going all the way up to the root.
+ *
+ * btrfs_search_slot will keep the lock held on higher nodes in a few
+ * corner cases, such as COW of the block at slot zero in the node.  This
+ * ignores those rules, and it should only be called when there are no
+ * more updates to be done higher up in the tree.
+ */
+noinline void btrfs_unlock_up_safe(struct btrfs_path *path, int level)
+{
+       int i;
+
+       if (path->keep_locks || path->lowest_level)
+               return;
+
+       for (i = level; i < BTRFS_MAX_LEVEL; i++) {
+               if (!path->nodes[i])
+                       continue;
+               if (!path->locks[i])
+                       continue;
+               btrfs_tree_unlock(path->nodes[i]);
+               path->locks[i] = 0;
+       }
+}
+
 /*
  * look for key in the tree.  path is filled in with nodes along the way
  * if key is found, we return zero and you can find the item in the leaf
@@ -1387,31 +1507,30 @@ again:
                        int wret;
 
                        /* is a cow on this block not required */
-                       spin_lock(&root->fs_info->hash_lock);
                        if (btrfs_header_generation(b) == trans->transid &&
                            btrfs_header_owner(b) == root->root_key.objectid &&
                            !btrfs_header_flag(b, BTRFS_HEADER_FLAG_WRITTEN)) {
-                               spin_unlock(&root->fs_info->hash_lock);
                                goto cow_done;
                        }
-                       spin_unlock(&root->fs_info->hash_lock);
 
                        /* ok, we have to cow, is our old prealloc the right
                         * size?
                         */
                        if (prealloc_block.objectid &&
                            prealloc_block.offset != b->len) {
+                               btrfs_release_path(root, p);
                                btrfs_free_reserved_extent(root,
                                           prealloc_block.objectid,
                                           prealloc_block.offset);
                                prealloc_block.objectid = 0;
+                               goto again;
                        }
 
                        /*
                         * for higher level blocks, try not to allocate blocks
                         * with the block and the parent locks held.
                         */
-                       if (level > 1 && !prealloc_block.objectid &&
+                       if (level > 0 && !prealloc_block.objectid &&
                            btrfs_path_lock_waiting(p, level)) {
                                u32 size = b->len;
                                u64 hint = b->start;
@@ -1425,6 +1544,8 @@ again:
                                goto again;
                        }
 
+                       btrfs_set_path_blocking(p);
+
                        wret = btrfs_cow_block(trans, root, b,
                                               p->nodes[level + 1],
                                               p->slots[level + 1],
@@ -1446,6 +1567,22 @@ cow_done:
                if (!p->skip_locking)
                        p->locks[level] = 1;
 
+               btrfs_clear_path_blocking(p);
+
+               /*
+                * we have a lock on b and as long as we aren't changing
+                * the tree, there is no way to for the items in b to change.
+                * It is safe to drop the lock on our parent before we
+                * go through the expensive btree search on b.
+                *
+                * If cow is true, then we might be changing slot zero,
+                * which may require changing the parent.  So, we can't
+                * drop the lock until after we know which slot we're
+                * operating on.
+                */
+               if (!cow)
+                       btrfs_unlock_up_safe(p, level + 1);
+
                ret = check_block(root, p, level);
                if (ret) {
                        ret = -1;
@@ -1453,6 +1590,7 @@ cow_done:
                }
 
                ret = bin_search(b, key, level, &slot);
+
                if (level != 0) {
                        if (ret && slot > 0)
                                slot -= 1;
@@ -1460,7 +1598,16 @@ cow_done:
                        if ((p->search_for_split || ins_len > 0) &&
                            btrfs_header_nritems(b) >=
                            BTRFS_NODEPTRS_PER_BLOCK(root) - 3) {
-                               int sret = split_node(trans, root, p, level);
+                               int sret;
+
+                               sret = reada_for_balance(root, p, level);
+                               if (sret)
+                                       goto again;
+
+                               btrfs_set_path_blocking(p);
+                               sret = split_node(trans, root, p, level);
+                               btrfs_clear_path_blocking(p);
+
                                BUG_ON(sret > 0);
                                if (sret) {
                                        ret = sret;
@@ -1468,9 +1615,19 @@ cow_done:
                                }
                                b = p->nodes[level];
                                slot = p->slots[level];
-                       } else if (ins_len < 0) {
-                               int sret = balance_level(trans, root, p,
-                                                        level);
+                       } else if (ins_len < 0 &&
+                                  btrfs_header_nritems(b) <
+                                  BTRFS_NODEPTRS_PER_BLOCK(root) / 4) {
+                               int sret;
+
+                               sret = reada_for_balance(root, p, level);
+                               if (sret)
+                                       goto again;
+
+                               btrfs_set_path_blocking(p);
+                               sret = balance_level(trans, root, p, level);
+                               btrfs_clear_path_blocking(p);
+
                                if (sret) {
                                        ret = sret;
                                        goto done;
@@ -1504,7 +1661,7 @@ cow_done:
                                 * of the btree by dropping locks before
                                 * we read.
                                 */
-                               if (level > 1) {
+                               if (level > 0) {
                                        btrfs_release_path(NULL, p);
                                        if (tmp)
                                                free_extent_buffer(tmp);
@@ -1519,6 +1676,7 @@ cow_done:
                                                free_extent_buffer(tmp);
                                        goto again;
                                } else {
+                                       btrfs_set_path_blocking(p);
                                        if (tmp)
                                                free_extent_buffer(tmp);
                                        if (should_reada)
@@ -1528,14 +1686,29 @@ cow_done:
                                        b = read_node_slot(root, b, slot);
                                }
                        }
-                       if (!p->skip_locking)
-                               btrfs_tree_lock(b);
+                       if (!p->skip_locking) {
+                               int lret;
+
+                               btrfs_clear_path_blocking(p);
+                               lret = btrfs_try_spin_lock(b);
+
+                               if (!lret) {
+                                       btrfs_set_path_blocking(p);
+                                       btrfs_tree_lock(b);
+                                       btrfs_clear_path_blocking(p);
+                               }
+                       }
                } else {
                        p->slots[level] = slot;
                        if (ins_len > 0 &&
                            btrfs_leaf_free_space(root, b) < ins_len) {
-                               int sret = split_leaf(trans, root, key,
+                               int sret;
+
+                               btrfs_set_path_blocking(p);
+                               sret = split_leaf(trans, root, key,
                                                      p, ins_len, ret == 0);
+                               btrfs_clear_path_blocking(p);
+
                                BUG_ON(sret > 0);
                                if (sret) {
                                        ret = sret;
@@ -1549,12 +1722,16 @@ cow_done:
        }
        ret = 1;
 done:
+       /*
+        * we don't really know what they plan on doing with the path
+        * from here on, so for now just mark it as blocking
+        */
+       btrfs_set_path_blocking(p);
        if (prealloc_block.objectid) {
                btrfs_free_reserved_extent(root,
                           prealloc_block.objectid,
                           prealloc_block.offset);
        }
-
        return ret;
 }
 
@@ -1578,6 +1755,8 @@ int btrfs_merge_path(struct btrfs_trans_handle *trans,
        ret = btrfs_cow_block(trans, root, eb, NULL, 0, &eb, 0);
        BUG_ON(ret);
 
+       btrfs_set_lock_blocking(eb);
+
        parent = eb;
        while (1) {
                level = btrfs_header_level(parent);
@@ -1602,6 +1781,7 @@ int btrfs_merge_path(struct btrfs_trans_handle *trans,
                        eb = read_tree_block(root, bytenr, blocksize,
                                             generation);
                        btrfs_tree_lock(eb);
+                       btrfs_set_lock_blocking(eb);
                }
 
                /*
@@ -1626,6 +1806,7 @@ int btrfs_merge_path(struct btrfs_trans_handle *trans,
                                eb = read_tree_block(root, bytenr, blocksize,
                                                generation);
                                btrfs_tree_lock(eb);
+                               btrfs_set_lock_blocking(eb);
                        }
 
                        ret = btrfs_cow_block(trans, root, eb, parent, slot,
@@ -2172,6 +2353,8 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
 
        right = read_node_slot(root, upper, slot + 1);
        btrfs_tree_lock(right);
+       btrfs_set_lock_blocking(right);
+
        free_space = btrfs_leaf_free_space(root, right);
        if (free_space < data_size)
                goto out_unlock;
@@ -2367,6 +2550,8 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
 
        left = read_node_slot(root, path->nodes[1], slot - 1);
        btrfs_tree_lock(left);
+       btrfs_set_lock_blocking(left);
+
        free_space = btrfs_leaf_free_space(root, left);
        if (free_space < data_size) {
                ret = 1;
@@ -2825,6 +3010,12 @@ int btrfs_split_item(struct btrfs_trans_handle *trans,
        path->keep_locks = 0;
        BUG_ON(ret);
 
+       /*
+        * make sure any changes to the path from split_leaf leave it
+        * in a blocking state
+        */
+       btrfs_set_path_blocking(path);
+
        leaf = path->nodes[0];
        BUG_ON(btrfs_leaf_free_space(root, leaf) < sizeof(struct btrfs_item));
 
@@ -3354,6 +3545,7 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
                BUG();
        }
 out:
+       btrfs_unlock_up_safe(path, 1);
        return ret;
 }
 
@@ -3441,15 +3633,22 @@ noinline int btrfs_del_leaf(struct btrfs_trans_handle *trans,
 {
        int ret;
        u64 root_gen = btrfs_header_generation(path->nodes[1]);
+       u64 parent_start = path->nodes[1]->start;
+       u64 parent_owner = btrfs_header_owner(path->nodes[1]);
 
        ret = del_ptr(trans, root, path, 1, path->slots[1]);
        if (ret)
                return ret;
 
+       /*
+        * btrfs_free_extent is expensive, we want to make sure we
+        * aren't holding any locks when we call it
+        */
+       btrfs_unlock_up_safe(path, 0);
+
        ret = btrfs_free_extent(trans, root, bytenr,
                                btrfs_level_size(root, 0),
-                               path->nodes[1]->start,
-                               btrfs_header_owner(path->nodes[1]),
+                               parent_start, parent_owner,
                                root_gen, 0, 1);
        return ret;
 }
@@ -3721,12 +3920,14 @@ find_next_key:
                 */
                if (slot >= nritems) {
                        path->slots[level] = slot;
+                       btrfs_set_path_blocking(path);
                        sret = btrfs_find_next_key(root, path, min_key, level,
                                                  cache_only, min_trans);
                        if (sret == 0) {
                                btrfs_release_path(root, path);
                                goto again;
                        } else {
+                               btrfs_clear_path_blocking(path);
                                goto out;
                        }
                }
@@ -3738,16 +3939,20 @@ find_next_key:
                        unlock_up(path, level, 1);
                        goto out;
                }
+               btrfs_set_path_blocking(path);
                cur = read_node_slot(root, cur, slot);
 
                btrfs_tree_lock(cur);
+
                path->locks[level - 1] = 1;
                path->nodes[level - 1] = cur;
                unlock_up(path, level, 1);
+               btrfs_clear_path_blocking(path);
        }
 out:
        if (ret == 0)
                memcpy(min_key, &found_key, sizeof(found_key));
+       btrfs_set_path_blocking(path);
        return ret;
 }
 
@@ -3843,6 +4048,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
        if (ret < 0)
                return ret;
 
+       btrfs_set_path_blocking(path);
        nritems = btrfs_header_nritems(path->nodes[0]);
        /*
         * by releasing the path above we dropped all our locks.  A balance
@@ -3873,6 +4079,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
                        free_extent_buffer(next);
                }
 
+               /* the path was set to blocking above */
                if (level == 1 && (path->locks[1] || path->skip_locking) &&
                    path->reada)
                        reada_for_search(root, path, level, slot, 0);
@@ -3881,6 +4088,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
                if (!path->skip_locking) {
                        WARN_ON(!btrfs_tree_locked(c));
                        btrfs_tree_lock(next);
+                       btrfs_set_lock_blocking(next);
                }
                break;
        }
@@ -3897,12 +4105,15 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
                        path->locks[level] = 1;
                if (!level)
                        break;
+
+               btrfs_set_path_blocking(path);
                if (level == 1 && path->locks[1] && path->reada)
                        reada_for_search(root, path, level, slot, 0);
                next = read_node_slot(root, next, 0);
                if (!path->skip_locking) {
                        WARN_ON(!btrfs_tree_locked(path->nodes[level]));
                        btrfs_tree_lock(next);
+                       btrfs_set_lock_blocking(next);
                }
        }
 done:
@@ -3927,6 +4138,7 @@ int btrfs_previous_item(struct btrfs_root *root,
 
        while (1) {
                if (path->slots[0] == 0) {
+                       btrfs_set_path_blocking(path);
                        ret = btrfs_prev_leaf(root, path);
                        if (ret != 0)
                                return ret;
index eee060f88113089c5243e2dc9c38e77258d58da6..531db112c8bd5e003bde909c4adfb8c74a8b4e64 100644 (file)
@@ -454,17 +454,11 @@ struct btrfs_timespec {
        __le32 nsec;
 } __attribute__ ((__packed__));
 
-typedef enum {
+enum btrfs_compression_type {
        BTRFS_COMPRESS_NONE = 0,
        BTRFS_COMPRESS_ZLIB = 1,
        BTRFS_COMPRESS_LAST = 2,
-} btrfs_compression_type;
-
-/* we don't understand any encryption methods right now */
-typedef enum {
-       BTRFS_ENCRYPTION_NONE = 0,
-       BTRFS_ENCRYPTION_LAST = 1,
-} btrfs_encryption_type;
+};
 
 struct btrfs_inode_item {
        /* nfs style generation number */
@@ -701,9 +695,7 @@ struct btrfs_fs_info {
        struct btrfs_transaction *running_transaction;
        wait_queue_head_t transaction_throttle;
        wait_queue_head_t transaction_wait;
-
        wait_queue_head_t async_submit_wait;
-       wait_queue_head_t tree_log_wait;
 
        struct btrfs_super_block super_copy;
        struct btrfs_super_block super_for_commit;
@@ -711,7 +703,6 @@ struct btrfs_fs_info {
        struct super_block *sb;
        struct inode *btree_inode;
        struct backing_dev_info bdi;
-       spinlock_t hash_lock;
        struct mutex trans_mutex;
        struct mutex tree_log_mutex;
        struct mutex transaction_kthread_mutex;
@@ -730,10 +721,6 @@ struct btrfs_fs_info {
        atomic_t async_submit_draining;
        atomic_t nr_async_bios;
        atomic_t async_delalloc_pages;
-       atomic_t tree_log_writers;
-       atomic_t tree_log_commit;
-       unsigned long tree_log_batch;
-       u64 tree_log_transid;
 
        /*
         * this is used by the balancing code to wait for all the pending
@@ -833,7 +820,14 @@ struct btrfs_root {
        struct kobject root_kobj;
        struct completion kobj_unregister;
        struct mutex objectid_mutex;
+
        struct mutex log_mutex;
+       wait_queue_head_t log_writer_wait;
+       wait_queue_head_t log_commit_wait[2];
+       atomic_t log_writers;
+       atomic_t log_commit[2];
+       unsigned long log_transid;
+       unsigned long log_batch;
 
        u64 objectid;
        u64 last_trans;
@@ -1841,6 +1835,10 @@ void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p);
 struct btrfs_path *btrfs_alloc_path(void);
 void btrfs_free_path(struct btrfs_path *p);
 void btrfs_init_path(struct btrfs_path *p);
+void btrfs_set_path_blocking(struct btrfs_path *p);
+void btrfs_clear_path_blocking(struct btrfs_path *p);
+void btrfs_unlock_up_safe(struct btrfs_path *p, int level);
+
 int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                   struct btrfs_path *path, int slot, int nr);
 int btrfs_del_leaf(struct btrfs_trans_handle *trans,
index 81a313874ae577aa51370459a0e98c8e26c53c46..5aebddd711934817e6f2993375bc1031e3330e63 100644 (file)
@@ -16,7 +16,6 @@
  * Boston, MA 021110-1307, USA.
  */
 
-#include <linux/version.h>
 #include <linux/fs.h>
 #include <linux/blkdev.h>
 #include <linux/scatterlist.h>
@@ -800,7 +799,7 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
        ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid);
 
        if (ret == 0)
-               buf->flags |= EXTENT_UPTODATE;
+               set_bit(EXTENT_BUFFER_UPTODATE, &buf->bflags);
        else
                WARN_ON(1);
        return buf;
@@ -814,6 +813,10 @@ int clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
        if (btrfs_header_generation(buf) ==
            root->fs_info->running_transaction->transid) {
                WARN_ON(!btrfs_tree_locked(buf));
+
+               /* ugh, clear_extent_buffer_dirty can be expensive */
+               btrfs_set_lock_blocking(buf);
+
                clear_extent_buffer_dirty(&BTRFS_I(btree_inode)->io_tree,
                                          buf);
        }
@@ -850,6 +853,14 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
        spin_lock_init(&root->list_lock);
        mutex_init(&root->objectid_mutex);
        mutex_init(&root->log_mutex);
+       init_waitqueue_head(&root->log_writer_wait);
+       init_waitqueue_head(&root->log_commit_wait[0]);
+       init_waitqueue_head(&root->log_commit_wait[1]);
+       atomic_set(&root->log_commit[0], 0);
+       atomic_set(&root->log_commit[1], 0);
+       atomic_set(&root->log_writers, 0);
+       root->log_batch = 0;
+       root->log_transid = 0;
        extent_io_tree_init(&root->dirty_log_pages,
                             fs_info->btree_inode->i_mapping, GFP_NOFS);
 
@@ -934,15 +945,16 @@ int btrfs_free_log_root_tree(struct btrfs_trans_handle *trans,
        return 0;
 }
 
-int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
-                            struct btrfs_fs_info *fs_info)
+static struct btrfs_root *alloc_log_tree(struct btrfs_trans_handle *trans,
+                                        struct btrfs_fs_info *fs_info)
 {
        struct btrfs_root *root;
        struct btrfs_root *tree_root = fs_info->tree_root;
+       struct extent_buffer *leaf;
 
        root = kzalloc(sizeof(*root), GFP_NOFS);
        if (!root)
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
 
        __setup_root(tree_root->nodesize, tree_root->leafsize,
                     tree_root->sectorsize, tree_root->stripesize,
@@ -951,12 +963,23 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
        root->root_key.objectid = BTRFS_TREE_LOG_OBJECTID;
        root->root_key.type = BTRFS_ROOT_ITEM_KEY;
        root->root_key.offset = BTRFS_TREE_LOG_OBJECTID;
+       /*
+        * log trees do not get reference counted because they go away
+        * before a real commit is actually done.  They do store pointers
+        * to file data extents, and those reference counts still get
+        * updated (along with back refs to the log tree).
+        */
        root->ref_cows = 0;
 
-       root->node = btrfs_alloc_free_block(trans, root, root->leafsize,
-                                           0, BTRFS_TREE_LOG_OBJECTID,
-                                           trans->transid, 0, 0, 0);
+       leaf = btrfs_alloc_free_block(trans, root, root->leafsize,
+                                     0, BTRFS_TREE_LOG_OBJECTID,
+                                     trans->transid, 0, 0, 0);
+       if (IS_ERR(leaf)) {
+               kfree(root);
+               return ERR_CAST(leaf);
+       }
 
+       root->node = leaf;
        btrfs_set_header_nritems(root->node, 0);
        btrfs_set_header_level(root->node, 0);
        btrfs_set_header_bytenr(root->node, root->node->start);
@@ -968,7 +991,48 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
                            BTRFS_FSID_SIZE);
        btrfs_mark_buffer_dirty(root->node);
        btrfs_tree_unlock(root->node);
-       fs_info->log_root_tree = root;
+       return root;
+}
+
+int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
+                            struct btrfs_fs_info *fs_info)
+{
+       struct btrfs_root *log_root;
+
+       log_root = alloc_log_tree(trans, fs_info);
+       if (IS_ERR(log_root))
+               return PTR_ERR(log_root);
+       WARN_ON(fs_info->log_root_tree);
+       fs_info->log_root_tree = log_root;
+       return 0;
+}
+
+int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
+                      struct btrfs_root *root)
+{
+       struct btrfs_root *log_root;
+       struct btrfs_inode_item *inode_item;
+
+       log_root = alloc_log_tree(trans, root->fs_info);
+       if (IS_ERR(log_root))
+               return PTR_ERR(log_root);
+
+       log_root->last_trans = trans->transid;
+       log_root->root_key.offset = root->root_key.objectid;
+
+       inode_item = &log_root->root_item.inode;
+       inode_item->generation = cpu_to_le64(1);
+       inode_item->size = cpu_to_le64(3);
+       inode_item->nlink = cpu_to_le32(1);
+       inode_item->nbytes = cpu_to_le64(root->leafsize);
+       inode_item->mode = cpu_to_le32(S_IFDIR | 0755);
+
+       btrfs_set_root_bytenr(&log_root->root_item, log_root->node->start);
+       btrfs_set_root_generation(&log_root->root_item, trans->transid);
+
+       WARN_ON(root->log_root);
+       root->log_root = log_root;
+       root->log_transid = 0;
        return 0;
 }
 
@@ -1136,7 +1200,6 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
 {
        struct btrfs_fs_info *info = (struct btrfs_fs_info *)congested_data;
        int ret = 0;
-       struct list_head *cur;
        struct btrfs_device *device;
        struct backing_dev_info *bdi;
 #if 0
@@ -1144,8 +1207,7 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
            btrfs_congested_async(info, 0))
                return 1;
 #endif
-       list_for_each(cur, &info->fs_devices->devices) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(device, &info->fs_devices->devices, dev_list) {
                if (!device->bdev)
                        continue;
                bdi = blk_get_backing_dev_info(device->bdev);
@@ -1163,13 +1225,11 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
  */
 static void __unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
 {
-       struct list_head *cur;
        struct btrfs_device *device;
        struct btrfs_fs_info *info;
 
        info = (struct btrfs_fs_info *)bdi->unplug_io_data;
-       list_for_each(cur, &info->fs_devices->devices) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(device, &info->fs_devices->devices, dev_list) {
                if (!device->bdev)
                        continue;
 
@@ -1447,7 +1507,6 @@ struct btrfs_root *open_ctree(struct super_block *sb,
        INIT_LIST_HEAD(&fs_info->dead_roots);
        INIT_LIST_HEAD(&fs_info->hashers);
        INIT_LIST_HEAD(&fs_info->delalloc_inodes);
-       spin_lock_init(&fs_info->hash_lock);
        spin_lock_init(&fs_info->delalloc_lock);
        spin_lock_init(&fs_info->new_trans_lock);
        spin_lock_init(&fs_info->ref_cache_lock);
@@ -1535,10 +1594,6 @@ struct btrfs_root *open_ctree(struct super_block *sb,
        init_waitqueue_head(&fs_info->transaction_throttle);
        init_waitqueue_head(&fs_info->transaction_wait);
        init_waitqueue_head(&fs_info->async_submit_wait);
-       init_waitqueue_head(&fs_info->tree_log_wait);
-       atomic_set(&fs_info->tree_log_commit, 0);
-       atomic_set(&fs_info->tree_log_writers, 0);
-       fs_info->tree_log_transid = 0;
 
        __setup_root(4096, 4096, 4096, 4096, tree_root,
                     fs_info, BTRFS_ROOT_TREE_OBJECTID);
@@ -1627,6 +1682,8 @@ struct btrfs_root *open_ctree(struct super_block *sb,
         * low idle thresh
         */
        fs_info->endio_workers.idle_thresh = 4;
+       fs_info->endio_meta_workers.idle_thresh = 4;
+
        fs_info->endio_write_workers.idle_thresh = 64;
        fs_info->endio_meta_write_workers.idle_thresh = 64;
 
@@ -1740,13 +1797,13 @@ struct btrfs_root *open_ctree(struct super_block *sb,
        fs_info->system_alloc_profile = fs_info->metadata_alloc_profile;
        fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root,
                                               "btrfs-cleaner");
-       if (!fs_info->cleaner_kthread)
+       if (IS_ERR(fs_info->cleaner_kthread))
                goto fail_csum_root;
 
        fs_info->transaction_kthread = kthread_run(transaction_kthread,
                                                   tree_root,
                                                   "btrfs-transaction");
-       if (!fs_info->transaction_kthread)
+       if (IS_ERR(fs_info->transaction_kthread))
                goto fail_cleaner;
 
        if (btrfs_super_log_root(disk_super) != 0) {
@@ -1828,13 +1885,14 @@ fail_sb_buffer:
 fail_iput:
        invalidate_inode_pages2(fs_info->btree_inode->i_mapping);
        iput(fs_info->btree_inode);
-fail:
+
        btrfs_close_devices(fs_info->fs_devices);
        btrfs_mapping_tree_free(&fs_info->mapping_tree);
+       bdi_destroy(&fs_info->bdi);
 
+fail:
        kfree(extent_root);
        kfree(tree_root);
-       bdi_destroy(&fs_info->bdi);
        kfree(fs_info);
        kfree(chunk_root);
        kfree(dev_root);
@@ -1995,7 +2053,6 @@ static int write_dev_supers(struct btrfs_device *device,
 
 int write_all_supers(struct btrfs_root *root, int max_mirrors)
 {
-       struct list_head *cur;
        struct list_head *head = &root->fs_info->fs_devices->devices;
        struct btrfs_device *dev;
        struct btrfs_super_block *sb;
@@ -2011,8 +2068,7 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors)
 
        sb = &root->fs_info->super_for_commit;
        dev_item = &sb->dev_item;
-       list_for_each(cur, head) {
-               dev = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(dev, head, dev_list) {
                if (!dev->bdev) {
                        total_errors++;
                        continue;
@@ -2045,8 +2101,7 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors)
        }
 
        total_errors = 0;
-       list_for_each(cur, head) {
-               dev = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(dev, head, dev_list) {
                if (!dev->bdev)
                        continue;
                if (!dev->in_fs_metadata || !dev->writeable)
@@ -2260,6 +2315,8 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
        u64 transid = btrfs_header_generation(buf);
        struct inode *btree_inode = root->fs_info->btree_inode;
 
+       btrfs_set_lock_blocking(buf);
+
        WARN_ON(!btrfs_tree_locked(buf));
        if (transid != root->fs_info->generation) {
                printk(KERN_CRIT "btrfs transid mismatch buffer %llu, "
@@ -2302,14 +2359,13 @@ int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid)
        int ret;
        ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid);
        if (ret == 0)
-               buf->flags |= EXTENT_UPTODATE;
+               set_bit(EXTENT_BUFFER_UPTODATE, &buf->bflags);
        return ret;
 }
 
 int btree_lock_page_hook(struct page *page)
 {
        struct inode *inode = page->mapping->host;
-       struct btrfs_root *root = BTRFS_I(inode)->root;
        struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
        struct extent_buffer *eb;
        unsigned long len;
@@ -2324,9 +2380,7 @@ int btree_lock_page_hook(struct page *page)
                goto out;
 
        btrfs_tree_lock(eb);
-       spin_lock(&root->fs_info->hash_lock);
        btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
-       spin_unlock(&root->fs_info->hash_lock);
        btrfs_tree_unlock(eb);
        free_extent_buffer(eb);
 out:
index c0ff404c31b71745b4a8b8b9addb2f9f64f02018..494a56eb298614d6f443b37ff375e94f06f44b92 100644 (file)
@@ -98,5 +98,7 @@ int btrfs_free_log_root_tree(struct btrfs_trans_handle *trans,
                             struct btrfs_fs_info *fs_info);
 int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
                             struct btrfs_fs_info *fs_info);
+int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
+                      struct btrfs_root *root);
 int btree_lock_page_hook(struct page *page);
 #endif
index 293da650873f5193c726c4883bc6ecc5114b0a1a..7527523c2d2d851ce1200424dce799814ac5a1fa 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/pagemap.h>
 #include <linux/writeback.h>
 #include <linux/blkdev.h>
-#include <linux/version.h>
+#include <linux/sort.h>
 #include "compat.h"
 #include "hash.h"
 #include "crc32c.h"
@@ -30,7 +30,6 @@
 #include "volumes.h"
 #include "locking.h"
 #include "ref-cache.h"
-#include "compat.h"
 
 #define PENDING_EXTENT_INSERT 0
 #define PENDING_EXTENT_DELETE 1
@@ -326,10 +325,8 @@ static struct btrfs_space_info *__find_space_info(struct btrfs_fs_info *info,
                                                  u64 flags)
 {
        struct list_head *head = &info->space_info;
-       struct list_head *cur;
        struct btrfs_space_info *found;
-       list_for_each(cur, head) {
-               found = list_entry(cur, struct btrfs_space_info, list);
+       list_for_each_entry(found, head, list) {
                if (found->flags == flags)
                        return found;
        }
@@ -1525,15 +1522,55 @@ out:
        return ret;
 }
 
-int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
-                 struct extent_buffer *orig_buf, struct extent_buffer *buf,
-                 u32 *nr_extents)
+/* when a block goes through cow, we update the reference counts of
+ * everything that block points to.  The internal pointers of the block
+ * can be in just about any order, and it is likely to have clusters of
+ * things that are close together and clusters of things that are not.
+ *
+ * To help reduce the seeks that come with updating all of these reference
+ * counts, sort them by byte number before actual updates are done.
+ *
+ * struct refsort is used to match byte number to slot in the btree block.
+ * we sort based on the byte number and then use the slot to actually
+ * find the item.
+ *
+ * struct refsort is smaller than strcut btrfs_item and smaller than
+ * struct btrfs_key_ptr.  Since we're currently limited to the page size
+ * for a btree block, there's no way for a kmalloc of refsorts for a
+ * single node to be bigger than a page.
+ */
+struct refsort {
+       u64 bytenr;
+       u32 slot;
+};
+
+/*
+ * for passing into sort()
+ */
+static int refsort_cmp(const void *a_void, const void *b_void)
+{
+       const struct refsort *a = a_void;
+       const struct refsort *b = b_void;
+
+       if (a->bytenr < b->bytenr)
+               return -1;
+       if (a->bytenr > b->bytenr)
+               return 1;
+       return 0;
+}
+
+
+noinline int btrfs_inc_ref(struct btrfs_trans_handle *trans,
+                          struct btrfs_root *root,
+                          struct extent_buffer *orig_buf,
+                          struct extent_buffer *buf, u32 *nr_extents)
 {
        u64 bytenr;
        u64 ref_root;
        u64 orig_root;
        u64 ref_generation;
        u64 orig_generation;
+       struct refsort *sorted;
        u32 nritems;
        u32 nr_file_extents = 0;
        struct btrfs_key key;
@@ -1542,6 +1579,8 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
        int level;
        int ret = 0;
        int faili = 0;
+       int refi = 0;
+       int slot;
        int (*process_func)(struct btrfs_trans_handle *, struct btrfs_root *,
                            u64, u64, u64, u64, u64, u64, u64, u64);
 
@@ -1553,6 +1592,9 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
        nritems = btrfs_header_nritems(buf);
        level = btrfs_header_level(buf);
 
+       sorted = kmalloc(sizeof(struct refsort) * nritems, GFP_NOFS);
+       BUG_ON(!sorted);
+
        if (root->ref_cows) {
                process_func = __btrfs_inc_extent_ref;
        } else {
@@ -1565,6 +1607,11 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                process_func = __btrfs_update_extent_ref;
        }
 
+       /*
+        * we make two passes through the items.  In the first pass we
+        * only record the byte number and slot.  Then we sort based on
+        * byte number and do the actual work based on the sorted results
+        */
        for (i = 0; i < nritems; i++) {
                cond_resched();
                if (level == 0) {
@@ -1581,6 +1628,32 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                                continue;
 
                        nr_file_extents++;
+                       sorted[refi].bytenr = bytenr;
+                       sorted[refi].slot = i;
+                       refi++;
+               } else {
+                       bytenr = btrfs_node_blockptr(buf, i);
+                       sorted[refi].bytenr = bytenr;
+                       sorted[refi].slot = i;
+                       refi++;
+               }
+       }
+       /*
+        * if refi == 0, we didn't actually put anything into the sorted
+        * array and we're done
+        */
+       if (refi == 0)
+               goto out;
+
+       sort(sorted, refi, sizeof(struct refsort), refsort_cmp, NULL);
+
+       for (i = 0; i < refi; i++) {
+               cond_resched();
+               slot = sorted[i].slot;
+               bytenr = sorted[i].bytenr;
+
+               if (level == 0) {
+                       btrfs_item_key_to_cpu(buf, &key, slot);
 
                        ret = process_func(trans, root, bytenr,
                                           orig_buf->start, buf->start,
@@ -1589,25 +1662,25 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                                           key.objectid);
 
                        if (ret) {
-                               faili = i;
+                               faili = slot;
                                WARN_ON(1);
                                goto fail;
                        }
                } else {
-                       bytenr = btrfs_node_blockptr(buf, i);
                        ret = process_func(trans, root, bytenr,
                                           orig_buf->start, buf->start,
                                           orig_root, ref_root,
                                           orig_generation, ref_generation,
                                           level - 1);
                        if (ret) {
-                               faili = i;
+                               faili = slot;
                                WARN_ON(1);
                                goto fail;
                        }
                }
        }
 out:
+       kfree(sorted);
        if (nr_extents) {
                if (level == 0)
                        *nr_extents = nr_file_extents;
@@ -1616,6 +1689,7 @@ out:
        }
        return 0;
 fail:
+       kfree(sorted);
        WARN_ON(1);
        return ret;
 }
@@ -2159,7 +2233,8 @@ again:
                ret = find_first_extent_bit(&info->extent_ins, search, &start,
                                            &end, EXTENT_WRITEBACK);
                if (ret) {
-                       if (skipped && all && !num_inserts) {
+                       if (skipped && all && !num_inserts &&
+                           list_empty(&update_list)) {
                                skipped = 0;
                                search = 0;
                                continue;
@@ -2547,6 +2622,7 @@ again:
                if (ret) {
                        if (all && skipped && !nr) {
                                search = 0;
+                               skipped = 0;
                                continue;
                        }
                        mutex_unlock(&info->extent_ins_mutex);
@@ -2700,13 +2776,9 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
        /* if metadata always pin */
        if (owner_objectid < BTRFS_FIRST_FREE_OBJECTID) {
                if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID) {
-                       struct btrfs_block_group_cache *cache;
-
-                       /* btrfs_free_reserved_extent */
-                       cache = btrfs_lookup_block_group(root->fs_info, bytenr);
-                       BUG_ON(!cache);
-                       btrfs_add_free_space(cache, bytenr, num_bytes);
-                       put_block_group(cache);
+                       mutex_lock(&root->fs_info->pinned_mutex);
+                       btrfs_update_pinned_extents(root, bytenr, num_bytes, 1);
+                       mutex_unlock(&root->fs_info->pinned_mutex);
                        update_reserved_extents(root, bytenr, num_bytes, 0);
                        return 0;
                }
@@ -3014,7 +3086,6 @@ loop_check:
 static void dump_space_info(struct btrfs_space_info *info, u64 bytes)
 {
        struct btrfs_block_group_cache *cache;
-       struct list_head *l;
 
        printk(KERN_INFO "space_info has %llu free, is %sfull\n",
               (unsigned long long)(info->total_bytes - info->bytes_used -
@@ -3022,8 +3093,7 @@ static void dump_space_info(struct btrfs_space_info *info, u64 bytes)
               (info->full) ? "" : "not ");
 
        down_read(&info->groups_sem);
-       list_for_each(l, &info->block_groups) {
-               cache = list_entry(l, struct btrfs_block_group_cache, list);
+       list_for_each_entry(cache, &info->block_groups, list) {
                spin_lock(&cache->lock);
                printk(KERN_INFO "block group %llu has %llu bytes, %llu used "
                       "%llu pinned %llu reserved\n",
@@ -3342,7 +3412,10 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
        btrfs_set_header_generation(buf, trans->transid);
        btrfs_tree_lock(buf);
        clean_tree_block(trans, root, buf);
+
+       btrfs_set_lock_blocking(buf);
        btrfs_set_buffer_uptodate(buf);
+
        if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID) {
                set_extent_dirty(&root->dirty_log_pages, buf->start,
                         buf->start + buf->len - 1, GFP_NOFS);
@@ -3351,6 +3424,7 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
                         buf->start + buf->len - 1, GFP_NOFS);
        }
        trans->blocks_used++;
+       /* this returns a buffer locked for blocking */
        return buf;
 }
 
@@ -3388,36 +3462,73 @@ int btrfs_drop_leaf_ref(struct btrfs_trans_handle *trans,
 {
        u64 leaf_owner;
        u64 leaf_generation;
+       struct refsort *sorted;
        struct btrfs_key key;
        struct btrfs_file_extent_item *fi;
        int i;
        int nritems;
        int ret;
+       int refi = 0;
+       int slot;
 
        BUG_ON(!btrfs_is_leaf(leaf));
        nritems = btrfs_header_nritems(leaf);
        leaf_owner = btrfs_header_owner(leaf);
        leaf_generation = btrfs_header_generation(leaf);
 
+       sorted = kmalloc(sizeof(*sorted) * nritems, GFP_NOFS);
+       /* we do this loop twice.  The first time we build a list
+        * of the extents we have a reference on, then we sort the list
+        * by bytenr.  The second time around we actually do the
+        * extent freeing.
+        */
        for (i = 0; i < nritems; i++) {
                u64 disk_bytenr;
                cond_resched();
 
                btrfs_item_key_to_cpu(leaf, &key, i);
+
+               /* only extents have references, skip everything else */
                if (btrfs_key_type(&key) != BTRFS_EXTENT_DATA_KEY)
                        continue;
+
                fi = btrfs_item_ptr(leaf, i, struct btrfs_file_extent_item);
+
+               /* inline extents live in the btree, they don't have refs */
                if (btrfs_file_extent_type(leaf, fi) ==
                    BTRFS_FILE_EXTENT_INLINE)
                        continue;
-               /*
-                * FIXME make sure to insert a trans record that
-                * repeats the snapshot del on crash
-                */
+
                disk_bytenr = btrfs_file_extent_disk_bytenr(leaf, fi);
+
+               /* holes don't have refs */
                if (disk_bytenr == 0)
                        continue;
 
+               sorted[refi].bytenr = disk_bytenr;
+               sorted[refi].slot = i;
+               refi++;
+       }
+
+       if (refi == 0)
+               goto out;
+
+       sort(sorted, refi, sizeof(struct refsort), refsort_cmp, NULL);
+
+       for (i = 0; i < refi; i++) {
+               u64 disk_bytenr;
+
+               disk_bytenr = sorted[i].bytenr;
+               slot = sorted[i].slot;
+
+               cond_resched();
+
+               btrfs_item_key_to_cpu(leaf, &key, slot);
+               if (btrfs_key_type(&key) != BTRFS_EXTENT_DATA_KEY)
+                       continue;
+
+               fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item);
+
                ret = __btrfs_free_extent(trans, root, disk_bytenr,
                                btrfs_file_extent_disk_num_bytes(leaf, fi),
                                leaf->start, leaf_owner, leaf_generation,
@@ -3428,6 +3539,8 @@ int btrfs_drop_leaf_ref(struct btrfs_trans_handle *trans,
                wake_up(&root->fs_info->transaction_throttle);
                cond_resched();
        }
+out:
+       kfree(sorted);
        return 0;
 }
 
@@ -3437,9 +3550,25 @@ static noinline int cache_drop_leaf_ref(struct btrfs_trans_handle *trans,
 {
        int i;
        int ret;
-       struct btrfs_extent_info *info = ref->extents;
+       struct btrfs_extent_info *info;
+       struct refsort *sorted;
+
+       if (ref->nritems == 0)
+               return 0;
 
+       sorted = kmalloc(sizeof(*sorted) * ref->nritems, GFP_NOFS);
        for (i = 0; i < ref->nritems; i++) {
+               sorted[i].bytenr = ref->extents[i].bytenr;
+               sorted[i].slot = i;
+       }
+       sort(sorted, ref->nritems, sizeof(struct refsort), refsort_cmp, NULL);
+
+       /*
+        * the items in the ref were sorted when the ref was inserted
+        * into the ref cache, so this is already in order
+        */
+       for (i = 0; i < ref->nritems; i++) {
+               info = ref->extents + sorted[i].slot;
                ret = __btrfs_free_extent(trans, root, info->bytenr,
                                          info->num_bytes, ref->bytenr,
                                          ref->owner, ref->generation,
@@ -3453,6 +3582,7 @@ static noinline int cache_drop_leaf_ref(struct btrfs_trans_handle *trans,
                info++;
        }
 
+       kfree(sorted);
        return 0;
 }
 
@@ -3496,6 +3626,152 @@ static int drop_snap_lookup_refcount(struct btrfs_root *root, u64 start,
        return ret;
 }
 
+/*
+ * this is used while deleting old snapshots, and it drops the refs
+ * on a whole subtree starting from a level 1 node.
+ *
+ * The idea is to sort all the leaf pointers, and then drop the
+ * ref on all the leaves in order.  Most of the time the leaves
+ * will have ref cache entries, so no leaf IOs will be required to
+ * find the extents they have references on.
+ *
+ * For each leaf, any references it has are also dropped in order
+ *
+ * This ends up dropping the references in something close to optimal
+ * order for reading and modifying the extent allocation tree.
+ */
+static noinline int drop_level_one_refs(struct btrfs_trans_handle *trans,
+                                       struct btrfs_root *root,
+                                       struct btrfs_path *path)
+{
+       u64 bytenr;
+       u64 root_owner;
+       u64 root_gen;
+       struct extent_buffer *eb = path->nodes[1];
+       struct extent_buffer *leaf;
+       struct btrfs_leaf_ref *ref;
+       struct refsort *sorted = NULL;
+       int nritems = btrfs_header_nritems(eb);
+       int ret;
+       int i;
+       int refi = 0;
+       int slot = path->slots[1];
+       u32 blocksize = btrfs_level_size(root, 0);
+       u32 refs;
+
+       if (nritems == 0)
+               goto out;
+
+       root_owner = btrfs_header_owner(eb);
+       root_gen = btrfs_header_generation(eb);
+       sorted = kmalloc(sizeof(*sorted) * nritems, GFP_NOFS);
+
+       /*
+        * step one, sort all the leaf pointers so we don't scribble
+        * randomly into the extent allocation tree
+        */
+       for (i = slot; i < nritems; i++) {
+               sorted[refi].bytenr = btrfs_node_blockptr(eb, i);
+               sorted[refi].slot = i;
+               refi++;
+       }
+
+       /*
+        * nritems won't be zero, but if we're picking up drop_snapshot
+        * after a crash, slot might be > 0, so double check things
+        * just in case.
+        */
+       if (refi == 0)
+               goto out;
+
+       sort(sorted, refi, sizeof(struct refsort), refsort_cmp, NULL);
+
+       /*
+        * the first loop frees everything the leaves point to
+        */
+       for (i = 0; i < refi; i++) {
+               u64 ptr_gen;
+
+               bytenr = sorted[i].bytenr;
+
+               /*
+                * check the reference count on this leaf.  If it is > 1
+                * we just decrement it below and don't update any
+                * of the refs the leaf points to.
+                */
+               ret = drop_snap_lookup_refcount(root, bytenr, blocksize, &refs);
+               BUG_ON(ret);
+               if (refs != 1)
+                       continue;
+
+               ptr_gen = btrfs_node_ptr_generation(eb, sorted[i].slot);
+
+               /*
+                * the leaf only had one reference, which means the
+                * only thing pointing to this leaf is the snapshot
+                * we're deleting.  It isn't possible for the reference
+                * count to increase again later
+                *
+                * The reference cache is checked for the leaf,
+                * and if found we'll be able to drop any refs held by
+                * the leaf without needing to read it in.
+                */
+               ref = btrfs_lookup_leaf_ref(root, bytenr);
+               if (ref && ref->generation != ptr_gen) {
+                       btrfs_free_leaf_ref(root, ref);
+                       ref = NULL;
+               }
+               if (ref) {
+                       ret = cache_drop_leaf_ref(trans, root, ref);
+                       BUG_ON(ret);
+                       btrfs_remove_leaf_ref(root, ref);
+                       btrfs_free_leaf_ref(root, ref);
+               } else {
+                       /*
+                        * the leaf wasn't in the reference cache, so
+                        * we have to read it.
+                        */
+                       leaf = read_tree_block(root, bytenr, blocksize,
+                                              ptr_gen);
+                       ret = btrfs_drop_leaf_ref(trans, root, leaf);
+                       BUG_ON(ret);
+                       free_extent_buffer(leaf);
+               }
+               atomic_inc(&root->fs_info->throttle_gen);
+               wake_up(&root->fs_info->transaction_throttle);
+               cond_resched();
+       }
+
+       /*
+        * run through the loop again to free the refs on the leaves.
+        * This is faster than doing it in the loop above because
+        * the leaves are likely to be clustered together.  We end up
+        * working in nice chunks on the extent allocation tree.
+        */
+       for (i = 0; i < refi; i++) {
+               bytenr = sorted[i].bytenr;
+               ret = __btrfs_free_extent(trans, root, bytenr,
+                                       blocksize, eb->start,
+                                       root_owner, root_gen, 0, 1);
+               BUG_ON(ret);
+
+               atomic_inc(&root->fs_info->throttle_gen);
+               wake_up(&root->fs_info->transaction_throttle);
+               cond_resched();
+       }
+out:
+       kfree(sorted);
+
+       /*
+        * update the path to show we've processed the entire level 1
+        * node.  This will get saved into the root's drop_snapshot_progress
+        * field so these drops are not repeated again if this transaction
+        * commits.
+        */
+       path->slots[1] = nritems;
+       return 0;
+}
+
 /*
  * helper function for drop_snapshot, this walks down the tree dropping ref
  * counts as it goes.
@@ -3511,7 +3787,6 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
        struct extent_buffer *next;
        struct extent_buffer *cur;
        struct extent_buffer *parent;
-       struct btrfs_leaf_ref *ref;
        u32 blocksize;
        int ret;
        u32 refs;
@@ -3538,17 +3813,46 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
                if (path->slots[*level] >=
                    btrfs_header_nritems(cur))
                        break;
+
+               /* the new code goes down to level 1 and does all the
+                * leaves pointed to that node in bulk.  So, this check
+                * for level 0 will always be false.
+                *
+                * But, the disk format allows the drop_snapshot_progress
+                * field in the root to leave things in a state where
+                * a leaf will need cleaning up here.  If someone crashes
+                * with the old code and then boots with the new code,
+                * we might find a leaf here.
+                */
                if (*level == 0) {
                        ret = btrfs_drop_leaf_ref(trans, root, cur);
                        BUG_ON(ret);
                        break;
                }
+
+               /*
+                * once we get to level one, process the whole node
+                * at once, including everything below it.
+                */
+               if (*level == 1) {
+                       ret = drop_level_one_refs(trans, root, path);
+                       BUG_ON(ret);
+                       break;
+               }
+
                bytenr = btrfs_node_blockptr(cur, path->slots[*level]);
                ptr_gen = btrfs_node_ptr_generation(cur, path->slots[*level]);
                blocksize = btrfs_level_size(root, *level - 1);
 
                ret = drop_snap_lookup_refcount(root, bytenr, blocksize, &refs);
                BUG_ON(ret);
+
+               /*
+                * if there is more than one reference, we don't need
+                * to read that node to drop any references it has.  We
+                * just drop the ref we hold on that node and move on to the
+                * next slot in this level.
+                */
                if (refs != 1) {
                        parent = path->nodes[*level];
                        root_owner = btrfs_header_owner(parent);
@@ -3567,46 +3871,12 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
 
                        continue;
                }
+
                /*
-                * at this point, we have a single ref, and since the
-                * only place referencing this extent is a dead root
-                * the reference count should never go higher.
-                * So, we don't need to check it again
+                * we need to keep freeing things in the next level down.
+                * read the block and loop around to process it
                 */
-               if (*level == 1) {
-                       ref = btrfs_lookup_leaf_ref(root, bytenr);
-                       if (ref && ref->generation != ptr_gen) {
-                               btrfs_free_leaf_ref(root, ref);
-                               ref = NULL;
-                       }
-                       if (ref) {
-                               ret = cache_drop_leaf_ref(trans, root, ref);
-                               BUG_ON(ret);
-                               btrfs_remove_leaf_ref(root, ref);
-                               btrfs_free_leaf_ref(root, ref);
-                               *level = 0;
-                               break;
-                       }
-               }
-               next = btrfs_find_tree_block(root, bytenr, blocksize);
-               if (!next || !btrfs_buffer_uptodate(next, ptr_gen)) {
-                       free_extent_buffer(next);
-
-                       next = read_tree_block(root, bytenr, blocksize,
-                                              ptr_gen);
-                       cond_resched();
-#if 0
-                       /*
-                        * this is a debugging check and can go away
-                        * the ref should never go all the way down to 1
-                        * at this point
-                        */
-                       ret = lookup_extent_ref(NULL, root, bytenr, blocksize,
-                                               &refs);
-                       BUG_ON(ret);
-                       WARN_ON(refs != 1);
-#endif
-               }
+               next = read_tree_block(root, bytenr, blocksize, ptr_gen);
                WARN_ON(*level <= 0);
                if (path->nodes[*level-1])
                        free_extent_buffer(path->nodes[*level-1]);
@@ -3631,11 +3901,16 @@ out:
        root_owner = btrfs_header_owner(parent);
        root_gen = btrfs_header_generation(parent);
 
+       /*
+        * cleanup and free the reference on the last node
+        * we processed
+        */
        ret = __btrfs_free_extent(trans, root, bytenr, blocksize,
                                  parent->start, root_owner, root_gen,
                                  *level, 1);
        free_extent_buffer(path->nodes[*level]);
        path->nodes[*level] = NULL;
+
        *level += 1;
        BUG_ON(ret);
 
@@ -3687,6 +3962,7 @@ static noinline int walk_down_subtree(struct btrfs_trans_handle *trans,
 
                next = read_tree_block(root, bytenr, blocksize, ptr_gen);
                btrfs_tree_lock(next);
+               btrfs_set_lock_blocking(next);
 
                ret = btrfs_lookup_extent_ref(trans, root, bytenr, blocksize,
                                              &refs);
@@ -3754,6 +4030,13 @@ static noinline int walk_up_tree(struct btrfs_trans_handle *trans,
                if (slot < btrfs_header_nritems(path->nodes[i]) - 1) {
                        struct extent_buffer *node;
                        struct btrfs_disk_key disk_key;
+
+                       /*
+                        * there is more work to do in this level.
+                        * Update the drop_progress marker to reflect
+                        * the work we've done so far, and then bump
+                        * the slot number
+                        */
                        node = path->nodes[i];
                        path->slots[i]++;
                        *level = i;
@@ -3765,6 +4048,11 @@ static noinline int walk_up_tree(struct btrfs_trans_handle *trans,
                        return 0;
                } else {
                        struct extent_buffer *parent;
+
+                       /*
+                        * this whole node is done, free our reference
+                        * on it and go up one level
+                        */
                        if (path->nodes[*level] == root->node)
                                parent = path->nodes[*level];
                        else
@@ -4444,7 +4732,7 @@ static noinline int replace_one_extent(struct btrfs_trans_handle *trans,
        u64 lock_end = 0;
        u64 num_bytes;
        u64 ext_offset;
-       u64 first_pos;
+       u64 search_end = (u64)-1;
        u32 nritems;
        int nr_scaned = 0;
        int extent_locked = 0;
@@ -4452,7 +4740,6 @@ static noinline int replace_one_extent(struct btrfs_trans_handle *trans,
        int ret;
 
        memcpy(&key, leaf_key, sizeof(key));
-       first_pos = INT_LIMIT(loff_t) - extent_key->offset;
        if (ref_path->owner_objectid != BTRFS_MULTIPLE_OBJECTIDS) {
                if (key.objectid < ref_path->owner_objectid ||
                    (key.objectid == ref_path->owner_objectid &&
@@ -4501,7 +4788,7 @@ next:
                        if ((key.objectid > ref_path->owner_objectid) ||
                            (key.objectid == ref_path->owner_objectid &&
                             key.type > BTRFS_EXTENT_DATA_KEY) ||
-                           (key.offset >= first_pos + extent_key->offset))
+                           key.offset >= search_end)
                                break;
                }
 
@@ -4534,8 +4821,10 @@ next:
                num_bytes = btrfs_file_extent_num_bytes(leaf, fi);
                ext_offset = btrfs_file_extent_offset(leaf, fi);
 
-               if (first_pos > key.offset - ext_offset)
-                       first_pos = key.offset - ext_offset;
+               if (search_end == (u64)-1) {
+                       search_end = key.offset - ext_offset +
+                               btrfs_file_extent_ram_bytes(leaf, fi);
+               }
 
                if (!extent_locked) {
                        lock_start = key.offset;
@@ -4724,7 +5013,7 @@ next:
                }
 skip:
                if (ref_path->owner_objectid != BTRFS_MULTIPLE_OBJECTIDS &&
-                   key.offset >= first_pos + extent_key->offset)
+                   key.offset >= search_end)
                        break;
 
                cond_resched();
@@ -4778,6 +5067,7 @@ int btrfs_reloc_tree_cache_ref(struct btrfs_trans_handle *trans,
                ref->bytenr = buf->start;
                ref->owner = btrfs_header_owner(buf);
                ref->generation = btrfs_header_generation(buf);
+
                ret = btrfs_add_leaf_ref(root, ref, 0);
                WARN_ON(ret);
                btrfs_free_leaf_ref(root, ref);
@@ -5957,9 +6247,11 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
        path = btrfs_alloc_path();
        BUG_ON(!path);
 
-       btrfs_remove_free_space_cache(block_group);
+       spin_lock(&root->fs_info->block_group_cache_lock);
        rb_erase(&block_group->cache_node,
                 &root->fs_info->block_group_cache_tree);
+       spin_unlock(&root->fs_info->block_group_cache_lock);
+       btrfs_remove_free_space_cache(block_group);
        down_write(&block_group->space_info->groups_sem);
        list_del(&block_group->list);
        up_write(&block_group->space_info->groups_sem);
index e086d407f1fa8b3ad34b2c6770721e8592ca9cc1..37d43b516b79bdb7cb64dd153a06a805be59dd94 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/spinlock.h>
 #include <linux/blkdev.h>
 #include <linux/swap.h>
-#include <linux/version.h>
 #include <linux/writeback.h>
 #include <linux/pagevec.h>
 #include "extent_io.h"
@@ -31,7 +30,7 @@ static LIST_HEAD(buffers);
 static LIST_HEAD(states);
 
 #define LEAK_DEBUG 0
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
 static DEFINE_SPINLOCK(leak_lock);
 #endif
 
@@ -120,7 +119,7 @@ void extent_io_tree_init(struct extent_io_tree *tree,
 static struct extent_state *alloc_extent_state(gfp_t mask)
 {
        struct extent_state *state;
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
        unsigned long flags;
 #endif
 
@@ -130,7 +129,7 @@ static struct extent_state *alloc_extent_state(gfp_t mask)
        state->state = 0;
        state->private = 0;
        state->tree = NULL;
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
        spin_lock_irqsave(&leak_lock, flags);
        list_add(&state->leak_list, &states);
        spin_unlock_irqrestore(&leak_lock, flags);
@@ -145,11 +144,11 @@ static void free_extent_state(struct extent_state *state)
        if (!state)
                return;
        if (atomic_dec_and_test(&state->refs)) {
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
                unsigned long flags;
 #endif
                WARN_ON(state->tree);
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
                spin_lock_irqsave(&leak_lock, flags);
                list_del(&state->leak_list);
                spin_unlock_irqrestore(&leak_lock, flags);
@@ -2378,11 +2377,6 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
        int scanned = 0;
        int range_whole = 0;
 
-       if (wbc->nonblocking && bdi_write_congested(bdi)) {
-               wbc->encountered_congestion = 1;
-               return 0;
-       }
-
        pagevec_init(&pvec, 0);
        if (wbc->range_cyclic) {
                index = mapping->writeback_index; /* Start from prev offset */
@@ -2855,6 +2849,98 @@ out:
        return sector;
 }
 
+int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+               __u64 start, __u64 len, get_extent_t *get_extent)
+{
+       int ret;
+       u64 off = start;
+       u64 max = start + len;
+       u32 flags = 0;
+       u64 disko = 0;
+       struct extent_map *em = NULL;
+       int end = 0;
+       u64 em_start = 0, em_len = 0;
+       unsigned long emflags;
+       ret = 0;
+
+       if (len == 0)
+               return -EINVAL;
+
+       lock_extent(&BTRFS_I(inode)->io_tree, start, start + len,
+               GFP_NOFS);
+       em = get_extent(inode, NULL, 0, off, max - off, 0);
+       if (!em)
+               goto out;
+       if (IS_ERR(em)) {
+               ret = PTR_ERR(em);
+               goto out;
+       }
+       while (!end) {
+               off = em->start + em->len;
+               if (off >= max)
+                       end = 1;
+
+               em_start = em->start;
+               em_len = em->len;
+
+               disko = 0;
+               flags = 0;
+
+               switch (em->block_start) {
+               case EXTENT_MAP_LAST_BYTE:
+                       end = 1;
+                       flags |= FIEMAP_EXTENT_LAST;
+                       break;
+               case EXTENT_MAP_HOLE:
+                       flags |= FIEMAP_EXTENT_UNWRITTEN;
+                       break;
+               case EXTENT_MAP_INLINE:
+                       flags |= (FIEMAP_EXTENT_DATA_INLINE |
+                                 FIEMAP_EXTENT_NOT_ALIGNED);
+                       break;
+               case EXTENT_MAP_DELALLOC:
+                       flags |= (FIEMAP_EXTENT_DELALLOC |
+                                 FIEMAP_EXTENT_UNKNOWN);
+                       break;
+               default:
+                       disko = em->block_start;
+                       break;
+               }
+               if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags))
+                       flags |= FIEMAP_EXTENT_ENCODED;
+
+               emflags = em->flags;
+               free_extent_map(em);
+               em = NULL;
+
+               if (!end) {
+                       em = get_extent(inode, NULL, 0, off, max - off, 0);
+                       if (!em)
+                               goto out;
+                       if (IS_ERR(em)) {
+                               ret = PTR_ERR(em);
+                               goto out;
+                       }
+                       emflags = em->flags;
+               }
+               if (test_bit(EXTENT_FLAG_VACANCY, &emflags)) {
+                       flags |= FIEMAP_EXTENT_LAST;
+                       end = 1;
+               }
+
+               ret = fiemap_fill_next_extent(fieinfo, em_start, disko,
+                                       em_len, flags);
+               if (ret)
+                       goto out_free;
+       }
+out_free:
+       free_extent_map(em);
+out:
+       unlock_extent(&BTRFS_I(inode)->io_tree, start, start + len,
+                       GFP_NOFS);
+       return ret;
+}
+
 static inline struct page *extent_buffer_page(struct extent_buffer *eb,
                                              unsigned long i)
 {
@@ -2892,15 +2978,17 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree,
                                                   gfp_t mask)
 {
        struct extent_buffer *eb = NULL;
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
        unsigned long flags;
 #endif
 
        eb = kmem_cache_zalloc(extent_buffer_cache, mask);
        eb->start = start;
        eb->len = len;
-       mutex_init(&eb->mutex);
-#ifdef LEAK_DEBUG
+       spin_lock_init(&eb->lock);
+       init_waitqueue_head(&eb->lock_wq);
+
+#if LEAK_DEBUG
        spin_lock_irqsave(&leak_lock, flags);
        list_add(&eb->leak_list, &buffers);
        spin_unlock_irqrestore(&leak_lock, flags);
@@ -2912,7 +3000,7 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree,
 
 static void __free_extent_buffer(struct extent_buffer *eb)
 {
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
        unsigned long flags;
        spin_lock_irqsave(&leak_lock, flags);
        list_del(&eb->leak_list);
@@ -2980,8 +3068,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree,
                unlock_page(p);
        }
        if (uptodate)
-               eb->flags |= EXTENT_UPTODATE;
-       eb->flags |= EXTENT_BUFFER_FILLED;
+               set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
 
        spin_lock(&tree->buffer_lock);
        exists = buffer_tree_insert(tree, start, &eb->rb_node);
@@ -3135,7 +3222,7 @@ int clear_extent_buffer_uptodate(struct extent_io_tree *tree,
        unsigned long num_pages;
 
        num_pages = num_extent_pages(eb->start, eb->len);
-       eb->flags &= ~EXTENT_UPTODATE;
+       clear_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
 
        clear_extent_uptodate(tree, eb->start, eb->start + eb->len - 1,
                              GFP_NOFS);
@@ -3206,7 +3293,7 @@ int extent_buffer_uptodate(struct extent_io_tree *tree,
        struct page *page;
        int pg_uptodate = 1;
 
-       if (eb->flags & EXTENT_UPTODATE)
+       if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))
                return 1;
 
        ret = test_range_bit(tree, eb->start, eb->start + eb->len - 1,
@@ -3242,7 +3329,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
        struct bio *bio = NULL;
        unsigned long bio_flags = 0;
 
-       if (eb->flags & EXTENT_UPTODATE)
+       if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))
                return 0;
 
        if (test_range_bit(tree, eb->start, eb->start + eb->len - 1,
@@ -3273,7 +3360,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
        }
        if (all_uptodate) {
                if (start_i == 0)
-                       eb->flags |= EXTENT_UPTODATE;
+                       set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
                goto unlock_exit;
        }
 
@@ -3309,7 +3396,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
        }
 
        if (!ret)
-               eb->flags |= EXTENT_UPTODATE;
+               set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
        return ret;
 
 unlock_exit:
@@ -3406,7 +3493,6 @@ int map_extent_buffer(struct extent_buffer *eb, unsigned long start,
                unmap_extent_buffer(eb, eb->map_token, km);
                eb->map_token = NULL;
                save = 1;
-               WARN_ON(!mutex_is_locked(&eb->mutex));
        }
        err = map_private_extent_buffer(eb, start, min_len, token, map,
                                       map_start, map_len, km);
index c5b483a791372c6b9a849b36c41e8e3dcf6437ac..1f9df88afbf6922e9f4af87972f05521ed15e862 100644 (file)
 /* flags for bio submission */
 #define EXTENT_BIO_COMPRESSED 1
 
+/* these are bit numbers for test/set bit */
+#define EXTENT_BUFFER_UPTODATE 0
+#define EXTENT_BUFFER_BLOCKING 1
+
 /*
  * page->private values.  Every page that is controlled by the extent
  * map has page->private set to one.
@@ -95,11 +99,19 @@ struct extent_buffer {
        unsigned long map_start;
        unsigned long map_len;
        struct page *first_page;
+       unsigned long bflags;
        atomic_t refs;
-       int flags;
        struct list_head leak_list;
        struct rb_node rb_node;
-       struct mutex mutex;
+
+       /* the spinlock is used to protect most operations */
+       spinlock_t lock;
+
+       /*
+        * when we keep the lock held while blocking, waiters go onto
+        * the wq
+        */
+       wait_queue_head_t lock_wq;
 };
 
 struct extent_map_tree;
@@ -193,6 +205,8 @@ int extent_commit_write(struct extent_io_tree *tree,
                        unsigned from, unsigned to);
 sector_t extent_bmap(struct address_space *mapping, sector_t iblock,
                get_extent_t *get_extent);
+int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+               __u64 start, __u64 len, get_extent_t *get_extent);
 int set_range_dirty(struct extent_io_tree *tree, u64 start, u64 end);
 int set_state_private(struct extent_io_tree *tree, u64 start, u64 private);
 int get_state_private(struct extent_io_tree *tree, u64 start, u64 *private);
index 4a83e33ada32548c1970adceab67590b1747c60d..50da69da20cec141fca63ffba2a4e92b8f93f875 100644 (file)
@@ -3,7 +3,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
-#include <linux/version.h>
 #include <linux/hardirq.h>
 #include "extent_map.h"
 
index 90268334145e30e4abe0390333b98678bf47db29..3e8023efaff7581568f8d9a4f131a01c37f76d3b 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/writeback.h>
 #include <linux/statfs.h>
 #include <linux/compat.h>
-#include <linux/version.h>
 #include "ctree.h"
 #include "disk-io.h"
 #include "transaction.h"
@@ -1215,10 +1214,10 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
        }
        mutex_unlock(&root->fs_info->trans_mutex);
 
-       root->fs_info->tree_log_batch++;
+       root->log_batch++;
        filemap_fdatawrite(inode->i_mapping);
        btrfs_wait_ordered_range(inode, 0, (u64)-1);
-       root->fs_info->tree_log_batch++;
+       root->log_batch++;
 
        /*
         * ok we haven't committed the transaction yet, lets do a commit
index 8adfe059ab4153f911da295a9673009965039bc2..8f0706210a478cc8866b3dd280b2860e75089757 100644 (file)
@@ -34,7 +34,6 @@
 #include <linux/statfs.h>
 #include <linux/compat.h>
 #include <linux/bit_spinlock.h>
-#include <linux/version.h>
 #include <linux/xattr.h>
 #include <linux/posix_acl.h>
 #include <linux/falloc.h>
@@ -51,6 +50,7 @@
 #include "tree-log.h"
 #include "ref-cache.h"
 #include "compression.h"
+#include "locking.h"
 
 struct btrfs_iget_args {
        u64 ino;
@@ -91,6 +91,16 @@ static noinline int cow_file_range(struct inode *inode,
                                   u64 start, u64 end, int *page_started,
                                   unsigned long *nr_written, int unlock);
 
+static int btrfs_init_inode_security(struct inode *inode,  struct inode *dir)
+{
+       int err;
+
+       err = btrfs_init_acl(inode, dir);
+       if (!err)
+               err = btrfs_xattr_security_init(inode, dir);
+       return err;
+}
+
 /*
  * a very lame attempt at stopping writes when the FS is 85% full.  There
  * are countless ways this is incorrect, but it is better than nothing.
@@ -350,6 +360,19 @@ again:
        nr_pages = (end >> PAGE_CACHE_SHIFT) - (start >> PAGE_CACHE_SHIFT) + 1;
        nr_pages = min(nr_pages, (128 * 1024UL) / PAGE_CACHE_SIZE);
 
+       /*
+        * we don't want to send crud past the end of i_size through
+        * compression, that's just a waste of CPU time.  So, if the
+        * end of the file is before the start of our current
+        * requested range of bytes, we bail out to the uncompressed
+        * cleanup code that can deal with all of this.
+        *
+        * It isn't really the fastest way to fix things, but this is a
+        * very uncommon corner.
+        */
+       if (actual_end <= start)
+               goto cleanup_and_bail_uncompressed;
+
        total_compressed = actual_end - start;
 
        /* we want to make sure that amount of ram required to uncompress
@@ -494,6 +517,7 @@ again:
                        goto again;
                }
        } else {
+cleanup_and_bail_uncompressed:
                /*
                 * No compression, but we still need to write the pages in
                 * the file we've been given so far.  redirty the locked
@@ -1324,12 +1348,11 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans,
                             struct inode *inode, u64 file_offset,
                             struct list_head *list)
 {
-       struct list_head *cur;
        struct btrfs_ordered_sum *sum;
 
        btrfs_set_trans_block_group(trans, inode);
-       list_for_each(cur, list) {
-               sum = list_entry(cur, struct btrfs_ordered_sum, list);
+
+       list_for_each_entry(sum, list, list) {
                btrfs_csum_file_blocks(trans,
                       BTRFS_I(inode)->root->fs_info->csum_root, sum);
        }
@@ -2013,6 +2036,7 @@ void btrfs_read_locked_inode(struct inode *inode)
        BTRFS_I(inode)->flags = btrfs_inode_flags(leaf, inode_item);
 
        alloc_group_block = btrfs_inode_block_group(leaf, inode_item);
+
        BTRFS_I(inode)->block_group = btrfs_find_block_group(root, 0,
                                                alloc_group_block, 0);
        btrfs_free_path(path);
@@ -2039,6 +2063,7 @@ void btrfs_read_locked_inode(struct inode *inode)
                inode->i_mapping->backing_dev_info = &root->fs_info->bdi;
                break;
        default:
+               inode->i_op = &btrfs_special_inode_operations;
                init_special_inode(inode, inode->i_mode, rdev);
                break;
        }
@@ -2108,6 +2133,7 @@ noinline int btrfs_update_inode(struct btrfs_trans_handle *trans,
                goto failed;
        }
 
+       btrfs_unlock_up_safe(path, 1);
        leaf = path->nodes[0];
        inode_item = btrfs_item_ptr(leaf, path->slots[0],
                                  struct btrfs_inode_item);
@@ -2429,6 +2455,8 @@ next_node:
                        ref->generation = leaf_gen;
                        ref->nritems = 0;
 
+                       btrfs_sort_leaf_ref(ref);
+
                        ret = btrfs_add_leaf_ref(root, ref, 0);
                        WARN_ON(ret);
                        btrfs_free_leaf_ref(root, ref);
@@ -2476,7 +2504,7 @@ noinline int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
        struct btrfs_path *path;
        struct btrfs_key key;
        struct btrfs_key found_key;
-       u32 found_type;
+       u32 found_type = (u8)-1;
        struct extent_buffer *leaf;
        struct btrfs_file_extent_item *fi;
        u64 extent_start = 0;
@@ -2663,6 +2691,8 @@ next:
                        if (pending_del_nr)
                                goto del_pending;
                        btrfs_release_path(root, path);
+                       if (found_type == BTRFS_INODE_ITEM_KEY)
+                               break;
                        goto search_again;
                }
 
@@ -2679,6 +2709,8 @@ del_pending:
                        BUG_ON(ret);
                        pending_del_nr = 0;
                        btrfs_release_path(root, path);
+                       if (found_type == BTRFS_INODE_ITEM_KEY)
+                               break;
                        goto search_again;
                }
        }
@@ -3265,7 +3297,7 @@ skip:
 
        /* Reached end of directory/root. Bump pos past the last item. */
        if (key_type == BTRFS_DIR_INDEX_KEY)
-               filp->f_pos = INT_LIMIT(typeof(filp->f_pos));
+               filp->f_pos = INT_LIMIT(off_t);
        else
                filp->f_pos++;
 nopos:
@@ -3458,7 +3490,14 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
                root->highest_inode = objectid;
 
        inode->i_uid = current_fsuid();
-       inode->i_gid = current_fsgid();
+
+       if (dir && (dir->i_mode & S_ISGID)) {
+               inode->i_gid = dir->i_gid;
+               if (S_ISDIR(mode))
+                       mode |= S_ISGID;
+       } else
+               inode->i_gid = current_fsgid();
+
        inode->i_mode = mode;
        inode->i_ino = objectid;
        inode_set_bytes(inode, 0);
@@ -3586,7 +3625,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
        if (IS_ERR(inode))
                goto out_unlock;
 
-       err = btrfs_init_acl(inode, dir);
+       err = btrfs_init_inode_security(inode, dir);
        if (err) {
                drop_inode = 1;
                goto out_unlock;
@@ -3649,7 +3688,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
        if (IS_ERR(inode))
                goto out_unlock;
 
-       err = btrfs_init_acl(inode, dir);
+       err = btrfs_init_inode_security(inode, dir);
        if (err) {
                drop_inode = 1;
                goto out_unlock;
@@ -3772,7 +3811,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 
        drop_on_err = 1;
 
-       err = btrfs_init_acl(inode, dir);
+       err = btrfs_init_inode_security(inode, dir);
        if (err)
                goto out_fail;
 
@@ -4158,9 +4197,10 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
        return -EINVAL;
 }
 
-static sector_t btrfs_bmap(struct address_space *mapping, sector_t iblock)
+static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+               __u64 start, __u64 len)
 {
-       return extent_bmap(mapping, iblock, btrfs_get_extent);
+       return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent);
 }
 
 int btrfs_readpage(struct file *file, struct page *page)
@@ -4733,7 +4773,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
        if (IS_ERR(inode))
                goto out_unlock;
 
-       err = btrfs_init_acl(inode, dir);
+       err = btrfs_init_inode_security(inode, dir);
        if (err) {
                drop_inode = 1;
                goto out_unlock;
@@ -4987,13 +5027,24 @@ static struct extent_io_ops btrfs_extent_io_ops = {
        .clear_bit_hook = btrfs_clear_bit_hook,
 };
 
+/*
+ * btrfs doesn't support the bmap operation because swapfiles
+ * use bmap to make a mapping of extents in the file.  They assume
+ * these extents won't change over the life of the file and they
+ * use the bmap result to do IO directly to the drive.
+ *
+ * the btrfs bmap call would return logical addresses that aren't
+ * suitable for IO and they also will change frequently as COW
+ * operations happen.  So, swapfile + btrfs == corruption.
+ *
+ * For now we're avoiding this by dropping bmap.
+ */
 static struct address_space_operations btrfs_aops = {
        .readpage       = btrfs_readpage,
        .writepage      = btrfs_writepage,
        .writepages     = btrfs_writepages,
        .readpages      = btrfs_readpages,
        .sync_page      = block_sync_page,
-       .bmap           = btrfs_bmap,
        .direct_IO      = btrfs_direct_IO,
        .invalidatepage = btrfs_invalidatepage,
        .releasepage    = btrfs_releasepage,
@@ -5017,6 +5068,7 @@ static struct inode_operations btrfs_file_inode_operations = {
        .removexattr    = btrfs_removexattr,
        .permission     = btrfs_permission,
        .fallocate      = btrfs_fallocate,
+       .fiemap         = btrfs_fiemap,
 };
 static struct inode_operations btrfs_special_inode_operations = {
        .getattr        = btrfs_getattr,
@@ -5032,4 +5084,8 @@ static struct inode_operations btrfs_symlink_inode_operations = {
        .follow_link    = page_follow_link_light,
        .put_link       = page_put_link,
        .permission     = btrfs_permission,
+       .setxattr       = btrfs_setxattr,
+       .getxattr       = btrfs_getxattr,
+       .listxattr      = btrfs_listxattr,
+       .removexattr    = btrfs_removexattr,
 };
index c2aa33e3feb5b40f251fcdedae4aed93b3745fc2..988fdc8b49ebb92b7ad7d5d9163f3fc23e866d16 100644 (file)
@@ -38,7 +38,6 @@
 #include <linux/compat.h>
 #include <linux/bit_spinlock.h>
 #include <linux/security.h>
-#include <linux/version.h>
 #include <linux/xattr.h>
 #include <linux/vmalloc.h>
 #include "compat.h"
index 39bae7761db6c20ae87686a70d383a12c6285ee6..68fd9ccf1805e63adf0973612f9822b9585034f8 100644 (file)
 #include "locking.h"
 
 /*
- * locks the per buffer mutex in an extent buffer.  This uses adaptive locks
- * and the spin is not tuned very extensively.  The spinning does make a big
- * difference in almost every workload, but spinning for the right amount of
- * time needs some help.
- *
- * In general, we want to spin as long as the lock holder is doing btree
- * searches, and we should give up if they are in more expensive code.
+ * btrfs_header_level() isn't free, so don't call it when lockdep isn't
+ * on
  */
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+static inline void spin_nested(struct extent_buffer *eb)
+{
+       spin_lock_nested(&eb->lock, BTRFS_MAX_LEVEL - btrfs_header_level(eb));
+}
+#else
+static inline void spin_nested(struct extent_buffer *eb)
+{
+       spin_lock(&eb->lock);
+}
+#endif
 
-int btrfs_tree_lock(struct extent_buffer *eb)
+/*
+ * Setting a lock to blocking will drop the spinlock and set the
+ * flag that forces other procs who want the lock to wait.  After
+ * this you can safely schedule with the lock held.
+ */
+void btrfs_set_lock_blocking(struct extent_buffer *eb)
 {
-       int i;
+       if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) {
+               set_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags);
+               spin_unlock(&eb->lock);
+       }
+       /* exit with the spin lock released and the bit set */
+}
 
-       if (mutex_trylock(&eb->mutex))
-               return 0;
+/*
+ * clearing the blocking flag will take the spinlock again.
+ * After this you can't safely schedule
+ */
+void btrfs_clear_lock_blocking(struct extent_buffer *eb)
+{
+       if (test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) {
+               spin_nested(eb);
+               clear_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags);
+               smp_mb__after_clear_bit();
+       }
+       /* exit with the spin lock held */
+}
+
+/*
+ * unfortunately, many of the places that currently set a lock to blocking
+ * don't end up blocking for every long, and often they don't block
+ * at all.  For a dbench 50 run, if we don't spin one the blocking bit
+ * at all, the context switch rate can jump up to 400,000/sec or more.
+ *
+ * So, we're still stuck with this crummy spin on the blocking bit,
+ * at least until the most common causes of the short blocks
+ * can be dealt with.
+ */
+static int btrfs_spin_on_block(struct extent_buffer *eb)
+{
+       int i;
        for (i = 0; i < 512; i++) {
                cpu_relax();
-               if (mutex_trylock(&eb->mutex))
+               if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
+                       return 1;
+               if (need_resched())
+                       break;
+       }
+       return 0;
+}
+
+/*
+ * This is somewhat different from trylock.  It will take the
+ * spinlock but if it finds the lock is set to blocking, it will
+ * return without the lock held.
+ *
+ * returns 1 if it was able to take the lock and zero otherwise
+ *
+ * After this call, scheduling is not safe without first calling
+ * btrfs_set_lock_blocking()
+ */
+int btrfs_try_spin_lock(struct extent_buffer *eb)
+{
+       int i;
+
+       spin_nested(eb);
+       if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
+               return 1;
+       spin_unlock(&eb->lock);
+
+       /* spin for a bit on the BLOCKING flag */
+       for (i = 0; i < 2; i++) {
+               if (!btrfs_spin_on_block(eb))
+                       break;
+
+               spin_nested(eb);
+               if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
+                       return 1;
+               spin_unlock(&eb->lock);
+       }
+       return 0;
+}
+
+/*
+ * the autoremove wake function will return 0 if it tried to wake up
+ * a process that was already awake, which means that process won't
+ * count as an exclusive wakeup.  The waitq code will continue waking
+ * procs until it finds one that was actually sleeping.
+ *
+ * For btrfs, this isn't quite what we want.  We want a single proc
+ * to be notified that the lock is ready for taking.  If that proc
+ * already happen to be awake, great, it will loop around and try for
+ * the lock.
+ *
+ * So, btrfs_wake_function always returns 1, even when the proc that we
+ * tried to wake up was already awake.
+ */
+static int btrfs_wake_function(wait_queue_t *wait, unsigned mode,
+                              int sync, void *key)
+{
+       autoremove_wake_function(wait, mode, sync, key);
+       return 1;
+}
+
+/*
+ * returns with the extent buffer spinlocked.
+ *
+ * This will spin and/or wait as required to take the lock, and then
+ * return with the spinlock held.
+ *
+ * After this call, scheduling is not safe without first calling
+ * btrfs_set_lock_blocking()
+ */
+int btrfs_tree_lock(struct extent_buffer *eb)
+{
+       DEFINE_WAIT(wait);
+       wait.func = btrfs_wake_function;
+
+       while(1) {
+               spin_nested(eb);
+
+               /* nobody is blocking, exit with the spinlock held */
+               if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
                        return 0;
+
+               /*
+                * we have the spinlock, but the real owner is blocking.
+                * wait for them
+                */
+               spin_unlock(&eb->lock);
+
+               /*
+                * spin for a bit, and if the blocking flag goes away,
+                * loop around
+                */
+               if (btrfs_spin_on_block(eb))
+                       continue;
+
+               prepare_to_wait_exclusive(&eb->lock_wq, &wait,
+                                         TASK_UNINTERRUPTIBLE);
+
+               if (test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
+                       schedule();
+
+               finish_wait(&eb->lock_wq, &wait);
        }
-       cpu_relax();
-       mutex_lock_nested(&eb->mutex, BTRFS_MAX_LEVEL - btrfs_header_level(eb));
        return 0;
 }
 
+/*
+ * Very quick trylock, this does not spin or schedule.  It returns
+ * 1 with the spinlock held if it was able to take the lock, or it
+ * returns zero if it was unable to take the lock.
+ *
+ * After this call, scheduling is not safe without first calling
+ * btrfs_set_lock_blocking()
+ */
 int btrfs_try_tree_lock(struct extent_buffer *eb)
 {
-       return mutex_trylock(&eb->mutex);
+       if (spin_trylock(&eb->lock)) {
+               if (test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) {
+                       /*
+                        * we've got the spinlock, but the real owner is
+                        * blocking.  Drop the spinlock and return failure
+                        */
+                       spin_unlock(&eb->lock);
+                       return 0;
+               }
+               return 1;
+       }
+       /* someone else has the spinlock giveup */
+       return 0;
 }
 
 int btrfs_tree_unlock(struct extent_buffer *eb)
 {
-       mutex_unlock(&eb->mutex);
+       /*
+        * if we were a blocking owner, we don't have the spinlock held
+        * just clear the bit and look for waiters
+        */
+       if (test_and_clear_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
+               smp_mb__after_clear_bit();
+       else
+               spin_unlock(&eb->lock);
+
+       if (waitqueue_active(&eb->lock_wq))
+               wake_up(&eb->lock_wq);
        return 0;
 }
 
 int btrfs_tree_locked(struct extent_buffer *eb)
 {
-       return mutex_is_locked(&eb->mutex);
+       return test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags) ||
+                       spin_is_locked(&eb->lock);
 }
 
 /*
@@ -75,12 +245,14 @@ int btrfs_path_lock_waiting(struct btrfs_path *path, int level)
 {
        int i;
        struct extent_buffer *eb;
+
        for (i = level; i <= level + 1 && i < BTRFS_MAX_LEVEL; i++) {
                eb = path->nodes[i];
                if (!eb)
                        break;
                smp_mb();
-               if (!list_empty(&eb->mutex.wait_list))
+               if (spin_is_contended(&eb->lock) ||
+                   waitqueue_active(&eb->lock_wq))
                        return 1;
        }
        return 0;
index bc1faef12519451294e361becacbd9f404ac0afd..d92e707f5870c1dfb13462298047b58c8827f622 100644 (file)
 int btrfs_tree_lock(struct extent_buffer *eb);
 int btrfs_tree_unlock(struct extent_buffer *eb);
 int btrfs_tree_locked(struct extent_buffer *eb);
+
 int btrfs_try_tree_lock(struct extent_buffer *eb);
+int btrfs_try_spin_lock(struct extent_buffer *eb);
+
 int btrfs_path_lock_waiting(struct btrfs_path *path, int level);
+
+void btrfs_set_lock_blocking(struct extent_buffer *eb);
+void btrfs_clear_lock_blocking(struct extent_buffer *eb);
 #endif
index a2094017027489a16473e03db2cddaad41c048cc..77c2411a5f0f0c59b6ab97e78b2828d94a1c7401 100644 (file)
@@ -613,7 +613,6 @@ int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr,
        struct btrfs_sector_sum *sector_sums;
        struct btrfs_ordered_extent *ordered;
        struct btrfs_ordered_inode_tree *tree = &BTRFS_I(inode)->ordered_tree;
-       struct list_head *cur;
        unsigned long num_sectors;
        unsigned long i;
        u32 sectorsize = BTRFS_I(inode)->root->sectorsize;
@@ -624,8 +623,7 @@ int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr,
                return 1;
 
        mutex_lock(&tree->mutex);
-       list_for_each_prev(cur, &ordered->list) {
-               ordered_sum = list_entry(cur, struct btrfs_ordered_sum, list);
+       list_for_each_entry_reverse(ordered_sum, &ordered->list, list) {
                if (disk_bytenr >= ordered_sum->bytenr) {
                        num_sectors = ordered_sum->len / sectorsize;
                        sector_sums = ordered_sum->sums;
index 6f0acc4c9eab7675dd9cacc0804bc530f3db46d3..d0cc62bccb948e776fb9845c7da1a8f2119788f6 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <linux/sched.h>
+#include <linux/sort.h>
 #include "ctree.h"
 #include "ref-cache.h"
 #include "transaction.h"
index 16f3183d7c59058909707d72ad16315d091bc098..bc283ad2db7364b112824ab08f44e58e37fc18cf 100644 (file)
@@ -73,5 +73,4 @@ int btrfs_add_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref,
 int btrfs_remove_leaf_refs(struct btrfs_root *root, u64 max_root_gen,
                           int shared);
 int btrfs_remove_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref);
-
 #endif
index db9fb3bc1e333c5255a92537a9891d4f8716f899..f3fd7e2cbc383aaefd42be70a02f80c759b6979b 100644 (file)
@@ -37,7 +37,6 @@
 #include <linux/ctype.h>
 #include <linux/namei.h>
 #include <linux/miscdevice.h>
-#include <linux/version.h>
 #include <linux/magic.h>
 #include "compat.h"
 #include "ctree.h"
@@ -583,17 +582,18 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
        struct btrfs_ioctl_vol_args *vol;
        struct btrfs_fs_devices *fs_devices;
        int ret = -ENOTTY;
-       int len;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
        vol = kmalloc(sizeof(*vol), GFP_KERNEL);
+       if (!vol)
+               return -ENOMEM;
+
        if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) {
                ret = -EFAULT;
                goto out;
        }
-       len = strnlen(vol->name, BTRFS_PATH_NAME_MAX);
 
        switch (cmd) {
        case BTRFS_IOC_SCAN_DEV:
index 8a08f94433407e6c8ca7ce2e15285ef75115bb26..919172de5c9aa9ce64630f593f74a7942e8292fd 100644 (file)
@@ -852,11 +852,9 @@ static noinline int create_pending_snapshots(struct btrfs_trans_handle *trans,
 {
        struct btrfs_pending_snapshot *pending;
        struct list_head *head = &trans->transaction->pending_snapshots;
-       struct list_head *cur;
        int ret;
 
-       list_for_each(cur, head) {
-               pending = list_entry(cur, struct btrfs_pending_snapshot, list);
+       list_for_each_entry(pending, head, list) {
                ret = create_pending_snapshot(trans, fs_info, pending);
                BUG_ON(ret);
        }
index 3e8358c36165ece2969b28348c2286b1b609dcbf..98d25fa4570ea902abc4c8345ecf29f62af9013c 100644 (file)
@@ -74,6 +74,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
                u32 nritems;
 
                root_node = btrfs_lock_root_node(root);
+               btrfs_set_lock_blocking(root_node);
                nritems = btrfs_header_nritems(root_node);
                root->defrag_max.objectid = 0;
                /* from above we know this is not a leaf */
index d81cda2e077c9b3c4685d26a55057826d0c06b2d..20794290256b4f977f14a5ea95810781edc7bbad 100644 (file)
@@ -77,104 +77,6 @@ static int link_to_fixup_dir(struct btrfs_trans_handle *trans,
  * and once to do all the other items.
  */
 
-/*
- * btrfs_add_log_tree adds a new per-subvolume log tree into the
- * tree of log tree roots.  This must be called with a tree log transaction
- * running (see start_log_trans).
- */
-static int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
-                     struct btrfs_root *root)
-{
-       struct btrfs_key key;
-       struct btrfs_root_item root_item;
-       struct btrfs_inode_item *inode_item;
-       struct extent_buffer *leaf;
-       struct btrfs_root *new_root = root;
-       int ret;
-       u64 objectid = root->root_key.objectid;
-
-       leaf = btrfs_alloc_free_block(trans, root, root->leafsize, 0,
-                                     BTRFS_TREE_LOG_OBJECTID,
-                                     trans->transid, 0, 0, 0);
-       if (IS_ERR(leaf)) {
-               ret = PTR_ERR(leaf);
-               return ret;
-       }
-
-       btrfs_set_header_nritems(leaf, 0);
-       btrfs_set_header_level(leaf, 0);
-       btrfs_set_header_bytenr(leaf, leaf->start);
-       btrfs_set_header_generation(leaf, trans->transid);
-       btrfs_set_header_owner(leaf, BTRFS_TREE_LOG_OBJECTID);
-
-       write_extent_buffer(leaf, root->fs_info->fsid,
-                           (unsigned long)btrfs_header_fsid(leaf),
-                           BTRFS_FSID_SIZE);
-       btrfs_mark_buffer_dirty(leaf);
-
-       inode_item = &root_item.inode;
-       memset(inode_item, 0, sizeof(*inode_item));
-       inode_item->generation = cpu_to_le64(1);
-       inode_item->size = cpu_to_le64(3);
-       inode_item->nlink = cpu_to_le32(1);
-       inode_item->nbytes = cpu_to_le64(root->leafsize);
-       inode_item->mode = cpu_to_le32(S_IFDIR | 0755);
-
-       btrfs_set_root_bytenr(&root_item, leaf->start);
-       btrfs_set_root_generation(&root_item, trans->transid);
-       btrfs_set_root_level(&root_item, 0);
-       btrfs_set_root_refs(&root_item, 0);
-       btrfs_set_root_used(&root_item, 0);
-
-       memset(&root_item.drop_progress, 0, sizeof(root_item.drop_progress));
-       root_item.drop_level = 0;
-
-       btrfs_tree_unlock(leaf);
-       free_extent_buffer(leaf);
-       leaf = NULL;
-
-       btrfs_set_root_dirid(&root_item, 0);
-
-       key.objectid = BTRFS_TREE_LOG_OBJECTID;
-       key.offset = objectid;
-       btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);
-       ret = btrfs_insert_root(trans, root->fs_info->log_root_tree, &key,
-                               &root_item);
-       if (ret)
-               goto fail;
-
-       new_root = btrfs_read_fs_root_no_radix(root->fs_info->log_root_tree,
-                                              &key);
-       BUG_ON(!new_root);
-
-       WARN_ON(root->log_root);
-       root->log_root = new_root;
-
-       /*
-        * log trees do not get reference counted because they go away
-        * before a real commit is actually done.  They do store pointers
-        * to file data extents, and those reference counts still get
-        * updated (along with back refs to the log tree).
-        */
-       new_root->ref_cows = 0;
-       new_root->last_trans = trans->transid;
-
-       /*
-        * we need to make sure the root block for this new tree
-        * is marked as dirty in the dirty_log_pages tree.  This
-        * is how it gets flushed down to disk at tree log commit time.
-        *
-        * the tree logging mutex keeps others from coming in and changing
-        * the new_root->node, so we can safely access it here
-        */
-       set_extent_dirty(&new_root->dirty_log_pages, new_root->node->start,
-                        new_root->node->start + new_root->node->len - 1,
-                        GFP_NOFS);
-
-fail:
-       return ret;
-}
-
 /*
  * start a sub transaction and setup the log tree
  * this increments the log tree writer count to make the people
@@ -184,6 +86,14 @@ static int start_log_trans(struct btrfs_trans_handle *trans,
                           struct btrfs_root *root)
 {
        int ret;
+
+       mutex_lock(&root->log_mutex);
+       if (root->log_root) {
+               root->log_batch++;
+               atomic_inc(&root->log_writers);
+               mutex_unlock(&root->log_mutex);
+               return 0;
+       }
        mutex_lock(&root->fs_info->tree_log_mutex);
        if (!root->fs_info->log_root_tree) {
                ret = btrfs_init_log_root_tree(trans, root->fs_info);
@@ -193,9 +103,10 @@ static int start_log_trans(struct btrfs_trans_handle *trans,
                ret = btrfs_add_log_tree(trans, root);
                BUG_ON(ret);
        }
-       atomic_inc(&root->fs_info->tree_log_writers);
-       root->fs_info->tree_log_batch++;
        mutex_unlock(&root->fs_info->tree_log_mutex);
+       root->log_batch++;
+       atomic_inc(&root->log_writers);
+       mutex_unlock(&root->log_mutex);
        return 0;
 }
 
@@ -212,13 +123,12 @@ static int join_running_log_trans(struct btrfs_root *root)
        if (!root->log_root)
                return -ENOENT;
 
-       mutex_lock(&root->fs_info->tree_log_mutex);
+       mutex_lock(&root->log_mutex);
        if (root->log_root) {
                ret = 0;
-               atomic_inc(&root->fs_info->tree_log_writers);
-               root->fs_info->tree_log_batch++;
+               atomic_inc(&root->log_writers);
        }
-       mutex_unlock(&root->fs_info->tree_log_mutex);
+       mutex_unlock(&root->log_mutex);
        return ret;
 }
 
@@ -228,10 +138,11 @@ static int join_running_log_trans(struct btrfs_root *root)
  */
 static int end_log_trans(struct btrfs_root *root)
 {
-       atomic_dec(&root->fs_info->tree_log_writers);
-       smp_mb();
-       if (waitqueue_active(&root->fs_info->tree_log_wait))
-               wake_up(&root->fs_info->tree_log_wait);
+       if (atomic_dec_and_test(&root->log_writers)) {
+               smp_mb();
+               if (waitqueue_active(&root->log_writer_wait))
+                       wake_up(&root->log_writer_wait);
+       }
        return 0;
 }
 
@@ -1704,6 +1615,7 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
 
                                btrfs_tree_lock(next);
                                clean_tree_block(trans, root, next);
+                               btrfs_set_lock_blocking(next);
                                btrfs_wait_tree_block_writeback(next);
                                btrfs_tree_unlock(next);
 
@@ -1750,6 +1662,7 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
                next = path->nodes[*level];
                btrfs_tree_lock(next);
                clean_tree_block(trans, root, next);
+               btrfs_set_lock_blocking(next);
                btrfs_wait_tree_block_writeback(next);
                btrfs_tree_unlock(next);
 
@@ -1807,6 +1720,7 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
 
                                btrfs_tree_lock(next);
                                clean_tree_block(trans, root, next);
+                               btrfs_set_lock_blocking(next);
                                btrfs_wait_tree_block_writeback(next);
                                btrfs_tree_unlock(next);
 
@@ -1879,6 +1793,7 @@ static int walk_log_tree(struct btrfs_trans_handle *trans,
 
                        btrfs_tree_lock(next);
                        clean_tree_block(trans, log, next);
+                       btrfs_set_lock_blocking(next);
                        btrfs_wait_tree_block_writeback(next);
                        btrfs_tree_unlock(next);
 
@@ -1902,26 +1817,65 @@ static int walk_log_tree(struct btrfs_trans_handle *trans,
                }
        }
        btrfs_free_path(path);
-       if (wc->free)
-               free_extent_buffer(log->node);
        return ret;
 }
 
-static int wait_log_commit(struct btrfs_root *log)
+/*
+ * helper function to update the item for a given subvolumes log root
+ * in the tree of log roots
+ */
+static int update_log_root(struct btrfs_trans_handle *trans,
+                          struct btrfs_root *log)
+{
+       int ret;
+
+       if (log->log_transid == 1) {
+               /* insert root item on the first sync */
+               ret = btrfs_insert_root(trans, log->fs_info->log_root_tree,
+                               &log->root_key, &log->root_item);
+       } else {
+               ret = btrfs_update_root(trans, log->fs_info->log_root_tree,
+                               &log->root_key, &log->root_item);
+       }
+       return ret;
+}
+
+static int wait_log_commit(struct btrfs_root *root, unsigned long transid)
 {
        DEFINE_WAIT(wait);
-       u64 transid = log->fs_info->tree_log_transid;
+       int index = transid % 2;
 
+       /*
+        * we only allow two pending log transactions at a time,
+        * so we know that if ours is more than 2 older than the
+        * current transaction, we're done
+        */
        do {
-               prepare_to_wait(&log->fs_info->tree_log_wait, &wait,
-                               TASK_UNINTERRUPTIBLE);
-               mutex_unlock(&log->fs_info->tree_log_mutex);
-               if (atomic_read(&log->fs_info->tree_log_commit))
+               prepare_to_wait(&root->log_commit_wait[index],
+                               &wait, TASK_UNINTERRUPTIBLE);
+               mutex_unlock(&root->log_mutex);
+               if (root->log_transid < transid + 2 &&
+                   atomic_read(&root->log_commit[index]))
                        schedule();
-               finish_wait(&log->fs_info->tree_log_wait, &wait);
-               mutex_lock(&log->fs_info->tree_log_mutex);
-       } while (transid == log->fs_info->tree_log_transid &&
-               atomic_read(&log->fs_info->tree_log_commit));
+               finish_wait(&root->log_commit_wait[index], &wait);
+               mutex_lock(&root->log_mutex);
+       } while (root->log_transid < transid + 2 &&
+                atomic_read(&root->log_commit[index]));
+       return 0;
+}
+
+static int wait_for_writer(struct btrfs_root *root)
+{
+       DEFINE_WAIT(wait);
+       while (atomic_read(&root->log_writers)) {
+               prepare_to_wait(&root->log_writer_wait,
+                               &wait, TASK_UNINTERRUPTIBLE);
+               mutex_unlock(&root->log_mutex);
+               if (atomic_read(&root->log_writers))
+                       schedule();
+               mutex_lock(&root->log_mutex);
+               finish_wait(&root->log_writer_wait, &wait);
+       }
        return 0;
 }
 
@@ -1933,57 +1887,114 @@ static int wait_log_commit(struct btrfs_root *log)
 int btrfs_sync_log(struct btrfs_trans_handle *trans,
                   struct btrfs_root *root)
 {
+       int index1;
+       int index2;
        int ret;
-       unsigned long batch;
        struct btrfs_root *log = root->log_root;
+       struct btrfs_root *log_root_tree = root->fs_info->log_root_tree;
 
-       mutex_lock(&log->fs_info->tree_log_mutex);
-       if (atomic_read(&log->fs_info->tree_log_commit)) {
-               wait_log_commit(log);
-               goto out;
+       mutex_lock(&root->log_mutex);
+       index1 = root->log_transid % 2;
+       if (atomic_read(&root->log_commit[index1])) {
+               wait_log_commit(root, root->log_transid);
+               mutex_unlock(&root->log_mutex);
+               return 0;
        }
-       atomic_set(&log->fs_info->tree_log_commit, 1);
+       atomic_set(&root->log_commit[index1], 1);
+
+       /* wait for previous tree log sync to complete */
+       if (atomic_read(&root->log_commit[(index1 + 1) % 2]))
+               wait_log_commit(root, root->log_transid - 1);
 
        while (1) {
-               batch = log->fs_info->tree_log_batch;
-               mutex_unlock(&log->fs_info->tree_log_mutex);
+               unsigned long batch = root->log_batch;
+               mutex_unlock(&root->log_mutex);
                schedule_timeout_uninterruptible(1);
-               mutex_lock(&log->fs_info->tree_log_mutex);
-
-               while (atomic_read(&log->fs_info->tree_log_writers)) {
-                       DEFINE_WAIT(wait);
-                       prepare_to_wait(&log->fs_info->tree_log_wait, &wait,
-                                       TASK_UNINTERRUPTIBLE);
-                       mutex_unlock(&log->fs_info->tree_log_mutex);
-                       if (atomic_read(&log->fs_info->tree_log_writers))
-                               schedule();
-                       mutex_lock(&log->fs_info->tree_log_mutex);
-                       finish_wait(&log->fs_info->tree_log_wait, &wait);
-               }
-               if (batch == log->fs_info->tree_log_batch)
+               mutex_lock(&root->log_mutex);
+               wait_for_writer(root);
+               if (batch == root->log_batch)
                        break;
        }
 
        ret = btrfs_write_and_wait_marked_extents(log, &log->dirty_log_pages);
        BUG_ON(ret);
-       ret = btrfs_write_and_wait_marked_extents(root->fs_info->log_root_tree,
-                              &root->fs_info->log_root_tree->dirty_log_pages);
+
+       btrfs_set_root_bytenr(&log->root_item, log->node->start);
+       btrfs_set_root_generation(&log->root_item, trans->transid);
+       btrfs_set_root_level(&log->root_item, btrfs_header_level(log->node));
+
+       root->log_batch = 0;
+       root->log_transid++;
+       log->log_transid = root->log_transid;
+       smp_mb();
+       /*
+        * log tree has been flushed to disk, new modifications of
+        * the log will be written to new positions. so it's safe to
+        * allow log writers to go in.
+        */
+       mutex_unlock(&root->log_mutex);
+
+       mutex_lock(&log_root_tree->log_mutex);
+       log_root_tree->log_batch++;
+       atomic_inc(&log_root_tree->log_writers);
+       mutex_unlock(&log_root_tree->log_mutex);
+
+       ret = update_log_root(trans, log);
+       BUG_ON(ret);
+
+       mutex_lock(&log_root_tree->log_mutex);
+       if (atomic_dec_and_test(&log_root_tree->log_writers)) {
+               smp_mb();
+               if (waitqueue_active(&log_root_tree->log_writer_wait))
+                       wake_up(&log_root_tree->log_writer_wait);
+       }
+
+       index2 = log_root_tree->log_transid % 2;
+       if (atomic_read(&log_root_tree->log_commit[index2])) {
+               wait_log_commit(log_root_tree, log_root_tree->log_transid);
+               mutex_unlock(&log_root_tree->log_mutex);
+               goto out;
+       }
+       atomic_set(&log_root_tree->log_commit[index2], 1);
+
+       if (atomic_read(&log_root_tree->log_commit[(index2 + 1) % 2]))
+               wait_log_commit(log_root_tree, log_root_tree->log_transid - 1);
+
+       wait_for_writer(log_root_tree);
+
+       ret = btrfs_write_and_wait_marked_extents(log_root_tree,
+                               &log_root_tree->dirty_log_pages);
        BUG_ON(ret);
 
        btrfs_set_super_log_root(&root->fs_info->super_for_commit,
-                                log->fs_info->log_root_tree->node->start);
+                               log_root_tree->node->start);
        btrfs_set_super_log_root_level(&root->fs_info->super_for_commit,
-                      btrfs_header_level(log->fs_info->log_root_tree->node));
+                               btrfs_header_level(log_root_tree->node));
+
+       log_root_tree->log_batch = 0;
+       log_root_tree->log_transid++;
+       smp_mb();
+
+       mutex_unlock(&log_root_tree->log_mutex);
+
+       /*
+        * nobody else is going to jump in and write the the ctree
+        * super here because the log_commit atomic below is protecting
+        * us.  We must be called with a transaction handle pinning
+        * the running transaction open, so a full commit can't hop
+        * in and cause problems either.
+        */
+       write_ctree_super(trans, root->fs_info->tree_root, 2);
 
-       write_ctree_super(trans, log->fs_info->tree_root, 2);
-       log->fs_info->tree_log_transid++;
-       log->fs_info->tree_log_batch = 0;
-       atomic_set(&log->fs_info->tree_log_commit, 0);
+       atomic_set(&log_root_tree->log_commit[index2], 0);
        smp_mb();
-       if (waitqueue_active(&log->fs_info->tree_log_wait))
-               wake_up(&log->fs_info->tree_log_wait);
+       if (waitqueue_active(&log_root_tree->log_commit_wait[index2]))
+               wake_up(&log_root_tree->log_commit_wait[index2]);
 out:
-       mutex_unlock(&log->fs_info->tree_log_mutex);
+       atomic_set(&root->log_commit[index1], 0);
+       smp_mb();
+       if (waitqueue_active(&root->log_commit_wait[index1]))
+               wake_up(&root->log_commit_wait[index1]);
        return 0;
 }
 
@@ -2019,37 +2030,17 @@ int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root)
                                   start, end, GFP_NOFS);
        }
 
-       log = root->log_root;
-       ret = btrfs_del_root(trans, root->fs_info->log_root_tree,
-                            &log->root_key);
-       BUG_ON(ret);
+       if (log->log_transid > 0) {
+               ret = btrfs_del_root(trans, root->fs_info->log_root_tree,
+                                    &log->root_key);
+               BUG_ON(ret);
+       }
        root->log_root = NULL;
-       kfree(root->log_root);
+       free_extent_buffer(log->node);
+       kfree(log);
        return 0;
 }
 
-/*
- * helper function to update the item for a given subvolumes log root
- * in the tree of log roots
- */
-static int update_log_root(struct btrfs_trans_handle *trans,
-                          struct btrfs_root *log)
-{
-       u64 bytenr = btrfs_root_bytenr(&log->root_item);
-       int ret;
-
-       if (log->node->start == bytenr)
-               return 0;
-
-       btrfs_set_root_bytenr(&log->root_item, log->node->start);
-       btrfs_set_root_generation(&log->root_item, trans->transid);
-       btrfs_set_root_level(&log->root_item, btrfs_header_level(log->node));
-       ret = btrfs_update_root(trans, log->fs_info->log_root_tree,
-                               &log->root_key, &log->root_item);
-       BUG_ON(ret);
-       return ret;
-}
-
 /*
  * If both a file and directory are logged, and unlinks or renames are
  * mixed in, we have a few interesting corners:
@@ -2711,11 +2702,6 @@ next_slot:
 
        btrfs_free_path(path);
        btrfs_free_path(dst_path);
-
-       mutex_lock(&root->fs_info->tree_log_mutex);
-       ret = update_log_root(trans, log);
-       BUG_ON(ret);
-       mutex_unlock(&root->fs_info->tree_log_mutex);
 out:
        return 0;
 }
index 3451e1cca2b5c77ccdfdc3f5cab713f4a02721d2..bcd14ebccae16e751e67a73cf79c2dfbbf0db465 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/buffer_head.h>
 #include <linux/blkdev.h>
 #include <linux/random.h>
-#include <linux/version.h>
 #include <asm/div64.h>
 #include "compat.h"
 #include "ctree.h"
@@ -104,10 +103,8 @@ static noinline struct btrfs_device *__find_device(struct list_head *head,
                                                   u64 devid, u8 *uuid)
 {
        struct btrfs_device *dev;
-       struct list_head *cur;
 
-       list_for_each(cur, head) {
-               dev = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(dev, head, dev_list) {
                if (dev->devid == devid &&
                    (!uuid || !memcmp(dev->uuid, uuid, BTRFS_UUID_SIZE))) {
                        return dev;
@@ -118,11 +115,9 @@ static noinline struct btrfs_device *__find_device(struct list_head *head,
 
 static noinline struct btrfs_fs_devices *find_fsid(u8 *fsid)
 {
-       struct list_head *cur;
        struct btrfs_fs_devices *fs_devices;
 
-       list_for_each(cur, &fs_uuids) {
-               fs_devices = list_entry(cur, struct btrfs_fs_devices, list);
+       list_for_each_entry(fs_devices, &fs_uuids, list) {
                if (memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE) == 0)
                        return fs_devices;
        }
@@ -159,6 +154,7 @@ static noinline int run_scheduled_bios(struct btrfs_device *device)
 loop:
        spin_lock(&device->io_lock);
 
+loop_lock:
        /* take all the bios off the list at once and process them
         * later on (without the lock held).  But, remember the
         * tail and other pointers so the bios can be properly reinserted
@@ -208,7 +204,7 @@ loop:
                 * is now congested.  Back off and let other work structs
                 * run instead
                 */
-               if (pending && bdi_write_congested(bdi) &&
+               if (pending && bdi_write_congested(bdi) && num_run > 16 &&
                    fs_info->fs_devices->open_devices > 1) {
                        struct bio *old_head;
 
@@ -220,7 +216,8 @@ loop:
                                tail->bi_next = old_head;
                        else
                                device->pending_bio_tail = tail;
-                       device->running_pending = 0;
+
+                       device->running_pending = 1;
 
                        spin_unlock(&device->io_lock);
                        btrfs_requeue_work(&device->work);
@@ -229,6 +226,11 @@ loop:
        }
        if (again)
                goto loop;
+
+       spin_lock(&device->io_lock);
+       if (device->pending_bios)
+               goto loop_lock;
+       spin_unlock(&device->io_lock);
 done:
        return 0;
 }
@@ -345,14 +347,11 @@ error:
 
 int btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices)
 {
-       struct list_head *tmp;
-       struct list_head *cur;
-       struct btrfs_device *device;
+       struct btrfs_device *device, *next;
 
        mutex_lock(&uuid_mutex);
 again:
-       list_for_each_safe(cur, tmp, &fs_devices->devices) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry_safe(device, next, &fs_devices->devices, dev_list) {
                if (device->in_fs_metadata)
                        continue;
 
@@ -383,14 +382,12 @@ again:
 
 static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
 {
-       struct list_head *cur;
        struct btrfs_device *device;
 
        if (--fs_devices->opened > 0)
                return 0;
 
-       list_for_each(cur, &fs_devices->devices) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(device, &fs_devices->devices, dev_list) {
                if (device->bdev) {
                        close_bdev_exclusive(device->bdev, device->mode);
                        fs_devices->open_devices--;
@@ -439,7 +436,6 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
 {
        struct block_device *bdev;
        struct list_head *head = &fs_devices->devices;
-       struct list_head *cur;
        struct btrfs_device *device;
        struct block_device *latest_bdev = NULL;
        struct buffer_head *bh;
@@ -450,8 +446,7 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
        int seeding = 1;
        int ret = 0;
 
-       list_for_each(cur, head) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(device, head, dev_list) {
                if (device->bdev)
                        continue;
                if (!device->name)
@@ -578,7 +573,7 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
                       *(unsigned long long *)disk_super->fsid,
                       *(unsigned long long *)(disk_super->fsid + 8));
        }
-       printk(KERN_INFO "devid %llu transid %llu %s\n",
+       printk(KERN_CONT "devid %llu transid %llu %s\n",
               (unsigned long long)devid, (unsigned long long)transid, path);
        ret = device_list_add(path, disk_super, devid, fs_devices_ret);
 
@@ -1017,14 +1012,12 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
        }
 
        if (strcmp(device_path, "missing") == 0) {
-               struct list_head *cur;
                struct list_head *devices;
                struct btrfs_device *tmp;
 
                device = NULL;
                devices = &root->fs_info->fs_devices->devices;
-               list_for_each(cur, devices) {
-                       tmp = list_entry(cur, struct btrfs_device, dev_list);
+               list_for_each_entry(tmp, devices, dev_list) {
                        if (tmp->in_fs_metadata && !tmp->bdev) {
                                device = tmp;
                                break;
@@ -1280,7 +1273,6 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
        struct btrfs_trans_handle *trans;
        struct btrfs_device *device;
        struct block_device *bdev;
-       struct list_head *cur;
        struct list_head *devices;
        struct super_block *sb = root->fs_info->sb;
        u64 total_bytes;
@@ -1304,8 +1296,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
        mutex_lock(&root->fs_info->volume_mutex);
 
        devices = &root->fs_info->fs_devices->devices;
-       list_for_each(cur, devices) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(device, devices, dev_list) {
                if (device->bdev == bdev) {
                        ret = -EEXIST;
                        goto error;
@@ -1704,7 +1695,6 @@ static u64 div_factor(u64 num, int factor)
 int btrfs_balance(struct btrfs_root *dev_root)
 {
        int ret;
-       struct list_head *cur;
        struct list_head *devices = &dev_root->fs_info->fs_devices->devices;
        struct btrfs_device *device;
        u64 old_size;
@@ -1723,8 +1713,7 @@ int btrfs_balance(struct btrfs_root *dev_root)
        dev_root = dev_root->fs_info->dev_root;
 
        /* step one make some room on all the devices */
-       list_for_each(cur, devices) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(device, devices, dev_list) {
                old_size = device->total_bytes;
                size_to_free = div_factor(old_size, 1);
                size_to_free = min(size_to_free, (u64)1 * 1024 * 1024);
index 7f332e2708942f95968f07d49279fc08f43e59b2..a9d3bf4d2689a5924f1de8765bc38e3c5481c215 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/slab.h>
 #include <linux/rwsem.h>
 #include <linux/xattr.h>
+#include <linux/security.h>
 #include "ctree.h"
 #include "btrfs_inode.h"
 #include "transaction.h"
@@ -45,9 +46,12 @@ ssize_t __btrfs_getxattr(struct inode *inode, const char *name,
        /* lookup the xattr by name */
        di = btrfs_lookup_xattr(NULL, root, path, inode->i_ino, name,
                                strlen(name), 0);
-       if (!di || IS_ERR(di)) {
+       if (!di) {
                ret = -ENODATA;
                goto out;
+       } else if (IS_ERR(di)) {
+               ret = PTR_ERR(di);
+               goto out;
        }
 
        leaf = path->nodes[0];
@@ -62,6 +66,14 @@ ssize_t __btrfs_getxattr(struct inode *inode, const char *name,
                ret = -ERANGE;
                goto out;
        }
+
+       /*
+        * The way things are packed into the leaf is like this
+        * |struct btrfs_dir_item|name|data|
+        * where name is the xattr name, so security.foo, and data is the
+        * content of the xattr.  data_ptr points to the location in memory
+        * where the data starts in the in memory leaf
+        */
        data_ptr = (unsigned long)((char *)(di + 1) +
                                   btrfs_dir_name_len(leaf, di));
        read_extent_buffer(leaf, buffer, data_ptr,
@@ -86,7 +98,7 @@ int __btrfs_setxattr(struct inode *inode, const char *name,
        if (!path)
                return -ENOMEM;
 
-       trans = btrfs_start_transaction(root, 1);
+       trans = btrfs_join_transaction(root, 1);
        btrfs_set_trans_block_group(trans, inode);
 
        /* first lets see if we already have this xattr */
@@ -176,7 +188,6 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
        ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
        if (ret < 0)
                goto err;
-       ret = 0;
        advance = 0;
        while (1) {
                leaf = path->nodes[0];
@@ -320,3 +331,34 @@ int btrfs_removexattr(struct dentry *dentry, const char *name)
                return -EOPNOTSUPP;
        return __btrfs_setxattr(dentry->d_inode, name, NULL, 0, XATTR_REPLACE);
 }
+
+int btrfs_xattr_security_init(struct inode *inode, struct inode *dir)
+{
+       int err;
+       size_t len;
+       void *value;
+       char *suffix;
+       char *name;
+
+       err = security_inode_init_security(inode, dir, &suffix, &value, &len);
+       if (err) {
+               if (err == -EOPNOTSUPP)
+                       return 0;
+               return err;
+       }
+
+       name = kmalloc(XATTR_SECURITY_PREFIX_LEN + strlen(suffix) + 1,
+                      GFP_NOFS);
+       if (!name) {
+               err = -ENOMEM;
+       } else {
+               strcpy(name, XATTR_SECURITY_PREFIX);
+               strcpy(name + XATTR_SECURITY_PREFIX_LEN, suffix);
+               err = __btrfs_setxattr(inode, name, value, len, 0);
+               kfree(name);
+       }
+
+       kfree(suffix);
+       kfree(value);
+       return err;
+}
index 5b1d08f8e68dede07beb1dcc79f52dd8af9553c5..c71e9c3cf3f749e8981d19433bef8ada685383aa 100644 (file)
@@ -36,4 +36,6 @@ extern int btrfs_setxattr(struct dentry *dentry, const char *name,
                const void *value, size_t size, int flags);
 extern int btrfs_removexattr(struct dentry *dentry, const char *name);
 
+extern int btrfs_xattr_security_init(struct inode *inode, struct inode *dir);
+
 #endif /* __XATTR__ */
index b58208f1640a00eecbb0c760469a15b8fe31f6c3..665d446b25bc034241ef54c3c6b1d239c0ccf0f9 100644 (file)
@@ -2688,7 +2688,7 @@ int nobh_write_end(struct file *file, struct address_space *mapping,
        struct buffer_head *bh;
        BUG_ON(fsdata != NULL && page_has_buffers(page));
 
-       if (unlikely(copied < len) && !page_has_buffers(page))
+       if (unlikely(copied < len) && head)
                attach_nobh_buffers(page, head);
        if (page_has_buffers(page))
                return generic_write_end(file, mapping, pos, len,
index 080703a15f44cfdd86c2872ab14f5646cfa7622d..73ac7ebd1dfcc253db5a40d9aa91379764dbebdb 100644 (file)
@@ -5,7 +5,9 @@ rather than posix (advisory) byte range locks, even though server would
 support posix byte range locks.  Fix query of root inode when prefixpath
 specified and user does not have access to query information about the
 top of the share.  Fix problem in 2.6.28 resolving DFS paths to
-Samba servers (worked to Windows).
+Samba servers (worked to Windows).  Fix rmdir so that pending search
+(readdir) requests do not get invalid results which include the now
+removed directory.
 
 Version 1.55
 ------------
index d4839cf0cb2c79fecf81b17efc95177bef59d4dc..7c9809523f428a1cf3a31128d32d0d101152e2f6 100644 (file)
@@ -48,11 +48,11 @@ static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu,
        if ((cifs_pdu == NULL) || (signature == NULL) || (key == NULL))
                return -EINVAL;
 
-       MD5Init(&context);
-       MD5Update(&context, (char *)&key->data, key->len);
-       MD5Update(&context, cifs_pdu->Protocol, cifs_pdu->smb_buf_length);
+       cifs_MD5_init(&context);
+       cifs_MD5_update(&context, (char *)&key->data, key->len);
+       cifs_MD5_update(&context, cifs_pdu->Protocol, cifs_pdu->smb_buf_length);
 
-       MD5Final(signature, &context);
+       cifs_MD5_final(signature, &context);
        return 0;
 }
 
@@ -96,8 +96,8 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
        if ((iov == NULL) || (signature == NULL) || (key == NULL))
                return -EINVAL;
 
-       MD5Init(&context);
-       MD5Update(&context, (char *)&key->data, key->len);
+       cifs_MD5_init(&context);
+       cifs_MD5_update(&context, (char *)&key->data, key->len);
        for (i = 0; i < n_vec; i++) {
                if (iov[i].iov_len == 0)
                        continue;
@@ -110,13 +110,13 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
                if (i == 0) {
                        if (iov[0].iov_len <= 8) /* cmd field at offset 9 */
                                break; /* nothing to sign or corrupt header */
-                       MD5Update(&context, iov[0].iov_base+4,
+                       cifs_MD5_update(&context, iov[0].iov_base+4,
                                  iov[0].iov_len-4);
                } else
-                       MD5Update(&context, iov[i].iov_base, iov[i].iov_len);
+                       cifs_MD5_update(&context, iov[i].iov_base, iov[i].iov_len);
        }
 
-       MD5Final(signature, &context);
+       cifs_MD5_final(signature, &context);
 
        return 0;
 }
index 06f6779988bf9373c52b19114ada1e0885ea854e..382ba62988094b58ec396ae7872a104ff7a66104 100644 (file)
@@ -35,8 +35,8 @@ extern struct smb_hdr *cifs_buf_get(void);
 extern void cifs_buf_release(void *);
 extern struct smb_hdr *cifs_small_buf_get(void);
 extern void cifs_small_buf_release(void *);
-extern int smb_send(struct socket *, struct smb_hdr *,
-                       unsigned int /* length */ , struct sockaddr *, bool);
+extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *,
+                       unsigned int /* length */);
 extern unsigned int _GetXid(void);
 extern void _FreeXid(unsigned int);
 #define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__func__, xid,current_fsuid()));
index e9ea394ee075d0ef20ab7900d111c5bd6a6e20c6..2209be94305132f375b1082193bdcf7280c312d8 100644 (file)
@@ -1354,7 +1354,7 @@ cifs_parse_mount_options(char *options, const char *devname,
 }
 
 static struct TCP_Server_Info *
-cifs_find_tcp_session(struct sockaddr *addr)
+cifs_find_tcp_session(struct sockaddr_storage *addr)
 {
        struct list_head *tmp;
        struct TCP_Server_Info *server;
@@ -1374,11 +1374,11 @@ cifs_find_tcp_session(struct sockaddr *addr)
                if (server->tcpStatus == CifsNew)
                        continue;
 
-               if (addr->sa_family == AF_INET &&
+               if (addr->ss_family == AF_INET &&
                    (addr4->sin_addr.s_addr !=
                     server->addr.sockAddr.sin_addr.s_addr))
                        continue;
-               else if (addr->sa_family == AF_INET6 &&
+               else if (addr->ss_family == AF_INET6 &&
                         memcmp(&server->addr.sockAddr6.sin6_addr,
                                &addr6->sin6_addr, sizeof(addr6->sin6_addr)))
                        continue;
@@ -1419,12 +1419,12 @@ static struct TCP_Server_Info *
 cifs_get_tcp_session(struct smb_vol *volume_info)
 {
        struct TCP_Server_Info *tcp_ses = NULL;
-       struct sockaddr addr;
+       struct sockaddr_storage addr;
        struct sockaddr_in *sin_server = (struct sockaddr_in *) &addr;
        struct sockaddr_in6 *sin_server6 = (struct sockaddr_in6 *) &addr;
        int rc;
 
-       memset(&addr, 0, sizeof(struct sockaddr));
+       memset(&addr, 0, sizeof(struct sockaddr_storage));
 
        if (volume_info->UNCip && volume_info->UNC) {
                rc = cifs_inet_pton(AF_INET, volume_info->UNCip,
@@ -1435,9 +1435,9 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
                        rc = cifs_inet_pton(AF_INET6, volume_info->UNCip,
                                            &sin_server6->sin6_addr.in6_u);
                        if (rc > 0)
-                               addr.sa_family = AF_INET6;
+                               addr.ss_family = AF_INET6;
                } else {
-                       addr.sa_family = AF_INET;
+                       addr.ss_family = AF_INET;
                }
 
                if (rc <= 0) {
@@ -1502,7 +1502,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
        tcp_ses->tcpStatus = CifsNew;
        ++tcp_ses->srv_count;
 
-       if (addr.sa_family == AF_INET6) {
+       if (addr.ss_family == AF_INET6) {
                cFYI(1, ("attempting ipv6 connect"));
                /* BB should we allow ipv6 on port 139? */
                /* other OS never observed in Wild doing 139 with v6 */
@@ -1802,7 +1802,7 @@ ipv4_connect(struct TCP_Server_Info *server)
         *  user space buffer
         */
        socket->sk->sk_rcvtimeo = 7 * HZ;
-       socket->sk->sk_sndtimeo = 3 * HZ;
+       socket->sk->sk_sndtimeo = 5 * HZ;
 
        /* make the bufsizes depend on wsize/rsize and max requests */
        if (server->noautotune) {
@@ -1860,9 +1860,7 @@ ipv4_connect(struct TCP_Server_Info *server)
                        smb_buf = (struct smb_hdr *)ses_init_buf;
                        /* sizeof RFC1002_SESSION_REQUEST with no scope */
                        smb_buf->smb_buf_length = 0x81000044;
-                       rc = smb_send(socket, smb_buf, 0x44,
-                               (struct sockaddr *) &server->addr.sockAddr,
-                               server->noblocksnd);
+                       rc = smb_send(server, smb_buf, 0x44);
                        kfree(ses_init_buf);
                        msleep(1); /* RFC1001 layer in at least one server
                                      requires very short break before negprot
@@ -1955,7 +1953,7 @@ ipv6_connect(struct TCP_Server_Info *server)
         * user space buffer
         */
        socket->sk->sk_rcvtimeo = 7 * HZ;
-       socket->sk->sk_sndtimeo = 3 * HZ;
+       socket->sk->sk_sndtimeo = 5 * HZ;
        server->ssocket = socket;
 
        return rc;
index 838d9c720a5cec1a76237468b698873528edd214..964aad03c5ad82d914ad504a8453f09f149d5c67 100644 (file)
@@ -129,6 +129,17 @@ cifs_bp_rename_retry:
        return full_path;
 }
 
+static void setup_cifs_dentry(struct cifsTconInfo *tcon,
+                             struct dentry *direntry,
+                             struct inode *newinode)
+{
+       if (tcon->nocase)
+               direntry->d_op = &cifs_ci_dentry_ops;
+       else
+               direntry->d_op = &cifs_dentry_ops;
+       d_instantiate(direntry, newinode);
+}
+
 /* Inode operations in similar order to how they appear in Linux file fs.h */
 
 int
@@ -139,14 +150,14 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
        int xid;
        int create_options = CREATE_NOT_DIR;
        int oplock = 0;
+       /* BB below access is too much for the mknod to request */
        int desiredAccess = GENERIC_READ | GENERIC_WRITE;
        __u16 fileHandle;
        struct cifs_sb_info *cifs_sb;
-       struct cifsTconInfo *pTcon;
+       struct cifsTconInfo *tcon;
        char *full_path = NULL;
        FILE_ALL_INFO *buf = NULL;
        struct inode *newinode = NULL;
-       struct cifsFileInfo *pCifsFile = NULL;
        struct cifsInodeInfo *pCifsInode;
        int disposition = FILE_OVERWRITE_IF;
        bool write_only = false;
@@ -154,7 +165,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
        xid = GetXid();
 
        cifs_sb = CIFS_SB(inode->i_sb);
-       pTcon = cifs_sb->tcon;
+       tcon = cifs_sb->tcon;
 
        full_path = build_path_from_dentry(direntry);
        if (full_path == NULL) {
@@ -162,6 +173,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
                return -ENOMEM;
        }
 
+       mode &= ~current->fs->umask;
+
        if (nd && (nd->flags & LOOKUP_OPEN)) {
                int oflags = nd->intent.open.flags;
 
@@ -196,17 +209,15 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
                return -ENOMEM;
        }
 
-       mode &= ~current->fs->umask;
-
        /*
         * if we're not using unix extensions, see if we need to set
         * ATTR_READONLY on the create call
         */
-       if (!pTcon->unix_ext && (mode & S_IWUGO) == 0)
+       if (!tcon->unix_ext && (mode & S_IWUGO) == 0)
                create_options |= CREATE_OPTION_READONLY;
 
        if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS)
-               rc = CIFSSMBOpen(xid, pTcon, full_path, disposition,
+               rc = CIFSSMBOpen(xid, tcon, full_path, disposition,
                         desiredAccess, create_options,
                         &fileHandle, &oplock, buf, cifs_sb->local_nls,
                         cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
@@ -215,7 +226,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
 
        if (rc == -EIO) {
                /* old server, retry the open legacy style */
-               rc = SMBLegacyOpen(xid, pTcon, full_path, disposition,
+               rc = SMBLegacyOpen(xid, tcon, full_path, disposition,
                        desiredAccess, create_options,
                        &fileHandle, &oplock, buf, cifs_sb->local_nls,
                        cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
@@ -225,7 +236,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
        } else {
                /* If Open reported that we actually created a file
                then we now have to set the mode if possible */
-               if ((pTcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) {
+               if ((tcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) {
                        struct cifs_unix_set_info_args args = {
                                .mode   = mode,
                                .ctime  = NO_CHANGE_64,
@@ -244,20 +255,20 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
                                args.uid = NO_CHANGE_64;
                                args.gid = NO_CHANGE_64;
                        }
-                       CIFSSMBUnixSetInfo(xid, pTcon, full_path, &args,
+                       CIFSSMBUnixSetInfo(xid, tcon, full_path, &args,
                                cifs_sb->local_nls,
                                cifs_sb->mnt_cifs_flags &
                                        CIFS_MOUNT_MAP_SPECIAL_CHR);
                } else {
                        /* BB implement mode setting via Windows security
                           descriptors e.g. */
-                       /* CIFSSMBWinSetPerms(xid,pTcon,path,mode,-1,-1,nls);*/
+                       /* CIFSSMBWinSetPerms(xid,tcon,path,mode,-1,-1,nls);*/
 
                        /* Could set r/o dos attribute if mode & 0222 == 0 */
                }
 
                /* server might mask mode so we have to query for it */
-               if (pTcon->unix_ext)
+               if (tcon->unix_ext)
                        rc = cifs_get_inode_info_unix(&newinode, full_path,
                                                 inode->i_sb, xid);
                else {
@@ -283,22 +294,17 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
                }
 
                if (rc != 0) {
-                       cFYI(1,
-                            ("Create worked but get_inode_info failed rc = %d",
-                             rc));
-               } else {
-                       if (pTcon->nocase)
-                               direntry->d_op = &cifs_ci_dentry_ops;
-                       else
-                               direntry->d_op = &cifs_dentry_ops;
-                       d_instantiate(direntry, newinode);
-               }
+                       cFYI(1, ("Create worked, get_inode_info failed rc = %d",
+                                rc));
+               } else
+                       setup_cifs_dentry(tcon, direntry, newinode);
+
                if ((nd == NULL /* nfsd case - nfs srv does not set nd */) ||
                        (!(nd->flags & LOOKUP_OPEN))) {
                        /* mknod case - do not leave file open */
-                       CIFSSMBClose(xid, pTcon, fileHandle);
+                       CIFSSMBClose(xid, tcon, fileHandle);
                } else if (newinode) {
-                       pCifsFile =
+                       struct cifsFileInfo *pCifsFile =
                           kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);
 
                        if (pCifsFile == NULL)
@@ -316,7 +322,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
                        /* set the following in open now
                                pCifsFile->pfile = file; */
                        write_lock(&GlobalSMBSeslock);
-                       list_add(&pCifsFile->tlist, &pTcon->openFileList);
+                       list_add(&pCifsFile->tlist, &tcon->openFileList);
                        pCifsInode = CIFS_I(newinode);
                        if (pCifsInode) {
                                /* if readable file instance put first in list*/
index 5ab9896fdcb2cbd93be444b14c2896f90c98e301..bcf7b518466413023097ba69b7a5cb8cb4c4a449 100644 (file)
@@ -1285,6 +1285,11 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
        cifsInode = CIFS_I(direntry->d_inode);
        cifsInode->time = 0;    /* force revalidate to go get info when
                                   needed */
+
+       cifsInode = CIFS_I(inode);
+       cifsInode->time = 0;    /* force revalidate to get parent dir info
+                                  since cached search results now invalid */
+
        direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime =
                current_fs_time(inode->i_sb);
 
index 462bbfefd4b671771a52658ec08fa0efd72e9e5c..98b66a54c31997edc228d67018819d693f9feaa0 100644 (file)
@@ -10,8 +10,8 @@
  * with every copy.
  *
  * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to MD5Init, call MD5Update as
- * needed on buffers full of bytes, and then call MD5Final, which
+ * MD5Context structure, pass it to cifs_MD5_init, call cifs_MD5_update as
+ * needed on buffers full of bytes, and then call cifs_MD5_final, which
  * will fill a supplied 16-byte array with the digest.
  */
 
@@ -45,7 +45,7 @@ byteReverse(unsigned char *buf, unsigned longs)
  * initialization constants.
  */
 void
-MD5Init(struct MD5Context *ctx)
+cifs_MD5_init(struct MD5Context *ctx)
 {
        ctx->buf[0] = 0x67452301;
        ctx->buf[1] = 0xefcdab89;
@@ -61,7 +61,7 @@ MD5Init(struct MD5Context *ctx)
  * of bytes.
  */
 void
-MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
+cifs_MD5_update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
 {
        register __u32 t;
 
@@ -110,7 +110,7 @@ MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
  * 1 0* (64-bit count of bits processed, MSB-first)
  */
 void
-MD5Final(unsigned char digest[16], struct MD5Context *ctx)
+cifs_MD5_final(unsigned char digest[16], struct MD5Context *ctx)
 {
        unsigned int count;
        unsigned char *p;
@@ -165,7 +165,7 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx)
 
 /*
  * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data.  MD5Update blocks
+ * reflect the addition of 16 longwords of new data.  cifs_MD5_update blocks
  * the data and converts bytes into longwords for this routine.
  */
 static void
@@ -267,9 +267,9 @@ hmac_md5_init_rfc2104(unsigned char *key, int key_len,
                unsigned char tk[16];
                struct MD5Context tctx;
 
-               MD5Init(&tctx);
-               MD5Update(&tctx, key, key_len);
-               MD5Final(tk, &tctx);
+               cifs_MD5_init(&tctx);
+               cifs_MD5_update(&tctx, key, key_len);
+               cifs_MD5_final(tk, &tctx);
 
                key = tk;
                key_len = 16;
@@ -287,8 +287,8 @@ hmac_md5_init_rfc2104(unsigned char *key, int key_len,
                ctx->k_opad[i] ^= 0x5c;
        }
 
-       MD5Init(&ctx->ctx);
-       MD5Update(&ctx->ctx, ctx->k_ipad, 64);
+       cifs_MD5_init(&ctx->ctx);
+       cifs_MD5_update(&ctx->ctx, ctx->k_ipad, 64);
 }
 #endif
 
@@ -317,8 +317,8 @@ hmac_md5_init_limK_to_64(const unsigned char *key, int key_len,
                ctx->k_opad[i] ^= 0x5c;
        }
 
-       MD5Init(&ctx->ctx);
-       MD5Update(&ctx->ctx, ctx->k_ipad, 64);
+       cifs_MD5_init(&ctx->ctx);
+       cifs_MD5_update(&ctx->ctx, ctx->k_ipad, 64);
 }
 
 /***********************************************************************
@@ -328,7 +328,7 @@ void
 hmac_md5_update(const unsigned char *text, int text_len,
                struct HMACMD5Context *ctx)
 {
-       MD5Update(&ctx->ctx, text, text_len);   /* then text of datagram */
+       cifs_MD5_update(&ctx->ctx, text, text_len);     /* then text of datagram */
 }
 
 /***********************************************************************
@@ -339,12 +339,12 @@ hmac_md5_final(unsigned char *digest, struct HMACMD5Context *ctx)
 {
        struct MD5Context ctx_o;
 
-       MD5Final(digest, &ctx->ctx);
+       cifs_MD5_final(digest, &ctx->ctx);
 
-       MD5Init(&ctx_o);
-       MD5Update(&ctx_o, ctx->k_opad, 64);
-       MD5Update(&ctx_o, digest, 16);
-       MD5Final(digest, &ctx_o);
+       cifs_MD5_init(&ctx_o);
+       cifs_MD5_update(&ctx_o, ctx->k_opad, 64);
+       cifs_MD5_update(&ctx_o, digest, 16);
+       cifs_MD5_final(digest, &ctx_o);
 }
 
 /***********************************************************
index f7d4f4197bac3cc6973e8c1c5de2ddc9c8721493..6fba8cb402fdc5e2aa28340548bf1d3524eca822 100644 (file)
@@ -20,10 +20,10 @@ struct HMACMD5Context {
 };
 #endif                         /* _HMAC_MD5_H */
 
-void MD5Init(struct MD5Context *context);
-void MD5Update(struct MD5Context *context, unsigned char const *buf,
+void cifs_MD5_init(struct MD5Context *context);
+void cifs_MD5_update(struct MD5Context *context, unsigned char const *buf,
                        unsigned len);
-void MD5Final(unsigned char digest[16], struct MD5Context *context);
+void cifs_MD5_final(unsigned char digest[16], struct MD5Context *context);
 
 /* The following definitions come from lib/hmacmd5.c  */
 
index 7ebe6599ed3a07cb712d0f6e725277bb778e12f0..0ad3e2d116a6b0fb8238601bcb654b871ecb9845 100644 (file)
@@ -154,81 +154,8 @@ void DeleteTconOplockQEntries(struct cifsTconInfo *tcon)
        spin_unlock(&GlobalMid_Lock);
 }
 
-int
-smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
-        unsigned int smb_buf_length, struct sockaddr *sin, bool noblocksnd)
-{
-       int rc = 0;
-       int i = 0;
-       struct msghdr smb_msg;
-       struct kvec iov;
-       unsigned len = smb_buf_length + 4;
-
-       if (ssocket == NULL)
-               return -ENOTSOCK; /* BB eventually add reconnect code here */
-       iov.iov_base = smb_buffer;
-       iov.iov_len = len;
-
-       smb_msg.msg_name = sin;
-       smb_msg.msg_namelen = sizeof(struct sockaddr);
-       smb_msg.msg_control = NULL;
-       smb_msg.msg_controllen = 0;
-       if (noblocksnd)
-               smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL;
-       else
-               smb_msg.msg_flags = MSG_NOSIGNAL;
-
-       /* smb header is converted in header_assemble. bcc and rest of SMB word
-          area, and byte area if necessary, is converted to littleendian in
-          cifssmb.c and RFC1001 len is converted to bigendian in smb_send
-          Flags2 is converted in SendReceive */
-
-       smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length);
-       cFYI(1, ("Sending smb of length %d", smb_buf_length));
-       dump_smb(smb_buffer, len);
-
-       while (len > 0) {
-               rc = kernel_sendmsg(ssocket, &smb_msg, &iov, 1, len);
-               if ((rc == -ENOSPC) || (rc == -EAGAIN)) {
-                       i++;
-               /* smaller timeout here than send2 since smaller size */
-               /* Although it may not be required, this also is smaller
-                  oplock break time */
-                       if (i > 12) {
-                               cERROR(1,
-                                  ("sends on sock %p stuck for 7 seconds",
-                                   ssocket));
-                               rc = -EAGAIN;
-                               break;
-                       }
-                       msleep(1 << i);
-                       continue;
-               }
-               if (rc < 0)
-                       break;
-               else
-                       i = 0; /* reset i after each successful send */
-               iov.iov_base += rc;
-               iov.iov_len -= rc;
-               len -= rc;
-       }
-
-       if (rc < 0) {
-               cERROR(1, ("Error %d sending data on socket to server", rc));
-       } else {
-               rc = 0;
-       }
-
-       /* Don't want to modify the buffer as a
-          side effect of this call. */
-       smb_buffer->smb_buf_length = smb_buf_length;
-
-       return rc;
-}
-
 static int
-smb_send2(struct TCP_Server_Info *server, struct kvec *iov, int n_vec,
-         struct sockaddr *sin, bool noblocksnd)
+smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec)
 {
        int rc = 0;
        int i = 0;
@@ -243,11 +170,11 @@ smb_send2(struct TCP_Server_Info *server, struct kvec *iov, int n_vec,
        if (ssocket == NULL)
                return -ENOTSOCK; /* BB eventually add reconnect code here */
 
-       smb_msg.msg_name = sin;
+       smb_msg.msg_name = (struct sockaddr *) &server->addr.sockAddr;
        smb_msg.msg_namelen = sizeof(struct sockaddr);
        smb_msg.msg_control = NULL;
        smb_msg.msg_controllen = 0;
-       if (noblocksnd)
+       if (server->noblocksnd)
                smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL;
        else
                smb_msg.msg_flags = MSG_NOSIGNAL;
@@ -272,7 +199,25 @@ smb_send2(struct TCP_Server_Info *server, struct kvec *iov, int n_vec,
                                    n_vec - first_vec, total_len);
                if ((rc == -ENOSPC) || (rc == -EAGAIN)) {
                        i++;
-                       if (i >= 14) {
+                       /* if blocking send we try 3 times, since each can block
+                          for 5 seconds. For nonblocking  we have to try more
+                          but wait increasing amounts of time allowing time for
+                          socket to clear.  The overall time we wait in either
+                          case to send on the socket is about 15 seconds.
+                          Similarly we wait for 15 seconds for
+                          a response from the server in SendReceive[2]
+                          for the server to send a response back for
+                          most types of requests (except SMB Write
+                          past end of file which can be slow, and
+                          blocking lock operations). NFS waits slightly longer
+                          than CIFS, but this can make it take longer for
+                          nonresponsive servers to be detected and 15 seconds
+                          is more than enough time for modern networks to
+                          send a packet.  In most cases if we fail to send
+                          after the retries we will kill the socket and
+                          reconnect which may clear the network problem.
+                       */
+                       if ((i >= 14) || (!server->noblocksnd && (i > 2))) {
                                cERROR(1,
                                   ("sends on sock %p stuck for 15 seconds",
                                    ssocket));
@@ -339,6 +284,18 @@ smb_send2(struct TCP_Server_Info *server, struct kvec *iov, int n_vec,
        return rc;
 }
 
+int
+smb_send(struct TCP_Server_Info *server, struct smb_hdr *smb_buffer,
+        unsigned int smb_buf_length)
+{
+       struct kvec iov;
+
+       iov.iov_base = smb_buffer;
+       iov.iov_len = smb_buf_length + 4;
+
+       return smb_sendv(server, &iov, 1);
+}
+
 static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
 {
        if (long_op == CIFS_ASYNC_OP) {
@@ -540,9 +497,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
 #ifdef CONFIG_CIFS_STATS2
        atomic_inc(&ses->server->inSend);
 #endif
-       rc = smb_send2(ses->server, iov, n_vec,
-                     (struct sockaddr *) &(ses->server->addr.sockAddr),
-                      ses->server->noblocksnd);
+       rc = smb_sendv(ses->server, iov, n_vec);
 #ifdef CONFIG_CIFS_STATS2
        atomic_dec(&ses->server->inSend);
        midQ->when_sent = jiffies;
@@ -736,9 +691,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
 #ifdef CONFIG_CIFS_STATS2
        atomic_inc(&ses->server->inSend);
 #endif
-       rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length,
-                     (struct sockaddr *) &(ses->server->addr.sockAddr),
-                     ses->server->noblocksnd);
+       rc = smb_send(ses->server, in_buf, in_buf->smb_buf_length);
 #ifdef CONFIG_CIFS_STATS2
        atomic_dec(&ses->server->inSend);
        midQ->when_sent = jiffies;
@@ -879,9 +832,7 @@ send_nt_cancel(struct cifsTconInfo *tcon, struct smb_hdr *in_buf,
                mutex_unlock(&ses->server->srv_mutex);
                return rc;
        }
-       rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length,
-             (struct sockaddr *) &(ses->server->addr.sockAddr),
-             ses->server->noblocksnd);
+       rc = smb_send(ses->server, in_buf, in_buf->smb_buf_length);
        mutex_unlock(&ses->server->srv_mutex);
        return rc;
 }
@@ -973,9 +924,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
 #ifdef CONFIG_CIFS_STATS2
        atomic_inc(&ses->server->inSend);
 #endif
-       rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length,
-                     (struct sockaddr *) &(ses->server->addr.sockAddr),
-                     ses->server->noblocksnd);
+       rc = smb_send(ses->server, in_buf, in_buf->smb_buf_length);
 #ifdef CONFIG_CIFS_STATS2
        atomic_dec(&ses->server->inSend);
        midQ->when_sent = jiffies;
index 65a070e705ab1d8112ae6085c8d3e7d7c6202c90..d0145ca27572890b958765c72795a2b291628c20 100644 (file)
@@ -1407,7 +1407,7 @@ int compat_do_execve(char * filename,
        bprm->cred = prepare_exec_creds();
        if (!bprm->cred)
                goto out_unlock;
-       check_unsafe_exec(bprm);
+       check_unsafe_exec(bprm, current->files);
 
        file = open_exec(filename);
        retval = PTR_ERR(file);
index 5235c67e7594141b289f008a77ee447de5faf8c3..9c6d815dd1918b42640b4819393ac056b21da17f 100644 (file)
@@ -538,6 +538,7 @@ static int dev_ifsioc(unsigned int fd, unsigned int cmd, unsigned long arg)
                 * cannot be fixed without breaking all existing apps.
                 */
                case TUNSETIFF:
+               case TUNGETIFF:
                case SIOCGIFFLAGS:
                case SIOCGIFMETRIC:
                case SIOCGIFMTU:
@@ -784,7 +785,7 @@ static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
 
        if (copy_in_user(&sgio->status, &sgio32->status,
                         (4 * sizeof(unsigned char)) +
-                        (2 * sizeof(unsigned (short))) +
+                        (2 * sizeof(unsigned short)) +
                         (3 * sizeof(int))))
                return -EFAULT;
 
@@ -1982,6 +1983,11 @@ COMPATIBLE_IOCTL(TUNSETNOCSUM)
 COMPATIBLE_IOCTL(TUNSETDEBUG)
 COMPATIBLE_IOCTL(TUNSETPERSIST)
 COMPATIBLE_IOCTL(TUNSETOWNER)
+COMPATIBLE_IOCTL(TUNSETLINK)
+COMPATIBLE_IOCTL(TUNSETGROUP)
+COMPATIBLE_IOCTL(TUNGETFEATURES)
+COMPATIBLE_IOCTL(TUNSETOFFLOAD)
+COMPATIBLE_IOCTL(TUNSETTXFILTER)
 /* Big V */
 COMPATIBLE_IOCTL(VT_SETMODE)
 COMPATIBLE_IOCTL(VT_GETMODE)
@@ -2573,6 +2579,7 @@ HANDLE_IOCTL(SIOCGIFPFLAGS, dev_ifsioc)
 HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc)
 HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc)
 HANDLE_IOCTL(TUNSETIFF, dev_ifsioc)
+HANDLE_IOCTL(TUNGETIFF, dev_ifsioc)
 HANDLE_IOCTL(SIOCETHTOOL, ethtool_ioctl)
 HANDLE_IOCTL(SIOCBONDENSLAVE, bond_ioctl)
 HANDLE_IOCTL(SIOCBONDRELEASE, bond_ioctl)
index c01e043670e21300808dcd5d58e77f19bfccd076..f6caeb1d110621e7c24c1ab0b714f5774e333a93 100644 (file)
@@ -1716,7 +1716,7 @@ static int ecryptfs_copy_filename(char **copied_name, size_t *copied_name_size,
 {
        int rc = 0;
 
-       (*copied_name) = kmalloc((name_size + 2), GFP_KERNEL);
+       (*copied_name) = kmalloc((name_size + 1), GFP_KERNEL);
        if (!(*copied_name)) {
                rc = -ENOMEM;
                goto out;
@@ -1726,7 +1726,7 @@ static int ecryptfs_copy_filename(char **copied_name, size_t *copied_name_size,
                                                 * in printing out the
                                                 * string in debug
                                                 * messages */
-       (*copied_name_size) = (name_size + 1);
+       (*copied_name_size) = name_size;
 out:
        return rc;
 }
index ba2f9ec71192180647967f02fc1c4221c95c4a5a..011b9b8c90c6976bb15e5bf50ffaf865fd31892b 100644 (file)
@@ -234,8 +234,6 @@ struct ep_pqueue {
 /*
  * Configuration options available inside /proc/sys/fs/epoll/
  */
-/* Maximum number of epoll devices, per user */
-static int max_user_instances __read_mostly;
 /* Maximum number of epoll watched descriptors, per user */
 static int max_user_watches __read_mostly;
 
@@ -260,14 +258,6 @@ static struct kmem_cache *pwq_cache __read_mostly;
 static int zero;
 
 ctl_table epoll_table[] = {
-       {
-               .procname       = "max_user_instances",
-               .data           = &max_user_instances,
-               .maxlen         = sizeof(int),
-               .mode           = 0644,
-               .proc_handler   = &proc_dointvec_minmax,
-               .extra1         = &zero,
-       },
        {
                .procname       = "max_user_watches",
                .data           = &max_user_watches,
@@ -491,7 +481,6 @@ static void ep_free(struct eventpoll *ep)
 
        mutex_unlock(&epmutex);
        mutex_destroy(&ep->mtx);
-       atomic_dec(&ep->user->epoll_devs);
        free_uid(ep->user);
        kfree(ep);
 }
@@ -581,10 +570,6 @@ static int ep_alloc(struct eventpoll **pep)
        struct eventpoll *ep;
 
        user = get_current_user();
-       error = -EMFILE;
-       if (unlikely(atomic_read(&user->epoll_devs) >=
-                       max_user_instances))
-               goto free_uid;
        error = -ENOMEM;
        ep = kzalloc(sizeof(*ep), GFP_KERNEL);
        if (unlikely(!ep))
@@ -1141,7 +1126,6 @@ SYSCALL_DEFINE1(epoll_create1, int, flags)
                              flags & O_CLOEXEC);
        if (fd < 0)
                ep_free(ep);
-       atomic_inc(&ep->user->epoll_devs);
 
 error_return:
        DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n",
@@ -1366,8 +1350,10 @@ static int __init eventpoll_init(void)
        struct sysinfo si;
 
        si_meminfo(&si);
-       max_user_instances = 128;
-       max_user_watches = (((si.totalram - si.totalhigh) / 32) << PAGE_SHIFT) /
+       /*
+        * Allows top 4% of lomem to be allocated for epoll watches (per user).
+        */
+       max_user_watches = (((si.totalram - si.totalhigh) / 25) << PAGE_SHIFT) /
                EP_ITEM_COST;
 
        /* Initialize the structure used to perform safe poll wait head wake ups */
index 0dd60a01f1b4eabcd6ff2717ad2faffe099f8f61..929b58004b7eace02d784a2a4fbba17fd02b0533 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1049,16 +1049,32 @@ EXPORT_SYMBOL(install_exec_creds);
  * - the caller must hold current->cred_exec_mutex to protect against
  *   PTRACE_ATTACH
  */
-void check_unsafe_exec(struct linux_binprm *bprm)
+void check_unsafe_exec(struct linux_binprm *bprm, struct files_struct *files)
 {
-       struct task_struct *p = current;
+       struct task_struct *p = current, *t;
+       unsigned long flags;
+       unsigned n_fs, n_files, n_sighand;
 
        bprm->unsafe = tracehook_unsafe_exec(p);
 
-       if (atomic_read(&p->fs->count) > 1 ||
-           atomic_read(&p->files->count) > 1 ||
-           atomic_read(&p->sighand->count) > 1)
+       n_fs = 1;
+       n_files = 1;
+       n_sighand = 1;
+       lock_task_sighand(p, &flags);
+       for (t = next_thread(p); t != p; t = next_thread(t)) {
+               if (t->fs == p->fs)
+                       n_fs++;
+               if (t->files == files)
+                       n_files++;
+               n_sighand++;
+       }
+
+       if (atomic_read(&p->fs->count) > n_fs ||
+           atomic_read(&p->files->count) > n_files ||
+           atomic_read(&p->sighand->count) > n_sighand)
                bprm->unsafe |= LSM_UNSAFE_SHARE;
+
+       unlock_task_sighand(p, &flags);
 }
 
 /* 
@@ -1273,7 +1289,7 @@ int do_execve(char * filename,
        bprm->cred = prepare_exec_creds();
        if (!bprm->cred)
                goto out_unlock;
-       check_unsafe_exec(bprm);
+       check_unsafe_exec(bprm, displaced);
 
        file = open_exec(filename);
        retval = PTR_ERR(file);
index 69a3d19ca9fd4dfbb80cf4de27b0fe10e9518120..4db4ffa1edad2f54c5b5de0d8c80ee26f83bb20b 100644 (file)
@@ -1358,7 +1358,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
        struct fake_dirent *fde;
 
        blocksize =  dir->i_sb->s_blocksize;
-       dxtrace(printk("Creating index\n"));
+       dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino));
        retval = ext3_journal_get_write_access(handle, bh);
        if (retval) {
                ext3_std_error(dir->i_sb, retval);
@@ -1367,6 +1367,19 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
        }
        root = (struct dx_root *) bh->b_data;
 
+       /* The 0th block becomes the root, move the dirents out */
+       fde = &root->dotdot;
+       de = (struct ext3_dir_entry_2 *)((char *)fde +
+                       ext3_rec_len_from_disk(fde->rec_len));
+       if ((char *) de >= (((char *) root) + blocksize)) {
+               ext3_error(dir->i_sb, __func__,
+                          "invalid rec_len for '..' in inode %lu",
+                          dir->i_ino);
+               brelse(bh);
+               return -EIO;
+       }
+       len = ((char *) root) + blocksize - (char *) de;
+
        bh2 = ext3_append (handle, dir, &block, &retval);
        if (!(bh2)) {
                brelse(bh);
@@ -1375,11 +1388,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
        EXT3_I(dir)->i_flags |= EXT3_INDEX_FL;
        data1 = bh2->b_data;
 
-       /* The 0th block becomes the root, move the dirents out */
-       fde = &root->dotdot;
-       de = (struct ext3_dir_entry_2 *)((char *)fde +
-                       ext3_rec_len_from_disk(fde->rec_len));
-       len = ((char *) root) + blocksize - (char *) de;
        memcpy (data1, de, len);
        de = (struct ext3_dir_entry_2 *) data1;
        top = data1 + len;
index 6bba06b09dd1ce8d969dccad6d20513e0f00a474..9a50b8052dcfab2865d34aebf54b459ec81e54b7 100644 (file)
@@ -684,15 +684,15 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb)
                gdp = ext4_get_group_desc(sb, i, NULL);
                if (!gdp)
                        continue;
-               desc_count += le16_to_cpu(gdp->bg_free_blocks_count);
+               desc_count += ext4_free_blks_count(sb, gdp);
                brelse(bitmap_bh);
                bitmap_bh = ext4_read_block_bitmap(sb, i);
                if (bitmap_bh == NULL)
                        continue;
 
                x = ext4_count_free(bitmap_bh, sb->s_blocksize);
-               printk(KERN_DEBUG "group %lu: stored = %d, counted = %u\n",
-                       i, le16_to_cpu(gdp->bg_free_blocks_count), x);
+               printk(KERN_DEBUG "group %u: stored = %d, counted = %u\n",
+                       i, ext4_free_blks_count(sb, gdp), x);
                bitmap_count += x;
        }
        brelse(bitmap_bh);
index c668e4377d76027a87f95eb168d6e54b024a1a69..aafc9eba1c25c8aace126bafc56e70d058695621 100644 (file)
@@ -1206,8 +1206,11 @@ static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
 
 static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
 {
-       return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
-               le32_to_cpu(raw_inode->i_size_lo);
+       if (S_ISREG(le16_to_cpu(raw_inode->i_mode)))
+               return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
+                       le32_to_cpu(raw_inode->i_size_lo);
+       else
+               return (loff_t) le32_to_cpu(raw_inode->i_size_lo);
 }
 
 static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
index 54bf0623a9ae31f4db4dbf6cecc0a13c72038ce5..e2eab196875ff694d3614b35e091e94bc82e31ea 100644 (file)
@@ -3048,7 +3048,7 @@ retry:
                        WARN_ON(ret <= 0);
                        printk(KERN_ERR "%s: ext4_ext_get_blocks "
                                    "returned error inode#%lu, block=%u, "
-                                   "max_blocks=%lu", __func__,
+                                   "max_blocks=%u", __func__,
                                    inode->i_ino, block, max_blocks);
 #endif
                        ext4_mark_inode_dirty(handle, inode);
index a6444cee0c7e086c4b76b6906011d11b32de7c7f..03ba20be132997140e4dcae313dadb865149427e 100644 (file)
@@ -360,9 +360,9 @@ static int ext4_block_to_path(struct inode *inode,
                final = ptrs;
        } else {
                ext4_warning(inode->i_sb, "ext4_block_to_path",
-                               "block %lu > max",
+                               "block %lu > max in inode %lu",
                                i_block + direct_blocks +
-                               indirect_blocks + double_blocks);
+                               indirect_blocks + double_blocks, inode->i_ino);
        }
        if (boundary)
                *boundary = final - 1 - (i_block & (ptrs - 1));
@@ -2821,9 +2821,6 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
                filemap_write_and_wait(mapping);
        }
 
-       BUG_ON(!EXT4_JOURNAL(inode) &&
-              EXT4_I(inode)->i_state & EXT4_STATE_JDATA);
-
        if (EXT4_JOURNAL(inode) && EXT4_I(inode)->i_state & EXT4_STATE_JDATA) {
                /*
                 * This is a REALLY heavyweight approach, but the use of
@@ -3622,7 +3619,7 @@ static void ext4_free_data(handle_t *handle, struct inode *inode,
                 * block pointed to itself, it would have been detached when
                 * the block was cleared. Check for this instead of OOPSing.
                 */
-               if (bh2jh(this_bh))
+               if ((EXT4_JOURNAL(inode) == NULL) || bh2jh(this_bh))
                        ext4_handle_dirty_metadata(handle, inode, this_bh);
                else
                        ext4_error(inode->i_sb, __func__,
index 918aec0c8a11d96b8439de14bfa83aad461d5b66..deba54f6cbed2af2d504224d2910829951e98d1c 100644 (file)
@@ -3025,7 +3025,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
                goto out_err;
 
        ext4_debug("using block group %u(%d)\n", ac->ac_b_ex.fe_group,
-                       gdp->bg_free_blocks_count);
+                       ext4_free_blks_count(sb, gdp));
 
        err = ext4_journal_get_write_access(handle, gdp_bh);
        if (err)
index fec0b4c2f5f1904c89436c1f825e82338489232f..ba702bd7910d955629d7ae049d1fb6930681d893 100644 (file)
@@ -1368,7 +1368,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
        struct fake_dirent *fde;
 
        blocksize =  dir->i_sb->s_blocksize;
-       dxtrace(printk(KERN_DEBUG "Creating index\n"));
+       dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino));
        retval = ext4_journal_get_write_access(handle, bh);
        if (retval) {
                ext4_std_error(dir->i_sb, retval);
@@ -1377,6 +1377,20 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
        }
        root = (struct dx_root *) bh->b_data;
 
+       /* The 0th block becomes the root, move the dirents out */
+       fde = &root->dotdot;
+       de = (struct ext4_dir_entry_2 *)((char *)fde +
+               ext4_rec_len_from_disk(fde->rec_len));
+       if ((char *) de >= (((char *) root) + blocksize)) {
+               ext4_error(dir->i_sb, __func__,
+                          "invalid rec_len for '..' in inode %lu",
+                          dir->i_ino);
+               brelse(bh);
+               return -EIO;
+       }
+       len = ((char *) root) + blocksize - (char *) de;
+
+       /* Allocate new block for the 0th block's dirents */
        bh2 = ext4_append(handle, dir, &block, &retval);
        if (!(bh2)) {
                brelse(bh);
@@ -1385,11 +1399,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
        EXT4_I(dir)->i_flags |= EXT4_INDEX_FL;
        data1 = bh2->b_data;
 
-       /* The 0th block becomes the root, move the dirents out */
-       fde = &root->dotdot;
-       de = (struct ext4_dir_entry_2 *)((char *)fde +
-               ext4_rec_len_from_disk(fde->rec_len));
-       len = ((char *) root) + blocksize - (char *) de;
        memcpy (data1, de, len);
        de = (struct ext4_dir_entry_2 *) data1;
        top = data1 + len;
index c328be5d68851a039b27a73a0adb7c39e11dcbc7..c06886abd6588b3c975ee92dd1eb76a88be29e3a 100644 (file)
@@ -861,12 +861,13 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
        gdp = (struct ext4_group_desc *)((char *)primary->b_data +
                                         gdb_off * EXT4_DESC_SIZE(sb));
 
+       memset(gdp, 0, EXT4_DESC_SIZE(sb));
        ext4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */
        ext4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */
        ext4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */
        ext4_free_blks_set(sb, gdp, input->free_blocks_count);
        ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb));
-       gdp->bg_flags |= cpu_to_le16(EXT4_BG_INODE_ZEROED);
+       gdp->bg_flags = cpu_to_le16(EXT4_BG_INODE_ZEROED);
        gdp->bg_checksum = ext4_group_desc_csum(sbi, input->group, gdp);
 
        /*
index 53af885f173243df3a5bf0906b589edccece84db..0d8ac497b3d552315b56e53c95f3f0440f59e45d 100644 (file)
@@ -43,7 +43,7 @@ extern void __init chrdev_init(void);
 /*
  * exec.c
  */
-extern void check_unsafe_exec(struct linux_binprm *);
+extern void check_unsafe_exec(struct linux_binprm *, struct files_struct *);
 
 /*
  * namespace.c
index 56675306ed817eacb654a3f245a14d81cc4d6971..eb343008eded0fd86851417f60717650dda96857 100644 (file)
 #include <linux/proc_fs.h>
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
+#include <linux/math64.h>
 
 #include <asm/uaccess.h>
 #include <asm/page.h>
-#include <asm/div64.h>
 
 EXPORT_SYMBOL(jbd2_journal_start);
 EXPORT_SYMBOL(jbd2_journal_restart);
@@ -846,8 +846,8 @@ static int jbd2_seq_info_show(struct seq_file *seq, void *v)
            jiffies_to_msecs(s->stats->u.run.rs_flushing / s->stats->ts_tid));
        seq_printf(seq, "  %ums logging transaction\n",
            jiffies_to_msecs(s->stats->u.run.rs_logging / s->stats->ts_tid));
-       seq_printf(seq, "  %luus average transaction commit time\n",
-                  do_div(s->journal->j_average_commit_time, 1000));
+       seq_printf(seq, "  %lluus average transaction commit time\n",
+                  div_u64(s->journal->j_average_commit_time, 1000));
        seq_printf(seq, "  %lu handles per transaction\n",
            s->stats->u.run.rs_handle_count / s->stats->ts_tid);
        seq_printf(seq, "  %lu blocks per transaction\n",
index d861096c9d81cbd643618377a7b7c9831c524cd9..60fe74035db5745fb541bdcc6983d3bb442e17ce 100644 (file)
@@ -5390,6 +5390,9 @@ int ocfs2_remove_btree_range(struct inode *inode,
                goto out;
        }
 
+       vfs_dq_free_space_nodirty(inode,
+                                 ocfs2_clusters_to_bytes(inode->i_sb, len));
+
        ret = ocfs2_remove_extent(inode, et, cpos, len, handle, meta_ac,
                                  dealloc);
        if (ret) {
index b1cc7c381e889b5d898ad5f3e2a9bddeb9b39fd1..e9d7c2038c0f55c1f0cf48386a2f6eed12a2d805 100644 (file)
@@ -38,6 +38,7 @@
 #include "dlmglue.h"
 #include "file.h"
 #include "inode.h"
+#include "super.h"
 
 
 static int ocfs2_dentry_revalidate(struct dentry *dentry,
@@ -294,6 +295,34 @@ out_attach:
        return ret;
 }
 
+static DEFINE_SPINLOCK(dentry_list_lock);
+
+/* We limit the number of dentry locks to drop in one go. We have
+ * this limit so that we don't starve other users of ocfs2_wq. */
+#define DL_INODE_DROP_COUNT 64
+
+/* Drop inode references from dentry locks */
+void ocfs2_drop_dl_inodes(struct work_struct *work)
+{
+       struct ocfs2_super *osb = container_of(work, struct ocfs2_super,
+                                              dentry_lock_work);
+       struct ocfs2_dentry_lock *dl;
+       int drop_count = DL_INODE_DROP_COUNT;
+
+       spin_lock(&dentry_list_lock);
+       while (osb->dentry_lock_list && drop_count--) {
+               dl = osb->dentry_lock_list;
+               osb->dentry_lock_list = dl->dl_next;
+               spin_unlock(&dentry_list_lock);
+               iput(dl->dl_inode);
+               kfree(dl);
+               spin_lock(&dentry_list_lock);
+       }
+       if (osb->dentry_lock_list)
+               queue_work(ocfs2_wq, &osb->dentry_lock_work);
+       spin_unlock(&dentry_list_lock);
+}
+
 /*
  * ocfs2_dentry_iput() and friends.
  *
@@ -318,16 +347,23 @@ out_attach:
 static void ocfs2_drop_dentry_lock(struct ocfs2_super *osb,
                                   struct ocfs2_dentry_lock *dl)
 {
-       iput(dl->dl_inode);
        ocfs2_simple_drop_lockres(osb, &dl->dl_lockres);
        ocfs2_lock_res_free(&dl->dl_lockres);
-       kfree(dl);
+
+       /* We leave dropping of inode reference to ocfs2_wq as that can
+        * possibly lead to inode deletion which gets tricky */
+       spin_lock(&dentry_list_lock);
+       if (!osb->dentry_lock_list)
+               queue_work(ocfs2_wq, &osb->dentry_lock_work);
+       dl->dl_next = osb->dentry_lock_list;
+       osb->dentry_lock_list = dl;
+       spin_unlock(&dentry_list_lock);
 }
 
 void ocfs2_dentry_lock_put(struct ocfs2_super *osb,
                           struct ocfs2_dentry_lock *dl)
 {
-       int unlock = 0;
+       int unlock;
 
        BUG_ON(dl->dl_count == 0);
 
index c091c34d9883d25dcc2084371d664e0c93b4de2b..d06e16c0664061d7ea7bf4bb319242a890eef68a 100644 (file)
 extern struct dentry_operations ocfs2_dentry_ops;
 
 struct ocfs2_dentry_lock {
+       /* Use count of dentry lock */
        unsigned int            dl_count;
-       u64                     dl_parent_blkno;
+       union {
+               /* Linked list of dentry locks to release */
+               struct ocfs2_dentry_lock *dl_next;
+               u64                     dl_parent_blkno;
+       };
 
        /*
         * The ocfs2_dentry_lock keeps an inode reference until
@@ -47,6 +52,8 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry, struct inode *inode,
 void ocfs2_dentry_lock_put(struct ocfs2_super *osb,
                           struct ocfs2_dentry_lock *dl);
 
+void ocfs2_drop_dl_inodes(struct work_struct *work);
+
 struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno,
                                      int skip_unhashed);
 
index b0c4cadd4c45181f7d8d02f1af11a182e2f380dd..206a2370876a8c82f4c6ad04f101a7d801be6e5b 100644 (file)
@@ -2860,6 +2860,10 @@ static void ocfs2_unlock_ast(void *opaque, int error)
        case OCFS2_UNLOCK_CANCEL_CONVERT:
                mlog(0, "Cancel convert success for %s\n", lockres->l_name);
                lockres->l_action = OCFS2_AST_INVALID;
+               /* Downconvert thread may have requeued this lock, we
+                * need to wake it. */
+               if (lockres->l_flags & OCFS2_LOCK_BLOCKED)
+                       ocfs2_wake_downconvert_thread(ocfs2_get_lockres_osb(lockres));
                break;
        case OCFS2_UNLOCK_DROP_LOCK:
                lockres->l_level = DLM_LOCK_IV;
index ad5c24a29edd6d91db671390922c336651bd8d40..077384135f4ea763cd30105b9df51521b9565227 100644 (file)
@@ -210,6 +210,7 @@ struct ocfs2_journal;
 struct ocfs2_slot_info;
 struct ocfs2_recovery_map;
 struct ocfs2_quota_recovery;
+struct ocfs2_dentry_lock;
 struct ocfs2_super
 {
        struct task_struct *commit_task;
@@ -325,6 +326,11 @@ struct ocfs2_super
        struct list_head blocked_lock_list;
        unsigned long blocked_lock_count;
 
+       /* List of dentry locks to release. Anyone can add locks to
+        * the list, ocfs2_wq processes the list  */
+       struct ocfs2_dentry_lock *dentry_lock_list;
+       struct work_struct dentry_lock_work;
+
        wait_queue_head_t               osb_mount_event;
 
        /* Truncate log info */
index f4efa89baee54d8493d886b9afbaec19a8e29ad4..1ed0f7c868697c47c447ee611175f067def508dd 100644 (file)
@@ -754,7 +754,9 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot)
        if (dquot->dq_flags & mask)
                sync = 1;
        spin_unlock(&dq_data_lock);
-       if (!sync) {
+       /* This is a slight hack but we can't afford getting global quota
+        * lock if we already have a transaction started. */
+       if (!sync || journal_current_handle()) {
                status = ocfs2_write_dquot(dquot);
                goto out;
        }
index 43ed11345b59fdf7ac8c00596b14491a4e89eb20..b1cb38fbe80706817a2fdf6be8dda71f348eb568 100644 (file)
@@ -1887,6 +1887,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
        INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery);
        journal->j_state = OCFS2_JOURNAL_FREE;
 
+       INIT_WORK(&osb->dentry_lock_work, ocfs2_drop_dl_inodes);
+       osb->dentry_lock_list = NULL;
+
        /* get some pseudo constants for clustersize bits */
        osb->s_clustersize_bits =
                le32_to_cpu(di->id2.i_super.s_clustersize_bits);
index e1d638af6ac3d00d8cb72a5b9b442c3bdfb8e3f0..915039fffe6ed37149a47d1929929f79b0865d5c 100644 (file)
@@ -4729,13 +4729,6 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode,
        vb.vb_xv = (struct ocfs2_xattr_value_root *)
                (vb.vb_bh->b_data + offset % blocksize);
 
-       ret = ocfs2_xattr_bucket_journal_access(ctxt->handle, bucket,
-                                               OCFS2_JOURNAL_ACCESS_WRITE);
-       if (ret) {
-               mlog_errno(ret);
-               goto out;
-       }
-
        /*
         * From here on out we have to dirty the bucket.  The generic
         * value calls only modify one of the bucket's bhs, but we need
@@ -4748,12 +4741,18 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode,
        ret = ocfs2_xattr_value_truncate(inode, &vb, len, ctxt);
        if (ret) {
                mlog_errno(ret);
-               goto out_dirty;
+               goto out;
+       }
+
+       ret = ocfs2_xattr_bucket_journal_access(ctxt->handle, bucket,
+                                               OCFS2_JOURNAL_ACCESS_WRITE);
+       if (ret) {
+               mlog_errno(ret);
+               goto out;
        }
 
        xe->xe_value_size = cpu_to_le64(len);
 
-out_dirty:
        ocfs2_xattr_bucket_journal_dirty(ctxt->handle, bucket);
 
 out:
index b569ff1c4dc81570bec822be5df54069af18a162..5267098532bfc8a3a6c25026119a14c144d49f5c 100644 (file)
@@ -54,6 +54,64 @@ int seq_open(struct file *file, const struct seq_operations *op)
 }
 EXPORT_SYMBOL(seq_open);
 
+static int traverse(struct seq_file *m, loff_t offset)
+{
+       loff_t pos = 0, index;
+       int error = 0;
+       void *p;
+
+       m->version = 0;
+       index = 0;
+       m->count = m->from = 0;
+       if (!offset) {
+               m->index = index;
+               return 0;
+       }
+       if (!m->buf) {
+               m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
+               if (!m->buf)
+                       return -ENOMEM;
+       }
+       p = m->op->start(m, &index);
+       while (p) {
+               error = PTR_ERR(p);
+               if (IS_ERR(p))
+                       break;
+               error = m->op->show(m, p);
+               if (error < 0)
+                       break;
+               if (unlikely(error)) {
+                       error = 0;
+                       m->count = 0;
+               }
+               if (m->count == m->size)
+                       goto Eoverflow;
+               if (pos + m->count > offset) {
+                       m->from = offset - pos;
+                       m->count -= m->from;
+                       m->index = index;
+                       break;
+               }
+               pos += m->count;
+               m->count = 0;
+               if (pos == offset) {
+                       index++;
+                       m->index = index;
+                       break;
+               }
+               p = m->op->next(m, p, &index);
+       }
+       m->op->stop(m, p);
+       m->index = index;
+       return error;
+
+Eoverflow:
+       m->op->stop(m, p);
+       kfree(m->buf);
+       m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
+       return !m->buf ? -ENOMEM : -EAGAIN;
+}
+
 /**
  *     seq_read -      ->read() method for sequential files.
  *     @file: the file to read from
@@ -186,63 +244,6 @@ Efault:
 }
 EXPORT_SYMBOL(seq_read);
 
-static int traverse(struct seq_file *m, loff_t offset)
-{
-       loff_t pos = 0, index;
-       int error = 0;
-       void *p;
-
-       m->version = 0;
-       index = 0;
-       m->count = m->from = 0;
-       if (!offset) {
-               m->index = index;
-               return 0;
-       }
-       if (!m->buf) {
-               m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
-               if (!m->buf)
-                       return -ENOMEM;
-       }
-       p = m->op->start(m, &index);
-       while (p) {
-               error = PTR_ERR(p);
-               if (IS_ERR(p))
-                       break;
-               error = m->op->show(m, p);
-               if (error < 0)
-                       break;
-               if (unlikely(error)) {
-                       error = 0;
-                       m->count = 0;
-               }
-               if (m->count == m->size)
-                       goto Eoverflow;
-               if (pos + m->count > offset) {
-                       m->from = offset - pos;
-                       m->count -= m->from;
-                       m->index = index;
-                       break;
-               }
-               pos += m->count;
-               m->count = 0;
-               if (pos == offset) {
-                       index++;
-                       m->index = index;
-                       break;
-               }
-               p = m->op->next(m, p, &index);
-       }
-       m->op->stop(m, p);
-       return error;
-
-Eoverflow:
-       m->op->stop(m, p);
-       kfree(m->buf);
-       m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
-       return !m->buf ? -ENOMEM : -EAGAIN;
-}
-
 /**
  *     seq_lseek -     ->llseek() method for sequential files.
  *     @file: the file in question
index 645e5403f2a0da0b4ed97cd6b6499791c732338d..61dce001dd572ef74685c42b0a1b83fa7307703b 100644 (file)
@@ -301,7 +301,7 @@ void generic_shutdown_super(struct super_block *sb)
                /*
                 * wait for asynchronous fs operations to finish before going further
                 */
-               async_synchronize_full_special(&sb->s_async_list);
+               async_synchronize_full_domain(&sb->s_async_list);
 
                /* bad name - it should be evict_inodes() */
                invalidate_inodes(sb);
@@ -470,7 +470,7 @@ restart:
                sb->s_count++;
                spin_unlock(&sb_lock);
                down_read(&sb->s_umount);
-               async_synchronize_full_special(&sb->s_async_list);
+               async_synchronize_full_domain(&sb->s_async_list);
                if (sb->s_root && (wait || sb->s_dirt))
                        sb->s_op->sync_fs(sb, wait);
                up_read(&sb->s_umount);
index 175f9c590b7717cbe0fc8170683a7edc9a602611..f393620890ee4dfd8cb4c2bde0e32dce25390635 100644 (file)
@@ -689,7 +689,7 @@ long long ubifs_reported_space(const struct ubifs_info *c, long long free)
 }
 
 /**
- * ubifs_get_free_space - return amount of free space.
+ * ubifs_get_free_space_nolock - return amount of free space.
  * @c: UBIFS file-system description object
  *
  * This function calculates amount of free space to report to user-space.
@@ -704,16 +704,14 @@ long long ubifs_reported_space(const struct ubifs_info *c, long long free)
  * traditional file-systems, because they have way less overhead than UBIFS.
  * So, to keep users happy, UBIFS tries to take the overhead into account.
  */
-long long ubifs_get_free_space(struct ubifs_info *c)
+long long ubifs_get_free_space_nolock(struct ubifs_info *c)
 {
-       int min_idx_lebs, rsvd_idx_lebs, lebs;
+       int rsvd_idx_lebs, lebs;
        long long available, outstanding, free;
 
-       spin_lock(&c->space_lock);
-       min_idx_lebs = c->min_idx_lebs;
-       ubifs_assert(min_idx_lebs == ubifs_calc_min_idx_lebs(c));
+       ubifs_assert(c->min_idx_lebs == ubifs_calc_min_idx_lebs(c));
        outstanding = c->budg_data_growth + c->budg_dd_growth;
-       available = ubifs_calc_available(c, min_idx_lebs);
+       available = ubifs_calc_available(c, c->min_idx_lebs);
 
        /*
         * When reporting free space to user-space, UBIFS guarantees that it is
@@ -726,15 +724,14 @@ long long ubifs_get_free_space(struct ubifs_info *c)
         * Note, the calculations below are similar to what we have in
         * 'do_budget_space()', so refer there for comments.
         */
-       if (min_idx_lebs > c->lst.idx_lebs)
-               rsvd_idx_lebs = min_idx_lebs - c->lst.idx_lebs;
+       if (c->min_idx_lebs > c->lst.idx_lebs)
+               rsvd_idx_lebs = c->min_idx_lebs - c->lst.idx_lebs;
        else
                rsvd_idx_lebs = 0;
        lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt -
               c->lst.taken_empty_lebs;
        lebs -= rsvd_idx_lebs;
        available += lebs * (c->dark_wm - c->leb_overhead);
-       spin_unlock(&c->space_lock);
 
        if (available > outstanding)
                free = ubifs_reported_space(c, available - outstanding);
@@ -742,3 +739,21 @@ long long ubifs_get_free_space(struct ubifs_info *c)
                free = 0;
        return free;
 }
+
+/**
+ * ubifs_get_free_space - return amount of free space.
+ * @c: UBIFS file-system description object
+ *
+ * This function calculates and retuns amount of free space to report to
+ * user-space.
+ */
+long long ubifs_get_free_space(struct ubifs_info *c)
+{
+       long long free;
+
+       spin_lock(&c->space_lock);
+       free = ubifs_get_free_space_nolock(c);
+       spin_unlock(&c->space_lock);
+
+       return free;
+}
index 792c5a16c182e6b4f501e85041c7144e444370e8..e975bd82f38b8d31d6a4ae4b25a587b6c5494318 100644 (file)
@@ -620,9 +620,11 @@ void dbg_dump_budg(struct ubifs_info *c)
               c->dark_wm, c->dead_wm, c->max_idx_node_sz);
        printk(KERN_DEBUG "\tgc_lnum %d, ihead_lnum %d\n",
               c->gc_lnum, c->ihead_lnum);
-       for (i = 0; i < c->jhead_cnt; i++)
-               printk(KERN_DEBUG "\tjhead %d\t LEB %d\n",
-                      c->jheads[i].wbuf.jhead, c->jheads[i].wbuf.lnum);
+       /* If we are in R/O mode, journal heads do not exist */
+       if (c->jheads)
+               for (i = 0; i < c->jhead_cnt; i++)
+                       printk(KERN_DEBUG "\tjhead %d\t LEB %d\n",
+                              c->jheads[i].wbuf.jhead, c->jheads[i].wbuf.lnum);
        for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) {
                bud = rb_entry(rb, struct ubifs_bud, rb);
                printk(KERN_DEBUG "\tbud LEB %d\n", bud->lnum);
@@ -637,10 +639,7 @@ void dbg_dump_budg(struct ubifs_info *c)
        /* Print budgeting predictions */
        available = ubifs_calc_available(c, c->min_idx_lebs);
        outstanding = c->budg_data_growth + c->budg_dd_growth;
-       if (available > outstanding)
-               free = ubifs_reported_space(c, available - outstanding);
-       else
-               free = 0;
+       free = ubifs_get_free_space_nolock(c);
        printk(KERN_DEBUG "Budgeting predictions:\n");
        printk(KERN_DEBUG "\tavailable: %lld, outstanding %lld, free %lld\n",
               available, outstanding, free);
@@ -860,6 +859,65 @@ void dbg_dump_index(struct ubifs_info *c)
        dbg_walk_index(c, NULL, dump_znode, NULL);
 }
 
+/**
+ * dbg_save_space_info - save information about flash space.
+ * @c: UBIFS file-system description object
+ *
+ * This function saves information about UBIFS free space, dirty space, etc, in
+ * order to check it later.
+ */
+void dbg_save_space_info(struct ubifs_info *c)
+{
+       struct ubifs_debug_info *d = c->dbg;
+
+       ubifs_get_lp_stats(c, &d->saved_lst);
+
+       spin_lock(&c->space_lock);
+       d->saved_free = ubifs_get_free_space_nolock(c);
+       spin_unlock(&c->space_lock);
+}
+
+/**
+ * dbg_check_space_info - check flash space information.
+ * @c: UBIFS file-system description object
+ *
+ * This function compares current flash space information with the information
+ * which was saved when the 'dbg_save_space_info()' function was called.
+ * Returns zero if the information has not changed, and %-EINVAL it it has
+ * changed.
+ */
+int dbg_check_space_info(struct ubifs_info *c)
+{
+       struct ubifs_debug_info *d = c->dbg;
+       struct ubifs_lp_stats lst;
+       long long avail, free;
+
+       spin_lock(&c->space_lock);
+       avail = ubifs_calc_available(c, c->min_idx_lebs);
+       spin_unlock(&c->space_lock);
+       free = ubifs_get_free_space(c);
+
+       if (free != d->saved_free) {
+               ubifs_err("free space changed from %lld to %lld",
+                         d->saved_free, free);
+               goto out;
+       }
+
+       return 0;
+
+out:
+       ubifs_msg("saved lprops statistics dump");
+       dbg_dump_lstats(&d->saved_lst);
+       ubifs_get_lp_stats(c, &lst);
+       ubifs_msg("current lprops statistics dump");
+       dbg_dump_lstats(&d->saved_lst);
+       spin_lock(&c->space_lock);
+       dbg_dump_budg(c);
+       spin_unlock(&c->space_lock);
+       dump_stack();
+       return -EINVAL;
+}
+
 /**
  * dbg_check_synced_i_size - check synchronized inode size.
  * @inode: inode to check
@@ -1349,7 +1407,7 @@ int dbg_check_tnc(struct ubifs_info *c, int extra)
  * @c: UBIFS file-system description object
  * @leaf_cb: called for each leaf node
  * @znode_cb: called for each indexing node
- * @priv: private date which is passed to callbacks
+ * @priv: private data which is passed to callbacks
  *
  * This function walks the UBIFS index and calls the @leaf_cb for each leaf
  * node and @znode_cb for each indexing node. Returns zero in case of success
@@ -2409,7 +2467,7 @@ void ubifs_debugging_exit(struct ubifs_info *c)
  * Root directory for UBIFS stuff in debugfs. Contains sub-directories which
  * contain the stuff specific to particular file-system mounts.
  */
-static struct dentry *debugfs_rootdir;
+static struct dentry *dfs_rootdir;
 
 /**
  * dbg_debugfs_init - initialize debugfs file-system.
@@ -2421,9 +2479,9 @@ static struct dentry *debugfs_rootdir;
  */
 int dbg_debugfs_init(void)
 {
-       debugfs_rootdir = debugfs_create_dir("ubifs", NULL);
-       if (IS_ERR(debugfs_rootdir)) {
-               int err = PTR_ERR(debugfs_rootdir);
+       dfs_rootdir = debugfs_create_dir("ubifs", NULL);
+       if (IS_ERR(dfs_rootdir)) {
+               int err = PTR_ERR(dfs_rootdir);
                ubifs_err("cannot create \"ubifs\" debugfs directory, "
                          "error %d\n", err);
                return err;
@@ -2437,7 +2495,7 @@ int dbg_debugfs_init(void)
  */
 void dbg_debugfs_exit(void)
 {
-       debugfs_remove(debugfs_rootdir);
+       debugfs_remove(dfs_rootdir);
 }
 
 static int open_debugfs_file(struct inode *inode, struct file *file)
@@ -2452,13 +2510,13 @@ static ssize_t write_debugfs_file(struct file *file, const char __user *buf,
        struct ubifs_info *c = file->private_data;
        struct ubifs_debug_info *d = c->dbg;
 
-       if (file->f_path.dentry == d->dump_lprops)
+       if (file->f_path.dentry == d->dfs_dump_lprops)
                dbg_dump_lprops(c);
-       else if (file->f_path.dentry == d->dump_budg) {
+       else if (file->f_path.dentry == d->dfs_dump_budg) {
                spin_lock(&c->space_lock);
                dbg_dump_budg(c);
                spin_unlock(&c->space_lock);
-       } else if (file->f_path.dentry == d->dump_tnc) {
+       } else if (file->f_path.dentry == d->dfs_dump_tnc) {
                mutex_lock(&c->tnc_mutex);
                dbg_dump_tnc(c);
                mutex_unlock(&c->tnc_mutex);
@@ -2469,7 +2527,7 @@ static ssize_t write_debugfs_file(struct file *file, const char __user *buf,
        return count;
 }
 
-static const struct file_operations debugfs_fops = {
+static const struct file_operations dfs_fops = {
        .open = open_debugfs_file,
        .write = write_debugfs_file,
        .owner = THIS_MODULE,
@@ -2494,36 +2552,32 @@ int dbg_debugfs_init_fs(struct ubifs_info *c)
        struct dentry *dent;
        struct ubifs_debug_info *d = c->dbg;
 
-       sprintf(d->debugfs_dir_name, "ubi%d_%d", c->vi.ubi_num, c->vi.vol_id);
-       d->debugfs_dir = debugfs_create_dir(d->debugfs_dir_name,
-                                             debugfs_rootdir);
-       if (IS_ERR(d->debugfs_dir)) {
-               err = PTR_ERR(d->debugfs_dir);
+       sprintf(d->dfs_dir_name, "ubi%d_%d", c->vi.ubi_num, c->vi.vol_id);
+       d->dfs_dir = debugfs_create_dir(d->dfs_dir_name, dfs_rootdir);
+       if (IS_ERR(d->dfs_dir)) {
+               err = PTR_ERR(d->dfs_dir);
                ubifs_err("cannot create \"%s\" debugfs directory, error %d\n",
-                         d->debugfs_dir_name, err);
+                         d->dfs_dir_name, err);
                goto out;
        }
 
        fname = "dump_lprops";
-       dent = debugfs_create_file(fname, S_IWUGO, d->debugfs_dir, c,
-                                  &debugfs_fops);
+       dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops);
        if (IS_ERR(dent))
                goto out_remove;
-       d->dump_lprops = dent;
+       d->dfs_dump_lprops = dent;
 
        fname = "dump_budg";
-       dent = debugfs_create_file(fname, S_IWUGO, d->debugfs_dir, c,
-                                  &debugfs_fops);
+       dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops);
        if (IS_ERR(dent))
                goto out_remove;
-       d->dump_budg = dent;
+       d->dfs_dump_budg = dent;
 
        fname = "dump_tnc";
-       dent = debugfs_create_file(fname, S_IWUGO, d->debugfs_dir, c,
-                                  &debugfs_fops);
+       dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops);
        if (IS_ERR(dent))
                goto out_remove;
-       d->dump_tnc = dent;
+       d->dfs_dump_tnc = dent;
 
        return 0;
 
@@ -2531,7 +2585,7 @@ out_remove:
        err = PTR_ERR(dent);
        ubifs_err("cannot create \"%s\" debugfs directory, error %d\n",
                  fname, err);
-       debugfs_remove_recursive(d->debugfs_dir);
+       debugfs_remove_recursive(d->dfs_dir);
 out:
        return err;
 }
@@ -2542,7 +2596,7 @@ out:
  */
 void dbg_debugfs_exit_fs(struct ubifs_info *c)
 {
-       debugfs_remove_recursive(c->dbg->debugfs_dir);
+       debugfs_remove_recursive(c->dbg->dfs_dir);
 }
 
 #endif /* CONFIG_UBIFS_FS_DEBUG */
index 9820d6999f7e0b2704325713cba2150a7c4b0cef..c1cd73b2e06e4ecc541ebf3b5f840572c8bfe282 100644 (file)
  * @chk_lpt_wastage: used by LPT tree size checker
  * @chk_lpt_lebs: used by LPT tree size checker
  * @new_nhead_offs: used by LPT tree size checker
- * @new_ihead_lnum: used by debugging to check ihead_lnum
- * @new_ihead_offs: used by debugging to check ihead_offs
+ * @new_ihead_lnum: used by debugging to check @c->ihead_lnum
+ * @new_ihead_offs: used by debugging to check @c->ihead_offs
  *
- * debugfs_dir_name: name of debugfs directory containing this file-system's
- *                   files
- * debugfs_dir: direntry object of the file-system debugfs directory
- * dump_lprops: "dump lprops" debugfs knob
- * dump_budg: "dump budgeting information" debugfs knob
- * dump_tnc: "dump TNC" debugfs knob
+ * @saved_lst: saved lprops statistics (used by 'dbg_save_space_info()')
+ * @saved_free: saved free space (used by 'dbg_save_space_info()')
+ *
+ * dfs_dir_name: name of debugfs directory containing this file-system's files
+ * dfs_dir: direntry object of the file-system debugfs directory
+ * dfs_dump_lprops: "dump lprops" debugfs knob
+ * dfs_dump_budg: "dump budgeting information" debugfs knob
+ * dfs_dump_tnc: "dump TNC" debugfs knob
  */
 struct ubifs_debug_info {
        void *buf;
@@ -69,11 +71,14 @@ struct ubifs_debug_info {
        int new_ihead_lnum;
        int new_ihead_offs;
 
-       char debugfs_dir_name[100];
-       struct dentry *debugfs_dir;
-       struct dentry *dump_lprops;
-       struct dentry *dump_budg;
-       struct dentry *dump_tnc;
+       struct ubifs_lp_stats saved_lst;
+       long long saved_free;
+
+       char dfs_dir_name[100];
+       struct dentry *dfs_dir;
+       struct dentry *dfs_dump_lprops;
+       struct dentry *dfs_dump_budg;
+       struct dentry *dfs_dump_tnc;
 };
 
 #define ubifs_assert(expr) do {                                                \
@@ -297,7 +302,8 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
                   dbg_znode_callback znode_cb, void *priv);
 
 /* Checking functions */
-
+void dbg_save_space_info(struct ubifs_info *c);
+int dbg_check_space_info(struct ubifs_info *c);
 int dbg_check_lprops(struct ubifs_info *c);
 int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot);
 int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot);
@@ -439,6 +445,8 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c);
 
 #define dbg_walk_index(c, leaf_cb, znode_cb, priv) 0
 #define dbg_old_index_check_init(c, zroot)         0
+#define dbg_save_space_info(c)                     ({})
+#define dbg_check_space_info(c)                    0
 #define dbg_check_old_index(c, zroot)              0
 #define dbg_check_cats(c)                          0
 #define dbg_check_ltab(c)                          0
index f448ab1f9c38eb7861ec62ad998fdebce72e1aa9..f55d523c52bbd052b5600dfdc17a99706b48d823 100644 (file)
@@ -482,30 +482,29 @@ static int ubifs_dir_release(struct inode *dir, struct file *file)
 }
 
 /**
- * lock_2_inodes - lock two UBIFS inodes.
+ * lock_2_inodes - a wrapper for locking two UBIFS inodes.
  * @inode1: first inode
  * @inode2: second inode
+ *
+ * We do not implement any tricks to guarantee strict lock ordering, because
+ * VFS has already done it for us on the @i_mutex. So this is just a simple
+ * wrapper function.
  */
 static void lock_2_inodes(struct inode *inode1, struct inode *inode2)
 {
-       if (inode1->i_ino < inode2->i_ino) {
-               mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_2);
-               mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_3);
-       } else {
-               mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2);
-               mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_3);
-       }
+       mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1);
+       mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2);
 }
 
 /**
- * unlock_2_inodes - unlock two UBIFS inodes inodes.
+ * unlock_2_inodes - a wrapper for unlocking two UBIFS inodes.
  * @inode1: first inode
  * @inode2: second inode
  */
 static void unlock_2_inodes(struct inode *inode1, struct inode *inode2)
 {
-       mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
        mutex_unlock(&ubifs_inode(inode2)->ui_mutex);
+       mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
 }
 
 static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
@@ -527,6 +526,8 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
        dbg_gen("dent '%.*s' to ino %lu (nlink %d) in dir ino %lu",
                dentry->d_name.len, dentry->d_name.name, inode->i_ino,
                inode->i_nlink, dir->i_ino);
+       ubifs_assert(mutex_is_locked(&dir->i_mutex));
+       ubifs_assert(mutex_is_locked(&inode->i_mutex));
        err = dbg_check_synced_i_size(inode);
        if (err)
                return err;
@@ -580,6 +581,8 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
        dbg_gen("dent '%.*s' from ino %lu (nlink %d) in dir ino %lu",
                dentry->d_name.len, dentry->d_name.name, inode->i_ino,
                inode->i_nlink, dir->i_ino);
+       ubifs_assert(mutex_is_locked(&dir->i_mutex));
+       ubifs_assert(mutex_is_locked(&inode->i_mutex));
        err = dbg_check_synced_i_size(inode);
        if (err)
                return err;
@@ -667,7 +670,8 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
 
        dbg_gen("directory '%.*s', ino %lu in dir ino %lu", dentry->d_name.len,
                dentry->d_name.name, inode->i_ino, dir->i_ino);
-
+       ubifs_assert(mutex_is_locked(&dir->i_mutex));
+       ubifs_assert(mutex_is_locked(&inode->i_mutex));
        err = check_dir_empty(c, dentry->d_inode);
        if (err)
                return err;
@@ -922,59 +926,30 @@ out_budg:
 }
 
 /**
- * lock_3_inodes - lock three UBIFS inodes for rename.
+ * lock_3_inodes - a wrapper for locking three UBIFS inodes.
  * @inode1: first inode
  * @inode2: second inode
  * @inode3: third inode
  *
- * For 'ubifs_rename()', @inode1 may be the same as @inode2 whereas @inode3 may
- * be null.
+ * This function is used for 'ubifs_rename()' and @inode1 may be the same as
+ * @inode2 whereas @inode3 may be %NULL.
+ *
+ * We do not implement any tricks to guarantee strict lock ordering, because
+ * VFS has already done it for us on the @i_mutex. So this is just a simple
+ * wrapper function.
  */
 static void lock_3_inodes(struct inode *inode1, struct inode *inode2,
                          struct inode *inode3)
 {
-       struct inode *i1, *i2, *i3;
-
-       if (!inode3) {
-               if (inode1 != inode2) {
-                       lock_2_inodes(inode1, inode2);
-                       return;
-               }
-               mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1);
-               return;
-       }
-
-       if (inode1 == inode2) {
-               lock_2_inodes(inode1, inode3);
-               return;
-       }
-
-       /* 3 different inodes */
-       if (inode1 < inode2) {
-               i3 = inode2;
-               if (inode1 < inode3) {
-                       i1 = inode1;
-                       i2 = inode3;
-               } else {
-                       i1 = inode3;
-                       i2 = inode1;
-               }
-       } else {
-               i3 = inode1;
-               if (inode2 < inode3) {
-                       i1 = inode2;
-                       i2 = inode3;
-               } else {
-                       i1 = inode3;
-                       i2 = inode2;
-               }
-       }
-       mutex_lock_nested(&ubifs_inode(i1)->ui_mutex, WB_MUTEX_1);
-       lock_2_inodes(i2, i3);
+       mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1);
+       if (inode2 != inode1)
+               mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2);
+       if (inode3)
+               mutex_lock_nested(&ubifs_inode(inode3)->ui_mutex, WB_MUTEX_3);
 }
 
 /**
- * unlock_3_inodes - unlock three UBIFS inodes for rename.
+ * unlock_3_inodes - a wrapper for unlocking three UBIFS inodes for rename.
  * @inode1: first inode
  * @inode2: second inode
  * @inode3: third inode
@@ -982,11 +957,11 @@ static void lock_3_inodes(struct inode *inode1, struct inode *inode2,
 static void unlock_3_inodes(struct inode *inode1, struct inode *inode2,
                            struct inode *inode3)
 {
-       mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
-       if (inode1 != inode2)
-               mutex_unlock(&ubifs_inode(inode2)->ui_mutex);
        if (inode3)
                mutex_unlock(&ubifs_inode(inode3)->ui_mutex);
+       if (inode1 != inode2)
+               mutex_unlock(&ubifs_inode(inode2)->ui_mutex);
+       mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
 }
 
 static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
@@ -1020,6 +995,11 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
                "dir ino %lu", old_dentry->d_name.len, old_dentry->d_name.name,
                old_inode->i_ino, old_dir->i_ino, new_dentry->d_name.len,
                new_dentry->d_name.name, new_dir->i_ino);
+       ubifs_assert(mutex_is_locked(&old_dir->i_mutex));
+       ubifs_assert(mutex_is_locked(&new_dir->i_mutex));
+       if (unlink)
+               ubifs_assert(mutex_is_locked(&new_inode->i_mutex));
+
 
        if (unlink && is_dir) {
                err = check_dir_empty(c, new_inode);
@@ -1199,7 +1179,7 @@ int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
        return 0;
 }
 
-struct inode_operations ubifs_dir_inode_operations = {
+const struct inode_operations ubifs_dir_inode_operations = {
        .lookup      = ubifs_lookup,
        .create      = ubifs_create,
        .link        = ubifs_link,
@@ -1219,7 +1199,7 @@ struct inode_operations ubifs_dir_inode_operations = {
 #endif
 };
 
-struct file_operations ubifs_dir_operations = {
+const struct file_operations ubifs_dir_operations = {
        .llseek         = ubifs_dir_llseek,
        .release        = ubifs_dir_release,
        .read           = generic_read_dir,
index bf37374567fa745c63c9f4698d929811544af0e3..93b6de51f261727f2c5f4e62814a0e79d3b109b5 100644 (file)
@@ -432,7 +432,6 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,
        int uninitialized_var(err), appending = !!(pos + len > inode->i_size);
        struct page *page;
 
-
        ubifs_assert(ubifs_inode(inode)->ui_size == inode->i_size);
 
        if (unlikely(c->ro_media))
@@ -1541,7 +1540,7 @@ static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma)
        return 0;
 }
 
-struct address_space_operations ubifs_file_address_operations = {
+const struct address_space_operations ubifs_file_address_operations = {
        .readpage       = ubifs_readpage,
        .writepage      = ubifs_writepage,
        .write_begin    = ubifs_write_begin,
@@ -1551,7 +1550,7 @@ struct address_space_operations ubifs_file_address_operations = {
        .releasepage    = ubifs_releasepage,
 };
 
-struct inode_operations ubifs_file_inode_operations = {
+const struct inode_operations ubifs_file_inode_operations = {
        .setattr     = ubifs_setattr,
        .getattr     = ubifs_getattr,
 #ifdef CONFIG_UBIFS_FS_XATTR
@@ -1562,14 +1561,14 @@ struct inode_operations ubifs_file_inode_operations = {
 #endif
 };
 
-struct inode_operations ubifs_symlink_inode_operations = {
+const struct inode_operations ubifs_symlink_inode_operations = {
        .readlink    = generic_readlink,
        .follow_link = ubifs_follow_link,
        .setattr     = ubifs_setattr,
        .getattr     = ubifs_getattr,
 };
 
-struct file_operations ubifs_file_operations = {
+const struct file_operations ubifs_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = do_sync_read,
        .write          = do_sync_write,
index 9832f9abe28e08af3c444f03bb31b9bc0f84f3db..a711d33b3d3e1434f27dc763983200886155e9fd 100644 (file)
  * to be reused. Garbage collection will cause the number of dirty index nodes
  * to grow, however sufficient space is reserved for the index to ensure the
  * commit will never run out of space.
+ *
+ * Notes about dead watermark. At current UBIFS implementation we assume that
+ * LEBs which have less than @c->dead_wm bytes of free + dirty space are full
+ * and not worth garbage-collecting. The dead watermark is one min. I/O unit
+ * size, or min. UBIFS node size, depending on what is greater. Indeed, UBIFS
+ * Garbage Collector has to synchronize the GC head's write buffer before
+ * returning, so this is about wasting one min. I/O unit. However, UBIFS GC can
+ * actually reclaim even very small pieces of dirty space by garbage collecting
+ * enough dirty LEBs, but we do not bother doing this at this implementation.
+ *
+ * Notes about dark watermark. The results of GC work depends on how big are
+ * the UBIFS nodes GC deals with. Large nodes make GC waste more space. Indeed,
+ * if GC move data from LEB A to LEB B and nodes in LEB A are large, GC would
+ * have to waste large pieces of free space at the end of LEB B, because nodes
+ * from LEB A would not fit. And the worst situation is when all nodes are of
+ * maximum size. So dark watermark is the amount of free + dirty space in LEB
+ * which are guaranteed to be reclaimable. If LEB has less space, the GC migh
+ * be unable to reclaim it. So, LEBs with free + dirty greater than dark
+ * watermark are "good" LEBs from GC's point of few. The other LEBs are not so
+ * good, and GC takes extra care when moving them.
  */
 
 #include <linux/pagemap.h>
@@ -381,7 +401,7 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp)
 
                /*
                 * Don't release the LEB until after the next commit, because
-                * it may contain date which is needed for recovery. So
+                * it may contain data which is needed for recovery. So
                 * although we freed this LEB, it will become usable only after
                 * the commit.
                 */
@@ -810,8 +830,9 @@ out:
  * ubifs_destroy_idx_gc - destroy idx_gc list.
  * @c: UBIFS file-system description object
  *
- * This function destroys the idx_gc list. It is called when unmounting or
- * remounting read-only so locks are not needed.
+ * This function destroys the @c->idx_gc list. It is called when unmounting
+ * so locks are not needed. Returns zero in case of success and a negative
+ * error code in case of failure.
  */
 void ubifs_destroy_idx_gc(struct ubifs_info *c)
 {
@@ -824,7 +845,6 @@ void ubifs_destroy_idx_gc(struct ubifs_info *c)
                list_del(&idx_gc->list);
                kfree(idx_gc);
        }
-
 }
 
 /**
index 01682713af69e9e4f20b9648cfc4f74380da2da8..e8e632a1dcdf1ea52834bf4a0441108d72e6a4a4 100644 (file)
@@ -29,7 +29,7 @@
  * would have been wasted for padding to the nearest minimal I/O unit boundary.
  * Instead, data first goes to the write-buffer and is flushed when the
  * buffer is full or when it is not used for some time (by timer). This is
- * similarto the mechanism is used by JFFS2.
+ * similar to the mechanism is used by JFFS2.
  *
  * Write-buffers are defined by 'struct ubifs_wbuf' objects and protected by
  * mutexes defined inside these objects. Since sometimes upper-level code
@@ -75,7 +75,7 @@ void ubifs_ro_mode(struct ubifs_info *c, int err)
  * @lnum: logical eraseblock number
  * @offs: offset within the logical eraseblock
  * @quiet: print no messages
- * @chk_crc: indicates whether to always check the CRC
+ * @must_chk_crc: indicates whether to always check the CRC
  *
  * This function checks node magic number and CRC checksum. This function also
  * validates node length to prevent UBIFS from becoming crazy when an attacker
@@ -83,11 +83,17 @@ void ubifs_ro_mode(struct ubifs_info *c, int err)
  * node length in the common header could cause UBIFS to read memory outside of
  * allocated buffer when checking the CRC checksum.
  *
- * This function returns zero in case of success %-EUCLEAN in case of bad CRC
- * or magic.
+ * This function may skip data nodes CRC checking if @c->no_chk_data_crc is
+ * true, which is controlled by corresponding UBIFS mount option. However, if
+ * @must_chk_crc is true, then @c->no_chk_data_crc is ignored and CRC is
+ * checked. Similarly, if @c->always_chk_crc is true, @c->no_chk_data_crc is
+ * ignored and CRC is checked.
+ *
+ * This function returns zero in case of success and %-EUCLEAN in case of bad
+ * CRC or magic.
  */
 int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
-                    int offs, int quiet, int chk_crc)
+                    int offs, int quiet, int must_chk_crc)
 {
        int err = -EINVAL, type, node_len;
        uint32_t crc, node_crc, magic;
@@ -123,9 +129,9 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
                   node_len > c->ranges[type].max_len)
                goto out_len;
 
-       if (!chk_crc && type == UBIFS_DATA_NODE && !c->always_chk_crc)
-               if (c->no_chk_data_crc)
-                       return 0;
+       if (!must_chk_crc && type == UBIFS_DATA_NODE && !c->always_chk_crc &&
+            c->no_chk_data_crc)
+               return 0;
 
        crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8);
        node_crc = le32_to_cpu(ch->crc);
index 9b7c54e0cd2ae0379bba6045d0a340a7d10bf1fd..a11ca0958a238b254cf7e8e29cda17f342cf2fc3 100644 (file)
@@ -208,7 +208,7 @@ again:
        offs = 0;
 
 out:
-       err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, UBI_SHORTTERM);
+       err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, wbuf->dtype);
        if (err)
                goto out_unlock;
 
index dfd2bcece27a865de970f3d4333468c5ebb5db66..4cdd284dea5688eddf40d21eeb5f70a83e2724b9 100644 (file)
@@ -635,10 +635,10 @@ const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c,
  * @c: UBIFS file-system description object
  * @st: return statistics
  */
-void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *st)
+void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *lst)
 {
        spin_lock(&c->space_lock);
-       memcpy(st, &c->lst, sizeof(struct ubifs_lp_stats));
+       memcpy(lst, &c->lst, sizeof(struct ubifs_lp_stats));
        spin_unlock(&c->space_lock);
 }
 
@@ -678,6 +678,9 @@ int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int free, int dirty,
 
 out:
        ubifs_release_lprops(c);
+       if (err)
+               ubifs_err("cannot change properties of LEB %d, error %d",
+                         lnum, err);
        return err;
 }
 
@@ -714,6 +717,9 @@ int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int free, int dirty,
 
 out:
        ubifs_release_lprops(c);
+       if (err)
+               ubifs_err("cannot update properties of LEB %d, error %d",
+                         lnum, err);
        return err;
 }
 
@@ -737,6 +743,8 @@ int ubifs_read_one_lp(struct ubifs_info *c, int lnum, struct ubifs_lprops *lp)
        lpp = ubifs_lpt_lookup(c, lnum);
        if (IS_ERR(lpp)) {
                err = PTR_ERR(lpp);
+               ubifs_err("cannot read properties of LEB %d, error %d",
+                         lnum, err);
                goto out;
        }
 
index 96ca957071754067f7aeddf5dcecc2b0a2b12116..3216a1f277f8940799e090cf50ff0c6bb566352c 100644 (file)
@@ -556,23 +556,23 @@ no_space:
 }
 
 /**
- * next_pnode - find next pnode.
+ * next_pnode_to_dirty - find next pnode to dirty.
  * @c: UBIFS file-system description object
  * @pnode: pnode
  *
- * This function returns the next pnode or %NULL if there are no more pnodes.
+ * This function returns the next pnode to dirty or %NULL if there are no more
+ * pnodes.  Note that pnodes that have never been written (lnum == 0) are
+ * skipped.
  */
-static struct ubifs_pnode *next_pnode(struct ubifs_info *c,
-                                     struct ubifs_pnode *pnode)
+static struct ubifs_pnode *next_pnode_to_dirty(struct ubifs_info *c,
+                                              struct ubifs_pnode *pnode)
 {
        struct ubifs_nnode *nnode;
        int iip;
 
        /* Try to go right */
        nnode = pnode->parent;
-       iip = pnode->iip + 1;
-       if (iip < UBIFS_LPT_FANOUT) {
-               /* We assume here that LEB zero is never an LPT LEB */
+       for (iip = pnode->iip + 1; iip < UBIFS_LPT_FANOUT; iip++) {
                if (nnode->nbranch[iip].lnum)
                        return ubifs_get_pnode(c, nnode, iip);
        }
@@ -583,8 +583,11 @@ static struct ubifs_pnode *next_pnode(struct ubifs_info *c,
                nnode = nnode->parent;
                if (!nnode)
                        return NULL;
-               /* We assume here that LEB zero is never an LPT LEB */
-       } while (iip >= UBIFS_LPT_FANOUT || !nnode->nbranch[iip].lnum);
+               for (; iip < UBIFS_LPT_FANOUT; iip++) {
+                       if (nnode->nbranch[iip].lnum)
+                               break;
+               }
+       } while (iip >= UBIFS_LPT_FANOUT);
 
        /* Go right */
        nnode = ubifs_get_nnode(c, nnode, iip);
@@ -593,12 +596,29 @@ static struct ubifs_pnode *next_pnode(struct ubifs_info *c,
 
        /* Go down to level 1 */
        while (nnode->level > 1) {
-               nnode = ubifs_get_nnode(c, nnode, 0);
+               for (iip = 0; iip < UBIFS_LPT_FANOUT; iip++) {
+                       if (nnode->nbranch[iip].lnum)
+                               break;
+               }
+               if (iip >= UBIFS_LPT_FANOUT) {
+                       /*
+                        * Should not happen, but we need to keep going
+                        * if it does.
+                        */
+                       iip = 0;
+               }
+               nnode = ubifs_get_nnode(c, nnode, iip);
                if (IS_ERR(nnode))
                        return (void *)nnode;
        }
 
-       return ubifs_get_pnode(c, nnode, 0);
+       for (iip = 0; iip < UBIFS_LPT_FANOUT; iip++)
+               if (nnode->nbranch[iip].lnum)
+                       break;
+       if (iip >= UBIFS_LPT_FANOUT)
+               /* Should not happen, but we need to keep going if it does */
+               iip = 0;
+       return ubifs_get_pnode(c, nnode, iip);
 }
 
 /**
@@ -688,7 +708,7 @@ static int make_tree_dirty(struct ubifs_info *c)
        pnode = pnode_lookup(c, 0);
        while (pnode) {
                do_make_pnode_dirty(c, pnode);
-               pnode = next_pnode(c, pnode);
+               pnode = next_pnode_to_dirty(c, pnode);
                if (IS_ERR(pnode))
                        return PTR_ERR(pnode);
        }
index 71d5493bf565a3252f2a266eee74594968735188..a88f33801b989aa7316e6ab99e7629cddd9dfb67 100644 (file)
@@ -354,7 +354,7 @@ int ubifs_write_master(struct ubifs_info *c)
        int err, lnum, offs, len;
 
        if (c->ro_media)
-               return -EINVAL;
+               return -EROFS;
 
        lnum = UBIFS_MST_LNUM;
        offs = c->mst_offs + c->mst_node_alsz;
index 9e6f403f170e4425641c5db8b833db9f63c3ce7b..152a7b34a1414658d217f3604e61e10ea9e2c799 100644 (file)
@@ -46,7 +46,7 @@
  * Orphans are accumulated in a rb-tree. When an inode's link count drops to
  * zero, the inode number is added to the rb-tree. It is removed from the tree
  * when the inode is deleted.  Any new orphans that are in the orphan tree when
- * the commit is run, are written to the orphan area in 1 or more orph nodes.
+ * the commit is run, are written to the orphan area in 1 or more orphan nodes.
  * If the orphan area is full, it is consolidated to make space.  There is
  * always enough space because validation prevents the user from creating more
  * than the maximum number of orphans allowed.
@@ -231,7 +231,7 @@ static int tot_avail_orphs(struct ubifs_info *c)
 }
 
 /**
- * do_write_orph_node - write a node
+ * do_write_orph_node - write a node to the orphan head.
  * @c: UBIFS file-system description object
  * @len: length of node
  * @atomic: write atomically
@@ -264,11 +264,11 @@ static int do_write_orph_node(struct ubifs_info *c, int len, int atomic)
 }
 
 /**
- * write_orph_node - write an orph node
+ * write_orph_node - write an orphan node.
  * @c: UBIFS file-system description object
  * @atomic: write atomically
  *
- * This function builds an orph node from the cnext list and writes it to the
+ * This function builds an orphan node from the cnext list and writes it to the
  * orphan head. On success, %0 is returned, otherwise a negative error code
  * is returned.
  */
@@ -326,11 +326,11 @@ static int write_orph_node(struct ubifs_info *c, int atomic)
 }
 
 /**
- * write_orph_nodes - write orph nodes until there are no more to commit
+ * write_orph_nodes - write orphan nodes until there are no more to commit.
  * @c: UBIFS file-system description object
  * @atomic: write atomically
  *
- * This function writes orph nodes for all the orphans to commit. On success,
+ * This function writes orphan nodes for all the orphans to commit. On success,
  * %0 is returned, otherwise a negative error code is returned.
  */
 static int write_orph_nodes(struct ubifs_info *c, int atomic)
@@ -478,14 +478,14 @@ int ubifs_orphan_end_commit(struct ubifs_info *c)
 }
 
 /**
- * clear_orphans - erase all LEBs used for orphans.
+ * ubifs_clear_orphans - erase all LEBs used for orphans.
  * @c: UBIFS file-system description object
  *
  * If recovery is not required, then the orphans from the previous session
  * are not needed. This function locates the LEBs used to record
  * orphans, and un-maps them.
  */
-static int clear_orphans(struct ubifs_info *c)
+int ubifs_clear_orphans(struct ubifs_info *c)
 {
        int lnum, err;
 
@@ -547,9 +547,9 @@ static int insert_dead_orphan(struct ubifs_info *c, ino_t inum)
  * do_kill_orphans - remove orphan inodes from the index.
  * @c: UBIFS file-system description object
  * @sleb: scanned LEB
- * @last_cmt_no: cmt_no of last orph node read is passed and returned here
+ * @last_cmt_no: cmt_no of last orphan node read is passed and returned here
  * @outofdate: whether the LEB is out of date is returned here
- * @last_flagged: whether the end orph node is encountered
+ * @last_flagged: whether the end orphan node is encountered
  *
  * This function is a helper to the 'kill_orphans()' function. It goes through
  * every orphan node in a LEB and for every inode number recorded, removes
@@ -580,8 +580,8 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
                /*
                 * The commit number on the master node may be less, because
                 * of a failed commit. If there are several failed commits in a
-                * row, the commit number written on orph nodes will continue to
-                * increase (because the commit number is adjusted here) even
+                * row, the commit number written on orphan nodes will continue
+                * to increase (because the commit number is adjusted here) even
                 * though the commit number on the master node stays the same
                 * because the master node has not been re-written.
                 */
@@ -589,9 +589,9 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
                        c->cmt_no = cmt_no;
                if (cmt_no < *last_cmt_no && *last_flagged) {
                        /*
-                        * The last orph node had a higher commit number and was
-                        * flagged as the last written for that commit number.
-                        * That makes this orph node, out of date.
+                        * The last orphan node had a higher commit number and
+                        * was flagged as the last written for that commit
+                        * number. That makes this orphan node, out of date.
                         */
                        if (!first) {
                                ubifs_err("out of order commit number %llu in "
@@ -658,10 +658,10 @@ static int kill_orphans(struct ubifs_info *c)
        /*
         * Orph nodes always start at c->orph_first and are written to each
         * successive LEB in turn. Generally unused LEBs will have been unmapped
-        * but may contain out of date orph nodes if the unmap didn't go
-        * through. In addition, the last orph node written for each commit is
+        * but may contain out of date orphan nodes if the unmap didn't go
+        * through. In addition, the last orphan node written for each commit is
         * marked (top bit of orph->cmt_no is set to 1). It is possible that
-        * there are orph nodes from the next commit (i.e. the commit did not
+        * there are orphan nodes from the next commit (i.e. the commit did not
         * complete successfully). In that case, no orphans will have been lost
         * due to the way that orphans are written, and any orphans added will
         * be valid orphans anyway and so can be deleted.
@@ -718,7 +718,7 @@ int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only)
        if (unclean)
                err = kill_orphans(c);
        else if (!read_only)
-               err = clear_orphans(c);
+               err = ubifs_clear_orphans(c);
 
        return err;
 }
index 89556ee725185936d63c06f9fd9813f783a1f5b4..1182b66a5491443ac725504ec3bd7e3bf0b0dc30 100644 (file)
@@ -397,6 +397,7 @@ static int ubifs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_namelen = UBIFS_MAX_NLEN;
        buf->f_fsid.val[0] = le32_to_cpu(uuid[0]) ^ le32_to_cpu(uuid[2]);
        buf->f_fsid.val[1] = le32_to_cpu(uuid[1]) ^ le32_to_cpu(uuid[3]);
+       ubifs_assert(buf->f_bfree <= c->block_cnt);
        return 0;
 }
 
@@ -432,32 +433,23 @@ static int ubifs_sync_fs(struct super_block *sb, int wait)
        int i, err;
        struct ubifs_info *c = sb->s_fs_info;
        struct writeback_control wbc = {
-               .sync_mode   = wait ? WB_SYNC_ALL : WB_SYNC_NONE,
+               .sync_mode   = WB_SYNC_ALL,
                .range_start = 0,
                .range_end   = LLONG_MAX,
                .nr_to_write = LONG_MAX,
        };
 
        /*
-        * Note by akpm about WB_SYNC_NONE used above: zero @wait is just an
-        * advisory thing to help the file system shove lots of data into the
-        * queues. If some gets missed then it'll be picked up on the second
+        * Zero @wait is just an advisory thing to help the file system shove
+        * lots of data into the queues, and there will be the second
         * '->sync_fs()' call, with non-zero @wait.
         */
+       if (!wait)
+               return 0;
 
        if (sb->s_flags & MS_RDONLY)
                return 0;
 
-       /*
-        * Synchronize write buffers, because 'ubifs_run_commit()' does not
-        * do this if it waits for an already running commit.
-        */
-       for (i = 0; i < c->jhead_cnt; i++) {
-               err = ubifs_wbuf_sync(&c->jheads[i].wbuf);
-               if (err)
-                       return err;
-       }
-
        /*
         * VFS calls '->sync_fs()' before synchronizing all dirty inodes and
         * pages, so synchronize them first, then commit the journal. Strictly
@@ -469,6 +461,16 @@ static int ubifs_sync_fs(struct super_block *sb, int wait)
         */
        generic_sync_sb_inodes(sb, &wbc);
 
+       /*
+        * Synchronize write buffers, because 'ubifs_run_commit()' does not
+        * do this if it waits for an already running commit.
+        */
+       for (i = 0; i < c->jhead_cnt; i++) {
+               err = ubifs_wbuf_sync(&c->jheads[i].wbuf);
+               if (err)
+                       return err;
+       }
+
        err = ubifs_run_commit(c);
        if (err)
                return err;
@@ -572,15 +574,8 @@ static int init_constants_early(struct ubifs_info *c)
        c->ranges[UBIFS_IDX_NODE].max_len = INT_MAX;
 
        /*
-        * Initialize dead and dark LEB space watermarks.
-        *
-        * Dead space is the space which cannot be used. Its watermark is
-        * equivalent to min. I/O unit or minimum node size if it is greater
-        * then min. I/O unit.
-        *
-        * Dark space is the space which might be used, or might not, depending
-        * on which node should be written to the LEB. Its watermark is
-        * equivalent to maximum UBIFS node size.
+        * Initialize dead and dark LEB space watermarks. See gc.c for comments
+        * about these values.
         */
        c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size);
        c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size);
@@ -741,12 +736,12 @@ static void init_constants_master(struct ubifs_info *c)
  * take_gc_lnum - reserve GC LEB.
  * @c: UBIFS file-system description object
  *
- * This function ensures that the LEB reserved for garbage collection is
- * unmapped and is marked as "taken" in lprops. We also have to set free space
- * to LEB size and dirty space to zero, because lprops may contain out-of-date
- * information if the file-system was un-mounted before it has been committed.
- * This function returns zero in case of success and a negative error code in
- * case of failure.
+ * This function ensures that the LEB reserved for garbage collection is marked
+ * as "taken" in lprops. We also have to set free space to LEB size and dirty
+ * space to zero, because lprops may contain out-of-date information if the
+ * file-system was un-mounted before it has been committed. This function
+ * returns zero in case of success and a negative error code in case of
+ * failure.
  */
 static int take_gc_lnum(struct ubifs_info *c)
 {
@@ -757,10 +752,6 @@ static int take_gc_lnum(struct ubifs_info *c)
                return -EINVAL;
        }
 
-       err = ubifs_leb_unmap(c, c->gc_lnum);
-       if (err)
-               return err;
-
        /* And we have to tell lprops that this LEB is taken */
        err = ubifs_change_one_lp(c, c->gc_lnum, c->leb_size, 0,
                                  LPROPS_TAKEN, 0, 0);
@@ -966,13 +957,16 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
 
                token = match_token(p, tokens, args);
                switch (token) {
+               /*
+                * %Opt_fast_unmount and %Opt_norm_unmount options are ignored.
+                * We accepte them in order to be backware-compatible. But this
+                * should be removed at some point.
+                */
                case Opt_fast_unmount:
                        c->mount_opts.unmount_mode = 2;
-                       c->fast_unmount = 1;
                        break;
                case Opt_norm_unmount:
                        c->mount_opts.unmount_mode = 1;
-                       c->fast_unmount = 0;
                        break;
                case Opt_bulk_read:
                        c->mount_opts.bulk_read = 2;
@@ -1094,12 +1088,7 @@ static int check_free_space(struct ubifs_info *c)
                ubifs_err("insufficient free space to mount in read/write mode");
                dbg_dump_budg(c);
                dbg_dump_lprops(c);
-               /*
-                * We return %-EINVAL instead of %-ENOSPC because it seems to
-                * be the closest error code mentioned in the mount function
-                * documentation.
-                */
-               return -EINVAL;
+               return -ENOSPC;
        }
        return 0;
 }
@@ -1286,10 +1275,19 @@ static int mount_ubifs(struct ubifs_info *c)
                        if (err)
                                goto out_orphans;
                        err = ubifs_rcvry_gc_commit(c);
-               } else
+               } else {
                        err = take_gc_lnum(c);
-               if (err)
-                       goto out_orphans;
+                       if (err)
+                               goto out_orphans;
+
+                       /*
+                        * GC LEB may contain garbage if there was an unclean
+                        * reboot, and it should be un-mapped.
+                        */
+                       err = ubifs_leb_unmap(c, c->gc_lnum);
+                       if (err)
+                               return err;
+               }
 
                err = dbg_check_lprops(c);
                if (err)
@@ -1298,6 +1296,16 @@ static int mount_ubifs(struct ubifs_info *c)
                err = ubifs_recover_size(c);
                if (err)
                        goto out_orphans;
+       } else {
+               /*
+                * Even if we mount read-only, we have to set space in GC LEB
+                * to proper value because this affects UBIFS free space
+                * reporting. We do not want to have a situation when
+                * re-mounting from R/O to R/W changes amount of free space.
+                */
+               err = take_gc_lnum(c);
+               if (err)
+                       goto out_orphans;
        }
 
        spin_lock(&ubifs_infos_lock);
@@ -1310,14 +1318,17 @@ static int mount_ubifs(struct ubifs_info *c)
                else {
                        c->need_recovery = 0;
                        ubifs_msg("recovery completed");
+                       /* GC LEB has to be empty and taken at this point */
+                       ubifs_assert(c->lst.taken_empty_lebs == 1);
                }
-       }
+       } else
+               ubifs_assert(c->lst.taken_empty_lebs == 1);
 
-       err = dbg_debugfs_init_fs(c);
+       err = dbg_check_filesystem(c);
        if (err)
                goto out_infos;
 
-       err = dbg_check_filesystem(c);
+       err = dbg_debugfs_init_fs(c);
        if (err)
                goto out_infos;
 
@@ -1351,7 +1362,6 @@ static int mount_ubifs(struct ubifs_info *c)
               c->uuid[4], c->uuid[5], c->uuid[6], c->uuid[7],
               c->uuid[8], c->uuid[9], c->uuid[10], c->uuid[11],
               c->uuid[12], c->uuid[13], c->uuid[14], c->uuid[15]);
-       dbg_msg("fast unmount:        %d", c->fast_unmount);
        dbg_msg("big_lpt              %d", c->big_lpt);
        dbg_msg("log LEBs:            %d (%d - %d)",
                c->log_lebs, UBIFS_LOG_LNUM, c->log_last);
@@ -1475,10 +1485,8 @@ static int ubifs_remount_rw(struct ubifs_info *c)
 {
        int err, lnum;
 
-       if (c->ro_media)
-               return -EINVAL;
-
        mutex_lock(&c->umount_mutex);
+       dbg_save_space_info(c);
        c->remounting_rw = 1;
        c->always_chk_crc = 1;
 
@@ -1514,6 +1522,12 @@ static int ubifs_remount_rw(struct ubifs_info *c)
                err = ubifs_recover_inl_heads(c, c->sbuf);
                if (err)
                        goto out;
+       } else {
+               /* A readonly mount is not allowed to have orphans */
+               ubifs_assert(c->tot_orphans == 0);
+               err = ubifs_clear_orphans(c);
+               if (err)
+                       goto out;
        }
 
        if (!(c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY))) {
@@ -1569,7 +1583,7 @@ static int ubifs_remount_rw(struct ubifs_info *c)
        if (c->need_recovery)
                err = ubifs_rcvry_gc_commit(c);
        else
-               err = take_gc_lnum(c);
+               err = ubifs_leb_unmap(c, c->gc_lnum);
        if (err)
                goto out;
 
@@ -1582,8 +1596,9 @@ static int ubifs_remount_rw(struct ubifs_info *c)
        c->vfs_sb->s_flags &= ~MS_RDONLY;
        c->remounting_rw = 0;
        c->always_chk_crc = 0;
+       err = dbg_check_space_info(c);
        mutex_unlock(&c->umount_mutex);
-       return 0;
+       return err;
 
 out:
        vfree(c->orph_buf);
@@ -1602,44 +1617,19 @@ out:
        return err;
 }
 
-/**
- * commit_on_unmount - commit the journal when un-mounting.
- * @c: UBIFS file-system description object
- *
- * This function is called during un-mounting and re-mounting, and it commits
- * the journal unless the "fast unmount" mode is enabled.
- */
-static void commit_on_unmount(struct ubifs_info *c)
-{
-       struct super_block *sb = c->vfs_sb;
-       long long bud_bytes;
-
-       /*
-        * This function is called before the background thread is stopped, so
-        * we may race with ongoing commit, which means we have to take
-        * @c->bud_lock to access @c->bud_bytes.
-        */
-       spin_lock(&c->buds_lock);
-       bud_bytes = c->bud_bytes;
-       spin_unlock(&c->buds_lock);
-
-       if (!c->fast_unmount && !(sb->s_flags & MS_RDONLY) && bud_bytes)
-               ubifs_run_commit(c);
-}
-
 /**
  * ubifs_remount_ro - re-mount in read-only mode.
  * @c: UBIFS file-system description object
  *
- * We rely on VFS to have stopped writing. Possibly the background thread could
- * be running a commit, however kthread_stop will wait in that case.
+ * We assume VFS has stopped writing. Possibly the background thread could be
+ * running a commit, however kthread_stop will wait in that case.
  */
 static void ubifs_remount_ro(struct ubifs_info *c)
 {
        int i, err;
 
        ubifs_assert(!c->need_recovery);
-       commit_on_unmount(c);
+       ubifs_assert(!(c->vfs_sb->s_flags & MS_RDONLY));
 
        mutex_lock(&c->umount_mutex);
        if (c->bgt) {
@@ -1647,27 +1637,29 @@ static void ubifs_remount_ro(struct ubifs_info *c)
                c->bgt = NULL;
        }
 
+       dbg_save_space_info(c);
+
        for (i = 0; i < c->jhead_cnt; i++) {
                ubifs_wbuf_sync(&c->jheads[i].wbuf);
                del_timer_sync(&c->jheads[i].wbuf.timer);
        }
 
-       if (!c->ro_media) {
-               c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY);
-               c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS);
-               c->mst_node->gc_lnum = cpu_to_le32(c->gc_lnum);
-               err = ubifs_write_master(c);
-               if (err)
-                       ubifs_ro_mode(c, err);
-       }
+       c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY);
+       c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS);
+       c->mst_node->gc_lnum = cpu_to_le32(c->gc_lnum);
+       err = ubifs_write_master(c);
+       if (err)
+               ubifs_ro_mode(c, err);
 
-       ubifs_destroy_idx_gc(c);
        free_wbufs(c);
        vfree(c->orph_buf);
        c->orph_buf = NULL;
        vfree(c->ileb_buf);
        c->ileb_buf = NULL;
        ubifs_lpt_free(c, 1);
+       err = dbg_check_space_info(c);
+       if (err)
+               ubifs_ro_mode(c, err);
        mutex_unlock(&c->umount_mutex);
 }
 
@@ -1760,11 +1752,20 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
        }
 
        if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
+               if (c->ro_media) {
+                       ubifs_msg("cannot re-mount due to prior errors");
+                       return -EROFS;
+               }
                err = ubifs_remount_rw(c);
                if (err)
                        return err;
-       } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY))
+       } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) {
+               if (c->ro_media) {
+                       ubifs_msg("cannot re-mount due to prior errors");
+                       return -EROFS;
+               }
                ubifs_remount_ro(c);
+       }
 
        if (c->bulk_read == 1)
                bu_init(c);
@@ -1774,10 +1775,11 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
                c->bu.buf = NULL;
        }
 
+       ubifs_assert(c->lst.taken_empty_lebs == 1);
        return 0;
 }
 
-struct super_operations ubifs_super_operations = {
+const struct super_operations ubifs_super_operations = {
        .alloc_inode   = ubifs_alloc_inode,
        .destroy_inode = ubifs_destroy_inode,
        .put_super     = ubifs_put_super,
@@ -2044,15 +2046,6 @@ out_close:
 
 static void ubifs_kill_sb(struct super_block *sb)
 {
-       struct ubifs_info *c = sb->s_fs_info;
-
-       /*
-        * We do 'commit_on_unmount()' here instead of 'ubifs_put_super()'
-        * in order to be outside BKL.
-        */
-       if (sb->s_root)
-               commit_on_unmount(c);
-       /* The un-mount routine is actually done in put_super() */
        generic_shutdown_super(sb);
 }
 
index f7e36f5455275e3e125b551b49b32448dd6f9188..fa28a84c6a1b4a9d0f3cf5dfdb9f8fadd36e10da 100644 (file)
@@ -443,6 +443,11 @@ static int tnc_read_node_nm(struct ubifs_info *c, struct ubifs_zbranch *zbr,
  * This function performs that same function as ubifs_read_node except that
  * it does not require that there is actually a node present and instead
  * the return code indicates if a node was read.
+ *
+ * Note, this function does not check CRC of data nodes if @c->no_chk_data_crc
+ * is true (it is controlled by corresponding mount option). However, if
+ * @c->always_chk_crc is true, @c->no_chk_data_crc is ignored and CRC is always
+ * checked.
  */
 static int try_read_node(const struct ubifs_info *c, void *buf, int type,
                         int len, int lnum, int offs)
@@ -470,9 +475,8 @@ static int try_read_node(const struct ubifs_info *c, void *buf, int type,
        if (node_len != len)
                return 0;
 
-       if (type == UBIFS_DATA_NODE && !c->always_chk_crc)
-               if (c->no_chk_data_crc)
-                       return 0;
+       if (type == UBIFS_DATA_NODE && !c->always_chk_crc && c->no_chk_data_crc)
+               return 1;
 
        crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8);
        node_crc = le32_to_cpu(ch->crc);
@@ -1506,7 +1510,7 @@ out:
  *
  * Note, if the bulk-read buffer length (@bu->buf_len) is known, this function
  * makes sure bulk-read nodes fit the buffer. Otherwise, this function prepares
- * maxumum possible amount of nodes for bulk-read.
+ * maximum possible amount of nodes for bulk-read.
  */
 int ubifs_tnc_get_bu_keys(struct ubifs_info *c, struct bu_info *bu)
 {
index fc2a4cc66d03c75429a14de807c4fcf8d48a7cce..039a68bee29accc639034936c64cde4bbece9ad5 100644 (file)
@@ -426,9 +426,9 @@ struct ubifs_unclean_leb {
  * LEB properties flags.
  *
  * LPROPS_UNCAT: not categorized
- * LPROPS_DIRTY: dirty > 0, not index
+ * LPROPS_DIRTY: dirty > free, dirty >= @c->dead_wm, not index
  * LPROPS_DIRTY_IDX: dirty + free > @c->min_idx_node_sze and index
- * LPROPS_FREE: free > 0, not empty, not index
+ * LPROPS_FREE: free > 0, dirty < @c->dead_wm, not empty, not index
  * LPROPS_HEAP_CNT: number of heaps used for storing categorized LEBs
  * LPROPS_EMPTY: LEB is empty, not taken
  * LPROPS_FREEABLE: free + dirty == leb_size, not index, not taken
@@ -961,7 +961,6 @@ struct ubifs_debug_info;
  * @cs_lock: commit state lock
  * @cmt_wq: wait queue to sleep on if the log is full and a commit is running
  *
- * @fast_unmount: do not run journal commit before un-mounting
  * @big_lpt: flag that LPT is too big to write whole during commit
  * @no_chk_data_crc: do not check CRCs when reading data nodes (except during
  *                   recovery)
@@ -1202,7 +1201,6 @@ struct ubifs_info {
        spinlock_t cs_lock;
        wait_queue_head_t cmt_wq;
 
-       unsigned int fast_unmount:1;
        unsigned int big_lpt:1;
        unsigned int no_chk_data_crc:1;
        unsigned int bulk_read:1;
@@ -1405,13 +1403,13 @@ extern struct list_head ubifs_infos;
 extern spinlock_t ubifs_infos_lock;
 extern atomic_long_t ubifs_clean_zn_cnt;
 extern struct kmem_cache *ubifs_inode_slab;
-extern struct super_operations ubifs_super_operations;
-extern struct address_space_operations ubifs_file_address_operations;
-extern struct file_operations ubifs_file_operations;
-extern struct inode_operations ubifs_file_inode_operations;
-extern struct file_operations ubifs_dir_operations;
-extern struct inode_operations ubifs_dir_inode_operations;
-extern struct inode_operations ubifs_symlink_inode_operations;
+extern const struct super_operations ubifs_super_operations;
+extern const struct address_space_operations ubifs_file_address_operations;
+extern const struct file_operations ubifs_file_operations;
+extern const struct inode_operations ubifs_file_inode_operations;
+extern const struct file_operations ubifs_dir_operations;
+extern const struct inode_operations ubifs_dir_inode_operations;
+extern const struct inode_operations ubifs_symlink_inode_operations;
 extern struct backing_dev_info ubifs_backing_dev_info;
 extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
 
@@ -1428,7 +1426,7 @@ int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len,
 int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum,
                     int offs, int dtype);
 int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
-                    int offs, int quiet, int chk_crc);
+                    int offs, int quiet, int must_chk_crc);
 void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad);
 void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last);
 int ubifs_io_init(struct ubifs_info *c);
@@ -1495,6 +1493,7 @@ void ubifs_release_ino_dirty(struct ubifs_info *c, struct inode *inode,
 void ubifs_cancel_ino_op(struct ubifs_info *c, struct inode *inode,
                         struct ubifs_budget_req *req);
 long long ubifs_get_free_space(struct ubifs_info *c);
+long long ubifs_get_free_space_nolock(struct ubifs_info *c);
 int ubifs_calc_min_idx_lebs(struct ubifs_info *c);
 void ubifs_convert_page_budget(struct ubifs_info *c);
 long long ubifs_reported_space(const struct ubifs_info *c, long long free);
@@ -1603,6 +1602,7 @@ void ubifs_delete_orphan(struct ubifs_info *c, ino_t inum);
 int ubifs_orphan_start_commit(struct ubifs_info *c);
 int ubifs_orphan_end_commit(struct ubifs_info *c);
 int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only);
+int ubifs_clear_orphans(struct ubifs_info *c);
 
 /* lpt.c */
 int ubifs_calc_lpt_geom(struct ubifs_info *c);
@@ -1646,7 +1646,7 @@ const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c,
                                           const struct ubifs_lprops *lp,
                                           int free, int dirty, int flags,
                                           int idx_gc_cnt);
-void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *stats);
+void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *lst);
 void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops,
                      int cat);
 void ubifs_replace_cat(struct ubifs_info *c, struct ubifs_lprops *old_lprops,
index 2ed035354c26aab0b40cbd85c83df7b5bb36cd84..a608e72fa4054c3892bfc45b17e0343d21fd31ce 100644 (file)
@@ -371,7 +371,11 @@ xfs_quiesce_attr(
        /* flush inodes and push all remaining buffers out to disk */
        xfs_quiesce_fs(mp);
 
-       ASSERT_ALWAYS(atomic_read(&mp->m_active_trans) == 0);
+       /*
+        * Just warn here till VFS can correctly support
+        * read-only remount without racing.
+        */
+       WARN_ON(atomic_read(&mp->m_active_trans) != 0);
 
        /* Push the superblock and write an unmount record */
        error = xfs_log_sbcount(mp, 1);
index b4c1ee713492315f03f097ec66611c6f0b602d31..f8278cfcc1d328a1a9542663d448607de1c5f561 100644 (file)
@@ -55,17 +55,11 @@ xfs_swapext(
        struct file     *file, *target_file;
        int             error = 0;
 
-       sxp = kmem_alloc(sizeof(xfs_swapext_t), KM_MAYFAIL);
-       if (!sxp) {
-               error = XFS_ERROR(ENOMEM);
-               goto out;
-       }
-
        /* Pull information for the target fd */
        file = fget((int)sxp->sx_fdtarget);
        if (!file) {
                error = XFS_ERROR(EINVAL);
-               goto out_free_sxp;
+               goto out;
        }
 
        if (!(file->f_mode & FMODE_WRITE) || (file->f_flags & O_APPEND)) {
@@ -109,8 +103,6 @@ xfs_swapext(
        fput(target_file);
  out_put_file:
        fput(file);
- out_free_sxp:
-       kmem_free(sxp);
  out:
        return error;
 }
index 35cca98bd94c90c926dd3db7ae49974661577a4c..b1047de2fffd5a66d465c9bdff399b82205cf596 100644 (file)
@@ -70,16 +70,21 @@ STATIC void xlog_recover_check_summary(xlog_t *);
 xfs_buf_t *
 xlog_get_bp(
        xlog_t          *log,
-       int             num_bblks)
+       int             nbblks)
 {
-       ASSERT(num_bblks > 0);
+       if (nbblks <= 0 || nbblks > log->l_logBBsize) {
+               xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks);
+               XFS_ERROR_REPORT("xlog_get_bp(1)",
+                                XFS_ERRLEVEL_HIGH, log->l_mp);
+               return NULL;
+       }
 
        if (log->l_sectbb_log) {
-               if (num_bblks > 1)
-                       num_bblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1);
-               num_bblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, num_bblks);
+               if (nbblks > 1)
+                       nbblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1);
+               nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
        }
-       return xfs_buf_get_noaddr(BBTOB(num_bblks), log->l_mp->m_logdev_targp);
+       return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp);
 }
 
 void
@@ -102,6 +107,13 @@ xlog_bread(
 {
        int             error;
 
+       if (nbblks <= 0 || nbblks > log->l_logBBsize) {
+               xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks);
+               XFS_ERROR_REPORT("xlog_bread(1)",
+                                XFS_ERRLEVEL_HIGH, log->l_mp);
+               return EFSCORRUPTED;
+       }
+
        if (log->l_sectbb_log) {
                blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
                nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
@@ -139,6 +151,13 @@ xlog_bwrite(
 {
        int             error;
 
+       if (nbblks <= 0 || nbblks > log->l_logBBsize) {
+               xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks);
+               XFS_ERROR_REPORT("xlog_bwrite(1)",
+                                XFS_ERRLEVEL_HIGH, log->l_mp);
+               return EFSCORRUPTED;
+       }
+
        if (log->l_sectbb_log) {
                blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
                nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
index e72bfdd887f9b285ccbb3530be8096d61aeb74a8..552637b0d051d2677818e4e8f841fe9f1499ee64 100644 (file)
@@ -14,6 +14,7 @@
 #define ACPI_PDC_SMP_T_SWCOORD         (0x0080)
 #define ACPI_PDC_C_C1_FFH              (0x0100)
 #define ACPI_PDC_C_C2C3_FFH            (0x0200)
+#define ACPI_PDC_SMP_P_HWCOORD         (0x0800)
 
 #define ACPI_PDC_EST_CAPABILITY_SMP    (ACPI_PDC_SMP_C1PT | \
                                         ACPI_PDC_C_C1_HALT | \
@@ -22,6 +23,7 @@
 #define ACPI_PDC_EST_CAPABILITY_SWSMP  (ACPI_PDC_SMP_C1PT | \
                                         ACPI_PDC_C_C1_HALT | \
                                         ACPI_PDC_SMP_P_SWCOORD | \
+                                        ACPI_PDC_SMP_P_HWCOORD | \
                                         ACPI_PDC_P_FFH)
 
 #define ACPI_PDC_C_CAPABILITY_SMP      (ACPI_PDC_SMP_C2C3  | \
index 12e9a2957caf4ccbd4fb3e2e694fe479218a2e98..b97cdc516a8fcb078e29f1b2745db7f6040a880a 100644 (file)
@@ -41,6 +41,7 @@ header-y += baycom.h
 header-y += bfs_fs.h
 header-y += blkpg.h
 header-y += bpqether.h
+header-y += bsg.h
 header-y += can.h
 header-y += cdk.h
 header-y += chio.h
@@ -89,7 +90,6 @@ header-y += if_ppp.h
 header-y += if_slip.h
 header-y += if_strip.h
 header-y += if_tun.h
-header-y += if_tunnel.h
 header-y += in_route.h
 header-y += ioctl.h
 header-y += ip6_tunnel.h
@@ -235,6 +235,7 @@ unifdef-y += if_phonet.h
 unifdef-y += if_pppol2tp.h
 unifdef-y += if_pppox.h
 unifdef-y += if_tr.h
+unifdef-y += if_tunnel.h
 unifdef-y += if_vlan.h
 unifdef-y += igmp.h
 unifdef-y += inet_diag.h
index 9e017293131542df17e57917e11d9809e6f4e49a..2c8731664180242ad95fa91cfb2b8e6d11f90b78 100644 (file)
@@ -27,6 +27,7 @@
 #ifndef __LINUX__AIO_ABI_H
 #define __LINUX__AIO_ABI_H
 
+#include <linux/types.h>
 #include <asm/byteorder.h>
 
 typedef unsigned long  aio_context_t;
index c4ecacd0b32771729e68b9b30f766ae55a42a8c6..68a9530196f299c518856e6e4926376fcc4560cf 100644 (file)
@@ -17,9 +17,11 @@ typedef u64 async_cookie_t;
 typedef void (async_func_ptr) (void *data, async_cookie_t cookie);
 
 extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data);
-extern async_cookie_t async_schedule_special(async_func_ptr *ptr, void *data, struct list_head *list);
+extern async_cookie_t async_schedule_domain(async_func_ptr *ptr, void *data,
+                                           struct list_head *list);
 extern void async_synchronize_full(void);
-extern void async_synchronize_full_special(struct list_head *list);
+extern void async_synchronize_full_domain(struct list_head *list);
 extern void async_synchronize_cookie(async_cookie_t cookie);
-extern void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *list);
+extern void async_synchronize_cookie_domain(async_cookie_t cookie,
+                                           struct list_head *list);
 
index a53318b8cbd0ea9a4b7a69f3376cb11036a5ff32..08a86d5cdf1b7ea2c6c995f1073aaa59092d9a8c 100644 (file)
@@ -731,12 +731,17 @@ static inline int ata_id_current_chs_valid(const u16 *id)
 
 static inline int ata_id_is_cfa(const u16 *id)
 {
-       if (id[ATA_ID_CONFIG] == 0x848A)        /* Standard CF */
+       if (id[ATA_ID_CONFIG] == 0x848A)        /* Traditional CF */
                return 1;
-       /* Could be CF hiding as standard ATA */
-       if (ata_id_major_version(id) >= 3 &&
-           id[ATA_ID_COMMAND_SET_1] != 0xFFFF &&
-          (id[ATA_ID_COMMAND_SET_1] & (1 << 2)))
+       /*
+        * CF specs don't require specific value in the word 0 anymore and yet
+        * they forbid to report the ATA version in the word 80 and require the
+        * CFA feature set support to be indicated in the word 83 in this case.
+        * Unfortunately, some cards only follow either of this requirements,
+        * and while those that don't indicate CFA feature support need some
+        * sort of quirk list, it seems impractical for the ones that do...
+        */
+       if ((id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004)
                return 1;
        return 0;
 }
index e9ebac2e2ecc97d4db3e73615a9ddc020c47ba6a..d34c187432ed883e6bcb498c6d9299c68e68d118 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_ATALK_H__
 #define __LINUX_ATALK_H__
 
+#include <linux/types.h>
 #include <asm/byteorder.h>
 
 /*
index 52bf72affbbae9405f8bc43066f6126cf6d39f54..fdb2629b61890b0326ef151e53eedc4bfbfad851 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _LINUX_ATMBR2684_H
 #define _LINUX_ATMBR2684_H
 
+#include <linux/types.h>
 #include <linux/atm.h>
 #include <linux/if.h>          /* For IFNAMSIZ */
 
index 55fa478bd639127e274ee8564f2779e53dfe2796..8b49ac48a5b7216550063d550440756000a83e77 100644 (file)
@@ -12,6 +12,7 @@
 #define _LINUX_AUTO_FS4_H
 
 /* Include common v3 definitions */
+#include <linux/types.h>
 #include <linux/auto_fs.h>
 
 /* autofs v4 definitions */
index 8ed6dfdcd78337f3a5b36066223c3cd2bc2ade80..1c0b355aa51548174e2b7325c62ab8664d2ae3e3 100644 (file)
@@ -6,6 +6,8 @@
 #ifndef _LINUX_BFS_FS_H
 #define _LINUX_BFS_FS_H
 
+#include <linux/types.h>
+
 #define BFS_BSIZE_BITS         9
 #define BFS_BSIZE              (1<<BFS_BSIZE_BITS)
 
@@ -17,7 +19,6 @@
 #define BFS_VDIR 2L
 #define BFS_VREG 1L
 
-
 /* BFS inode layout on disk */
 struct bfs_inode {
        __le16 i_ino;
index 18462c5b8fff91e0b4d5341dac07e4e263907690..2aa283ab062b215ddb37975d8e55193ecd502c5f 100644 (file)
@@ -144,7 +144,7 @@ struct bio {
  * bit 1 -- rw-ahead when set
  * bit 2 -- barrier
  *     Insert a serialization point in the IO queue, forcing previously
- *     submitted IO to be completed before this oen is issued.
+ *     submitted IO to be completed before this one is issued.
  * bit 3 -- synchronous I/O hint: the block layer will unplug immediately
  *     Note that this does NOT indicate that the IO itself is sync, just
  *     that the block layer will not postpone issue of this IO by plugging.
@@ -163,12 +163,33 @@ struct bio {
 #define BIO_RW         0       /* Must match RW in req flags (blkdev.h) */
 #define BIO_RW_AHEAD   1       /* Must match FAILFAST in req flags */
 #define BIO_RW_BARRIER 2
-#define BIO_RW_SYNC    3
-#define BIO_RW_META    4
-#define BIO_RW_DISCARD 5
-#define BIO_RW_FAILFAST_DEV            6
-#define BIO_RW_FAILFAST_TRANSPORT      7
-#define BIO_RW_FAILFAST_DRIVER         8
+#define BIO_RW_SYNCIO  3
+#define BIO_RW_UNPLUG  4
+#define BIO_RW_META    5
+#define BIO_RW_DISCARD 6
+#define BIO_RW_FAILFAST_DEV            7
+#define BIO_RW_FAILFAST_TRANSPORT      8
+#define BIO_RW_FAILFAST_DRIVER         9
+
+#define BIO_RW_SYNC    (BIO_RW_SYNCIO | BIO_RW_UNPLUG)
+
+#define bio_rw_flagged(bio, flag)      ((bio)->bi_rw & (1 << (flag)))
+
+/*
+ * Old defines, these should eventually be replaced by direct usage of
+ * bio_rw_flagged()
+ */
+#define bio_barrier(bio)       bio_rw_flagged(bio, BIO_RW_BARRIER)
+#define bio_sync(bio)          bio_rw_flagged(bio, BIO_RW_SYNCIO)
+#define bio_unplug(bio)                bio_rw_flagged(bio, BIO_RW_UNPLUG)
+#define bio_failfast_dev(bio)  bio_rw_flagged(bio, BIO_RW_FAILFAST_DEV)
+#define bio_failfast_transport(bio)    \
+               bio_rw_flagged(bio, BIO_RW_FAILFAST_TRANSPORT)
+#define bio_failfast_driver(bio)       \
+               bio_rw_flagged(bio, BIO_RW_FAILFAST_DRIVER)
+#define bio_rw_ahead(bio)      bio_rw_flagged(bio, BIO_RW_AHEAD)
+#define bio_rw_meta(bio)       bio_rw_flagged(bio, BIO_RW_META)
+#define bio_discard(bio)       bio_rw_flagged(bio, BIO_RW_DISCARD)
 
 /*
  * upper 16 bits of bi_rw define the io priority of this bio
@@ -193,15 +214,6 @@ struct bio {
 #define bio_offset(bio)                bio_iovec((bio))->bv_offset
 #define bio_segments(bio)      ((bio)->bi_vcnt - (bio)->bi_idx)
 #define bio_sectors(bio)       ((bio)->bi_size >> 9)
-#define bio_barrier(bio)       ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
-#define bio_sync(bio)          ((bio)->bi_rw & (1 << BIO_RW_SYNC))
-#define bio_failfast_dev(bio)  ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DEV))
-#define bio_failfast_transport(bio)    \
-       ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_TRANSPORT))
-#define bio_failfast_driver(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DRIVER))
-#define bio_rw_ahead(bio)      ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
-#define bio_rw_meta(bio)       ((bio)->bi_rw & (1 << BIO_RW_META))
-#define bio_discard(bio)       ((bio)->bi_rw & (1 << BIO_RW_DISCARD))
 #define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio))
 
 static inline unsigned int bio_cur_sectors(struct bio *bio)
@@ -312,7 +324,6 @@ struct bio_integrity_payload {
        void                    *bip_buf;       /* generated integrity data */
        bio_end_io_t            *bip_end_io;    /* saved I/O completion fn */
 
-       int                     bip_error;      /* saved I/O error */
        unsigned int            bip_size;
 
        unsigned short          bip_pool;       /* pool the ivec came from */
@@ -440,12 +451,13 @@ extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
 
 #ifdef CONFIG_HIGHMEM
 /*
- * remember to add offset! and never ever reenable interrupts between a
- * bvec_kmap_irq and bvec_kunmap_irq!!
+ * remember never ever reenable interrupts between a bvec_kmap_irq and
+ * bvec_kunmap_irq!
  *
  * This function MUST be inlined - it plays with the CPU interrupt flags.
  */
-static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
+static __always_inline char *bvec_kmap_irq(struct bio_vec *bvec,
+               unsigned long *flags)
 {
        unsigned long addr;
 
@@ -461,7 +473,8 @@ static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
        return (char *) addr + bvec->bv_offset;
 }
 
-static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
+static __always_inline void bvec_kunmap_irq(char *buffer,
+               unsigned long *flags)
 {
        unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
 
index 044467ef7b112d2fe3ff61bdd7173a87a4c941c5..dcaa0fd84b02c36453f8d7cc211c5eaf3d12aa7b 100644 (file)
@@ -108,6 +108,7 @@ enum rq_flag_bits {
        __REQ_RW_META,          /* metadata io request */
        __REQ_COPY_USER,        /* contains copies of user pages */
        __REQ_INTEGRITY,        /* integrity metadata has been remapped */
+       __REQ_UNPLUG,           /* unplug queue on submission */
        __REQ_NR_BITS,          /* stops here */
 };
 
@@ -134,6 +135,7 @@ enum rq_flag_bits {
 #define REQ_RW_META    (1 << __REQ_RW_META)
 #define REQ_COPY_USER  (1 << __REQ_COPY_USER)
 #define REQ_INTEGRITY  (1 << __REQ_INTEGRITY)
+#define REQ_UNPLUG     (1 << __REQ_UNPLUG)
 
 #define BLK_MAX_CDB    16
 
@@ -449,6 +451,11 @@ struct request_queue
 #define QUEUE_FLAG_STACKABLE   13      /* supports request stacking */
 #define QUEUE_FLAG_NONROT      14      /* non-rotational device (SSD) */
 #define QUEUE_FLAG_VIRT        QUEUE_FLAG_NONROT /* paravirt device */
+#define QUEUE_FLAG_IO_STAT     15      /* do IO stats */
+
+#define QUEUE_FLAG_DEFAULT     ((1 << QUEUE_FLAG_IO_STAT) |            \
+                                (1 << QUEUE_FLAG_CLUSTER) |            \
+                                (1 << QUEUE_FLAG_STACKABLE))
 
 static inline int queue_is_locked(struct request_queue *q)
 {
@@ -565,6 +572,7 @@ enum {
 #define blk_queue_stopped(q)   test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
 #define blk_queue_nomerges(q)  test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
 #define blk_queue_nonrot(q)    test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
+#define blk_queue_io_stat(q)   test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
 #define blk_queue_flushing(q)  ((q)->ordseq)
 #define blk_queue_stackable(q) \
        test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
index 1dba3493d520b56e4465aa59c37811b784fb80a8..25379cba2370f2dd6cb11931d9a6649aaee40a8d 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef BLKTRACE_H
 #define BLKTRACE_H
 
+#include <linux/types.h>
 #ifdef __KERNEL__
 #include <linux/blkdev.h>
 #include <linux/relay.h>
index 7f293273c444a66101b7b66f9394c3c1c16b6bce..1432b278c52d5732fbd9f6b00c1c43bd3da6bd31 100644 (file)
@@ -14,6 +14,8 @@
 #ifndef CAN_BCM_H
 #define CAN_BCM_H
 
+#include <linux/types.h>
+
 /**
  * struct bcm_msg_head - head of messages to/from the broadcast manager
  * @opcode:    opcode, see enum below.
index 02bdb768d43b8dc980bdabd38e0784355f71eaf1..1b9872556131b8335f56b24880c6285eeb7e9a70 100644 (file)
@@ -69,10 +69,6 @@ typedef struct __user_cap_data_struct {
 #define VFS_CAP_U32             VFS_CAP_U32_2
 #define VFS_CAP_REVISION       VFS_CAP_REVISION_2
 
-#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
-extern int file_caps_enabled;
-#endif
-
 struct vfs_cap_data {
        __le32 magic_etc;            /* Little endian */
        struct {
@@ -96,6 +92,10 @@ struct vfs_cap_data {
 #define _KERNEL_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3
 #define _KERNEL_CAPABILITY_U32S    _LINUX_CAPABILITY_U32S_3
 
+#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
+extern int file_caps_enabled;
+#endif
+
 typedef struct kernel_cap_struct {
        __u32 cap[_KERNEL_CAPABILITY_U32S];
 } kernel_cap_t;
index 0b49e08d3cb0d9187649996012ab4503c5c73852..78e904796622532ff822cdc78e6e19669b87f48c 100644 (file)
@@ -11,6 +11,7 @@
 #ifndef        _LINUX_CDROM_H
 #define        _LINUX_CDROM_H
 
+#include <linux/types.h>
 #include <asm/byteorder.h>
 
 /*******************************************************
index e267e62827bbc4e564c930576fcee8b70a8c4a79..e4e8e117d27d9171f23cdc54b69011758243c3da 100644 (file)
@@ -99,6 +99,7 @@ static inline bool css_tryget(struct cgroup_subsys_state *css)
        while (!atomic_inc_not_zero(&css->refcnt)) {
                if (test_bit(CSS_REMOVED, &css->flags))
                        return false;
+               cpu_relax();
        }
        return true;
 }
index 4f53abf6855d437053df022ac5710b8c2f4ec069..3753c33160d116ada0b86b74d786bd04db119039 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef _LINUX_CGROUPSTATS_H
 #define _LINUX_CGROUPSTATS_H
 
+#include <linux/types.h>
 #include <linux/taskstats.h>
 
 /*
index cea153697ec788a3c3d61c2402a3f1188b5b06c7..3a1dbba4d3ae2da500e710387d130cd8ad5dd4c2 100644 (file)
@@ -36,6 +36,7 @@ enum clock_event_nofitiers {
        CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
        CLOCK_EVT_NOTIFY_SUSPEND,
        CLOCK_EVT_NOTIFY_RESUME,
+       CLOCK_EVT_NOTIFY_CPU_DYING,
        CLOCK_EVT_NOTIFY_CPU_DEAD,
 };
 
index 18d5fdbceb7468e104da91c258baa5f417d1d681..2dd21243104ffd72dff12fb7cfa70d1b77de0f69 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef __DLM_PLOCK_DOT_H__
 #define __DLM_PLOCK_DOT_H__
 
+#include <linux/types.h>
+
 #define DLM_PLOCK_MISC_NAME            "dlm_plock"
 
 #define DLM_PLOCK_VERSION_MAJOR        1
index 02bba040fcfb7e5e058b5c25d6bb138873ede572..fe999082319323fb2dd4946ad6ecabb89a49a7e5 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _LINUX_DN_H
 #define _LINUX_DN_H
 
+#include <linux/types.h>
+
 /*
 
        DECnet Data Structures and Constants
index 89412e18f571ec20c0b980628798033e7aa7b648..bb0df2aaebfa8676c029f13d58ff35fd48709166 100644 (file)
 #ifndef _DVBAUDIO_H_
 #define _DVBAUDIO_H_
 
-#ifdef __KERNEL__
 #include <linux/types.h>
-#else
-#include <stdint.h>
-#endif
-
 
 typedef enum {
        AUDIO_SOURCE_DEMUX, /* Select the demux as the main source */
index 402fb7a8d922531809a2b19a4ec1d590587e578f..fef943738a24d56127516c1abbf863c8e79b5ed0 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef _DVBDMX_H_
 #define _DVBDMX_H_
 
-#include <asm/types.h>
+#include <linux/types.h>
 #ifdef __KERNEL__
 #include <linux/time.h>
 #else
index 55026b1a40bd8ee17fdfca344311d28f2bae3a6a..51c8d2d49e4289adf14b59c42fdb68b7fa4e1bb5 100644 (file)
@@ -26,8 +26,7 @@
 #ifndef _DVBFRONTEND_H_
 #define _DVBFRONTEND_H_
 
-#include <asm/types.h>
-
+#include <linux/types.h>
 
 typedef enum fe_type {
        FE_QPSK,
index 5be474bf0d2bd2dc065862e46fa4bf2ff86cc4df..f451e7eb0b0bd9c393dca78cea873c4f91e1dede 100644 (file)
@@ -24,8 +24,7 @@
 #ifndef _DVBNET_H_
 #define _DVBNET_H_
 
-#include <asm/types.h>
-
+#include <linux/types.h>
 
 struct dvb_net_if {
        __u16 pid;
index 50839fe9e39e3b615b9acb5e3bc549a603d46a52..bd49c3ebf916daef78fd00eb8a600619f162100d 100644 (file)
 #ifndef _DVBVIDEO_H_
 #define _DVBVIDEO_H_
 
-#include <linux/compiler.h>
-
-#ifdef __KERNEL__
 #include <linux/types.h>
+#ifdef __KERNEL__
+#include <linux/compiler.h>
 #else
-#include <asm/types.h>
 #include <stdint.h>
 #include <time.h>
 #endif
 
-
 typedef enum {
        VIDEO_FORMAT_4_3,     /* Select 4:3 format */
        VIDEO_FORMAT_16_9,    /* Select 16:9 format. */
index 5d747c5cd0fea267a01ae33de179988f79dd13c5..4cbd0fe9df0898f09a4641270ebd89d0f7def56a 100644 (file)
@@ -30,6 +30,8 @@
 #ifndef _LINUX_EDD_H
 #define _LINUX_EDD_H
 
+#include <linux/types.h>
+
 #define EDDNR 0x1e9            /* addr of number of edd_info structs at EDDBUF
                                   in boot_params - treat this as 1 byte  */
 #define EDDBUF 0xd00           /* addr of edd_info structs in boot_params */
index ff1945e37790e5a679ec4f1c7a09f3425483cea6..a01be90c58ccfee4a0c78846c754d340c8d458ad 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef __EFS_FS_SB_H__
 #define __EFS_FS_SB_H__
 
+#include <linux/types.h>
 #include <linux/magic.h>
 
 /* EFS superblock magic numbers */
index 9f5b7456bff35653ebf96d027a80ddd41ea0ceac..7cd2e80cebc8d4ae3f68ac339a8cb58c6a2eb1a2 100644 (file)
@@ -58,11 +58,13 @@ struct elf_fdpic_params {
 #define ELF_FDPIC_FLAG_PRESENT         0x80000000      /* T if this object is present */
 };
 
+#ifdef __KERNEL__
 #ifdef CONFIG_MMU
 extern void elf_fdpic_arch_lay_out_mm(struct elf_fdpic_params *exec_params,
                                      struct elf_fdpic_params *interp_params,
                                      unsigned long *start_stack,
                                      unsigned long *start_brk);
 #endif
+#endif /* __KERNEL__ */
 
 #endif /* _LINUX_ELF_FDPIC_H */
index 0b61ca41a0445009ee757680aa31fa2320e144f2..45a937be6d38c1079ea0b92adb8b595d760af1f8 100644 (file)
@@ -377,6 +377,7 @@ typedef struct elf64_note {
   Elf64_Word n_type;   /* Content type */
 } Elf64_Nhdr;
 
+#ifdef __KERNEL__
 #if ELF_CLASS == ELFCLASS32
 
 extern Elf32_Dyn _DYNAMIC [];
@@ -404,5 +405,5 @@ static inline int elf_coredump_extra_notes_write(struct file *file,
 extern int elf_coredump_extra_notes_size(void);
 extern int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset);
 #endif
-
+#endif /* __KERNEL__ */
 #endif /* _LINUX_ELF_H */
index 92f8d4fab32be96bd86e29612b78c6a8cb1b952b..ceb1454b69770d303508a137be39bc1772c54802 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _LINUX_ERRQUEUE_H
 #define _LINUX_ERRQUEUE_H 1
 
+#include <linux/types.h>
+
 struct sock_extended_err
 {
        __u32   ee_errno;       
index 818fe21257e8c62acdb8847be5af682c1cc186b7..31527e17076b7c8697dcf7fdeb9717d8dead779a 100644 (file)
@@ -960,6 +960,21 @@ extern struct fb_info *registered_fb[FB_MAX];
 extern int num_registered_fb;
 extern struct class *fb_class;
 
+static inline int lock_fb_info(struct fb_info *info)
+{
+       mutex_lock(&info->lock);
+       if (!info->fbops) {
+               mutex_unlock(&info->lock);
+               return 0;
+       }
+       return 1;
+}
+
+static inline void unlock_fb_info(struct fb_info *info)
+{
+       mutex_unlock(&info->lock);
+}
+
 static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
                                           u8 *src, u32 s_pitch, u32 height)
 {
index 7da02c93002b4fd1f955230463ce0354aee3da95..b834ef6d59fa459ca793a004c311fe363e5a68fa 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_GENERIC_NETLINK_H
 #define __LINUX_GENERIC_NETLINK_H
 
+#include <linux/types.h>
 #include <linux/netlink.h>
 
 #define GENL_NAMSIZ    16      /* length of family name */
index 14d0df0b5749833b823b4ff8cfd7de1c08a4e4b3..c56b4bce56d06faee3f3690f37555de624ccfc6e 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef __GFS2_ONDISK_DOT_H__
 #define __GFS2_ONDISK_DOT_H__
 
+#include <linux/types.h>
+
 #define GFS2_MAGIC             0x01161970
 #define GFS2_BASIC_BLOCK       512
 #define GFS2_BASIC_BLOCK_SHIFT 9
index 81aa84d60c6b4087eb46ebe0a2f5ecfd1b274700..fa8ee9cef7bec3e228f27304bb31e14d161c0673 100644 (file)
@@ -791,6 +791,7 @@ dbg_hid(const char *fmt, ...)
                __FILE__ , ## arg)
 #endif /* HID_FF */
 
+#ifdef __KERNEL__
 #ifdef CONFIG_HID_COMPAT
 #define HID_COMPAT_LOAD_DRIVER(name)   \
 /* prototype to avoid sparse warning */        \
@@ -804,6 +805,7 @@ EXPORT_SYMBOL(hid_compat_##name)
        extern void hid_compat_##name(void);    \
        hid_compat_##name();                    \
 } while (0)
+#endif /* __KERNEL__ */
 
 #endif
 
index c760ae0eb6a12b8842297388d2d86ec14f20291c..bb6f58baf319918121880b604a0c1c004eab5e03 100644 (file)
@@ -27,6 +27,8 @@
  * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
  */
 
+#include <linux/types.h>
+
 /*
  * The event structure itself
  */
index a93a8dd33118f5fe900e2e6a2e79672bdb1f1319..10d701eec484cb353508afa13efbf63d506e2759 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _LINUX_ICMPV6_H
 #define _LINUX_ICMPV6_H
 
+#include <linux/types.h>
 #include <asm/byteorder.h>
 
 struct icmp6hdr {
index 43f3bedaafd3c295c29f57082a7d51aaeb4f0bfb..a60c821be44c3e99e971f12a5a061cf28cfea519 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_IF_ADDR_H
 #define __LINUX_IF_ADDR_H
 
+#include <linux/types.h>
 #include <linux/netlink.h>
 
 struct ifaddrmsg
index 9fe79c95dd2808960b6770c6928eb72f3cf13384..89571f65d6ded5d25bdfa6951e88c23131a7b724 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef __LINUX_IF_ADDRLABEL_H
 #define __LINUX_IF_ADDRLABEL_H
 
+#include <linux/types.h>
+
 struct ifaddrlblmsg
 {
        __u8            ifal_family;            /* Address family */
index 376a34ea47231282bc883e05fcb2dcd487b52bd3..6ed7f1bf35c81b411739c5dce95bdc07e9df5a94 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef _LINUX_IF_FC_H
 #define _LINUX_IF_FC_H
 
+#include <linux/types.h>
 
 #define FC_ALEN        6               /* Octets in one ethernet addr   */
 #define FC_HLEN   (sizeof(struct fch_hdr)+sizeof(struct fcllc))
index f0f23516bb5982222fcaf0b4677782137e90a5b1..4a7c9940b08051eef671d7d1f2faa6099be2679d 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef _LINUX_IF_HIPPI_H
 #define _LINUX_IF_HIPPI_H
 
+#include <linux/types.h>
 #include <asm/byteorder.h>
 
 /*
index f9032c88716a6c3d937adcdff70a3679e89bb887..176c5182c515e1f16ae41c96dac084c0d8f5485d 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _LINUX_IF_LINK_H
 #define _LINUX_IF_LINK_H
 
+#include <linux/types.h>
 #include <linux/netlink.h>
 
 /* The struct should be in sync with struct net_device_stats */
index c3b1f8562709cf375689666b9e3257fb31fcb06c..fcef103aa3f602cb80c1609432911de1eee0b36b 100644 (file)
@@ -33,6 +33,7 @@
 #ifndef _IF_PPP_H_
 #define _IF_PPP_H_
 
+#include <linux/types.h>
 #include <linux/compiler.h>
 
 /*
index fb5c5c98442f14dfdc0ac2d76a50c339e1caf3f3..6526a6235832b549741c9bd2281d61e00c7fc34d 100644 (file)
@@ -18,6 +18,8 @@
 #ifndef __LINUX_STRIP_H
 #define __LINUX_STRIP_H
 
+#include <linux/types.h>
+
 typedef struct {
     __u8 c[6];
 } MetricomAddress;
index 5bcec8b2c5e2b557d1cdbbec372177c4bc3c24ed..fc23aeb0f20133c95234cc549b62e5128890abca 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef _LINUX_IF_TR_H
 #define _LINUX_IF_TR_H
 
+#include <linux/types.h>
 #include <asm/byteorder.h>     /* For __be16 */
 
 /* IEEE 802.5 Token-Ring magic constants.  The frame sizes omit the preamble
index aeab2cb32a9cd94048763941101bec458f2461d6..82c43624c067a132bec16e08abf07c6845c1b1df 100644 (file)
@@ -2,7 +2,10 @@
 #define _IF_TUNNEL_H_
 
 #include <linux/types.h>
+
+#ifdef __KERNEL__
 #include <linux/ip.h>
+#endif
 
 #define SIOCGETTUNNEL   (SIOCDEVPRIVATE + 0)
 #define SIOCADDTUNNEL   (SIOCDEVPRIVATE + 1)
index f734a0ba0698b2ddf7ccf58190205f0b0ac60f7c..92fbd8cbd68fc87032a77b739b24d4f2d63f7084 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef _LINUX_IGMP_H
 #define _LINUX_IGMP_H
 
+#include <linux/types.h>
 #include <asm/byteorder.h>
 
 /*
index 6e8bc548635af6a2cb1a685158751ca437dff476..bc8c490220842540e6ea30c49662077c927e6142 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _INET_DIAG_H_
 #define _INET_DIAG_H_ 1
 
+#include <linux/types.h>
+
 /* Just some random number */
 #define TCPDIAG_GETSOCK 18
 #define DCCPDIAG_GETSOCK 19
index 1e7cc4af40deac588512e9715c77611c374b431c..acb9ad684d639167c6a2c1469e14eb1d6694e93b 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _IP6_TUNNEL_H
 #define _IP6_TUNNEL_H
 
+#include <linux/types.h>
+
 #define IPV6_TLV_TNL_ENCAP_LIMIT 4
 #define IPV6_DEFAULT_TNL_ENCAP_LIMIT 4
 
index 0b816cae533eea35ece747f5c7921a3df8c979e3..476d9464ac82d27c53a0fc48c435639f77391dcd 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _IPV6_H
 #define _IPV6_H
 
+#include <linux/types.h>
 #include <linux/in6.h>
 #include <asm/byteorder.h>
 
index b323ff5779672c77b6adfba1c1bdc87f4981f85c..1e7d8af2defe78d27bbe9c2518065b3679e63903 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef _LINUX_IPV6_ROUTE_H
 #define _LINUX_IPV6_ROUTE_H
 
+#include <linux/types.h>
+
 #define RTF_DEFAULT    0x00010000      /* default - learned via ND     */
 #define RTF_ALLONLINK  0x00020000      /* (deprecated and will be removed)
                                           fallback, no routers on link */
index eb19b4ea84f499e5dc8ab62bd46a9558e05751ef..aabb1d294025cace5fe82b9cd184dec7931cf55b 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef _IPX_H_
 #define _IPX_H_
+#include <linux/types.h>
 #include <linux/sockios.h>
 #include <linux/socket.h>
 #define IPX_NODE_LEN   6
index 28f88ecba344e1eefe5fbca694b3d56fcca2948d..00bdad0e8515a007c112b7d055af603dbd02f46c 100644 (file)
@@ -25,6 +25,8 @@
 #ifndef KERNEL_IRDA_H
 #define KERNEL_IRDA_H
 
+#include <linux/types.h>
+
 /* Please do *not* add any #include in this file, this file is
  * included as-is in user space.
  * Please fix the calling file to properly included needed files before
index b45109c61fba90451a0396f6c845e7c55964ccb3..b28b37eb11c626da84e8152f4878b8c593125ec3 100644 (file)
@@ -308,7 +308,8 @@ void buffer_assertion_failure(struct buffer_head *bh);
                int val = (expr);                                            \
                if (!val) {                                                  \
                        printk(KERN_ERR                                      \
-                               "EXT3-fs unexpected failure: %s;\n",# expr); \
+                              "JBD2 unexpected failure: %s: %s;\n",         \
+                              __func__, #expr);                             \
                        printk(KERN_ERR why "\n");                           \
                }                                                            \
                val;                                                         \
index 343df9ef2412393020e90c1ef5227135b3b5a07f..7fa371898e3e76d8e1af870f049844ff71bea931 100644 (file)
@@ -480,7 +480,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
 /*
  * swap - swap value of @a and @b
  */
-#define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; })
+#define swap(a, b) \
+       do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
 
 /**
  * container_of - cast a member of a structure out to the containing structure
index d6ea19e314bb2a41d050423da7e9bd1e826812d2..32851eef48f058908f2e30312007692540cedd2e 100644 (file)
 
 /* Attach to insert probes on any functions which should be ignored*/
 #define __kprobes      __attribute__((__section__(".kprobes.text"))) notrace
+#else /* CONFIG_KPROBES */
+typedef int kprobe_opcode_t;
+struct arch_specific_insn {
+       int dummy;
+};
+#define __kprobes      notrace
+#endif /* CONFIG_KPROBES */
 
 struct kprobe;
 struct pt_regs;
@@ -131,23 +138,6 @@ struct jprobe {
 /* For backward compatibility with old code using JPROBE_ENTRY() */
 #define JPROBE_ENTRY(handler)  (handler)
 
-DECLARE_PER_CPU(struct kprobe *, current_kprobe);
-DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
-
-#ifdef CONFIG_KRETPROBES
-extern void arch_prepare_kretprobe(struct kretprobe_instance *ri,
-                                  struct pt_regs *regs);
-extern int arch_trampoline_kprobe(struct kprobe *p);
-#else /* CONFIG_KRETPROBES */
-static inline void arch_prepare_kretprobe(struct kretprobe *rp,
-                                       struct pt_regs *regs)
-{
-}
-static inline int arch_trampoline_kprobe(struct kprobe *p)
-{
-       return 0;
-}
-#endif /* CONFIG_KRETPROBES */
 /*
  * Function-return probe -
  * Note:
@@ -188,6 +178,25 @@ struct kprobe_blackpoint {
        unsigned long range;
 };
 
+#ifdef CONFIG_KPROBES
+DECLARE_PER_CPU(struct kprobe *, current_kprobe);
+DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
+
+#ifdef CONFIG_KRETPROBES
+extern void arch_prepare_kretprobe(struct kretprobe_instance *ri,
+                                  struct pt_regs *regs);
+extern int arch_trampoline_kprobe(struct kprobe *p);
+#else /* CONFIG_KRETPROBES */
+static inline void arch_prepare_kretprobe(struct kretprobe *rp,
+                                       struct pt_regs *regs)
+{
+}
+static inline int arch_trampoline_kprobe(struct kprobe *p)
+{
+       return 0;
+}
+#endif /* CONFIG_KRETPROBES */
+
 extern struct kretprobe_blackpoint kretprobe_blacklist[];
 
 static inline void kretprobe_assert(struct kretprobe_instance *ri,
@@ -264,10 +273,6 @@ void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
 
 #else /* CONFIG_KPROBES */
 
-#define __kprobes      notrace
-struct jprobe;
-struct kretprobe;
-
 static inline struct kprobe *get_kprobe(void *addr)
 {
        return NULL;
index bca3ba25f52ac3cba6c983eb66c0e78ce3074fd9..5d87bc09a1f5bcef65f97a4c06599c8e9f7295b1 100644 (file)
@@ -380,6 +380,7 @@ enum {
        ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands
                                                    not multiple of 16 bytes */
        ATA_HORKAGE_FIRMWARE_WARN = (1 << 12),  /* firwmare update warning */
+       ATA_HORKAGE_1_5_GBPS    = (1 << 13),    /* force 1.5 Gbps */
 
         /* DMA mask for user DMA control: User visible values; DO NOT
            renumber */
@@ -580,7 +581,7 @@ struct ata_device {
        acpi_handle             acpi_handle;
        union acpi_object       *gtf_cache;
 #endif
-       /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
+       /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */
        u64                     n_sectors;      /* size of device, if ATA */
        unsigned int            class;          /* ATA_DEV_xxx */
        unsigned long           unpark_deadline;
@@ -605,20 +606,22 @@ struct ata_device {
        u16                     heads;          /* Number of heads */
        u16                     sectors;        /* Number of sectors per track */
 
-       /* error history */
-       int                     spdn_cnt;
-       struct ata_ering        ering;
-
        union {
                u16             id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
                u32             gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
        };
+
+       /* error history */
+       int                     spdn_cnt;
+       /* ering is CLEAR_END, read comment above CLEAR_END */
+       struct ata_ering        ering;
 };
 
-/* Offset into struct ata_device.  Fields above it are maintained
- * acress device init.  Fields below are zeroed.
+/* Fields between ATA_DEVICE_CLEAR_BEGIN and ATA_DEVICE_CLEAR_END are
+ * cleared to zero on ata_dev_init().
  */
-#define ATA_DEVICE_CLEAR_OFFSET                offsetof(struct ata_device, n_sectors)
+#define ATA_DEVICE_CLEAR_BEGIN         offsetof(struct ata_device, n_sectors)
+#define ATA_DEVICE_CLEAR_END           offsetof(struct ata_device, ering)
 
 struct ata_eh_info {
        struct ata_device       *dev;           /* offending device */
index 0e39745f5111b90d930998aae2caadade96c99e8..13fe09e0576a3c30064a3f81f785d97dd13c3155 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _LINUX_MINIX_FS_H
 #define _LINUX_MINIX_FS_H
 
+#include <linux/types.h>
 #include <linux/magic.h>
 
 /*
index 4f7ea12463d33d3ec99ad98da98ec8b1cba52a80..145a75528cc1868c275bbbcfacb97ab0124eab46 100644 (file)
@@ -219,11 +219,6 @@ void *__symbol_get_gpl(const char *symbol);
 
 #endif
 
-struct module_ref
-{
-       local_t count;
-} ____cacheline_aligned;
-
 enum module_state
 {
        MODULE_STATE_LIVE,
@@ -344,8 +339,11 @@ struct module
        /* Destruction function. */
        void (*exit)(void);
 
-       /* Reference counts */
-       struct module_ref ref[NR_CPUS];
+#ifdef CONFIG_SMP
+       char *refptr;
+#else
+       local_t ref;
+#endif
 #endif
 };
 #ifndef MODULE_ARCH_INIT
@@ -395,13 +393,21 @@ void __symbol_put(const char *symbol);
 #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x)
 void symbol_put_addr(void *addr);
 
+static inline local_t *__module_ref_addr(struct module *mod, int cpu)
+{
+#ifdef CONFIG_SMP
+       return (local_t *) (mod->refptr + per_cpu_offset(cpu));
+#else
+       return &mod->ref;
+#endif
+}
+
 /* Sometimes we know we already have a refcount, and it's easier not
    to handle the error case (which only happens with rmmod --wait). */
 static inline void __module_get(struct module *module)
 {
        if (module) {
-               BUG_ON(module_refcount(module) == 0);
-               local_inc(&module->ref[get_cpu()].count);
+               local_inc(__module_ref_addr(module, get_cpu()));
                put_cpu();
        }
 }
@@ -413,7 +419,7 @@ static inline int try_module_get(struct module *module)
        if (module) {
                unsigned int cpu = get_cpu();
                if (likely(module_is_live(module)))
-                       local_inc(&module->ref[cpu].count);
+                       local_inc(__module_ref_addr(module, cpu));
                else
                        ret = 0;
                put_cpu();
index e0a9b207920d37d5e9d6fd98ae8cc4dc809808eb..ce38f1caa5e1346e748ee0fca6d5d7b66c2aae0d 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _LINUX_MSDOS_FS_H
 #define _LINUX_MSDOS_FS_H
 
+#include <linux/types.h>
 #include <linux/magic.h>
 #include <asm/byteorder.h>
 
index bd3bbf668cdb009292195056d2e8be292dd6e97e..8730d5dae1bc2a3c5b8a33aab453cb8382a19dcf 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_NEIGHBOUR_H
 #define __LINUX_NEIGHBOUR_H
 
+#include <linux/types.h>
 #include <linux/netlink.h>
 
 struct ndmsg
index f3fd83e46babdf422bf6952f0c21214fdac57d98..8f5345275393b61d652a0cd934f656770f0557a7 100644 (file)
@@ -5,6 +5,7 @@
 #ifndef _XT_CONNTRACK_H
 #define _XT_CONNTRACK_H
 
+#include <linux/types.h>
 #include <linux/netfilter/nf_conntrack_tuple_common.h>
 
 #define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
index 15a9f3b7289ab4722d042dc6712860b793f627c2..91a1c24e0cbffdeb97e28d072cd657510d22faab 100644 (file)
@@ -37,6 +37,8 @@
 #ifndef NFS_IDMAP_H
 #define NFS_IDMAP_H
 
+#include <linux/types.h>
+
 /* XXX from bits/utmp.h  */
 #define IDMAP_NAMESZ  128
 
index 5431512b2757b809314a406089c92c3d83b1c476..bcd0201589f833ec3e5e4c73200ebf0939a9ec69 100644 (file)
@@ -10,9 +10,8 @@
 #ifndef NFSD_EXPORT_H
 #define NFSD_EXPORT_H
 
-#include <asm/types.h>
-#ifdef __KERNEL__
 # include <linux/types.h>
+#ifdef __KERNEL__
 # include <linux/in.h>
 #endif
 
index b2e093870bc6c7060bf74b23dec745e7cfd5a76e..fa317f6c154b168286905d40ca3b9aae9918cf0e 100644 (file)
@@ -14,9 +14,8 @@
 #ifndef _LINUX_NFSD_FH_H
 #define _LINUX_NFSD_FH_H
 
-#include <asm/types.h>
-#ifdef __KERNEL__
 # include <linux/types.h>
+#ifdef __KERNEL__
 # include <linux/string.h>
 # include <linux/fs.h>
 #endif
index 4e439765b705e3a01dd3be9559b57d38a70ea445..7a3b565b898f76042d81c5ea00a235bd7dc31b93 100644 (file)
@@ -9,9 +9,8 @@
 #ifndef NFSD_SYSCALL_H
 #define NFSD_SYSCALL_H
 
-#include <asm/types.h>
-#ifdef __KERNEL__
 # include <linux/types.h>
+#ifdef __KERNEL__
 # include <linux/in.h>
 #endif 
 #include <linux/posix_types.h>
index c4355076d1a5e58183336134a51244b878fbce62..7382af374731eca162a79dff5e9156126c2b7f94 100644 (file)
@@ -12,6 +12,7 @@
 #ifndef LINUX_NUBUS_H
 #define LINUX_NUBUS_H
 
+#include <linux/types.h>
 #ifdef __KERNEL__
 #include <asm/nubus.h>
 #endif
index 48890cf3f96e562937ded2fc8134f156e9fba60d..7bd624bfdcfd37945e3c59bf2a74f0d2f1dabb21 100644 (file)
@@ -684,7 +684,7 @@ int pci_enable_rom(struct pci_dev *pdev);
 void pci_disable_rom(struct pci_dev *pdev);
 void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
 void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
-size_t pci_get_rom_size(void __iomem *rom, size_t size);
+size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
 
 /* Power management related routines */
 int pci_save_state(struct pci_dev *dev);
index febc10ed3858a474a5d1edf12c8759e133af4fe1..52a9fe08451cfa105c733099350355a8b89dc028 100644 (file)
 #define PCI_DEVICE_ID_INTEL_ICH7_0     0x27b8
 #define PCI_DEVICE_ID_INTEL_ICH7_1     0x27b9
 #define PCI_DEVICE_ID_INTEL_ICH7_30    0x27b0
+#define PCI_DEVICE_ID_INTEL_TGP_LPC    0x27bc
 #define PCI_DEVICE_ID_INTEL_ICH7_31    0x27bd
 #define PCI_DEVICE_ID_INTEL_ICH7_17    0x27da
 #define PCI_DEVICE_ID_INTEL_ICH7_19    0x27dd
index 4157faa857b697b3c9a4a5e55520ef7dd6c48339..ee5e3c9e2bcaf0006b6b03f659cc6d323c15f3bb 100644 (file)
@@ -23,6 +23,8 @@
 #ifndef LINUX_PHONET_H
 #define LINUX_PHONET_H
 
+#include <linux/types.h>
+
 /* Automatic protocol selection */
 #define PN_PROTO_TRANSPORT     0
 /* Phonet datagram socket */
index e6aa8482ad7a910fdbf256b8d2cd7203d13f0e4b..3c842edff388c90ef76bab969322cddfa7e076d1 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_PKT_CLS_H
 #define __LINUX_PKT_CLS_H
 
+#include <linux/types.h>
 #include <linux/pkt_sched.h>
 
 /* I think i could have done better macros ; for now this is stolen from
index e3f133adba7828e62b620796ca6dcee345e08d86..b2648e8e4987549d1b9be26f5f2feab01be3cb24 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __LINUX_PKT_SCHED_H
 #define __LINUX_PKT_SCHED_H
 
+#include <linux/types.h>
+
 /* Logical priority bands not depending on specific packet scheduler.
    Every scheduler will map them to real traffic classes, if it has
    no more precise mechanism to classify packets.
index 6e8adc77522c061ba8ea409d081b9a033ff125af..1c866bda2018a367b822e62620dc8bed246f6205 100644 (file)
@@ -25,6 +25,8 @@
  * OR MODIFICATIONS.
  */
 
+#include <linux/types.h>
+
 /*
  *  ==FILEVERSION 20000114==
  *
index 9491026afe6610bc5f4897fbe2f30c5b75484f2c..6ba830fa8538e1f15ef26e91017948ccc69f783d 100644 (file)
@@ -15,6 +15,8 @@
 #ifndef _MD_P_H
 #define _MD_P_H
 
+#include <linux/types.h>
+
 /*
  * RAID superblock.
  *
index 407ea3646f8f12f05a0410166f3ff2e6fa4a447e..25d02fe5c9b5a6561e19bd3410a4132ea98dffd8 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef _LINUX_RANDOM_H
 #define _LINUX_RANDOM_H
 
+#include <linux/types.h>
 #include <linux/ioctl.h>
 #include <linux/irqnr.h>
 
index e88f7058b3a11b5764950e0ec95488ddc7610158..1e5f6730ff31f412b65b731a5c7b375e4ddf0046 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_RTNETLINK_H
 #define __LINUX_RTNETLINK_H
 
+#include <linux/types.h>
 #include <linux/netlink.h>
 #include <linux/if_link.h>
 #include <linux/if_addr.h>
index 02e16d2073042857e8f59565e2848c9821818744..2127e959e0f4ac86565ff0832063586ac6387dab 100644 (file)
@@ -443,6 +443,7 @@ struct pacct_struct {
  * @utime:             time spent in user mode, in &cputime_t units
  * @stime:             time spent in kernel mode, in &cputime_t units
  * @sum_exec_runtime:  total time spent on the CPU, in nanoseconds
+ * @lock:              lock for fields in this struct
  *
  * This structure groups together three kinds of CPU time that are
  * tracked for threads and thread groups.  Most things considering
@@ -630,7 +631,6 @@ struct user_struct {
        atomic_t inotify_devs;  /* How many inotify devs does this user have opened? */
 #endif
 #ifdef CONFIG_EPOLL
-       atomic_t epoll_devs;    /* The number of epoll descriptors currently open */
        atomic_t epoll_watches; /* The number of file descriptors currently watched */
 #endif
 #ifdef CONFIG_POSIX_MQUEUE
index bef0c46d4713cb82a041907fe62b21c71175d930..b363b916c90961a9d61877f26d900d9111aeacb7 100644 (file)
@@ -8,6 +8,7 @@
 #ifndef _LINUX_SIGNALFD_H
 #define _LINUX_SIGNALFD_H
 
+#include <linux/types.h>
 /* For O_CLOEXEC and O_NONBLOCK */
 #include <linux/fcntl.h>
 
index 39c3a5eb8ebe677851fedd8c8ff6a70730d17c0b..6ca6a7b66d75c36eb5ab30d4f5f3784a4e9ea8aa 100644 (file)
@@ -43,10 +43,7 @@ static inline void *kmalloc(size_t size, gfp_t flags)
                        i++;
 #include <linux/kmalloc_sizes.h>
 #undef CACHE
-               {
-                       extern void __you_cannot_kmalloc_that_much(void);
-                       __you_cannot_kmalloc_that_much();
-               }
+               return NULL;
 found:
 #ifdef CONFIG_ZONE_DMA
                if (flags & GFP_DMA)
@@ -77,10 +74,7 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
                        i++;
 #include <linux/kmalloc_sizes.h>
 #undef CACHE
-               {
-                       extern void __you_cannot_kmalloc_that_much(void);
-                       __you_cannot_kmalloc_that_much();
-               }
+               return NULL;
 found:
 #ifdef CONFIG_ZONE_DMA
                if (flags & GFP_DMA)
index 9e2a94feed6baa519190de1db4521b4eaeeead43..44dcf057043250362eb007650eecdf3d2003ca39 100644 (file)
@@ -25,6 +25,7 @@
 #define SND_DEV_AMIDI          13      /* Like /dev/midi (obsolete) */
 #define SND_DEV_ADMMIDI                14      /* Like /dev/dmmidi (onsolete) */
 
+#ifdef __KERNEL__
 /*
  *     Sound core interface functions
  */
@@ -40,3 +41,4 @@ extern void unregister_sound_special(int unit);
 extern void unregister_sound_mixer(int unit);
 extern void unregister_sound_midi(int unit);
 extern void unregister_sound_dsp(int unit);
+#endif /* __KERNEL__ */
index c93ef9d42a01e48b2ad66fc3bacdf42362844ed1..95251ccd5a07072ac3421f6566e4a89658e1f578 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef SPIDEV_H
 #define SPIDEV_H
 
+#include <linux/types.h>
 
 /* User space versions of kernel symbols for SPI clocking modes,
  * matching <linux/spi/spi.h>
index c844a229acc937e42b28d201168847e3ed789e45..99b8bdb17b2b9235cd9b937be79bacae78668835 100644 (file)
@@ -13,6 +13,8 @@
 #define _SYNCLINK_H_
 #define SYNCLINK_H_VERSION 3.6
 
+#include <linux/types.h>
+
 #define BIT0   0x0001
 #define BIT1   0x0002
 #define BIT2   0x0004
index 16875f89e6a7135d28dfccb1c51e4f8174383bea..0eda02ff2414dbcedeab8312f4cbc3c2a2a7fbc7 100644 (file)
@@ -108,9 +108,14 @@ struct old_linux_dirent;
        asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n"      \
             "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
 #else
+#ifdef CONFIG_ALPHA
+#define SYSCALL_ALIAS(alias, name)                                     \
+       asm ( #alias " = " #name "\n\t.globl " #alias)
+#else
 #define SYSCALL_ALIAS(alias, name)                                     \
        asm ("\t.globl " #alias "\n\t.set " #alias ", " #name)
 #endif
+#endif
 
 #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
 
index 18269e956a7189d600387a12f70e7bf9c2996d55..341dddb55090853430c39bd76a081bc2125c8fe5 100644 (file)
@@ -16,6 +16,8 @@
 #ifndef _LINUX_TASKSTATS_H
 #define _LINUX_TASKSTATS_H
 
+#include <linux/types.h>
+
 /* Format for per-task data returned to userland when
  *     - a task exits
  *     - listener requests stats for a task
index 23a03eb630db07996c69d2b12b0c09d7eac45171..e895c0a396291a64e3010a4f30824bdfab20ceb7 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_TC_GACT_H
 #define __LINUX_TC_GACT_H
 
+#include <linux/types.h>
 #include <linux/pkt_cls.h>
 
 #define TCA_ACT_GACT 5
index 71d63409d5684154c515a2c57b5cbe919f045ef3..0a99ab60d61083026908fa38fba1395abec50090 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_TC_MIR_H
 #define __LINUX_TC_MIR_H
 
+#include <linux/types.h>
 #include <linux/pkt_cls.h>
 
 #define TCA_ACT_MIRRED 8
index 83e56e32e8e050d6733527bb3329abb1807d362e..54ce9064115a43a18d9cf5061d7bb09ec1c67614 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_TC_PED_H
 #define __LINUX_TC_PED_H
 
+#include <linux/types.h>
 #include <linux/pkt_cls.h>
 
 #define TCA_ACT_PEDIT 7
index c7f4d43618fd8e9282a3053d7d8612b5676bc84e..38e7f7b25ec2de7d4aa02b0ac26bb8cd4db6b99e 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_TC_EM_CMP_H
 #define __LINUX_TC_EM_CMP_H
 
+#include <linux/types.h>
 #include <linux/pkt_cls.h>
 
 struct tcf_em_cmp
index c50d2ba5caf004ea9b8a33a12d27fa859a4e4864..dcfb733fa1f6660542696362df20bbd94f6e8701 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_TC_EM_META_H
 #define __LINUX_TC_EM_META_H
 
+#include <linux/types.h>
 #include <linux/pkt_cls.h>
 
 enum
index f19d1f58ec9df4c834b848290309ea1a319a3919..9ed8c2e58488933fa337784b4f108cdcfcc39c38 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_TC_EM_NBYTE_H
 #define __LINUX_TC_EM_NBYTE_H
 
+#include <linux/types.h>
 #include <linux/pkt_cls.h>
 
 struct tcf_em_nbyte
index 7cd43e99c7f5e027e39ea938f36885da78dae004..d12a73a225fc2ae019e93fc1848e4d7f6df68b80 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __LINUX_TC_EM_TEXT_H
 #define __LINUX_TC_EM_TEXT_H
 
+#include <linux/types.h>
 #include <linux/pkt_cls.h>
 
 #define TC_EM_TEXT_ALGOSIZ     16
index 18a729343ffae3edd927fca1d4855b0f2e1bc0b2..3c86ed25a04ca53dfbe1ceb278c3ac33a125a973 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef __LINUX_USB_CDC_H
 #define __LINUX_USB_CDC_H
 
+#include <linux/types.h>
+
 #define USB_CDC_SUBCLASS_ACM                   0x02
 #define USB_CDC_SUBCLASS_ETHERNET              0x06
 #define USB_CDC_SUBCLASS_WHCM                  0x08
index ea45f265ec05221bc18b0ad687a15e721f53ed44..612102e4d75ea0484da586db87e4cfd1d4ae64f4 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef __LINUX_USB_GADGETFS_H
 #define __LINUX_USB_GADGETFS_H
 
-#include <asm/types.h>
+#include <linux/types.h>
 #include <asm/ioctl.h>
 
 #include <linux/usb/ch9.h>
index 121e26da2c1869b6447423649d38af8591389060..e26c0c86a6eaf919dadfe83d2e5226fccfbe7f6a 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _LINUX_VIDEO_DECODER_H
 #define _LINUX_VIDEO_DECODER_H
 
+#include <linux/types.h>
+
 #define HAVE_VIDEO_DECODER 1
 
 struct video_decoder_capability { /* this name is too long */
index 4b0e6907a7b4cd0b0c3aa8434a45b1c97e71f1c7..b7b6423bbb8ac0188890368ef6b57dc42ec6bc19 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _LINUX_VIDEO_ENCODER_H
 #define _LINUX_VIDEO_ENCODER_H
 
+#include <linux/types.h>
+
 struct video_encoder_capability { /* this name is too long */
        __u32   flags;
 #define        VIDEO_ENCODER_PAL       1       /* can encode PAL signal */
index 15a653d411329dc8cb7eb8584120b93243bfcede..837f392fbe9761bad9cadaf26f02ffa2d0a8bda0 100644 (file)
@@ -12,6 +12,7 @@
 #ifndef __LINUX_VIDEODEV_H
 #define __LINUX_VIDEODEV_H
 
+#include <linux/types.h>
 #include <linux/ioctl.h>
 #include <linux/videodev2.h>
 
index c1aef85243bf468522364425b6e06c022d9c8071..94c56d29869df77a2c72b7438762db7ff72fac9f 100644 (file)
@@ -2,6 +2,7 @@
 #define _LINUX_VIRTIO_BLK_H
 /* This header is BSD licensed so anyone can use the definitions to implement
  * compatible drivers/servers. */
+#include <linux/types.h>
 #include <linux/virtio_config.h>
 
 /* The ID for virtio_block */
index 7615ffcdd555cb2d3b1fa80b5f380c492881b394..dc161115ae35acdcfd3d54732f7f887194d9cbc1 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef _LINUX_VIRTIO_CONSOLE_H
 #define _LINUX_VIRTIO_CONSOLE_H
+#include <linux/types.h>
 #include <linux/virtio_config.h>
 /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
  * anyone can use the definitions to implement compatible drivers/servers. */
index 5cdd0aa8bde94b0d53c37fe8bf463b9d07845c15..3efa86c3ecb30ca4f7ce50d4319989373d4fbc2c 100644 (file)
@@ -2,6 +2,7 @@
 #define _LINUX_VIRTIO_NET_H
 /* This header is BSD licensed so anyone can use the definitions to implement
  * compatible drivers/servers. */
+#include <linux/types.h>
 #include <linux/virtio_config.h>
 
 /* The ID for virtio_net */
index ef609f842faca33c6e9dded2db7bbd09d7adc8d1..a210ede73b568d25bc672b44c8bd17986d326b7e 100644 (file)
@@ -132,6 +132,8 @@ static inline void __remove_wait_queue(wait_queue_head_t *head,
        list_del(&old->task_list);
 }
 
+void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
+                       int nr_exclusive, int sync, void *key);
 void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
 extern void __wake_up_locked(wait_queue_head_t *q, unsigned int mode);
 extern void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
@@ -333,16 +335,19 @@ do {                                                                      \
        for (;;) {                                                      \
                prepare_to_wait_exclusive(&wq, &__wait,                 \
                                        TASK_INTERRUPTIBLE);            \
-               if (condition)                                          \
+               if (condition) {                                        \
+                       finish_wait(&wq, &__wait);                      \
                        break;                                          \
+               }                                                       \
                if (!signal_pending(current)) {                         \
                        schedule();                                     \
                        continue;                                       \
                }                                                       \
                ret = -ERESTARTSYS;                                     \
+               abort_exclusive_wait(&wq, &__wait,                      \
+                               TASK_INTERRUPTIBLE, NULL);              \
                break;                                                  \
        }                                                               \
-       finish_wait(&wq, &__wait);                                      \
 } while (0)
 
 #define wait_event_interruptible_exclusive(wq, condition)              \
@@ -431,6 +436,8 @@ extern long interruptible_sleep_on_timeout(wait_queue_head_t *q,
 void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state);
 void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state);
 void finish_wait(wait_queue_head_t *q, wait_queue_t *wait);
+void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait,
+                       unsigned int mode, void *key);
 int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
 int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
 
index 9bf4ccc93dbf9ff591df4eecc6f4358d527d14fe..55e41afd95ef39c59c8d110e9ebc7eed476e7812 100644 (file)
@@ -94,16 +94,16 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
 /* Call the specified callback for all subdevs matching grp_id (if 0, then
    match them all). Ignore any errors. Note that you cannot add or delete
    a subdev while walking the subdevs list. */
-#define v4l2_device_call_all(dev, grp_id, o, f, args...)               \
+#define v4l2_device_call_all(dev, grpid, o, f, args...)                \
        __v4l2_device_call_subdevs(dev,                                 \
-                       !(grp_id) || sd->grp_id == (grp_id), o, f , ##args)
+                       !(grpid) || sd->grp_id == (grpid), o, f , ##args)
 
 /* Call the specified callback for all subdevs matching grp_id (if 0, then
    match them all). If the callback returns an error other than 0 or
    -ENOIOCTLCMD, then return with that error code. Note that you cannot
    add or delete a subdev while walking the subdevs list. */
-#define v4l2_device_call_until_err(dev, grp_id, o, f, args...)                 \
+#define v4l2_device_call_until_err(dev, grpid, o, f, args...)          \
        __v4l2_device_call_subdevs_until_err(dev,                       \
-                      !(grp_id) || sd->grp_id == (grp_id), o, f , ##args)
+                      !(grpid) || sd->grp_id == (grpid), o, f , ##args)
 
 #endif
index 90edd22d343c96a2011380964d31ef61bea9ee37..dda47f0082e99e1e405d29fa0577a492330ccf6f 100644 (file)
@@ -49,7 +49,7 @@ struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages,
  *     does memory allocation too using vmalloc_32().
  *
  * videobuf_dma_*()
- *     see Documentation/DMA-mapping.txt, these functions to
+ *     see Documentation/PCI/PCI-DMA-mapping.txt, these functions to
  *     basically the same.  The map function does also build a
  *     scatterlist for the buffer (and unmap frees it ...)
  *
index e17eda302b2d6c505902d8992f89712f362c9197..d409d489d900563b0fc557fc6a84e42fb420594e 100644 (file)
@@ -6,6 +6,8 @@
 #ifndef __MTD_INFTL_USER_H__
 #define __MTD_INFTL_USER_H__
 
+#include <linux/types.h>
+
 #define        OSAK_VERSION    0x5120
 #define        PERCENTUSED     98
 
index 2dc2eb2b8e2210ea17f29602473b4d9bc7c4ac66..296efae3525efe7164a8176035cc55631f5bd59d 100644 (file)
  * UBI volume creation
  * ~~~~~~~~~~~~~~~~~~~
  *
- * UBI volumes are created via the %UBI_IOCMKVOL IOCTL command of UBI character
+ * UBI volumes are created via the %UBI_IOCMKVOL ioctl command of UBI character
  * device. A &struct ubi_mkvol_req object has to be properly filled and a
- * pointer to it has to be passed to the IOCTL.
+ * pointer to it has to be passed to the ioctl.
  *
  * UBI volume deletion
  * ~~~~~~~~~~~~~~~~~~~
  *
- * To delete a volume, the %UBI_IOCRMVOL IOCTL command of the UBI character
+ * To delete a volume, the %UBI_IOCRMVOL ioctl command of the UBI character
  * device should be used. A pointer to the 32-bit volume ID hast to be passed
- * to the IOCTL.
+ * to the ioctl.
  *
  * UBI volume re-size
  * ~~~~~~~~~~~~~~~~~~
  *
- * To re-size a volume, the %UBI_IOCRSVOL IOCTL command of the UBI character
+ * To re-size a volume, the %UBI_IOCRSVOL ioctl command of the UBI character
  * device should be used. A &struct ubi_rsvol_req object has to be properly
- * filled and a pointer to it has to be passed to the IOCTL.
+ * filled and a pointer to it has to be passed to the ioctl.
  *
  * UBI volumes re-name
  * ~~~~~~~~~~~~~~~~~~~
  *
  * To re-name several volumes atomically at one go, the %UBI_IOCRNVOL command
  * of the UBI character device should be used. A &struct ubi_rnvol_req object
- * has to be properly filled and a pointer to it has to be passed to the IOCTL.
+ * has to be properly filled and a pointer to it has to be passed to the ioctl.
  *
  * UBI volume update
  * ~~~~~~~~~~~~~~~~~
  *
- * Volume update should be done via the %UBI_IOCVOLUP IOCTL command of the
+ * Volume update should be done via the %UBI_IOCVOLUP ioctl command of the
  * corresponding UBI volume character device. A pointer to a 64-bit update
- * size should be passed to the IOCTL. After this, UBI expects user to write
+ * size should be passed to the ioctl. After this, UBI expects user to write
  * this number of bytes to the volume character device. The update is finished
  * when the claimed number of bytes is passed. So, the volume update sequence
  * is something like:
  * write(fd, buf, image_size);
  * close(fd);
  *
- * Atomic eraseblock change
+ * Logical eraseblock erase
  * ~~~~~~~~~~~~~~~~~~~~~~~~
  *
- * Atomic eraseblock change operation is done via the %UBI_IOCEBCH IOCTL
- * command of the corresponding UBI volume character device. A pointer to
- * &struct ubi_leb_change_req has to be passed to the IOCTL. Then the user is
- * expected to write the requested amount of bytes. This is similar to the
- * "volume update" IOCTL.
+ * To erase a logical eraseblock, the %UBI_IOCEBER ioctl command of the
+ * corresponding UBI volume character device should be used. This command
+ * unmaps the requested logical eraseblock, makes sure the corresponding
+ * physical eraseblock is successfully erased, and returns.
+ *
+ * Atomic logical eraseblock change
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * Atomic logical eraseblock change operation is called using the %UBI_IOCEBCH
+ * ioctl command of the corresponding UBI volume character device. A pointer to
+ * a &struct ubi_leb_change_req object has to be passed to the ioctl. Then the
+ * user is expected to write the requested amount of bytes (similarly to what
+ * should be done in case of the "volume update" ioctl).
+ *
+ * Logical eraseblock map
+ * ~~~~~~~~~~~~~~~~~~~~~
+ *
+ * To map a logical eraseblock to a physical eraseblock, the %UBI_IOCEBMAP
+ * ioctl command should be used. A pointer to a &struct ubi_map_req object is
+ * expected to be passed. The ioctl maps the requested logical eraseblock to
+ * a physical eraseblock and returns.  Only non-mapped logical eraseblocks can
+ * be mapped. If the logical eraseblock specified in the request is already
+ * mapped to a physical eraseblock, the ioctl fails and returns error.
+ *
+ * Logical eraseblock unmap
+ * ~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * To unmap a logical eraseblock to a physical eraseblock, the %UBI_IOCEBUNMAP
+ * ioctl command should be used. The ioctl unmaps the logical eraseblocks,
+ * schedules corresponding physical eraseblock for erasure, and returns. Unlike
+ * the "LEB erase" command, it does not wait for the physical eraseblock being
+ * erased. Note, the side effect of this is that if an unclean reboot happens
+ * after the unmap ioctl returns, you may find the LEB mapped again to the same
+ * physical eraseblock after the UBI is run again.
+ *
+ * Check if logical eraseblock is mapped
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * To check if a logical eraseblock is mapped to a physical eraseblock, the
+ * %UBI_IOCEBISMAP ioctl command should be used. It returns %0 if the LEB is
+ * not mapped, and %1 if it is mapped.
+ *
+ * Set an UBI volume property
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * To set an UBI volume property the %UBI_IOCSETPROP ioctl command should be
+ * used. A pointer to a &struct ubi_set_prop_req object is expected to be
+ * passed. The object describes which property should be set, and to which value
+ * it should be set.
  */
 
 /*
 /* Maximum volume name length */
 #define UBI_MAX_VOLUME_NAME 127
 
-/* IOCTL commands of UBI character devices */
+/* ioctl commands of UBI character devices */
 
 #define UBI_IOC_MAGIC 'o'
 
 /* Re-name volumes */
 #define UBI_IOCRNVOL _IOW(UBI_IOC_MAGIC, 3, struct ubi_rnvol_req)
 
-/* IOCTL commands of the UBI control character device */
+/* ioctl commands of the UBI control character device */
 
 #define UBI_CTRL_IOC_MAGIC 'o'
 
 /* Detach an MTD device */
 #define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, int32_t)
 
-/* IOCTL commands of UBI volume character devices */
+/* ioctl commands of UBI volume character devices */
 
 #define UBI_VOL_IOC_MAGIC 'O'
 
 /* Start UBI volume update */
 #define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, int64_t)
-/* An eraseblock erasure command, used for debugging, disabled by default */
+/* LEB erasure command, used for debugging, disabled by default */
 #define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, int32_t)
-/* An atomic eraseblock change command */
+/* Atomic LEB change command */
 #define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, int32_t)
+/* Map LEB command */
+#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req)
+/* Unmap LEB command */
+#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, int32_t)
+/* Check if LEB is mapped command */
+#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, int32_t)
+/* Set an UBI volume property */
+#define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req)
 
 /* Maximum MTD device name length supported by UBI */
 #define MAX_UBI_MTD_NAME_LEN 127
@@ -168,6 +220,16 @@ enum {
        UBI_STATIC_VOLUME  = 4,
 };
 
+/*
+ * UBI set property ioctl constants
+ *
+ * @UBI_PROP_DIRECT_WRITE: allow / disallow user to directly write and
+ *                         erase individual eraseblocks on dynamic volumes
+ */
+enum {
+       UBI_PROP_DIRECT_WRITE = 1,
+};
+
 /**
  * struct ubi_attach_req - attach MTD device request.
  * @ubi_num: UBI device number to create
@@ -305,8 +367,8 @@ struct ubi_rnvol_req {
 } __attribute__ ((packed));
 
 /**
- * struct ubi_leb_change_req - a data structure used in atomic logical
- *                             eraseblock change requests.
+ * struct ubi_leb_change_req - a data structure used in atomic LEB change
+ *                             requests.
  * @lnum: logical eraseblock number to change
  * @bytes: how many bytes will be written to the logical eraseblock
  * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN)
@@ -319,4 +381,30 @@ struct ubi_leb_change_req {
        int8_t  padding[7];
 } __attribute__ ((packed));
 
+/**
+ * struct ubi_map_req - a data structure used in map LEB requests.
+ * @lnum: logical eraseblock number to unmap
+ * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN)
+ * @padding: reserved for future, not used, has to be zeroed
+ */
+struct ubi_map_req {
+       int32_t lnum;
+       int8_t  dtype;
+       int8_t  padding[3];
+} __attribute__ ((packed));
+
+
+/**
+ * struct ubi_set_prop_req - a data structure used to set an ubi volume
+ *                           property.
+ * @property: property to set (%UBI_PROP_DIRECT_WRITE)
+ * @padding: reserved for future, not used, has to be zeroed
+ * @value: value to set
+ */
+struct ubi_set_prop_req {
+       uint8_t  property;
+       uint8_t  padding[7];
+       uint64_t value;
+}  __attribute__ ((packed));
+
 #endif /* __UBI_USER_H__ */
index f44bb5c77a70cdb4d5cfdea2688a1a8ec3492b20..d0a043153cc6741de298c53f18773f05adc0b0ba 100644 (file)
@@ -182,7 +182,7 @@ static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo)
                size = 2048;
        if (nr_pcpus >= 32)
                size = 4096;
-       if (sizeof(rwlock_t) != 0) {
+       if (sizeof(spinlock_t) != 0) {
 #ifdef CONFIG_NUMA
                if (size * sizeof(spinlock_t) > PAGE_SIZE)
                        hashinfo->ehash_locks = vmalloc(size * sizeof(spinlock_t));
index dec6b1dc37eab02c0c7ed2e498b08db1240b87fb..d98a78dff2db291e97c77fc16bde746d9f10f9f9 100644 (file)
@@ -19,6 +19,8 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <linux/types.h>
+
 #define HDSP_MATRIX_MIXER_SIZE 2048
 
 enum HDSP_IO_Type {
index 7079beb005e812a9daad7aca630f6da9b05f26e2..51ac69f05bdcc6d547a7671f2a072e0f6a20f353 100644 (file)
@@ -21,9 +21,9 @@
 #define I2C_CNTL_1                             0x0094
 #define PALETTE_INDEX                          0x00b0
 #define PALETTE_DATA                           0x00b4
-#define CONFIG_CNTL                            0x00e0
+#define CNFG_CNTL                              0x00e0
 #define GEN_RESET_CNTL                         0x00f0
-#define CONFIG_MEMSIZE                         0x00f8
+#define CNFG_MEMSIZE                           0x00f8
 #define MEM_CNTL                               0x0140
 #define MEM_POWER_MISC                         0x015c
 #define AGP_BASE                               0x0170
index a8332e528ec19ef6d7b50540e615ec108ce36a0f..89e91c0cb737ba2aeca917f6b514a1a14ae0ddca 100644 (file)
 #define CUR_HORZ_VERT_OFF      0x0070  /* Dword offset 0_1C */
 #define CUR2_HORZ_VERT_OFF     0x0070  /* Dword offset 0_1C */
 
-#define CONFIG_PANEL_LG                0x0074  /* Dword offset 0_1D (LG) */
+#define CNFG_PANEL_LG          0x0074  /* Dword offset 0_1D (LG) */
 
 /* General I/O Control */
 #define GP_IO                  0x0078  /* Dword offset 0_1E */
 #define CLOCK_SEL_CNTL         0x0090  /* Dword offset 0_24 */
 
 /* Configuration */
-#define CONFIG_STAT1           0x0094  /* Dword offset 0_25 */
-#define CONFIG_STAT2           0x0098  /* Dword offset 0_26 */
+#define CNFG_STAT1             0x0094  /* Dword offset 0_25 */
+#define CNFG_STAT2             0x0098  /* Dword offset 0_26 */
 
 /* Bus Control */
 #define BUS_CNTL               0x00A0  /* Dword offset 0_28 */
 #define POWER_MANAGEMENT_LG    0x00D8  /* Dword offset 0_36 (LG) */
 
 /* Configuration */
-#define CONFIG_CNTL            0x00DC  /* Dword offset 0_37 (CT, ET, VT) */
-#define CONFIG_CHIP_ID         0x00E0  /* Dword offset 0_38 */
-#define CONFIG_STAT0           0x00E4  /* Dword offset 0_39 */
+#define CNFG_CNTL              0x00DC  /* Dword offset 0_37 (CT, ET, VT) */
+#define CNFG_CHIP_ID           0x00E0  /* Dword offset 0_38 */
+#define CNFG_STAT0             0x00E4  /* Dword offset 0_39 */
 
 /* Test and Debug */
 #define CRC_SIG                        0x00E8  /* Dword offset 0_3A */
 #define PLL_YCLK_CNTL          0x29
 #define PM_DYN_CLK_CNTL                0x2A
 
-/* CONFIG_CNTL register constants */
+/* CNFG_CNTL register constants */
 #define APERTURE_4M_ENABLE     1
 #define APERTURE_8M_ENABLE     2
 #define VGA_APERTURE_ENABLE    4
 
-/* CONFIG_STAT0 register constants (GX, CX) */
+/* CNFG_STAT0 register constants (GX, CX) */
 #define CFG_BUS_TYPE           0x00000007
 #define CFG_MEM_TYPE           0x00000038
 #define CFG_INIT_DAC_TYPE      0x00000e00
 
-/* CONFIG_STAT0 register constants (CT, ET, VT) */
+/* CNFG_STAT0 register constants (CT, ET, VT) */
 #define CFG_MEM_TYPE_xT                0x00000007
 
 #define ISA                    0
 #define PCI_ATI_VENDOR_ID      0x1002
 
 
-/* CONFIG_CHIP_ID register constants */
+/* CNFG_CHIP_ID register constants */
 #define CFG_CHIP_TYPE          0x0000FFFF
 #define CFG_CHIP_CLASS         0x00FF0000
 #define CFG_CHIP_REV           0xFF000000
 #define CFG_CHIP_MINOR         0xC0000000
 
 
-/* Chip IDs read from CONFIG_CHIP_ID */
+/* Chip IDs read from CNFG_CHIP_ID */
 
 /* mach64GX family */
 #define GX_CHIP_ID     0xD7    /* mach64GX (ATI888GX00) */
 #define CRTC2_DISPLAY_DIS      0x00000400
 
 /* LCD register indices */
-#define CONFIG_PANEL           0x00
+#define CNFG_PANEL             0x00
 #define LCD_GEN_CNTL           0x01
 #define DSTN_CONTROL           0x02
 #define HFB_PITCH_ADDR         0x03
index 1cd09cc5b169460609ca91f7d71edaba6a32f284..e072b16b39abf88bb0bb4e2281d0bf09dd00f0bc 100644 (file)
 #define HI_STAT                                0x004C  
 #define BUS_CNTL1                              0x0034
 #define I2C_CNTL_1                            0x0094  
-#define CONFIG_CNTL                            0x00E0  
-#define CONFIG_MEMSIZE                         0x00F8  
-#define CONFIG_APER_0_BASE                     0x0100  
-#define CONFIG_APER_1_BASE                     0x0104  
-#define CONFIG_APER_SIZE                       0x0108  
-#define CONFIG_REG_1_BASE                      0x010C  
-#define CONFIG_REG_APER_SIZE                   0x0110  
+#define CNFG_CNTL                              0x00E0
+#define CNFG_MEMSIZE                           0x00F8
+#define CNFG_APER_0_BASE                       0x0100
+#define CNFG_APER_1_BASE                       0x0104
+#define CNFG_APER_SIZE                         0x0108
+#define CNFG_REG_1_BASE                        0x010C
+#define CNFG_REG_APER_SIZE                     0x0110
 #define PAD_AGPINPUT_DELAY                     0x0164  
 #define PAD_CTLR_STRENGTH                      0x0168  
 #define PAD_CTLR_UPDATE                        0x016C
 /* CLOCK_CNTL_INDEX bit constants */
 #define PLL_WR_EN                                  0x00000080
 
-/* CONFIG_CNTL bit constants */
+/* CNFG_CNTL bit constants */
 #define CFG_VGA_RAM_EN                             0x00000100
 #define CFG_ATI_REV_ID_MASK                       (0xf << 16)
 #define CFG_ATI_REV_A11                                   (0 << 16)
 
 /* masks */
 
-#define CONFIG_MEMSIZE_MASK            0x1f000000
+#define CNFG_MEMSIZE_MASK              0x1f000000
 #define MEM_CFG_TYPE                   0x40000000
 #define DST_OFFSET_MASK                        0x003fffff
 #define DST_PITCH_MASK                 0x3fc00000
index e402eb5b3c7a2b74f08da85c26d5e947989f65d1..fdd74f1a67914f9c024f8268d8f5ea6af3b66cd9 100644 (file)
@@ -21,8 +21,8 @@
 #ifndef _LINUX_SISFB_H_
 #define _LINUX_SISFB_H_
 
+#include <linux/types.h>
 #include <asm/ioctl.h>
-#include <asm/types.h>
 
 /**********************************************/
 /*                   PUBLIC                   */
index 95bcef19395482b089e3ea421ddb24395c394dfb..0993a220a3e61fb7a2b21b9cf2eeb311025e18a9 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _UVESAFB_H
 #define _UVESAFB_H
 
+#include <linux/types.h>
+
 struct v86_regs {
        __u32 ebx;
        __u32 ecx;
index a9e09ad2263e36e611c8e7599e34115cfb467b92..f8f69fad3a27879e1f0bf82725c196455dec81c8 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -368,14 +368,14 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
                file = hugetlb_file_setup(name, size);
                shp->mlock_user = current_user();
        } else {
-               int acctflag = VM_ACCOUNT;
+               int acctflag = 0;
                /*
                 * Do not allow no accounting for OVERCOMMIT_NEVER, even
                 * if it's asked for.
                 */
                if  ((shmflg & SHM_NORESERVE) &&
                                sysctl_overcommit_memory != OVERCOMMIT_NEVER)
-                       acctflag = 0;
+                       acctflag = VM_NORESERVE;
                file = shmem_file_setup(name, size, acctflag);
        }
        error = PTR_ERR(file);
@@ -565,11 +565,15 @@ static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss,
                        struct hstate *h = hstate_file(shp->shm_file);
                        *rss += pages_per_huge_page(h) * mapping->nrpages;
                } else {
+#ifdef CONFIG_SHMEM
                        struct shmem_inode_info *info = SHMEM_I(inode);
                        spin_lock(&info->lock);
                        *rss += inode->i_mapping->nrpages;
                        *swp += info->swapped;
                        spin_unlock(&info->lock);
+#else
+                       *rss += inode->i_mapping->nrpages;
+#endif
                }
 
                total++;
index 608b32b42812d2c40f54782c0bf07d7d744f10be..f565891f2c9bd069873b93c12e7ecb0424876c90 100644 (file)
@@ -54,6 +54,7 @@ asynchronous and synchronous parts of the kernel.
 #include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/kthread.h>
+#include <linux/delay.h>
 #include <asm/atomic.h>
 
 static async_cookie_t next_cookie = 1;
@@ -132,21 +133,23 @@ static void run_one_entry(void)
        entry = list_first_entry(&async_pending, struct async_entry, list);
 
        /* 2) move it to the running queue */
-       list_del(&entry->list);
-       list_add_tail(&entry->list, &async_running);
+       list_move_tail(&entry->list, entry->running);
        spin_unlock_irqrestore(&async_lock, flags);
 
        /* 3) run it (and print duration)*/
        if (initcall_debug && system_state == SYSTEM_BOOTING) {
-               printk("calling  %lli_%pF @ %i\n", entry->cookie, entry->func, task_pid_nr(current));
+               printk("calling  %lli_%pF @ %i\n", (long long)entry->cookie,
+                       entry->func, task_pid_nr(current));
                calltime = ktime_get();
        }
        entry->func(entry->data, entry->cookie);
        if (initcall_debug && system_state == SYSTEM_BOOTING) {
                rettime = ktime_get();
                delta = ktime_sub(rettime, calltime);
-               printk("initcall %lli_%pF returned 0 after %lld usecs\n", entry->cookie,
-                       entry->func, ktime_to_ns(delta) >> 10);
+               printk("initcall %lli_%pF returned 0 after %lld usecs\n",
+                       (long long)entry->cookie,
+                       entry->func,
+                       (long long)ktime_to_ns(delta) >> 10);
        }
 
        /* 4) remove it from the running queue */
@@ -205,18 +208,44 @@ static async_cookie_t __async_schedule(async_func_ptr *ptr, void *data, struct l
        return newcookie;
 }
 
+/**
+ * async_schedule - schedule a function for asynchronous execution
+ * @ptr: function to execute asynchronously
+ * @data: data pointer to pass to the function
+ *
+ * Returns an async_cookie_t that may be used for checkpointing later.
+ * Note: This function may be called from atomic or non-atomic contexts.
+ */
 async_cookie_t async_schedule(async_func_ptr *ptr, void *data)
 {
-       return __async_schedule(ptr, data, &async_pending);
+       return __async_schedule(ptr, data, &async_running);
 }
 EXPORT_SYMBOL_GPL(async_schedule);
 
-async_cookie_t async_schedule_special(async_func_ptr *ptr, void *data, struct list_head *running)
+/**
+ * async_schedule_domain - schedule a function for asynchronous execution within a certain domain
+ * @ptr: function to execute asynchronously
+ * @data: data pointer to pass to the function
+ * @running: running list for the domain
+ *
+ * Returns an async_cookie_t that may be used for checkpointing later.
+ * @running may be used in the async_synchronize_*_domain() functions
+ * to wait within a certain synchronization domain rather than globally.
+ * A synchronization domain is specified via the running queue @running to use.
+ * Note: This function may be called from atomic or non-atomic contexts.
+ */
+async_cookie_t async_schedule_domain(async_func_ptr *ptr, void *data,
+                                    struct list_head *running)
 {
        return __async_schedule(ptr, data, running);
 }
-EXPORT_SYMBOL_GPL(async_schedule_special);
+EXPORT_SYMBOL_GPL(async_schedule_domain);
 
+/**
+ * async_synchronize_full - synchronize all asynchronous function calls
+ *
+ * This function waits until all asynchronous function calls have been done.
+ */
 void async_synchronize_full(void)
 {
        do {
@@ -225,13 +254,30 @@ void async_synchronize_full(void)
 }
 EXPORT_SYMBOL_GPL(async_synchronize_full);
 
-void async_synchronize_full_special(struct list_head *list)
+/**
+ * async_synchronize_full_domain - synchronize all asynchronous function within a certain domain
+ * @list: running list to synchronize on
+ *
+ * This function waits until all asynchronous function calls for the
+ * synchronization domain specified by the running list @list have been done.
+ */
+void async_synchronize_full_domain(struct list_head *list)
 {
-       async_synchronize_cookie_special(next_cookie, list);
+       async_synchronize_cookie_domain(next_cookie, list);
 }
-EXPORT_SYMBOL_GPL(async_synchronize_full_special);
+EXPORT_SYMBOL_GPL(async_synchronize_full_domain);
 
-void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *running)
+/**
+ * async_synchronize_cookie_domain - synchronize asynchronous function calls within a certain domain with cookie checkpointing
+ * @cookie: async_cookie_t to use as checkpoint
+ * @running: running list to synchronize on
+ *
+ * This function waits until all asynchronous function calls for the
+ * synchronization domain specified by the running list @list submitted
+ * prior to @cookie have been done.
+ */
+void async_synchronize_cookie_domain(async_cookie_t cookie,
+                                    struct list_head *running)
 {
        ktime_t starttime, delta, endtime;
 
@@ -247,14 +293,22 @@ void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *r
                delta = ktime_sub(endtime, starttime);
 
                printk("async_continuing @ %i after %lli usec\n",
-                       task_pid_nr(current), ktime_to_ns(delta) >> 10);
+                       task_pid_nr(current),
+                       (long long)ktime_to_ns(delta) >> 10);
        }
 }
-EXPORT_SYMBOL_GPL(async_synchronize_cookie_special);
+EXPORT_SYMBOL_GPL(async_synchronize_cookie_domain);
 
+/**
+ * async_synchronize_cookie - synchronize asynchronous function calls with cookie checkpointing
+ * @cookie: async_cookie_t to use as checkpoint
+ *
+ * This function waits until all asynchronous function calls prior to @cookie
+ * have been done.
+ */
 void async_synchronize_cookie(async_cookie_t cookie)
 {
-       async_synchronize_cookie_special(cookie, &async_running);
+       async_synchronize_cookie_domain(cookie, &async_running);
 }
 EXPORT_SYMBOL_GPL(async_synchronize_cookie);
 
@@ -315,7 +369,11 @@ static int async_manager_thread(void *unused)
                ec = atomic_read(&entry_count);
 
                while (tc < ec && tc < MAX_THREADS) {
-                       kthread_run(async_thread, NULL, "async/%i", tc);
+                       if (IS_ERR(kthread_run(async_thread, NULL, "async/%i",
+                                              tc))) {
+                               msleep(100);
+                               continue;
+                       }
                        atomic_inc(&thread_count);
                        tc++;
                }
@@ -330,7 +388,9 @@ static int async_manager_thread(void *unused)
 static int __init async_init(void)
 {
        if (async_enabled)
-               kthread_run(async_manager_thread, NULL, "async/mgr");
+               if (IS_ERR(kthread_run(async_manager_thread, NULL,
+                                      "async/mgr")))
+                       async_enabled = 0;
        return 0;
 }
 
index c29831076e7a2e156e584725453c51568682eb93..5a54ff42874ee916997139c859b8cfda725b9a33 100644 (file)
@@ -1115,8 +1115,10 @@ static void cgroup_kill_sb(struct super_block *sb) {
        }
        write_unlock(&css_set_lock);
 
-       list_del(&root->root_list);
-       root_count--;
+       if (!list_empty(&root->root_list)) {
+               list_del(&root->root_list);
+               root_count--;
+       }
 
        mutex_unlock(&cgroup_mutex);
 
@@ -2434,7 +2436,9 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
 
  err_remove:
 
+       cgroup_lock_hierarchy(root);
        list_del(&cgrp->sibling);
+       cgroup_unlock_hierarchy(root);
        root->number_of_cgroups--;
 
  err_destroy:
@@ -2507,7 +2511,7 @@ static int cgroup_clear_css_refs(struct cgroup *cgrp)
        for_each_subsys(cgrp->root, ss) {
                struct cgroup_subsys_state *css = cgrp->subsys[ss->subsys_id];
                int refcnt;
-               do {
+               while (1) {
                        /* We can only remove a CSS with a refcnt==1 */
                        refcnt = atomic_read(&css->refcnt);
                        if (refcnt > 1) {
@@ -2521,7 +2525,10 @@ static int cgroup_clear_css_refs(struct cgroup *cgrp)
                         * css_tryget() to spin until we set the
                         * CSS_REMOVED bits or abort
                         */
-               } while (atomic_cmpxchg(&css->refcnt, refcnt, 0) != refcnt);
+                       if (atomic_cmpxchg(&css->refcnt, refcnt, 0) == refcnt)
+                               break;
+                       cpu_relax();
+               }
        }
  done:
        for_each_subsys(cgrp->root, ss) {
@@ -2991,20 +2998,21 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys,
                mutex_unlock(&cgroup_mutex);
                return 0;
        }
-       task_lock(tsk);
-       cg = tsk->cgroups;
-       parent = task_cgroup(tsk, subsys->subsys_id);
 
        /* Pin the hierarchy */
-       if (!atomic_inc_not_zero(&parent->root->sb->s_active)) {
+       if (!atomic_inc_not_zero(&root->sb->s_active)) {
                /* We race with the final deactivate_super() */
                mutex_unlock(&cgroup_mutex);
                return 0;
        }
 
        /* Keep the cgroup alive */
+       task_lock(tsk);
+       parent = task_cgroup(tsk, subsys->subsys_id);
+       cg = tsk->cgroups;
        get_css_set(cg);
        task_unlock(tsk);
+
        mutex_unlock(&cgroup_mutex);
 
        /* Now do the VFS work to create a cgroup */
@@ -3043,7 +3051,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys,
                mutex_unlock(&inode->i_mutex);
                put_css_set(cg);
 
-               deactivate_super(parent->root->sb);
+               deactivate_super(root->sb);
                /* The cgroup is still accessible in the VFS, but
                 * we're not going to try to rmdir() it at this
                 * point. */
@@ -3069,7 +3077,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys,
        mutex_lock(&cgroup_mutex);
        put_css_set(cg);
        mutex_unlock(&cgroup_mutex);
-       deactivate_super(parent->root->sb);
+       deactivate_super(root->sb);
        return ret;
 }
 
index a85678865c5eca291f4c9a06e1b5005e3c79c06b..f76db9dcaa05e592f3138f5389ae4c22827b58d9 100644 (file)
 #include <linux/workqueue.h>
 #include <linux/cgroup.h>
 
+/*
+ * Workqueue for cpuset related tasks.
+ *
+ * Using kevent workqueue may cause deadlock when memory_migrate
+ * is set. So we create a separate workqueue thread for cpuset.
+ */
+static struct workqueue_struct *cpuset_wq;
+
 /*
  * Tracks how many cpusets are currently defined in system.
  * When there is only one cpuset (the root cpuset) we can
@@ -831,7 +839,7 @@ static DECLARE_WORK(rebuild_sched_domains_work, do_rebuild_sched_domains);
  */
 static void async_rebuild_sched_domains(void)
 {
-       schedule_work(&rebuild_sched_domains_work);
+       queue_work(cpuset_wq, &rebuild_sched_domains_work);
 }
 
 /*
@@ -2111,6 +2119,9 @@ void __init cpuset_init_smp(void)
 
        hotcpu_notifier(cpuset_track_online_cpus, 0);
        hotplug_memory_notifier(cpuset_track_online_nodes, 10);
+
+       cpuset_wq = create_singlethread_workqueue("cpuset");
+       BUG_ON(!cpuset_wq);
 }
 
 /**
index 242a706e77218073f74b9b8aa44ca589aaa1cbf4..6d5dbb7a13e253132f9281fcfaf9a112f576ff38 100644 (file)
@@ -1005,6 +1005,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
         * triggers too late. This doesn't hurt, the check is only there
         * to stop root fork bombs.
         */
+       retval = -EAGAIN;
        if (nr_threads >= max_threads)
                goto bad_fork_cleanup_count;
 
index f33afb0407bcdc5c6d6a21e06cd41dde40d46d84..f394d2a42ca3442a048d6c9586ec8bfd6cfe4487 100644 (file)
@@ -501,6 +501,13 @@ static void hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base)
                        continue;
                timer = rb_entry(base->first, struct hrtimer, node);
                expires = ktime_sub(hrtimer_get_expires(timer), base->offset);
+               /*
+                * clock_was_set() has changed base->offset so the
+                * result might be negative. Fix it up to prevent a
+                * false positive in clockevents_program_event()
+                */
+               if (expires.tv64 < 0)
+                       expires.tv64 = 0;
                if (expires.tv64 < cpu_base->expires_next.tv64)
                        cpu_base->expires_next = expires;
        }
@@ -1158,6 +1165,29 @@ static void __run_hrtimer(struct hrtimer *timer)
 
 #ifdef CONFIG_HIGH_RES_TIMERS
 
+static int force_clock_reprogram;
+
+/*
+ * After 5 iteration's attempts, we consider that hrtimer_interrupt()
+ * is hanging, which could happen with something that slows the interrupt
+ * such as the tracing. Then we force the clock reprogramming for each future
+ * hrtimer interrupts to avoid infinite loops and use the min_delta_ns
+ * threshold that we will overwrite.
+ * The next tick event will be scheduled to 3 times we currently spend on
+ * hrtimer_interrupt(). This gives a good compromise, the cpus will spend
+ * 1/4 of their time to process the hrtimer interrupts. This is enough to
+ * let it running without serious starvation.
+ */
+
+static inline void
+hrtimer_interrupt_hanging(struct clock_event_device *dev,
+                       ktime_t try_time)
+{
+       force_clock_reprogram = 1;
+       dev->min_delta_ns = (unsigned long)try_time.tv64 * 3;
+       printk(KERN_WARNING "hrtimer: interrupt too slow, "
+               "forcing clock min delta to %lu ns\n", dev->min_delta_ns);
+}
 /*
  * High resolution timer interrupt
  * Called with interrupts disabled
@@ -1167,6 +1197,7 @@ void hrtimer_interrupt(struct clock_event_device *dev)
        struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
        struct hrtimer_clock_base *base;
        ktime_t expires_next, now;
+       int nr_retries = 0;
        int i;
 
        BUG_ON(!cpu_base->hres_active);
@@ -1174,6 +1205,10 @@ void hrtimer_interrupt(struct clock_event_device *dev)
        dev->next_event.tv64 = KTIME_MAX;
 
  retry:
+       /* 5 retries is enough to notice a hang */
+       if (!(++nr_retries % 5))
+               hrtimer_interrupt_hanging(dev, ktime_sub(ktime_get(), now));
+
        now = ktime_get();
 
        expires_next.tv64 = KTIME_MAX;
@@ -1226,7 +1261,7 @@ void hrtimer_interrupt(struct clock_event_device *dev)
 
        /* Reprogramming necessary ? */
        if (expires_next.tv64 != KTIME_MAX) {
-               if (tick_program_event(expires_next, 0))
+               if (tick_program_event(expires_next, force_clock_reprogram))
                        goto retry;
        }
 }
@@ -1580,6 +1615,10 @@ static int __cpuinit hrtimer_cpu_notify(struct notifier_block *self,
                break;
 
 #ifdef CONFIG_HOTPLUG_CPU
+       case CPU_DYING:
+       case CPU_DYING_FROZEN:
+               clockevents_notify(CLOCK_EVT_NOTIFY_CPU_DYING, &scpu);
+               break;
        case CPU_DEAD:
        case CPU_DEAD_FROZEN:
        {
index f63c706d25e15f481f61548dd248d1eaf69702bb..7de11bd64dfe33a2fa8c1091a308ed58b685d0c7 100644 (file)
@@ -383,6 +383,7 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
 out_unlock:
        spin_unlock(&desc->lock);
 }
+EXPORT_SYMBOL_GPL(handle_level_irq);
 
 /**
  *     handle_fasteoi_irq - irq handler for transparent controllers
@@ -593,6 +594,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
        }
        spin_unlock_irqrestore(&desc->lock, flags);
 }
+EXPORT_SYMBOL_GPL(__set_irq_handler);
 
 void
 set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
index ecf765c6a77ac8276b73cc551af07de1c4302f23..acd88356ac76abfcbd186209f16d8e92d2ff31fb 100644 (file)
@@ -71,7 +71,7 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc,
        desc = irq_desc_ptrs[irq];
 
        if (desc && old_desc != desc)
-                       goto out_unlock;
+               goto out_unlock;
 
        node = cpu_to_node(cpu);
        desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node);
@@ -84,10 +84,15 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc,
        init_copy_one_irq_desc(irq, old_desc, desc, cpu);
 
        irq_desc_ptrs[irq] = desc;
+       spin_unlock_irqrestore(&sparse_irq_lock, flags);
 
        /* free the old one */
        free_one_irq_desc(old_desc, desc);
+       spin_unlock(&old_desc->lock);
        kfree(old_desc);
+       spin_lock(&desc->lock);
+
+       return desc;
 
 out_unlock:
        spin_unlock_irqrestore(&sparse_irq_lock, flags);
index e8b51d41dd72cf8170d3404b14dff167978e324a..ba22484a987eb96a9d2bff0cdeede4b62a1d7156 100644 (file)
@@ -573,13 +573,13 @@ static char last_unloaded_module[MODULE_NAME_LEN+1];
 /* Init the unload section of the module. */
 static void module_unload_init(struct module *mod)
 {
-       unsigned int i;
+       int cpu;
 
        INIT_LIST_HEAD(&mod->modules_which_use_me);
-       for (i = 0; i < NR_CPUS; i++)
-               local_set(&mod->ref[i].count, 0);
+       for_each_possible_cpu(cpu)
+               local_set(__module_ref_addr(mod, cpu), 0);
        /* Hold reference count during initialization. */
-       local_set(&mod->ref[raw_smp_processor_id()].count, 1);
+       local_set(__module_ref_addr(mod, raw_smp_processor_id()), 1);
        /* Backwards compatibility macros put refcount during init. */
        mod->waiter = current;
 }
@@ -717,10 +717,11 @@ static int try_stop_module(struct module *mod, int flags, int *forced)
 
 unsigned int module_refcount(struct module *mod)
 {
-       unsigned int i, total = 0;
+       unsigned int total = 0;
+       int cpu;
 
-       for (i = 0; i < NR_CPUS; i++)
-               total += local_read(&mod->ref[i].count);
+       for_each_possible_cpu(cpu)
+               total += local_read(__module_ref_addr(mod, cpu));
        return total;
 }
 EXPORT_SYMBOL(module_refcount);
@@ -894,7 +895,7 @@ void module_put(struct module *module)
 {
        if (module) {
                unsigned int cpu = get_cpu();
-               local_dec(&module->ref[cpu].count);
+               local_dec(__module_ref_addr(module, cpu));
                /* Maybe they're waiting for us to drop reference? */
                if (unlikely(!module_is_live(module)))
                        wake_up_process(module->waiter);
@@ -1464,7 +1465,10 @@ static void free_module(struct module *mod)
        kfree(mod->args);
        if (mod->percpu)
                percpu_modfree(mod->percpu);
-
+#if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
+       if (mod->refptr)
+               percpu_modfree(mod->refptr);
+#endif
        /* Free lock-classes: */
        lockdep_free_key_range(mod->module_core, mod->core_size);
 
@@ -2011,6 +2015,14 @@ static noinline struct module *load_module(void __user *umod,
        if (err < 0)
                goto free_mod;
 
+#if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
+       mod->refptr = percpu_modalloc(sizeof(local_t), __alignof__(local_t),
+                                     mod->name);
+       if (!mod->refptr) {
+               err = -ENOMEM;
+               goto free_mod;
+       }
+#endif
        if (pcpuindex) {
                /* We have a special allocation for this section. */
                percpu = percpu_modalloc(sechdrs[pcpuindex].sh_size,
@@ -2018,7 +2030,7 @@ static noinline struct module *load_module(void __user *umod,
                                         mod->name);
                if (!percpu) {
                        err = -ENOMEM;
-                       goto free_mod;
+                       goto free_percpu;
                }
                sechdrs[pcpuindex].sh_flags &= ~(unsigned long)SHF_ALLOC;
                mod->percpu = percpu;
@@ -2282,6 +2294,9 @@ static noinline struct module *load_module(void __user *umod,
  free_percpu:
        if (percpu)
                percpu_modfree(percpu);
+#if defined(CONFIG_MODULE_UNLOAD) && defined(CONFIG_SMP)
+       percpu_modfree(mod->refptr);
+#endif
  free_mod:
        kfree(args);
  free_hdr:
index 239988873971fed7fde593ab2ad28a3523bd66f5..b4d219016b6ca351f19ad2a08e6f7c9aada2ab7e 100644 (file)
@@ -57,16 +57,6 @@ int pm_notifier_call_chain(unsigned long val)
 #ifdef CONFIG_PM_DEBUG
 int pm_test_level = TEST_NONE;
 
-static int suspend_test(int level)
-{
-       if (pm_test_level == level) {
-               printk(KERN_INFO "suspend debug: Waiting for 5 seconds.\n");
-               mdelay(5000);
-               return 1;
-       }
-       return 0;
-}
-
 static const char * const pm_tests[__TEST_AFTER_LAST] = {
        [TEST_NONE] = "none",
        [TEST_CORE] = "core",
@@ -125,14 +115,24 @@ static ssize_t pm_test_store(struct kobject *kobj, struct kobj_attribute *attr,
 }
 
 power_attr(pm_test);
-#else /* !CONFIG_PM_DEBUG */
-static inline int suspend_test(int level) { return 0; }
-#endif /* !CONFIG_PM_DEBUG */
+#endif /* CONFIG_PM_DEBUG */
 
 #endif /* CONFIG_PM_SLEEP */
 
 #ifdef CONFIG_SUSPEND
 
+static int suspend_test(int level)
+{
+#ifdef CONFIG_PM_DEBUG
+       if (pm_test_level == level) {
+               printk(KERN_INFO "suspend debug: Waiting for 5 seconds.\n");
+               mdelay(5000);
+               return 1;
+       }
+#endif /* !CONFIG_PM_DEBUG */
+       return 0;
+}
+
 #ifdef CONFIG_PM_TEST_SUSPEND
 
 /*
index 52bbf1c842a8e0baecd1cd9f53883806eaab1350..8ee437a5ec1d5186bc411b146a513280533ff998 100644 (file)
@@ -2266,6 +2266,16 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
        if (!sched_feat(SYNC_WAKEUPS))
                sync = 0;
 
+       if (!sync) {
+               if (current->se.avg_overlap < sysctl_sched_migration_cost &&
+                         p->se.avg_overlap < sysctl_sched_migration_cost)
+                       sync = 1;
+       } else {
+               if (current->se.avg_overlap >= sysctl_sched_migration_cost ||
+                         p->se.avg_overlap >= sysctl_sched_migration_cost)
+                       sync = 0;
+       }
+
 #ifdef CONFIG_SMP
        if (sched_feat(LB_WAKEUP_UPDATE)) {
                struct sched_domain *sd;
@@ -4687,8 +4697,8 @@ EXPORT_SYMBOL(default_wake_function);
  * started to run but is not in state TASK_RUNNING. try_to_wake_up() returns
  * zero in this (rare) case, and we handle it by continuing to scan the queue.
  */
-static void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
-                            int nr_exclusive, int sync, void *key)
+void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
+                       int nr_exclusive, int sync, void *key)
 {
        wait_queue_t *curr, *next;
 
index 5cc1c162044fc4f40b15c351cd170ce2c58703f7..a7e50ba185ac0a843ac16604e13a721ca8e4cb8e 100644 (file)
@@ -719,7 +719,7 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup)
                __enqueue_entity(cfs_rq, se);
 }
 
-static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
+static void __clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
        if (cfs_rq->last == se)
                cfs_rq->last = NULL;
@@ -728,6 +728,12 @@ static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
                cfs_rq->next = NULL;
 }
 
+static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
+{
+       for_each_sched_entity(se)
+               __clear_buddies(cfs_rq_of(se), se);
+}
+
 static void
 dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
 {
@@ -768,8 +774,14 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
 
        ideal_runtime = sched_slice(cfs_rq, curr);
        delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime;
-       if (delta_exec > ideal_runtime)
+       if (delta_exec > ideal_runtime) {
                resched_task(rq_of(cfs_rq)->curr);
+               /*
+                * The current task ran long enough, ensure it doesn't get
+                * re-elected due to buddy favours.
+                */
+               clear_buddies(cfs_rq, curr);
+       }
 }
 
 static void
@@ -1179,20 +1191,15 @@ wake_affine(struct sched_domain *this_sd, struct rq *this_rq,
            int idx, unsigned long load, unsigned long this_load,
            unsigned int imbalance)
 {
-       struct task_struct *curr = this_rq->curr;
-       struct task_group *tg;
        unsigned long tl = this_load;
        unsigned long tl_per_task;
+       struct task_group *tg;
        unsigned long weight;
        int balanced;
 
        if (!(this_sd->flags & SD_WAKE_AFFINE) || !sched_feat(AFFINE_WAKEUPS))
                return 0;
 
-       if (sync && (curr->se.avg_overlap > sysctl_sched_migration_cost ||
-                       p->se.avg_overlap > sysctl_sched_migration_cost))
-               sync = 0;
-
        /*
         * If sync wakeup then subtract the (maximum possible)
         * effect of the currently running task from the load
@@ -1419,9 +1426,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
        if (!sched_feat(WAKEUP_PREEMPT))
                return;
 
-       if (sched_feat(WAKEUP_OVERLAP) && (sync ||
-                       (se->avg_overlap < sysctl_sched_migration_cost &&
-                        pse->avg_overlap < sysctl_sched_migration_cost))) {
+       if (sched_feat(WAKEUP_OVERLAP) && sync) {
                resched_task(curr);
                return;
        }
@@ -1452,6 +1457,11 @@ static struct task_struct *pick_next_task_fair(struct rq *rq)
 
        do {
                se = pick_next_entity(cfs_rq);
+               /*
+                * If se was a buddy, clear it so that it will have to earn
+                * the favour again.
+                */
+               __clear_buddies(cfs_rq, se);
                set_next_entity(cfs_rq, se);
                cfs_rq = group_cfs_rq(se);
        } while (cfs_rq);
index 954e1a81b7967567b617b918b254deaa12a848a4..bac1061cea2f4ab67f7c6d5b81300d02b717d5ba 100644 (file)
@@ -968,8 +968,8 @@ static inline int pick_optimal_cpu(int this_cpu, cpumask_t *mask)
        if ((this_cpu != -1) && cpu_isset(this_cpu, *mask))
                return this_cpu;
 
-       first = first_cpu(*mask);
-       if (first != NR_CPUS)
+       first = cpumask_first(mask);
+       if (first < nr_cpu_ids)
                return first;
 
        return -1;
index e73759783dc84d8134c9e5603432d0729d4634a3..b6b36768b758901b2d1806839a8c6b6c5ee035e0 100644 (file)
@@ -909,7 +909,9 @@ static void print_fatal_signal(struct pt_regs *regs, int signr)
        }
 #endif
        printk("\n");
+       preempt_disable();
        show_regs(regs);
+       preempt_enable();
 }
 
 static int __init setup_print_fatal_signals(char *str)
index 5cfa0e5e3e88d0a4527205de6e438b0e17dbf8ec..bbedbb7efe32816c2a3e7aba263d077337bc6158 100644 (file)
@@ -18,6 +18,7 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(call_function_lock);
 enum {
        CSD_FLAG_WAIT           = 0x01,
        CSD_FLAG_ALLOC          = 0x02,
+       CSD_FLAG_LOCK           = 0x04,
 };
 
 struct call_function_data {
@@ -186,6 +187,9 @@ void generic_smp_call_function_single_interrupt(void)
                        if (data_flags & CSD_FLAG_WAIT) {
                                smp_wmb();
                                data->flags &= ~CSD_FLAG_WAIT;
+                       } else if (data_flags & CSD_FLAG_LOCK) {
+                               smp_wmb();
+                               data->flags &= ~CSD_FLAG_LOCK;
                        } else if (data_flags & CSD_FLAG_ALLOC)
                                kfree(data);
                }
@@ -196,6 +200,8 @@ void generic_smp_call_function_single_interrupt(void)
        }
 }
 
+static DEFINE_PER_CPU(struct call_single_data, csd_data);
+
 /*
  * smp_call_function_single - Run a function on a specific CPU
  * @func: The function to run. This must be fast and non-blocking.
@@ -224,14 +230,38 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
                func(info);
                local_irq_restore(flags);
        } else if ((unsigned)cpu < nr_cpu_ids && cpu_online(cpu)) {
-               struct call_single_data *data = NULL;
+               struct call_single_data *data;
 
                if (!wait) {
+                       /*
+                        * We are calling a function on a single CPU
+                        * and we are not going to wait for it to finish.
+                        * We first try to allocate the data, but if we
+                        * fail, we fall back to use a per cpu data to pass
+                        * the information to that CPU. Since all callers
+                        * of this code will use the same data, we must
+                        * synchronize the callers to prevent a new caller
+                        * from corrupting the data before the callee
+                        * can access it.
+                        *
+                        * The CSD_FLAG_LOCK is used to let us know when
+                        * the IPI handler is done with the data.
+                        * The first caller will set it, and the callee
+                        * will clear it. The next caller must wait for
+                        * it to clear before we set it again. This
+                        * will make sure the callee is done with the
+                        * data before a new caller will use it.
+                        */
                        data = kmalloc(sizeof(*data), GFP_ATOMIC);
                        if (data)
                                data->flags = CSD_FLAG_ALLOC;
-               }
-               if (!data) {
+                       else {
+                               data = &per_cpu(csd_data, me);
+                               while (data->flags & CSD_FLAG_LOCK)
+                                       cpu_relax();
+                               data->flags = CSD_FLAG_LOCK;
+                       }
+               } else {
                        data = &d;
                        data->flags = CSD_FLAG_WAIT;
                }
index e7dc0e10a485878a08a8c80b52e6919ca6da3c13..f145c415bc160e62b6d888cf6fa9d3198c00b4a7 100644 (file)
@@ -1525,22 +1525,14 @@ SYSCALL_DEFINE2(setrlimit, unsigned int, resource, struct rlimit __user *, rlim)
                return -EINVAL;
        if (copy_from_user(&new_rlim, rlim, sizeof(*rlim)))
                return -EFAULT;
+       if (new_rlim.rlim_cur > new_rlim.rlim_max)
+               return -EINVAL;
        old_rlim = current->signal->rlim + resource;
        if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
            !capable(CAP_SYS_RESOURCE))
                return -EPERM;
-
-       if (resource == RLIMIT_NOFILE) {
-               if (new_rlim.rlim_max == RLIM_INFINITY)
-                       new_rlim.rlim_max = sysctl_nr_open;
-               if (new_rlim.rlim_cur == RLIM_INFINITY)
-                       new_rlim.rlim_cur = sysctl_nr_open;
-               if (new_rlim.rlim_max > sysctl_nr_open)
-                       return -EPERM;
-       }
-
-       if (new_rlim.rlim_cur > new_rlim.rlim_max)
-               return -EINVAL;
+       if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open)
+               return -EPERM;
 
        retval = security_task_setrlimit(resource, &new_rlim);
        if (retval)
index 63e05d423a09903907558d7d2aba661f5b426db6..21a5ca849514b40b689c5b34e2c9caaf9cbf051b 100644 (file)
@@ -273,6 +273,21 @@ out_bc:
        return ret;
 }
 
+/*
+ * Transfer the do_timer job away from a dying cpu.
+ *
+ * Called with interrupts disabled.
+ */
+static void tick_handover_do_timer(int *cpup)
+{
+       if (*cpup == tick_do_timer_cpu) {
+               int cpu = cpumask_first(cpu_online_mask);
+
+               tick_do_timer_cpu = (cpu < nr_cpu_ids) ? cpu :
+                       TICK_DO_TIMER_NONE;
+       }
+}
+
 /*
  * Shutdown an event device on a given cpu:
  *
@@ -297,13 +312,6 @@ static void tick_shutdown(unsigned int *cpup)
                clockevents_exchange_device(dev, NULL);
                td->evtdev = NULL;
        }
-       /* Transfer the do_timer job away from this cpu */
-       if (*cpup == tick_do_timer_cpu) {
-               int cpu = cpumask_first(cpu_online_mask);
-
-               tick_do_timer_cpu = (cpu < nr_cpu_ids) ? cpu :
-                       TICK_DO_TIMER_NONE;
-       }
        spin_unlock_irqrestore(&tick_device_lock, flags);
 }
 
@@ -357,6 +365,10 @@ static int tick_notify(struct notifier_block *nb, unsigned long reason,
                tick_broadcast_oneshot_control(reason);
                break;
 
+       case CLOCK_EVT_NOTIFY_CPU_DYING:
+               tick_handover_do_timer(dev);
+               break;
+
        case CLOCK_EVT_NOTIFY_CPU_DEAD:
                tick_shutdown_broadcast_oneshot(dev);
                tick_shutdown_broadcast(dev);
index 2f32969c09df04c682c4fe79e6e3d951ff53fa7c..9a236ffe2aa45188cacabfc8fbc15e81c6091f64 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/clocksource.h>
 #include <linux/kallsyms.h>
 #include <linux/seq_file.h>
+#include <linux/suspend.h>
 #include <linux/debugfs.h>
 #include <linux/hardirq.h>
 #include <linux/kthread.h>
@@ -1736,9 +1737,12 @@ static void clear_ftrace_pid(struct pid *pid)
 {
        struct task_struct *p;
 
+       rcu_read_lock();
        do_each_pid_task(pid, PIDTYPE_PID, p) {
                clear_tsk_trace_trace(p);
        } while_each_pid_task(pid, PIDTYPE_PID, p);
+       rcu_read_unlock();
+
        put_pid(pid);
 }
 
@@ -1746,9 +1750,11 @@ static void set_ftrace_pid(struct pid *pid)
 {
        struct task_struct *p;
 
+       rcu_read_lock();
        do_each_pid_task(pid, PIDTYPE_PID, p) {
                set_tsk_trace_trace(p);
        } while_each_pid_task(pid, PIDTYPE_PID, p);
+       rcu_read_unlock();
 }
 
 static void clear_ftrace_pid_task(struct pid **pid)
@@ -1965,6 +1971,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 
 static atomic_t ftrace_graph_active;
+static struct notifier_block ftrace_suspend_notifier;
 
 int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace)
 {
@@ -2043,6 +2050,27 @@ static int start_graph_tracing(void)
        return ret;
 }
 
+/*
+ * Hibernation protection.
+ * The state of the current task is too much unstable during
+ * suspend/restore to disk. We want to protect against that.
+ */
+static int
+ftrace_suspend_notifier_call(struct notifier_block *bl, unsigned long state,
+                                                       void *unused)
+{
+       switch (state) {
+       case PM_HIBERNATION_PREPARE:
+               pause_graph_tracing();
+               break;
+
+       case PM_POST_HIBERNATION:
+               unpause_graph_tracing();
+               break;
+       }
+       return NOTIFY_DONE;
+}
+
 int register_ftrace_graph(trace_func_graph_ret_t retfunc,
                        trace_func_graph_ent_t entryfunc)
 {
@@ -2050,6 +2078,9 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
 
        mutex_lock(&ftrace_sysctl_lock);
 
+       ftrace_suspend_notifier.notifier_call = ftrace_suspend_notifier_call;
+       register_pm_notifier(&ftrace_suspend_notifier);
+
        atomic_inc(&ftrace_graph_active);
        ret = start_graph_tracing();
        if (ret) {
@@ -2075,6 +2106,7 @@ void unregister_ftrace_graph(void)
        ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
        ftrace_graph_entry = ftrace_graph_entry_stub;
        ftrace_shutdown(FTRACE_STOP_FUNC_RET);
+       unregister_pm_notifier(&ftrace_suspend_notifier);
 
        mutex_unlock(&ftrace_sysctl_lock);
 }
index 8b0daf0662ef45e7ad6ad9df71e52dfd3c3459ba..bd38c5cfd8ad715e4a1d58fa6d9eeda6be1189a2 100644 (file)
@@ -246,7 +246,7 @@ static inline int test_time_stamp(u64 delta)
        return 0;
 }
 
-#define BUF_PAGE_SIZE (PAGE_SIZE - sizeof(struct buffer_data_page))
+#define BUF_PAGE_SIZE (PAGE_SIZE - offsetof(struct buffer_data_page, data))
 
 /*
  * head_page == tail_page && head == tail then buffer is empty.
@@ -1025,12 +1025,8 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
                }
 
                if (next_page == head_page) {
-                       if (!(buffer->flags & RB_FL_OVERWRITE)) {
-                               /* reset write */
-                               if (tail <= BUF_PAGE_SIZE)
-                                       local_set(&tail_page->write, tail);
+                       if (!(buffer->flags & RB_FL_OVERWRITE))
                                goto out_unlock;
-                       }
 
                        /* tail_page has not moved yet? */
                        if (tail_page == cpu_buffer->tail_page) {
@@ -1105,6 +1101,10 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
        return event;
 
  out_unlock:
+       /* reset write */
+       if (tail <= BUF_PAGE_SIZE)
+               local_set(&tail_page->write, tail);
+
        __raw_spin_unlock(&cpu_buffer->lock);
        local_irq_restore(flags);
        return NULL;
@@ -2174,6 +2174,9 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
 
        cpu_buffer->overrun = 0;
        cpu_buffer->entries = 0;
+
+       cpu_buffer->write_stamp = 0;
+       cpu_buffer->read_stamp = 0;
 }
 
 /**
index c580233add95a0915f4797b84ae05a728aa986c6..17bb88d86ac2fead9cb0bacc72a338c2d8d798c4 100644 (file)
@@ -40,7 +40,7 @@
 
 #define TRACE_BUFFER_FLAGS     (RB_FL_OVERWRITE)
 
-unsigned long __read_mostly    tracing_max_latency = (cycle_t)ULONG_MAX;
+unsigned long __read_mostly    tracing_max_latency;
 unsigned long __read_mostly    tracing_thresh;
 
 /*
@@ -3736,7 +3736,7 @@ static struct notifier_block trace_die_notifier = {
  * it if we decide to change what log level the ftrace dump
  * should be at.
  */
-#define KERN_TRACE             KERN_INFO
+#define KERN_TRACE             KERN_EMERG
 
 static void
 trace_printk_seq(struct trace_seq *s)
@@ -3770,6 +3770,7 @@ void ftrace_dump(void)
        dump_ran = 1;
 
        /* No turning back! */
+       tracing_off();
        ftrace_kill();
 
        for_each_tracing_cpu(cpu) {
index 7c2e326bbc8b15d942532d5951a38978fb66e194..62a78d943534cd0c6b4d50d8ef5832db741c881d 100644 (file)
@@ -380,6 +380,7 @@ static void stop_irqsoff_tracer(struct trace_array *tr)
 
 static void __irqsoff_tracer_init(struct trace_array *tr)
 {
+       tracing_max_latency = 0;
        irqsoff_trace = tr;
        /* make sure that the tracer is visible */
        smp_wmb();
index 43586b689e3108c8cad184a6667365b7a1dc87da..42ae1e77b6b3a499408b1d23f101ac154be0fa70 100644 (file)
@@ -333,6 +333,7 @@ static void stop_wakeup_tracer(struct trace_array *tr)
 
 static int wakeup_tracer_init(struct trace_array *tr)
 {
+       tracing_max_latency = 0;
        wakeup_trace = tr;
        start_wakeup_tracer(tr);
        return 0;
index cd87131f2fc2aa138aa1bc818f5efab612c3085c..42a2dbc181c89ca708360d84ee53a5ca21640b44 100644 (file)
@@ -91,6 +91,15 @@ prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state)
 }
 EXPORT_SYMBOL(prepare_to_wait_exclusive);
 
+/*
+ * finish_wait - clean up after waiting in a queue
+ * @q: waitqueue waited on
+ * @wait: wait descriptor
+ *
+ * Sets current thread back to running state and removes
+ * the wait descriptor from the given waitqueue if still
+ * queued.
+ */
 void finish_wait(wait_queue_head_t *q, wait_queue_t *wait)
 {
        unsigned long flags;
@@ -117,6 +126,39 @@ void finish_wait(wait_queue_head_t *q, wait_queue_t *wait)
 }
 EXPORT_SYMBOL(finish_wait);
 
+/*
+ * abort_exclusive_wait - abort exclusive waiting in a queue
+ * @q: waitqueue waited on
+ * @wait: wait descriptor
+ * @state: runstate of the waiter to be woken
+ * @key: key to identify a wait bit queue or %NULL
+ *
+ * Sets current thread back to running state and removes
+ * the wait descriptor from the given waitqueue if still
+ * queued.
+ *
+ * Wakes up the next waiter if the caller is concurrently
+ * woken up through the queue.
+ *
+ * This prevents waiter starvation where an exclusive waiter
+ * aborts and is woken up concurrently and noone wakes up
+ * the next waiter.
+ */
+void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait,
+                       unsigned int mode, void *key)
+{
+       unsigned long flags;
+
+       __set_current_state(TASK_RUNNING);
+       spin_lock_irqsave(&q->lock, flags);
+       if (!list_empty(&wait->task_list))
+               list_del_init(&wait->task_list);
+       else if (waitqueue_active(q))
+               __wake_up_common(q, mode, 1, 0, key);
+       spin_unlock_irqrestore(&q->lock, flags);
+}
+EXPORT_SYMBOL(abort_exclusive_wait);
+
 int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key)
 {
        int ret = default_wake_function(wait, mode, sync, key);
@@ -177,17 +219,20 @@ int __sched
 __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q,
                        int (*action)(void *), unsigned mode)
 {
-       int ret = 0;
-
        do {
+               int ret;
+
                prepare_to_wait_exclusive(wq, &q->wait, mode);
-               if (test_bit(q->key.bit_nr, q->key.flags)) {
-                       if ((ret = (*action)(q->key.flags)))
-                               break;
-               }
+               if (!test_bit(q->key.bit_nr, q->key.flags))
+                       continue;
+               ret = action(q->key.flags);
+               if (!ret)
+                       continue;
+               abort_exclusive_wait(wq, &q->wait, mode, &q->key);
+               return ret;
        } while (test_and_set_bit(q->key.bit_nr, q->key.flags));
        finish_wait(wq, &q->wait);
-       return ret;
+       return 0;
 }
 EXPORT_SYMBOL(__wait_on_bit_lock);
 
index 0f8fc22ed1030a200f1fd3c203ca6789c5646ac8..4689cb073da4ef00000fecd739583bf19f23f6f1 100644 (file)
@@ -22,7 +22,7 @@ notrace unsigned int debug_smp_processor_id(void)
         * Kernel threads bound to a single CPU can safely use
         * smp_processor_id():
         */
-       if (cpus_equal(current->cpus_allowed, cpumask_of_cpu(this_cpu)))
+       if (cpumask_equal(&current->cpus_allowed, cpumask_of(this_cpu)))
                goto out;
 
        /*
index 4d0ea3ceba6d2e40431f64f7e8d8c0f3c0022165..8e4be9cb2a6a7642601516e3587d151dcea586f4 100644 (file)
@@ -202,6 +202,7 @@ pcg_default_flags[NR_CHARGE_TYPE] = {
 
 static void mem_cgroup_get(struct mem_cgroup *mem);
 static void mem_cgroup_put(struct mem_cgroup *mem);
+static struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *mem);
 
 static void mem_cgroup_charge_statistics(struct mem_cgroup *mem,
                                         struct page_cgroup *pc,
@@ -1684,7 +1685,7 @@ move_account:
                /* This is for making all *used* pages to be on LRU. */
                lru_add_drain_all();
                ret = 0;
-               for_each_node_state(node, N_POSSIBLE) {
+               for_each_node_state(node, N_HIGH_MEMORY) {
                        for (zid = 0; !ret && zid < MAX_NR_ZONES; zid++) {
                                enum lru_list l;
                                for_each_lru(l) {
@@ -2193,10 +2194,23 @@ static void mem_cgroup_get(struct mem_cgroup *mem)
 
 static void mem_cgroup_put(struct mem_cgroup *mem)
 {
-       if (atomic_dec_and_test(&mem->refcnt))
+       if (atomic_dec_and_test(&mem->refcnt)) {
+               struct mem_cgroup *parent = parent_mem_cgroup(mem);
                __mem_cgroup_free(mem);
+               if (parent)
+                       mem_cgroup_put(parent);
+       }
 }
 
+/*
+ * Returns the parent mem_cgroup in memcgroup hierarchy with hierarchy enabled.
+ */
+static struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *mem)
+{
+       if (!mem->res.parent)
+               return NULL;
+       return mem_cgroup_from_res_counter(mem->res.parent, res);
+}
 
 #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
 static void __init enable_swap_cgroup(void)
@@ -2235,6 +2249,13 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
        if (parent && parent->use_hierarchy) {
                res_counter_init(&mem->res, &parent->res);
                res_counter_init(&mem->memsw, &parent->memsw);
+               /*
+                * We increment refcnt of the parent to ensure that we can
+                * safely access it on res_counter_charge/uncharge.
+                * This refcnt will be decremented when freeing this
+                * mem_cgroup(see mem_cgroup_put).
+                */
+               mem_cgroup_get(parent);
        } else {
                res_counter_init(&mem->res, NULL);
                res_counter_init(&mem->memsw, NULL);
index 22bfa7a47a0b613cf9c39ee6e7d24f7dc3c9cf77..baa999e87cd21d2f9e67c8e3b1093bb6831513fb 100644 (file)
@@ -1999,7 +1999,7 @@ gotten:
         * Don't let another task, with possibly unlocked vma,
         * keep the mlocked page.
         */
-       if (vma->vm_flags & VM_LOCKED) {
+       if ((vma->vm_flags & VM_LOCKED) && old_page) {
                lock_page(old_page);    /* for LRU manipulation */
                clear_page_mlock(old_page);
                unlock_page(old_page);
index 2904a347e4761169655696120751c371e4d74959..037161d61b4e72432d9d6bae71507d251b522afc 100644 (file)
@@ -294,14 +294,10 @@ static inline int __mlock_posix_error_return(long retval)
  *
  * return number of pages [> 0] to be removed from locked_vm on success
  * of "special" vmas.
- *
- * return negative error if vma spanning @start-@range disappears while
- * mmap semaphore is dropped.  Unlikely?
  */
 long mlock_vma_pages_range(struct vm_area_struct *vma,
                        unsigned long start, unsigned long end)
 {
-       struct mm_struct *mm = vma->vm_mm;
        int nr_pages = (end - start) / PAGE_SIZE;
        BUG_ON(!(vma->vm_flags & VM_LOCKED));
 
@@ -314,20 +310,11 @@ long mlock_vma_pages_range(struct vm_area_struct *vma,
        if (!((vma->vm_flags & (VM_DONTEXPAND | VM_RESERVED)) ||
                        is_vm_hugetlb_page(vma) ||
                        vma == get_gate_vma(current))) {
-               long error;
-               downgrade_write(&mm->mmap_sem);
-
-               error = __mlock_vma_pages_range(vma, start, end, 1);
 
-               up_read(&mm->mmap_sem);
-               /* vma can change or disappear */
-               down_write(&mm->mmap_sem);
-               vma = find_vma(mm, start);
-               /* non-NULL vma must contain @start, but need to check @end */
-               if (!vma ||  end > vma->vm_end)
-                       return -ENOMEM;
+               __mlock_vma_pages_range(vma, start, end, 1);
 
-               return 0;       /* hide other errors from mmap(), et al */
+               /* Hide errors from mmap() and other callers */
+               return 0;
        }
 
        /*
@@ -438,41 +425,14 @@ success:
        vma->vm_flags = newflags;
 
        if (lock) {
-               /*
-                * mmap_sem is currently held for write.  Downgrade the write
-                * lock to a read lock so that other faults, mmap scans, ...
-                * while we fault in all pages.
-                */
-               downgrade_write(&mm->mmap_sem);
-
                ret = __mlock_vma_pages_range(vma, start, end, 1);
 
-               /*
-                * Need to reacquire mmap sem in write mode, as our callers
-                * expect this.  We have no support for atomically upgrading
-                * a sem to write, so we need to check for ranges while sem
-                * is unlocked.
-                */
-               up_read(&mm->mmap_sem);
-               /* vma can change or disappear */
-               down_write(&mm->mmap_sem);
-               *prev = find_vma(mm, start);
-               /* non-NULL *prev must contain @start, but need to check @end */
-               if (!(*prev) || end > (*prev)->vm_end)
-                       ret = -ENOMEM;
-               else if (ret > 0) {
+               if (ret > 0) {
                        mm->locked_vm -= ret;
                        ret = 0;
                } else
                        ret = __mlock_posix_error_return(ret); /* translate if needed */
        } else {
-               /*
-                * TODO:  for unlocking, pages will already be resident, so
-                * we don't need to wait for allocations/reclaim/pagein, ...
-                * However, unlocking a very large region can still take a
-                * while.  Should we downgrade the semaphore for both lock
-                * AND unlock ?
-                */
                __mlock_vma_pages_range(vma, start, end, 0);
        }
 
index 8d95902e9a389ba84fea3e45c39ad3c5012cee9d..214b6a258eeb6f807f2cf8ae11f02c4ae9c78005 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -658,6 +658,9 @@ again:                      remove_next = 1 + (end > next->vm_end);
        validate_mm(mm);
 }
 
+/* Flags that can be inherited from an existing mapping when merging */
+#define VM_MERGEABLE_FLAGS (VM_CAN_NONLINEAR)
+
 /*
  * If the vma has a ->close operation then the driver probably needs to release
  * per-vma resources, so we don't attempt to merge those.
@@ -665,7 +668,7 @@ again:                      remove_next = 1 + (end > next->vm_end);
 static inline int is_mergeable_vma(struct vm_area_struct *vma,
                        struct file *file, unsigned long vm_flags)
 {
-       if (vma->vm_flags != vm_flags)
+       if ((vma->vm_flags ^ vm_flags) & ~VM_MERGEABLE_FLAGS)
                return 0;
        if (vma->vm_file != file)
                return 0;
@@ -1087,6 +1090,15 @@ int vma_wants_writenotify(struct vm_area_struct *vma)
                mapping_cap_account_dirty(vma->vm_file->f_mapping);
 }
 
+/*
+ * We account for memory if it's a private writeable mapping,
+ * and VM_NORESERVE wasn't set.
+ */
+static inline int accountable_mapping(unsigned int vm_flags)
+{
+       return (vm_flags & (VM_NORESERVE | VM_SHARED | VM_WRITE)) == VM_WRITE;
+}
+
 unsigned long mmap_region(struct file *file, unsigned long addr,
                          unsigned long len, unsigned long flags,
                          unsigned int vm_flags, unsigned long pgoff,
@@ -1114,36 +1126,32 @@ munmap_back:
        if (!may_expand_vm(mm, len >> PAGE_SHIFT))
                return -ENOMEM;
 
-       if (flags & MAP_NORESERVE)
+       /*
+        * Set 'VM_NORESERVE' if we should not account for the
+        * memory use of this mapping. We only honor MAP_NORESERVE
+        * if we're allowed to overcommit memory.
+        */
+       if ((flags & MAP_NORESERVE) && sysctl_overcommit_memory != OVERCOMMIT_NEVER)
+               vm_flags |= VM_NORESERVE;
+       if (!accountable)
                vm_flags |= VM_NORESERVE;
 
-       if (accountable && (!(flags & MAP_NORESERVE) ||
-                           sysctl_overcommit_memory == OVERCOMMIT_NEVER)) {
-               if (vm_flags & VM_SHARED) {
-                       /* Check memory availability in shmem_file_setup? */
-                       vm_flags |= VM_ACCOUNT;
-               } else if (vm_flags & VM_WRITE) {
-                       /*
-                        * Private writable mapping: check memory availability
-                        */
-                       charged = len >> PAGE_SHIFT;
-                       if (security_vm_enough_memory(charged))
-                               return -ENOMEM;
-                       vm_flags |= VM_ACCOUNT;
-               }
+       /*
+        * Private writable mapping: check memory availability
+        */
+       if (accountable_mapping(vm_flags)) {
+               charged = len >> PAGE_SHIFT;
+               if (security_vm_enough_memory(charged))
+                       return -ENOMEM;
+               vm_flags |= VM_ACCOUNT;
        }
 
        /*
-        * Can we just expand an old private anonymous mapping?
-        * The VM_SHARED test is necessary because shmem_zero_setup
-        * will create the file object for a shared anonymous map below.
+        * Can we just expand an old mapping?
         */
-       if (!file && !(vm_flags & VM_SHARED)) {
-               vma = vma_merge(mm, prev, addr, addr + len, vm_flags,
-                                       NULL, NULL, pgoff, NULL);
-               if (vma)
-                       goto out;
-       }
+       vma = vma_merge(mm, prev, addr, addr + len, vm_flags, NULL, file, pgoff, NULL);
+       if (vma)
+               goto out;
 
        /*
         * Determine the object being mapped and call the appropriate
@@ -1186,14 +1194,6 @@ munmap_back:
                        goto free_vma;
        }
 
-       /* We set VM_ACCOUNT in a shared mapping's vm_flags, to inform
-        * shmem_zero_setup (perhaps called through /dev/zero's ->mmap)
-        * that memory reservation must be checked; but that reservation
-        * belongs to shared memory object, not to vma: so now clear it.
-        */
-       if ((vm_flags & (VM_SHARED|VM_ACCOUNT)) == (VM_SHARED|VM_ACCOUNT))
-               vma->vm_flags &= ~VM_ACCOUNT;
-
        /* Can addr have changed??
         *
         * Answer: Yes, several device drivers can do it in their
@@ -1206,17 +1206,8 @@ munmap_back:
        if (vma_wants_writenotify(vma))
                vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED);
 
-       if (file && vma_merge(mm, prev, addr, vma->vm_end,
-                       vma->vm_flags, NULL, file, pgoff, vma_policy(vma))) {
-               mpol_put(vma_policy(vma));
-               kmem_cache_free(vm_area_cachep, vma);
-               fput(file);
-               if (vm_flags & VM_EXECUTABLE)
-                       removed_exe_file_vma(mm);
-       } else {
-               vma_link(mm, vma, prev, rb_link, rb_parent);
-               file = vma->vm_file;
-       }
+       vma_link(mm, vma, prev, rb_link, rb_parent);
+       file = vma->vm_file;
 
        /* Once vma denies write, undo our temporary denial count */
        if (correct_wcount)
index b493db7841dc6c2db77d10eab751f6e1f62e7355..dc32dae01e5f53e0b38c1e3c8c11c33e839a423b 100644 (file)
@@ -1051,13 +1051,22 @@ continue_unlock:
                                }
                        }
 
-                       if (wbc->sync_mode == WB_SYNC_NONE) {
-                               wbc->nr_to_write--;
-                               if (wbc->nr_to_write <= 0) {
-                                       done = 1;
-                                       break;
-                               }
+                       if (nr_to_write > 0)
+                               nr_to_write--;
+                       else if (wbc->sync_mode == WB_SYNC_NONE) {
+                               /*
+                                * We stop writing back only if we are not
+                                * doing integrity sync. In case of integrity
+                                * sync we have to keep going because someone
+                                * may be concurrently dirtying pages, and we
+                                * might have synced a lot of newly appeared
+                                * dirty pages, but have not synced all of the
+                                * old dirty pages.
+                                */
+                               done = 1;
+                               break;
                        }
+
                        if (wbc->nonblocking && bdi_write_congested(bdi)) {
                                wbc->encountered_congestion = 1;
                                done = 1;
index 5d0de96c97897f463eaa0d469f86ad5f273664d5..19d566ccdeeab8c6a1f0431602b3bd3dd5a76026 100644 (file)
@@ -2628,7 +2628,7 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
                goto close_file;
 
 #ifdef CONFIG_SHMEM
-       SHMEM_I(inode)->flags = flags & VM_ACCOUNT;
+       SHMEM_I(inode)->flags = (flags & VM_NORESERVE) ? 0 : VM_ACCOUNT;
 #endif
        d_instantiate(dentry, inode);
        inode->i_size = size;
index 6392ae5cc6b1e8972d98b059bee576aeb66d366c..bdc9abb08a230f2724ad842a0bc4928da0e48d23 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1996,7 +1996,7 @@ static struct kmem_cache_cpu *alloc_kmem_cache_cpu(struct kmem_cache *s,
 static void free_kmem_cache_cpu(struct kmem_cache_cpu *c, int cpu)
 {
        if (c < per_cpu(kmem_cache_cpu, cpu) ||
-                       c > per_cpu(kmem_cache_cpu, cpu) + NR_KMEM_CACHE_CPU) {
+                       c >= per_cpu(kmem_cache_cpu, cpu) + NR_KMEM_CACHE_CPU) {
                kfree(c);
                return;
        }
index f48b831e5e5ca5e5b400247e973aeec2a6023f94..7e6304dfafab174884bad5820a0194f449906a32 100644 (file)
@@ -698,8 +698,10 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd,
        pte_t *pte;
        int ret = 1;
 
-       if (mem_cgroup_try_charge_swapin(vma->vm_mm, page, GFP_KERNEL, &ptr))
+       if (mem_cgroup_try_charge_swapin(vma->vm_mm, page, GFP_KERNEL, &ptr)) {
                ret = -ENOMEM;
+               goto out_nolock;
+       }
 
        pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
        if (unlikely(!pte_same(*pte, swp_entry_to_pte(entry)))) {
@@ -723,6 +725,7 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd,
        activate_page(page);
 out:
        pte_unmap_unlock(pte, ptl);
+out_nolock:
        return ret;
 }
 
index 2e5f2ca3bdcdefea914cd329315ee5e1f04200ad..da74b844f4eab0464374a1a667cea8aa40a7bf26 100644 (file)
@@ -2212,10 +2212,10 @@ unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
                return 0;
 
 next_skb:
-       block_limit = skb_headlen(st->cur_skb);
+       block_limit = skb_headlen(st->cur_skb) + st->stepped_offset;
 
        if (abs_offset < block_limit) {
-               *data = st->cur_skb->data + abs_offset;
+               *data = st->cur_skb->data + (abs_offset - st->stepped_offset);
                return block_limit - abs_offset;
        }
 
@@ -2250,13 +2250,14 @@ next_skb:
                st->frag_data = NULL;
        }
 
-       if (st->cur_skb->next) {
-               st->cur_skb = st->cur_skb->next;
+       if (st->root_skb == st->cur_skb &&
+           skb_shinfo(st->root_skb)->frag_list) {
+               st->cur_skb = skb_shinfo(st->root_skb)->frag_list;
                st->frag_idx = 0;
                goto next_skb;
-       } else if (st->root_skb == st->cur_skb &&
-                  skb_shinfo(st->root_skb)->frag_list) {
-               st->cur_skb = skb_shinfo(st->root_skb)->frag_list;
+       } else if (st->cur_skb->next) {
+               st->cur_skb = st->cur_skb->next;
+               st->frag_idx = 0;
                goto next_skb;
        }
 
index 42a0f3dd3fd64323ac9a087895dbbaaff822e7cd..d722013c1cae2a620c70282e39a767662bf608c5 100644 (file)
@@ -1268,6 +1268,9 @@ __be32 __init root_nfs_parse_addr(char *name)
 static int __init ip_auto_config(void)
 {
        __be32 addr;
+#ifdef IPCONFIG_DYNAMIC
+       int retries = CONF_OPEN_RETRIES;
+#endif
 
 #ifdef CONFIG_PROC_FS
        proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops);
@@ -1304,9 +1307,6 @@ static int __init ip_auto_config(void)
 #endif
            ic_first_dev->next) {
 #ifdef IPCONFIG_DYNAMIC
-
-               int retries = CONF_OPEN_RETRIES;
-
                if (ic_dynamic() < 0) {
                        ic_close_devs();
 
index 0cd71b84e483d3a1685bde2e947117b8a24aac91..76b148bcb0dcb9ffcb333aa2b3ab3a2ed68fad33 100644 (file)
@@ -524,7 +524,8 @@ static int tcp_splice_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb,
        struct tcp_splice_state *tss = rd_desc->arg.data;
        int ret;
 
-       ret = skb_splice_bits(skb, offset, tss->pipe, rd_desc->count, tss->flags);
+       ret = skb_splice_bits(skb, offset, tss->pipe, min(rd_desc->count, len),
+                             tss->flags);
        if (ret > 0)
                rd_desc->count -= ret;
        return ret;
index 557fe16cbfb0c8498e179ddebecc2e602abf5d2e..dda42f0bd7a3b986d23be16b6f44c87333af0844 100644 (file)
@@ -663,14 +663,10 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
        th->urg_ptr             = 0;
 
        /* The urg_mode check is necessary during a below snd_una win probe */
-       if (unlikely(tcp_urg_mode(tp))) {
-               if (between(tp->snd_up, tcb->seq + 1, tcb->seq + 0xFFFF)) {
-                       th->urg_ptr = htons(tp->snd_up - tcb->seq);
-                       th->urg = 1;
-               } else if (after(tcb->seq + 0xFFFF, tp->snd_nxt)) {
-                       th->urg_ptr = 0xFFFF;
-                       th->urg = 1;
-               }
+       if (unlikely(tcp_urg_mode(tp) &&
+                    between(tp->snd_up, tcb->seq + 1, tcb->seq + 0xFFFF))) {
+               th->urg_ptr             = htons(tp->snd_up - tcb->seq);
+               th->urg                 = 1;
        }
 
        tcp_options_write((__be32 *)(th + 1), tp, &opts, &md5_hash_location);
index cf5ab0581ebac98ddf919f92083f7066aa0bf61f..cc3a0a06c004df7eb933ca53c3bf05764aeb487e 100644 (file)
@@ -120,8 +120,11 @@ EXPORT_SYMBOL(sysctl_udp_wmem_min);
 atomic_t udp_memory_allocated;
 EXPORT_SYMBOL(udp_memory_allocated);
 
+#define PORTS_PER_CHAIN (65536 / UDP_HTABLE_SIZE)
+
 static int udp_lib_lport_inuse(struct net *net, __u16 num,
                               const struct udp_hslot *hslot,
+                              unsigned long *bitmap,
                               struct sock *sk,
                               int (*saddr_comp)(const struct sock *sk1,
                                                 const struct sock *sk2))
@@ -132,12 +135,17 @@ static int udp_lib_lport_inuse(struct net *net, __u16 num,
        sk_nulls_for_each(sk2, node, &hslot->head)
                if (net_eq(sock_net(sk2), net)                  &&
                    sk2 != sk                                   &&
-                   sk2->sk_hash == num                         &&
+                   (bitmap || sk2->sk_hash == num)             &&
                    (!sk2->sk_reuse || !sk->sk_reuse)           &&
                    (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if
                        || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
-                   (*saddr_comp)(sk, sk2))
-                       return 1;
+                   (*saddr_comp)(sk, sk2)) {
+                       if (bitmap)
+                               __set_bit(sk2->sk_hash / UDP_HTABLE_SIZE,
+                                         bitmap);
+                       else
+                               return 1;
+               }
        return 0;
 }
 
@@ -160,32 +168,47 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
        if (!snum) {
                int low, high, remaining;
                unsigned rand;
-               unsigned short first;
+               unsigned short first, last;
+               DECLARE_BITMAP(bitmap, PORTS_PER_CHAIN);
 
                inet_get_local_port_range(&low, &high);
                remaining = (high - low) + 1;
 
                rand = net_random();
-               snum = first = rand % remaining + low;
-               rand |= 1;
-               for (;;) {
-                       hslot = &udptable->hash[udp_hashfn(net, snum)];
+               first = (((u64)rand * remaining) >> 32) + low;
+               /*
+                * force rand to be an odd multiple of UDP_HTABLE_SIZE
+                */
+               rand = (rand | 1) * UDP_HTABLE_SIZE;
+               for (last = first + UDP_HTABLE_SIZE; first != last; first++) {
+                       hslot = &udptable->hash[udp_hashfn(net, first)];
+                       bitmap_zero(bitmap, PORTS_PER_CHAIN);
                        spin_lock_bh(&hslot->lock);
-                       if (!udp_lib_lport_inuse(net, snum, hslot, sk, saddr_comp))
-                               break;
-                       spin_unlock_bh(&hslot->lock);
+                       udp_lib_lport_inuse(net, snum, hslot, bitmap, sk,
+                                           saddr_comp);
+
+                       snum = first;
+                       /*
+                        * Iterate on all possible values of snum for this hash.
+                        * Using steps of an odd multiple of UDP_HTABLE_SIZE
+                        * give us randomization and full range coverage.
+                        */
                        do {
-                               snum = snum + rand;
-                       } while (snum < low || snum > high);
-                       if (snum == first)
-                               goto fail;
+                               if (low <= snum && snum <= high &&
+                                   !test_bit(snum / UDP_HTABLE_SIZE, bitmap))
+                                       goto found;
+                               snum += rand;
+                       } while (snum != first);
+                       spin_unlock_bh(&hslot->lock);
                }
+               goto fail;
        } else {
                hslot = &udptable->hash[udp_hashfn(net, snum)];
                spin_lock_bh(&hslot->lock);
-               if (udp_lib_lport_inuse(net, snum, hslot, sk, saddr_comp))
+               if (udp_lib_lport_inuse(net, snum, hslot, NULL, sk, saddr_comp))
                        goto fail_unlock;
        }
+found:
        inet_sk(sk)->num = snum;
        sk->sk_hash = snum;
        if (sk_unhashed(sk)) {
@@ -992,9 +1015,11 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 
        if ((rc = sock_queue_rcv_skb(sk, skb)) < 0) {
                /* Note that an ENOMEM error is charged twice */
-               if (rc == -ENOMEM)
+               if (rc == -ENOMEM) {
                        UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS,
                                         is_udplite);
+                       atomic_inc(&sk->sk_drops);
+               }
                goto drop;
        }
 
@@ -1206,7 +1231,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
                   int proto)
 {
        struct sock *sk;
-       struct udphdr *uh = udp_hdr(skb);
+       struct udphdr *uh;
        unsigned short ulen;
        struct rtable *rt = (struct rtable*)skb->dst;
        __be32 saddr = ip_hdr(skb)->saddr;
@@ -1219,6 +1244,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
        if (!pskb_may_pull(skb, sizeof(struct udphdr)))
                goto drop;              /* No space for header. */
 
+       uh   = udp_hdr(skb);
        ulen = ntohs(uh->len);
        if (ulen > skb->len)
                goto short_packet;
index e92ad8455c63a851ef9966705b627299459f0bb2..f9afb452249c0f1cfbcdac802430d9adb41b694b 100644 (file)
@@ -4250,7 +4250,7 @@ static struct addrconf_sysctl_table
                        .procname       =       "mc_forwarding",
                        .data           =       &ipv6_devconf.mc_forwarding,
                        .maxlen         =       sizeof(int),
-                       .mode           =       0644,
+                       .mode           =       0444,
                        .proc_handler   =       proc_dointvec,
                },
 #endif
index 4f433847d95f51724c0a943d50a5a67edb80b34c..36dff8807183c81741baba329cea9d637ff6ebcd 100644 (file)
@@ -443,10 +443,10 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
        if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6))
                goto relookup_failed;
 
-       if (ip6_dst_lookup(sk, &dst2, &fl))
+       if (ip6_dst_lookup(sk, &dst2, &fl2))
                goto relookup_failed;
 
-       err = xfrm_lookup(net, &dst2, &fl, sk, XFRM_LOOKUP_ICMP);
+       err = xfrm_lookup(net, &dst2, &fl2, sk, XFRM_LOOKUP_ICMP);
        switch (err) {
        case 0:
                dst_release(dst);
index 936f48946e20e897720b15db9faee4a58d4211a3..f171e8dbac9124ae43c94f5e169fdfa6571c5fca 100644 (file)
@@ -255,6 +255,7 @@ int ip6_mc_input(struct sk_buff *skb)
         *      IPv6 multicast router mode is now supported ;)
         */
        if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding &&
+           !(ipv6_addr_type(&hdr->daddr) & IPV6_ADDR_LINKLOCAL) &&
            likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) {
                /*
                 * Okay, we try to forward - split and duplicate
@@ -316,7 +317,6 @@ int ip6_mc_input(struct sk_buff *skb)
                }
 
                if (skb2) {
-                       skb2->dev = skb2->dst->dev;
                        ip6_mr_input(skb2);
                }
        }
index 4b15938bef4dabd3f09087369d752a2400820a00..9fb49c3b518af09939516cd4805e24bf8b4479b4 100644 (file)
@@ -1105,6 +1105,18 @@ static inline int ip6_ufo_append_data(struct sock *sk,
        return err;
 }
 
+static inline struct ipv6_opt_hdr *ip6_opt_dup(struct ipv6_opt_hdr *src,
+                                              gfp_t gfp)
+{
+       return src ? kmemdup(src, (src->hdrlen + 1) * 8, gfp) : NULL;
+}
+
+static inline struct ipv6_rt_hdr *ip6_rthdr_dup(struct ipv6_rt_hdr *src,
+                                               gfp_t gfp)
+{
+       return src ? kmemdup(src, (src->hdrlen + 1) * 8, gfp) : NULL;
+}
+
 int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
        int offset, int len, int odd, struct sk_buff *skb),
        void *from, int length, int transhdrlen,
@@ -1130,17 +1142,37 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
                 * setup for corking
                 */
                if (opt) {
-                       if (np->cork.opt == NULL) {
-                               np->cork.opt = kmalloc(opt->tot_len,
-                                                      sk->sk_allocation);
-                               if (unlikely(np->cork.opt == NULL))
-                                       return -ENOBUFS;
-                       } else if (np->cork.opt->tot_len < opt->tot_len) {
-                               printk(KERN_DEBUG "ip6_append_data: invalid option length\n");
+                       if (WARN_ON(np->cork.opt))
                                return -EINVAL;
-                       }
-                       memcpy(np->cork.opt, opt, opt->tot_len);
-                       inet->cork.flags |= IPCORK_OPT;
+
+                       np->cork.opt = kmalloc(opt->tot_len, sk->sk_allocation);
+                       if (unlikely(np->cork.opt == NULL))
+                               return -ENOBUFS;
+
+                       np->cork.opt->tot_len = opt->tot_len;
+                       np->cork.opt->opt_flen = opt->opt_flen;
+                       np->cork.opt->opt_nflen = opt->opt_nflen;
+
+                       np->cork.opt->dst0opt = ip6_opt_dup(opt->dst0opt,
+                                                           sk->sk_allocation);
+                       if (opt->dst0opt && !np->cork.opt->dst0opt)
+                               return -ENOBUFS;
+
+                       np->cork.opt->dst1opt = ip6_opt_dup(opt->dst1opt,
+                                                           sk->sk_allocation);
+                       if (opt->dst1opt && !np->cork.opt->dst1opt)
+                               return -ENOBUFS;
+
+                       np->cork.opt->hopopt = ip6_opt_dup(opt->hopopt,
+                                                          sk->sk_allocation);
+                       if (opt->hopopt && !np->cork.opt->hopopt)
+                               return -ENOBUFS;
+
+                       np->cork.opt->srcrt = ip6_rthdr_dup(opt->srcrt,
+                                                           sk->sk_allocation);
+                       if (opt->srcrt && !np->cork.opt->srcrt)
+                               return -ENOBUFS;
+
                        /* need source address above miyazawa*/
                }
                dst_hold(&rt->u.dst);
@@ -1167,8 +1199,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
        } else {
                rt = (struct rt6_info *)inet->cork.dst;
                fl = &inet->cork.fl;
-               if (inet->cork.flags & IPCORK_OPT)
-                       opt = np->cork.opt;
+               opt = np->cork.opt;
                transhdrlen = 0;
                exthdrlen = 0;
                mtu = inet->cork.fragsize;
@@ -1407,9 +1438,15 @@ error:
 
 static void ip6_cork_release(struct inet_sock *inet, struct ipv6_pinfo *np)
 {
-       inet->cork.flags &= ~IPCORK_OPT;
-       kfree(np->cork.opt);
-       np->cork.opt = NULL;
+       if (np->cork.opt) {
+               kfree(np->cork.opt->dst0opt);
+               kfree(np->cork.opt->dst1opt);
+               kfree(np->cork.opt->hopopt);
+               kfree(np->cork.opt->srcrt);
+               kfree(np->cork.opt);
+               np->cork.opt = NULL;
+       }
+
        if (inet->cork.dst) {
                dst_release(inet->cork.dst);
                inet->cork.dst = NULL;
index 3c51b2d827f4b82966502e7a210c028260f52419..228be551e9c1d896eb97ba00ec78fc80cc47d2c0 100644 (file)
@@ -48,6 +48,7 @@
 #include <linux/pim.h>
 #include <net/addrconf.h>
 #include <linux/netfilter_ipv6.h>
+#include <net/ip6_checksum.h>
 
 /* Big lock, protecting vif table, mrt cache and mroute socket state.
    Note that the changes are semaphored via rtnl_lock.
@@ -365,7 +366,9 @@ static int pim6_rcv(struct sk_buff *skb)
        pim = (struct pimreghdr *)skb_transport_header(skb);
        if (pim->type != ((PIM_VERSION << 4) | PIM_REGISTER) ||
            (pim->flags & PIM_NULL_REGISTER) ||
-           (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 &&
+           (csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
+                            sizeof(*pim), IPPROTO_PIM,
+                            csum_partial((void *)pim, sizeof(*pim), 0)) &&
             csum_fold(skb_checksum(skb, 0, skb->len, 0))))
                goto drop;
 
@@ -392,7 +395,7 @@ static int pim6_rcv(struct sk_buff *skb)
        skb_pull(skb, (u8 *)encap - skb->data);
        skb_reset_network_header(skb);
        skb->dev = reg_dev;
-       skb->protocol = htons(ETH_P_IP);
+       skb->protocol = htons(ETH_P_IPV6);
        skb->ip_summed = 0;
        skb->pkt_type = PACKET_HOST;
        dst_release(skb->dst);
@@ -481,6 +484,7 @@ static int mif6_delete(struct net *net, int vifi)
 {
        struct mif_device *v;
        struct net_device *dev;
+       struct inet6_dev *in6_dev;
        if (vifi < 0 || vifi >= net->ipv6.maxvif)
                return -EADDRNOTAVAIL;
 
@@ -513,6 +517,10 @@ static int mif6_delete(struct net *net, int vifi)
 
        dev_set_allmulti(dev, -1);
 
+       in6_dev = __in6_dev_get(dev);
+       if (in6_dev)
+               in6_dev->cnf.mc_forwarding--;
+
        if (v->flags & MIFF_REGISTER)
                unregister_netdevice(dev);
 
@@ -622,6 +630,7 @@ static int mif6_add(struct net *net, struct mif6ctl *vifc, int mrtsock)
        int vifi = vifc->mif6c_mifi;
        struct mif_device *v = &net->ipv6.vif6_table[vifi];
        struct net_device *dev;
+       struct inet6_dev *in6_dev;
        int err;
 
        /* Is vif busy ? */
@@ -662,6 +671,10 @@ static int mif6_add(struct net *net, struct mif6ctl *vifc, int mrtsock)
                return -EINVAL;
        }
 
+       in6_dev = __in6_dev_get(dev);
+       if (in6_dev)
+               in6_dev->cnf.mc_forwarding++;
+
        /*
         *      Fill in the VIF structures
         */
@@ -838,8 +851,6 @@ static int ip6mr_cache_report(struct net *net, struct sk_buff *pkt, mifi_t mifi,
 
        skb->dst = dst_clone(pkt->dst);
        skb->ip_summed = CHECKSUM_UNNECESSARY;
-
-       skb_pull(skb, sizeof(struct ipv6hdr));
        }
 
        if (net->ipv6.mroute6_sk == NULL) {
@@ -1222,8 +1233,10 @@ static int ip6mr_sk_init(struct sock *sk)
 
        rtnl_lock();
        write_lock_bh(&mrt_lock);
-       if (likely(net->ipv6.mroute6_sk == NULL))
+       if (likely(net->ipv6.mroute6_sk == NULL)) {
                net->ipv6.mroute6_sk = sk;
+               net->ipv6.devconf_all->mc_forwarding++;
+       }
        else
                err = -EADDRINUSE;
        write_unlock_bh(&mrt_lock);
@@ -1242,6 +1255,7 @@ int ip6mr_sk_done(struct sock *sk)
        if (sk == net->ipv6.mroute6_sk) {
                write_lock_bh(&mrt_lock);
                net->ipv6.mroute6_sk = NULL;
+               net->ipv6.devconf_all->mc_forwarding--;
                write_unlock_bh(&mrt_lock);
 
                mroute_clean_tables(net);
index c4a59824ac2ce45129508517ef0627e0f0fb96b1..9c574235c9058bb137bcc0f6bc8e8188c7111f63 100644 (file)
@@ -794,7 +794,7 @@ void ip6_route_input(struct sk_buff *skb)
                .proto = iph->nexthdr,
        };
 
-       if (rt6_need_strict(&iph->daddr))
+       if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG)
                flags |= RT6_LOOKUP_F_IFACE;
 
        skb->dst = fib6_rule_lookup(net, &fl, flags, ip6_pol_route_input);
index 5f94db2f3e9ed410e58f660f3ab3c0468e68ff92..1fc4a7885c410f59ce5c81399d6829084a99cdbd 100644 (file)
@@ -77,6 +77,7 @@
 #include <linux/poll.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/mutex.h>
 
 #ifdef CONFIG_INET
 #include <net/inet_common.h>
@@ -175,6 +176,7 @@ struct packet_sock {
 #endif
        struct packet_type      prot_hook;
        spinlock_t              bind_lock;
+       struct mutex            pg_vec_lock;
        unsigned int            running:1,      /* prot_hook is attached*/
                                auxdata:1,
                                origdev:1;
@@ -220,13 +222,13 @@ static void *packet_lookup_frame(struct packet_sock *po, unsigned int position,
        h.raw = po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size);
        switch (po->tp_version) {
        case TPACKET_V1:
-               if (status != h.h1->tp_status ? TP_STATUS_USER :
-                                               TP_STATUS_KERNEL)
+               if (status != (h.h1->tp_status ? TP_STATUS_USER :
+                                               TP_STATUS_KERNEL))
                        return NULL;
                break;
        case TPACKET_V2:
-               if (status != h.h2->tp_status ? TP_STATUS_USER :
-                                               TP_STATUS_KERNEL)
+               if (status != (h.h2->tp_status ? TP_STATUS_USER :
+                                               TP_STATUS_KERNEL))
                        return NULL;
                break;
        }
@@ -1069,6 +1071,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
         */
 
        spin_lock_init(&po->bind_lock);
+       mutex_init(&po->pg_vec_lock);
        po->prot_hook.func = packet_rcv;
 
        if (sock->type == SOCK_PACKET)
@@ -1865,6 +1868,7 @@ static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing
        synchronize_net();
 
        err = -EBUSY;
+       mutex_lock(&po->pg_vec_lock);
        if (closing || atomic_read(&po->mapped) == 0) {
                err = 0;
 #define XC(a, b) ({ __typeof__ ((a)) __t; __t = (a); (a) = (b); __t; })
@@ -1886,6 +1890,7 @@ static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing
                if (atomic_read(&po->mapped))
                        printk(KERN_DEBUG "packet_mmap: vma is busy: %d\n", atomic_read(&po->mapped));
        }
+       mutex_unlock(&po->pg_vec_lock);
 
        spin_lock(&po->bind_lock);
        if (was_running && !po->running) {
@@ -1918,7 +1923,7 @@ static int packet_mmap(struct file *file, struct socket *sock, struct vm_area_st
 
        size = vma->vm_end - vma->vm_start;
 
-       lock_sock(sk);
+       mutex_lock(&po->pg_vec_lock);
        if (po->pg_vec == NULL)
                goto out;
        if (size != po->pg_vec_len*po->pg_vec_pages*PAGE_SIZE)
@@ -1941,7 +1946,7 @@ static int packet_mmap(struct file *file, struct socket *sock, struct vm_area_st
        err = 0;
 
 out:
-       release_sock(sk);
+       mutex_unlock(&po->pg_vec_lock);
        return err;
 }
 #endif
index dcef600d0bf52642106cf07a0d2be9b9c87c4883..5592883e1e4a9feab8c44dbd42d9ef049da0031c 100644 (file)
@@ -6,7 +6,7 @@ config SUNRPC_GSS
 
 config SUNRPC_XPRT_RDMA
        tristate
-       depends on SUNRPC && INFINIBAND && EXPERIMENTAL
+       depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS && EXPERIMENTAL
        default SUNRPC && INFINIBAND
        help
          This option allows the NFS client and server to support
index 87cf4430079c7912d22fb8bbee683f4431e14a02..94d216a464078136c890ad5333be1bc3f15449e5 100644 (file)
 #include "debug-levels.h"
 
 
-/* Debug framework control of debug levels */
-struct d_level D_LEVEL[] = {
-       D_SUBMODULE_DEFINE(debugfs),
-       D_SUBMODULE_DEFINE(id_table),
-       D_SUBMODULE_DEFINE(op_msg),
-       D_SUBMODULE_DEFINE(op_reset),
-       D_SUBMODULE_DEFINE(op_rfkill),
-       D_SUBMODULE_DEFINE(stack),
-};
-size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
-
 #define __debugfs_register(prefix, name, parent)                       \
 do {                                                                   \
        result = d_level_register_debugfs(prefix, name, parent);        \
index d4da92f8981a1760e77e163b3cd61ab5cfe80ad6..3869c0327882ef292d30515cf2586ef7a260dbab 100644 (file)
@@ -516,6 +516,19 @@ void wimax_dev_rm(struct wimax_dev *wimax_dev)
 }
 EXPORT_SYMBOL_GPL(wimax_dev_rm);
 
+
+/* Debug framework control of debug levels */
+struct d_level D_LEVEL[] = {
+       D_SUBMODULE_DEFINE(debugfs),
+       D_SUBMODULE_DEFINE(id_table),
+       D_SUBMODULE_DEFINE(op_msg),
+       D_SUBMODULE_DEFINE(op_reset),
+       D_SUBMODULE_DEFINE(op_rfkill),
+       D_SUBMODULE_DEFINE(stack),
+};
+size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
+
+
 struct genl_family wimax_gnl_family = {
        .id = GENL_ID_GENERATE,
        .name = "WiMAX",
index bc494cef21026e943215670b9899378fcdd900c3..85c9034c59b276fb3a3606f3845e81ea714bc1c5 100644 (file)
@@ -498,6 +498,7 @@ static struct ieee80211_regdomain *country_ie_2_rd(
         * calculate the number of reg rules we will need. We will need one
         * for each channel subband */
        while (country_ie_len >= 3) {
+               int end_channel = 0;
                struct ieee80211_country_ie_triplet *triplet =
                        (struct ieee80211_country_ie_triplet *) country_ie;
                int cur_sub_max_channel = 0, cur_channel = 0;
@@ -509,9 +510,25 @@ static struct ieee80211_regdomain *country_ie_2_rd(
                        continue;
                }
 
+               /* 2 GHz */
+               if (triplet->chans.first_channel <= 14)
+                       end_channel = triplet->chans.first_channel +
+                               triplet->chans.num_channels;
+               else
+                       /*
+                        * 5 GHz -- For example in country IEs if the first
+                        * channel given is 36 and the number of channels is 4
+                        * then the individual channel numbers defined for the
+                        * 5 GHz PHY by these parameters are: 36, 40, 44, and 48
+                        * and not 36, 37, 38, 39.
+                        *
+                        * See: http://tinyurl.com/11d-clarification
+                        */
+                       end_channel =  triplet->chans.first_channel +
+                               (4 * (triplet->chans.num_channels - 1));
+
                cur_channel = triplet->chans.first_channel;
-               cur_sub_max_channel = ieee80211_channel_to_frequency(
-                       cur_channel + triplet->chans.num_channels);
+               cur_sub_max_channel = end_channel;
 
                /* Basic sanity check */
                if (cur_sub_max_channel < cur_channel)
@@ -590,15 +607,6 @@ static struct ieee80211_regdomain *country_ie_2_rd(
                        end_channel = triplet->chans.first_channel +
                                triplet->chans.num_channels;
                else
-                       /*
-                        * 5 GHz -- For example in country IEs if the first
-                        * channel given is 36 and the number of channels is 4
-                        * then the individual channel numbers defined for the
-                        * 5 GHz PHY by these parameters are: 36, 40, 44, and 48
-                        * and not 36, 37, 38, 39.
-                        *
-                        * See: http://tinyurl.com/11d-clarification
-                        */
                        end_channel =  triplet->chans.first_channel +
                                (4 * (triplet->chans.num_channels - 1));
 
@@ -1276,7 +1284,7 @@ static void reg_country_ie_process_debug(
        if (intersected_rd) {
                printk(KERN_DEBUG "cfg80211: We intersect both of these "
                        "and get:\n");
-               print_regdomain_info(rd);
+               print_regdomain_info(intersected_rd);
                return;
        }
        printk(KERN_DEBUG "cfg80211: Intersection between both failed\n");
index e17836680f4980f5fd0d9aad9de4ed674be46a93..0a1798eafb0b5400a0cceea85c072aa0e805f31a 100644 (file)
@@ -1767,7 +1767,7 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file)
                       AFMT_S8 | AFMT_U16_LE |
                       AFMT_U16_BE |
                        AFMT_S32_LE | AFMT_S32_BE |
-                       AFMT_S24_LE | AFMT_S24_LE |
+                       AFMT_S24_LE | AFMT_S24_BE |
                        AFMT_S24_PACKED;
        params = kmalloc(sizeof(*params), GFP_KERNEL);
        if (!params)
index b7bba7dc7cf15ee0e18b6147839d0c3c8ae59d3b..0b708134d12fd74cde9be0e10bcc0fe30a31a7f5 100644 (file)
@@ -487,7 +487,6 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card,
 {
        struct hda_bus *bus;
        int err;
-       char qname[8];
        static struct snd_device_ops dev_ops = {
                .dev_register = snd_hda_bus_dev_register,
                .dev_free = snd_hda_bus_dev_free,
@@ -517,10 +516,12 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card,
        mutex_init(&bus->cmd_mutex);
        INIT_LIST_HEAD(&bus->codec_list);
 
-       snprintf(qname, sizeof(qname), "hda%d", card->number);
-       bus->workq = create_workqueue(qname);
+       snprintf(bus->workq_name, sizeof(bus->workq_name),
+                "hd-audio%d", card->number);
+       bus->workq = create_singlethread_workqueue(bus->workq_name);
        if (!bus->workq) {
-               snd_printk(KERN_ERR "cannot create workqueue %s\n", qname);
+               snd_printk(KERN_ERR "cannot create workqueue %s\n",
+                          bus->workq_name);
                kfree(bus);
                return -ENOMEM;
        }
index 5810ef5884029bba949a4ba8b396478766c93d8f..09a332ada0c68dd8a840de095846fe4f9328abcc 100644 (file)
@@ -614,6 +614,7 @@ struct hda_bus {
 
        /* unsolicited event queue */
        struct hda_bus_unsolicited *unsol;
+       char workq_name[16];
        struct workqueue_struct *workq; /* common workqueue for codecs */
 
        /* assigned PCMs */
index 7ca66d654148bb07723982411e3401acd93f4887..144b85276d5a9431de945d75f4eda4309c4e39d7 100644 (file)
@@ -399,7 +399,8 @@ static void print_conn_list(struct snd_info_buffer *buffer,
 {
        int c, curr = -1;
 
-       if (conn_len > 1 && wid_type != AC_WID_AUD_MIX)
+       if (conn_len > 1 && wid_type != AC_WID_AUD_MIX &&
+           wid_type != AC_WID_VOL_KNB)
                curr = snd_hda_codec_read(codec, nid, 0,
                                          AC_VERB_GET_CONNECT_SEL, 0);
        snd_iprintf(buffer, "  Connection: %d\n", conn_len);
index 75de40aaab0af5d5c558788468132bad574523f4..0177ef8f4c9e9f2af8206a21c307d6795e3dbbd3 100644 (file)
@@ -347,6 +347,7 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol,
                                     &spec->cur_mux[adc_idx]);
 }
 
+#ifdef CONFIG_SND_JACK
 static int conexant_add_jack(struct hda_codec *codec,
                hda_nid_t nid, int type)
 {
@@ -394,7 +395,6 @@ static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid)
 
 static int conexant_init_jacks(struct hda_codec *codec)
 {
-#ifdef CONFIG_SND_JACK
        struct conexant_spec *spec = codec->spec;
        int i;
 
@@ -422,10 +422,19 @@ static int conexant_init_jacks(struct hda_codec *codec)
                        ++hv;
                }
        }
-#endif
        return 0;
 
 }
+#else
+static inline void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid)
+{
+}
+
+static inline int conexant_init_jacks(struct hda_codec *codec)
+{
+       return 0;
+}
+#endif
 
 static int conexant_init(struct hda_codec *codec)
 {
@@ -1566,6 +1575,7 @@ static struct snd_pci_quirk cxt5047_cfg_tbl[] = {
        SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP),
        SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV2000T/DV3000T", CXT5047_LAPTOP),
        SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2000Z", CXT5047_LAPTOP),
+       SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6700", CXT5047_LAPTOP),
        SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P100", CXT5047_LAPTOP_EAPD),
        {}
 };
index 5d249a547fbf69642ebf25a3ddf935f124bbcbc6..ae5c8a0d147934907495e77f79b79aef735dfa4e 100644 (file)
@@ -1037,6 +1037,7 @@ do_sku:
                case 0x10ec0267:
                case 0x10ec0268:
                case 0x10ec0269:
+               case 0x10ec0272:
                case 0x10ec0660:
                case 0x10ec0662:
                case 0x10ec0663:
@@ -1065,6 +1066,7 @@ do_sku:
                case 0x10ec0882:
                case 0x10ec0883:
                case 0x10ec0885:
+               case 0x10ec0887:
                case 0x10ec0889:
                        snd_hda_codec_write(codec, 0x20, 0,
                                            AC_VERB_SET_COEF_INDEX, 7);
@@ -7012,12 +7014,14 @@ static int patch_alc882(struct hda_codec *codec)
                        break;
                case 0x106b1000: /* iMac 24 */
                case 0x106b2800: /* AppleTV */
+               case 0x106b3e00: /* iMac 24 Aluminium */
                        board_config = ALC885_IMAC24;
                        break;
                case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
                case 0x106b00a4: /* MacbookPro4,1 */
                case 0x106b2c00: /* Macbook Pro rev3 */
                case 0x106b3600: /* Macbook 3.1 */
+               case 0x106b3800: /* MacbookPro4,1 - latter revision */
                        board_config = ALC885_MBP3;
                        break;
                default:
@@ -8513,6 +8517,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
        SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
        SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
        SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
+       SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550",
+                     ALC883_FUJITSU_PI2515),
        SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
        SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
                ALC888_FUJITSU_XA3530),
index 3dd4eee70b7caf8c32660688ec7febe6ad9a3ca5..38428e22428f672d8d21ac4c725b24ef9127944d 100644 (file)
@@ -1804,6 +1804,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
                      "HP dv4", STAC_HP_DV5),
        SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc,
                      "HP dv7", STAC_HP_M4),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3600,
+                     "HP dv5", STAC_HP_DV5),
        SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603,
                      "HP dv5", STAC_HP_DV5),
        SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
@@ -2539,6 +2541,8 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
 
        info->name = "STAC92xx Analog";
        info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
+       info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
+               spec->multiout.dac_nids[0];
        info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
        info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
        info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
index 19d3391e229f2f7e02615a12344142464dfcb902..e900cdc84849ae7a7e8eb1225c917ebfc8639dd3 100644 (file)
@@ -617,7 +617,7 @@ static int snd_intel8x0_ali_codec_semaphore(struct intel8x0 *chip)
        int time = 100;
        if (chip->buggy_semaphore)
                return 0; /* just ignore ... */
-       while (time-- && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY))
+       while (--time && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY))
                udelay(1);
        if (! time && ! chip->in_ac97_init)
                snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n");
index c5d67900d666857d7baed233a39d31be01a5be3a..ff0054b765028062bb0040985777969f940fe6fd 100644 (file)
@@ -10,7 +10,7 @@
  * Based on at91-ssc.c by
  * Frank Mandarino <fmandarino@endrelia.com>
  * Based on pxa2xx Platform drivers by
- * Liam Girdwood <liam.girdwood@wolfsonmicro.com>
+ * Liam Girdwood <lrg@slimlogic.co.uk>
  *
  * 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
index a828746e8a2f31f58e9df59f25db9c29961a99b3..391135f9c6c10b0057b7a1b742da180ca44927f2 100644 (file)
@@ -10,7 +10,7 @@
  * Based on at91-ssc.c by
  * Frank Mandarino <fmandarino@endrelia.com>
  * Based on pxa2xx Platform drivers by
- * Liam Girdwood <liam.girdwood@wolfsonmicro.com>
+ * Liam Girdwood <lrg@slimlogic.co.uk>
  *
  * 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
index e3989d406f54d17bb861da78e32d691ba541c1cc..35d99750c383cd48a17603e290d5dce70b7064c7 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
  *
- * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com>
+ * Author: Liam Girdwood <lrg@slimlogic.co.uk>
  *
  * 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
index 6c21b50c93758f28c7aea6d59ae396405d232530..77620ab9875618f9217e8a6479b61478300c5ecf 100644 (file)
@@ -1451,7 +1451,14 @@ static const struct snd_soc_dai wm8753_all_dai[] = {
 },
 };
 
-struct snd_soc_dai wm8753_dai[2];
+struct snd_soc_dai wm8753_dai[] = {
+       {
+               .name = "WM8753 DAI 0",
+       },
+       {
+               .name = "WM8753 DAI 1",
+       },
+};
 EXPORT_SYMBOL_GPL(wm8753_dai);
 
 static void wm8753_set_dai_mode(struct snd_soc_codec *codec, unsigned int mode)
index 5b5afc14447817ede31e23807af451f4def6e989..1cbb7b9b51ce07fd36b099426a5210dc2b4fce44 100644 (file)
@@ -2,8 +2,7 @@
  * wm8990.c  --  WM8990 ALSA Soc Audio driver
  *
  * Copyright 2008 Wolfson Microelectronics PLC.
- * Author: Liam Girdwood
- *         lg@opensource.wolfsonmicro.com or linux@wolfsonmicro.com
+ * Author: Liam Girdwood <lrg@slimlogic.co.uk>
  *
  *  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
index ec5e18a78758346b9340946d30c15bbf9e498b39..05dd5abcddf41d425f97d5883911f74f87dae6dc 100644 (file)
@@ -302,6 +302,10 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
        regs->spcr1     |= RINTM(3);
        regs->rcr2      |= RFIG;
        regs->xcr2      |= XFIG;
+       if (cpu_is_omap2430() || cpu_is_omap34xx()) {
+               regs->xccr = DXENDLY(1) | XDMAEN;
+               regs->rccr = RFULL_CYCLE | RDMAEN;
+       }
 
        switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
        case SND_SOC_DAIFMT_I2S:
index b0362dfd5b719a50839503fd39992c9d6ec8df0d..dd3bb293376277d180749a31783bcb34efdf040c 100644 (file)
@@ -175,9 +175,10 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct omap_runtime_data *prtd = runtime->private_data;
+       unsigned long flags;
        int ret = 0;
 
-       spin_lock_irq(&prtd->lock);
+       spin_lock_irqsave(&prtd->lock, flags);
        switch (cmd) {
        case SNDRV_PCM_TRIGGER_START:
        case SNDRV_PCM_TRIGGER_RESUME:
@@ -195,7 +196,7 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
        default:
                ret = -EINVAL;
        }
-       spin_unlock_irq(&prtd->lock);
+       spin_unlock_irqrestore(&prtd->lock, flags);
 
        return ret;
 }
index c709b9563226c0b343f98588f4bc91345c5bf185..2ab83129d9b04b846c7fd15a076a53cdef1d1c21 100644 (file)
@@ -2966,6 +2966,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
                return -EINVAL;
        }
        alts = &iface->altsetting[fp->altset_idx];
+       fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
        usb_set_interface(chip->dev, fp->iface, 0);
        init_usb_pitch(chip->dev, fp->iface, alts, fp);
        init_usb_sample_rate(chip->dev, fp->iface, alts, fp, fp->rate_max);