]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge current mainline tree into linux-omap tree
authorTony Lindgren <tony@atomide.com>
Tue, 15 Jan 2008 01:13:45 +0000 (17:13 -0800)
committerTony Lindgren <tony@atomide.com>
Tue, 15 Jan 2008 01:13:45 +0000 (17:13 -0800)
Merge branches 'master' and 'linus'

482 files changed:
Documentation/kernel-parameters.txt
Documentation/lguest/lguest.txt
Documentation/nfsroot.txt
Documentation/sysctl/vm.txt
Documentation/vm/hugetlbpage.txt
MAINTAINERS
Makefile
arch/alpha/Makefile
arch/alpha/kernel/err_ev7.c
arch/alpha/kernel/err_marvel.c
arch/alpha/kernel/err_titan.c
arch/alpha/kernel/machvec_impl.h
arch/alpha/lib/ev6-stxncpy.S
arch/alpha/lib/strncpy.S
arch/alpha/lib/stxncpy.S
arch/arm/mach-at91/board-ek.c
arch/arm/mach-pxa/pxa25x.c
arch/arm/vfp/vfp.h
arch/arm/vfp/vfpdouble.c
arch/cris/arch-v10/drivers/ds1302.c
arch/cris/arch-v10/kernel/signal.c
arch/cris/arch-v10/kernel/time.c
arch/ia64/hp/common/sba_iommu.c
arch/ia64/ia32/binfmt_elf32.c
arch/ia64/kernel/head.S
arch/ia64/kernel/irq_ia64.c
arch/ia64/kernel/mca.c
arch/ia64/kernel/process.c
arch/ia64/kernel/signal.c
arch/ia64/kernel/uncached.c
arch/ia64/mm/tlb.c
arch/ia64/sn/kernel/bte.c
arch/ia64/sn/kernel/bte_error.c
arch/ia64/sn/kernel/xp_nofault.S
arch/ia64/sn/pci/tioce_provider.c
arch/mips/Kconfig
arch/mips/au1000/common/pci.c
arch/mips/kernel/head.S
arch/mips/kernel/setup.c
arch/mips/kernel/time.c
arch/mips/lasat/image/Makefile
arch/mips/mips-boards/generic/memory.c
arch/mips/mips-boards/generic/reset.c
arch/mips/mm/dma-default.c
arch/mips/pci/ops-au1000.c
arch/mips/pci/ops-mace.c
arch/mips/pci/pci-ip32.c
arch/mips/philips/pnx8550/common/time.c
arch/mips/sgi-ip32/ip32-irq.c
arch/mips/sgi-ip32/ip32-platform.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/mm/slb.c
arch/powerpc/platforms/cell/Kconfig
arch/powerpc/platforms/cell/Makefile
arch/powerpc/platforms/cell/spu_notify.c [new file with mode: 0644]
arch/powerpc/platforms/cell/spu_syscalls.c
arch/powerpc/platforms/cell/spufs/context.c
arch/powerpc/platforms/cell/spufs/sched.c
arch/powerpc/platforms/cell/spufs/syscalls.c
arch/powerpc/platforms/ps3/os-area.c
arch/powerpc/platforms/pseries/hotplug-cpu.c
arch/powerpc/platforms/pseries/lpar.c
arch/sparc/kernel/ptrace.c
arch/sparc64/kernel/pci.c
arch/sparc64/kernel/pci_schizo.c
arch/um/drivers/harddog_user.c
arch/um/drivers/net_user.c
arch/um/drivers/slip_user.c
arch/um/drivers/slirp_user.c
arch/um/drivers/ubd_user.c
arch/um/include/os.h
arch/um/os-Linux/aio.c
arch/um/os-Linux/drivers/ethertap_user.c
arch/um/os-Linux/drivers/tuntap_user.c
arch/um/os-Linux/helper.c
arch/um/os-Linux/process.c
arch/um/os-Linux/skas/process.c
arch/um/os-Linux/util.c
arch/x86/kernel/apic_32.c
arch/x86/kernel/apm_32.c
arch/x86/kernel/cpu/intel_cacheinfo.c
arch/x86/kernel/head_32.S
arch/x86/kernel/io_apic_32.c
arch/x86/kernel/io_apic_64.c
arch/x86/kernel/kprobes_32.c
arch/x86/kernel/kprobes_64.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
arch/x86/kernel/setup_32.c
arch/x86/kernel/smpboot_32.c
arch/x86/kernel/smpboot_64.c
arch/x86/kernel/suspend_64.c
arch/x86/kernel/traps_32.c
arch/x86/oprofile/op_model_athlon.c
block/as-iosched.c
block/blktrace.c
block/cfq-iosched.c
block/deadline-iosched.c
block/elevator.c
block/noop-iosched.c
block/scsi_ioctl.c
drivers/acpi/Kconfig
drivers/acpi/ac.c
drivers/acpi/battery.c
drivers/acpi/bus.c
drivers/acpi/ec.c
drivers/acpi/events/evregion.c
drivers/acpi/pci_irq.c
drivers/acpi/processor_idle.c
drivers/acpi/sbs.c
drivers/acpi/scan.c
drivers/ata/libata-acpi.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-pmp.c
drivers/ata/libata-scsi.c
drivers/ata/libata-sff.c
drivers/ata/libata.h
drivers/ata/pata_hpt37x.c
drivers/ata/pata_ixp4xx_cf.c
drivers/ata/pata_pdc202xx_old.c
drivers/ata/sata_mv.c
drivers/ata/sata_qstor.c
drivers/ata/sata_sil.c
drivers/ata/sata_sil24.c
drivers/atm/firestream.c
drivers/atm/nicstar.c
drivers/block/cciss.c
drivers/block/loop.c
drivers/block/pktcdvd.c
drivers/block/umem.c
drivers/char/tpm/tpm.c
drivers/char/tty_ioctl.c
drivers/connector/cn_queue.c
drivers/connector/connector.c
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq_stats.c
drivers/crypto/padlock-aes.c
drivers/dma/ioat_dma.c
drivers/dma/ioatdma.h
drivers/firmware/dmi-id.c
drivers/hwmon/w83627ehf.c
drivers/i2c/busses/i2c-at91.c
drivers/i2c/busses/i2c-powermac.c
drivers/i2c/busses/i2c-sibyte.c
drivers/i2c/i2c-dev.c
drivers/ide/ide-acpi.c
drivers/ide/ide-cd.c
drivers/ide/ide-cd.h
drivers/ide/ide-iops.c
drivers/ide/pci/cmd64x.c
drivers/ide/pci/cs5535.c
drivers/ide/pci/trm290.c
drivers/infiniband/hw/mlx4/cq.c
drivers/infiniband/ulp/srp/ib_srp.c
drivers/input/gameport/gameport.c
drivers/input/input.c
drivers/input/keyboard/Kconfig
drivers/input/keyboard/jornada680_kbd.c
drivers/input/keyboard/spitzkbd.c
drivers/input/touchscreen/Kconfig
drivers/isdn/i4l/isdn_common.c
drivers/isdn/i4l/isdn_tty.c
drivers/leds/led-class.c
drivers/leds/led-core.c
drivers/leds/led-triggers.c
drivers/leds/leds-locomo.c
drivers/leds/leds.h
drivers/macintosh/adbhid.c
drivers/macintosh/via-pmu.c
drivers/md/Kconfig
drivers/md/dm-crypt.c
drivers/md/dm-ioctl.c
drivers/md/dm-table.c
drivers/md/dm.c
drivers/md/dm.h
drivers/md/raid5.c
drivers/media/dvb/ttpci/av7110.c
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/cx23885/Kconfig
drivers/media/video/ivtv/ivtv-i2c.c
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h
drivers/mtd/chips/cfi_cmdset_0001.c
drivers/net/3c509.c
drivers/net/Kconfig
drivers/net/cassini.c
drivers/net/cassini.h
drivers/net/dl2k.c
drivers/net/dl2k.h
drivers/net/e100.c
drivers/net/e1000/e1000_main.c
drivers/net/e1000e/netdev.c
drivers/net/epic100.c
drivers/net/fec_8xx/fec_main.c
drivers/net/fec_mpc52xx.c
drivers/net/forcedeth.c
drivers/net/fs_enet/fs_enet-main.c
drivers/net/hamachi.c
drivers/net/ibm_newemac/debug.c
drivers/net/ixgb/ixgb_main.c
drivers/net/ixgbe/ixgbe_main.c
drivers/net/ixp2000/ixpdev.c
drivers/net/loopback.c
drivers/net/macb.c
drivers/net/meth.c
drivers/net/myri10ge/myri10ge.c
drivers/net/natsemi.c
drivers/net/netx-eth.c
drivers/net/netxen/netxen_nic.h
drivers/net/netxen/netxen_nic_init.c
drivers/net/netxen/netxen_nic_main.c
drivers/net/netxen/netxen_nic_niu.c
drivers/net/niu.c
drivers/net/pcmcia/3c574_cs.c
drivers/net/pcmcia/3c589_cs.c
drivers/net/pcmcia/pcnet_cs.c
drivers/net/pcnet32.c
drivers/net/qla3xxx.c
drivers/net/r8169.c
drivers/net/rrunner.c
drivers/net/rrunner.h
drivers/net/s2io.c
drivers/net/sis190.c
drivers/net/sky2.c
drivers/net/sky2.h
drivers/net/smc911x.h
drivers/net/starfire.c
drivers/net/sundance.c
drivers/net/tg3.c
drivers/net/tokenring/3c359.c
drivers/net/tokenring/3c359.h
drivers/net/tulip/de4x5.c
drivers/net/tulip/interrupt.c
drivers/net/tulip/tulip_core.c
drivers/net/tulip/xircom_cb.c
drivers/net/tun.c
drivers/net/typhoon.c
drivers/net/typhoon.h
drivers/net/ucc_geth.c
drivers/net/ucc_geth_mii.h
drivers/net/usb/asix.c
drivers/net/usb/kaweth.c
drivers/net/usb/mcs7830.c
drivers/net/veth.c
drivers/net/wan/cycx_x25.c
drivers/net/wireless/Kconfig
drivers/net/wireless/b43/b43.h
drivers/net/wireless/b43/leds.c
drivers/net/wireless/b43/main.c
drivers/net/wireless/b43/main.h
drivers/net/wireless/b43/rfkill.c
drivers/net/wireless/b43/xmit.c
drivers/net/wireless/b43/xmit.h
drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
drivers/net/wireless/ipw2200.c
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/iwlwifi/iwl4965-base.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2x00pci.c
drivers/net/wireless/rt2x00/rt2x00usb.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rtl8187_dev.c
drivers/net/wireless/zd1211rw/zd_mac.c
drivers/net/xen-netfront.c
drivers/net/yellowfin.c
drivers/parport/procfs.c
drivers/pci/probe.c
drivers/pci/quirks.c
drivers/pcmcia/pxa2xx_lubbock.c
drivers/pnp/pnpacpi/rsparser.c
drivers/ps3/ps3-vuart.c
drivers/rtc/rtc-at32ap700x.c
drivers/scsi/advansys.c
drivers/scsi/dpt_i2o.c
drivers/scsi/initio.c
drivers/scsi/qla1280.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_priv.h
drivers/scsi/scsi_sysfs.c
drivers/scsi/scsi_transport_srp.c
drivers/scsi/st.c
drivers/scsi/sym53c8xx_2/sym_glue.c
drivers/scsi/sym53c8xx_2/sym_hipd.c
drivers/serial/suncore.c
drivers/spi/spi_bitbang.c
drivers/ssb/scan.c
drivers/usb/gadget/fsl_usb2_udc.c
drivers/usb/serial/cp2101.c
drivers/usb/serial/pl2303.c
drivers/usb/serial/sierra.c
drivers/video/atmel_lcdfb.c
drivers/video/ps3fb.c
drivers/video/s3c2410fb.c
drivers/video/uvesafb.c
drivers/w1/w1.c
fs/Kconfig
fs/binfmt_aout.c
fs/binfmt_elf.c
fs/compat_ioctl.c
fs/dquot.c
fs/ecryptfs/crypto.c
fs/ecryptfs/inode.c
fs/ecryptfs/keystore.c
fs/ecryptfs/main.c
fs/ecryptfs/messaging.c
fs/ecryptfs/mmap.c
fs/ecryptfs/read_write.c
fs/ecryptfs/super.c
fs/ext3/super.c
fs/ext4/super.c
fs/fat/fatent.c
fs/hfs/bfind.c
fs/hfs/brec.c
fs/hfs/btree.c
fs/hfs/hfs.h
fs/namei.c
fs/nfs/nfs4_fs.h
fs/nfs/nfs4proc.c
fs/nfs/nfs4renewd.c
fs/nfs/nfs4state.c
fs/nfs/super.c
fs/nfsd/nfs3xdr.c
fs/nfsd/nfsxdr.c
fs/proc/array.c
fs/proc/base.c
fs/proc/internal.h
fs/proc/proc_misc.c
fs/proc/task_mmu.c
fs/proc/task_nommu.c
fs/xfs/linux-2.6/xfs_file.c
fs/xfs/linux-2.6/xfs_iops.c
fs/xfs/xfs_dir2_block.c
fs/xfs/xfs_dir2_leaf.c
fs/xfs/xfs_dir2_sf.c
fs/xfs/xfs_inode.c
include/asm-alpha/io_trivial.h
include/asm-arm/arch-pxa/hardware.h
include/asm-arm/system.h
include/asm-cris/unistd.h
include/asm-generic/tlb.h
include/asm-ia64/bitops.h
include/asm-ia64/gcc_intrin.h
include/asm-ia64/hw_irq.h
include/asm-ia64/intel_intrin.h
include/asm-ia64/sn/bte.h
include/asm-ia64/sn/xp.h
include/asm-ia64/sn/xpc.h
include/asm-ia64/tlbflush.h
include/asm-powerpc/mmu-hash64.h
include/asm-powerpc/spu.h
include/asm-sh/cacheflush.h
include/asm-sh/uaccess.h
include/asm-sparc64/dma-mapping.h
include/asm-sparc64/pci.h
include/asm-x86/byteorder.h
include/asm-x86/kprobes_32.h
include/asm-x86/kprobes_64.h
include/asm-x86/msr.h
include/asm-x86/system_64.h
include/linux/Kbuild
include/linux/apm_bios.h
include/linux/ata.h
include/linux/cpu.h
include/linux/cpumask.h
include/linux/device-mapper.h
include/linux/elevator.h
include/linux/hugetlb.h
include/linux/i2c-id.h
include/linux/irq.h
include/linux/key.h
include/linux/libata.h
include/linux/mmc/host.h
include/linux/netdevice.h
include/linux/pci_ids.h
include/linux/pm.h
include/linux/pm_legacy.h
include/linux/pnp.h
include/linux/ptrace.h
include/linux/quicklist.h
include/linux/scatterlist.h
include/linux/sched.h
include/linux/slab.h
include/linux/slab_def.h
include/linux/tc_act/Kbuild
include/linux/tty.h
include/linux/veth.h [moved from include/net/veth.h with 100% similarity]
include/net/ax25.h
include/net/ip6_tunnel.h
include/net/irda/discovery.h
include/net/netfilter/nf_conntrack.h
include/net/sch_generic.h
include/net/sctp/structs.h
include/net/sctp/user.h
include/net/sock.h
include/net/xfrm.h
init/Kconfig
kernel/acct.c
kernel/futex.c
kernel/irq/chip.c
kernel/kexec.c
kernel/module.c
kernel/panic.c
kernel/params.c
kernel/power/main.c
kernel/power/pm.c
kernel/printk.c
kernel/ptrace.c
kernel/rwsem.c
kernel/sched.c
kernel/sched_debug.c
kernel/sched_fair.c
kernel/sched_rt.c
kernel/sysctl.c
kernel/sysctl_check.c
kernel/time/tick-broadcast.c
kernel/timer.c
lib/proportions.c
lib/rwsem.c
mm/Kconfig
mm/filemap.c
mm/filemap_xip.c
mm/hugetlb.c
mm/page_alloc.c
mm/quicklist.c
mm/slab.c
mm/slub.c
mm/sparse.c
net/atm/mpc.c
net/ax25/ax25_in.c
net/bluetooth/hci_conn.c
net/bluetooth/hci_sysfs.c
net/compat.c
net/core/dev.c
net/core/scm.c
net/core/skbuff.c
net/dccp/ackvec.h
net/dccp/ccids/ccid3.c
net/ipv4/arp.c
net/ipv4/devinet.c
net/ipv4/fib_frontend.c
net/ipv4/inet_lro.c
net/ipv4/ip_gre.c
net/ipv4/ipconfig.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
net/ipv4/netfilter/nf_nat_sip.c
net/ipv4/raw.c
net/ipv4/route.c
net/ipv4/tcp_input.c
net/ipv6/datagram.c
net/ipv6/ndisc.c
net/irda/af_irda.c
net/irda/ircomm/ircomm_param.c
net/irda/irlan/irlan_eth.c
net/irda/irlap_frame.c
net/irda/parameters.c
net/irda/wrapper.c
net/key/af_key.c
net/mac80211/ieee80211.c
net/mac80211/ieee80211_ioctl.c
net/mac80211/ieee80211_rate.c
net/mac80211/ieee80211_sta.c
net/mac80211/rx.c
net/mac80211/sta_info.c
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_conntrack_sip.c
net/netlabel/netlabel_mgmt.c
net/netrom/nr_dev.c
net/sched/sch_hfsc.c
net/sctp/sm_make_chunk.c
net/sctp/sm_statefuns.c
net/sctp/ulpevent.c
net/sunrpc/auth_gss/auth_gss.c
net/x25/x25_forward.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c
scripts/bloat-o-meter
scripts/kconfig/conf.c
sound/core/oss/mixer_oss.c
sound/oss/msnd.h

index 33121d6c827c6e5fcc85d72b1f5ee5f166b743a2..c4178778e7fd01d65b99b2279aecad0727701770 100644 (file)
@@ -527,29 +527,30 @@ and is between 256 and 4096 characters. It is defined in the file
                        Format: <area>[,<node>]
                        See also Documentation/networking/decnet.txt.
 
-       default_blu=    [VT]
+       vt.default_blu= [VT]
                        Format: <blue0>,<blue1>,<blue2>,...,<blue15>
                        Change the default blue palette of the console.
                        This is a 16-member array composed of values
                        ranging from 0-255.
 
-       default_grn=    [VT]
+       vt.default_grn= [VT]
                        Format: <green0>,<green1>,<green2>,...,<green15>
                        Change the default green palette of the console.
                        This is a 16-member array composed of values
                        ranging from 0-255.
 
-       default_red=    [VT]
+       vt.default_red= [VT]
                        Format: <red0>,<red1>,<red2>,...,<red15>
                        Change the default red palette of the console.
                        This is a 16-member array composed of values
                        ranging from 0-255.
 
-       default_utf8=   [VT]
+       vt.default_utf8=
+                       [VT]
                        Format=<0|1>
                        Set system-wide default UTF-8 mode for all tty's.
-                       Default is 0 and by setting to 1, it enables UTF-8
-                       mode for all newly opened or allocated terminals.
+                       Default is 1, i.e. UTF-8 mode is enabled for all
+                       newly opened terminals.
 
        dhash_entries=  [KNL]
                        Set number of hash buckets for dentry cache.
@@ -882,6 +883,14 @@ and is between 256 and 4096 characters. It is defined in the file
        lapic_timer_c2_ok       [X86-32,x86-64,APIC] trust the local apic timer in
                        C2 power state.
 
+       libata.dma=     [LIBATA] DMA control
+                       libata.dma=0      Disable all PATA and SATA DMA
+                       libata.dma=1      PATA and SATA Disk DMA only
+                       libata.dma=2      ATAPI (CDROM) DMA only
+                       libata.dma=4      Compact Flash DMA only 
+                       Combinations also work, so libata.dma=3 enables DMA
+                       for disks and CDROMs, but not CFs.
+
        libata.noacpi   [LIBATA] Disables use of ACPI in libata suspend/resume
                        when set.
                        Format: <int>
index 7885ab2d5f53710d54676c1e8df6be8f224c36ca..722d4e7fbebe479001ee2bd6a8891fc2572bd1e1 100644 (file)
@@ -109,10 +109,6 @@ Running Lguest:
   See http://linux-net.osdl.org/index.php/Bridge for general information
   on how to get bridging working.
 
-- You can also create an inter-guest network using
-  "--sharenet=<filename>": any two guests using the same file are on
-  the same network.  This file is created if it does not exist.
-
 There is a helpful mailing list at http://ozlabs.org/mailman/listinfo/lguest
 
 Good luck!
index 9b956a96936204c19545a3871b42b949a48a842a..31b329172343546e8f1e1fb4a30549298d45ee68 100644 (file)
@@ -97,10 +97,6 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
   autoconfiguration will take place.  The most common way to use this
   is "ip=dhcp".
 
-  Note that "ip=off" is not the same thing as "ip=::::::off", because in
-  the latter autoconfiguration will take place if any of DHCP, BOOTP or RARP
-  are compiled in the kernel.
-
   <client-ip>  IP address of the client.
 
                Default:  Determined using autoconfiguration.
@@ -149,7 +145,9 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
                this option.
 
                   off or none: don't use autoconfiguration
+                               (do static IP assignment instead)
                  on or any:   use any protocol available in the kernel
+                              (default)
                  dhcp:        use DHCP
                  bootp:       use BOOTP
                  rarp:        use RARP
index b89570c304346f4ddf928996044bcbc7f2e72a72..6f31f0a247d03137b85955bf59d06a666e34b1a0 100644 (file)
@@ -34,6 +34,8 @@ Currently, these files are in /proc/sys/vm:
 - oom_kill_allocating_task
 - mmap_min_address
 - numa_zonelist_order
+- nr_hugepages
+- nr_overcommit_hugepages
 
 ==============================================================
 
@@ -305,3 +307,20 @@ will select "node" order in following case.
 
 Otherwise, "zone" order will be selected. Default order is recommended unless
 this is causing problems for your system/application.
+
+==============================================================
+
+nr_hugepages
+
+Change the minimum size of the hugepage pool.
+
+See Documentation/vm/hugetlbpage.txt
+
+==============================================================
+
+nr_overcommit_hugepages
+
+Change the maximum size of the hugepage pool. The maximum is
+nr_hugepages + nr_overcommit_hugepages.
+
+See Documentation/vm/hugetlbpage.txt
index 51ccc48aa763a55dd641eb32fd05ceff63a80a67..f962d01bea2a34efe494f83127ac957e8498dd99 100644 (file)
@@ -30,9 +30,10 @@ alignment and size of the arguments to the above system calls.
 The output of "cat /proc/meminfo" will have lines like:
 
 .....
-HugePages_Total: xxx
-HugePages_Free:  yyy
-HugePages_Rsvd:  www
+HugePages_Total: vvv
+HugePages_Free:  www
+HugePages_Rsvd:  xxx
+HugePages_Surp:  yyy
 Hugepagesize:    zzz kB
 
 where:
@@ -42,6 +43,10 @@ allocated.
 HugePages_Rsvd is short for "reserved," and is the number of hugepages
 for which a commitment to allocate from the pool has been made, but no
 allocation has yet been made. It's vaguely analogous to overcommit.
+HugePages_Surp is short for "surplus," and is the number of hugepages in
+the pool above the value in /proc/sys/vm/nr_hugepages. The maximum
+number of surplus hugepages is controlled by
+/proc/sys/vm/nr_overcommit_hugepages.
 
 /proc/filesystems should also show a filesystem of type "hugetlbfs" configured
 in the kernel.
@@ -71,7 +76,25 @@ or failure of allocation depends on the amount of physically contiguous
 memory that is preset in system at this time.  System administrators may want
 to put this command in one of the local rc init files.  This will enable the
 kernel to request huge pages early in the boot process (when the possibility
-of getting physical contiguous pages is still very high).
+of getting physical contiguous pages is still very high). In either
+case, adminstrators will want to verify the number of hugepages actually
+allocated by checking the sysctl or meminfo.
+
+/proc/sys/vm/nr_overcommit_hugepages indicates how large the pool of
+hugepages can grow, if more hugepages than /proc/sys/vm/nr_hugepages are
+requested by applications. echo'ing any non-zero value into this file
+indicates that the hugetlb subsystem is allowed to try to obtain
+hugepages from the buddy allocator, if the normal pool is exhausted. As
+these surplus hugepages go out of use, they are freed back to the buddy
+allocator.
+
+Caveat: Shrinking the pool via nr_hugepages while a surplus is in effect
+will allow the number of surplus huge pages to exceed the overcommit
+value, as the pool hugepages (which must have been in use for a surplus
+hugepages to be allocated) will become surplus hugepages.  As long as
+this condition holds, however, no more surplus huge pages will be
+allowed on the system until one of the two sysctls are increased
+sufficiently, or the surplus huge pages go out of use and are freed.
 
 If the user applications are going to request hugepages using mmap system
 call, then it is required that system administrator mount a file system of
@@ -94,8 +117,8 @@ provided on command line then no limits are set.  For size and nr_inodes
 options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For
 example, size=2K has the same meaning as size=2048.
 
-read and write system calls are not supported on files that reside on hugetlb
-file systems.
+While read system calls are supported on files that reside on hugetlb
+file systems, write system calls are not.
 
 Regular chown, chgrp, and chmod commands (with right permissions) could be
 used to change the file attributes on hugetlbfs.
index a04fd3f0d0b9143f1ca094b1b69d887f7717c46a..57fc2cc5471eed630b7043e2e8ec26b145ac1527 100644 (file)
@@ -665,12 +665,18 @@ S:        Maintained
 
 ATMEL AT91 MCI DRIVER
 P:     Nicolas Ferre
-M:     nicolas.ferre@rfo.atmel.com
+M:     nicolas.ferre@atmel.com
 L:     linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
 W:     http://www.atmel.com/products/AT91/
 W:     http://www.at91.com/
 S:     Maintained
 
+ATMEL LCDFB DRIVER
+P:     Nicolas Ferre
+M:     nicolas.ferre@atmel.com
+L:     linux-fbdev-devel@lists.sourceforge.net (subscribers-only)
+S:     Maintained
+
 ATMEL MACB ETHERNET DRIVER
 P:     Haavard Skinnemoen
 M:     hskinnemoen@atmel.com
@@ -1870,8 +1876,10 @@ T:       quilt kernel.org/pub/linux/kernel/people/bart/pata-2.6/
 S:     Maintained
 
 IDE/ATAPI CDROM DRIVER
+P:     Borislav Petkov
+M:     bbpetkov@yahoo.de
 L:     linux-ide@vger.kernel.org
-S:     Unmaintained
+S:     Maintained
 
 IDE/ATAPI FLOPPY DRIVERS
 P:     Paul Bristow
@@ -1917,7 +1925,7 @@ INFINIBAND SUBSYSTEM
 P:     Roland Dreier
 M:     rolandd@cisco.com
 P:     Sean Hefty
-M:     mshefty@ichips.intel.com
+M:     sean.hefty@intel.com
 P:     Hal Rosenstock
 M:     hal.rosenstock@gmail.com 
 L:     general@lists.openfabrics.org
@@ -1982,29 +1990,27 @@ L:      netdev@vger.kernel.org
 S:     Maintained
 
 INTEL PRO/100 ETHERNET SUPPORT
-P:     John Ronciak
-M:     john.ronciak@intel.com
+P:     Auke Kok
+M:     auke-jan.h.kok@intel.com
 P:     Jesse Brandeburg
 M:     jesse.brandeburg@intel.com
 P:     Jeff Kirsher
 M:     jeffrey.t.kirsher@intel.com
-P:     Auke Kok
-M:     auke-jan.h.kok@intel.com
+P:     John Ronciak
+M:     john.ronciak@intel.com
 L:     e1000-devel@lists.sourceforge.net
 W:     http://sourceforge.net/projects/e1000/
 S:     Supported
 
 INTEL PRO/1000 GIGABIT ETHERNET SUPPORT
-P:     Jeb Cramer
-M:     cramerj@intel.com
-P:     John Ronciak
-M:     john.ronciak@intel.com
+P:     Auke Kok
+M:     auke-jan.h.kok@intel.com
 P:     Jesse Brandeburg
 M:     jesse.brandeburg@intel.com
 P:     Jeff Kirsher
 M:     jeffrey.t.kirsher@intel.com
-P:     Auke Kok
-M:     auke-jan.h.kok@intel.com
+P:     John Ronciak
+M:     john.ronciak@intel.com
 L:     e1000-devel@lists.sourceforge.net
 W:     http://sourceforge.net/projects/e1000/
 S:     Supported
@@ -2029,7 +2035,7 @@ P:        James Ketrenos
 M:     jketreno@linux.intel.com
 L:     linux-wireless@vger.kernel.org
 L:     ipw2100-devel@lists.sourceforge.net
-L:     http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel
+W:     http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel
 W:     http://ipw2100.sourceforge.net
 S:     Supported
 
@@ -2040,7 +2046,7 @@ P:        James Ketrenos
 M:     jketreno@linux.intel.com
 L:     linux-wireless@vger.kernel.org
 L:     ipw2100-devel@lists.sourceforge.net
-L:     http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel
+W:     http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel
 W:     http://ipw2200.sourceforge.net
 S:     Supported
 
@@ -2489,6 +2495,12 @@ M:       mtk.manpages@gmail.com
 W:     ftp://ftp.kernel.org/pub/linux/docs/manpages
 S:     Maintained
 
+MARVELL LIBERTAS WIRELESS DRIVER
+P:     Dan Williams
+M:     dcbw@redhat.com
+L:     libertas-dev@lists.infradead.org
+S:     Maintained
+
 MARVELL MV643XX ETHERNET DRIVER
 P:     Dale Farnsworth
 M:     dale@farnsworth.org
@@ -2591,7 +2603,7 @@ S:        Maintained
 MSI LAPTOP SUPPORT
 P:     Lennart Poettering
 M:     mzxreary@0pointer.de
-L:     https://tango.0pointer.de/mailman/listinfo/s270-linux
+W:     https://tango.0pointer.de/mailman/listinfo/s270-linux
 W:     http://0pointer.de/lennart/tchibo.html
 S:     Maintained
 
@@ -2733,8 +2745,8 @@ T:        git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git
 S:     Maintained
 
 NETXEN (1/10) GbE SUPPORT
-P:     Amit S. Kale
-M:     amitkale@netxen.com
+P:     Dhananjay Phadke
+M:     dhananjay@netxen.com
 L:     netdev@vger.kernel.org
 W:     http://www.netxen.com
 S:     Supported
@@ -3605,8 +3617,10 @@ L:       linux-kernel@vger.kernel.org ?
 S:     Supported
 
 SPIDERNET NETWORK DRIVER for CELL
-P:     Linas Vepstas
-M:     linas@austin.ibm.com
+P:     Ishizaki Kou
+M:     kou.ishizaki@toshiba.co.jp
+P:     Jens Osterkamp
+M:     jens@de.ibm.com
 L:     netdev@vger.kernel.org
 S:     Supported
 
@@ -4048,6 +4062,14 @@ L:       user-mode-linux-user@lists.sourceforge.net
 W:     http://user-mode-linux.sourceforge.net
 S:     Maintained
 
+USERSPACE I/O (UIO)
+P:     Hans J. Koch
+M:     hjk@linutronix.de
+P:     Greg Kroah-Hartman
+M:     gregkh@suse.de
+L:     linux-kernel@vger.kernel.org
+S:     Maintained
+
 FAT/VFAT/MSDOS FILESYSTEM:
 P:     OGAWA Hirofumi
 M:     hirofumi@mail.parknet.co.jp
index bc6dbf358be8e2184dc5e226a78c77c9d580a8a4..f467da40c0bf3cdaedbd09c95b29bbb70c9d60c5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 24
-EXTRAVERSION = -rc5
+EXTRAVERSION = -rc7
 NAME = Arr Matey! A Hairy Bilge Rat!
 
 # *DOCUMENTATION*
index 63104ebd18063fafe17c7e116963b1299e895d15..4e1a8e2c45410746b0b8176c6356068f433a8be2 100644 (file)
@@ -14,13 +14,13 @@ LDFLAGS_vmlinux     := -static -N #-relax
 CHECKFLAGS     += -D__alpha__ -m64
 cflags-y       := -pipe -mno-fp-regs -ffixed-8 -msmall-data
 
-cpuflags-$(CONFIG_ALPHA_EV67)          := -mcpu=ev67
-cpuflags-$(CONFIG_ALPHA_EV6)           := -mcpu=ev6
+cpuflags-$(CONFIG_ALPHA_EV4)           := -mcpu=ev4
+cpuflags-$(CONFIG_ALPHA_EV5)           := -mcpu=ev5
+cpuflags-$(CONFIG_ALPHA_EV56)          := -mcpu=ev56
 cpuflags-$(CONFIG_ALPHA_POLARIS)       := -mcpu=pca56
 cpuflags-$(CONFIG_ALPHA_SX164)         := -mcpu=pca56
-cpuflags-$(CONFIG_ALPHA_EV56)          := -mcpu=ev56
-cpuflags-$(CONFIG_ALPHA_EV5)           := -mcpu=ev5
-cpuflags-$(CONFIG_ALPHA_EV4)           := -mcpu=ev4
+cpuflags-$(CONFIG_ALPHA_EV6)           := -mcpu=ev6
+cpuflags-$(CONFIG_ALPHA_EV67)          := -mcpu=ev67
 # If GENERIC, make sure to turn off any instruction set extensions that
 # the host compiler might have on by default.  Given that EV4 and EV5
 # have the same instruction set, prefer EV5 because an EV5 schedule is
index bc799f72d8c1ae6cb6e490e0c5bb15db179f8a11..68cd493f54c5fd93b5fddec8eb2323a65e124924 100644 (file)
@@ -273,7 +273,7 @@ ev7_process_pal_subpacket(struct el_subpacket *header)
 struct el_subpacket_handler ev7_pal_subpacket_handler =
        SUBPACKET_HANDLER_INIT(EL_CLASS__PAL, ev7_process_pal_subpacket);
 
-void
+void __init
 ev7_register_error_handlers(void)
 {
        int i;
index 497877bf20127daad85ee837ea829eec85c982aa..413bf37eb094057b0e38e03b965764056cb11c5a 100644 (file)
@@ -1152,7 +1152,7 @@ marvel_machine_check(u64 vector, u64 la_ptr)
        mb();
 }
 
-void
+void __init
 marvel_register_error_handlers(void)
 {
        ev7_register_error_handlers();
index 6f3867877d9e451f9e8278094f385d50a0fed660..257449ed15efca1ac97d46e999acb0e223e62408 100644 (file)
@@ -564,7 +564,7 @@ static struct el_subpacket_handler titan_subpacket_handler =
        SUBPACKET_HANDLER_INIT(EL_CLASS__REGATTA_FAMILY, 
                               el_process_regatta_subpacket);
 
-void
+void __init
 titan_register_error_handlers(void)
 {
        size_t i;
index 0caa45aa128d773aa470bbd3fd753c75e92429e6..466c9dff818192de44302c5feacd495c6a542c74 100644 (file)
 #define __initmv __initdata
 #define ALIAS_MV(x)
 #else
-#define __initmv
+#define __initmv __initdata_refok
 
 /* GCC actually has a syntax for defining aliases, but is under some
    delusion that you shouldn't be able to declare it extern somewhere
index b581a7af24560cfdc39658961e2d6f5b81457f54..1aa6e97e04b5c72df684a2aefa9f1a3f08117ca0 100644 (file)
@@ -362,10 +362,10 @@ $unaligned:
 
        extql   t2, a1, t2      # U :
        cmpbge  zero, t1, t8    # E : is there a zero?
-       andnot  t2, t6, t12     # E : dest mask for a single word copy
+       andnot  t2, t6, t     # E : dest mask for a single word copy
        or      t8, t10, t5     # E : test for end-of-count too
 
-       cmpbge  zero, t12, t3   # E :
+       cmpbge  zero, t2, t3    # E :
        cmoveq  a2, t5, t8      # E : Latency=2, extra map slot
        nop                     # E : keep with cmoveq
        andnot  t8, t3, t8      # E : (stall)
@@ -379,13 +379,13 @@ $unaligned:
        negq    t8, t6          # E : build bitmask of bytes <= zero
        mskqh   t1, t4, t1      # U :
 
-       and     t6, t8, t     # E :
-       subq    t2, 1, t6       # E : (stall)
-       or      t6, t2, t8      # E : (stall)
-       zapnot  t12, t8, t12    # U : prepare source word; mirror changes (stall)
+       and     t6, t8, t12     # E :
+       subq    t12, 1, t6      # E : (stall)
+       or      t6, t12, t8     # E : (stall)
+       zapnot  t2, t8, t2      # U : prepare source word; mirror changes (stall)
 
        zapnot  t1, t8, t1      # U : to source validity mask
-       andnot  t0, t12, t0     # E : zero place for source to reside
+       andnot  t0, t2, t0      # E : zero place for source to reside
        or      t0, t1, t0      # E : and put it there (stall both t0, t1)
        stq_u   t0, 0(a0)       # L : (stall)
 
index bbdef1be5f95fda9ee4ef87cdb1827b237c01fce..a46f7f3ad8c731961dd3f24502955ab5953477ca 100644 (file)
@@ -35,7 +35,7 @@ strncpy:
 
        or      $3, $24, $3     # clear the bits between the last
        or      $4, $27, $4     # written byte and the last byte in COUNT
-       andnot  $4, $3, $4
+       andnot  $3, $4, $4
        zap     $1, $4, $1
 
        stq_u   $1, 0($16)
index da1a72740d29da7d8c00e26a81da4cbf80d5d74d..3dece25283a317f418000261029692756a069ed0 100644 (file)
@@ -315,9 +315,9 @@ $unaligned:
 
        extql   t2, a1, t2      # e0    :
        cmpbge  zero, t1, t8    # .. e1 : is there a zero?
-       andnot  t2, t6, t12     # e0    : dest mask for a single word copy
+       andnot  t2, t6, t     # e0    : dest mask for a single word copy
        or      t8, t10, t5     # .. e1 : test for end-of-count too
-       cmpbge  zero, t12, t3   # e0    :
+       cmpbge  zero, t2, t3    # e0    :
        cmoveq  a2, t5, t8      # .. e1 :
        andnot  t8, t3, t8      # e0    :
        beq     t8, $u_head     # .. e1 (zdb)
@@ -330,14 +330,14 @@ $unaligned:
        ldq_u   t0, 0(a0)       # e0    :
        negq    t8, t6          # .. e1 : build bitmask of bytes <= zero
        mskqh   t1, t4, t1      # e0    :
-       and     t6, t8, t     # .. e1 :
-       subq    t2, 1, t6       # e0    :
-       or      t6, t2, t8      # e1    :
+       and     t6, t8, t12     # .. e1 :
+       subq    t12, 1, t6      # e0    :
+       or      t6, t12, t8     # e1    :
 
-       zapnot  t12, t8, t12    # e0    : prepare source word; mirror changes
+       zapnot  t2, t8, t2      # e0    : prepare source word; mirror changes
        zapnot  t1, t8, t1      # .. e1 : to source validity mask
 
-       andnot  t0, t12, t0     # e0    : zero place for source to reside
+       andnot  t0, t2, t0      # e0    : zero place for source to reside
        or      t0, t1, t0      # e1    : and put it there
        stq_u   t0, 0(a0)       # e0    :
        ret     (t9)            # .. e1 :
index d05b1b2be9fbe34fd70a0c2912a8372f999f13bc..53a5ef9e72eeec7844007282896002f0e0f8552e 100644 (file)
@@ -109,6 +109,15 @@ static struct spi_board_info ek_spi_devices[] = {
 #endif
 };
 
+static struct i2c_board_info __initdata ek_i2c_devices[] = {
+       {
+               I2C_BOARD_INFO("ics1523", 0x26),
+       },
+       {
+               I2C_BOARD_INFO("dac3550", 0x4d),
+       }
+};
+
 #define EK_FLASH_BASE  AT91_CHIPSELECT_0
 #define EK_FLASH_SIZE  0x200000
 
index dcd81f8d0833f28da844c3e468bf89ea8becfa40..9732d5d9466b1381fdb1b6ce416403af4215675d 100644 (file)
@@ -178,13 +178,19 @@ static void pxa25x_cpu_pm_save(unsigned long *sleep_save)
        SAVE(GAFR1_L); SAVE(GAFR1_U);
        SAVE(GAFR2_L); SAVE(GAFR2_U);
 
-       SAVE(ICMR);
+       SAVE(ICMR); ICMR = 0;
        SAVE(CKEN);
        SAVE(PSTR);
+
+       /* Clear GPIO transition detect bits */
+       GEDR0 = GEDR0; GEDR1 = GEDR1; GEDR2 = GEDR2;
 }
 
 static void pxa25x_cpu_pm_restore(unsigned long *sleep_save)
 {
+       /* ensure not to come back here if it wasn't intended */
+       PSPR = 0;
+
        /* restore registers */
        RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1); RESTORE_GPLEVEL(2);
        RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2);
@@ -195,7 +201,12 @@ static void pxa25x_cpu_pm_restore(unsigned long *sleep_save)
        RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2);
        RESTORE(PGSR0); RESTORE(PGSR1); RESTORE(PGSR2);
 
+       PSSR = PSSR_RDH | PSSR_PH;
+
        RESTORE(CKEN);
+
+       ICLR = 0;
+       ICCR = 1;
        RESTORE(ICMR);
        RESTORE(PSTR);
 }
index 0392a4543008c4713e7aa64ac1344ec06bdc06db..c85860bad585ecfd10d4a316408f8080f7748667 100644 (file)
@@ -365,10 +365,12 @@ u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand);
  *  OP_SCALAR - this operation always operates in scalar mode
  *  OP_SD - the instruction exceptionally writes to a single precision result.
  *  OP_DD - the instruction exceptionally writes to a double precision result.
+ *  OP_SM - the instruction exceptionally reads from a single precision operand.
  */
 #define OP_SCALAR      (1 << 0)
 #define OP_SD          (1 << 1)
 #define OP_DD          (1 << 1)
+#define OP_SM          (1 << 2)
 
 struct op {
        u32 (* const fn)(int dd, int dn, int dm, u32 fpscr);
index 190a09ad18ebe87217222c7eecc2c05823bec86f..6cac43bd1d86c63638993bafa8ba989fea52e91f 100644 (file)
@@ -668,8 +668,8 @@ static struct op fops_ext[32] = {
        [FEXT_TO_IDX(FEXT_FCMPZ)]       = { vfp_double_fcmpz,  OP_SCALAR },
        [FEXT_TO_IDX(FEXT_FCMPEZ)]      = { vfp_double_fcmpez, OP_SCALAR },
        [FEXT_TO_IDX(FEXT_FCVT)]        = { vfp_double_fcvts,  OP_SCALAR|OP_SD },
-       [FEXT_TO_IDX(FEXT_FUITO)]       = { vfp_double_fuito,  OP_SCALAR },
-       [FEXT_TO_IDX(FEXT_FSITO)]       = { vfp_double_fsito,  OP_SCALAR },
+       [FEXT_TO_IDX(FEXT_FUITO)]       = { vfp_double_fuito,  OP_SCALAR|OP_SM },
+       [FEXT_TO_IDX(FEXT_FSITO)]       = { vfp_double_fsito,  OP_SCALAR|OP_SM },
        [FEXT_TO_IDX(FEXT_FTOUI)]       = { vfp_double_ftoui,  OP_SCALAR|OP_SD },
        [FEXT_TO_IDX(FEXT_FTOUIZ)]      = { vfp_double_ftouiz, OP_SCALAR|OP_SD },
        [FEXT_TO_IDX(FEXT_FTOSI)]       = { vfp_double_ftosi,  OP_SCALAR|OP_SD },
@@ -1128,7 +1128,7 @@ u32 vfp_double_cpdo(u32 inst, u32 fpscr)
        u32 exceptions = 0;
        unsigned int dest;
        unsigned int dn = vfp_get_dn(inst);
-       unsigned int dm = vfp_get_dm(inst);
+       unsigned int dm;
        unsigned int vecitr, veclen, vecstride;
        struct op *fop;
 
@@ -1145,6 +1145,14 @@ u32 vfp_double_cpdo(u32 inst, u32 fpscr)
        else
                dest = vfp_get_dd(inst);
 
+       /*
+        * f[us]ito takes a sN operand, not a dN operand.
+        */
+       if (fop->flags & OP_SM)
+               dm = vfp_get_sm(inst);
+       else
+               dm = vfp_get_dm(inst);
+
        /*
         * If destination bank is zero, vector length is always '1'.
         * ARM DDI0100F C5.1.3, C5.3.2.
index 88eff7f54ea6cc17ab28e70b33155957ba3acdb1..1d1936a18133d36376186baea9a1d76434f408dc 100644 (file)
@@ -6,136 +6,9 @@
 *!
 *! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init
 *!
-*! $Log: ds1302.c,v $
-*! Revision 1.18  2005/01/24 09:11:26  mikaelam
-*! Minor changes to get DS1302 RTC chip driver to work
-*!
-*! Revision 1.17  2005/01/05 06:11:22  starvik
-*! No need to do local_irq_disable after local_irq_save.
-*!
-*! Revision 1.16  2004/12/13 12:21:52  starvik
-*! Added I/O and DMA allocators from Linux 2.4
-*!
-*! Revision 1.14  2004/08/24 06:48:43  starvik
-*! Whitespace cleanup
-*!
-*! Revision 1.13  2004/05/28 09:26:59  starvik
-*! Modified I2C initialization to work in 2.6.
-*!
-*! Revision 1.12  2004/05/14 07:58:03  starvik
-*! Merge of changes from 2.4
-*!
-*! Revision 1.10  2004/02/04 09:25:12  starvik
-*! Merge of Linux 2.6.2
-*!
-*! Revision 1.9  2003/07/04 08:27:37  starvik
-*! Merge of Linux 2.5.74
-*!
-*! Revision 1.8  2003/04/09 05:20:47  starvik
-*! Merge of Linux 2.5.67
-*!
-*! Revision 1.6  2003/01/09 14:42:51  starvik
-*! Merge of Linux 2.5.55
-*!
-*! Revision 1.4  2002/12/11 13:13:57  starvik
-*! Added arch/ to v10 specific includes
-*! Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer)
-*!
-*! Revision 1.3  2002/11/20 11:56:10  starvik
-*! Merge of Linux 2.5.48
-*!
-*! Revision 1.2  2002/11/18 13:16:06  starvik
-*! Linux 2.5 port of latest 2.4 drivers
-*!
-*! Revision 1.15  2002/10/11 16:14:33  johana
-*! Added CONFIG_ETRAX_DS1302_TRICKLE_CHARGE and initial setting of the
-*! trcklecharge register.
-*!
-*! Revision 1.14  2002/10/10 12:15:38  magnusmn
-*! Added support for having the RST signal on bit g0
-*!
-*! Revision 1.13  2002/05/29 15:16:08  johana
-*! Removed unused variables.
-*!
-*! Revision 1.12  2002/04/10 15:35:25  johana
-*! Moved probe function closer to init function and marked it __init.
-*!
-*! Revision 1.11  2001/06/14 12:35:52  jonashg
-*! The ATA hack is back. It is unfortunately the only way to set g27 to output.
-*!
-*! Revision 1.9  2001/06/14 10:00:14  jonashg
-*! No need for tempudelay to be inline anymore (had to adjust the usec to
-*! loops conversion because of this to make it slow enough to be a udelay).
-*!
-*! Revision 1.8  2001/06/14 08:06:32  jonashg
-*! Made tempudelay delay usecs (well, just a tad more).
-*!
-*! Revision 1.7  2001/06/13 14:18:11  jonashg
-*! Only allow processes with SYS_TIME capability to set time and charge.
-*!
-*! Revision 1.6  2001/06/12 15:22:07  jonashg
-*! * Made init function __init.
-*! * Parameter to out_byte() is unsigned char.
-*! * The magic number 42 has got a name.
-*! * Removed comment about /proc (nothing is exported there).
-*!
-*! Revision 1.5  2001/06/12 14:35:13  jonashg
-*! Gave the module a name and added it to printk's.
-*!
-*! Revision 1.4  2001/05/31 14:53:40  jonashg
-*! Made tempudelay() inline so that the watchdog doesn't reset (see
-*! function comment).
-*!
-*! Revision 1.3  2001/03/26 16:03:06  bjornw
-*! Needs linux/config.h
-*!
-*! Revision 1.2  2001/03/20 19:42:00  bjornw
-*! Use the ETRAX prefix on the DS1302 options
-*!
-*! Revision 1.1  2001/03/20 09:13:50  magnusmn
-*! Linux 2.4 port
-*!
-*! Revision 1.10  2000/07/05 15:38:23  bjornw
-*! Dont update kernel time when a RTC_SET_TIME is done
-*!
-*! Revision 1.9  2000/03/02 15:42:59  macce
-*! * Hack to make RTC work on all 2100/2400
-*!
-*! Revision 1.8  2000/02/23 16:59:18  torbjore
-*! added setup of R_GEN_CONFIG when RTC is connected to the generic port.
-*!
-*! Revision 1.7  2000/01/17 15:51:43  johana
-*! Added RTC_SET_CHARGE ioctl to enable trickle charger.
-*!
-*! Revision 1.6  1999/10/27 13:19:47  bjornw
-*! Added update_xtime_from_cmos which reads back the updated RTC into the kernel.
-*! /dev/rtc calls it now.
-*!
-*! Revision 1.5  1999/10/27 12:39:37  bjornw
-*! Disabled superuser check. Anyone can now set the time.
-*!
-*! Revision 1.4  1999/09/02 13:27:46  pkj
-*! Added shadow for R_PORT_PB_CONFIG.
-*! Renamed port_g_shadow to port_g_data_shadow.
-*!
-*! Revision 1.3  1999/09/02 08:28:06  pkj
-*! Made it possible to select either port PB or the generic port for the RST
-*! signal line to the DS1302 RTC.
-*! Also make sure the RST bit is configured as output on Port PB (if used).
-*!
-*! Revision 1.2  1999/09/01 14:47:20  bjornw
-*! Added support for /dev/rtc operations with ioctl RD_TIME and SET_TIME to read
-*! and set the date. Register as major 121.
-*!
-*! Revision 1.1  1999/09/01 09:45:29  bjornw
-*! Implemented a DS1302 RTC driver.
-*!
-*!
 *! ---------------------------------------------------------------------------
 *!
-*! (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004  Axis Communications AB, LUND, SWEDEN
-*!
-*! $Id: ds1302.c,v 1.18 2005/01/24 09:11:26 mikaelam Exp $
+*! (C) Copyright 1999-2007 Axis Communications AB, LUND, SWEDEN
 *!
 *!***************************************************************************/
 
 #include <asm/rtc.h>
 #include <asm/arch/io_interface_mux.h>
 
+#include "i2c.h"
+
 #define RTC_MAJOR_NR 121 /* local major, change later */
 
 static const char ds1302_name[] = "ds1302";
index 41d4a5f93284abe34e1838c1e5379d1ab120956a..b6be705c2a3e6fb7ec2994600e47deaebfcadbfa 100644 (file)
@@ -7,7 +7,7 @@
  *
  *  Ideas also taken from arch/arm.
  *
- *  Copyright (C) 2000, 2001 Axis Communications AB
+ *  Copyright (C) 2000-2007 Axis Communications AB
  *
  *  Authors:  Bjorn Wesen (bjornw@axis.com)
  *
  */
 #define RESTART_CRIS_SYS(regs) regs->r10 = regs->orig_r10; regs->irp -= 2;
 
-int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs);
+void do_signal(int canrestart, struct pt_regs *regs);
 
 /*
- * Atomically swap in the new signal mask, and wait for a signal.  Define 
+ * Atomically swap in the new signal mask, and wait for a signal.  Define
  * dummy arguments to be able to reach the regs argument.  (Note that this
  * arrangement relies on old_sigset_t occupying one register.)
  */
-int
-sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof, 
-               long srp, struct pt_regs *regs)
+int sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof,
+       long srp, struct pt_regs *regs)
 {
-       sigset_t saveset;
-
        mask &= _BLOCKABLE;
        spin_lock_irq(&current->sighand->siglock);
-       saveset = current->blocked;
+       current->saved_sigmask = current->blocked;
        siginitset(&current->blocked, mask);
        recalc_sigpending();
        spin_unlock_irq(&current->sighand->siglock);
-
-       regs->r10 = -EINTR;
-       while (1) {
-               current->state = TASK_INTERRUPTIBLE;
-               schedule();
-               if (do_signal(0, &saveset, regs))
-                       /* We will get here twice: once to call the signal
-                          handler, then again to return from the
-                          sigsuspend system call.  When calling the
-                          signal handler, R10 holds the signal number as
-                          set through do_signal.  The sigsuspend call
-                          will return with the restored value set above;
-                          always -EINTR.  */
-                       return regs->r10;
-       }
+       current->state = TASK_INTERRUPTIBLE;
+       schedule();
+       set_thread_flag(TIF_RESTORE_SIGMASK);
+       return -ERESTARTNOHAND;
 }
 
-/* Define dummy arguments to be able to reach the regs argument.  (Note that
- * this arrangement relies on size_t occupying one register.)
- */
-int
-sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, long r12, long r13, 
-                  long mof, long srp, struct pt_regs *regs)
-{
-       sigset_t saveset, newset;
-
-       /* XXX: Don't preclude handling different sized sigset_t's.  */
-       if (sigsetsize != sizeof(sigset_t))
-               return -EINVAL;
-
-       if (copy_from_user(&newset, unewset, sizeof(newset)))
-               return -EFAULT;
-       sigdelsetmask(&newset, ~_BLOCKABLE);
-
-       spin_lock_irq(&current->sighand->siglock);
-       saveset = current->blocked;
-       current->blocked = newset;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
-       regs->r10 = -EINTR;
-       while (1) {
-               current->state = TASK_INTERRUPTIBLE;
-               schedule();
-               if (do_signal(0, &saveset, regs))
-                       /* We will get here twice: once to call the signal
-                          handler, then again to return from the
-                          sigsuspend system call.  When calling the
-                          signal handler, R10 holds the signal number as
-                          set through do_signal.  The sigsuspend call
-                          will return with the restored value set above;
-                          always -EINTR.  */
-                       return regs->r10;
-       }
-}
-
-int 
-sys_sigaction(int sig, const struct old_sigaction __user *act,
-             struct old_sigaction *oact)
+int sys_sigaction(int sig, const struct old_sigaction __user *act,
+       struct old_sigaction *oact)
 {
        struct k_sigaction new_ka, old_ka;
        int ret;
@@ -147,8 +93,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
        return ret;
 }
 
-int
-sys_sigaltstack(const stack_t *uss, stack_t __user *uoss)
+int sys_sigaltstack(const stack_t *uss, stack_t __user *uoss)
 {
        return do_sigaltstack(uss, uoss, rdusp());
 }
@@ -205,7 +150,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
 
        /* TODO: the other ports use regs->orig_XX to disable syscall checks
         * after this completes, but we don't use that mechanism. maybe we can
-        * use it now ? 
+        * use it now ?
         */
 
        return err;
@@ -216,7 +161,7 @@ badframe:
 
 /* Define dummy arguments to be able to reach the regs argument.  */
 
-asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof, 
+asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof,
                              long srp, struct pt_regs *regs)
 {
        struct sigframe __user *frame = (struct sigframe *)rdusp();
@@ -243,7 +188,7 @@ asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof,
        current->blocked = set;
        recalc_sigpending();
        spin_unlock_irq(&current->sighand->siglock);
-       
+
        if (restore_sigcontext(regs, &frame->sc))
                goto badframe;
 
@@ -254,11 +199,11 @@ asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof,
 badframe:
        force_sig(SIGSEGV, current);
        return 0;
-}      
+}
 
 /* Define dummy arguments to be able to reach the regs argument.  */
 
-asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13, 
+asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
                                 long mof, long srp, struct pt_regs *regs)
 {
        struct rt_sigframe __user *frame = (struct rt_sigframe *)rdusp();
@@ -282,7 +227,7 @@ asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
        current->blocked = set;
        recalc_sigpending();
        spin_unlock_irq(&current->sighand->siglock);
-       
+
        if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
                goto badframe;
 
@@ -294,14 +239,14 @@ asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
 badframe:
        force_sig(SIGSEGV, current);
        return 0;
-}      
+}
 
 /*
  * Set up a signal frame.
  */
 
-static int
-setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned long mask)
+static int setup_sigcontext(struct sigcontext __user *sc,
+       struct pt_regs *regs, unsigned long mask)
 {
        int err = 0;
        unsigned long usp = rdusp();
@@ -324,10 +269,11 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned lo
        return err;
 }
 
-/* figure out where we want to put the new signal frame - usually on the stack */
+/* Figure out where we want to put the new signal frame
+ * - usually on the stack. */
 
 static inline void __user *
-get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
+get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
 {
        unsigned long sp = rdusp();
 
@@ -345,15 +291,15 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
 }
 
 /* grab and setup a signal frame.
- * 
+ *
  * basically we stack a lot of state info, and arrange for the
  * user-mode program to return to the kernel using either a
  * trampoline which performs the syscall sigreturn, or a provided
  * user-mode trampoline.
  */
 
-static void setup_frame(int sig, struct k_sigaction *ka,
-                       sigset_t *set, struct pt_regs * regs)
+static int setup_frame(int sig, struct k_sigaction *ka,
+                      sigset_t *set, struct pt_regs *regs)
 {
        struct sigframe __user *frame;
        unsigned long return_ip;
@@ -401,14 +347,15 @@ static void setup_frame(int sig, struct k_sigaction *ka,
 
        wrusp((unsigned long)frame);
 
-       return;
+       return 0;
 
 give_sigsegv:
        force_sigsegv(sig, current);
+       return -EFAULT;
 }
 
-static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
-                          sigset_t *set, struct pt_regs * regs)
+static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
+       sigset_t *set, struct pt_regs *regs)
 {
        struct rt_sigframe __user *frame;
        unsigned long return_ip;
@@ -443,9 +390,10 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
                /* trampoline - the desired return ip is the retcode itself */
                return_ip = (unsigned long)&frame->retcode;
                /* This is movu.w __NR_rt_sigreturn, r9; break 13; */
-               err |= __put_user(0x9c5f,            (short __user*)(frame->retcode+0));
-               err |= __put_user(__NR_rt_sigreturn, (short __user*)(frame->retcode+2));
-               err |= __put_user(0xe93d,            (short __user*)(frame->retcode+4));
+               err |= __put_user(0x9c5f, (short __user *)(frame->retcode+0));
+               err |= __put_user(__NR_rt_sigreturn,
+                       (short __user *)(frame->retcode+2));
+               err |= __put_user(0xe93d, (short __user *)(frame->retcode+4));
        }
 
        if (err)
@@ -455,73 +403,81 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 
        /* Set up registers for signal handler */
 
-       regs->irp = (unsigned long) ka->sa.sa_handler;  /* what we enter NOW   */
-       regs->srp = return_ip;                          /* what we enter LATER */
-       regs->r10 = sig;                                /* first argument is signo */
-        regs->r11 = (unsigned long) &frame->info;       /* second argument is (siginfo_t *) */
-        regs->r12 = 0;                                  /* third argument is unused */
-
-       /* actually move the usp to reflect the stacked frame */
-
+       /* What we enter NOW   */
+       regs->irp = (unsigned long) ka->sa.sa_handler;
+       /* What we enter LATER */
+       regs->srp = return_ip;
+       /* First argument is signo */
+       regs->r10 = sig;
+       /* Second argument is (siginfo_t *) */
+       regs->r11 = (unsigned long)&frame->info;
+       /* Third argument is unused */
+       regs->r12 = 0;
+
+       /* Actually move the usp to reflect the stacked frame */
        wrusp((unsigned long)frame);
 
-       return;
+       return 0;
 
 give_sigsegv:
        force_sigsegv(sig, current);
+       return -EFAULT;
 }
 
 /*
  * OK, we're invoking a handler
- */    
+ */
 
-static inline void
-handle_signal(int canrestart, unsigned long sig,
-             siginfo_t *info, struct k_sigaction *ka,
-              sigset_t *oldset, struct pt_regs * regs)
+static inline int handle_signal(int canrestart, unsigned long sig,
+       siginfo_t *info, struct k_sigaction *ka,
+       sigset_t *oldset, struct pt_regs *regs)
 {
+       int ret;
+
        /* Are we from a system call? */
        if (canrestart) {
                /* If so, check system call restarting.. */
                switch (regs->r10) {
-                       case -ERESTART_RESTARTBLOCK:
-                       case -ERESTARTNOHAND:
-                               /* ERESTARTNOHAND means that the syscall should only be
-                                  restarted if there was no handler for the signal, and since
-                                  we only get here if there is a handler, we don't restart */
+               case -ERESTART_RESTARTBLOCK:
+               case -ERESTARTNOHAND:
+                       /* ERESTARTNOHAND means that the syscall should
+                        * only be restarted if there was no handler for
+                        * the signal, and since we only get here if there
+                        * is a handler, we don't restart */
+                       regs->r10 = -EINTR;
+                       break;
+               case -ERESTARTSYS:
+                       /* ERESTARTSYS means to restart the syscall if
+                        * there is no handler or the handler was
+                        * registered with SA_RESTART */
+                       if (!(ka->sa.sa_flags & SA_RESTART)) {
                                regs->r10 = -EINTR;
                                break;
-
-                       case -ERESTARTSYS:
-                               /* ERESTARTSYS means to restart the syscall if there is no
-                                  handler or the handler was registered with SA_RESTART */
-                               if (!(ka->sa.sa_flags & SA_RESTART)) {
-                                       regs->r10 = -EINTR;
-                                       break;
-                               }
-                       /* fallthrough */
-                       case -ERESTARTNOINTR:
-                               /* ERESTARTNOINTR means that the syscall should be called again
-                                  after the signal handler returns. */
-                               RESTART_CRIS_SYS(regs);
+                       }
+               /* fallthrough */
+               case -ERESTARTNOINTR:
+                       /* ERESTARTNOINTR means that the syscall should
+                        * be called again after the signal handler returns. */
+                       RESTART_CRIS_SYS(regs);
                }
        }
 
        /* Set up the stack frame */
        if (ka->sa.sa_flags & SA_SIGINFO)
-               setup_rt_frame(sig, ka, info, oldset, regs);
+               ret = setup_rt_frame(sig, ka, info, oldset, regs);
        else
-               setup_frame(sig, ka, oldset, regs);
-
-       if (ka->sa.sa_flags & SA_ONESHOT)
-               ka->sa.sa_handler = SIG_DFL;
-
-       spin_lock_irq(&current->sighand->siglock);
-       sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
-       if (!(ka->sa.sa_flags & SA_NODEFER))
-               sigaddset(&current->blocked,sig);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+               ret = setup_frame(sig, ka, oldset, regs);
+
+       if (ret == 0) {
+               spin_lock_irq(&current->sighand->siglock);
+               sigorsets(&current->blocked, &current->blocked,
+                       &ka->sa.sa_mask);
+               if (!(ka->sa.sa_flags & SA_NODEFER))
+                       sigaddset(&current->blocked, sig);
+               recalc_sigpending();
+               spin_unlock_irq(&current->sighand->siglock);
+       }
+       return ret;
 }
 
 /*
@@ -536,11 +492,12 @@ handle_signal(int canrestart, unsigned long sig,
  * mode below.
  */
 
-int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs)
+void do_signal(int canrestart, struct pt_regs *regs)
 {
        siginfo_t info;
        int signr;
         struct k_sigaction ka;
+       sigset_t *oldset;
 
        /*
         * We want the common case to go fast, which
@@ -549,16 +506,26 @@ int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs)
         * if so.
         */
        if (!user_mode(regs))
-               return 1;
+               return;
 
-       if (!oldset)
+       if (test_thread_flag(TIF_RESTORE_SIGMASK))
+               oldset = &current->saved_sigmask;
+       else
                oldset = &current->blocked;
 
        signr = get_signal_to_deliver(&info, &ka, regs, NULL);
        if (signr > 0) {
                /* Whee!  Actually deliver the signal.  */
-               handle_signal(canrestart, signr, &info, &ka, oldset, regs);
-               return 1;
+               if (handle_signal(canrestart, signr, &info, &ka,
+                               oldset, regs)) {
+                       /* a signal was successfully delivered; the saved
+                        * sigmask will have been stored in the signal frame,
+                        * and will be restored by sigreturn, so we can simply
+                        * clear the TIF_RESTORE_SIGMASK flag */
+                       if (test_thread_flag(TIF_RESTORE_SIGMASK))
+                               clear_thread_flag(TIF_RESTORE_SIGMASK);
+               }
+               return;
        }
 
        /* Did we come from a system call? */
@@ -569,10 +536,16 @@ int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs)
                    regs->r10 == -ERESTARTNOINTR) {
                        RESTART_CRIS_SYS(regs);
                }
-               if (regs->r10 == -ERESTART_RESTARTBLOCK){
+               if (regs->r10 == -ERESTART_RESTARTBLOCK) {
                        regs->r10 = __NR_restart_syscall;
                        regs->irp -= 2;
                }
        }
-       return 0;
+
+       /* if there's no signal to deliver, we just put the saved sigmask
+        * back */
+       if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
+               clear_thread_flag(TIF_RESTORE_SIGMASK);
+               sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
+       }
 }
index 5976f6199c47237937b2e7a4bd15709203472cf9..9310a7b476e95cf6353180de4e88bc8ba4f9f592 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/swap.h>
 #include <linux/sched.h>
 #include <linux/init.h>
+#include <linux/vmstat.h>
 #include <asm/arch/svinto.h>
 #include <asm/types.h>
 #include <asm/signal.h>
index bc859a311eaf07774379ad3daa40067cb252c304..45bf04eb7d705c2371d8907e8ec13cc7ab5d6be5 100644 (file)
@@ -2034,7 +2034,8 @@ sba_init(void)
        if (!ia64_platform_is("hpzx1") && !ia64_platform_is("hpzx1_swiotlb"))
                return 0;
 
-#if defined(CONFIG_IA64_GENERIC) && defined(CONFIG_CRASH_DUMP)
+#if defined(CONFIG_IA64_GENERIC) && defined(CONFIG_CRASH_DUMP) && \
+        defined(CONFIG_PROC_FS)
        /* If we are booting a kdump kernel, the sba_iommu will
         * cause devices that were not shutdown properly to MCA
         * as soon as they are turned back on.  Our only option for
index f6ae3ec938105c8f94b688823f0e16c9e28f06d3..3e35987af4584c094d36fa374a3d23f49887d92d 100644 (file)
@@ -52,33 +52,29 @@ extern struct page *ia32_shared_page[];
 extern unsigned long *ia32_gdt;
 extern struct page *ia32_gate_page;
 
-struct page *
-ia32_install_shared_page (struct vm_area_struct *vma, unsigned long address, int *type)
+int
+ia32_install_shared_page (struct vm_area_struct *vma, struct vm_fault *vmf)
 {
-       struct page *pg = ia32_shared_page[smp_processor_id()];
-       get_page(pg);
-       if (type)
-               *type = VM_FAULT_MINOR;
-       return pg;
+       vmf->page = ia32_shared_page[smp_processor_id()];
+       get_page(vmf->page);
+       return 0;
 }
 
-struct page *
-ia32_install_gate_page (struct vm_area_struct *vma, unsigned long address, int *type)
+int
+ia32_install_gate_page (struct vm_area_struct *vma, struct vm_fault *vmf)
 {
-       struct page *pg = ia32_gate_page;
-       get_page(pg);
-       if (type)
-               *type = VM_FAULT_MINOR;
-       return pg;
+       vmf->page = ia32_gate_page;
+       get_page(vmf->page);
+       return 0;
 }
 
 
 static struct vm_operations_struct ia32_shared_page_vm_ops = {
-       .nopage = ia32_install_shared_page
+       .fault = ia32_install_shared_page
 };
 
 static struct vm_operations_struct ia32_gate_page_vm_ops = {
-       .nopage = ia32_install_gate_page
+       .fault = ia32_install_gate_page
 };
 
 void
index 4e5e27540e278288d33911b43d0219b004bb0fec..d3a41d5f8d1216dfd3a2b9e18f95208ec5aa6f92 100644 (file)
@@ -1176,6 +1176,7 @@ tlb_purge_done:
        RESTORE_REG(cr.dcr, r25, r17);;
        RESTORE_REG(cr.iva, r25, r17);;
        RESTORE_REG(cr.pta, r25, r17);;
+       srlz.d;;        // required not to violate RAW dependency
        RESTORE_REG(cr.itv, r25, r17);;
        RESTORE_REG(cr.pmv, r25, r17);;
        RESTORE_REG(cr.cmcv, r25, r17);;
index 00a4599e5f472d43edbbb91eb05c55ded2d9b6ab..0b52f19ed04615b8f637e2ee496fa8c488b5546c 100644 (file)
@@ -200,7 +200,7 @@ assign_irq_vector (int irq)
 {
        unsigned long flags;
        int vector, cpu;
-       cpumask_t domain;
+       cpumask_t domain = CPU_MASK_NONE;
 
        vector = -ENOSPC;
 
@@ -340,7 +340,7 @@ int create_irq(void)
 {
        unsigned long flags;
        int irq, vector, cpu;
-       cpumask_t domain;
+       cpumask_t domain = CPU_MASK_NONE;
 
        irq = vector = -ENOSPC;
        spin_lock_irqsave(&vector_lock, flags);
index 10b48cd15a878c399503d5bc5da4334906748978..6dbf5919d2d0e7600b9bf9d9fc7f7f7116bb04a8 100644 (file)
@@ -75,6 +75,7 @@
 #include <linux/workqueue.h>
 #include <linux/cpumask.h>
 #include <linux/kdebug.h>
+#include <linux/cpu.h>
 
 #include <asm/delay.h>
 #include <asm/machvec.h>
@@ -1813,6 +1814,36 @@ ia64_mca_cpu_init(void *cpu_data)
                                                              PAGE_KERNEL));
 }
 
+static void __cpuinit ia64_mca_cmc_vector_adjust(void *dummy)
+{
+       unsigned long flags;
+
+       local_irq_save(flags);
+       if (!cmc_polling_enabled)
+               ia64_mca_cmc_vector_enable(NULL);
+       local_irq_restore(flags);
+}
+
+static int __cpuinit mca_cpu_callback(struct notifier_block *nfb,
+                                     unsigned long action,
+                                     void *hcpu)
+{
+       int hotcpu = (unsigned long) hcpu;
+
+       switch (action) {
+       case CPU_ONLINE:
+       case CPU_ONLINE_FROZEN:
+               smp_call_function_single(hotcpu, ia64_mca_cmc_vector_adjust,
+                                        NULL, 1, 0);
+               break;
+       }
+       return NOTIFY_OK;
+}
+
+static struct notifier_block mca_cpu_notifier __cpuinitdata = {
+       .notifier_call = mca_cpu_callback
+};
+
 /*
  * ia64_mca_init
  *
@@ -1996,6 +2027,8 @@ ia64_mca_late_init(void)
        if (!mca_init)
                return 0;
 
+       register_hotcpu_notifier(&mca_cpu_notifier);
+
        /* Setup the CMCI/P vector and handler */
        init_timer(&cmc_poll_timer);
        cmc_poll_timer.function = ia64_mca_cmc_poll;
index 2418289ee5ca4a89e598f057c26f2f201497ea0e..7377d323131dfcc6565678dad9c0e4d8ab1e6f63 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/kdebug.h>
+#include <linux/utsname.h>
 
 #include <asm/cpu.h>
 #include <asm/delay.h>
@@ -107,8 +108,9 @@ show_regs (struct pt_regs *regs)
        print_modules();
        printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current),
                        smp_processor_id(), current->comm);
-       printk("psr : %016lx ifs : %016lx ip  : [<%016lx>]    %s\n",
-              regs->cr_ipsr, regs->cr_ifs, ip, print_tainted());
+       printk("psr : %016lx ifs : %016lx ip  : [<%016lx>]    %s (%s)\n",
+              regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),
+              init_utsname()->release);
        print_symbol("ip is at %s\n", ip);
        printk("unat: %016lx pfs : %016lx rsc : %016lx\n",
               regs->ar_unat, regs->ar_pfs, regs->ar_rsc);
@@ -737,6 +739,7 @@ flush_thread (void)
                ia32_drop_ia64_partial_page_list(current);
                current->thread.task_size = IA32_PAGE_OFFSET;
                set_fs(USER_DS);
+               memset(current->thread.tls_array, 0, sizeof(current->thread.tls_array));
        }
 #endif
 }
index 4c730099d58fcbfae6140c4f523bf210426b733b..309da3567bc851966e8a7ad27e01eccac2e26ff2 100644 (file)
@@ -280,15 +280,7 @@ setup_sigcontext (struct sigcontext __user *sc, sigset_t *mask, struct sigscratc
        err |= __copy_to_user(&sc->sc_gr[15], &scr->pt.r15, 8);         /* r15 */
        err |= __put_user(scr->pt.cr_iip + ia64_psr(&scr->pt)->ri, &sc->sc_ip);
 
-       if (flags & IA64_SC_FLAG_IN_SYSCALL) {
-               /* Clear scratch registers if the signal interrupted a system call. */
-               err |= __put_user(0, &sc->sc_ar_ccv);                           /* ar.ccv */
-               err |= __put_user(0, &sc->sc_br[7]);                            /* b7 */
-               err |= __put_user(0, &sc->sc_gr[14]);                           /* r14 */
-               err |= __clear_user(&sc->sc_ar25, 2*8);                 /* ar.csd & ar.ssd */
-               err |= __clear_user(&sc->sc_gr[2], 2*8);                        /* r2-r3 */
-               err |= __clear_user(&sc->sc_gr[16], 16*8);                      /* r16-r31 */
-       } else {
+       if (!(flags & IA64_SC_FLAG_IN_SYSCALL)) {
                /* Copy scratch regs to sigcontext if the signal didn't interrupt a syscall. */
                err |= __put_user(scr->pt.ar_ccv, &sc->sc_ar_ccv);              /* ar.ccv */
                err |= __put_user(scr->pt.b7, &sc->sc_br[7]);                   /* b7 */
index a7be4f203420ddfd82629fe5308d445911f236ba..2a90c32024f4419fa5cc8f7d918e536c2d934d33 100644 (file)
@@ -118,7 +118,7 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid)
        for (i = 0; i < (IA64_GRANULE_SIZE / PAGE_SIZE); i++)
                SetPageUncached(&page[i]);
 
-       flush_tlb_kernel_range(uc_addr, uc_adddr + IA64_GRANULE_SIZE);
+       flush_tlb_kernel_range(uc_addr, uc_addr + IA64_GRANULE_SIZE);
 
        status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL);
        if (status == PAL_VISIBILITY_OK_REMOTE_NEEDED) {
index cef164729db79d77d5b3cb8c694787cf10b8cc6f..655da240d13cf04a91f0fdcc7c846eb1d1a25d25 100644 (file)
@@ -10,6 +10,7 @@
  *              IPI based ptc implementation and A-step IPI implementation.
  * Rohit Seth <rohit.seth@intel.com>
  * Ken Chen <kenneth.w.chen@intel.com>
+ * Christophe de Dinechin <ddd@hp.com>: Avoid ptc.e on memory allocation
  */
 #include <linux/module.h>
 #include <linux/init.h>
@@ -89,9 +90,16 @@ ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start,
 {
        static DEFINE_SPINLOCK(ptcg_lock);
 
-       if (mm != current->active_mm || !current->mm) {
-               flush_tlb_all();
-               return;
+       struct mm_struct *active_mm = current->active_mm;
+
+       if (mm != active_mm) {
+               /* Restore region IDs for mm */
+               if (mm && active_mm) {
+                       activate_context(mm);
+               } else {
+                       flush_tlb_all();
+                       return;
+               }
        }
 
        /* HW requires global serialization of ptc.ga.  */
@@ -107,6 +115,10 @@ ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start,
                } while (start < end);
        }
        spin_unlock(&ptcg_lock);
+
+        if (mm != active_mm) {
+                activate_context(active_mm);
+        }
 }
 
 void
index b362d6d6a8c8f76234596037d8a3406626e2aa64..9456d4034024aa97eed31518162e6ddb68e7a436 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2000-2006 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2007 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
 #include <linux/module.h>
@@ -227,7 +227,7 @@ retry_bteop:
                     BTE_LNSTAT_LOAD(bte), *bte->most_rcnt_na));
 
        if (transfer_stat & IBLS_ERROR) {
-               bte_status = transfer_stat & ~IBLS_ERROR;
+               bte_status = BTE_GET_ERROR_STATUS(transfer_stat);
        } else {
                bte_status = BTE_SUCCESS;
        }
index 27c5936ccfe96b5287f87994a37aa0956b12061f..4cb09f3f1efc636b9090adcfd2fe80e07e278760 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2007 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
 #include <linux/types.h>
@@ -148,7 +148,11 @@ int shub2_bte_error_handler(unsigned long _nodepda)
        for (i = 0; i < BTES_PER_NODE; i++) {
                bte = &err_nodepda->bte_if[i];
                status = BTE_LNSTAT_LOAD(bte);
-               if ((status & IBLS_ERROR) || !(status & IBLS_BUSY))
+               if (status & IBLS_ERROR) {
+                       bte->bh_error = BTE_SHUB2_ERROR(status);
+                       continue;
+               }
+               if (!(status & IBLS_BUSY))
                        continue;
                mod_timer(recovery_timer, jiffies + (HZ * 5));
                BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda,
index 54e8973b6e99d21679c2083d76c8c0ea2cdfaedf..98e7c7dbfdd84082d5b2adf72d19b6b3309f2762 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2004-2005 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2004-2007 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
 
  * PIO read fails, the MCA handler will force the error to look
  * corrected and vector to the xp_error_PIOR which will return an error.
  *
+ * The definition of "consumption" and the time it takes for an MCA
+ * to surface is processor implementation specific.  This code
+ * is sufficient on Itanium through the Montvale processor family.
+ * It may need to be adjusted for future processor implementations.
+ *
  *     extern int xp_nofault_PIOR(void *remote_register);
  */
 
@@ -22,11 +27,10 @@ xp_nofault_PIOR:
        mov     r8=r0                   // Stage a success return value
        ld8.acq r9=[r32];;              // PIO Read the specified register
        adds    r9=1,r9;;               // Add to force consumption
-       or      r9=r9,r9;;              // Or to force consumption
+       srlz.i;;                        // Allow time for MCA to surface
        br.ret.sptk.many b0;;           // Return success
 
        .global xp_error_PIOR
 xp_error_PIOR:
        mov     r8=1                    // Return value of 1
        br.ret.sptk.many b0;;           // Return failure
-
index cee9379d44e04e0207b01fe7c81c8e0939c69531..e1a3e19d3d9c9c8a0e55852e9df3f3011e06416a 100644 (file)
@@ -41,7 +41,7 @@
  *     } else
  *             do desired mmr access
  *
- * According to hw, we can use reads instead of writes to the above addres
+ * According to hw, we can use reads instead of writes to the above address
  *
  * Note this WAR can only to be used for accessing internal MMR's in the
  * TIOCE Coretalk Address Range 0x0 - 0x07ff_ffff.  This includes the
index c6fc405a6c8e33348bfe69c1720dada4df2ab4be..291d368ffd281912b9570b6f940edfab6ce17223 100644 (file)
@@ -992,8 +992,6 @@ config BOOT_ELF64
 
 menu "CPU selection"
 
-source "kernel/time/Kconfig"
-
 choice
        prompt "CPU type"
        default CPU_R4X00
@@ -1768,6 +1766,8 @@ config NR_CPUS
          performance should round up your number of processors to the next
          power of two.
 
+source "kernel/time/Kconfig"
+
 #
 # Timer Interrupt Frequency Configuration
 #
index 6fa70a36a250aaf4eb8ab3b8482244daefedca9d..ce771487567d5e3ee29fc4bd01a9211e23bd8554 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * BRIEF MODULE DESCRIPTION
- *     Alchemy/AMD Au1x00 pci support.
+ *     Alchemy/AMD Au1x00 PCI support.
  *
- * Copyright 2001,2002,2003 MontaVista Software Inc.
+ * Copyright 2001-2003, 2007 MontaVista Software Inc.
  * Author: MontaVista Software, Inc.
  *             ppopov@mvista.com or source@mvista.com
  *
@@ -66,6 +66,8 @@ static unsigned long virt_io_addr;
 
 static int __init au1x_pci_setup(void)
 {
+       extern void au1x_pci_cfg_init(void);
+
 #if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
        virt_io_addr = (unsigned long)ioremap(Au1500_PCI_IO_START,
                        Au1500_PCI_IO_END - Au1500_PCI_IO_START + 1);
@@ -94,6 +96,8 @@ static int __init au1x_pci_setup(void)
        set_io_port_base(virt_io_addr);
 #endif
 
+       au1x_pci_cfg_init();
+
        register_pci_controller(&au1x_controller);
        return 0;
 }
index 2367687310630c40a68b11423a21dab45cc6b2a9..50be56c9e9ef590e9960337de7da248f5eaed575 100644 (file)
@@ -136,7 +136,8 @@ EXPORT(_stext)
         * kernel load address.  This is needed because this platform does
         * not have a ELF loader yet.
         */
-       __INIT
+FEXPORT(__kernel_entry)
+       j       kernel_entry
 #endif
 
        __INIT_REFOK
index 7f6ddcb5d48532657a52b80461644dd05c467551..f8a535afce3943d434ae0fe42a727f9aba654694 100644 (file)
@@ -269,7 +269,7 @@ static void __init bootmem_init(void)
 
 static void __init bootmem_init(void)
 {
-       unsigned long init_begin, reserved_end;
+       unsigned long reserved_end;
        unsigned long mapstart = ~0UL;
        unsigned long bootmap_size;
        int i;
@@ -344,7 +344,6 @@ static void __init bootmem_init(void)
                                         min_low_pfn, max_low_pfn);
 
 
-       init_begin = PFN_UP(__pa_symbol(&__init_begin));
        for (i = 0; i < boot_mem_map.nr_map; i++) {
                unsigned long start, end;
 
@@ -352,8 +351,8 @@ static void __init bootmem_init(void)
                end = PFN_DOWN(boot_mem_map.map[i].addr
                                + boot_mem_map.map[i].size);
 
-               if (start <= init_begin)
-                       start = init_begin;
+               if (start <= min_low_pfn)
+                       start = min_low_pfn;
                if (start >= end)
                        continue;
 
index 1ecfbb7eba6cd25f0637137b6b6272a9ccdd0bc8..2995be1ab3cada3d9771e46cb95727f601cbad53 100644 (file)
@@ -147,9 +147,9 @@ static __init int cpu_has_mfc0_count_bug(void)
                        return 1;
 
                /*
-                * I don't have erratas for newer R4400 so be paranoid.
+                * we assume newer revisions are ok
                 */
-               return 1;
+               return 0;
        }
 
        return 0;
index 5332449ec040fcc08769407b799101ee12d1a603..460626b6d62fc4cce318667032ccefa1f0de80aa 100644 (file)
@@ -12,11 +12,11 @@ endif
 
 MKLASATIMG = mklasatimg
 MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
-KERNEL_IMAGE = $(TOPDIR)/vmlinux
+KERNEL_IMAGE = vmlinux
 KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
 KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )
 
-LDSCRIPT= -L$(obj) -Tromscript.normal
+LDSCRIPT= -L$(srctree)/$(src) -Tromscript.normal
 
 HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
                -D_kernel_entry=0x$(KERNEL_ENTRY) \
@@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
                -D TIMESTAMP=$(shell date +%s)
 
 $(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
-       $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
+       $(CC) -fno-pic $(HEAD_DEFINES) $(LINUXINCLUDE) -c -o $@ $<
 
 OBJECTS = head.o kImage.o
 
index 2c5c27c8e86df597681f0afd216a0af26f64f1c4..dc272c1882337167a0350d87afc978702b1c0f0a 100644 (file)
@@ -169,7 +169,6 @@ void __init prom_meminit(void)
 
 void __init prom_free_prom_memory(void)
 {
-#if 0 /* for now ...  */
        unsigned long addr;
        int i;
 
@@ -181,5 +180,4 @@ void __init prom_free_prom_memory(void)
                free_init_pages("prom memory",
                                addr, addr + boot_mem_map.map[i].size);
        }
-#endif
 }
index 7a1bb51f81ee150e1b5ec38d6b645da8bc1605c3..583d468d98a947cfc95e4cd09872911128f1fa34 100644 (file)
@@ -39,16 +39,18 @@ static void atlas_machine_power_off(void);
 
 static void mips_machine_restart(char *command)
 {
-       unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, sizeof(unsigned int));
+       unsigned int __iomem *softres_reg =
+               ioremap(SOFTRES_REG, sizeof(unsigned int));
 
-       writew(GORESET, softres_reg);
+       __raw_writel(GORESET, softres_reg);
 }
 
 static void mips_machine_halt(void)
 {
-        unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, sizeof(unsigned int));
+       unsigned int __iomem *softres_reg =
+               ioremap(SOFTRES_REG, sizeof(unsigned int));
 
-       writew(GORESET, softres_reg);
+       __raw_writel(GORESET, softres_reg);
 }
 
 #if defined(CONFIG_MIPS_ATLAS)
index ae76795685cc2ee2789596dfbdfeba6c40b47808..810535dd091be1f1aaff24c6403f0686b8b01d63 100644 (file)
@@ -45,7 +45,7 @@ static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp)
        /* ignore region specifiers */
        gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
 
-#ifdef CONFIG_ZONE_DMA32
+#ifdef CONFIG_ZONE_DMA
        if (dev == NULL)
                gfp |= __GFP_DMA;
        else if (dev->coherent_dma_mask < DMA_BIT_MASK(24))
index 6b29904acf451936093ccbaa8d2af9b759502325..1314bd58f0365415a4553a8282d981e36ff54c73 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * BRIEF MODULE DESCRIPTION
- *     Alchemy/AMD Au1x00 pci support.
+ *     Alchemy/AMD Au1x00 PCI support.
  *
- * Copyright 2001,2002,2003 MontaVista Software Inc.
+ * Copyright 2001-2003, 2007 MontaVista Software Inc.
  * Author: MontaVista Software, Inc.
  *             ppopov@mvista.com or source@mvista.com
  *
@@ -69,10 +69,27 @@ void mod_wired_entry(int entry, unsigned long entrylo0,
        write_c0_pagemask(old_pagemask);
 }
 
-struct vm_struct *pci_cfg_vm;
+static struct vm_struct *pci_cfg_vm;
 static int pci_cfg_wired_entry;
-static int first_cfg = 1;
-unsigned long last_entryLo0, last_entryLo1;
+static unsigned long last_entryLo0, last_entryLo1;
+
+/*
+ * We can't ioremap the entire pci config space because it's too large.
+ * Nor can we call ioremap dynamically because some device drivers use
+ * the PCI config routines from within interrupt handlers and that
+ * becomes a problem in get_vm_area().  We use one wired TLB to handle
+ * all config accesses for all busses.
+ */
+void __init au1x_pci_cfg_init(void)
+{
+       /* Reserve a wired entry for PCI config accesses */
+       pci_cfg_vm = get_vm_area(0x2000, VM_IOREMAP);
+       if (!pci_cfg_vm)
+               panic(KERN_ERR "PCI unable to get vm area\n");
+       pci_cfg_wired_entry = read_c0_wired();
+       add_wired_entry(0, 0, (unsigned long)pci_cfg_vm->addr, PM_4K);
+       last_entryLo0 = last_entryLo1 = 0xffffffff;
+}
 
 static int config_access(unsigned char access_type, struct pci_bus *bus,
                         unsigned int dev_fn, unsigned char where,
@@ -97,27 +114,6 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
                        Au1500_PCI_STATCMD);
        au_sync_udelay(1);
 
-       /*
-        * We can't ioremap the entire pci config space because it's
-        * too large. Nor can we call ioremap dynamically because some
-        * device drivers use the pci config routines from within
-        * interrupt handlers and that becomes a problem in get_vm_area().
-        * We use one wired tlb to handle all config accesses for all
-        * busses. To improve performance, if the current device
-        * is the same as the last device accessed, we don't touch the
-        * tlb.
-        */
-       if (first_cfg) {
-               /* reserve a wired entry for pci config accesses */
-               first_cfg = 0;
-               pci_cfg_vm = get_vm_area(0x2000, VM_IOREMAP);
-               if (!pci_cfg_vm)
-                       panic(KERN_ERR "PCI unable to get vm area\n");
-               pci_cfg_wired_entry = read_c0_wired();
-               add_wired_entry(0, 0, (unsigned long)pci_cfg_vm->addr, PM_4K);
-               last_entryLo0  = last_entryLo1 = 0xffffffff;
-       }
-
        /* Allow board vendors to implement their own off-chip idsel.
         * If it doesn't succeed, may as well bail out at this point.
         */
@@ -144,9 +140,12 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
        /* page boundary */
        cfg_base = cfg_base & PAGE_MASK;
 
+       /*
+        * To improve performance, if the current device is the same as
+        * the last device accessed, we don't touch the TLB.
+        */
        entryLo0 = (6 << 26)  | (cfg_base >> 6) | (2 << 3) | 7;
        entryLo1 = (6 << 26)  | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7;
-
        if ((entryLo0 != last_entryLo0) || (entryLo1 != last_entryLo1)) {
                mod_wired_entry(pci_cfg_wired_entry, entryLo0, entryLo1,
                                (unsigned long)pci_cfg_vm->addr, PM_4K);
index fe54514493044d8a9c70d9686518617531838d23..e95881897ec904b0489233f3fb1fd771a7da20e3 100644 (file)
@@ -42,6 +42,10 @@ static int
 mace_pci_read_config(struct pci_bus *bus, unsigned int devfn,
                     int reg, int size, u32 *val)
 {
+       u32 control = mace->pci.control;
+
+       /* disable master aborts interrupts during config read */
+       mace->pci.control = control & ~MACEPCI_CONTROL_MAR_INT;
        mace->pci.config_addr = mkaddr(bus, devfn, reg);
        switch (size) {
        case 1:
@@ -54,6 +58,9 @@ mace_pci_read_config(struct pci_bus *bus, unsigned int devfn,
                *val = mace->pci.config_data.l;
                break;
        }
+       /* ack possible master abort */
+       mace->pci.error &= ~MACEPCI_ERROR_MASTER_ABORT;
+       mace->pci.control = control;
 
        DPRINTK("read%d: reg=%08x,val=%02x\n", size * 8, reg, *val);
 
index 618ea7dbc47444535cc53095f5f738fda0470b4c..532b561b44425d5fa58c951b0bbce8d25b2069eb 100644 (file)
@@ -119,6 +119,7 @@ static struct pci_controller mace_pci_controller = {
        .iommu          = 0,
        .mem_offset     = MACE_PCI_MEM_OFFSET,
        .io_offset      = 0,
+       .io_map_base    = CKSEG1ADDR(MACEPCI_LOW_IO),
 };
 
 static int __init mace_init(void)
@@ -135,7 +136,8 @@ static int __init mace_init(void)
        BUG_ON(request_irq(MACE_PCI_BRIDGE_IRQ, macepci_error, 0,
                           "MACE PCI error", NULL));
 
-       iomem_resource = mace_pci_mem_resource;
+       /* extend memory resources */
+       iomem_resource.end = mace_pci_mem_resource.end;
        ioport_resource = mace_pci_io_resource;
 
        register_pci_controller(&mace_pci_controller);
index e818fd0f1584f0938a467791be9492c2c4607821..6d494e0de3d97cb60beea553a515d8a9c65281ec 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/kernel_stat.h>
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
-#include <linux/module.h>
 
 #include <asm/bootinfo.h>
 #include <asm/cpu.h>
@@ -41,11 +40,60 @@ static cycle_t hpt_read(void)
        return read_c0_count2();
 }
 
+static struct clocksource pnx_clocksource = {
+       .name           = "pnx8xxx",
+       .rating         = 200,
+       .read           = hpt_read,
+       .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
+};
+
 static void timer_ack(void)
 {
        write_c0_compare(cpj);
 }
 
+static irqreturn_t pnx8xxx_timer_interrupt(int irq, void *dev_id)
+{
+       struct clock_event_device *c = dev_id;
+
+       /* clear MATCH, signal the event */
+       c->event_handler(c);
+
+       return IRQ_HANDLED;
+}
+
+static struct irqaction pnx8xxx_timer_irq = {
+       .handler        = pnx8xxx_timer_interrupt,
+       .flags          = IRQF_DISABLED | IRQF_PERCPU,
+       .name           = "pnx8xxx_timer",
+};
+
+static irqreturn_t monotonic_interrupt(int irq, void *dev_id)
+{
+       /* Timer 2 clear interrupt */
+       write_c0_compare2(-1);
+       return IRQ_HANDLED;
+}
+
+static struct irqaction monotonic_irqaction = {
+       .handler = monotonic_interrupt,
+       .flags = IRQF_DISABLED,
+       .name = "Monotonic timer",
+};
+
+static int pnx8xxx_set_next_event(unsigned long delta,
+                               struct clock_event_device *evt)
+{
+       write_c0_compare(delta);
+       return 0;
+}
+
+static struct clock_event_device pnx8xxx_clockevent = {
+       .name           = "pnx8xxx_clockevent",
+       .features       = CLOCK_EVT_FEAT_ONESHOT,
+       .set_next_event = pnx8xxx_set_next_event,
+};
+
 /*
  * plat_time_init() - it does the following things:
  *
@@ -58,11 +106,34 @@ static void timer_ack(void)
 
 __init void plat_time_init(void)
 {
+       unsigned int             configPR;
        unsigned int             n;
        unsigned int             m;
        unsigned int             p;
        unsigned int             pow2p;
 
+       clockevents_register_device(&pnx8xxx_clockevent);
+       clocksource_register(&pnx_clocksource);
+
+       setup_irq(PNX8550_INT_TIMER1, &pnx8xxx_timer_irq);
+       setup_irq(PNX8550_INT_TIMER2, &monotonic_irqaction);
+
+       /* Timer 1 start */
+       configPR = read_c0_config7();
+       configPR &= ~0x00000008;
+       write_c0_config7(configPR);
+
+       /* Timer 2 start */
+       configPR = read_c0_config7();
+       configPR &= ~0x00000010;
+       write_c0_config7(configPR);
+
+       /* Timer 3 stop */
+       configPR = read_c0_config7();
+       configPR |= 0x00000020;
+       write_c0_config7(configPR);
+
+
         /* PLL0 sets MIPS clock (PLL1 <=> TM1, PLL6 <=> TM2, PLL5 <=> mem) */
         /* (but only if CLK_MIPS_CTL select value [bits 3:1] is 1:  FIXME) */
 
@@ -87,42 +158,6 @@ __init void plat_time_init(void)
        write_c0_count2(0);
        write_c0_compare2(0xffffffff);
 
-       clocksource_mips.read = hpt_read;
-       mips_timer_ack = timer_ack;
-}
-
-static irqreturn_t monotonic_interrupt(int irq, void *dev_id)
-{
-       /* Timer 2 clear interrupt */
-       write_c0_compare2(-1);
-       return IRQ_HANDLED;
 }
 
-static struct irqaction monotonic_irqaction = {
-       .handler = monotonic_interrupt,
-       .flags = IRQF_DISABLED,
-       .name = "Monotonic timer",
-};
 
-void __init plat_timer_setup(struct irqaction *irq)
-{
-       int configPR;
-
-       setup_irq(PNX8550_INT_TIMER1, irq);
-       setup_irq(PNX8550_INT_TIMER2, &monotonic_irqaction);
-
-       /* Timer 1 start */
-       configPR = read_c0_config7();
-       configPR &= ~0x00000008;
-       write_c0_config7(configPR);
-
-       /* Timer 2 start */
-       configPR = read_c0_config7();
-       configPR &= ~0x00000010;
-       write_c0_config7(configPR);
-
-       /* Timer 3 stop */
-       configPR = read_c0_config7();
-       configPR |= 0x00000020;
-       write_c0_config7(configPR);
-}
index cab7cc22ab67407a8f2f37d4706a574c303ed3fb..b0ea0e43ba482b542f533d172277c6c03cee7bbd 100644 (file)
@@ -426,7 +426,6 @@ static void ip32_irq0(void)
 
        crime_int = crime->istat & crime_mask;
        irq = MACE_VID_IN1_IRQ + __ffs(crime_int);
-       crime_int = 1 << irq;
 
        if (crime_int & CRIME_MACEISA_INT_MASK) {
                unsigned long mace_int = mace->perif.ctrl.istat;
index 77febd68fcd47ec0ea6b5bcd7876b62fe283121e..89a71f49b692a31450911cc2be04f378c71f079d 100644 (file)
 #include <asm/ip32/mace.h>
 #include <asm/ip32/ip32_ints.h>
 
-/*
- * .iobase isn't a constant (in the sense of C) so we fill it in at runtime.
- */
-#define MACE_PORT(int)                                                 \
+#define MACEISA_SERIAL1_OFFS   offsetof(struct sgi_mace, isa.serial1)
+#define MACEISA_SERIAL2_OFFS   offsetof(struct sgi_mace, isa.serial2)
+
+#define MACE_PORT(offset,_irq)                                         \
 {                                                                      \
-       .irq            = int,                                          \
+       .mapbase        = MACE_BASE + offset,                           \
+       .irq            = _irq,                                         \
        .uartclk        = 1843200,                                      \
        .iotype         = UPIO_MEM,                                     \
-       .flags          = UPF_SKIP_TEST,                                \
+       .flags          = UPF_SKIP_TEST|UPF_IOREMAP,                    \
        .regshift       = 8,                                            \
 }
 
 static struct plat_serial8250_port uart8250_data[] = {
-       MACE_PORT(MACEISA_SERIAL1_IRQ),
-       MACE_PORT(MACEISA_SERIAL2_IRQ),
+       MACE_PORT(MACEISA_SERIAL1_OFFS, MACEISA_SERIAL1_IRQ),
+       MACE_PORT(MACEISA_SERIAL2_OFFS, MACEISA_SERIAL2_IRQ),
        { },
 };
 
@@ -41,9 +42,6 @@ static struct platform_device uart8250_device = {
 
 static int __init uart8250_init(void)
 {
-       uart8250_data[0].membase = (void __iomem *) &mace->isa.serial1;
-       uart8250_data[1].membase = (void __iomem *) &mace->isa.serial2;
-
        return platform_device_register(&uart8250_device);
 }
 
index 1add6efdb315065e4b424114944911ddb89a3c0e..5d89a21dd0d69b793989c79d169e6ce6fab60020 100644 (file)
@@ -2216,6 +2216,45 @@ static void __init fixup_device_tree_efika(void)
                        prom_printf("fixup_device_tree_efika: ",
                                "skipped entry %x - setprop error\n", i);
        }
+
+       /* Make sure ethernet mdio bus node exists */
+       node = call_prom("finddevice", 1, 1, ADDR("/builtin/mdio"));
+       if (!PHANDLE_VALID(node)) {
+               prom_printf("Adding Ethernet MDIO node\n");
+               call_prom("interpret", 1, 1,
+                       " s\" /builtin\" find-device"
+                       " new-device"
+                               " 1 encode-int s\" #address-cells\" property"
+                               " 0 encode-int s\" #size-cells\" property"
+                               " s\" mdio\" 2dup device-name device-type"
+                               " s\" mpc5200b-fec-phy\" encode-string"
+                               " s\" compatible\" property"
+                               " 0xf0003000 0x400 reg"
+                               " 0x2 encode-int"
+                               " 0x5 encode-int encode+"
+                               " 0x3 encode-int encode+"
+                               " s\" interrupts\" property"
+                       " finish-device");
+       };
+
+       /* Make sure ethernet phy device node exist */
+       node = call_prom("finddevice", 1, 1, ADDR("/builtin/mdio/ethernet-phy"));
+       if (!PHANDLE_VALID(node)) {
+               prom_printf("Adding Ethernet PHY node\n");
+               call_prom("interpret", 1, 1,
+                       " s\" /builtin/mdio\" find-device"
+                       " new-device"
+                               " s\" ethernet-phy\" device-name"
+                               " 0x10 encode-int s\" reg\" property"
+                               " my-self"
+                               " ihandle>phandle"
+                       " finish-device"
+                       " s\" /builtin/ethernet\" find-device"
+                               " encode-int"
+                               " s\" phy-handle\" property"
+                       " device-end");
+       }
+
 }
 #else
 #define fixup_device_tree_efika()
index 27922dff8b94e34614890f7764ce10c014b6fb65..a282bc212e809d76ec1a6b0b134864dca05ea876 100644 (file)
@@ -82,6 +82,14 @@ static inline void slb_shadow_clear(unsigned long entry)
        get_slb_shadow()->save_area[entry].esid = 0;
 }
 
+void slb_shadow_clear_all(void)
+{
+       int i;
+
+       for (i = 0; i < SLB_NUM_BOLTED; i++)
+               slb_shadow_clear(i);
+}
+
 static inline void create_shadowed_slbe(unsigned long ea, int ssize,
                                        unsigned long flags,
                                        unsigned long entry)
index e1e2f6a43019d9618f5da854c07a07bc982de49a..3a963b4a9be0fcca0457e97a980f37bc6a63f4a9 100644 (file)
@@ -88,3 +88,8 @@ config CBE_CPUFREQ_PMI
          but also at lower core voltage.
 
 endmenu
+
+config OPROFILE_CELL
+       def_bool y
+       depends on PPC_CELL_NATIVE && (OPROFILE = m || OPROFILE = y)
+
index 61d12f1830364e984a63a44ecebb40863af7042c..39d695cb969383e9399a15722bf5c6191f19cb70 100644 (file)
@@ -19,6 +19,7 @@ spu-manage-$(CONFIG_PPC_CELLEB)               += spu_manage.o
 spu-manage-$(CONFIG_PPC_CELL_NATIVE)   += spu_manage.o
 
 obj-$(CONFIG_SPU_BASE)                 += spu_callbacks.o spu_base.o \
+                                          spu_notify.o \
                                           spu_syscalls.o \
                                           $(spu-priv1-y) \
                                           $(spu-manage-y) \
diff --git a/arch/powerpc/platforms/cell/spu_notify.c b/arch/powerpc/platforms/cell/spu_notify.c
new file mode 100644 (file)
index 0000000..34d1569
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Move OProfile dependencies from spufs module to the kernel so it
+ * can run on non-cell PPC.
+ *
+ * Copyright (C) IBM 2005
+ *
+ * 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, or (at your option)
+ * any later version.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#undef DEBUG
+
+#include <linux/module.h>
+#include <asm/spu.h>
+#include "spufs/spufs.h"
+
+static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier);
+
+void spu_switch_notify(struct spu *spu, struct spu_context *ctx)
+{
+       blocking_notifier_call_chain(&spu_switch_notifier,
+                                    ctx ? ctx->object_id : 0, spu);
+}
+EXPORT_SYMBOL_GPL(spu_switch_notify);
+
+int spu_switch_event_register(struct notifier_block *n)
+{
+       int ret;
+       ret = blocking_notifier_chain_register(&spu_switch_notifier, n);
+       if (!ret)
+               notify_spus_active();
+       return ret;
+}
+EXPORT_SYMBOL_GPL(spu_switch_event_register);
+
+int spu_switch_event_unregister(struct notifier_block *n)
+{
+       return blocking_notifier_chain_unregister(&spu_switch_notifier, n);
+}
+EXPORT_SYMBOL_GPL(spu_switch_event_unregister);
+
+void spu_set_profile_private_kref(struct spu_context *ctx,
+                                 struct kref *prof_info_kref,
+                                 void (* prof_info_release) (struct kref *kref))
+{
+       ctx->prof_priv_kref = prof_info_kref;
+       ctx->prof_priv_release = prof_info_release;
+}
+EXPORT_SYMBOL_GPL(spu_set_profile_private_kref);
+
+void *spu_get_profile_private_kref(struct spu_context *ctx)
+{
+       return ctx->prof_priv_kref;
+}
+EXPORT_SYMBOL_GPL(spu_get_profile_private_kref);
+
index a9438b719fe8ba38e53f48f4e2106e1e81746cc0..75530d99eda6b831f363170ada2822140f38c29c 100644 (file)
@@ -145,6 +145,20 @@ int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset)
        return ret;
 }
 
+void notify_spus_active(void)
+{
+       struct spufs_calls *calls;
+
+       calls = spufs_calls_get();
+       if (!calls)
+               return;
+
+       calls->notify_spus_active();
+       spufs_calls_put(calls);
+
+       return;
+}
+
 int register_spu_syscalls(struct spufs_calls *calls)
 {
        if (spufs_calls)
index 9cb081c26e7120f5ca84c8ecb2e7ff7ae7814df4..adf0a030d6fecc5532dccb31c5df4375376276ec 100644 (file)
@@ -190,19 +190,3 @@ void spu_release_saved(struct spu_context *ctx)
        spu_release(ctx);
 }
 
-void spu_set_profile_private_kref(struct spu_context *ctx,
-                                 struct kref *prof_info_kref,
-                                 void ( * prof_info_release) (struct kref *kref))
-{
-       ctx->prof_priv_kref = prof_info_kref;
-       ctx->prof_priv_release = prof_info_release;
-}
-EXPORT_SYMBOL_GPL(spu_set_profile_private_kref);
-
-void *spu_get_profile_private_kref(struct spu_context *ctx)
-{
-       return ctx->prof_priv_kref;
-}
-EXPORT_SYMBOL_GPL(spu_get_profile_private_kref);
-
-
index 4d257b3f93364bc34b667d836153451e0e2161e4..9ad53e637aee4c111b747acae0f58d1fa89131fe 100644 (file)
@@ -166,15 +166,7 @@ static int node_allowed(struct spu_context *ctx, int node)
        return rval;
 }
 
-static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier);
-
-void spu_switch_notify(struct spu *spu, struct spu_context *ctx)
-{
-       blocking_notifier_call_chain(&spu_switch_notifier,
-                           ctx ? ctx->object_id : 0, spu);
-}
-
-static void notify_spus_active(void)
+void do_notify_spus_active(void)
 {
        int node;
 
@@ -201,22 +193,6 @@ static void notify_spus_active(void)
        }
 }
 
-int spu_switch_event_register(struct notifier_block * n)
-{
-       int ret;
-       ret = blocking_notifier_chain_register(&spu_switch_notifier, n);
-       if (!ret)
-               notify_spus_active();
-       return ret;
-}
-EXPORT_SYMBOL_GPL(spu_switch_event_register);
-
-int spu_switch_event_unregister(struct notifier_block * n)
-{
-       return blocking_notifier_chain_unregister(&spu_switch_notifier, n);
-}
-EXPORT_SYMBOL_GPL(spu_switch_event_unregister);
-
 /**
  * spu_bind_context - bind spu context to physical spu
  * @spu:       physical spu to bind to
index 2c34f717019033c6e568d4db0dc9828d47c936cb..430404413178852c146c67e57a763d5aebf3ccd2 100644 (file)
@@ -86,5 +86,6 @@ struct spufs_calls spufs_calls = {
        .spu_run = do_spu_run,
        .coredump_extra_notes_size = spufs_coredump_extra_notes_size,
        .coredump_extra_notes_write = spufs_coredump_extra_notes_write,
+       .notify_spus_active = do_notify_spus_active,
        .owner = THIS_MODULE,
 };
index 766685ab26f82b46116c46953bb51286455c7990..b9ea09d9d2fb130056f59d59640eec8554623fa0 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/workqueue.h>
 #include <linux/fs.h>
 #include <linux/syscalls.h>
+#include <linux/ctype.h>
 
 #include <asm/lmb.h>
 
@@ -37,6 +38,8 @@ enum os_area_ldr_format {
        HEADER_LDR_FORMAT_GZIP = 1,
 };
 
+#define OS_AREA_HEADER_MAGIC_NUM "cell_ext_os_area"
+
 /**
  * struct os_area_header - os area header segment.
  * @magic_num: Always 'cell_ext_os_area'.
@@ -114,13 +117,11 @@ struct os_area_params {
        u8 _reserved_5[8];
 };
 
-enum {
-       OS_AREA_DB_MAGIC_NUM = 0x2d64622dU,
-};
+#define OS_AREA_DB_MAGIC_NUM "-db-"
 
 /**
  * struct os_area_db - Shared flash memory database.
- * @magic_num: Always '-db-' = 0x2d64622d.
+ * @magic_num: Always '-db-'.
  * @version: os_area_db format version number.
  * @index_64: byte offset of the database id index for 64 bit variables.
  * @count_64: number of usable 64 bit index entries
@@ -135,7 +136,7 @@ enum {
  */
 
 struct os_area_db {
-       u32 magic_num;
+       u8 magic_num[4];
        u16 version;
        u16 _reserved_1;
        u16 index_64;
@@ -265,12 +266,26 @@ static void __init os_area_get_property(struct device_node *node,
                        prop->name);
 }
 
+static void dump_field(char *s, const u8 *field, int size_of_field)
+{
+#if defined(DEBUG)
+       int i;
+
+       for (i = 0; i < size_of_field; i++)
+               s[i] = isprint(field[i]) ? field[i] : '.';
+       s[i] = 0;
+#endif
+}
+
 #define dump_header(_a) _dump_header(_a, __func__, __LINE__)
 static void _dump_header(const struct os_area_header *h, const char *func,
        int line)
 {
+       char str[sizeof(h->magic_num) + 1];
+
+       dump_field(str, h->magic_num, sizeof(h->magic_num));
        pr_debug("%s:%d: h.magic_num:       '%s'\n", func, line,
-               h->magic_num);
+               str);
        pr_debug("%s:%d: h.hdr_version:     %u\n", func, line,
                h->hdr_version);
        pr_debug("%s:%d: h.db_area_offset:  %u\n", func, line,
@@ -311,7 +326,8 @@ static void _dump_params(const struct os_area_params *p, const char *func,
 
 static int verify_header(const struct os_area_header *header)
 {
-       if (memcmp(header->magic_num, "cell_ext_os_area", 16)) {
+       if (memcmp(header->magic_num, OS_AREA_HEADER_MAGIC_NUM,
+               sizeof(header->magic_num))) {
                pr_debug("%s:%d magic_num failed\n", __func__, __LINE__);
                return -1;
        }
@@ -331,7 +347,8 @@ static int verify_header(const struct os_area_header *header)
 
 static int db_verify(const struct os_area_db *db)
 {
-       if (db->magic_num != OS_AREA_DB_MAGIC_NUM) {
+       if (memcmp(db->magic_num, OS_AREA_DB_MAGIC_NUM,
+               sizeof(db->magic_num))) {
                pr_debug("%s:%d magic_num failed\n", __func__, __LINE__);
                return -1;
        }
@@ -484,8 +501,11 @@ static int db_get_rtc_diff(const struct os_area_db *db, int64_t *rtc_diff)
 static void _dump_db(const struct os_area_db *db, const char *func,
        int line)
 {
+       char str[sizeof(db->magic_num) + 1];
+
+       dump_field(str, db->magic_num, sizeof(db->magic_num));
        pr_debug("%s:%d: db.magic_num:      '%s'\n", func, line,
-               (const char*)&db->magic_num);
+               str);
        pr_debug("%s:%d: db.version:         %u\n", func, line,
                db->version);
        pr_debug("%s:%d: db.index_64:        %u\n", func, line,
@@ -516,7 +536,7 @@ static void os_area_db_init(struct os_area_db *db)
 
        memset(db, 0, sizeof(struct os_area_db));
 
-       db->magic_num = OS_AREA_DB_MAGIC_NUM;
+       memcpy(db->magic_num, OS_AREA_DB_MAGIC_NUM, sizeof(db->magic_num));
        db->version = 1;
        db->index_64 = HEADER_SIZE;
        db->count_64 = VALUES_64_COUNT;
index fc48b96c81bff2ee1ec79eef9d1f13f62b6693cf..412e6b42986f2535ddfd5e101caaec85c76f7dc6 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/vdso_datapage.h>
 #include <asm/pSeries_reconfig.h>
 #include "xics.h"
+#include "plpar_wrappers.h"
 
 /* This version can't take the spinlock, because it never returns */
 static struct rtas_args rtas_stop_self_args = {
@@ -58,6 +59,7 @@ static void pseries_mach_cpu_die(void)
        local_irq_disable();
        idle_task_exit();
        xics_teardown_cpu(0);
+       unregister_slb_shadow(hard_smp_processor_id(), __pa(get_slb_shadow()));
        rtas_stop_self();
        /* Should never get here... */
        BUG();
index 9a455d46379d525181a4278714e22304f72028db..34317aa148a8368b8e0e154a461b101e5b2e2678 100644 (file)
@@ -272,6 +272,7 @@ void vpa_init(int cpu)
         */
        addr = __pa(&slb_shadow[cpu]);
        if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
+               slb_shadow_clear_all();
                ret = register_slb_shadow(hwcpu, addr);
                if (ret)
                        printk(KERN_ERR
index fe562db475e9c454c42d930d9f64808410aa392c..7452269bba2a680a2fa192f20b7fbb1b5528b842 100644 (file)
@@ -5,7 +5,7 @@
  * Based upon code written by Ross Biro, Linus Torvalds, Bob Manson,
  * and David Mosberger.
  *
- * Added Linux support -miguel (weird, eh?, the orignal code was meant
+ * Added Linux support -miguel (weird, eh?, the original code was meant
  * to emulate SunOS).
  */
 
index 63b3ebc0c3c209fef14c8d8cc9f6e6d8bf276e82..a61c38fe75ead3db51c7b0ae0eb4a01ef7b912ee 100644 (file)
@@ -1275,4 +1275,20 @@ int pci_dma_supported(struct pci_dev *pdev, u64 device_mask)
        return (device_mask & dma_addr_mask) == dma_addr_mask;
 }
 
+void pci_resource_to_user(const struct pci_dev *pdev, int bar,
+                         const struct resource *rp, resource_size_t *start,
+                         resource_size_t *end)
+{
+       struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller;
+       unsigned long offset;
+
+       if (rp->flags & IORESOURCE_IO)
+               offset = pbm->io_space.start;
+       else
+               offset = pbm->mem_space.start;
+
+       *start = rp->start - offset;
+       *end = rp->end - offset;
+}
+
 #endif /* !(CONFIG_PCI) */
index 9546ba9f5dee5c5b16b76c77c1324aeacb484b68..e752e75cce83a14388a431bcbd2663f8b9ab42af 100644 (file)
@@ -850,7 +850,7 @@ static int pbm_routes_this_ino(struct pci_pbm_info *pbm, u32 ino)
 /* How the Tomatillo IRQs are routed around is pure guesswork here.
  *
  * All the Tomatillo devices I see in prtconf dumps seem to have only
- * a single PCI bus unit attached to it.  It would seem they are seperate
+ * a single PCI bus unit attached to it.  It would seem they are separate
  * devices because their PortID (ie. JBUS ID) values are all different
  * and thus the registers are mapped to totally different locations.
  *
index b56f8e0196a9e1c4bc0d2c6aa3308785e4c750e9..448ba59207a13f0f65e67cef68fd0ccc3f7ebb7e 100644 (file)
@@ -79,14 +79,14 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
        n = read(in_fds[0], &c, sizeof(c));
        if (n == 0) {
                printk("harddog_open - EOF on watchdog pipe\n");
-               helper_wait(pid);
+               helper_wait(pid, 1, NULL);
                err = -EIO;
                goto out_close_out;
        }
        else if (n < 0) {
                printk("harddog_open - read of watchdog pipe failed, "
                       "err = %d\n", errno);
-               helper_wait(pid);
+               helper_wait(pid, 1, NULL);
                err = n;
                goto out_close_out;
        }
index 90d7f2e8ead8bcd4f9911bcd774b77f1da7acffd..29185cad9fff97328b8b3be7a4cf6dfba6130f47 100644 (file)
@@ -201,7 +201,7 @@ static int change_tramp(char **argv, char *output, int output_len)
        close(fds[1]);
 
        if (pid > 0)
-               CATCH_EINTR(err = waitpid(pid, NULL, 0));
+               helper_wait(pid, 0, "change_tramp");
        return pid;
 }
 
index 5f06204d68719d2ac0fba7bb7a9a8e8b38bfcee3..b8711e50da801582081409b2c1d43ce398c83b67 100644 (file)
@@ -77,7 +77,7 @@ static int slip_tramp(char **argv, int fd)
 {
        struct slip_pre_exec_data pe_data;
        char *output;
-       int status, pid, fds[2], err, output_len;
+       int pid, fds[2], err, output_len;
 
        err = os_pipe(fds, 1, 0);
        if (err < 0) {
@@ -109,15 +109,7 @@ static int slip_tramp(char **argv, int fd)
        read_output(fds[0], output, output_len);
        printk("%s", output);
 
-       CATCH_EINTR(err = waitpid(pid, &status, 0));
-       if (err < 0)
-               err = errno;
-       else if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) {
-               printk(UM_KERN_ERR "'%s' didn't exit with status 0\n", argv[0]);
-               err = -EINVAL;
-       }
-       else err = 0;
-
+       err = helper_wait(pid, 0, argv[0]);
        close(fds[0]);
 
 out_free:
index 1865089ff41a41d920eadf082a12e06de893785d..89c1be225fda5f23525f0799673ba37fe11b6483 100644 (file)
@@ -79,7 +79,7 @@ out:
 static void slirp_close(int fd, void *data)
 {
        struct slirp_data *pri = data;
-       int status,err;
+       int err;
 
        close(fd);
        close(pri->slave);
@@ -98,18 +98,9 @@ static void slirp_close(int fd, void *data)
                       "(%d)\n", pri->pid, errno);
        }
 #endif
-
-       CATCH_EINTR(err = waitpid(pri->pid, &status, WNOHANG));
-       if (err < 0) {
-               printk(UM_KERN_ERR "slirp_close: waitpid returned %d\n", errno);
-               return;
-       }
-
-       if (err == 0) {
-               printk(UM_KERN_ERR "slirp_close: process %d has not exited\n",
-                      pri->pid);
+       err = helper_wait(pri->pid, 1, "slirp_close");
+       if (err < 0)
                return;
-       }
 
        pri->pid = -1;
 }
index 41d254bd38df5222d06f6d08e643dda7469df524..48fc7452bc1d11e3f3aad9c40c6983dac8526fc9 100644 (file)
@@ -49,8 +49,7 @@ int start_io_thread(unsigned long sp, int *fd_out)
                goto out_close;
        }
 
-       pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM | SIGCHLD,
-                   NULL);
+       pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM, NULL);
        if(pid < 0){
                err = -errno;
                printk("start_io_thread - clone failed : errno = %d\n", errno);
index fbf0a87c6eaa80b681086f5cc32dd36f88208df5..6f0d1c741bcad5660be289861c4b71e48c088af2 100644 (file)
@@ -214,7 +214,7 @@ extern int execvp_noalloc(char *buf, const char *file, char *const argv[]);
 extern int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv);
 extern int run_helper_thread(int (*proc)(void *), void *arg,
                             unsigned int flags, unsigned long *stack_out);
-extern int helper_wait(int pid);
+extern int helper_wait(int pid, int nohang, char *pname);
 
 
 /* tls.c */
index 4158118c4a56bd21eeb9699a6588f82860a7374c..93dc0c80ebaf7d128f08125185a8ba65c5f6f770 100644 (file)
@@ -218,7 +218,7 @@ static int init_aio_24(void)
                goto out_close_pipe;
 
        err = run_helper_thread(not_aio_thread, NULL,
-                               CLONE_FILES | CLONE_VM | SIGCHLD, &aio_stack);
+                               CLONE_FILES | CLONE_VM, &aio_stack);
        if (err < 0)
                goto out_close_pipe;
 
@@ -254,7 +254,7 @@ static int init_aio_26(void)
        }
 
        err = run_helper_thread(aio_thread, NULL,
-                               CLONE_FILES | CLONE_VM | SIGCHLD, &aio_stack);
+                               CLONE_FILES | CLONE_VM, &aio_stack);
        if (err < 0)
                return err;
 
index 4ff553603449caced35699db9845d206d703635a..07ca0cb472acf40b1ed8976070e5f4e2ac2cba25 100644 (file)
@@ -94,7 +94,7 @@ static int etap_tramp(char *dev, char *gate, int control_me,
                      int control_remote, int data_me, int data_remote)
 {
        struct etap_pre_exec_data pe_data;
-       int pid, status, err, n;
+       int pid, err, n;
        char version_buf[sizeof("nnnnn\0")];
        char data_fd_buf[sizeof("nnnnnn\0")];
        char gate_buf[sizeof("nnn.nnn.nnn.nnn\0")];
@@ -131,13 +131,7 @@ static int etap_tramp(char *dev, char *gate, int control_me,
        }
        if (c != 1) {
                printk(UM_KERN_ERR "etap_tramp : uml_net failed\n");
-               err = -EINVAL;
-               CATCH_EINTR(n = waitpid(pid, &status, 0));
-               if (n < 0)
-                       err = -errno;
-               else if (!WIFEXITED(status) || (WEXITSTATUS(status) != 1))
-                       printk(UM_KERN_ERR "uml_net didn't exit with "
-                              "status 1\n");
+               err = helper_wait(pid, 0, "uml_net");
        }
        return err;
 }
index 6c55d3c8ead8d00b56b2f2e48e6050a17750a9e6..1037a3b6386ee95f4ff746f764fd1200dc5411f3 100644 (file)
@@ -107,7 +107,7 @@ static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote,
                       "errno = %d\n", errno);
                return err;
        }
-       CATCH_EINTR(waitpid(pid, NULL, 0));
+       helper_wait(pid, 0, "tuntap_open_tramp");
 
        cmsg = CMSG_FIRSTHDR(&msg);
        if (cmsg == NULL) {
index 7a72dbb61b0d6d19d37d67ee44fc7bd4c64e93c5..fba3f0fefeef7ca78d3edd685f24e8d5d4c254bc 100644 (file)
@@ -76,7 +76,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
        data.fd = fds[1];
        data.buf = __cant_sleep() ? kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
                                        kmalloc(PATH_MAX, UM_GFP_KERNEL);
-       pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data);
+       pid = clone(helper_child, (void *) sp, CLONE_VM, &data);
        if (pid < 0) {
                ret = -errno;
                printk("run_helper : clone failed, errno = %d\n", errno);
@@ -101,7 +101,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
                        ret = n;
                        kill(pid, SIGKILL);
                }
-               CATCH_EINTR(waitpid(pid, NULL, 0));
+               CATCH_EINTR(waitpid(pid, NULL, __WCLONE));
        }
 
 out_free2:
@@ -126,7 +126,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
                return -ENOMEM;
 
        sp = stack + UM_KERN_PAGE_SIZE - sizeof(void *);
-       pid = clone(proc, (void *) sp, flags | SIGCHLD, arg);
+       pid = clone(proc, (void *) sp, flags, arg);
        if (pid < 0) {
                err = -errno;
                printk("run_helper_thread : clone failed, errno = %d\n",
@@ -134,7 +134,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
                return err;
        }
        if (stack_out == NULL) {
-               CATCH_EINTR(pid = waitpid(pid, &status, 0));
+               CATCH_EINTR(pid = waitpid(pid, &status, __WCLONE));
                if (pid < 0) {
                        err = -errno;
                        printk("run_helper_thread - wait failed, errno = %d\n",
@@ -150,14 +150,30 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
        return pid;
 }
 
-int helper_wait(int pid)
+int helper_wait(int pid, int nohang, char *pname)
 {
-       int ret;
+       int ret, status;
+       int wflags = __WCLONE;
 
-       CATCH_EINTR(ret = waitpid(pid, NULL, WNOHANG));
+       if (nohang)
+               wflags |= WNOHANG;
+
+       if (!pname)
+               pname = "helper_wait";
+
+       CATCH_EINTR(ret = waitpid(pid, &status, wflags));
        if (ret < 0) {
-               ret = -errno;
-               printk("helper_wait : waitpid failed, errno = %d\n", errno);
-       }
-       return ret;
+               printk(UM_KERN_ERR "%s : waitpid process %d failed, "
+                      "errno = %d\n", pname, pid, errno);
+               return -errno;
+       } else if (nohang && ret == 0) {
+               printk(UM_KERN_ERR "%s : process %d has not exited\n",
+                      pname, pid);
+               return -ECHILD;
+       } else if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
+               printk(UM_KERN_ERR "%s : process %d didn't exit with "
+                      "status 0\n", pname, pid);
+               return -ECHILD;
+       } else
+               return 0;
 }
index 37781db4cecad92a5849bb86d7fca6a3812e627e..bda5c3150d6c798254dd974e7780286971c8f6d7 100644 (file)
@@ -101,7 +101,7 @@ void os_kill_process(int pid, int reap_child)
 {
        kill(pid, SIGKILL);
        if (reap_child)
-               CATCH_EINTR(waitpid(pid, NULL, 0));
+               CATCH_EINTR(waitpid(pid, NULL, __WALL));
 }
 
 /* This is here uniquely to have access to the userspace errno, i.e. the one
@@ -130,7 +130,7 @@ void os_kill_ptraced_process(int pid, int reap_child)
        ptrace(PTRACE_KILL, pid);
        ptrace(PTRACE_CONT, pid);
        if (reap_child)
-               CATCH_EINTR(waitpid(pid, NULL, 0));
+               CATCH_EINTR(waitpid(pid, NULL, __WALL));
 }
 
 /* Don't use the glibc version, which caches the result in TLS. It misses some
index d77c81d7068a06309ecf935ee0ccb9938d4cd8b6..e8b7a97e83d3eb8d75785b6a44e29492ae81efcf 100644 (file)
@@ -64,7 +64,7 @@ void wait_stub_done(int pid)
        int n, status, err;
 
        while (1) {
-               CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
+               CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL));
                if ((n < 0) || !WIFSTOPPED(status))
                        goto bad_wait;
 
@@ -153,7 +153,7 @@ static void handle_trap(int pid, struct uml_pt_regs *regs,
                        panic("handle_trap - continuing to end of syscall "
                              "failed, errno = %d\n", errno);
 
-               CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
+               CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED | __WALL));
                if ((err < 0) || !WIFSTOPPED(status) ||
                   (WSTOPSIG(status) != SIGTRAP + 0x80)) {
                         err = ptrace_dump_regs(pid);
@@ -255,16 +255,18 @@ int start_userspace(unsigned long stub_stack)
                panic("start_userspace : mmap failed, errno = %d", errno);
        sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *);
 
-       flags = CLONE_FILES | SIGCHLD;
+       flags = CLONE_FILES;
        if (proc_mm)
                flags |= CLONE_VM;
+       else
+               flags |= SIGCHLD;
 
        pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack);
        if (pid < 0)
                panic("start_userspace : clone failed, errno = %d", errno);
 
        do {
-               CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
+               CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL));
                if (n < 0)
                        panic("start_userspace : wait failed, errno = %d",
                              errno);
@@ -314,7 +316,7 @@ void userspace(struct uml_pt_regs *regs)
                              "pid=%d, ptrace operation = %d, errno = %d\n",
                              pid, op, errno);
 
-               CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
+               CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED | __WALL));
                if (err < 0)
                        panic("userspace - waitpid failed, errno = %d\n",
                              errno);
index ef095436a78c24f669dfc54d1ef8af9eb376687d..3e058ce9ffb6cd044a8fbf5ff33883b46b649348 100644 (file)
@@ -141,7 +141,7 @@ void os_dump_core(void)
         * nothing reasonable to do if that fails.
         */
 
-       while ((pid = waitpid(-1, NULL, WNOHANG)) > 0)
+       while ((pid = waitpid(-1, NULL, WNOHANG | __WALL)) > 0)
                os_kill_ptraced_process(pid, 0);
 
        abort();
index 96986b46bc856844a8bed97a8b8a871293df92e8..edb5108e5d0e057f24dabe50ae1fde323b9fed56 100644 (file)
@@ -849,7 +849,7 @@ void __init init_bsp_APIC(void)
 /**
  * setup_local_APIC - setup the local APIC
  */
-void __devinit setup_local_APIC(void)
+void __cpuinit setup_local_APIC(void)
 {
        unsigned long oldvalue, value, maxlvt, integrated;
        int i, j;
index 17089a041028d5447f2c20503b10dd1058b030d5..af045ca0f653e7587fdd39dac737877ba0ebe17f 100644 (file)
@@ -2256,14 +2256,12 @@ static int __init apm_init(void)
                apm_info.disabled = 1;
                return -ENODEV;
        }
-       if (PM_IS_ACTIVE()) {
+       if (pm_flags & PM_ACPI) {
                printk(KERN_NOTICE "apm: overridden by ACPI.\n");
                apm_info.disabled = 1;
                return -ENODEV;
        }
-#ifdef CONFIG_PM_LEGACY
-       pm_active = 1;
-#endif
+       pm_flags |= PM_APM;
 
        /*
         * Set up a segment that references the real mode segment 0x40
@@ -2366,9 +2364,7 @@ static void __exit apm_exit(void)
                kthread_stop(kapmd_task);
                kapmd_task = NULL;
        }
-#ifdef CONFIG_PM_LEGACY
-       pm_active = 0;
-#endif
+       pm_flags &= ~PM_APM;
 }
 
 module_init(apm_init);
index 606fe4d55a91f0ee303bc78b08953881416743bd..9f530ff43c213ec3def93623fe36c11658721734 100644 (file)
@@ -49,6 +49,7 @@ static struct _cache_table cache_table[] __cpuinitdata =
        { 0x3c, LVL_2,      256 },      /* 4-way set assoc, sectored cache, 64 byte line size */
        { 0x3d, LVL_2,      384 },      /* 6-way set assoc, sectored cache, 64 byte line size */
        { 0x3e, LVL_2,      512 },      /* 4-way set assoc, sectored cache, 64 byte line size */
+       { 0x3f, LVL_2,      256 },      /* 2-way set assoc, 64 byte line size */
        { 0x41, LVL_2,      128 },      /* 4-way set assoc, 32 byte line size */
        { 0x42, LVL_2,      256 },      /* 4-way set assoc, 32 byte line size */
        { 0x43, LVL_2,      512 },      /* 4-way set assoc, 32 byte line size */
index ac0637a6d71cc75637cff60888c78cbfb5a504b1..fbad51fce672b25f4f30cf24ca81da8bc628a574 100644 (file)
@@ -196,7 +196,7 @@ default_entry:
        /* Do an early initialization of the fixmap area */
        movl $(swapper_pg_dir - __PAGE_OFFSET), %edx
        movl $(swapper_pg_pmd - __PAGE_OFFSET), %eax
-       addl $0x007, %eax                       /* 0x007 = PRESENT+RW+USER */
+       addl $0x67, %eax                        /* 0x67 == _PAGE_TABLE */
        movl %eax, 4092(%edx)
 
        xorl %ebx,%ebx                          /* This is the boot CPU (BSP) */
index 6cf27319a91c3938b457e6b2eb94e2f5d3c35464..c3a565bba106e5058d1465462b3656b0ee8e05a8 100644 (file)
@@ -1882,13 +1882,16 @@ __setup("no_timer_check", notimercheck);
 static int __init timer_irq_works(void)
 {
        unsigned long t1 = jiffies;
+       unsigned long flags;
 
        if (no_timer_check)
                return 1;
 
+       local_save_flags(flags);
        local_irq_enable();
        /* Let ten ticks pass... */
        mdelay((10 * 1000) / HZ);
+       local_irq_restore(flags);
 
        /*
         * Expect a few ticks at least, to be sure some possible
@@ -2167,6 +2170,9 @@ static inline void __init check_timer(void)
        int apic1, pin1, apic2, pin2;
        int vector;
        unsigned int ver;
+       unsigned long flags;
+
+       local_irq_save(flags);
 
        ver = apic_read(APIC_LVR);
        ver = GET_APIC_VERSION(ver);
@@ -2219,7 +2225,7 @@ static inline void __init check_timer(void)
                        }
                        if (disable_timer_pin_1 > 0)
                                clear_IO_APIC_pin(0, pin1);
-                       return;
+                       goto out;
                }
                clear_IO_APIC_pin(apic1, pin1);
                printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
@@ -2242,7 +2248,7 @@ static inline void __init check_timer(void)
                        if (nmi_watchdog == NMI_IO_APIC) {
                                setup_nmi();
                        }
-                       return;
+                       goto out;
                }
                /*
                 * Cleanup, just in case ...
@@ -2266,7 +2272,7 @@ static inline void __init check_timer(void)
 
        if (timer_irq_works()) {
                printk(" works.\n");
-               return;
+               goto out;
        }
        apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector);
        printk(" failed.\n");
@@ -2282,11 +2288,13 @@ static inline void __init check_timer(void)
 
        if (timer_irq_works()) {
                printk(" works.\n");
-               return;
+               goto out;
        }
        printk(" failed :(.\n");
        panic("IO-APIC + timer doesn't work!  Boot with apic=debug and send a "
                "report.  Then try booting with the 'noapic' option");
+out:
+       local_irq_restore(flags);
 }
 
 /*
index 435a8c9b55f854bce24e145f20e5cc04ff7b1509..cbac1670c7c36ec4ee8c268618b4a8014859c2f3 100644 (file)
@@ -1281,10 +1281,13 @@ void disable_IO_APIC(void)
 static int __init timer_irq_works(void)
 {
        unsigned long t1 = jiffies;
+       unsigned long flags;
 
+       local_save_flags(flags);
        local_irq_enable();
        /* Let ten ticks pass... */
        mdelay((10 * 1000) / HZ);
+       local_irq_restore(flags);
 
        /*
         * Expect a few ticks at least, to be sure some possible
@@ -1655,6 +1658,9 @@ static inline void check_timer(void)
 {
        struct irq_cfg *cfg = irq_cfg + 0;
        int apic1, pin1, apic2, pin2;
+       unsigned long flags;
+
+       local_irq_save(flags);
 
        /*
         * get/set the timer IRQ vector:
@@ -1696,7 +1702,7 @@ static inline void check_timer(void)
                        }
                        if (disable_timer_pin_1 > 0)
                                clear_IO_APIC_pin(0, pin1);
-                       return;
+                       goto out;
                }
                clear_IO_APIC_pin(apic1, pin1);
                apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not "
@@ -1718,7 +1724,7 @@ static inline void check_timer(void)
                        if (nmi_watchdog == NMI_IO_APIC) {
                                setup_nmi();
                        }
-                       return;
+                       goto out;
                }
                /*
                 * Cleanup, just in case ...
@@ -1741,7 +1747,7 @@ static inline void check_timer(void)
 
        if (timer_irq_works()) {
                apic_printk(APIC_VERBOSE," works.\n");
-               return;
+               goto out;
        }
        apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector);
        apic_printk(APIC_VERBOSE," failed.\n");
@@ -1756,10 +1762,12 @@ static inline void check_timer(void)
 
        if (timer_irq_works()) {
                apic_printk(APIC_VERBOSE," works.\n");
-               return;
+               goto out;
        }
        apic_printk(APIC_VERBOSE," failed :(.\n");
        panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n");
+out:
+       local_irq_restore(flags);
 }
 
 static int __init notimercheck(char *s)
index d87a523070d111d853cf8ca05a0d3dbad4bcf0cd..3a020f79f82b80195100adb8b431dc9502ed9780 100644 (file)
@@ -727,9 +727,7 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
 
        if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) {
                if (&regs->esp != kcb->jprobe_saved_esp) {
-                       struct pt_regs *saved_regs =
-                           container_of(kcb->jprobe_saved_esp,
-                                           struct pt_regs, esp);
+                       struct pt_regs *saved_regs = &kcb->jprobe_saved_regs;
                        printk("current esp %p does not match saved esp %p\n",
                               &regs->esp, kcb->jprobe_saved_esp);
                        printk("Saved registers for jprobe %p\n", jp);
index 0c467644589c728e2a25ba10aaa17fc682a6bb6c..5df19a9f9239511536c2f994e1b35f539b723a63 100644 (file)
@@ -485,7 +485,6 @@ static void __kprobes resume_execution(struct kprobe *p,
                struct pt_regs *regs, struct kprobe_ctlblk *kcb)
 {
        unsigned long *tos = (unsigned long *)regs->rsp;
-       unsigned long next_rip = 0;
        unsigned long copy_rip = (unsigned long)p->ainsn.insn;
        unsigned long orig_rip = (unsigned long)p->addr;
        kprobe_opcode_t *insn = p->ainsn.insn;
@@ -494,46 +493,42 @@ static void __kprobes resume_execution(struct kprobe *p,
        if (*insn >= 0x40 && *insn <= 0x4f)
                insn++;
 
+       regs->eflags &= ~TF_MASK;
        switch (*insn) {
-       case 0x9c:              /* pushfl */
+       case 0x9c:      /* pushfl */
                *tos &= ~(TF_MASK | IF_MASK);
                *tos |= kcb->kprobe_old_rflags;
                break;
-       case 0xc3:              /* ret/lret */
-       case 0xcb:
-       case 0xc2:
+       case 0xc2:      /* iret/ret/lret */
+       case 0xc3:
        case 0xca:
-               regs->eflags &= ~TF_MASK;
-               /* rip is already adjusted, no more changes required*/
-               return;
-       case 0xe8:              /* call relative - Fix return addr */
+       case 0xcb:
+       case 0xcf:
+       case 0xea:      /* jmp absolute -- ip is correct */
+               /* ip is already adjusted, no more changes required */
+               goto no_change;
+       case 0xe8:      /* call relative - Fix return addr */
                *tos = orig_rip + (*tos - copy_rip);
                break;
        case 0xff:
                if ((insn[1] & 0x30) == 0x10) {
                        /* call absolute, indirect */
-                       /* Fix return addr; rip is correct. */
-                       next_rip = regs->rip;
+                       /* Fix return addr; ip is correct. */
                        *tos = orig_rip + (*tos - copy_rip);
+                       goto no_change;
                } else if (((insn[1] & 0x31) == 0x20) ||        /* jmp near, absolute indirect */
                           ((insn[1] & 0x31) == 0x21)) {        /* jmp far, absolute indirect */
-                       /* rip is correct. */
-                       next_rip = regs->rip;
+                       /* ip is correct. */
+                       goto no_change;
                }
-               break;
-       case 0xea:              /* jmp absolute -- rip is correct */
-               next_rip = regs->rip;
-               break;
        default:
                break;
        }
 
-       regs->eflags &= ~TF_MASK;
-       if (next_rip) {
-               regs->rip = next_rip;
-       } else {
-               regs->rip = orig_rip + (regs->rip - copy_rip);
-       }
+       regs->rip = orig_rip + (regs->rip - copy_rip);
+no_change:
+
+       return;
 }
 
 int __kprobes post_kprobe_handler(struct pt_regs *regs)
@@ -716,10 +711,8 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
        struct jprobe *jp = container_of(p, struct jprobe, kp);
 
        if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) {
-               if ((long *)regs->rsp != kcb->jprobe_saved_rsp) {
-                       struct pt_regs *saved_regs =
-                           container_of(kcb->jprobe_saved_rsp,
-                                           struct pt_regs, rsp);
+               if ((unsigned long *)regs->rsp != kcb->jprobe_saved_rsp) {
+                       struct pt_regs *saved_regs = &kcb->jprobe_saved_regs;
                        printk("current rsp %p does not match saved rsp %p\n",
                               (long *)regs->rsp, kcb->jprobe_saved_rsp);
                        printk("Saved registers for jprobe %p\n", jp);
index 7b899584d290833cdbfed7dee779e20043a91ddb..46d391d49de8a82b750647787e0cd80186533e68 100644 (file)
@@ -204,6 +204,10 @@ void cpu_idle(void)
        }
 }
 
+static void do_nothing(void *unused)
+{
+}
+
 void cpu_idle_wait(void)
 {
        unsigned int cpu, this_cpu = get_cpu();
@@ -228,6 +232,13 @@ void cpu_idle_wait(void)
                                cpu_clear(cpu, map);
                }
                cpus_and(map, map, cpu_online_map);
+               /*
+                * We waited 1 sec, if a CPU still did not call idle
+                * it may be because it is in idle and not waking up
+                * because it has nothing to do.
+                * Give all the remaining CPUS a kick.
+                */
+               smp_call_function_mask(map, do_nothing, 0, 0);
        } while (!cpus_empty(map));
 
        set_cpus_allowed(current, tmp);
@@ -261,7 +272,7 @@ static void mwait_idle(void)
        mwait_idle_with_hints(0, 0);
 }
 
-void __devinit select_idle_routine(const struct cpuinfo_x86 *c)
+void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
 {
        if (cpu_has(c, X86_FEATURE_MWAIT)) {
                printk("monitor/mwait feature present.\n");
index 6309b275cb9c176f61133fa7fc2b5585c9063fd4..ab79e1dfa02311bb75c81c44aa137ddd450c5922 100644 (file)
@@ -135,6 +135,10 @@ static void poll_idle (void)
        cpu_relax();
 }
 
+static void do_nothing(void *unused)
+{
+}
+
 void cpu_idle_wait(void)
 {
        unsigned int cpu, this_cpu = get_cpu();
@@ -160,6 +164,13 @@ void cpu_idle_wait(void)
                                cpu_clear(cpu, map);
                }
                cpus_and(map, map, cpu_online_map);
+               /*
+                * We waited 1 sec, if a CPU still did not call idle
+                * it may be because it is in idle and not waking up
+                * because it has nothing to do.
+                * Give all the remaining CPUS a kick.
+                */
+               smp_call_function_mask(map, do_nothing, 0, 0);
        } while (!cpus_empty(map));
 
        set_cpus_allowed(current, tmp);
index e1e18c34c8219e5760db76bb06097fba5c2dec5a..9c24b45b513c83e5e1354e2b92d340f86d476f07 100644 (file)
@@ -67,7 +67,7 @@
    address, and must not be in the .bss segment! */
 unsigned long init_pg_tables_end __initdata = ~0UL;
 
-int disable_pse __devinitdata = 0;
+int disable_pse __cpuinitdata = 0;
 
 /*
  * Machine setup..
index ef0f34ede1ab34c4db94e1d6c5bd22f4b4a2b4d6..4ea80cbe52e58916798a9e7bd962c90ebd4e5a3f 100644 (file)
@@ -60,7 +60,7 @@
 #include <asm/mtrr.h>
 
 /* Set if we find a B stepping CPU */
-static int __devinitdata smp_b_stepping;
+static int __cpuinitdata smp_b_stepping;
 
 /* Number of siblings per CPU package */
 int smp_num_siblings = 1;
@@ -745,8 +745,8 @@ static inline int alloc_cpu_id(void)
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-static struct task_struct * __devinitdata cpu_idle_tasks[NR_CPUS];
-static inline struct task_struct * alloc_idle_task(int cpu)
+static struct task_struct * __cpuinitdata cpu_idle_tasks[NR_CPUS];
+static inline struct task_struct * __cpuinit alloc_idle_task(int cpu)
 {
        struct task_struct *idle;
 
index 500670c93d81d278e0402289803f5881946226b5..aaf4e1291217ef120d98cb3d7d98e55dd0debb79 100644 (file)
@@ -526,7 +526,7 @@ struct create_idle {
        int cpu;
 };
 
-void do_fork_idle(struct work_struct *work)
+static void __cpuinit do_fork_idle(struct work_struct *work)
 {
        struct create_idle *c_idle =
                container_of(work, struct create_idle, work);
index db284ef44d536a65850d7d0e10a1e2f3de9847c0..2e5efaaf8800ee2d402aca5b0b9bb1a00061458e 100644 (file)
@@ -192,42 +192,25 @@ static int res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long en
        return 0;
 }
 
-static int res_kernel_text_pud_init(pud_t *pud, unsigned long start)
-{
-       pmd_t *pmd;
-       unsigned long paddr;
-
-       pmd = (pmd_t *)get_safe_page(GFP_ATOMIC);
-       if (!pmd)
-               return -ENOMEM;
-       set_pud(pud + pud_index(start), __pud(__pa(pmd) | _KERNPG_TABLE));
-       for (paddr = 0; paddr < KERNEL_TEXT_SIZE; pmd++, paddr += PMD_SIZE) {
-               unsigned long pe;
-
-               pe = __PAGE_KERNEL_LARGE_EXEC | _PAGE_GLOBAL | paddr;
-               pe &= __supported_pte_mask;
-               set_pmd(pmd, __pmd(pe));
-       }
-
-       return 0;
-}
-
 static int set_up_temporary_mappings(void)
 {
        unsigned long start, end, next;
-       pud_t *pud;
        int error;
 
        temp_level4_pgt = (pgd_t *)get_safe_page(GFP_ATOMIC);
        if (!temp_level4_pgt)
                return -ENOMEM;
 
+       /* It is safe to reuse the original kernel mapping */
+       set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map),
+               init_level4_pgt[pgd_index(__START_KERNEL_map)]);
+
        /* Set up the direct mapping from scratch */
        start = (unsigned long)pfn_to_kaddr(0);
        end = (unsigned long)pfn_to_kaddr(end_pfn);
 
        for (; start < end; start = next) {
-               pud = (pud_t *)get_safe_page(GFP_ATOMIC);
+               pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC);
                if (!pud)
                        return -ENOMEM;
                next = start + PGDIR_SIZE;
@@ -238,17 +221,7 @@ static int set_up_temporary_mappings(void)
                set_pgd(temp_level4_pgt + pgd_index(start),
                        mk_kernel_pgd(__pa(pud)));
        }
-
-       /* Set up the kernel text mapping from scratch */
-       pud = (pud_t *)get_safe_page(GFP_ATOMIC);
-       if (!pud)
-               return -ENOMEM;
-       error = res_kernel_text_pud_init(pud, __START_KERNEL_map);
-       if (!error)
-               set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map),
-                       __pgd(__pa(pud) | _PAGE_TABLE));
-
-       return error;
+       return 0;
 }
 
 int swsusp_arch_resume(void)
index ef601026259775ae1f426b63f8808257615a37ef..c88bbffcaa03ed9485dddc721f6bf611c6982ae2 100644 (file)
@@ -373,14 +373,13 @@ void die(const char * str, struct pt_regs * regs, long err)
 
        if (die.lock_owner != raw_smp_processor_id()) {
                console_verbose();
+               raw_local_irq_save(flags);
                __raw_spin_lock(&die.lock);
-               raw_local_save_flags(flags);
                die.lock_owner = smp_processor_id();
                die.lock_owner_depth = 0;
                bust_spinlocks(1);
-       }
-       else
-               raw_local_save_flags(flags);
+       } else
+               raw_local_irq_save(flags);
 
        if (++die.lock_owner_depth < 3) {
                unsigned long esp;
index 3057a19e4641be711836ed889ae8a48677de4cb7..c3ee43333f26a28ae714d4160d7d9755be69791a 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * @file op_model_athlon.h
- * athlon / K7 model-specific MSR operations
+ * athlon / K7 / K8 / Family 10h model-specific MSR operations
  *
  * @remark Copyright 2002 OProfile authors
  * @remark Read the file COPYING
 #define CTRL_WRITE(l,h,msrs,c) do {wrmsr(msrs->controls[(c)].addr, (l), (h));} while (0)
 #define CTRL_SET_ACTIVE(n) (n |= (1<<22))
 #define CTRL_SET_INACTIVE(n) (n &= ~(1<<22))
-#define CTRL_CLEAR(x) (x &= (1<<21))
+#define CTRL_CLEAR_LO(x) (x &= (1<<21))
+#define CTRL_CLEAR_HI(x) (x &= 0xfffffcf0)
 #define CTRL_SET_ENABLE(val) (val |= 1<<20)
 #define CTRL_SET_USR(val,u) (val |= ((u & 1) << 16))
 #define CTRL_SET_KERN(val,k) (val |= ((k & 1) << 17))
 #define CTRL_SET_UM(val, m) (val |= (m << 8))
-#define CTRL_SET_EVENT(val, e) (val |= e)
+#define CTRL_SET_EVENT_LOW(val, e) (val |= (e & 0xff))
+#define CTRL_SET_EVENT_HIGH(val, e) (val |= ((e >> 8) & 0xf))
+#define CTRL_SET_HOST_ONLY(val, h) (val |= ((h & 1) << 9))
+#define CTRL_SET_GUEST_ONLY(val, h) (val |= ((h & 1) << 8))
 
 static unsigned long reset_value[NUM_COUNTERS];
  
@@ -70,7 +74,8 @@ static void athlon_setup_ctrs(struct op_msrs const * const msrs)
                if (unlikely(!CTRL_IS_RESERVED(msrs,i)))
                        continue;
                CTRL_READ(low, high, msrs, i);
-               CTRL_CLEAR(low);
+               CTRL_CLEAR_LO(low);
+               CTRL_CLEAR_HI(high);
                CTRL_WRITE(low, high, msrs, i);
        }
 
@@ -89,12 +94,17 @@ static void athlon_setup_ctrs(struct op_msrs const * const msrs)
                        CTR_WRITE(counter_config[i].count, msrs, i);
 
                        CTRL_READ(low, high, msrs, i);
-                       CTRL_CLEAR(low);
+                       CTRL_CLEAR_LO(low);
+                       CTRL_CLEAR_HI(high);
                        CTRL_SET_ENABLE(low);
                        CTRL_SET_USR(low, counter_config[i].user);
                        CTRL_SET_KERN(low, counter_config[i].kernel);
                        CTRL_SET_UM(low, counter_config[i].unit_mask);
-                       CTRL_SET_EVENT(low, counter_config[i].event);
+                       CTRL_SET_EVENT_LOW(low, counter_config[i].event);
+                       CTRL_SET_EVENT_HIGH(high, counter_config[i].event);
+                       CTRL_SET_HOST_ONLY(high, 0);
+                       CTRL_SET_GUEST_ONLY(high, 0);
+
                        CTRL_WRITE(low, high, msrs, i);
                } else {
                        reset_value[i] = 0;
index dc715a562e141161c40d9c1b0861bd412f5d5ec7..cb5e53b05c7c6baf6224f36a2c3dee8528c4e116 100644 (file)
@@ -880,7 +880,7 @@ static void as_remove_queued_request(struct request_queue *q,
 }
 
 /*
- * as_fifo_expired returns 0 if there are no expired reads on the fifo,
+ * as_fifo_expired returns 0 if there are no expired requests on the fifo,
  * 1 otherwise.  It is ratelimited so that we only perform the check once per
  * `fifo_expire' interval.  Otherwise a large number of expired requests
  * would create a hopeless seekstorm.
@@ -1097,7 +1097,8 @@ dispatch_writes:
                ad->batch_data_dir = REQ_ASYNC;
                ad->current_write_count = ad->write_batch_count;
                ad->write_batch_idled = 0;
-               rq = ad->next_rq[ad->batch_data_dir];
+               rq = rq_entry_fifo(ad->fifo_list[REQ_ASYNC].next);
+               ad->last_check_fifo[REQ_ASYNC] = jiffies;
                goto dispatch_request;
        }
 
@@ -1159,7 +1160,7 @@ static void as_add_request(struct request_queue *q, struct request *rq)
        as_add_rq_rb(ad, rq);
 
        /*
-        * set expire time (only used for reads) and add to fifo list
+        * set expire time and add to fifo list
         */
        rq_set_fifo_time(rq, jiffies + ad->fifo_expire[data_dir]);
        list_add_tail(&rq->queuelist, &ad->fifo_list[data_dir]);
@@ -1463,7 +1464,9 @@ static struct elevator_type iosched_as = {
 
 static int __init as_init(void)
 {
-       return elv_register(&iosched_as);
+       elv_register(&iosched_as);
+
+       return 0;
 }
 
 static void __exit as_exit(void)
index 498a0a54a6aa664f27edce4a32d2fb2d37f4c110..9b4da4ae3c7dcce3dc9964adb5ecf2c570017e8a 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/time.h>
 #include <asm/uaccess.h>
 
-static DEFINE_PER_CPU(unsigned long long, blk_trace_cpu_offset) = { 0, };
 static unsigned int blktrace_seq __read_mostly = 1;
 
 /*
@@ -41,7 +40,7 @@ static void trace_note(struct blk_trace *bt, pid_t pid, int action,
                const int cpu = smp_processor_id();
 
                t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION;
-               t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu);
+               t->time = ktime_to_ns(ktime_get());
                t->device = bt->dev;
                t->action = action;
                t->pid = pid;
@@ -159,7 +158,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
 
                t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION;
                t->sequence = ++(*sequence);
-               t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu);
+               t->time = ktime_to_ns(ktime_get());
                t->sector = sector;
                t->bytes = bytes;
                t->action = what;
@@ -179,7 +178,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
 EXPORT_SYMBOL_GPL(__blk_add_trace);
 
 static struct dentry *blk_tree_root;
-static struct mutex blk_tree_mutex;
+static DEFINE_MUTEX(blk_tree_mutex);
 static unsigned int root_users;
 
 static inline void blk_remove_root(void)
@@ -505,77 +504,3 @@ void blk_trace_shutdown(struct request_queue *q)
                blk_trace_remove(q);
        }
 }
-
-/*
- * Average offset over two calls to cpu_clock() with a gettimeofday()
- * in the middle
- */
-static void blk_check_time(unsigned long long *t, int this_cpu)
-{
-       unsigned long long a, b;
-       struct timeval tv;
-
-       a = cpu_clock(this_cpu);
-       do_gettimeofday(&tv);
-       b = cpu_clock(this_cpu);
-
-       *t = tv.tv_sec * 1000000000 + tv.tv_usec * 1000;
-       *t -= (a + b) / 2;
-}
-
-/*
- * calibrate our inter-CPU timings
- */
-static void blk_trace_check_cpu_time(void *data)
-{
-       unsigned long long *t;
-       int this_cpu = get_cpu();
-
-       t = &per_cpu(blk_trace_cpu_offset, this_cpu);
-
-       /*
-        * Just call it twice, hopefully the second call will be cache hot
-        * and a little more precise
-        */
-       blk_check_time(t, this_cpu);
-       blk_check_time(t, this_cpu);
-
-       put_cpu();
-}
-
-static void blk_trace_set_ht_offsets(void)
-{
-#if defined(CONFIG_SCHED_SMT)
-       int cpu, i;
-
-       /*
-        * now make sure HT siblings have the same time offset
-        */
-       preempt_disable();
-       for_each_online_cpu(cpu) {
-               unsigned long long *cpu_off, *sibling_off;
-
-               for_each_cpu_mask(i, per_cpu(cpu_sibling_map, cpu)) {
-                       if (i == cpu)
-                               continue;
-
-                       cpu_off = &per_cpu(blk_trace_cpu_offset, cpu);
-                       sibling_off = &per_cpu(blk_trace_cpu_offset, i);
-                       *sibling_off = *cpu_off;
-               }
-       }
-       preempt_enable();
-#endif
-}
-
-static __init int blk_trace_init(void)
-{
-       mutex_init(&blk_tree_mutex);
-       on_each_cpu(blk_trace_check_cpu_time, NULL, 1, 1);
-       blk_trace_set_ht_offsets();
-
-       return 0;
-}
-
-module_init(blk_trace_init);
-
index 0b4a47905575f2ee658d8a2f1e373aec71e935e5..13553e015d7203f244db2e411884c56cbee1bc26 100644 (file)
@@ -2279,8 +2279,6 @@ static struct elevator_type iosched_cfq = {
 
 static int __init cfq_init(void)
 {
-       int ret;
-
        /*
         * could be 0 on HZ < 1000 setups
         */
@@ -2292,11 +2290,9 @@ static int __init cfq_init(void)
        if (cfq_slab_setup())
                return -ENOMEM;
 
-       ret = elv_register(&iosched_cfq);
-       if (ret)
-               cfq_slab_kill();
+       elv_register(&iosched_cfq);
 
-       return ret;
+       return 0;
 }
 
 static void __exit cfq_exit(void)
index a054eef8dff63c19548f74e8d2b58db78e704822..342448c3d2ddf20432410b121ef3060859c998d3 100644 (file)
@@ -467,7 +467,9 @@ static struct elevator_type iosched_deadline = {
 
 static int __init deadline_init(void)
 {
-       return elv_register(&iosched_deadline);
+       elv_register(&iosched_deadline);
+
+       return 0;
 }
 
 static void __exit deadline_exit(void)
index 446aea2a3cfbd17e6ff8d15fc0b069785d196e7f..e452deb803957c1f71d71901ef669a630036363b 100644 (file)
@@ -960,7 +960,7 @@ void elv_unregister_queue(struct request_queue *q)
                __elv_unregister_queue(q->elevator);
 }
 
-int elv_register(struct elevator_type *e)
+void elv_register(struct elevator_type *e)
 {
        char *def = "";
 
@@ -975,7 +975,6 @@ int elv_register(struct elevator_type *e)
                                def = " (default)";
 
        printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def);
-       return 0;
 }
 EXPORT_SYMBOL_GPL(elv_register);
 
index 7563d8aa39440bf1946849c745586cc1c7e9eb06..c23e029696508dde4161e1359acd882a6dc8a6de 100644 (file)
@@ -101,7 +101,9 @@ static struct elevator_type elevator_noop = {
 
 static int __init noop_init(void)
 {
-       return elv_register(&elevator_noop);
+       elv_register(&elevator_noop);
+
+       return 0;
 }
 
 static void __exit noop_exit(void)
index 91c73224f4c66f537761fe8c622e441ed5919d12..9675b34638d4824b566e9df643042239bbf04e05 100644 (file)
@@ -230,7 +230,7 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
        rq->cmd_len = hdr->cmd_len;
        rq->cmd_type = REQ_TYPE_BLOCK_PC;
 
-       rq->timeout = (hdr->timeout * HZ) / 1000;
+       rq->timeout = msecs_to_jiffies(hdr->timeout);
        if (!rq->timeout)
                rq->timeout = q->sg_timeout;
        if (!rq->timeout)
@@ -366,7 +366,7 @@ static int sg_io(struct file *file, struct request_queue *q,
         */
        blk_execute_rq(q, bd_disk, rq, 0);
 
-       hdr->duration = ((jiffies - start_time) * 1000) / HZ;
+       hdr->duration = jiffies_to_msecs(jiffies - start_time);
 
        return blk_complete_sghdr_rq(rq, hdr, bio);
 out:
index b9f923ef173d8fc283e2122bc600e59039f0f396..ccf6ea95f68c76dc27d5eb9f06b15e3cd384d9d6 100644 (file)
@@ -82,6 +82,12 @@ config ACPI_PROCFS_POWER
          and functions, which do not yet exist in /sys
 
          Say N to delete power /proc/acpi/ folders that have moved to /sys/
+config ACPI_SYSFS_POWER
+       bool "Future power /sys interface"
+       select POWER_SUPPLY
+       default y
+       ---help---
+         Say N to disable power /sys interface
 config ACPI_PROC_EVENT
        bool "Deprecated /proc/acpi/event support"
        depends on PROC_FS
@@ -103,7 +109,6 @@ config ACPI_PROC_EVENT
 config ACPI_AC
        tristate "AC Adapter"
        depends on X86
-       select POWER_SUPPLY
        default y
        help
          This driver adds support for the AC Adapter object, which indicates
@@ -113,7 +118,6 @@ config ACPI_AC
 config ACPI_BATTERY
        tristate "Battery"
        depends on X86
-       select POWER_SUPPLY
        default y
        help
          This driver adds support for battery information through
@@ -368,7 +372,6 @@ config ACPI_HOTPLUG_MEMORY
 config ACPI_SBS
        tristate "Smart Battery System"
        depends on X86
-       select POWER_SUPPLY
        help
          This driver adds support for the Smart Battery System, another
          type of access to battery information, found on some laptops.
index 76ed4f52bebd6df84be95abc388fa45a8d5e35d0..76b9bea98b6d95729b6750072b7c40de2a9ec922 100644 (file)
@@ -31,7 +31,9 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #endif
+#ifdef CONFIG_ACPI_SYSFS_POWER
 #include <linux/power_supply.h>
+#endif
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
@@ -79,7 +81,9 @@ static struct acpi_driver acpi_ac_driver = {
 };
 
 struct acpi_ac {
+#ifdef CONFIG_ACPI_SYSFS_POWER
        struct power_supply charger;
+#endif
        struct acpi_device * device;
        unsigned long state;
 };
@@ -94,7 +98,7 @@ static const struct file_operations acpi_ac_fops = {
        .release = single_release,
 };
 #endif
-
+#ifdef CONFIG_ACPI_SYSFS_POWER
 static int get_ac_property(struct power_supply *psy,
                           enum power_supply_property psp,
                           union power_supply_propval *val)
@@ -113,7 +117,7 @@ static int get_ac_property(struct power_supply *psy,
 static enum power_supply_property ac_props[] = {
        POWER_SUPPLY_PROP_ONLINE,
 };
-
+#endif
 /* --------------------------------------------------------------------------
                                AC Adapter Management
    -------------------------------------------------------------------------- */
@@ -241,7 +245,9 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
                acpi_bus_generate_netlink_event(device->pnp.device_class,
                                                  device->dev.bus_id, event,
                                                  (u32) ac->state);
+#ifdef CONFIG_ACPI_SYSFS_POWER
                kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
+#endif
                break;
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -280,12 +286,14 @@ static int acpi_ac_add(struct acpi_device *device)
 #endif
        if (result)
                goto end;
+#ifdef CONFIG_ACPI_SYSFS_POWER
        ac->charger.name = acpi_device_bid(device);
        ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
        ac->charger.properties = ac_props;
        ac->charger.num_properties = ARRAY_SIZE(ac_props);
        ac->charger.get_property = get_ac_property;
        power_supply_register(&ac->device->dev, &ac->charger);
+#endif
        status = acpi_install_notify_handler(device->handle,
                                             ACPI_ALL_NOTIFY, acpi_ac_notify,
                                             ac);
@@ -319,8 +327,10 @@ static int acpi_ac_resume(struct acpi_device *device)
        old_state = ac->state;
        if (acpi_ac_get_state(ac))
                return 0;
+#ifdef CONFIG_ACPI_SYSFS_POWER
        if (old_state != ac->state)
                kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
+#endif
        return 0;
 }
 
@@ -337,8 +347,10 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
 
        status = acpi_remove_notify_handler(device->handle,
                                            ACPI_ALL_NOTIFY, acpi_ac_notify);
+#ifdef CONFIG_ACPI_SYSFS_POWER
        if (ac->charger.dev)
                power_supply_unregister(&ac->charger);
+#endif
 #ifdef CONFIG_ACPI_PROCFS_POWER
        acpi_ac_remove_fs(device);
 #endif
index 8f7505d304b58790c077e4bc257380eccf523117..c4a769d1ba8542bf0210f71eb6930641c9062a2f 100644 (file)
@@ -40,7 +40,9 @@
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
+#ifdef CONFIG_ACPI_SYSFS_POWER
 #include <linux/power_supply.h>
+#endif
 
 #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
 
@@ -86,7 +88,9 @@ MODULE_DEVICE_TABLE(acpi, battery_device_ids);
 
 struct acpi_battery {
        struct mutex lock;
+#ifdef CONFIG_ACPI_SYSFS_POWER
        struct power_supply bat;
+#endif
        struct acpi_device *device;
        unsigned long update_time;
        int current_now;
@@ -117,6 +121,7 @@ inline int acpi_battery_present(struct acpi_battery *battery)
        return battery->device->status.battery_present;
 }
 
+#ifdef CONFIG_ACPI_SYSFS_POWER
 static int acpi_battery_technology(struct acpi_battery *battery)
 {
        if (!strcasecmp("NiCd", battery->type))
@@ -222,6 +227,7 @@ static enum power_supply_property energy_battery_props[] = {
        POWER_SUPPLY_PROP_MODEL_NAME,
        POWER_SUPPLY_PROP_MANUFACTURER,
 };
+#endif
 
 #ifdef CONFIG_ACPI_PROCFS_POWER
 inline char *acpi_battery_units(struct acpi_battery *battery)
@@ -398,6 +404,7 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery)
        return acpi_battery_set_alarm(battery);
 }
 
+#ifdef CONFIG_ACPI_SYSFS_POWER
 static ssize_t acpi_battery_alarm_show(struct device *dev,
                                        struct device_attribute *attr,
                                        char *buf)
@@ -429,11 +436,6 @@ static int sysfs_add_battery(struct acpi_battery *battery)
 {
        int result;
 
-       battery->update_time = 0;
-       result = acpi_battery_get_info(battery);
-       acpi_battery_init_alarm(battery);
-       if (result)
-               return result;
        if (battery->power_unit) {
                battery->bat.properties = charge_battery_props;
                battery->bat.num_properties =
@@ -462,18 +464,31 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
        power_supply_unregister(&battery->bat);
        battery->bat.dev = NULL;
 }
+#endif
 
 static int acpi_battery_update(struct acpi_battery *battery)
 {
-       int result = acpi_battery_get_status(battery);
+       int result;
+       result = acpi_battery_get_status(battery);
        if (result)
                return result;
+#ifdef CONFIG_ACPI_SYSFS_POWER
        if (!acpi_battery_present(battery)) {
                sysfs_remove_battery(battery);
+               battery->update_time = 0;
                return 0;
        }
+#endif
+       if (!battery->update_time) {
+               result = acpi_battery_get_info(battery);
+               if (result)
+                       return result;
+               acpi_battery_init_alarm(battery);
+       }
+#ifdef CONFIG_ACPI_SYSFS_POWER
        if (!battery->bat.dev)
                sysfs_add_battery(battery);
+#endif
        return acpi_battery_get_state(battery);
 }
 
@@ -767,9 +782,11 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
        acpi_bus_generate_netlink_event(device->pnp.device_class,
                                        device->dev.bus_id, event,
                                        acpi_battery_present(battery));
+#ifdef CONFIG_ACPI_SYSFS_POWER
        /* acpi_batter_update could remove power_supply object */
        if (battery->bat.dev)
                kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE);
+#endif
 }
 
 static int acpi_battery_add(struct acpi_device *device)
@@ -828,7 +845,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
 #ifdef CONFIG_ACPI_PROCFS_POWER
        acpi_battery_remove_fs(device);
 #endif
+#ifdef CONFIG_ACPI_SYSFS_POWER
        sysfs_remove_battery(battery);
+#endif
        mutex_destroy(&battery->lock);
        kfree(battery);
        return 0;
index 49d432d0a12c6d7682b5325015f6612124058d19..d7a115c362d1b53c84a61164c51ff24036684b28 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/list.h>
 #include <linux/sched.h>
 #include <linux/pm.h>
-#include <linux/pm_legacy.h>
 #include <linux/device.h>
 #include <linux/proc_fs.h>
 #ifdef CONFIG_X86
@@ -764,16 +763,14 @@ static int __init acpi_init(void)
        result = acpi_bus_init();
 
        if (!result) {
-#ifdef CONFIG_PM_LEGACY
-               if (!PM_IS_ACTIVE())
-                       pm_active = 1;
+               if (!(pm_flags & PM_APM))
+                       pm_flags |= PM_ACPI;
                else {
                        printk(KERN_INFO PREFIX
                               "APM is already active, exiting\n");
                        disable_acpi();
                        result = -ENODEV;
                }
-#endif
        } else
                disable_acpi();
 
index d411017f8c066994cc0c06065a0776b9105397d6..97dc16155a556d13c373535f767bc8faba76514f 100644 (file)
@@ -892,6 +892,17 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
        return 0;
 }
 
+int __init acpi_boot_ec_enable(void)
+{
+       if (!boot_ec || boot_ec->handlers_installed)
+               return 0;
+       if (!ec_install_handlers(boot_ec)) {
+               first_ec = boot_ec;
+               return 0;
+       }
+       return -EFAULT;
+}
+
 int __init acpi_ec_ecdt_probe(void)
 {
        int ret;
@@ -924,9 +935,10 @@ int __init acpi_ec_ecdt_probe(void)
                        goto error;
                /* We really need to limit this workaround, the only ASUS,
                 * which needs it, has fake EC._INI method, so use it as flag.
+                * Keep boot_ec struct as it will be needed soon.
                 */
                if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
-                       goto error;
+                       return -ENODEV;
        }
 
        ret = ec_install_handlers(boot_ec);
index e99f0c435a4724006c9d204c69349733b91d763f..58ad09725dd2a69dcac8f1f45fa3226041981bf3 100644 (file)
@@ -344,7 +344,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                 * setup will potentially execute control methods
                 * (e.g., _REG method for this region)
                 */
-               acpi_ex_relinquish_interpreter();
+               acpi_ex_exit_interpreter();
 
                status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
                                      handler_desc->address_space.context,
@@ -352,7 +352,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
 
                /* Re-enter the interpreter */
 
-               acpi_ex_reacquire_interpreter();
+               acpi_ex_enter_interpreter();
 
                /* Check for failure of the Region Setup */
 
@@ -405,7 +405,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                 * exit the interpreter because the handler *might* block -- we don't
                 * know what it will do, so we can't hold the lock on the intepreter.
                 */
-               acpi_ex_relinquish_interpreter();
+               acpi_ex_exit_interpreter();
        }
 
        /* Call the handler */
@@ -426,7 +426,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                 * We just returned from a non-default handler, we must re-enter the
                 * interpreter
                 */
-               acpi_ex_reacquire_interpreter();
+               acpi_ex_enter_interpreter();
        }
 
        return_ACPI_STATUS(status);
index dd3186abe07a9c464df616aae6fb05454fb53085..62010c2481b3614b9b9ddd3e1cbbae2118f40fd7 100644 (file)
@@ -429,6 +429,15 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
                                          &polarity, &link,
                                          acpi_pci_allocate_irq);
 
+       if (irq < 0) {
+               /*
+                * IDE legacy mode controller IRQs are magic. Why do compat
+                * extensions always make such a nasty mess.
+                */
+               if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE &&
+                               (dev->class & 0x05) == 0)
+                       return 0;
+       }
        /*
         * No IRQ known to the ACPI subsystem - maybe the BIOS / 
         * driver reported one, then use it. Exit in any case.
index 2fe34cc73c1327a191a48aee32b70ee14c922c9e..2235f4e02d26f46267b512a0d3c4c14badc34526 100644 (file)
@@ -76,7 +76,11 @@ static void (*pm_idle_save) (void) __read_mostly;
 #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);
 
index 22cb95b349e49835be4b28599b23864634b13221..f136c7d3b3c234c0d5a5b4fabf19aa95df3733d1 100644 (file)
@@ -40,7 +40,9 @@
 #include <linux/jiffies.h>
 #include <linux/delay.h>
 
+#ifdef CONFIG_ACPI_SYSFS_POWER
 #include <linux/power_supply.h>
+#endif
 
 #include "sbshc.h"
 
@@ -80,7 +82,9 @@ static const struct acpi_device_id sbs_device_ids[] = {
 MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
 
 struct acpi_battery {
+#ifdef CONFIG_ACPI_SYSFS_POWER
        struct power_supply bat;
+#endif
        struct acpi_sbs *sbs;
 #ifdef CONFIG_ACPI_PROCFS_POWER
        struct proc_dir_entry *proc_entry;
@@ -113,7 +117,9 @@ struct acpi_battery {
 #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
 
 struct acpi_sbs {
+#ifdef CONFIG_ACPI_SYSFS_POWER
        struct power_supply charger;
+#endif
        struct acpi_device *device;
        struct acpi_smb_hc *hc;
        struct mutex lock;
@@ -157,6 +163,7 @@ static inline int acpi_battery_scale(struct acpi_battery *battery)
            acpi_battery_ipscale(battery);
 }
 
+#ifdef CONFIG_ACPI_SYSFS_POWER
 static int sbs_get_ac_property(struct power_supply *psy,
                               enum power_supply_property psp,
                               union power_supply_propval *val)
@@ -294,6 +301,7 @@ static enum power_supply_property sbs_energy_battery_props[] = {
        POWER_SUPPLY_PROP_MODEL_NAME,
        POWER_SUPPLY_PROP_MANUFACTURER,
 };
+#endif
 
 /* --------------------------------------------------------------------------
                             Smart Battery System Management
@@ -429,6 +437,7 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs)
        return result;
 }
 
+#ifdef CONFIG_ACPI_SYSFS_POWER
 static ssize_t acpi_battery_alarm_show(struct device *dev,
                                        struct device_attribute *attr,
                                        char *buf)
@@ -458,6 +467,7 @@ static struct device_attribute alarm_attr = {
        .show = acpi_battery_alarm_show,
        .store = acpi_battery_alarm_store,
 };
+#endif
 
 /* --------------------------------------------------------------------------
                               FS Interface (/proc/acpi)
@@ -793,6 +803,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
                        &acpi_battery_state_fops, &acpi_battery_alarm_fops,
                        battery);
 #endif
+#ifdef CONFIG_ACPI_SYSFS_POWER
        battery->bat.name = battery->name;
        battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
        if (!acpi_battery_mode(battery)) {
@@ -813,6 +824,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
                goto end;
        battery->have_sysfs_alarm = 1;
       end:
+#endif
        printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
               ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
               battery->name, sbs->battery->present ? "present" : "absent");
@@ -822,12 +834,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
 static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
 {
        struct acpi_battery *battery = &sbs->battery[id];
-
+#ifdef CONFIG_ACPI_SYSFS_POWER
        if (battery->bat.dev) {
                if (battery->have_sysfs_alarm)
                        device_remove_file(battery->bat.dev, &alarm_attr);
                power_supply_unregister(&battery->bat);
        }
+#endif
 #ifdef CONFIG_ACPI_PROCFS_POWER
        if (battery->proc_entry)
                acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
@@ -848,12 +861,14 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
        if (result)
                goto end;
 #endif
+#ifdef CONFIG_ACPI_SYSFS_POWER
        sbs->charger.name = "sbs-charger";
        sbs->charger.type = POWER_SUPPLY_TYPE_MAINS;
        sbs->charger.properties = sbs_ac_props;
        sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props);
        sbs->charger.get_property = sbs_get_ac_property;
        power_supply_register(&sbs->device->dev, &sbs->charger);
+#endif
        printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n",
               ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
               ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line");
@@ -863,8 +878,10 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
 
 static void acpi_charger_remove(struct acpi_sbs *sbs)
 {
+#ifdef CONFIG_ACPI_SYSFS_POWER
        if (sbs->charger.dev)
                power_supply_unregister(&sbs->charger);
+#endif
 #ifdef CONFIG_ACPI_PROCFS_POWER
        if (sbs->charger_entry)
                acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
@@ -885,7 +902,9 @@ void acpi_sbs_callback(void *context)
                                              ACPI_SBS_NOTIFY_STATUS,
                                              sbs->charger_present);
 #endif
+#ifdef CONFIG_ACPI_SYSFS_POWER
                kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE);
+#endif
        }
        if (sbs->manager_present) {
                for (id = 0; id < MAX_SBS_BAT; ++id) {
@@ -902,7 +921,9 @@ void acpi_sbs_callback(void *context)
                                                      ACPI_SBS_NOTIFY_STATUS,
                                                      bat->present);
 #endif
+#ifdef CONFIG_ACPI_SYSFS_POWER
                        kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE);
+#endif
                }
        }
 }
index 5b4d462117cf915c6e1f2a89d7604ec9ddaa712b..cbfe9ae7a9e55226d82c86e6e6947121ee6e7adc 100644 (file)
@@ -1449,6 +1449,8 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
        return result;
 }
 
+int __init acpi_boot_ec_enable(void);
+
 static int __init acpi_scan_init(void)
 {
        int result;
@@ -1480,6 +1482,10 @@ static int __init acpi_scan_init(void)
         * Enumerate devices in the ACPI namespace.
         */
        result = acpi_bus_scan_fixed(acpi_root);
+
+       /* EC region might be needed at bus_scan, so enable it now */
+       acpi_boot_ec_enable();
+
        if (!result)
                result = acpi_bus_scan(acpi_root, &ops);
 
index 545ea865ceb522bf37b675558f9eedab1da7332d..7bf4befd96bced87785d35c6903b3c38c23d23bc 100644 (file)
@@ -6,6 +6,7 @@
  * Copyright (C) 2006 Randy Dunlap
  */
 
+#include <linux/module.h>
 #include <linux/ata.h>
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <acpi/acmacros.h>
 #include <acpi/actypes.h>
 
+enum {
+       ATA_ACPI_FILTER_SETXFER = 1 << 0,
+       ATA_ACPI_FILTER_LOCK    = 1 << 1,
+
+       ATA_ACPI_FILTER_DEFAULT = ATA_ACPI_FILTER_SETXFER |
+                                 ATA_ACPI_FILTER_LOCK,
+};
+
+static unsigned int ata_acpi_gtf_filter = ATA_ACPI_FILTER_DEFAULT;
+module_param_named(acpi_gtf_filter, ata_acpi_gtf_filter, int, 0644);
+MODULE_PARM_DESC(acpi_gtf_filter, "filter mask for ACPI _GTF commands, set to filter out (0x1=set xfermode, 0x2=lock/freeze lock)");
+
 #define NO_PORT_MULT           0xffff
 #define SATA_ADR(root, pmp)    (((root) << 16) | (pmp))
 
@@ -41,6 +54,12 @@ static int is_pci_dev(struct device *dev)
        return (dev->bus == &pci_bus_type);
 }
 
+static void ata_acpi_clear_gtf(struct ata_device *dev)
+{
+       kfree(dev->gtf_cache);
+       dev->gtf_cache = NULL;
+}
+
 /**
  * ata_acpi_associate_sata_port - associate SATA port with ACPI objects
  * @ap: target SATA port
@@ -94,6 +113,9 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap)
 
                dev->acpi_handle = acpi_get_child(ap->acpi_handle, i);
        }
+
+       if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0)
+               ap->pflags |= ATA_PFLAG_INIT_GTM_VALID;
 }
 
 static void ata_acpi_handle_hotplug(struct ata_port *ap, struct kobject *kobj,
@@ -187,6 +209,32 @@ void ata_acpi_associate(struct ata_host *host)
        }
 }
 
+/**
+ * ata_acpi_dissociate - dissociate ATA host from ACPI objects
+ * @host: target ATA host
+ *
+ * This function is called during driver detach after the whole host
+ * is shut down.
+ *
+ * LOCKING:
+ * EH context.
+ */
+void ata_acpi_dissociate(struct ata_host *host)
+{
+       int i;
+
+       /* Restore initial _GTM values so that driver which attaches
+        * afterward can use them too.
+        */
+       for (i = 0; i < host->n_ports; i++) {
+               struct ata_port *ap = host->ports[i];
+               const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap);
+
+               if (ap->acpi_handle && gtm)
+                       ata_acpi_stm(ap, gtm);
+       }
+}
+
 /**
  * ata_acpi_gtm - execute _GTM
  * @ap: target ATA port
@@ -200,7 +248,7 @@ void ata_acpi_associate(struct ata_host *host)
  * RETURNS:
  * 0 on success, -ENOENT if _GTM doesn't exist, -errno on failure.
  */
-int ata_acpi_gtm(const struct ata_port *ap, struct ata_acpi_gtm *gtm)
+int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *gtm)
 {
        struct acpi_buffer output = { .length = ACPI_ALLOCATE_BUFFER };
        union acpi_object *out_obj;
@@ -259,15 +307,16 @@ EXPORT_SYMBOL_GPL(ata_acpi_gtm);
  * RETURNS:
  * 0 on success, -ENOENT if _STM doesn't exist, -errno on failure.
  */
-int ata_acpi_stm(const struct ata_port *ap, struct ata_acpi_gtm *stm)
+int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm)
 {
        acpi_status status;
+       struct ata_acpi_gtm             stm_buf = *stm;
        struct acpi_object_list         input;
        union acpi_object               in_params[3];
 
        in_params[0].type = ACPI_TYPE_BUFFER;
        in_params[0].buffer.length = sizeof(struct ata_acpi_gtm);
-       in_params[0].buffer.pointer = (u8 *)stm;
+       in_params[0].buffer.pointer = (u8 *)&stm_buf;
        /* Buffers for id may need byteswapping ? */
        in_params[1].type = ACPI_TYPE_BUFFER;
        in_params[1].buffer.length = 512;
@@ -297,7 +346,6 @@ EXPORT_SYMBOL_GPL(ata_acpi_stm);
  * ata_dev_get_GTF - get the drive bootup default taskfile settings
  * @dev: target ATA device
  * @gtf: output parameter for buffer containing _GTF taskfile arrays
- * @ptr_to_free: pointer which should be freed
  *
  * This applies to both PATA and SATA drives.
  *
@@ -311,11 +359,10 @@ EXPORT_SYMBOL_GPL(ata_acpi_stm);
  * EH context.
  *
  * RETURNS:
- * Number of taskfiles on success, 0 if _GTF doesn't exist or doesn't
- * contain valid data.
+ * Number of taskfiles on success, 0 if _GTF doesn't exist.  -EINVAL
+ * if _GTF is invalid.
  */
-static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
-                          void **ptr_to_free)
+static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
 {
        struct ata_port *ap = dev->link->ap;
        acpi_status status;
@@ -323,6 +370,12 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
        union acpi_object *out_obj;
        int rc = 0;
 
+       /* if _GTF is cached, use the cached value */
+       if (dev->gtf_cache) {
+               out_obj = dev->gtf_cache;
+               goto done;
+       }
+
        /* set up output buffer */
        output.length = ACPI_ALLOCATE_BUFFER;
        output.pointer = NULL;  /* ACPI-CA sets this; save/free it later */
@@ -333,12 +386,14 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
 
        /* _GTF has no input parameters */
        status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output);
+       out_obj = dev->gtf_cache = output.pointer;
 
        if (ACPI_FAILURE(status)) {
                if (status != AE_NOT_FOUND) {
                        ata_dev_printk(dev, KERN_WARNING,
                                       "_GTF evaluation failed (AE 0x%x)\n",
                                       status);
+                       rc = -EINVAL;
                }
                goto out_free;
        }
@@ -350,14 +405,15 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
                                __FUNCTION__,
                                (unsigned long long)output.length,
                                output.pointer);
+               rc = -EINVAL;
                goto out_free;
        }
 
-       out_obj = output.pointer;
        if (out_obj->type != ACPI_TYPE_BUFFER) {
                ata_dev_printk(dev, KERN_WARNING,
                               "_GTF unexpected object type 0x%x\n",
                               out_obj->type);
+               rc = -EINVAL;
                goto out_free;
        }
 
@@ -365,21 +421,23 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
                ata_dev_printk(dev, KERN_WARNING,
                               "unexpected _GTF length (%d)\n",
                               out_obj->buffer.length);
+               rc = -EINVAL;
                goto out_free;
        }
 
-       *ptr_to_free = out_obj;
-       *gtf = (void *)out_obj->buffer.pointer;
+ done:
        rc = out_obj->buffer.length / REGS_PER_GTF;
-
-       if (ata_msg_probe(ap))
-               ata_dev_printk(dev, KERN_DEBUG, "%s: returning "
-                       "gtf=%p, gtf_count=%d, ptr_to_free=%p\n",
-                       __FUNCTION__, *gtf, rc, *ptr_to_free);
+       if (gtf) {
+               *gtf = (void *)out_obj->buffer.pointer;
+               if (ata_msg_probe(ap))
+                       ata_dev_printk(dev, KERN_DEBUG,
+                                      "%s: returning gtf=%p, gtf_count=%d\n",
+                                      __FUNCTION__, *gtf, rc);
+       }
        return rc;
 
  out_free:
-       kfree(output.pointer);
+       ata_acpi_clear_gtf(dev);
        return rc;
 }
 
@@ -393,22 +451,21 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
 
 int ata_acpi_cbl_80wire(struct ata_port *ap)
 {
-       struct ata_acpi_gtm gtm;
+       const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap);
        int valid = 0;
 
-       /* No _GTM data, no information */
-       if (ata_acpi_gtm(ap, &gtm) < 0)
+       if (!gtm)
                return 0;
 
        /* Split timing, DMA enabled */
-       if ((gtm.flags & 0x11) == 0x11 && gtm.drive[0].dma < 55)
+       if ((gtm->flags & 0x11) == 0x11 && gtm->drive[0].dma < 55)
                valid |= 1;
-       if ((gtm.flags & 0x14) == 0x14 && gtm.drive[1].dma < 55)
+       if ((gtm->flags & 0x14) == 0x14 && gtm->drive[1].dma < 55)
                valid |= 2;
        /* Shared timing, DMA enabled */
-       if ((gtm.flags & 0x11) == 0x01 && gtm.drive[0].dma < 55)
+       if ((gtm->flags & 0x11) == 0x01 && gtm->drive[0].dma < 55)
                valid |= 1;
-       if ((gtm.flags & 0x14) == 0x04 && gtm.drive[0].dma < 55)
+       if ((gtm->flags & 0x14) == 0x04 && gtm->drive[0].dma < 55)
                valid |= 2;
 
        /* Drive check */
@@ -421,8 +478,62 @@ int ata_acpi_cbl_80wire(struct ata_port *ap)
 
 EXPORT_SYMBOL_GPL(ata_acpi_cbl_80wire);
 
+static void ata_acpi_gtf_to_tf(struct ata_device *dev,
+                              const struct ata_acpi_gtf *gtf,
+                              struct ata_taskfile *tf)
+{
+       ata_tf_init(dev, tf);
+
+       tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
+       tf->protocol = ATA_PROT_NODATA;
+       tf->feature = gtf->tf[0];       /* 0x1f1 */
+       tf->nsect   = gtf->tf[1];       /* 0x1f2 */
+       tf->lbal    = gtf->tf[2];       /* 0x1f3 */
+       tf->lbam    = gtf->tf[3];       /* 0x1f4 */
+       tf->lbah    = gtf->tf[4];       /* 0x1f5 */
+       tf->device  = gtf->tf[5];       /* 0x1f6 */
+       tf->command = gtf->tf[6];       /* 0x1f7 */
+}
+
+static int ata_acpi_filter_tf(const struct ata_taskfile *tf,
+                             const struct ata_taskfile *ptf)
+{
+       if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_SETXFER) {
+               /* libata doesn't use ACPI to configure transfer mode.
+                * It will only confuse device configuration.  Skip.
+                */
+               if (tf->command == ATA_CMD_SET_FEATURES &&
+                   tf->feature == SETFEATURES_XFER)
+                       return 1;
+       }
+
+       if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_LOCK) {
+               /* BIOS writers, sorry but we don't wanna lock
+                * features unless the user explicitly said so.
+                */
+
+               /* DEVICE CONFIGURATION FREEZE LOCK */
+               if (tf->command == ATA_CMD_CONF_OVERLAY &&
+                   tf->feature == ATA_DCO_FREEZE_LOCK)
+                       return 1;
+
+               /* SECURITY FREEZE LOCK */
+               if (tf->command == ATA_CMD_SEC_FREEZE_LOCK)
+                       return 1;
+
+               /* SET MAX LOCK and SET MAX FREEZE LOCK */
+               if ((!ptf || ptf->command != ATA_CMD_READ_NATIVE_MAX) &&
+                   tf->command == ATA_CMD_SET_MAX &&
+                   (tf->feature == ATA_SET_MAX_LOCK ||
+                    tf->feature == ATA_SET_MAX_FREEZE_LOCK))
+                       return 1;
+       }
+
+       return 0;
+}
+
 /**
- * taskfile_load_raw - send taskfile registers to host controller
+ * ata_acpi_run_tf - send taskfile registers to host controller
  * @dev: target ATA device
  * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7)
  *
@@ -441,56 +552,77 @@ EXPORT_SYMBOL_GPL(ata_acpi_cbl_80wire);
  * EH context.
  *
  * RETURNS:
- * 0 on success, -errno on failure.
+ * 1 if command is executed successfully.  0 if ignored, rejected or
+ * filtered out, -errno on other errors.
  */
-static int taskfile_load_raw(struct ata_device *dev,
-                             const struct ata_acpi_gtf *gtf)
+static int ata_acpi_run_tf(struct ata_device *dev,
+                          const struct ata_acpi_gtf *gtf,
+                          const struct ata_acpi_gtf *prev_gtf)
 {
-       struct ata_port *ap = dev->link->ap;
-       struct ata_taskfile tf, rtf;
+       struct ata_taskfile *pptf = NULL;
+       struct ata_taskfile tf, ptf, rtf;
        unsigned int err_mask;
+       const char *level;
+       char msg[60];
+       int rc;
 
        if ((gtf->tf[0] == 0) && (gtf->tf[1] == 0) && (gtf->tf[2] == 0)
            && (gtf->tf[3] == 0) && (gtf->tf[4] == 0) && (gtf->tf[5] == 0)
            && (gtf->tf[6] == 0))
                return 0;
 
-       ata_tf_init(dev, &tf);
+       ata_acpi_gtf_to_tf(dev, gtf, &tf);
+       if (prev_gtf) {
+               ata_acpi_gtf_to_tf(dev, prev_gtf, &ptf);
+               pptf = &ptf;
+       }
 
-       /* convert gtf to tf */
-       tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */
-       tf.protocol = ATA_PROT_NODATA;
-       tf.feature = gtf->tf[0];        /* 0x1f1 */
-       tf.nsect   = gtf->tf[1];        /* 0x1f2 */
-       tf.lbal    = gtf->tf[2];        /* 0x1f3 */
-       tf.lbam    = gtf->tf[3];        /* 0x1f4 */
-       tf.lbah    = gtf->tf[4];        /* 0x1f5 */
-       tf.device  = gtf->tf[5];        /* 0x1f6 */
-       tf.command = gtf->tf[6];        /* 0x1f7 */
+       if (!ata_acpi_filter_tf(&tf, pptf)) {
+               rtf = tf;
+               err_mask = ata_exec_internal(dev, &rtf, NULL,
+                                            DMA_NONE, NULL, 0, 0);
 
-       if (ata_msg_probe(ap))
-               ata_dev_printk(dev, KERN_DEBUG, "executing ACPI cmd "
-                              "%02x/%02x:%02x:%02x:%02x:%02x:%02x\n",
-                              tf.command, tf.feature, tf.nsect,
-                              tf.lbal, tf.lbam, tf.lbah, tf.device);
-
-       rtf = tf;
-       err_mask = ata_exec_internal(dev, &rtf, NULL, DMA_NONE, NULL, 0, 0);
-       if (err_mask) {
-               ata_dev_printk(dev, KERN_ERR,
-                       "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x failed "
-                       "(Emask=0x%x Stat=0x%02x Err=0x%02x)\n",
-                       tf.command, tf.feature, tf.nsect, tf.lbal, tf.lbam,
-                       tf.lbah, tf.device, err_mask, rtf.command, rtf.feature);
-               return -EIO;
+               switch (err_mask) {
+               case 0:
+                       level = KERN_DEBUG;
+                       snprintf(msg, sizeof(msg), "succeeded");
+                       rc = 1;
+                       break;
+
+               case AC_ERR_DEV:
+                       level = KERN_INFO;
+                       snprintf(msg, sizeof(msg),
+                                "rejected by device (Stat=0x%02x Err=0x%02x)",
+                                rtf.command, rtf.feature);
+                       rc = 0;
+                       break;
+
+               default:
+                       level = KERN_ERR;
+                       snprintf(msg, sizeof(msg),
+                                "failed (Emask=0x%x Stat=0x%02x Err=0x%02x)",
+                                err_mask, rtf.command, rtf.feature);
+                       rc = -EIO;
+                       break;
+               }
+       } else {
+               level = KERN_INFO;
+               snprintf(msg, sizeof(msg), "filtered out");
+               rc = 0;
        }
 
-       return 0;
+       ata_dev_printk(dev, level,
+                      "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x %s\n",
+                      tf.command, tf.feature, tf.nsect, tf.lbal,
+                      tf.lbam, tf.lbah, tf.device, msg);
+
+       return rc;
 }
 
 /**
  * ata_acpi_exec_tfs - get then write drive taskfile settings
  * @dev: target ATA device
+ * @nr_executed: out paramter for the number of executed commands
  *
  * Evaluate _GTF and excute returned taskfiles.
  *
@@ -498,35 +630,36 @@ static int taskfile_load_raw(struct ata_device *dev,
  * EH context.
  *
  * RETURNS:
- * Number of executed taskfiles on success, 0 if _GTF doesn't exist or
- * doesn't contain valid data.  -errno on other errors.
+ * Number of executed taskfiles on success, 0 if _GTF doesn't exist.
+ * -errno on other errors.
  */
-static int ata_acpi_exec_tfs(struct ata_device *dev)
+static int ata_acpi_exec_tfs(struct ata_device *dev, int *nr_executed)
 {
-       struct ata_acpi_gtf *gtf = NULL;
-       void *ptr_to_free = NULL;
+       struct ata_acpi_gtf *gtf = NULL, *pgtf = NULL;
        int gtf_count, i, rc;
 
        /* get taskfiles */
-       gtf_count = ata_dev_get_GTF(dev, &gtf, &ptr_to_free);
+       rc = ata_dev_get_GTF(dev, &gtf);
+       if (rc < 0)
+               return rc;
+       gtf_count = rc;
 
        /* execute them */
-       for (i = 0, rc = 0; i < gtf_count; i++) {
-               int tmp;
-
-               /* ACPI errors are eventually ignored.  Run till the
-                * end even after errors.
-                */
-               tmp = taskfile_load_raw(dev, gtf++);
-               if (!rc)
-                       rc = tmp;
+       for (i = 0; i < gtf_count; i++, gtf++) {
+               rc = ata_acpi_run_tf(dev, gtf, pgtf);
+               if (rc < 0)
+                       break;
+               if (rc) {
+                       (*nr_executed)++;
+                       pgtf = gtf;
+               }
        }
 
-       kfree(ptr_to_free);
+       ata_acpi_clear_gtf(dev);
 
-       if (rc == 0)
-               return gtf_count;
-       return rc;
+       if (rc < 0)
+               return rc;
+       return 0;
 }
 
 /**
@@ -596,27 +729,8 @@ static int ata_acpi_push_id(struct ata_device *dev)
  */
 int ata_acpi_on_suspend(struct ata_port *ap)
 {
-       unsigned long flags;
-       int rc;
-
-       /* proceed iff per-port acpi_handle is valid */
-       if (!ap->acpi_handle)
-               return 0;
-       BUG_ON(ap->flags & ATA_FLAG_ACPI_SATA);
-
-       /* store timing parameters */
-       rc = ata_acpi_gtm(ap, &ap->acpi_gtm);
-
-       spin_lock_irqsave(ap->lock, flags);
-       if (rc == 0)
-               ap->pflags |= ATA_PFLAG_GTM_VALID;
-       else
-               ap->pflags &= ~ATA_PFLAG_GTM_VALID;
-       spin_unlock_irqrestore(ap->lock, flags);
-
-       if (rc == -ENOENT)
-               rc = 0;
-       return rc;
+       /* nada */
+       return 0;
 }
 
 /**
@@ -631,18 +745,34 @@ int ata_acpi_on_suspend(struct ata_port *ap)
  */
 void ata_acpi_on_resume(struct ata_port *ap)
 {
+       const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap);
        struct ata_device *dev;
 
-       if (ap->acpi_handle && (ap->pflags & ATA_PFLAG_GTM_VALID)) {
-               BUG_ON(ap->flags & ATA_FLAG_ACPI_SATA);
+       if (ap->acpi_handle && gtm) {
+               /* _GTM valid */
 
                /* restore timing parameters */
-               ata_acpi_stm(ap, &ap->acpi_gtm);
-       }
+               ata_acpi_stm(ap, gtm);
 
-       /* schedule _GTF */
-       ata_link_for_each_dev(dev, &ap->link)
-               dev->flags |= ATA_DFLAG_ACPI_PENDING;
+               /* _GTF should immediately follow _STM so that it can
+                * use values set by _STM.  Cache _GTF result and
+                * schedule _GTF.
+                */
+               ata_link_for_each_dev(dev, &ap->link) {
+                       ata_acpi_clear_gtf(dev);
+                       if (ata_dev_get_GTF(dev, NULL) >= 0)
+                               dev->flags |= ATA_DFLAG_ACPI_PENDING;
+               }
+       } else {
+               /* SATA _GTF needs to be evaulated after _SDD and
+                * there's no reason to evaluate IDE _GTF early
+                * without _STM.  Clear cache and schedule _GTF.
+                */
+               ata_link_for_each_dev(dev, &ap->link) {
+                       ata_acpi_clear_gtf(dev);
+                       dev->flags |= ATA_DFLAG_ACPI_PENDING;
+               }
+       }
 }
 
 /**
@@ -664,6 +794,7 @@ int ata_acpi_on_devcfg(struct ata_device *dev)
        struct ata_port *ap = dev->link->ap;
        struct ata_eh_context *ehc = &ap->link.eh_context;
        int acpi_sata = ap->flags & ATA_FLAG_ACPI_SATA;
+       int nr_executed = 0;
        int rc;
 
        if (!dev->acpi_handle)
@@ -682,14 +813,14 @@ int ata_acpi_on_devcfg(struct ata_device *dev)
        }
 
        /* do _GTF */
-       rc = ata_acpi_exec_tfs(dev);
-       if (rc < 0)
+       rc = ata_acpi_exec_tfs(dev, &nr_executed);
+       if (rc)
                goto acpi_err;
 
        dev->flags &= ~ATA_DFLAG_ACPI_PENDING;
 
        /* refresh IDENTIFY page if any _GTF command has been executed */
-       if (rc > 0) {
+       if (nr_executed) {
                rc = ata_dev_reread_id(dev, 0);
                if (rc < 0) {
                        ata_dev_printk(dev, KERN_ERR, "failed to IDENTIFY "
@@ -701,17 +832,39 @@ int ata_acpi_on_devcfg(struct ata_device *dev)
        return 0;
 
  acpi_err:
-       /* let EH retry on the first failure, disable ACPI on the second */
-       if (dev->flags & ATA_DFLAG_ACPI_FAILED) {
-               ata_dev_printk(dev, KERN_WARNING, "ACPI on devcfg failed the "
-                              "second time, disabling (errno=%d)\n", rc);
-
-               dev->acpi_handle = NULL;
+       /* ignore evaluation failure if we can continue safely */
+       if (rc == -EINVAL && !nr_executed && !(ap->pflags & ATA_PFLAG_FROZEN))
+               return 0;
 
-               /* if port is working, request IDENTIFY reload and continue */
-               if (!(ap->pflags & ATA_PFLAG_FROZEN))
-                       rc = 1;
+       /* fail and let EH retry once more for unknown IO errors */
+       if (!(dev->flags & ATA_DFLAG_ACPI_FAILED)) {
+               dev->flags |= ATA_DFLAG_ACPI_FAILED;
+               return rc;
        }
-       dev->flags |= ATA_DFLAG_ACPI_FAILED;
+
+       ata_dev_printk(dev, KERN_WARNING,
+                      "ACPI: failed the second time, disabled\n");
+       dev->acpi_handle = NULL;
+
+       /* We can safely continue if no _GTF command has been executed
+        * and port is not frozen.
+        */
+       if (!nr_executed && !(ap->pflags & ATA_PFLAG_FROZEN))
+               return 0;
+
        return rc;
 }
+
+/**
+ * ata_acpi_on_disable - ATA ACPI hook called when a device is disabled
+ * @dev: target ATA device
+ *
+ * This function is called when @dev is about to be disabled.
+ *
+ * LOCKING:
+ * EH context.
+ */
+void ata_acpi_on_disable(struct ata_device *dev)
+{
+       ata_acpi_clear_gtf(dev);
+}
index e4dea8623a718675f72178fb03c24a3d6ab2837d..4753a1831dbc483b874a8efed0e9da8adf3f7869 100644 (file)
@@ -64,6 +64,7 @@
 #include <linux/libata.h>
 #include <asm/semaphore.h>
 #include <asm/byteorder.h>
+#include <linux/cdrom.h>
 
 #include "libata.h"
 
@@ -622,6 +623,7 @@ 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++;
@@ -3923,6 +3925,7 @@ void ata_std_postreset(struct ata_link *link, unsigned int *classes)
        /* clear SError */
        if (sata_scr_read(link, SCR_ERROR, &serror) == 0)
                sata_scr_write(link, SCR_ERROR, serror);
+       link->eh_info.serror = 0;
 
        /* is double-select really necessary? */
        if (classes[0] != ATA_DEV_NONE)
@@ -4149,6 +4152,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        { "HITACHI HDS7250SASUN500G*", NULL,    ATA_HORKAGE_NONCQ },
        { "HITACHI HDS7225SBSUN250G*", NULL,    ATA_HORKAGE_NONCQ },
        { "ST380817AS",         "3.42",         ATA_HORKAGE_NONCQ },
+       { "ST3160023AS",        "3.42",         ATA_HORKAGE_NONCQ },
 
        /* Blacklist entries taken from Silicon Image 3124/3132
           Windows driver .inf file - also several Linux problem reports */
@@ -4648,6 +4652,43 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc)
        return 0;
 }
 
+/**
+ *     atapi_qc_may_overflow - Check whether data transfer may overflow
+ *     @qc: ATA command in question
+ *
+ *     ATAPI commands which transfer variable length data to host
+ *     might overflow due to application error or hardare bug.  This
+ *     function checks whether overflow should be drained and ignored
+ *     for @qc.
+ *
+ *     LOCKING:
+ *     None.
+ *
+ *     RETURNS:
+ *     1 if @qc may overflow; otherwise, 0.
+ */
+static int atapi_qc_may_overflow(struct ata_queued_cmd *qc)
+{
+       if (qc->tf.protocol != ATA_PROT_ATAPI &&
+           qc->tf.protocol != ATA_PROT_ATAPI_DMA)
+               return 0;
+
+       if (qc->tf.flags & ATA_TFLAG_WRITE)
+               return 0;
+
+       switch (qc->cdb[0]) {
+       case READ_10:
+       case READ_12:
+       case WRITE_10:
+       case WRITE_12:
+       case GPCMD_READ_CD:
+       case GPCMD_READ_CD_MSF:
+               return 0;
+       }
+
+       return 1;
+}
+
 /**
  *     ata_std_qc_defer - Check whether a qc needs to be deferred
  *     @qc: ATA command in question
@@ -5136,23 +5177,19 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)
  *     Inherited from caller.
  *
  */
-
-static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
+static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
 {
        int do_write = (qc->tf.flags & ATA_TFLAG_WRITE);
-       struct scatterlist *sg = qc->__sg;
-       struct scatterlist *lsg = sg_last(qc->__sg, qc->n_elem);
        struct ata_port *ap = qc->ap;
+       struct ata_eh_info *ehi = &qc->dev->link->eh_info;
+       struct scatterlist *sg;
        struct page *page;
        unsigned char *buf;
        unsigned int offset, count;
-       int no_more_sg = 0;
-
-       if (qc->curbytes + bytes >= qc->nbytes)
-               ap->hsm_task_state = HSM_ST_LAST;
 
 next_sg:
-       if (unlikely(no_more_sg)) {
+       sg = qc->cursg;
+       if (unlikely(!sg)) {
                /*
                 * The end of qc->sg is reached and the device expects
                 * more data to transfer. In order not to overrun qc->sg
@@ -5161,21 +5198,28 @@ next_sg:
                 *    - for write case, padding zero data to the device
                 */
                u16 pad_buf[1] = { 0 };
-               unsigned int words = bytes >> 1;
                unsigned int i;
 
-               if (words) /* warning if bytes > 1 */
-                       ata_dev_printk(qc->dev, KERN_WARNING,
-                                      "%u bytes trailing data\n", bytes);
+               if (bytes > qc->curbytes - qc->nbytes + ATAPI_MAX_DRAIN) {
+                       ata_ehi_push_desc(ehi, "too much trailing data "
+                                         "buf=%u cur=%u bytes=%u",
+                                         qc->nbytes, qc->curbytes, bytes);
+                       return -1;
+               }
 
-               for (i = 0; i < words; i++)
+                /* overflow is exptected for misc ATAPI commands */
+               if (bytes && !atapi_qc_may_overflow(qc))
+                       ata_dev_printk(qc->dev, KERN_WARNING, "ATAPI %u bytes "
+                                      "trailing data (cdb=%02x nbytes=%u)\n",
+                                      bytes, qc->cdb[0], qc->nbytes);
+
+               for (i = 0; i < (bytes + 1) / 2; i++)
                        ap->ops->data_xfer(qc->dev, (unsigned char *)pad_buf, 2, do_write);
 
-               ap->hsm_task_state = HSM_ST_LAST;
-               return;
-       }
+               qc->curbytes += bytes;
 
-       sg = qc->cursg;
+               return 0;
+       }
 
        page = sg_page(sg);
        offset = sg->offset + qc->cursg_ofs;
@@ -5210,19 +5254,20 @@ next_sg:
        }
 
        bytes -= count;
+       if ((count & 1) && bytes)
+               bytes--;
        qc->curbytes += count;
        qc->cursg_ofs += count;
 
        if (qc->cursg_ofs == sg->length) {
-               if (qc->cursg == lsg)
-                       no_more_sg = 1;
-
                qc->cursg = sg_next(qc->cursg);
                qc->cursg_ofs = 0;
        }
 
        if (bytes)
                goto next_sg;
+
+       return 0;
 }
 
 /**
@@ -5265,7 +5310,8 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
 
        VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes);
 
-       __atapi_pio_bytes(qc, bytes);
+       if (__atapi_pio_bytes(qc, bytes))
+               goto err_out;
        ata_altstatus(ap); /* flush */
 
        return;
@@ -7208,18 +7254,14 @@ static void ata_port_detach(struct ata_port *ap)
 
        ata_port_wait_eh(ap);
 
-       /* EH is now guaranteed to see UNLOADING, so no new device
-        * will be attached.  Disable all existing devices.
+       /* EH is now guaranteed to see UNLOADING - EH context belongs
+        * to us.  Disable all existing devices.
         */
-       spin_lock_irqsave(ap->lock, flags);
-
        ata_port_for_each_link(link, ap) {
                ata_link_for_each_dev(dev, link)
                        ata_dev_disable(dev);
        }
 
-       spin_unlock_irqrestore(ap->lock, flags);
-
        /* Final freeze & EH.  All in-flight commands are aborted.  EH
         * will be skipped and retrials will be terminated with bad
         * target.
@@ -7251,6 +7293,9 @@ void ata_host_detach(struct ata_host *host)
 
        for (i = 0; i < host->n_ports; i++)
                ata_port_detach(host->ports[i]);
+
+       /* the host is dead now, dissociate ACPI */
+       ata_acpi_dissociate(host);
 }
 
 /**
index e6605f0386477f7f41fc4821debb11b0191fb9b6..21a81cd148e4babaec0d737c040bc47cc23510d0 100644 (file)
@@ -1264,8 +1264,8 @@ static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc)
                tf.feature |= ATAPI_PKT_DMA;
        } else {
                tf.protocol = ATA_PROT_ATAPI;
-               tf.lbam = (8 * 1024) & 0xff;
-               tf.lbah = (8 * 1024) >> 8;
+               tf.lbam = SCSI_SENSE_BUFFERSIZE;
+               tf.lbah = 0;
        }
 
        return ata_exec_internal(dev, &tf, cdb, DMA_FROM_DEVICE,
@@ -1733,11 +1733,15 @@ static void ata_eh_link_autopsy(struct ata_link *link)
                ehc->i.action &= ~ATA_EH_PERDEV_MASK;
        }
 
-       /* consider speeding down */
+       /* propagate timeout to host link */
+       if ((all_err_mask & AC_ERR_TIMEOUT) && !ata_is_host_link(link))
+               ap->link.eh_context.i.err_mask |= AC_ERR_TIMEOUT;
+
+       /* record error and consider speeding down */
        dev = ehc->i.dev;
-       if (!dev && ata_link_max_devices(link) == 1 &&
-           ata_dev_enabled(link->device))
-               dev = link->device;
+       if (!dev && ((ata_link_max_devices(link) == 1 &&
+                     ata_dev_enabled(link->device))))
+           dev = link->device;
 
        if (dev)
                ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask);
@@ -1759,8 +1763,14 @@ void ata_eh_autopsy(struct ata_port *ap)
 {
        struct ata_link *link;
 
-       __ata_port_for_each_link(link, ap)
+       ata_port_for_each_link(link, ap)
                ata_eh_link_autopsy(link);
+
+       /* Autopsy of fanout ports can affect host link autopsy.
+        * Perform host link autopsy last.
+        */
+       if (ap->nr_pmp_links)
+               ata_eh_link_autopsy(&ap->link);
 }
 
 /**
@@ -2157,13 +2167,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
                if (ata_link_offline(link))
                        continue;
 
-               /* apply class override and convert UNKNOWN to NONE */
+               /* apply class override */
                if (lflags & ATA_LFLAG_ASSUME_ATA)
                        classes[dev->devno] = ATA_DEV_ATA;
                else if (lflags & ATA_LFLAG_ASSUME_SEMB)
                        classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */
-               else if (classes[dev->devno] == ATA_DEV_UNKNOWN)
-                       classes[dev->devno] = ATA_DEV_NONE;
        }
 
        /* record current link speed */
index c0c4dbcde091b5daf1805d2f4e180b0189e213b1..caef2bbd4a8a1525be252d6cfcf627901e52e261 100644 (file)
@@ -495,14 +495,12 @@ static void sata_pmp_quirks(struct ata_port *ap)
                        /* SError.N need a kick in the ass to get working */
                        link->flags |= ATA_LFLAG_HRST_TO_RESUME;
 
-                       /* class code report is unreliable */
-                       if (link->pmp < 5)
-                               link->flags |= ATA_LFLAG_ASSUME_ATA;
-
-                       /* The config device, which can be either at
-                        * port 0 or 5, locks up on SRST.
+                       /* Class code report is unreliable and SRST
+                        * times out under certain configurations.
+                        * Config device can be at port 0 or 5 and
+                        * locks up on SRST.
                         */
-                       if (link->pmp == 0 || link->pmp == 5)
+                       if (link->pmp <= 5)
                                link->flags |= ATA_LFLAG_NO_SRST |
                                               ATA_LFLAG_ASSUME_ATA;
 
index a883bb03d4c7762dc21605974740c3ff4014ae49..264ae60e3fd8ae1a7e5ccb583545b1f6e6eac958 100644 (file)
@@ -872,7 +872,8 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
 
        ata_scsi_sdev_config(sdev);
 
-       sdev->manage_start_stop = 1;
+       if (dev->class == ATA_DEV_ATA)
+               sdev->manage_start_stop = 1;
 
        if (dev)
                ata_scsi_dev_config(sdev, dev);
index 48acc09dab9687e93a247a96614cbc93002727f8..b7ac80b4b1fbd91135e2e6b8f8b83b4d4bf8d300 100644 (file)
@@ -806,7 +806,10 @@ int ata_pci_init_one(struct pci_dev *pdev,
        if (rc)
                goto err_out;
 
-       if (!legacy_mode) {
+       if (!legacy_mode && pdev->irq) {
+               /* We may have no IRQ assigned in which case we can poll. This
+                  shouldn't happen on a sane system but robustness is cheap
+                  in this case */
                rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler,
                                      IRQF_SHARED, DRV_NAME, host);
                if (rc)
@@ -814,7 +817,7 @@ int ata_pci_init_one(struct pci_dev *pdev,
 
                ata_port_desc(host->ports[0], "irq %d", pdev->irq);
                ata_port_desc(host->ports[1], "irq %d", pdev->irq);
-       } else {
+       } else if (legacy_mode) {
                if (!ata_port_is_dummy(host->ports[0])) {
                        rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev),
                                              pi->port_ops->irq_handler,
index 0e6cf3a484dc6dce78834f51b69070b0f8ecc030..bbe59c2fd1e2210d7538e271398ee23465df7f19 100644 (file)
@@ -108,15 +108,19 @@ extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm);
 #ifdef CONFIG_ATA_ACPI
 extern void ata_acpi_associate_sata_port(struct ata_port *ap);
 extern void ata_acpi_associate(struct ata_host *host);
+extern void ata_acpi_dissociate(struct ata_host *host);
 extern int ata_acpi_on_suspend(struct ata_port *ap);
 extern void ata_acpi_on_resume(struct ata_port *ap);
-extern int ata_acpi_on_devcfg(struct ata_device *adev);
+extern int ata_acpi_on_devcfg(struct ata_device *dev);
+extern void ata_acpi_on_disable(struct ata_device *dev);
 #else
 static inline void ata_acpi_associate_sata_port(struct ata_port *ap) { }
 static inline void ata_acpi_associate(struct ata_host *host) { }
+static inline void ata_acpi_dissociate(struct ata_host *host) { }
 static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; }
 static inline void ata_acpi_on_resume(struct ata_port *ap) { }
-static inline int ata_acpi_on_devcfg(struct ata_device *adev) { return 0; }
+static inline int ata_acpi_on_devcfg(struct ata_device *dev) { return 0; }
+static inline void ata_acpi_on_disable(struct ata_device *dev) { }
 #endif
 
 /* libata-scsi.c */
index 46dc70e0dee7ee7d8add0e4541d28d64cc17f5ff..c79f066c2bc9ed796e35b1b6b3816d42d8c824ff 100644 (file)
@@ -375,7 +375,7 @@ static int hpt374_pre_reset(struct ata_link *link, unsigned long deadline)
        pci_write_config_word(pdev, mcrbase + 2, mcr3 | 0x8000);
        pci_read_config_byte(pdev, 0x5A, &ata66);
        /* Reset TCBLID/FCBLID to output */
-       pci_write_config_word(pdev, 0x52, mcr3);
+       pci_write_config_word(pdev, mcrbase + 2, mcr3);
 
        if (ata66 & (2 >> ap->port_no))
                ap->cbl = ATA_CBL_PATA40;
index fcd532afbf2e011c9b4d5183430945d409c702eb..120b5bfa7ce6e9019b2cbd07397ab8d91442c3ad 100644 (file)
@@ -130,10 +130,11 @@ static struct ata_port_operations ixp4xx_port_ops = {
        .port_start             = ata_port_start,
 };
 
-static void ixp4xx_setup_port(struct ata_ioports *ioaddr,
+static void ixp4xx_setup_port(struct ata_port *ap,
                              struct ixp4xx_pata_data *data,
                              unsigned long raw_cs0, unsigned long raw_cs1)
 {
+       struct ata_ioports *ioaddr = &ap->ioaddr;
        unsigned long raw_cmd = raw_cs0;
        unsigned long raw_ctl = raw_cs1 + 0x06;
 
index bc7c2d5d8d5ecee9fbc5fa93e98b19d7fb783e26..8f28156017910a6b58e16b9dcf82f026a5c822b3 100644 (file)
@@ -215,8 +215,8 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
        /* Flip back to 33Mhz for PIO */
        if (adev->dma_mode >= XFER_UDMA_2)
                iowrite8(ioread8(clock) & ~sel66, clock);
-
        ata_bmdma_stop(qc);
+       pdc202xx_set_piomode(ap, adev);
 }
 
 /**
@@ -233,6 +233,17 @@ static void pdc2026x_dev_config(struct ata_device *adev)
        adev->max_sectors = 256;
 }
 
+static int pdc2026x_port_start(struct ata_port *ap)
+{
+       void __iomem *bmdma = ap->ioaddr.bmdma_addr;
+       if (bmdma) {
+               /* Enable burst mode */
+               u8 burst = ioread8(bmdma + 0x1f);
+               iowrite8(burst | 0x01, bmdma + 0x1f);
+       }
+       return ata_sff_port_start(ap);
+}
+
 static struct scsi_host_template pdc202xx_sht = {
        .module                 = THIS_MODULE,
        .name                   = DRV_NAME,
@@ -313,7 +324,7 @@ static struct ata_port_operations pdc2026x_port_ops = {
        .irq_clear      = ata_bmdma_irq_clear,
        .irq_on         = ata_irq_on,
 
-       .port_start     = ata_sff_port_start,
+       .port_start     = pdc2026x_port_start,
 };
 
 static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
index fe0105d35bae130b1077b1b8bec411859bf13460..37b850ae084559d573e125a096cbdfe0eac3f958 100644 (file)
@@ -2506,11 +2506,31 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
                if (pdev->vendor == PCI_VENDOR_ID_TTI &&
                    (pdev->device == 0x2300 || pdev->device == 0x2310))
                {
-                       printk(KERN_WARNING "sata_mv: Highpoint RocketRAID BIOS"
-                               " will CORRUPT DATA on attached drives when"
-                               " configured as \"Legacy\".  BEWARE!\n");
-                       printk(KERN_WARNING "sata_mv: Use BIOS \"JBOD\" volumes"
-                               " instead for safety.\n");
+                       /*
+                        * Highpoint RocketRAID PCIe 23xx series cards:
+                        *
+                        * Unconfigured drives are treated as "Legacy"
+                        * by the BIOS, and it overwrites sector 8 with
+                        * a "Lgcy" metadata block prior to Linux boot.
+                        *
+                        * Configured drives (RAID or JBOD) leave sector 8
+                        * alone, but instead overwrite a high numbered
+                        * sector for the RAID metadata.  This sector can
+                        * be determined exactly, by truncating the physical
+                        * drive capacity to a nice even GB value.
+                        *
+                        * RAID metadata is at: (dev->n_sectors & ~0xfffff)
+                        *
+                        * Warn the user, lest they think we're just buggy.
+                        */
+                       printk(KERN_WARNING DRV_NAME ": Highpoint RocketRAID"
+                               " BIOS CORRUPTS DATA on all attached drives,"
+                               " regardless of if/how they are configured."
+                               " BEWARE!\n");
+                       printk(KERN_WARNING DRV_NAME ": For data safety, do not"
+                               " use sectors 8-9 on \"Legacy\" drives,"
+                               " and avoid the final two gigabytes on"
+                               " all RocketRAID BIOS initialized drives.\n");
                }
        case chip_6042:
                hpriv->ops = &mv6xxx_ops;
index 2f1de6ec044c52f2dd5a4318ba5d2812e00db382..c68b241805fdf569f182b7c9be211183cb1208ca 100644 (file)
@@ -270,7 +270,7 @@ static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
 static void qs_error_handler(struct ata_port *ap)
 {
        qs_enter_reg_mode(ap);
-       ata_do_eh(ap, qs_prereset, ata_std_softreset, NULL,
+       ata_do_eh(ap, qs_prereset, NULL, sata_std_hardreset,
                  ata_std_postreset);
 }
 
index 4e6e381279cc657556924c136fca91ac5ebd7284..f5119bf40c24f0e9e65219208e2fd65a47137e1f 100644 (file)
@@ -390,23 +390,19 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
                sil_scr_read(ap, SCR_ERROR, &serror);
                sil_scr_write(ap, SCR_ERROR, serror);
 
-               /* Trigger hotplug and accumulate SError only if the
-                * port isn't already frozen.  Otherwise, PHY events
-                * during hardreset makes controllers with broken SIEN
-                * repeat probing needlessly.
+               /* Sometimes spurious interrupts occur, double check
+                * it's PHYRDY CHG.
                 */
-               if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
-                       ata_ehi_hotplugged(&ap->link.eh_info);
+               if (serror & SERR_PHYRDY_CHG) {
                        ap->link.eh_info.serror |= serror;
+                       goto freeze;
                }
 
-               goto freeze;
+               if (!(bmdma2 & SIL_DMA_COMPLETE))
+                       return;
        }
 
-       if (unlikely(!qc))
-               goto freeze;
-
-       if (unlikely(qc->tf.flags & ATA_TFLAG_POLLING)) {
+       if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) {
                /* this sometimes happens, just clear IRQ */
                ata_chk_status(ap);
                return;
index 96fd5260446db812dbe938c903b4e47779dfc363..b4c674d83769de52634f03d7a7a1a384a417b17f 100644 (file)
@@ -832,16 +832,31 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc)
        struct ata_link *link = qc->dev->link;
        struct ata_port *ap = link->ap;
        u8 prot = qc->tf.protocol;
-       int is_atapi = (prot == ATA_PROT_ATAPI ||
-                       prot == ATA_PROT_ATAPI_NODATA ||
-                       prot == ATA_PROT_ATAPI_DMA);
-
-       /* ATAPI commands completing with CHECK_SENSE cause various
-        * weird problems if other commands are active.  PMP DMA CS
-        * errata doesn't cover all and HSM violation occurs even with
-        * only one other device active.  Always run an ATAPI command
-        * by itself.
-        */
+
+       /*
+        * There is a bug in the chip:
+        * Port LRAM Causes the PRB/SGT Data to be Corrupted
+        * If the host issues a read request for LRAM and SActive registers
+        * while active commands are available in the port, PRB/SGT data in
+        * the LRAM can become corrupted. This issue applies only when
+        * reading from, but not writing to, the LRAM.
+        *
+        * Therefore, reading LRAM when there is no particular error [and
+        * other commands may be outstanding] is prohibited.
+        *
+        * To avoid this bug there are two situations where a command must run
+        * exclusive of any other commands on the port:
+        *
+        * - ATAPI commands which check the sense data
+        * - Passthrough ATA commands which always have ATA_QCFLAG_RESULT_TF
+        *   set.
+        *
+        */
+       int is_excl = (prot == ATA_PROT_ATAPI ||
+                      prot == ATA_PROT_ATAPI_NODATA ||
+                      prot == ATA_PROT_ATAPI_DMA ||
+                      (qc->flags & ATA_QCFLAG_RESULT_TF));
+
        if (unlikely(ap->excl_link)) {
                if (link == ap->excl_link) {
                        if (ap->nr_active_links)
@@ -849,7 +864,7 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc)
                        qc->flags |= ATA_QCFLAG_CLEAR_EXCL;
                } else
                        return ATA_DEFER_PORT;
-       } else if (unlikely(is_atapi)) {
+       } else if (unlikely(is_excl)) {
                ap->excl_link = link;
                if (ap->nr_active_links)
                        return ATA_DEFER_PORT;
index f8f7139c07c1a9997954e7bb97db1aed5affafd2..c662d686154a1ac64ad5b1c1e7deca1029fce0bc 100644 (file)
@@ -171,8 +171,8 @@ static char *res_strings[] = {
        "packet purged", 
        "packet ageing timeout", 
        "channel ageing timeout", 
-       "calculated lenght error", 
-       "programmed lenght limit error", 
+       "calculated length error", 
+       "programmed length limit error", 
        "aal5 crc32 error", 
        "oam transp or transpc crc10 error", 
        "reserved 25", 
index 14ced85b3f54d9b087a5dab90dea6914cd17da9e..0c205b000e8b9038e6f175e2f6455e107df71c55 100644 (file)
@@ -625,14 +625,6 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
    if (mac[i] == NULL)
       nicstar_init_eprom(card->membase);
 
-   if (request_irq(pcidev->irq, &ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, "nicstar", card) != 0)
-   {
-      printk("nicstar%d: can't allocate IRQ %d.\n", i, pcidev->irq);
-      error = 9;
-      ns_init_card_error(card, error);
-      return error;
-   }
-
    /* Set the VPI/VCI MSb mask to zero so we can receive OAM cells */
    writel(0x00000000, card->membase + VPM);
       
@@ -858,8 +850,6 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
       card->iovpool.count++;
    }
 
-   card->intcnt = 0;
-
    /* Configure NICStAR */
    if (card->rct_size == 4096)
       ns_cfg_rctsize = NS_CFG_RCTSIZE_4096_ENTRIES;
@@ -868,6 +858,15 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
 
    card->efbie = 1;
 
+   card->intcnt = 0;
+   if (request_irq(pcidev->irq, &ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, "nicstar", card) != 0)
+   {
+      printk("nicstar%d: can't allocate IRQ %d.\n", i, pcidev->irq);
+      error = 9;
+      ns_init_card_error(card, error);
+      return error;
+   }
+
    /* Register device */
    card->atmdev = atm_dev_register("nicstar", &atm_ops, -1, NULL);
    if (card->atmdev == NULL)
index 7d704968765f308ac87726e310c64242e96db8fc..509b6490413b9cbc614c7bea6f0ed2b36bade674 100644 (file)
@@ -2927,7 +2927,7 @@ default_int_mode:
        return;
 }
 
-static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
+static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
 {
        ushort subsystem_vendor_id, subsystem_device_id, command;
        __u32 board_id, scratchpad = 0;
index 56e23042728ae093776a86a499da310511d51a91..b8af22e610dfe4f90ac1b637f0670ec5f9e6bfee 100644 (file)
@@ -610,7 +610,7 @@ static int loop_thread(void *data)
 static int loop_switch(struct loop_device *lo, struct file *file)
 {
        struct switch_request w;
-       struct bio *bio = bio_alloc(GFP_KERNEL, 1);
+       struct bio *bio = bio_alloc(GFP_KERNEL, 0);
        if (!bio)
                return -ENOMEM;
        init_completion(&w.wait);
index a5ee21319d37fa2633bd5625099fb429a5c353ca..3535ef896677a28dcc352654c880587e9bc463c2 100644 (file)
@@ -117,8 +117,10 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd,
        p->kobj.parent = parent;
        p->kobj.ktype = ktype;
        p->pd = pd;
-       if (kobject_register(&p->kobj) != 0)
+       if (kobject_register(&p->kobj) != 0) {
+               kobject_put(&p->kobj);
                return NULL;
+       }
        return p;
 }
 /*
index 5f5095afb06b900b3b70a05837b19d866a9cdd8a..c24e1bdbad438785b0b68fca6aba5699331436b2 100644 (file)
@@ -34,7 +34,7 @@
  *                      - set initialised bit then.
  */
 
-//#define DEBUG /* uncomment if you want debugging info (pr_debug) */
+#undef DEBUG   /* #define DEBUG if you want debugging info (pr_debug) */
 #include <linux/fs.h>
 #include <linux/bio.h>
 #include <linux/kernel.h>
@@ -143,17 +143,12 @@ static struct cardinfo cards[MM_MAXCARDS];
 static struct block_device_operations mm_fops;
 static struct timer_list battery_timer;
 
-static int num_cards = 0;
+static int num_cards;
 
 static struct gendisk *mm_gendisk[MM_MAXCARDS];
 
 static void check_batteries(struct cardinfo *card);
 
-/*
------------------------------------------------------------------------------------
---                           get_userbit
------------------------------------------------------------------------------------
-*/
 static int get_userbit(struct cardinfo *card, int bit)
 {
        unsigned char led;
@@ -161,11 +156,7 @@ static int get_userbit(struct cardinfo *card, int bit)
        led = readb(card->csr_remap + MEMCTRLCMD_LEDCTRL);
        return led & bit;
 }
-/*
------------------------------------------------------------------------------------
---                            set_userbit
------------------------------------------------------------------------------------
-*/
+
 static int set_userbit(struct cardinfo *card, int bit, unsigned char state)
 {
        unsigned char led;
@@ -179,11 +170,7 @@ static int set_userbit(struct cardinfo *card, int bit, unsigned char state)
 
        return 0;
 }
-/*
------------------------------------------------------------------------------------
---                             set_led
------------------------------------------------------------------------------------
-*/
+
 /*
  * NOTE: For the power LED, use the LED_POWER_* macros since they differ
  */
@@ -203,11 +190,6 @@ static void set_led(struct cardinfo *card, int shift, unsigned char state)
 }
 
 #ifdef MM_DIAG
-/*
------------------------------------------------------------------------------------
---                              dump_regs
------------------------------------------------------------------------------------
-*/
 static void dump_regs(struct cardinfo *card)
 {
        unsigned char *p;
@@ -224,32 +206,28 @@ static void dump_regs(struct cardinfo *card)
        }
 }
 #endif
-/*
------------------------------------------------------------------------------------
---                            dump_dmastat
------------------------------------------------------------------------------------
-*/
+
 static void dump_dmastat(struct cardinfo *card, unsigned int dmastat)
 {
        dev_printk(KERN_DEBUG, &card->dev->dev, "DMAstat - ");
        if (dmastat & DMASCR_ANY_ERR)
-               printk("ANY_ERR ");
+               printk(KERN_CONT "ANY_ERR ");
        if (dmastat & DMASCR_MBE_ERR)
-               printk("MBE_ERR ");
+               printk(KERN_CONT "MBE_ERR ");
        if (dmastat & DMASCR_PARITY_ERR_REP)
-               printk("PARITY_ERR_REP ");
+               printk(KERN_CONT "PARITY_ERR_REP ");
        if (dmastat & DMASCR_PARITY_ERR_DET)
-               printk("PARITY_ERR_DET ");
+               printk(KERN_CONT "PARITY_ERR_DET ");
        if (dmastat & DMASCR_SYSTEM_ERR_SIG)
-               printk("SYSTEM_ERR_SIG ");
+               printk(KERN_CONT "SYSTEM_ERR_SIG ");
        if (dmastat & DMASCR_TARGET_ABT)
-               printk("TARGET_ABT ");
+               printk(KERN_CONT "TARGET_ABT ");
        if (dmastat & DMASCR_MASTER_ABT)
-               printk("MASTER_ABT ");
+               printk(KERN_CONT "MASTER_ABT ");
        if (dmastat & DMASCR_CHAIN_COMPLETE)
-               printk("CHAIN_COMPLETE ");
+               printk(KERN_CONT "CHAIN_COMPLETE ");
        if (dmastat & DMASCR_DMA_COMPLETE)
-               printk("DMA_COMPLETE ");
+               printk(KERN_CONT "DMA_COMPLETE ");
        printk("\n");
 }
 
@@ -286,7 +264,8 @@ static void mm_start_io(struct cardinfo *card)
 
        /* make the last descriptor end the chain */
        page = &card->mm_pages[card->Active];
-       pr_debug("start_io: %d %d->%d\n", card->Active, page->headcnt, page->cnt-1);
+       pr_debug("start_io: %d %d->%d\n",
+               card->Active, page->headcnt, page->cnt - 1);
        desc = &page->desc[page->cnt-1];
 
        desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN);
@@ -310,8 +289,8 @@ static void mm_start_io(struct cardinfo *card)
        writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR);
        writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR + 4);
 
-       offset = ((char*)desc) - ((char*)page->desc);
-       writel(cpu_to_le32((page->page_dma+offset)&0xffffffff),
+       offset = ((char *)desc) - ((char *)page->desc);
+       writel(cpu_to_le32((page->page_dma+offset) & 0xffffffff),
               card->csr_remap + DMA_DESCRIPTOR_ADDR);
        /* Force the value to u64 before shifting otherwise >> 32 is undefined C
         * and on some ports will do nothing ! */
@@ -352,7 +331,7 @@ static inline void reset_page(struct mm_page *page)
        page->cnt = 0;
        page->headcnt = 0;
        page->bio = NULL;
-       page->biotail = & page->bio;
+       page->biotail = &page->bio;
 }
 
 static void mm_unplug_device(struct request_queue *q)
@@ -408,7 +387,7 @@ static int add_bio(struct cardinfo *card)
                                  vec->bv_page,
                                  vec->bv_offset,
                                  len,
-                                 (rw==READ) ?
+                                 (rw == READ) ?
                                  PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE);
 
        p = &card->mm_pages[card->Ready];
@@ -427,10 +406,10 @@ static int add_bio(struct cardinfo *card)
        desc->pci_addr = cpu_to_le64((u64)desc->data_dma_handle);
        desc->local_addr = cpu_to_le64(card->current_sector << 9);
        desc->transfer_size = cpu_to_le32(len);
-       offset = ( ((char*)&desc->sem_control_bits) - ((char*)p->desc));
+       offset = (((char *)&desc->sem_control_bits) - ((char *)p->desc));
        desc->sem_addr = cpu_to_le64((u64)(p->page_dma+offset));
        desc->zero1 = desc->zero2 = 0;
-       offset = ( ((char*)(desc+1)) - ((char*)p->desc));
+       offset = (((char *)(desc+1)) - ((char *)p->desc));
        desc->next_desc_addr = cpu_to_le64(p->page_dma+offset);
        desc->control_bits = cpu_to_le32(DMASCR_GO|DMASCR_ERR_INT_EN|
                                         DMASCR_PARITY_INT_EN|
@@ -455,11 +434,11 @@ static void process_page(unsigned long data)
        /* check if any of the requests in the page are DMA_COMPLETE,
         * and deal with them appropriately.
         * If we find a descriptor without DMA_COMPLETE in the semaphore, then
-        * dma must have hit an error on that descriptor, so use dma_status instead
-        * and assume that all following descriptors must be re-tried.
+        * dma must have hit an error on that descriptor, so use dma_status
+        * instead and assume that all following descriptors must be re-tried.
         */
        struct mm_page *page;
-       struct bio *return_bio=NULL;
+       struct bio *return_bio = NULL;
        struct cardinfo *card = (struct cardinfo *)data;
        unsigned int dma_status = card->dma_status;
 
@@ -472,12 +451,12 @@ static void process_page(unsigned long data)
                struct bio *bio = page->bio;
                struct mm_dma_desc *desc = &page->desc[page->headcnt];
                int control = le32_to_cpu(desc->sem_control_bits);
-               int last=0;
+               int last = 0;
                int idx;
 
                if (!(control & DMASCR_DMA_COMPLETE)) {
                        control = dma_status;
-                       last=1;
+                       last = 1;
                }
                page->headcnt++;
                idx = page->idx;
@@ -489,8 +468,8 @@ static void process_page(unsigned long data)
                }
 
                pci_unmap_page(card->dev, desc->data_dma_handle,
-                              bio_iovec_idx(bio,idx)->bv_len,
-                                (control& DMASCR_TRANSFER_READ) ?
+                              bio_iovec_idx(bio, idx)->bv_len,
+                                (control & DMASCR_TRANSFER_READ) ?
                                PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
                if (control & DMASCR_HARD_ERROR) {
                        /* error */
@@ -501,9 +480,10 @@ static void process_page(unsigned long data)
                                le32_to_cpu(desc->transfer_size));
                        dump_dmastat(card, control);
                } else if (test_bit(BIO_RW, &bio->bi_rw) &&
-                          le32_to_cpu(desc->local_addr)>>9 == card->init_size) {
-                       card->init_size += le32_to_cpu(desc->transfer_size)>>9;
-                       if (card->init_size>>1 >= card->mm_size) {
+                          le32_to_cpu(desc->local_addr) >> 9 ==
+                               card->init_size) {
+                       card->init_size += le32_to_cpu(desc->transfer_size) >> 9;
+                       if (card->init_size >> 1 >= card->mm_size) {
                                dev_printk(KERN_INFO, &card->dev->dev,
                                        "memory now initialised\n");
                                set_userbit(card, MEMORY_INITIALIZED, 1);
@@ -514,7 +494,8 @@ static void process_page(unsigned long data)
                        return_bio = bio;
                }
 
-               if (last) break;
+               if (last)
+                       break;
        }
 
        if (debug & DEBUG_LED_ON_TRANSFER)
@@ -536,7 +517,7 @@ static void process_page(unsigned long data)
  out_unlock:
        spin_unlock_bh(&card->lock);
 
-       while(return_bio) {
+       while (return_bio) {
                struct bio *bio = return_bio;
 
                return_bio = bio->bi_next;
@@ -545,11 +526,6 @@ static void process_page(unsigned long data)
        }
 }
 
-/*
------------------------------------------------------------------------------------
---                              mm_make_request
------------------------------------------------------------------------------------
-*/
 static int mm_make_request(struct request_queue *q, struct bio *bio)
 {
        struct cardinfo *card = q->queuedata;
@@ -566,11 +542,6 @@ static int mm_make_request(struct request_queue *q, struct bio *bio)
        return 0;
 }
 
-/*
------------------------------------------------------------------------------------
---                              mm_interrupt
------------------------------------------------------------------------------------
-*/
 static irqreturn_t mm_interrupt(int irq, void *__card)
 {
        struct cardinfo *card = (struct cardinfo *) __card;
@@ -584,15 +555,15 @@ HW_TRACE(0x30);
        if (!(dma_status & (DMASCR_ERROR_MASK | DMASCR_CHAIN_COMPLETE))) {
                /* interrupt wasn't for me ... */
                return IRQ_NONE;
-        }
+       }
 
        /* clear COMPLETION interrupts */
        if (card->flags & UM_FLAG_NO_BYTE_STATUS)
                writel(cpu_to_le32(DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE),
-                      card->csr_remap+ DMA_STATUS_CTRL);
+                      card->csr_remap + DMA_STATUS_CTRL);
        else
                writeb((DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE) >> 16,
-                      card->csr_remap+ DMA_STATUS_CTRL + 2);
+                      card->csr_remap + DMA_STATUS_CTRL + 2);
 
        /* log errors and clear interrupt status */
        if (dma_status & DMASCR_ANY_ERR) {
@@ -602,9 +573,12 @@ HW_TRACE(0x30);
 
                stat = readb(card->csr_remap + MEMCTRLCMD_ERRSTATUS);
 
-               data_log1 = le32_to_cpu(readl(card->csr_remap + ERROR_DATA_LOG));
-               data_log2 = le32_to_cpu(readl(card->csr_remap + ERROR_DATA_LOG + 4));
-               addr_log1 = le32_to_cpu(readl(card->csr_remap + ERROR_ADDR_LOG));
+               data_log1 = le32_to_cpu(readl(card->csr_remap +
+                                               ERROR_DATA_LOG));
+               data_log2 = le32_to_cpu(readl(card->csr_remap +
+                                               ERROR_DATA_LOG + 4));
+               addr_log1 = le32_to_cpu(readl(card->csr_remap +
+                                               ERROR_ADDR_LOG));
                addr_log2 = readb(card->csr_remap + ERROR_ADDR_LOG + 4);
 
                count = readb(card->csr_remap + ERROR_COUNT);
@@ -671,11 +645,7 @@ HW_TRACE(0x36);
 
        return IRQ_HANDLED;
 }
-/*
------------------------------------------------------------------------------------
---                         set_fault_to_battery_status
------------------------------------------------------------------------------------
-*/
+
 /*
  * If both batteries are good, no LED
  * If either battery has been warned, solid LED
@@ -696,12 +666,6 @@ static void set_fault_to_battery_status(struct cardinfo *card)
 
 static void init_battery_timer(void);
 
-
-/*
------------------------------------------------------------------------------------
---                            check_battery
------------------------------------------------------------------------------------
-*/
 static int check_battery(struct cardinfo *card, int battery, int status)
 {
        if (status != card->battery[battery].good) {
@@ -730,11 +694,7 @@ static int check_battery(struct cardinfo *card, int battery, int status)
 
        return 0;
 }
-/*
------------------------------------------------------------------------------------
---                              check_batteries
------------------------------------------------------------------------------------
-*/
+
 static void check_batteries(struct cardinfo *card)
 {
        /* NOTE: this must *never* be called while the card
@@ -775,11 +735,7 @@ static void check_all_batteries(unsigned long ptr)
 
        init_battery_timer();
 }
-/*
------------------------------------------------------------------------------------
---                            init_battery_timer
------------------------------------------------------------------------------------
-*/
+
 static void init_battery_timer(void)
 {
        init_timer(&battery_timer);
@@ -787,20 +743,12 @@ static void init_battery_timer(void)
        battery_timer.expires = jiffies + (HZ * 60);
        add_timer(&battery_timer);
 }
-/*
------------------------------------------------------------------------------------
---                              del_battery_timer
------------------------------------------------------------------------------------
-*/
+
 static void del_battery_timer(void)
 {
        del_timer(&battery_timer);
 }
-/*
------------------------------------------------------------------------------------
---                                mm_revalidate
------------------------------------------------------------------------------------
-*/
+
 /*
  * Note no locks taken out here.  In a worst case scenario, we could drop
  * a chunk of system memory.  But that should never happen, since validation
@@ -833,33 +781,23 @@ static int mm_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 }
 
 /*
------------------------------------------------------------------------------------
---                                mm_check_change
------------------------------------------------------------------------------------
-  Future support for removable devices
-*/
+ * Future support for removable devices
+ */
 static int mm_check_change(struct gendisk *disk)
 {
 /*  struct cardinfo *dev = disk->private_data; */
        return 0;
 }
-/*
------------------------------------------------------------------------------------
---                             mm_fops
------------------------------------------------------------------------------------
-*/
+
 static struct block_device_operations mm_fops = {
        .owner          = THIS_MODULE,
        .getgeo         = mm_getgeo,
-       .revalidate_disk= mm_revalidate,
+       .revalidate_disk = mm_revalidate,
        .media_changed  = mm_check_change,
 };
-/*
------------------------------------------------------------------------------------
---                                mm_pci_probe
------------------------------------------------------------------------------------
-*/
-static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
+
+static int __devinit mm_pci_probe(struct pci_dev *dev,
+                               const struct pci_device_id *id)
 {
        int ret = -ENODEV;
        struct cardinfo *card = &cards[num_cards];
@@ -889,7 +827,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
                return -ENODEV;
 
        dev_printk(KERN_INFO, &dev->dev,
-               "Micro Memory(tm) controller found (PCI Mem Module (Battery Backup))\n");
+         "Micro Memory(tm) controller found (PCI Mem Module (Battery Backup))\n");
 
        if (pci_set_dma_mask(dev, DMA_64BIT_MASK) &&
            pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
@@ -917,7 +855,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
                "CSR 0x%08lx -> 0x%p (0x%lx)\n",
               csr_base, card->csr_remap, csr_len);
 
-       switch(card->dev->device) {
+       switch (card->dev->device) {
        case 0x5415:
                card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG;
                magic_number = 0x59;
@@ -929,7 +867,8 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
                break;
 
        case 0x6155:
-               card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG | UM_FLAG_NO_BATT;
+               card->flags |= UM_FLAG_NO_BYTE_STATUS |
+                               UM_FLAG_NO_BATTREG | UM_FLAG_NO_BATT;
                magic_number = 0x99;
                break;
 
@@ -945,11 +884,11 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
        }
 
        card->mm_pages[0].desc = pci_alloc_consistent(card->dev,
-                                                     PAGE_SIZE*2,
-                                                     &card->mm_pages[0].page_dma);
+                                               PAGE_SIZE * 2,
+                                               &card->mm_pages[0].page_dma);
        card->mm_pages[1].desc = pci_alloc_consistent(card->dev,
-                                                     PAGE_SIZE*2,
-                                                     &card->mm_pages[1].page_dma);
+                                               PAGE_SIZE * 2,
+                                               &card->mm_pages[1].page_dma);
        if (card->mm_pages[0].desc == NULL ||
            card->mm_pages[1].desc == NULL) {
                dev_printk(KERN_ERR, &card->dev->dev, "alloc failed\n");
@@ -1013,9 +952,9 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
                dev_printk(KERN_INFO, &card->dev->dev,
                        "Size %d KB, Battery 1 %s (%s), Battery 2 %s (%s)\n",
                       card->mm_size,
-                      (batt_status & BATTERY_1_DISABLED ? "Disabled" : "Enabled"),
+                      batt_status & BATTERY_1_DISABLED ? "Disabled" : "Enabled",
                       card->battery[0].good ? "OK" : "FAILURE",
-                      (batt_status & BATTERY_2_DISABLED ? "Disabled" : "Enabled"),
+                      batt_status & BATTERY_2_DISABLED ? "Disabled" : "Enabled",
                       card->battery[1].good ? "OK" : "FAILURE");
 
                set_fault_to_battery_status(card);
@@ -1030,18 +969,18 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
        data = ~data;
        data += 1;
 
-       if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, DRIVER_NAME, card)) {
+       if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, DRIVER_NAME,
+                       card)) {
                dev_printk(KERN_ERR, &card->dev->dev,
                        "Unable to allocate IRQ\n");
                ret = -ENODEV;
-
                goto failed_req_irq;
        }
 
        dev_printk(KERN_INFO, &card->dev->dev,
                "Window size %d bytes, IRQ %d\n", data, dev->irq);
 
-        spin_lock_init(&card->lock);
+       spin_lock_init(&card->lock);
 
        pci_set_drvdata(dev, card);
 
@@ -1060,7 +999,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
 
        if (!get_userbit(card, MEMORY_INITIALIZED)) {
                dev_printk(KERN_INFO, &card->dev->dev,
-                       "memory NOT initialized. Consider over-writing whole device.\n");
+                 "memory NOT initialized. Consider over-writing whole device.\n");
                card->init_size = 0;
        } else {
                dev_printk(KERN_INFO, &card->dev->dev,
@@ -1091,11 +1030,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
 
        return ret;
 }
-/*
------------------------------------------------------------------------------------
---                              mm_pci_remove
------------------------------------------------------------------------------------
-*/
+
 static void mm_pci_remove(struct pci_dev *dev)
 {
        struct cardinfo *card = pci_get_drvdata(dev);
@@ -1119,16 +1054,16 @@ static void mm_pci_remove(struct pci_dev *dev)
 }
 
 static const struct pci_device_id mm_pci_ids[] = {
-    {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_5415CN)},
-    {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_5425CN)},
-    {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_6155)},
+    {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_5415CN)},
+    {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_5425CN)},
+    {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_6155)},
     {
        .vendor =       0x8086,
        .device =       0xB555,
-       .subvendor    0x1332,
-       .subdevice    0x5460,
-       .class  =       0x050000,
-       .class_mask   0,
+       .subvendor =    0x1332,
+       .subdevice =    0x5460,
+       .class        0x050000,
+       .class_mask =   0,
     }, { /* end: all zeroes */ }
 };
 
@@ -1141,12 +1076,6 @@ static struct pci_driver mm_pci_driver = {
        .remove         = mm_pci_remove,
 };
 
-/*
------------------------------------------------------------------------------------
---                               mm_init
------------------------------------------------------------------------------------
-*/
-
 static int __init mm_init(void)
 {
        int retval, i;
@@ -1193,18 +1122,14 @@ out:
                put_disk(mm_gendisk[i]);
        return -ENOMEM;
 }
-/*
------------------------------------------------------------------------------------
---                             mm_cleanup
------------------------------------------------------------------------------------
-*/
+
 static void __exit mm_cleanup(void)
 {
        int i;
 
        del_battery_timer();
 
-       for (i=0; i < num_cards ; i++) {
+       for (i = 0; i < num_cards ; i++) {
                del_gendisk(mm_gendisk[i]);
                put_disk(mm_gendisk[i]);
        }
index 39564b76d4a36670e501f5f8e24fa1632f625982..c88424a0c89b60d28d3805895e6ee973710b7d8c 100644 (file)
@@ -1046,12 +1046,6 @@ void tpm_remove_hardware(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(tpm_remove_hardware);
 
-static u8 savestate[] = {
-       0, 193,                 /* TPM_TAG_RQU_COMMAND */
-       0, 0, 0, 10,            /* blob length (in bytes) */
-       0, 0, 0, 152            /* TPM_ORD_SaveState */
-};
-
 /*
  * We are about to suspend. Save the TPM state
  * so that it can be restored.
@@ -1059,6 +1053,12 @@ static u8 savestate[] = {
 int tpm_pm_suspend(struct device *dev, pm_message_t pm_state)
 {
        struct tpm_chip *chip = dev_get_drvdata(dev);
+       u8 savestate[] = {
+               0, 193,         /* TPM_TAG_RQU_COMMAND */
+               0, 0, 0, 10,    /* blob length (in bytes) */
+               0, 0, 0, 152    /* TPM_ORD_SaveState */
+       };
+
        if (chip == NULL)
                return -ENODEV;
 
index 1bdd2bf4f37d74808bd60bcce01e67a2c6d57f5d..d4b6d64e858b5e4ec18255a992ce0e57a0cbd92b 100644 (file)
@@ -62,7 +62,7 @@ void tty_wait_until_sent(struct tty_struct * tty, long timeout)
        if (!timeout)
                timeout = MAX_SCHEDULE_TIMEOUT;
        if (wait_event_interruptible_timeout(tty->write_wait,
-                       !tty->driver->chars_in_buffer(tty), timeout))
+                       !tty->driver->chars_in_buffer(tty), timeout) < 0)
                return;
        if (tty->driver->wait_until_sent)
                tty->driver->wait_until_sent(tty, timeout);
@@ -364,6 +364,25 @@ void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old)
 
 EXPORT_SYMBOL(tty_termios_copy_hw);
 
+/**
+ *     tty_termios_hw_change   -       check for setting change
+ *     @a: termios
+ *     @b: termios to compare
+ *
+ *     Check if any of the bits that affect a dumb device have changed
+ *     between the two termios structures, or a speed change is needed.
+ */
+
+int tty_termios_hw_change(struct ktermios *a, struct ktermios *b)
+{
+       if (a->c_ispeed != b->c_ispeed || a->c_ospeed != b->c_ospeed)
+               return 1;
+       if ((a->c_cflag ^ b->c_cflag) & ~(HUPCL | CREAD | CLOCAL))
+               return 1;
+       return 0;
+}
+EXPORT_SYMBOL(tty_termios_hw_change);
+
 /**
  *     change_termios          -       update termios values
  *     @tty: tty to update
index 296f51002b555a4398d0450f92d1c1392d61d70a..12ceed54ab18001f89b2e587106fa8fa7b20de82 100644 (file)
@@ -99,8 +99,8 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id
        spin_unlock_bh(&dev->queue_lock);
 
        if (found) {
-               atomic_dec(&dev->refcnt);
                cn_queue_free_callback(cbq);
+               atomic_dec(&dev->refcnt);
                return -EINVAL;
        }
 
index 6883fcb79ad35d27cd3eb5d65d2f6eaab82ded4c..bf9716b75513d957a79e8836d8a127295d86f4d4 100644 (file)
@@ -145,6 +145,8 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
                                if (queue_work(dev->cbdev->cn_queue,
                                                        &__cbq->work))
                                        err = 0;
+                               else
+                                       err = -EINVAL;
                        } else {
                                struct cn_callback_data *d;
                                
index 5e626b12b97eb758b12a652d4fd8e5967ee76307..79581fab82d69464a77cf6c51363cec85fede91f 100644 (file)
@@ -841,19 +841,25 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
        drv_attr = cpufreq_driver->attr;
        while ((drv_attr) && (*drv_attr)) {
                ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
-               if (ret)
+               if (ret) {
+                       unlock_policy_rwsem_write(cpu);
                        goto err_out_driver_exit;
+               }
                drv_attr++;
        }
        if (cpufreq_driver->get){
                ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);
-               if (ret)
+               if (ret) {
+                       unlock_policy_rwsem_write(cpu);
                        goto err_out_driver_exit;
+               }
        }
        if (cpufreq_driver->target){
                ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
-               if (ret)
+               if (ret) {
+                       unlock_policy_rwsem_write(cpu);
                        goto err_out_driver_exit;
+               }
        }
 
        spin_lock_irqsave(&cpufreq_driver_lock, flags);
index 8a45d0f93e262716690a070c017883b4910da88d..1b8312b0200675e81722def6d6b51134594e1250 100644 (file)
@@ -164,7 +164,7 @@ freq_table_get_index(struct cpufreq_stats *stat, unsigned int freq)
        return -1;
 }
 
-static void __cpuexit cpufreq_stats_free_table(unsigned int cpu)
+static void cpufreq_stats_free_table(unsigned int cpu)
 {
        struct cpufreq_stats *stat = cpufreq_stats_table[cpu];
        struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
index abbcff0762b1d1f4bb7b77ff34f5d1c728f2aabc..5f7e7181048931dfb23192d7af582d85a071aba6 100644 (file)
@@ -419,13 +419,58 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
 /* ====== Encryption/decryption routines ====== */
 
 /* These are the real call to PadLock. */
+static inline void padlock_xcrypt(const u8 *input, u8 *output, void *key,
+                                 void *control_word)
+{
+       asm volatile (".byte 0xf3,0x0f,0xa7,0xc8"       /* rep xcryptecb */
+                     : "+S"(input), "+D"(output)
+                     : "d"(control_word), "b"(key), "c"(1));
+}
+
+static void aes_crypt_copy(const u8 *in, u8 *out, u32 *key, struct cword *cword)
+{
+       u8 buf[AES_BLOCK_SIZE * 2 + PADLOCK_ALIGNMENT - 1];
+       u8 *tmp = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT);
+
+       memcpy(tmp, in, AES_BLOCK_SIZE);
+       padlock_xcrypt(tmp, out, key, cword);
+}
+
+static inline void aes_crypt(const u8 *in, u8 *out, u32 *key,
+                            struct cword *cword)
+{
+       asm volatile ("pushfl; popfl");
+
+       /* padlock_xcrypt requires at least two blocks of data. */
+       if (unlikely(!(((unsigned long)in ^ (PAGE_SIZE - AES_BLOCK_SIZE)) &
+                      (PAGE_SIZE - 1)))) {
+               aes_crypt_copy(in, out, key, cword);
+               return;
+       }
+
+       padlock_xcrypt(in, out, key, cword);
+}
+
 static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key,
                                      void *control_word, u32 count)
 {
+       if (count == 1) {
+               aes_crypt(input, output, key, control_word);
+               return;
+       }
+
        asm volatile ("pushfl; popfl");         /* enforce key reload. */
-       asm volatile (".byte 0xf3,0x0f,0xa7,0xc8"       /* rep xcryptecb */
+       asm volatile ("test $1, %%cl;"
+                     "je 1f;"
+                     "lea -1(%%ecx), %%eax;"
+                     "mov $1, %%ecx;"
+                     ".byte 0xf3,0x0f,0xa7,0xc8;"      /* rep xcryptecb */
+                     "mov %%eax, %%ecx;"
+                     "1:"
+                     ".byte 0xf3,0x0f,0xa7,0xc8"       /* rep xcryptecb */
                      : "+S"(input), "+D"(output)
-                     : "d"(control_word), "b"(key), "c"(count));
+                     : "d"(control_word), "b"(key), "c"(count)
+                     : "ax");
 }
 
 static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
@@ -443,13 +488,13 @@ static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
 static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
 {
        struct aes_ctx *ctx = aes_ctx(tfm);
-       padlock_xcrypt_ecb(in, out, ctx->E, &ctx->cword.encrypt, 1);
+       aes_crypt(in, out, ctx->E, &ctx->cword.encrypt);
 }
 
 static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
 {
        struct aes_ctx *ctx = aes_ctx(tfm);
-       padlock_xcrypt_ecb(in, out, ctx->D, &ctx->cword.decrypt, 1);
+       aes_crypt(in, out, ctx->D, &ctx->cword.decrypt);
 }
 
 static struct crypto_alg aes_alg = {
index c1c2dcc6fc2eea413ed8367a4e839b93a7f2362e..45e7b4666c7b3c5197eeaa0c256dcf76860a2161 100644 (file)
@@ -173,10 +173,47 @@ static void ioat_set_dest(dma_addr_t addr,
        tx_to_ioat_desc(tx)->dst = addr;
 }
 
+/**
+ * ioat_dma_memcpy_issue_pending - push potentially unrecognized appended
+ *                                 descriptors to hw
+ * @chan: DMA channel handle
+ */
 static inline void __ioat1_dma_memcpy_issue_pending(
-                                              struct ioat_dma_chan *ioat_chan);
+                                               struct ioat_dma_chan *ioat_chan)
+{
+       ioat_chan->pending = 0;
+       writeb(IOAT_CHANCMD_APPEND, ioat_chan->reg_base + IOAT1_CHANCMD_OFFSET);
+}
+
+static void ioat1_dma_memcpy_issue_pending(struct dma_chan *chan)
+{
+       struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
+
+       if (ioat_chan->pending != 0) {
+               spin_lock_bh(&ioat_chan->desc_lock);
+               __ioat1_dma_memcpy_issue_pending(ioat_chan);
+               spin_unlock_bh(&ioat_chan->desc_lock);
+       }
+}
+
 static inline void __ioat2_dma_memcpy_issue_pending(
-                                              struct ioat_dma_chan *ioat_chan);
+                                               struct ioat_dma_chan *ioat_chan)
+{
+       ioat_chan->pending = 0;
+       writew(ioat_chan->dmacount,
+              ioat_chan->reg_base + IOAT_CHAN_DMACOUNT_OFFSET);
+}
+
+static void ioat2_dma_memcpy_issue_pending(struct dma_chan *chan)
+{
+       struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
+
+       if (ioat_chan->pending != 0) {
+               spin_lock_bh(&ioat_chan->desc_lock);
+               __ioat2_dma_memcpy_issue_pending(ioat_chan);
+               spin_unlock_bh(&ioat_chan->desc_lock);
+       }
+}
 
 static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx)
 {
@@ -203,7 +240,7 @@ static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx)
        prev = to_ioat_desc(ioat_chan->used_desc.prev);
        prefetch(prev->hw);
        do {
-               copy = min((u32) len, ioat_chan->xfercap);
+               copy = min_t(size_t, len, ioat_chan->xfercap);
 
                new->async_tx.ack = 1;
 
@@ -291,10 +328,12 @@ static dma_cookie_t ioat2_tx_submit(struct dma_async_tx_descriptor *tx)
        orig_ack = first->async_tx.ack;
        new = first;
 
-       /* ioat_chan->desc_lock is still in force in version 2 path */
-
+       /*
+        * ioat_chan->desc_lock is still in force in version 2 path
+        * it gets unlocked at end of this function
+        */
        do {
-               copy = min((u32) len, ioat_chan->xfercap);
+               copy = min_t(size_t, len, ioat_chan->xfercap);
 
                new->async_tx.ack = 1;
 
@@ -432,7 +471,7 @@ static void ioat2_dma_massage_chan_desc(struct ioat_dma_chan *ioat_chan)
 static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
 {
        struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
-       struct ioat_desc_sw *desc = NULL;
+       struct ioat_desc_sw *desc;
        u16 chanctrl;
        u32 chanerr;
        int i;
@@ -575,7 +614,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
 static struct ioat_desc_sw *
 ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
 {
-       struct ioat_desc_sw *new = NULL;
+       struct ioat_desc_sw *new;
 
        if (!list_empty(&ioat_chan->free_desc)) {
                new = to_ioat_desc(ioat_chan->free_desc.next);
@@ -583,9 +622,11 @@ ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
        } else {
                /* try to get another desc */
                new = ioat_dma_alloc_descriptor(ioat_chan, GFP_ATOMIC);
-               /* will this ever happen? */
-               /* TODO add upper limit on these */
-               BUG_ON(!new);
+               if (!new) {
+                       dev_err(&ioat_chan->device->pdev->dev,
+                               "alloc failed\n");
+                       return NULL;
+               }
        }
 
        prefetch(new->hw);
@@ -595,7 +636,7 @@ ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
 static struct ioat_desc_sw *
 ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
 {
-       struct ioat_desc_sw *new = NULL;
+       struct ioat_desc_sw *new;
 
        /*
         * used.prev points to where to start processing
@@ -609,8 +650,8 @@ ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
        if (ioat_chan->used_desc.prev &&
            ioat_chan->used_desc.next == ioat_chan->used_desc.prev->prev) {
 
-               struct ioat_desc_sw *desc = NULL;
-               struct ioat_desc_sw *noop_desc = NULL;
+               struct ioat_desc_sw *desc;
+               struct ioat_desc_sw *noop_desc;
                int i;
 
                /* set up the noop descriptor */
@@ -624,10 +665,14 @@ ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
                ioat_chan->pending++;
                ioat_chan->dmacount++;
 
-               /* get a few more descriptors */
+               /* try to get a few more descriptors */
                for (i = 16; i; i--) {
                        desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_ATOMIC);
-                       BUG_ON(!desc);
+                       if (!desc) {
+                               dev_err(&ioat_chan->device->pdev->dev,
+                                       "alloc failed\n");
+                               break;
+                       }
                        list_add_tail(&desc->node, ioat_chan->used_desc.next);
 
                        desc->hw->next
@@ -677,10 +722,13 @@ static struct dma_async_tx_descriptor *ioat1_dma_prep_memcpy(
 
        spin_lock_bh(&ioat_chan->desc_lock);
        new = ioat_dma_get_next_descriptor(ioat_chan);
-       new->len = len;
        spin_unlock_bh(&ioat_chan->desc_lock);
 
-       return new ? &new->async_tx : NULL;
+       if (new) {
+               new->len = len;
+               return &new->async_tx;
+       } else
+               return NULL;
 }
 
 static struct dma_async_tx_descriptor *ioat2_dma_prep_memcpy(
@@ -693,53 +741,17 @@ static struct dma_async_tx_descriptor *ioat2_dma_prep_memcpy(
 
        spin_lock_bh(&ioat_chan->desc_lock);
        new = ioat2_dma_get_next_descriptor(ioat_chan);
-       new->len = len;
-
-       /* leave ioat_chan->desc_lock set in version 2 path */
-       return new ? &new->async_tx : NULL;
-}
 
+       /*
+        * leave ioat_chan->desc_lock set in ioat 2 path
+        * it will get unlocked at end of tx_submit
+        */
 
-/**
- * ioat_dma_memcpy_issue_pending - push potentially unrecognized appended
- *                                 descriptors to hw
- * @chan: DMA channel handle
- */
-static inline void __ioat1_dma_memcpy_issue_pending(
-                                               struct ioat_dma_chan *ioat_chan)
-{
-       ioat_chan->pending = 0;
-       writeb(IOAT_CHANCMD_APPEND, ioat_chan->reg_base + IOAT1_CHANCMD_OFFSET);
-}
-
-static void ioat1_dma_memcpy_issue_pending(struct dma_chan *chan)
-{
-       struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
-
-       if (ioat_chan->pending != 0) {
-               spin_lock_bh(&ioat_chan->desc_lock);
-               __ioat1_dma_memcpy_issue_pending(ioat_chan);
-               spin_unlock_bh(&ioat_chan->desc_lock);
-       }
-}
-
-static inline void __ioat2_dma_memcpy_issue_pending(
-                                               struct ioat_dma_chan *ioat_chan)
-{
-       ioat_chan->pending = 0;
-       writew(ioat_chan->dmacount,
-              ioat_chan->reg_base + IOAT_CHAN_DMACOUNT_OFFSET);
-}
-
-static void ioat2_dma_memcpy_issue_pending(struct dma_chan *chan)
-{
-       struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
-
-       if (ioat_chan->pending != 0) {
-               spin_lock_bh(&ioat_chan->desc_lock);
-               __ioat2_dma_memcpy_issue_pending(ioat_chan);
-               spin_unlock_bh(&ioat_chan->desc_lock);
-       }
+       if (new) {
+               new->len = len;
+               return &new->async_tx;
+       } else
+               return NULL;
 }
 
 static void ioat_dma_cleanup_tasklet(unsigned long data)
@@ -1019,7 +1031,7 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
 static void ioat_dma_test_callback(void *dma_async_param)
 {
        printk(KERN_ERR "ioatdma: ioat_dma_test_callback(%p)\n",
-                       dma_async_param);
+               dma_async_param);
 }
 
 /**
@@ -1032,7 +1044,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
        u8 *src;
        u8 *dest;
        struct dma_chan *dma_chan;
-       struct dma_async_tx_descriptor *tx = NULL;
+       struct dma_async_tx_descriptor *tx;
        dma_addr_t addr;
        dma_cookie_t cookie;
        int err = 0;
@@ -1351,7 +1363,7 @@ err_completion_pool:
 err_dma_pool:
        kfree(device);
 err_kzalloc:
-       dev_err(&device->pdev->dev,
+       dev_err(&pdev->dev,
                "Intel(R) I/OAT DMA Engine initialization failed\n");
        return NULL;
 }
index b668234ef654b2590e88d752c4cf83d53a4d2585..f2c7fedbf009b545c72e13fe69cfae54117ed4b9 100644 (file)
@@ -76,7 +76,7 @@ struct ioat_dma_chan {
        dma_cookie_t completed_cookie;
        unsigned long last_completion;
 
-       u32 xfercap;    /* XFERCAP register value expanded out */
+       size_t xfercap; /* XFERCAP register value expanded out */
 
        spinlock_t cleanup_lock;
        spinlock_t desc_lock;
index b6e1eb77d14847c0f7d25f836c76bcfe6e76c554..bc132d8f79cb29922e2df5a6532777010cb14dc6 100644 (file)
@@ -175,12 +175,11 @@ static struct device *dmi_dev;
 
 extern int dmi_available;
 
-static int __init dmi_id_init(void)
+/* In a separate function to keep gcc 3.2 happy - do NOT merge this in
+   dmi_id_init! */
+static void __init dmi_id_init_attr_table(void)
 {
-       int ret, i;
-
-       if (!dmi_available)
-               return -ENODEV;
+       int i;
 
        /* Not necessarily all DMI fields are available on all
         * systems, hence let's built an attribute table of just
@@ -205,6 +204,16 @@ static int __init dmi_id_init(void)
        ADD_DMI_ATTR(chassis_serial,    DMI_CHASSIS_SERIAL);
        ADD_DMI_ATTR(chassis_asset_tag, DMI_CHASSIS_ASSET_TAG);
        sys_dmi_attributes[i++] = &sys_dmi_modalias_attr.attr;
+}
+
+static int __init dmi_id_init(void)
+{
+       int ret;
+
+       if (!dmi_available)
+               return -ENODEV;
+
+       dmi_id_init_attr_table();
 
        ret = class_register(&dmi_class);
        if (ret)
index b15c6a998b7271aeb0f45ce21fa21be75be2cf2f..d5aa25ce5dbdc8251d05d384391c418070f80d9b 100644 (file)
@@ -1276,23 +1276,31 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
 
        data->vrm = vid_which_vrm();
        superio_enter(sio_data->sioreg);
-       /* Set VID input sensibility if needed. In theory the BIOS should
-          have set it, but in practice it's not always the case. */
-       en_vrm10 = superio_inb(sio_data->sioreg, SIO_REG_EN_VRM10);
-       if ((en_vrm10 & 0x08) && data->vrm != 100) {
-               dev_warn(dev, "Setting VID input voltage to TTL\n");
-               superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10,
-                            en_vrm10 & ~0x08);
-       } else if (!(en_vrm10 & 0x08) && data->vrm == 100) {
-               dev_warn(dev, "Setting VID input voltage to VRM10\n");
-               superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10,
-                            en_vrm10 | 0x08);
-       }
        /* Read VID value */
        superio_select(sio_data->sioreg, W83627EHF_LD_HWM);
-       if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80)
+       if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) {
+               /* Set VID input sensibility if needed. In theory the BIOS
+                  should have set it, but in practice it's not always the
+                  case. We only do it for the W83627EHF/EHG because the
+                  W83627DHG is more complex in this respect. */
+               if (sio_data->kind == w83627ehf) {
+                       en_vrm10 = superio_inb(sio_data->sioreg,
+                                              SIO_REG_EN_VRM10);
+                       if ((en_vrm10 & 0x08) && data->vrm == 90) {
+                               dev_warn(dev, "Setting VID input voltage to "
+                                        "TTL\n");
+                               superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10,
+                                            en_vrm10 & ~0x08);
+                       } else if (!(en_vrm10 & 0x08) && data->vrm == 100) {
+                               dev_warn(dev, "Setting VID input voltage to "
+                                        "VRM10\n");
+                               superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10,
+                                            en_vrm10 | 0x08);
+                       }
+               }
+
                data->vid = superio_inb(sio_data->sioreg, SIO_REG_VID_DATA) & 0x3f;
-       else {
+       else {
                dev_info(dev, "VID pins in output mode, CPU VID not "
                         "available\n");
                data->vid = 0x3f;
index 9c8b6d5eaec9ef301fe1491d6bf8ce714bfc3c8c..c09b036913bd9588f9789f982b884b319cff5890 100644 (file)
@@ -135,7 +135,7 @@ static int xfer_write(struct i2c_adapter *adap, unsigned char *buf, int length)
  * Generic i2c master transfer entrypoint.
  *
  * Note: We do not use Atmel's feature of storing the "internal device address".
- * Instead the "internal device address" has to be written using a seperate
+ * Instead the "internal device address" has to be written using a separate
  * i2c message.
  * http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html
  */
index 0ab4f2627c26c58c3eb53fb593da0fffe7f03bff..7813127649a101e2977fa42544d7b2d6e50503e9 100644 (file)
@@ -94,7 +94,7 @@ static s32 i2c_powermac_smbus_xfer(   struct i2c_adapter*     adap,
                break;
 
        /* Note that these are broken vs. the expected smbus API where
-        * on reads, the lenght is actually returned from the function,
+        * on reads, the length is actually returned from the function,
         * but I think the current API makes no sense and I don't want
         * any driver that I haven't verified for correctness to go
         * anywhere near a pmac i2c bus anyway ...
index 0ca599d3b4029851ddf022bab424759824060ec2..503a134ec803c13edd0cd43dd71432179216f60a 100644 (file)
@@ -200,11 +200,14 @@ static struct i2c_adapter sibyte_board_adapter[2] = {
 
 static int __init i2c_sibyte_init(void)
 {
-       printk("i2c-swarm.o: i2c SMBus adapter module for SiByte board\n");
+       pr_info("i2c-sibyte: i2c SMBus adapter module for SiByte board\n");
        if (i2c_sibyte_add_bus(&sibyte_board_adapter[0], K_SMB_FREQ_100KHZ) < 0)
                return -ENODEV;
-       if (i2c_sibyte_add_bus(&sibyte_board_adapter[1], K_SMB_FREQ_400KHZ) < 0)
+       if (i2c_sibyte_add_bus(&sibyte_board_adapter[1],
+                              K_SMB_FREQ_400KHZ) < 0) {
+               i2c_del_adapter(&sibyte_board_adapter[0]);
                return -ENODEV;
+       }
        return 0;
 }
 
index c21ae20ae362b059a2c347238f0e063616e0411e..df540d5dfaf42db7f249c30491c59679265353da 100644 (file)
@@ -184,7 +184,7 @@ static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t c
 
 /* This address checking function differs from the one in i2c-core
    in that it considers an address with a registered device, but no
-   bounded driver, as NOT busy. */
+   bound driver, as NOT busy. */
 static int i2cdev_check_addr(struct i2c_adapter *adapter, unsigned int addr)
 {
        struct list_head *item;
index 89df48fdc69d7b6109098153813524862fe4bff1..899d56536e80dccdded8eceb67a4d05cecb3f7d2 100644 (file)
@@ -16,6 +16,7 @@
 #include <acpi/acpi.h>
 #include <linux/ide.h>
 #include <linux/pci.h>
+#include <linux/dmi.h>
 
 #include <acpi/acpi_bus.h>
 #include <acpi/acnames.h>
@@ -65,6 +66,39 @@ extern int ide_noacpi;
 extern int ide_noacpitfs;
 extern int ide_noacpionboot;
 
+static bool ide_noacpi_psx;
+static int no_acpi_psx(const struct dmi_system_id *id)
+{
+       ide_noacpi_psx = true;
+       printk(KERN_NOTICE"%s detected - disable ACPI _PSx.\n", id->ident);
+       return 0;
+}
+
+static const struct dmi_system_id ide_acpi_dmi_table[] = {
+       /* Bug 9673. */
+       /* We should check if this is because ACPI NVS isn't save/restored. */
+       {
+               .callback = no_acpi_psx,
+               .ident    = "HP nx9005",
+               .matches  = {
+                       DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies Ltd."),
+                       DMI_MATCH(DMI_BIOS_VERSION, "KAM1.60")
+               },
+       },
+
+       { }     /* terminate list */
+};
+
+static int ide_acpi_blacklist(void)
+{
+       static int done;
+       if (done)
+               return 0;
+       done = 1;
+       dmi_check_system(ide_acpi_dmi_table);
+       return 0;
+}
+
 /**
  * ide_get_dev_handle - finds acpi_handle and PCI device.function
  * @dev: device to locate
@@ -623,7 +657,7 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on)
 {
        int unit;
 
-       if (ide_noacpi)
+       if (ide_noacpi || ide_noacpi_psx)
                return;
 
        DEBPRINT("ENTER:\n");
@@ -668,6 +702,8 @@ void ide_acpi_init(ide_hwif_t *hwif)
        struct ide_acpi_drive_link      *master;
        struct ide_acpi_drive_link      *slave;
 
+       ide_acpi_blacklist();
+
        hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL);
        if (!hwif->acpidata)
                return;
index 92ac658dac33458fba3b97f296df67556c7195e4..c7d77f0ad892d5ae82a1968e64d13b3374164dbd 100644 (file)
@@ -1068,8 +1068,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
                return 0;
        else if (ireason == 0) {
                /* Whoops... The drive is expecting to receive data from us! */
-               printk(KERN_ERR "%s: read_intr: Drive wants to transfer data the "
-                                               "wrong way!\n", drive->name);
+               printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
+                               drive->name, __FUNCTION__);
 
                /* Throw some data at the drive so it doesn't hang
                   and quit this request. */
@@ -1086,8 +1086,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
                return 0;
        } else {
                /* Drive wants a command packet, or invalid ireason... */
-               printk(KERN_ERR "%s: read_intr: bad interrupt reason %x\n", drive->name,
-                                                               ireason);
+               printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n",
+                               drive->name, __FUNCTION__, ireason);
        }
 
        cdrom_end_request(drive, 0);
@@ -1112,8 +1112,11 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
         */
        if (dma) {
                info->dma = 0;
-               if ((dma_error = HWIF(drive)->ide_dma_end(drive)))
+               dma_error = HWIF(drive)->ide_dma_end(drive);
+               if (dma_error) {
+                       printk(KERN_ERR "%s: DMA read error\n", drive->name);
                        ide_dma_off(drive);
+               }
        }
 
        if (cdrom_decode_status(drive, 0, &stat))
@@ -1443,7 +1446,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
                return ide_stopped;
 
        /* Read the interrupt reason and the transfer length. */
-       ireason = HWIF(drive)->INB(IDE_IREASON_REG);
+       ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3;
        lowcyl  = HWIF(drive)->INB(IDE_BCOUNTL_REG);
        highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG);
 
@@ -1484,7 +1487,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
        if (thislen > len) thislen = len;
 
        /* The drive wants to be written to. */
-       if ((ireason & 3) == 0) {
+       if (ireason == 0) {
                if (!rq->data) {
                        blk_dump_rq_flags(rq, "cdrom_pc_intr, write");
                        goto confused;
@@ -1506,9 +1509,9 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
        }
 
        /* Same drill for reading. */
-       else if ((ireason & 3) == 2) {
+       else if (ireason == 2) {
                if (!rq->data) {
-                       blk_dump_rq_flags(rq, "cdrom_pc_intr, write");
+                       blk_dump_rq_flags(rq, "cdrom_pc_intr, read");
                        goto confused;
                }
                /* Transfer the data. */
@@ -1632,8 +1635,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
                return 0;
        else if (ireason == 2) {
                /* Whoops... The drive wants to send data. */
-               printk(KERN_ERR "%s: write_intr: wrong transfer direction!\n",
-                                                       drive->name);
+               printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
+                               drive->name, __FUNCTION__);
 
                while (len > 0) {
                        int dum = 0;
@@ -1642,8 +1645,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
                }
        } else {
                /* Drive wants a command packet, or invalid ireason... */
-               printk(KERN_ERR "%s: write_intr: bad interrupt reason %x\n",
-                                                       drive->name, ireason);
+               printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n",
+                               drive->name, __FUNCTION__, ireason);
        }
 
        cdrom_end_request(drive, 0);
@@ -1805,8 +1808,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
        /* Check for errors. */
        if (dma) {
                info->dma = 0;
-               if ((dma_error = HWIF(drive)->ide_dma_end(drive))) {
-                       printk(KERN_ERR "ide-cd: write dma error\n");
+               dma_error = HWIF(drive)->ide_dma_end(drive);
+               if (dma_error) {
+                       printk(KERN_ERR "%s: DMA write error\n", drive->name);
                        ide_dma_off(drive);
                }
        }
@@ -1826,7 +1830,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
        }
 
        /* Read the interrupt reason and the transfer length. */
-       ireason = HWIF(drive)->INB(IDE_IREASON_REG);
+       ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3;
        lowcyl  = HWIF(drive)->INB(IDE_BCOUNTL_REG);
        highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG);
 
@@ -1839,8 +1843,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
                 */
                uptodate = 1;
                if (rq->current_nr_sectors > 0) {
-                       printk(KERN_ERR "%s: write_intr: data underrun (%d blocks)\n",
-                       drive->name, rq->current_nr_sectors);
+                       printk(KERN_ERR "%s: %s: data underrun (%d blocks)\n",
+                                       drive->name, __FUNCTION__,
+                                       rq->current_nr_sectors);
                        uptodate = 0;
                }
                cdrom_end_request(drive, uptodate);
@@ -1860,7 +1865,8 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
                int this_transfer;
 
                if (!rq->current_nr_sectors) {
-                       printk(KERN_ERR "ide-cd: write_intr: oops\n");
+                       printk(KERN_ERR "%s: %s: confused, missing data\n",
+                                       drive->name, __FUNCTION__);
                        break;
                }
 
@@ -2688,14 +2694,14 @@ void ide_cdrom_update_speed (ide_drive_t *drive, struct atapi_capabilities_page
        if (!drive->id->model[0] &&
            !strncmp(drive->id->fw_rev, "241N", 4)) {
                CDROM_STATE_FLAGS(drive)->current_speed  =
-                       (((unsigned int)cap->curspeed) + (176/2)) / 176;
+                       (le16_to_cpu(cap->curspeed) + (176/2)) / 176;
                CDROM_CONFIG_FLAGS(drive)->max_speed =
-                       (((unsigned int)cap->maxspeed) + (176/2)) / 176;
+                       (le16_to_cpu(cap->maxspeed) + (176/2)) / 176;
        } else {
                CDROM_STATE_FLAGS(drive)->current_speed  =
-                       (ntohs(cap->curspeed) + (176/2)) / 176;
+                       (be16_to_cpu(cap->curspeed) + (176/2)) / 176;
                CDROM_CONFIG_FLAGS(drive)->max_speed =
-                       (ntohs(cap->maxspeed) + (176/2)) / 176;
+                       (be16_to_cpu(cap->maxspeed) + (176/2)) / 176;
        }
 }
 
@@ -2909,6 +2915,9 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots)
        if (!CDROM_CONFIG_FLAGS(drive)->ram)
                devinfo->mask |= CDC_RAM;
 
+       if (CDROM_CONFIG_FLAGS(drive)->no_speed_select)
+               devinfo->mask |= CDC_SELECT_SPEED;
+
        devinfo->disk = info->disk;
        return register_cdrom(devinfo);
 }
@@ -3161,7 +3170,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
                CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1;
        /* the 3231 model does not support the SET_CD_SPEED command */
        else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231"))
-               cdi->mask |= CDC_SELECT_SPEED;
+               CDROM_CONFIG_FLAGS(drive)->no_speed_select = 1;
 
 #if ! STANDARD_ATAPI
        /* by default Sanyo 3 CD changer support is turned off and
@@ -3504,15 +3513,8 @@ static int ide_cd_probe(ide_drive_t *drive)
        g->driverfs_dev = &drive->gendev;
        g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE;
        if (ide_cdrom_setup(drive)) {
-               struct cdrom_device_info *devinfo = &info->devinfo;
                ide_proc_unregister_driver(drive, &ide_cdrom_driver);
-               kfree(info->buffer);
-               kfree(info->toc);
-               kfree(info->changer_info);
-               if (devinfo->handle == drive && unregister_cdrom(devinfo))
-                       printk (KERN_ERR "%s: ide_cdrom_cleanup failed to unregister device from the cdrom driver.\n", drive->name);
-               kfree(info);
-               drive->driver_data = NULL;
+               ide_cd_release(&info->kref);
                goto failed;
        }
 
index 228b29c5d2e4d0684d6f2490ed6aa7c5a6bfa098..1b302fe2724d3d451f24278c61ecbab901792a9c 100644 (file)
@@ -91,7 +91,8 @@ struct ide_cd_config_flags {
        __u8 close_tray         : 1; /* can close the tray */
        __u8 writing            : 1; /* pseudo write in progress */
        __u8 mo_drive           : 1; /* drive is an MO device */
-       __u8 reserved           : 2;
+       __u8 no_speed_select    : 1; /* SET_CD_SPEED command is unsupported. */
+       __u8 reserved           : 1;
        byte max_speed;              /* Max speed of the drive */
 };
 #define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags))
index cef405ddaf0e3191a2d0eadd3f63681284d9d31f..bb9693dabe4180b4a1d93031a2115e85f7e22ab2 100644 (file)
@@ -612,12 +612,12 @@ u8 eighty_ninty_three (ide_drive_t *drive)
                printk(KERN_DEBUG "%s: skipping word 93 validity check\n",
                                  drive->name);
 
+       if (ide_dev_is_sata(id) && !ivb)
+               return 1;
+
        if (hwif->cbl != ATA_CBL_PATA80 && !ivb)
                goto no_80w;
 
-       if (ide_dev_is_sata(id))
-               return 1;
-
        /*
         * FIXME:
         * - force bit13 (80c cable present) check also for !ivb devices
index 51fca441c2946c59e69b0b9638ab88dee7f808c5..bc553337b1be38548d155ed6ea4db0fbffa417e0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/pci/cmd64x.c              Version 1.51    Nov 8, 2007
+ * linux/drivers/ide/pci/cmd64x.c              Version 1.52    Dec 24, 2007
  *
  * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines.
  *           Due to massive hardware bugs, UltraDMA is only supported
@@ -564,6 +564,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
                .init_chipset   = init_chipset_cmd64x,
                .init_hwif      = init_hwif_cmd64x,
                .enablebits     = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
+               .chipset        = ide_cmd646,
                .host_flags     = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO5,
                .mwdma_mask     = ATA_MWDMA2,
@@ -573,7 +574,6 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
                .init_chipset   = init_chipset_cmd64x,
                .init_hwif      = init_hwif_cmd64x,
                .enablebits     = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
-               .chipset        = ide_cmd646,
                .host_flags     = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO5,
                .mwdma_mask     = ATA_MWDMA2,
index 9094916e37803c61a02306f0d402653a771a2fc7..ddcbeba671e19ca749c3dc3f74aefbf898944473 100644 (file)
@@ -49,7 +49,7 @@
 #define ATAC_BM0_PRD           0x04
 #define CS5535_CABLE_DETECT    0x48
 
-/* Format I PIO settings. We seperate out cmd and data for safer timings */
+/* Format I PIO settings. We separate out cmd and data for safer timings */
 
 static unsigned int cs5535_pio_cmd_timings[5] =
 { 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 };
index 0895e753a35d34af4ba8b508fe3422fa82b4c461..0151d7fdfb8a7dade521aadbd3e0250ed21e49c9 100644 (file)
@@ -1,7 +1,8 @@
 /*
- *  linux/drivers/ide/pci/trm290.c             Version 1.02    Mar. 18, 2000
+ *  linux/drivers/ide/pci/trm290.c             Version 1.05    Dec. 26, 2007
  *
  *  Copyright (c) 1997-1998  Mark Lord
+ *  Copyright (c) 2007       MontaVista Software, Inc. <source@mvista.com>
  *  May be copied or modified under the terms of the GNU General Public License
  *
  *  June 22, 2004 - get rid of check_region
@@ -177,7 +178,7 @@ static void trm290_selectproc (ide_drive_t *drive)
        trm290_prepare_drive(drive, drive->using_dma);
 }
 
-static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
+static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
        BUG_ON(HWGROUP(drive)->handler != NULL);        /* paranoia check */
        ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
@@ -185,7 +186,7 @@ static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
        outb(command, IDE_COMMAND_REG);
 }
 
-static int trm290_ide_dma_setup(ide_drive_t *drive)
+static int trm290_dma_setup(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
        struct request *rq = hwif->hwgroup->rq;
@@ -215,7 +216,7 @@ static int trm290_ide_dma_setup(ide_drive_t *drive)
        return 0;
 }
 
-static void trm290_ide_dma_start(ide_drive_t *drive)
+static void trm290_dma_start(ide_drive_t *drive)
 {
 }
 
@@ -240,6 +241,14 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive)
        return (status == 0x00ff);
 }
 
+static void trm290_dma_host_on(ide_drive_t *drive)
+{
+}
+
+static void trm290_dma_host_off(ide_drive_t *drive)
+{
+}
+
 static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
 {
        unsigned int cfgbase = 0;
@@ -280,11 +289,13 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
 
        ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3);
 
-       hwif->dma_setup = &trm290_ide_dma_setup;
-       hwif->dma_exec_cmd = &trm290_ide_dma_exec_cmd;
-       hwif->dma_start = &trm290_ide_dma_start;
-       hwif->ide_dma_end = &trm290_ide_dma_end;
-       hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq;
+       hwif->dma_host_off      = &trm290_dma_host_off;
+       hwif->dma_host_on       = &trm290_dma_host_on;
+       hwif->dma_setup         = &trm290_dma_setup;
+       hwif->dma_exec_cmd      = &trm290_dma_exec_cmd;
+       hwif->dma_start         = &trm290_dma_start;
+       hwif->ide_dma_end       = &trm290_ide_dma_end;
+       hwif->ide_dma_test_irq  = &trm290_ide_dma_test_irq;
 
        hwif->selectproc = &trm290_selectproc;
 #if 1
index 8bf44daf45ecd851e858bc72b12678ada60be0d8..9d32c49cc651c76c23850f46c478c167916e7eee 100644 (file)
@@ -430,7 +430,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
                wc->dlid_path_bits = (be32_to_cpu(cqe->g_mlpath_rqpn) >> 24) & 0x7f;
                wc->wc_flags      |= be32_to_cpu(cqe->g_mlpath_rqpn) & 0x80000000 ?
                        IB_WC_GRH : 0;
-               wc->pkey_index     = be32_to_cpu(cqe->immed_rss_invalid) >> 16;
+               wc->pkey_index     = be32_to_cpu(cqe->immed_rss_invalid) & 0x7f;
        }
 
        return 0;
index 950228fb009f29c1ccebd3f9453ee2c731a9a4c9..bdb6f8517401d5950872c05e47aa64685e8287c6 100644 (file)
@@ -2053,6 +2053,7 @@ static void srp_remove_one(struct ib_device *device)
 
                list_for_each_entry_safe(target, tmp_target,
                                         &host->target_list, list) {
+                       srp_remove_host(target->scsi_host);
                        scsi_remove_host(target->scsi_host);
                        srp_disconnect_target(target);
                        ib_destroy_cm_id(target->cm_id);
index bfc6061f1554fdf72c20d0e9d22631921f6fc052..1dc2ac9f3d1cce12d1516c07b567c4656b28ee54 100644 (file)
@@ -38,8 +38,6 @@ EXPORT_SYMBOL(gameport_unregister_driver);
 EXPORT_SYMBOL(gameport_open);
 EXPORT_SYMBOL(gameport_close);
 EXPORT_SYMBOL(gameport_rescan);
-EXPORT_SYMBOL(gameport_cooked_read);
-EXPORT_SYMBOL(gameport_set_name);
 EXPORT_SYMBOL(gameport_set_phys);
 EXPORT_SYMBOL(gameport_start_polling);
 EXPORT_SYMBOL(gameport_stop_polling);
index 307c7b5c2b33a59fa33825523cca639af4f4ccd2..a0be978501ff1c1679374adcde4d13ad84102aa6 100644 (file)
@@ -235,6 +235,10 @@ static void input_handle_event(struct input_dev *dev,
                if (value >= 0)
                        disposition = INPUT_PASS_TO_ALL;
                break;
+
+       case EV_PWR:
+               disposition = INPUT_PASS_TO_ALL;
+               break;
        }
 
        if (type != EV_SYN)
@@ -1266,6 +1270,10 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int
                __set_bit(code, dev->ffbit);
                break;
 
+       case EV_PWR:
+               /* do nothing */
+               break;
+
        default:
                printk(KERN_ERR
                        "input_set_capability: unknown type %u (code %u)\n",
index bbc66d4ab5675bdb5e6b2cc0f3c2de8a11e01cc6..1d7cb099968f61719ad772ea90e249981445340b 100644 (file)
@@ -209,22 +209,22 @@ config KEYBOARD_HIL
          to your machine, so normally you should say Y here.
 
 config KEYBOARD_HP6XX
-       tristate "HP Jornada 6XX Keyboard support"
+       tristate "HP Jornada 6xx keyboard"
        depends on SH_HP6XX
        select INPUT_POLLDEV
        help
-         This adds support for the onboard keyboard found on
-         HP Jornada 620/660/680/690.
+         Say Y here if you have a HP Jornada 620/660/680/690 and want to
+         support the built-in keyboard.
 
          To compile this driver as a module, choose M here: the
          module will be called jornada680_kbd.
 
 config KEYBOARD_HP7XX
-       tristate "HP Jornada 7XX Keyboard Driver"
+       tristate "HP Jornada 7xx keyboard"
        depends on SA1100_JORNADA720_SSP && SA1100_SSP
        help
-         Say Y here to add support for the HP Jornada 7xx (710/720/728)
-         onboard keyboard.
+         Say Y here if you have a HP Jornada 710/720/728 and want to
+         support the built-in keyboard.
 
          To compile this driver as a module, choose M here: the
          module will be called jornada720_kbd.
index bec1cf483723ef18d58a9e99472d5619931647f1..a23633a2e1b46654979633556ef8564d1e160aa3 100644 (file)
  * published by the Free Software Foundation.
  */
 
-#include <linux/input.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/init.h>
+#include <linux/input.h>
 #include <linux/input-polldev.h>
+#include <linux/interrupt.h>
 #include <linux/jiffies.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
-#include <linux/interrupt.h>
 
 #include <asm/delay.h>
 #include <asm/io.h>
 #define PLDR 0xa4000134
 
 static const unsigned short jornada_scancodes[] = {
-/* PTD1 */     KEY_CAPSLOCK, KEY_MACRO, KEY_LEFTCTRL, 0, KEY_ESC, 0, 0, 0,     /*  1  -> 8   */
-               KEY_F1, KEY_F2, KEY_F3, KEY_F8, KEY_F7, KEY_F2, KEY_F4, KEY_F5, /*  9  -> 16  */
-/* PTD5 */     KEY_SLASH, KEY_APOSTROPHE, KEY_ENTER, 0, KEY_Z, 0, 0, 0,        /*  17 -> 24  */
-               KEY_X, KEY_C, KEY_V, KEY_DOT, KEY_COMMA, KEY_M, KEY_B, KEY_N,   /*  25 -> 32  */
-/* PTD7 */     KEY_KP2, KEY_KP6, 0, 0, 0, 0, 0, 0,                             /*  33 -> 40  */
-               0, 0, 0, KEY_KP4, 0, 0, KEY_LEFTALT, KEY_HANJA,                 /*  41 -> 48  */
-/* PTE0 */     0, 0, 0, 0, KEY_FINANCE, 0, 0, 0,                               /*  49 -> 56  */
-               KEY_LEFTCTRL, 0, KEY_SPACE, KEY_KPDOT, KEY_VOLUMEUP, 249, 0, 0, /*  57 -> 64  */
-/* PTE1 */     KEY_SEMICOLON, KEY_RIGHTBRACE, KEY_BACKSLASH, 0, KEY_A, 0, 0, 0,/*  65 -> 72  */
-               KEY_S, KEY_D, KEY_F, KEY_L, KEY_K, KEY_J, KEY_G, KEY_H,         /*  73 -> 80  */
-/* PTE3 */     KEY_KP8, KEY_LEFTMETA, KEY_RIGHTSHIFT, 0, KEY_TAB, 0, 0,0,      /*  81 -> 88  */
-               0, KEY_LEFTSHIFT, 0, 0, 0, 0, 0, 0,                             /*  89 -> 96  */
-/* PTE6 */     KEY_P, KEY_LEFTBRACE, KEY_BACKSPACE, 0, KEY_Q, 0, 0, 0,         /*  97 -> 104 */
-               KEY_W, KEY_E, KEY_R, KEY_O, KEY_I, KEY_U, KEY_T, KEY_R,         /* 105 -> 112 */
-/* PTE7 */     KEY_0, KEY_MINUS, KEY_EQUAL, 0, KEY_1, 0, 0, 0,                 /* 113 -> 120 */
-               KEY_2, KEY_3, KEY_4, KEY_9, KEY_8, KEY_7, KEY_5, KEY_6,         /* 121 -> 128 */
+/* PTD1 */     KEY_CAPSLOCK, KEY_MACRO, KEY_LEFTCTRL, 0, KEY_ESC, KEY_KP5, 0, 0,                       /*  1  -> 8   */
+               KEY_F1, KEY_F2, KEY_F3, KEY_F8, KEY_F7, KEY_F6, KEY_F4, KEY_F5,                         /*  9  -> 16  */
+/* PTD5 */     KEY_SLASH, KEY_APOSTROPHE, KEY_ENTER, 0, KEY_Z, 0, 0, 0,                                /*  17 -> 24  */
+               KEY_X, KEY_C, KEY_V, KEY_DOT, KEY_COMMA, KEY_M, KEY_B, KEY_N,                           /*  25 -> 32  */
+/* PTD7 */     KEY_KP2, KEY_KP6, KEY_KP3, 0, 0, 0, 0, 0,                                               /*  33 -> 40  */
+               KEY_F10, KEY_RO, KEY_F9, KEY_KP4, KEY_NUMLOCK, KEY_SCROLLLOCK, KEY_LEFTALT, KEY_HANJA,  /*  41 -> 48  */
+/* PTE0 */     KEY_KATAKANA, KEY_KP0, KEY_GRAVE, 0, KEY_FINANCE, 0, 0, 0,                              /*  49 -> 56  */
+               KEY_KPMINUS, KEY_HIRAGANA, KEY_SPACE, KEY_KPDOT, KEY_VOLUMEUP, 249, 0, 0,               /*  57 -> 64  */
+/* PTE1 */     KEY_SEMICOLON, KEY_RIGHTBRACE, KEY_BACKSLASH, 0, KEY_A, 0, 0, 0,                        /*  65 -> 72  */
+               KEY_S, KEY_D, KEY_F, KEY_L, KEY_K, KEY_J, KEY_G, KEY_H,                                 /*  73 -> 80  */
+/* PTE3 */     KEY_KP8, KEY_LEFTMETA, KEY_RIGHTSHIFT, 0, KEY_TAB, 0, 0, 0,                             /*  81 -> 88  */
+               0, KEY_LEFTSHIFT, KEY_KP7, KEY_KP9, KEY_KP1, KEY_F11, KEY_KPPLUS, KEY_KPASTERISK,       /*  89 -> 96  */
+/* PTE6 */     KEY_P, KEY_LEFTBRACE, KEY_BACKSPACE, 0, KEY_Q, 0, 0, 0,                                 /*  97 -> 104 */
+               KEY_W, KEY_E, KEY_R, KEY_O, KEY_I, KEY_U, KEY_T, KEY_Y,                                 /* 105 -> 112 */
+/* PTE7 */     KEY_0, KEY_MINUS, KEY_EQUAL, 0, KEY_1, 0, 0, 0,                                         /* 113 -> 120 */
+               KEY_2, KEY_3, KEY_4, KEY_9, KEY_8, KEY_7, KEY_5, KEY_6,                                 /* 121 -> 128 */
 /* **** */     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                0, 0, 0, 0, 0
 };
index 410d78a774d03c2eab0ce95a1fd608f73df09436..1d59a2dc3c17c57a6a18110e73a6128bceb28073 100644 (file)
@@ -391,6 +391,7 @@ static int __init spitzkbd_probe(struct platform_device *dev)
        for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++)
                set_bit(spitzkbd->keycode[i], input_dev->keybit);
        clear_bit(0, input_dev->keybit);
+       set_bit(KEY_SUSPEND, input_dev->keybit);
        set_bit(SW_LID, input_dev->swbit);
        set_bit(SW_TABLET_MODE, input_dev->swbit);
        set_bit(SW_HEADPHONE_INSERT, input_dev->swbit);
index fae46243fb55ba7e9f8c6b2b0cd3dd0981190f8c..f3c45b604ebed571d276d4153b278db1203f105a 100644 (file)
@@ -115,19 +115,17 @@ config TOUCHSCREEN_MK712
          module will be called mk712.
 
 config TOUCHSCREEN_HP600
-       tristate "HP Jornada 680/690 touchscreen"
+       tristate "HP Jornada 6xx touchscreen"
        depends on SH_HP6XX && SH_ADC
        help
-         Say Y here if you have a HP Jornada 680 or 690 and want to
+         Say Y here if you have a HP Jornada 620/660/680/690 and want to
           support the built-in touchscreen.
 
-         If unsure, say N.
-
          To compile this driver as a module, choose M here: the
          module will be called hp680_ts_input.
 
 config TOUCHSCREEN_HP7XX
-       tristate "HP Jornada 710/720/728 touchscreen"
+       tristate "HP Jornada 7xx touchscreen"
        depends on SA1100_JORNADA720_SSP
        help
          Say Y here if you have a HP Jornada 710/720/728 and want
index d6952959d72afc643be51248cadd523e2a0ebcf7..9cef6fcf587b6baaef9df48c3616779262d6d3a9 100644 (file)
@@ -914,6 +914,9 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
                        dflag = 0;
                        count_pull = count_put = 0;
                        while ((count_pull < skb->len) && (len > 0)) {
+                               /* push every character but the last to the tty buffer directly */
+                               if ( count_put )
+                                       tty_insert_flip_char(tty, last, TTY_NORMAL);
                                len--;
                                if (dev->drv[di]->DLEflag & DLEmask) {
                                        last = DLE;
index 4e5f87c1e71413bb3d15d65e5edf3ae011746b20..9cb6e5021adb93af85012396cf857b2fb82242f2 100644 (file)
@@ -85,6 +85,8 @@ isdn_tty_try_read(modem_info * info, struct sk_buff *skb)
                                                                tty_insert_flip_char(tty, DLE, 0);
                                                        tty_insert_flip_char(tty, *dp++, 0);
                                                }
+                                               if (*dp == DLE)
+                                                       tty_insert_flip_char(tty, DLE, 0);
                                                last = *dp;
                                        } else {
 #endif
@@ -2645,7 +2647,12 @@ isdn_tty_modem_result(int code, modem_info * info)
                if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) {
                        return;
                }
+#ifdef CONFIG_ISDN_AUDIO
+               if ( !info->vonline )
+                       tty_ldisc_flush(info->tty);
+#else
                tty_ldisc_flush(info->tty);
+#endif
                if ((info->flags & ISDN_ASYNC_CHECK_CD) &&
                    (!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) &&
                       (info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) {
index ba8b04b03b9f2799eacba45927595553ce4141df..64c66b3769c99edf05af6ae8d104a70a8240f2e1 100644 (file)
@@ -106,9 +106,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
                goto err_out;
 
        /* add to the list of leds */
-       write_lock(&leds_list_lock);
+       down_write(&leds_list_lock);
        list_add_tail(&led_cdev->node, &leds_list);
-       write_unlock(&leds_list_lock);
+       up_write(&leds_list_lock);
 
 #ifdef CONFIG_LEDS_TRIGGERS
        init_rwsem(&led_cdev->trigger_lock);
@@ -155,9 +155,9 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
 
        device_unregister(led_cdev->dev);
 
-       write_lock(&leds_list_lock);
+       down_write(&leds_list_lock);
        list_del(&led_cdev->node);
-       write_unlock(&leds_list_lock);
+       up_write(&leds_list_lock);
 }
 EXPORT_SYMBOL_GPL(led_classdev_unregister);
 
index 9b015f9af351e49526eb52ec0f0c09b4acb21e56..5d1ca10524b6933bc216fb282815ac6f348cc9d0 100644 (file)
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/module.h>
-#include <linux/spinlock.h>
+#include <linux/rwsem.h>
 #include <linux/leds.h>
 #include "leds.h"
 
-DEFINE_RWLOCK(leds_list_lock);
+DECLARE_RWSEM(leds_list_lock);
 LIST_HEAD(leds_list);
 
 EXPORT_SYMBOL_GPL(leds_list);
index 0bdb786210b1885bee8e6f194ccdcab09e5bdd18..13c9026d68af0af90e246824df1429496afe6814 100644 (file)
@@ -169,7 +169,7 @@ int led_trigger_register(struct led_trigger *trigger)
        up_write(&triggers_list_lock);
 
        /* Register with any LEDs that have this as a default trigger */
-       read_lock(&leds_list_lock);
+       down_read(&leds_list_lock);
        list_for_each_entry(led_cdev, &leds_list, node) {
                down_write(&led_cdev->trigger_lock);
                if (!led_cdev->trigger && led_cdev->default_trigger &&
@@ -177,7 +177,7 @@ int led_trigger_register(struct led_trigger *trigger)
                        led_trigger_set(led_cdev, trigger);
                up_write(&led_cdev->trigger_lock);
        }
-       read_unlock(&leds_list_lock);
+       up_read(&leds_list_lock);
 
        return 0;
 }
@@ -212,14 +212,14 @@ void led_trigger_unregister(struct led_trigger *trigger)
        up_write(&triggers_list_lock);
 
        /* Remove anyone actively using this trigger */
-       read_lock(&leds_list_lock);
+       down_read(&leds_list_lock);
        list_for_each_entry(led_cdev, &leds_list, node) {
                down_write(&led_cdev->trigger_lock);
                if (led_cdev->trigger == trigger)
                        led_trigger_set(led_cdev, NULL);
                up_write(&led_cdev->trigger_lock);
        }
-       read_unlock(&leds_list_lock);
+       up_read(&leds_list_lock);
 }
 
 void led_trigger_unregister_simple(struct led_trigger *trigger)
index bfac499f3258f74fd2c96267c7e9b9a5361a72bf..2207335e9212e97b64a05bdd290819ceee83a89d 100644 (file)
@@ -19,7 +19,7 @@
 static void locomoled_brightness_set(struct led_classdev *led_cdev,
                                enum led_brightness value, int offset)
 {
-       struct locomo_dev *locomo_dev = LOCOMO_DEV(led_cdev->dev);
+       struct locomo_dev *locomo_dev = LOCOMO_DEV(led_cdev->dev->parent);
        unsigned long flags;
 
        local_irq_save(flags);
index f2f3884fe06314b01a3bb647821c6b4e0ea88e89..12b6fe93b1356b980241ef2f7dae3fd325c30090 100644 (file)
@@ -14,6 +14,7 @@
 #define __LEDS_H_INCLUDED
 
 #include <linux/device.h>
+#include <linux/rwsem.h>
 #include <linux/leds.h>
 
 static inline void led_set_brightness(struct led_classdev *led_cdev,
@@ -26,7 +27,7 @@ static inline void led_set_brightness(struct led_classdev *led_cdev,
                led_cdev->brightness_set(led_cdev, value);
 }
 
-extern rwlock_t leds_list_lock;
+extern struct rw_semaphore leds_list_lock;
 extern struct list_head leds_list;
 
 #ifdef CONFIG_LEDS_TRIGGERS
index 883da72b5368d236d6c0246da16509b9a97bc42f..ef4c117ea35fde801a43eeea0d1dbf8aebc14190 100644 (file)
@@ -322,8 +322,9 @@ adbhid_input_keycode(int id, int scancode, int repeat)
                        input_sync(ahid->input);
                        input_report_key(ahid->input, KEY_CAPSLOCK, 0);
                        input_sync(ahid->input);
+                       return;
                }
-               return;
+               break;
 #ifdef CONFIG_PPC_PMAC
        case ADB_KEY_POWER_OLD: /* Power key on PBook 3400 needs remapping */
                switch(pmac_call_feature(PMAC_FTR_GET_MB_INFO,
index dc741d3a4531cbe365aa8b89256a0337782b5b00..6123c70153d3d7db8504cc5eef67ecdc4a14d3a3 100644 (file)
@@ -2336,6 +2336,7 @@ powerbook_sleep_3400(void)
        ret = pmac_suspend_devices();
        if (ret) {
                pbook_free_pci_save();
+               iounmap(mem_ctrl);
                printk(KERN_ERR "Sleep rejected by devices\n");
                return ret;
        }
index 9b6fbf044fd803bb04836f36381ea8ec9bdc58f6..3fa7c77d9bd91479c619ee9bced6a6c42d63a654 100644 (file)
@@ -269,7 +269,7 @@ config DM_MULTIPATH_RDAC
 
 config DM_MULTIPATH_HP
         tristate "HP MSA multipath support (EXPERIMENTAL)"
-        depends on DM_MULTIPATH && BLK_DEV_DM && EXPERIMENTAL
+        depends on DM_MULTIPATH && BLK_DEV_DM && SCSI && EXPERIMENTAL
         ---help---
           Multipath support for HP MSA (Active/Passive) series hardware.
 
index 28c6ae095c560d9377aa5e182e8b8af38de11117..6b66ee46b87d5b44e0023ef3248656b3a9e7ed36 100644 (file)
@@ -398,7 +398,8 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size)
        struct bio *clone;
        unsigned int nr_iovecs = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
        gfp_t gfp_mask = GFP_NOIO | __GFP_HIGHMEM;
-       unsigned int i;
+       unsigned i, len;
+       struct page *page;
 
        clone = bio_alloc_bioset(GFP_NOIO, nr_iovecs, cc->bs);
        if (!clone)
@@ -407,10 +408,8 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size)
        clone_init(io, clone);
 
        for (i = 0; i < nr_iovecs; i++) {
-               struct bio_vec *bv = bio_iovec_idx(clone, i);
-
-               bv->bv_page = mempool_alloc(cc->page_pool, gfp_mask);
-               if (!bv->bv_page)
+               page = mempool_alloc(cc->page_pool, gfp_mask);
+               if (!page)
                        break;
 
                /*
@@ -421,15 +420,14 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size)
                if (i == (MIN_BIO_PAGES - 1))
                        gfp_mask = (gfp_mask | __GFP_NOWARN) & ~__GFP_WAIT;
 
-               bv->bv_offset = 0;
-               if (size > PAGE_SIZE)
-                       bv->bv_len = PAGE_SIZE;
-               else
-                       bv->bv_len = size;
+               len = (size > PAGE_SIZE) ? PAGE_SIZE : size;
+
+               if (!bio_add_page(clone, page, len, 0)) {
+                       mempool_free(page, cc->page_pool);
+                       break;
+               }
 
-               clone->bi_size += bv->bv_len;
-               clone->bi_vcnt++;
-               size -= bv->bv_len;
+               size -= len;
        }
 
        if (!clone->bi_size) {
@@ -511,6 +509,9 @@ static void crypt_endio(struct bio *clone, int error)
        struct crypt_config *cc = io->target->private;
        unsigned read_io = bio_data_dir(clone) == READ;
 
+       if (unlikely(!bio_flagged(clone, BIO_UPTODATE) && !error))
+               error = -EIO;
+
        /*
         * free the processed pages
         */
@@ -519,10 +520,8 @@ static void crypt_endio(struct bio *clone, int error)
                goto out;
        }
 
-       if (unlikely(!bio_flagged(clone, BIO_UPTODATE))) {
-               error = -EIO;
+       if (unlikely(error))
                goto out;
-       }
 
        bio_put(clone);
        kcryptd_queue_crypt(io);
index 138200bf5e0befa90ff67d7ac50c231313f94380..9627fa0f9470cfdb4055199e83eb68c7f8a5f18f 100644 (file)
@@ -332,6 +332,8 @@ static int dm_hash_rename(const char *old, const char *new)
                dm_table_put(table);
        }
 
+       dm_kobject_uevent(hc->md);
+
        dm_put(hc->md);
        up_write(&_hash_lock);
        kfree(old_name);
@@ -1250,21 +1252,17 @@ static int target_message(struct dm_ioctl *param, size_t param_size)
        if (!table)
                goto out_argv;
 
-       if (tmsg->sector >= dm_table_get_size(table)) {
+       ti = dm_table_find_target(table, tmsg->sector);
+       if (!dm_target_is_valid(ti)) {
                DMWARN("Target message sector outside device.");
                r = -EINVAL;
-               goto out_table;
-       }
-
-       ti = dm_table_find_target(table, tmsg->sector);
-       if (ti->type->message)
+       } else if (ti->type->message)
                r = ti->type->message(ti, argc, argv);
        else {
                DMWARN("Target type does not support messages");
                r = -EINVAL;
        }
 
- out_table:
        dm_table_put(table);
  out_argv:
        kfree(argv);
index e298d8d11f24bb1892d959833dbd84cf4f9e16e6..47818d8249cbf16f125328d39d2be54c0241130a 100644 (file)
@@ -99,6 +99,9 @@ static void combine_restrictions_low(struct io_restrictions *lhs,
        lhs->max_segment_size =
                min_not_zero(lhs->max_segment_size, rhs->max_segment_size);
 
+       lhs->max_hw_sectors =
+               min_not_zero(lhs->max_hw_sectors, rhs->max_hw_sectors);
+
        lhs->seg_boundary_mask =
                min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask);
 
@@ -189,8 +192,10 @@ static int alloc_targets(struct dm_table *t, unsigned int num)
 
        /*
         * Allocate both the target array and offset array at once.
+        * Append an empty entry to catch sectors beyond the end of
+        * the device.
         */
-       n_highs = (sector_t *) dm_vcalloc(num, sizeof(struct dm_target) +
+       n_highs = (sector_t *) dm_vcalloc(num + 1, sizeof(struct dm_target) +
                                          sizeof(sector_t));
        if (!n_highs)
                return -ENOMEM;
@@ -564,6 +569,9 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
        rs->max_segment_size =
                min_not_zero(rs->max_segment_size, q->max_segment_size);
 
+       rs->max_hw_sectors =
+               min_not_zero(rs->max_hw_sectors, q->max_hw_sectors);
+
        rs->seg_boundary_mask =
                min_not_zero(rs->seg_boundary_mask,
                             q->seg_boundary_mask);
@@ -701,6 +709,8 @@ static void check_for_valid_limits(struct io_restrictions *rs)
 {
        if (!rs->max_sectors)
                rs->max_sectors = SAFE_MAX_SECTORS;
+       if (!rs->max_hw_sectors)
+               rs->max_hw_sectors = SAFE_MAX_SECTORS;
        if (!rs->max_phys_segments)
                rs->max_phys_segments = MAX_PHYS_SEGMENTS;
        if (!rs->max_hw_segments)
@@ -867,6 +877,9 @@ struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index)
 
 /*
  * Search the btree for the correct target.
+ *
+ * Caller should check returned pointer with dm_target_is_valid()
+ * to trap I/O beyond end of device.
  */
 struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector)
 {
@@ -896,6 +909,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q)
        q->max_hw_segments = t->limits.max_hw_segments;
        q->hardsect_size = t->limits.hardsect_size;
        q->max_segment_size = t->limits.max_segment_size;
+       q->max_hw_sectors = t->limits.max_hw_sectors;
        q->seg_boundary_mask = t->limits.seg_boundary_mask;
        q->bounce_pfn = t->limits.bounce_pfn;
        if (t->limits.no_cluster)
index 07cbbb8eb3e0d5d67f5c7bed7ea399f6636e5954..88c0fd657825fb88aab0eb07611050b2546c3514 100644 (file)
@@ -672,13 +672,19 @@ static struct bio *clone_bio(struct bio *bio, sector_t sector,
        return clone;
 }
 
-static void __clone_and_map(struct clone_info *ci)
+static int __clone_and_map(struct clone_info *ci)
 {
        struct bio *clone, *bio = ci->bio;
-       struct dm_target *ti = dm_table_find_target(ci->map, ci->sector);
-       sector_t len = 0, max = max_io_len(ci->md, ci->sector, ti);
+       struct dm_target *ti;
+       sector_t len = 0, max;
        struct dm_target_io *tio;
 
+       ti = dm_table_find_target(ci->map, ci->sector);
+       if (!dm_target_is_valid(ti))
+               return -EIO;
+
+       max = max_io_len(ci->md, ci->sector, ti);
+
        /*
         * Allocate a target io object.
         */
@@ -736,6 +742,9 @@ static void __clone_and_map(struct clone_info *ci)
                do {
                        if (offset) {
                                ti = dm_table_find_target(ci->map, ci->sector);
+                               if (!dm_target_is_valid(ti))
+                                       return -EIO;
+
                                max = max_io_len(ci->md, ci->sector, ti);
 
                                tio = alloc_tio(ci->md);
@@ -759,6 +768,8 @@ static void __clone_and_map(struct clone_info *ci)
 
                ci->idx++;
        }
+
+       return 0;
 }
 
 /*
@@ -767,6 +778,7 @@ static void __clone_and_map(struct clone_info *ci)
 static int __split_bio(struct mapped_device *md, struct bio *bio)
 {
        struct clone_info ci;
+       int error = 0;
 
        ci.map = dm_get_table(md);
        if (unlikely(!ci.map))
@@ -784,11 +796,11 @@ static int __split_bio(struct mapped_device *md, struct bio *bio)
        ci.idx = bio->bi_idx;
 
        start_io_acct(ci.io);
-       while (ci.sector_count)
-               __clone_and_map(&ci);
+       while (ci.sector_count && !error)
+               error = __clone_and_map(&ci);
 
        /* drop the extra reference count */
-       dec_pending(ci.io, 0);
+       dec_pending(ci.io, error);
        dm_table_put(ci.map);
 
        return 0;
@@ -1502,7 +1514,7 @@ int dm_resume(struct mapped_device *md)
 
        dm_table_unplug_all(map);
 
-       kobject_uevent(&md->disk->kobj, KOBJ_CHANGE);
+       dm_kobject_uevent(md);
 
        r = 0;
 
@@ -1516,6 +1528,11 @@ out:
 /*-----------------------------------------------------------------
  * Event notification.
  *---------------------------------------------------------------*/
+void dm_kobject_uevent(struct mapped_device *md)
+{
+       kobject_uevent(&md->disk->kobj, KOBJ_CHANGE);
+}
+
 uint32_t dm_next_uevent_seq(struct mapped_device *md)
 {
        return atomic_add_return(1, &md->uevent_seq);
index 4b3faa45277ec81666876110423c9c0f1cb8954e..b4584a39383bdeda58fc1f16f596447648f1e110 100644 (file)
@@ -112,6 +112,11 @@ int dm_table_resume_targets(struct dm_table *t);
 int dm_table_any_congested(struct dm_table *t, int bdi_bits);
 void dm_table_unplug_all(struct dm_table *t);
 
+/*
+ * To check the return value from dm_table_find_target().
+ */
+#define dm_target_is_valid(t) ((t)->table)
+
 /*-----------------------------------------------------------------
  * A registry of target types.
  *---------------------------------------------------------------*/
@@ -182,4 +187,6 @@ union map_info *dm_get_mapinfo(struct bio *bio);
 int dm_open_count(struct mapped_device *md);
 int dm_lock_for_deletion(struct mapped_device *md);
 
+void dm_kobject_uevent(struct mapped_device *md);
+
 #endif
index a5aad8cad84332a138e741d56ed49bbcf58e1c6c..e8c8157b02fcb5e99a09786b977e30226e56ed95 100644 (file)
@@ -2865,7 +2865,8 @@ static void handle_stripe5(struct stripe_head *sh)
                md_done_sync(conf->mddev, STRIPE_SECTORS, 1);
        }
 
-       if (s.expanding && s.locked == 0)
+       if (s.expanding && s.locked == 0 &&
+           !test_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending))
                handle_stripe_expansion(conf, sh, NULL);
 
        if (sh->ops.count)
@@ -3067,7 +3068,8 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
                md_done_sync(conf->mddev, STRIPE_SECTORS, 1);
        }
 
-       if (s.expanding && s.locked == 0)
+       if (s.expanding && s.locked == 0 &&
+           !test_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending))
                handle_stripe_expansion(conf, sh, &r6s);
 
        spin_unlock(&sh->lock);
index 8b8144f77a739b7637ce5c9de526c199a3daf389..0d36c155695bcd901febb18571547c9629eb1b1f 100644 (file)
@@ -2800,12 +2800,12 @@ static void av7110_irq(struct saa7146_dev* dev, u32 *isr)
 }
 
 
-static struct saa7146_extension av7110_extension;
+static struct saa7146_extension av7110_extension_driver;
 
 #define MAKE_AV7110_INFO(x_var,x_name) \
 static struct saa7146_pci_extension_data x_var = { \
        .ext_priv = x_name, \
-       .ext = &av7110_extension }
+       .ext = &av7110_extension_driver }
 
 MAKE_AV7110_INFO(tts_1_X_fsc,"Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C");
 MAKE_AV7110_INFO(ttt_1_X,    "Technotrend/Hauppauge WinTV DVB-T rev1.X");
@@ -2843,7 +2843,7 @@ static struct pci_device_id pci_tbl[] = {
 MODULE_DEVICE_TABLE(pci, pci_tbl);
 
 
-static struct saa7146_extension av7110_extension = {
+static struct saa7146_extension av7110_extension_driver = {
        .name           = "dvb",
        .flags          = SAA7146_USE_I2C_IRQ,
 
@@ -2860,14 +2860,14 @@ static struct saa7146_extension av7110_extension = {
 static int __init av7110_init(void)
 {
        int retval;
-       retval = saa7146_register_extension(&av7110_extension);
+       retval = saa7146_register_extension(&av7110_extension_driver);
        return retval;
 }
 
 
 static void __exit av7110_exit(void)
 {
-       saa7146_unregister_extension(&av7110_extension);
+       saa7146_unregister_extension(&av7110_extension_driver);
 }
 
 module_init(av7110_init);
index c02d92deacd2aab2b1009ca573183c898b818d42..581a3c955739def38f8bac332594f786283cc1cb 100644 (file)
@@ -3063,11 +3063,10 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
                struct video_mbuf *mbuf = arg;
                unsigned int i;
 
-               mutex_lock(&fh->cap.lock);
                retval = videobuf_mmap_setup(&fh->cap,gbuffers,gbufsize,
                                             V4L2_MEMORY_MMAP);
                if (retval < 0)
-                       goto fh_unlock_and_return;
+                       return retval;
 
                gbuffers = retval;
                memset(mbuf,0,sizeof(*mbuf));
@@ -3075,7 +3074,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
                mbuf->size   = gbuffers * gbufsize;
                for (i = 0; i < gbuffers; i++)
                        mbuf->offsets[i] = i * gbufsize;
-               mutex_unlock(&fh->cap.lock);
                return 0;
        }
        case VIDIOCMCAPTURE:
index d8b1ccb44913bcdba7692dc48406ed0f7f068aa9..081ee6e1536fe675f6e9852aa89312cd773f90df 100644 (file)
@@ -10,6 +10,7 @@ config VIDEO_CX23885
        select VIDEOBUF_DVB
        select DVB_TUNER_MT2131 if !DVB_FE_CUSTOMISE
        select DVB_S5H1409 if !DVB_FE_CUSTOMISE
+       select DVB_LGDT330X if !DVB_FE_CUSTOMISE
        select DVB_PLL if !DVB_FE_CUSTOMISE
        ---help---
          This is a video4linux driver for Conexant 23885 based
index 77b27dc750b1bc9ef5592cbbad1a4e76cb7b2edd..36e54f78aa2a6aad418f5e05cb921ad33df3ddf5 100644 (file)
@@ -541,7 +541,7 @@ static const struct i2c_algo_bit_data ivtv_i2c_algo_template = {
        .setscl         = ivtv_setscl_old,
        .getsda         = ivtv_getsda_old,
        .getscl         = ivtv_getscl_old,
-       .udelay         = 5,
+       .udelay         = 10,
        .timeout        = 200,
 };
 
index ff59d2e0475bfe620bb71dca843219bd76cf79f9..785bbdcf4a58212e4371fbdc024a1ef1919ffc88 100644 (file)
@@ -7,6 +7,10 @@
  * 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.
+ *
+ * Thanks to the following companies for their support:
+ *
+ *     - JMicron (hardware and technical support)
  */
 
 #include <linux/delay.h>
 
 static unsigned int debug_quirks = 0;
 
+/*
+ * Different quirks to handle when the hardware deviates from a strict
+ * interpretation of the SDHCI specification.
+ */
+
+/* Controller doesn't honor resets unless we touch the clock register */
 #define SDHCI_QUIRK_CLOCK_BEFORE_RESET                 (1<<0)
+/* Controller has bad caps bits, but really supports DMA */
 #define SDHCI_QUIRK_FORCE_DMA                          (1<<1)
 /* Controller doesn't like some resets when there is no card inserted. */
 #define SDHCI_QUIRK_NO_CARD_NO_RESET                   (1<<2)
+/* Controller doesn't like clearing the power reg before a change */
 #define SDHCI_QUIRK_SINGLE_POWER_WRITE                 (1<<3)
+/* Controller has flaky internal state so reset it on each ios change */
 #define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS              (1<<4)
+/* Controller has an unusable DMA engine */
 #define SDHCI_QUIRK_BROKEN_DMA                         (1<<5)
+/* Controller can only DMA from 32-bit aligned addresses */
+#define SDHCI_QUIRK_32BIT_DMA_ADDR                     (1<<6)
+/* Controller can only DMA chunk sizes that are a multiple of 32 bits */
+#define SDHCI_QUIRK_32BIT_DMA_SIZE                     (1<<7)
+/* Controller needs to be reset after each request to stay stable */
+#define SDHCI_QUIRK_RESET_AFTER_REQUEST                        (1<<8)
 
 static const struct pci_device_id pci_ids[] __devinitdata = {
        {
@@ -97,6 +117,16 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
                                  SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS,
        },
 
+       {
+               .vendor         = PCI_VENDOR_ID_JMICRON,
+               .device         = PCI_DEVICE_ID_JMICRON_JMB38X_SD,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .driver_data    = SDHCI_QUIRK_32BIT_DMA_ADDR |
+                                 SDHCI_QUIRK_32BIT_DMA_SIZE |
+                                 SDHCI_QUIRK_RESET_AFTER_REQUEST,
+       },
+
        {       /* Generic SD host controller */
                PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
        },
@@ -419,7 +449,29 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
 
        writeb(count, host->ioaddr + SDHCI_TIMEOUT_CONTROL);
 
-       if (host->flags & SDHCI_USE_DMA) {
+       if (host->flags & SDHCI_USE_DMA)
+               host->flags |= SDHCI_REQ_USE_DMA;
+
+       if (unlikely((host->flags & SDHCI_REQ_USE_DMA) &&
+               (host->chip->quirks & SDHCI_QUIRK_32BIT_DMA_SIZE) &&
+               ((data->blksz * data->blocks) & 0x3))) {
+               DBG("Reverting to PIO because of transfer size (%d)\n",
+                       data->blksz * data->blocks);
+               host->flags &= ~SDHCI_REQ_USE_DMA;
+       }
+
+       /*
+        * The assumption here being that alignment is the same after
+        * translation to device address space.
+        */
+       if (unlikely((host->flags & SDHCI_REQ_USE_DMA) &&
+               (host->chip->quirks & SDHCI_QUIRK_32BIT_DMA_ADDR) &&
+               (data->sg->offset & 0x3))) {
+               DBG("Reverting to PIO because of bad alignment\n");
+               host->flags &= ~SDHCI_REQ_USE_DMA;
+       }
+
+       if (host->flags & SDHCI_REQ_USE_DMA) {
                int count;
 
                count = pci_map_sg(host->chip->pdev, data->sg, data->sg_len,
@@ -456,7 +508,7 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
                mode |= SDHCI_TRNS_MULTI;
        if (data->flags & MMC_DATA_READ)
                mode |= SDHCI_TRNS_READ;
-       if (host->flags & SDHCI_USE_DMA)
+       if (host->flags & SDHCI_REQ_USE_DMA)
                mode |= SDHCI_TRNS_DMA;
 
        writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE);
@@ -472,7 +524,7 @@ static void sdhci_finish_data(struct sdhci_host *host)
        data = host->data;
        host->data = NULL;
 
-       if (host->flags & SDHCI_USE_DMA) {
+       if (host->flags & SDHCI_REQ_USE_DMA) {
                pci_unmap_sg(host->chip->pdev, data->sg, data->sg_len,
                        (data->flags & MMC_DATA_READ)?PCI_DMA_FROMDEVICE:PCI_DMA_TODEVICE);
        }
@@ -886,7 +938,8 @@ static void sdhci_tasklet_finish(unsigned long param)
         */
        if (mrq->cmd->error ||
                (mrq->data && (mrq->data->error ||
-               (mrq->data->stop && mrq->data->stop->error)))) {
+               (mrq->data->stop && mrq->data->stop->error))) ||
+               (host->chip->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST)) {
 
                /* Some controllers need this kick or reset won't work here */
                if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) {
@@ -1284,7 +1337,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
 
        version = readw(host->ioaddr + SDHCI_HOST_VERSION);
        version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT;
-       if (version != 0) {
+       if (version > 1) {
                printk(KERN_ERR "%s: Unknown controller version (%d). "
                        "You may experience problems.\n", host->slot_descr,
                        version);
index 05195ea900f490e1884a72de5a3d4081e61f38b5..e4d77b038bfa5e9e12c976294c3dfecb5b86d156 100644 (file)
@@ -171,7 +171,8 @@ struct sdhci_host {
        spinlock_t              lock;           /* Mutex */
 
        int                     flags;          /* Host attributes */
-#define SDHCI_USE_DMA          (1<<0)
+#define SDHCI_USE_DMA          (1<<0)          /* Host is DMA capable */
+#define SDHCI_REQ_USE_DMA      (1<<1)          /* Use DMA for this req. */
 
        unsigned int            max_clk;        /* Max possible freq (MHz) */
        unsigned int            timeout_clk;    /* Timeout freq (KHz) */
index a9eb1c516247ef5b69104682bb20e208877041cd..1707f98c322c589c144b59d19cd9a52cbb22377a 100644 (file)
@@ -1504,9 +1504,12 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
        int ret, wbufsize, word_gap, words;
        const struct kvec *vec;
        unsigned long vec_seek;
+       unsigned long initial_adr;
+       int initial_len = len;
 
        wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
        adr += chip->start;
+       initial_adr = adr;
        cmd_adr = adr & ~(wbufsize-1);
 
        /* Let's determine this according to the interleave only once */
@@ -1519,7 +1522,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
                return ret;
        }
 
-       XIP_INVAL_CACHED_RANGE(map, adr, len);
+       XIP_INVAL_CACHED_RANGE(map, initial_adr, initial_len);
        ENABLE_VPP(map);
        xip_disable(map, chip, cmd_adr);
 
@@ -1610,7 +1613,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
        chip->state = FL_WRITING;
 
        ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr,
-                                  adr, len,
+                                  initial_adr, initial_len,
                                   chip->buffer_write_time);
        if (ret) {
                map_write(map, CMD(0x70), cmd_adr);
index edda6e10ebe50144304316737f2e9884197c16bf..8fafac987e0bea25df8b53d562a4b8dbc19c763a 100644 (file)
@@ -385,6 +385,7 @@ static int __init el3_probe(int card_idx)
 #if defined(__ISAPNP__)
        static int pnp_cards;
        struct pnp_dev *idev = NULL;
+       int pnp_found = 0;
 
        if (nopnp == 1)
                goto no_pnp;
@@ -430,6 +431,7 @@ __again:
                        pnp_cards++;
 
                        netdev_boot_setup_check(dev);
+                       pnp_found = 1;
                        goto found;
                }
        }
@@ -560,6 +562,8 @@ no_pnp:
        lp = netdev_priv(dev);
 #if defined(__ISAPNP__)
        lp->dev = &idev->dev;
+       if (pnp_found)
+               lp->type = EL3_PNP;
 #endif
        err = el3_common_init(dev);
 
index d9107e542dface363ef53d71339361d99f7619de..114771a2a133888c6021dfce0aee9f7f2e83287f 100644 (file)
@@ -166,16 +166,6 @@ config NET_SB1000
 
          If you don't have this card, of course say N.
 
-config IP1000
-       tristate "IP1000 Gigabit Ethernet support"
-       depends on PCI && EXPERIMENTAL
-       select MII
-       ---help---
-         This driver supports IP1000 gigabit Ethernet cards.
-
-         To compile this driver as a module, choose M here: the module
-         will be called ipg.  This is recommended.
-
 source "drivers/net/arcnet/Kconfig"
 
 source "drivers/net/phy/Kconfig"
@@ -1992,6 +1982,16 @@ config E1000E
          To compile this driver as a module, choose M here. The module
          will be called e1000e.
 
+config IP1000
+       tristate "IP1000 Gigabit Ethernet support"
+       depends on PCI && EXPERIMENTAL
+       select MII
+       ---help---
+         This driver supports IP1000 gigabit Ethernet cards.
+
+         To compile this driver as a module, choose M here: the module
+         will be called ipg.  This is recommended.
+
 source "drivers/net/ixp2000/Kconfig"
 
 config MYRI_SBUS
index 7df31b5561cc02000cbc44d1ea2048bd016f4e58..d66915d82b24a7795ce040b3a785c3f6532aac14 100644 (file)
 
 #define DRV_MODULE_NAME                "cassini"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "1.4"
-#define DRV_MODULE_RELDATE     "1 July 2004"
+#define DRV_MODULE_VERSION     "1.5"
+#define DRV_MODULE_RELDATE     "4 Jan 2008"
 
 #define CAS_DEF_MSG_ENABLE       \
        (NETIF_MSG_DRV          | \
@@ -336,30 +336,6 @@ static inline void cas_mask_intr(struct cas *cp)
                cas_disable_irq(cp, i);
 }
 
-static inline void cas_buffer_init(cas_page_t *cp)
-{
-       struct page *page = cp->buffer;
-       atomic_set((atomic_t *)&page->lru.next, 1);
-}
-
-static inline int cas_buffer_count(cas_page_t *cp)
-{
-       struct page *page = cp->buffer;
-       return atomic_read((atomic_t *)&page->lru.next);
-}
-
-static inline void cas_buffer_inc(cas_page_t *cp)
-{
-       struct page *page = cp->buffer;
-       atomic_inc((atomic_t *)&page->lru.next);
-}
-
-static inline void cas_buffer_dec(cas_page_t *cp)
-{
-       struct page *page = cp->buffer;
-       atomic_dec((atomic_t *)&page->lru.next);
-}
-
 static void cas_enable_irq(struct cas *cp, const int ring)
 {
        if (ring == 0) { /* all but TX_DONE */
@@ -497,7 +473,6 @@ static int cas_page_free(struct cas *cp, cas_page_t *page)
 {
        pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size,
                       PCI_DMA_FROMDEVICE);
-       cas_buffer_dec(page);
        __free_pages(page->buffer, cp->page_order);
        kfree(page);
        return 0;
@@ -527,7 +502,6 @@ static cas_page_t *cas_page_alloc(struct cas *cp, const gfp_t flags)
        page->buffer = alloc_pages(flags, cp->page_order);
        if (!page->buffer)
                goto page_err;
-       cas_buffer_init(page);
        page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0,
                                      cp->page_size, PCI_DMA_FROMDEVICE);
        return page;
@@ -606,7 +580,7 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags)
        list_for_each_safe(elem, tmp, &list) {
                cas_page_t *page = list_entry(elem, cas_page_t, list);
 
-               if (cas_buffer_count(page) > 1)
+               if (page_count(page->buffer) > 1)
                        continue;
 
                list_del(elem);
@@ -1374,7 +1348,7 @@ static inline cas_page_t *cas_page_spare(struct cas *cp, const int index)
        cas_page_t *page = cp->rx_pages[1][index];
        cas_page_t *new;
 
-       if (cas_buffer_count(page) == 1)
+       if (page_count(page->buffer) == 1)
                return page;
 
        new = cas_page_dequeue(cp);
@@ -1394,7 +1368,7 @@ static cas_page_t *cas_page_swap(struct cas *cp, const int ring,
        cas_page_t **page1 = cp->rx_pages[1];
 
        /* swap if buffer is in use */
-       if (cas_buffer_count(page0[index]) > 1) {
+       if (page_count(page0[index]->buffer) > 1) {
                cas_page_t *new = cas_page_spare(cp, index);
                if (new) {
                        page1[index] = page0[index];
@@ -1979,6 +1953,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
        struct cas_page *page;
        struct sk_buff *skb;
        void *addr, *crcaddr;
+       __sum16 csum;
        char *p;
 
        hlen = CAS_VAL(RX_COMP2_HDR_SIZE, words[1]);
@@ -2062,10 +2037,10 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
 
                skb_shinfo(skb)->nr_frags++;
                skb->data_len += hlen - swivel;
+               skb->truesize += hlen - swivel;
                skb->len      += hlen - swivel;
 
                get_page(page->buffer);
-               cas_buffer_inc(page);
                frag->page = page->buffer;
                frag->page_offset = off;
                frag->size = hlen - swivel;
@@ -2090,7 +2065,6 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
                        frag++;
 
                        get_page(page->buffer);
-                       cas_buffer_inc(page);
                        frag->page = page->buffer;
                        frag->page_offset = 0;
                        frag->size = hlen;
@@ -2158,14 +2132,15 @@ end_copy_pkt:
                skb_put(skb, alloclen);
        }
 
-       i = CAS_VAL(RX_COMP4_TCP_CSUM, words[3]);
+       csum = (__force __sum16)htons(CAS_VAL(RX_COMP4_TCP_CSUM, words[3]));
        if (cp->crc_size) {
                /* checksum includes FCS. strip it out. */
-               i = csum_fold(csum_partial(crcaddr, cp->crc_size, i));
+               csum = csum_fold(csum_partial(crcaddr, cp->crc_size,
+                                             csum_unfold(csum)));
                if (addr)
                        cas_page_unmap(addr);
        }
-       skb->csum = ntohs(i ^ 0xffff);
+       skb->csum = csum_unfold(~csum);
        skb->ip_summed = CHECKSUM_COMPLETE;
        skb->protocol = eth_type_trans(skb, cp->dev);
        return len;
@@ -2253,7 +2228,7 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num)
        released = 0;
        while (entry != last) {
                /* make a new buffer if it's still in use */
-               if (cas_buffer_count(page[entry]) > 1) {
+               if (page_count(page[entry]->buffer) > 1) {
                        cas_page_t *new = cas_page_dequeue(cp);
                        if (!new) {
                                /* let the timer know that we need to
@@ -2611,7 +2586,7 @@ static int cas_poll(struct napi_struct *napi, int budget)
 {
        struct cas *cp = container_of(napi, struct cas, napi);
        struct net_device *dev = cp->dev;
-       int i, enable_intr, todo, credits;
+       int i, enable_intr, credits;
        u32 status = readl(cp->regs + REG_INTR_STATUS);
        unsigned long flags;
 
@@ -4375,7 +4350,7 @@ static int cas_close(struct net_device *dev)
        struct cas *cp = netdev_priv(dev);
 
 #ifdef USE_NAPI
-       napi_enable(&cp->napi);
+       napi_disable(&cp->napi);
 #endif
        /* Make sure we don't get distracted by suspend/resume */
        mutex_lock(&cp->pm_mutex);
@@ -4872,6 +4847,90 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        return rc;
 }
 
+/* When this chip sits underneath an Intel 31154 bridge, it is the
+ * only subordinate device and we can tweak the bridge settings to
+ * reflect that fact.
+ */
+static void __devinit cas_program_bridge(struct pci_dev *cas_pdev)
+{
+       struct pci_dev *pdev = cas_pdev->bus->self;
+       u32 val;
+
+       if (!pdev)
+               return;
+
+       if (pdev->vendor != 0x8086 || pdev->device != 0x537c)
+               return;
+
+       /* Clear bit 10 (Bus Parking Control) in the Secondary
+        * Arbiter Control/Status Register which lives at offset
+        * 0x41.  Using a 32-bit word read/modify/write at 0x40
+        * is much simpler so that's how we do this.
+        */
+       pci_read_config_dword(pdev, 0x40, &val);
+       val &= ~0x00040000;
+       pci_write_config_dword(pdev, 0x40, val);
+
+       /* Max out the Multi-Transaction Timer settings since
+        * Cassini is the only device present.
+        *
+        * The register is 16-bit and lives at 0x50.  When the
+        * settings are enabled, it extends the GRANT# signal
+        * for a requestor after a transaction is complete.  This
+        * allows the next request to run without first needing
+        * to negotiate the GRANT# signal back.
+        *
+        * Bits 12:10 define the grant duration:
+        *
+        *      1       --      16 clocks
+        *      2       --      32 clocks
+        *      3       --      64 clocks
+        *      4       --      128 clocks
+        *      5       --      256 clocks
+        *
+        * All other values are illegal.
+        *
+        * Bits 09:00 define which REQ/GNT signal pairs get the
+        * GRANT# signal treatment.  We set them all.
+        */
+       pci_write_config_word(pdev, 0x50, (5 << 10) | 0x3ff);
+
+       /* The Read Prefecth Policy register is 16-bit and sits at
+        * offset 0x52.  It enables a "smart" pre-fetch policy.  We
+        * enable it and max out all of the settings since only one
+        * device is sitting underneath and thus bandwidth sharing is
+        * not an issue.
+        *
+        * The register has several 3 bit fields, which indicates a
+        * multiplier applied to the base amount of prefetching the
+        * chip would do.  These fields are at:
+        *
+        *      15:13   ---     ReRead Primary Bus
+        *      12:10   ---     FirstRead Primary Bus
+        *      09:07   ---     ReRead Secondary Bus
+        *      06:04   ---     FirstRead Secondary Bus
+        *
+        * Bits 03:00 control which REQ/GNT pairs the prefetch settings
+        * get enabled on.  Bit 3 is a grouped enabler which controls
+        * all of the REQ/GNT pairs from [8:3].  Bits 2 to 0 control
+        * the individual REQ/GNT pairs [2:0].
+        */
+       pci_write_config_word(pdev, 0x52,
+                             (0x7 << 13) |
+                             (0x7 << 10) |
+                             (0x7 <<  7) |
+                             (0x7 <<  4) |
+                             (0xf <<  0));
+
+       /* Force cacheline size to 0x8 */
+       pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x08);
+
+       /* Force latency timer to maximum setting so Cassini can
+        * sit on the bus as long as it likes.
+        */
+       pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xff);
+}
+
 static int __devinit cas_init_one(struct pci_dev *pdev,
                                  const struct pci_device_id *ent)
 {
@@ -4927,6 +4986,8 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
                printk(KERN_WARNING PFX "Could not enable MWI for %s\n",
                       pci_name(pdev));
 
+       cas_program_bridge(pdev);
+
        /*
         * On some architectures, the default cache line size set
         * by pci_try_set_mwi reduces perforamnce.  We have to increase
index 2f93f83342d2575e146f8999ff37bafb55170dd6..552af89ca1cf04f49165248293570132bdaa189a 100644 (file)
@@ -4122,8 +4122,8 @@ cas_saturn_patch_t cas_saturn_patch[] = {
                                                             inserted into
                                                             outgoing frame. */
 struct cas_tx_desc {
-       u64     control;
-       u64     buffer;
+       __le64     control;
+       __le64     buffer;
 };
 
 /* descriptor ring for free buffers contains page-sized buffers. the index
@@ -4131,8 +4131,8 @@ struct cas_tx_desc {
  * the completion ring.
  */
 struct cas_rx_desc {
-       u64     index;
-       u64     buffer;
+       __le64     index;
+       __le64     buffer;
 };
 
 /* received packets are put on the completion ring. */
@@ -4210,10 +4210,10 @@ struct cas_rx_desc {
 #define RX_INDEX_RELEASE                  0x0000000000002000ULL
 
 struct cas_rx_comp {
-       u64     word1;
-       u64     word2;
-       u64     word3;
-       u64     word4;
+       __le64     word1;
+       __le64     word2;
+       __le64     word3;
+       __le64     word4;
 };
 
 enum link_state {
@@ -4252,7 +4252,7 @@ struct cas_init_block {
        struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP];
        struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC];
        struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX];
-       u64 tx_compwb;
+       __le64 tx_compwb;
 };
 
 /* tiny buffers to deal with target abort issue. we allocate a bit
index 5066beb2e7bc43e3e4e6b6e30a47e198dc647467..47cce9cad30f0a6bc3bace63522b0c43956ac358 100644 (file)
@@ -332,7 +332,7 @@ parse_eeprom (struct net_device *dev)
 #endif
        /* Read eeprom */
        for (i = 0; i < 128; i++) {
-               ((u16 *) sromdata)[i] = le16_to_cpu (read_eeprom (ioaddr, i));
+               ((__le16 *) sromdata)[i] = cpu_to_le16(read_eeprom (ioaddr, i));
        }
 #ifdef MEM_MAPPING
        ioaddr = dev->base_addr;
@@ -516,7 +516,7 @@ rio_timer (unsigned long data)
                                          PCI_DMA_FROMDEVICE));
                        }
                        np->rx_ring[entry].fraginfo |=
-                           cpu_to_le64 (np->rx_buf_sz) << 48;
+                           cpu_to_le64((u64)np->rx_buf_sz << 48);
                        np->rx_ring[entry].status = 0;
                } /* end for */
        } /* end if */
@@ -584,11 +584,11 @@ alloc_list (struct net_device *dev)
                    cpu_to_le64 ( pci_map_single (
                                  np->pdev, skb->data, np->rx_buf_sz,
                                  PCI_DMA_FROMDEVICE));
-               np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48;
+               np->rx_ring[i].fraginfo |= cpu_to_le64((u64)np->rx_buf_sz << 48);
        }
 
        /* Set RFDListPtr */
-       writel (cpu_to_le32 (np->rx_ring_dma), dev->base_addr + RFDListPtr0);
+       writel (np->rx_ring_dma, dev->base_addr + RFDListPtr0);
        writel (0, dev->base_addr + RFDListPtr1);
 
        return;
@@ -620,15 +620,14 @@ start_xmit (struct sk_buff *skb, struct net_device *dev)
        }
 #endif
        if (np->vlan) {
-               tfc_vlan_tag =
-                   cpu_to_le64 (VLANTagInsert) |
-                   (cpu_to_le64 (np->vlan) << 32) |
-                   (cpu_to_le64 (skb->priority) << 45);
+               tfc_vlan_tag = VLANTagInsert |
+                   ((u64)np->vlan << 32) |
+                   ((u64)skb->priority << 45);
        }
        txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data,
                                                        skb->len,
                                                        PCI_DMA_TODEVICE));
-       txdesc->fraginfo |= cpu_to_le64 (skb->len) << 48;
+       txdesc->fraginfo |= cpu_to_le64((u64)skb->len << 48);
 
        /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode
         * Work around: Always use 1 descriptor in 10Mbps mode */
@@ -708,6 +707,11 @@ rio_interrupt (int irq, void *dev_instance)
        return IRQ_RETVAL(handled);
 }
 
+static inline dma_addr_t desc_to_dma(struct netdev_desc *desc)
+{
+       return le64_to_cpu(desc->fraginfo) & DMA_48BIT_MASK;
+}
+
 static void
 rio_free_tx (struct net_device *dev, int irq)
 {
@@ -725,11 +729,11 @@ rio_free_tx (struct net_device *dev, int irq)
        while (entry != np->cur_tx) {
                struct sk_buff *skb;
 
-               if (!(np->tx_ring[entry].status & TFDDone))
+               if (!(np->tx_ring[entry].status & cpu_to_le64(TFDDone)))
                        break;
                skb = np->tx_skbuff[entry];
                pci_unmap_single (np->pdev,
-                                 np->tx_ring[entry].fraginfo & DMA_48BIT_MASK,
+                                 desc_to_dma(&np->tx_ring[entry]),
                                  skb->len, PCI_DMA_TODEVICE);
                if (irq)
                        dev_kfree_skb_irq (skb);
@@ -831,13 +835,14 @@ receive_packet (struct net_device *dev)
                int pkt_len;
                u64 frame_status;
 
-               if (!(desc->status & RFDDone) ||
-                   !(desc->status & FrameStart) || !(desc->status & FrameEnd))
+               if (!(desc->status & cpu_to_le64(RFDDone)) ||
+                   !(desc->status & cpu_to_le64(FrameStart)) ||
+                   !(desc->status & cpu_to_le64(FrameEnd)))
                        break;
 
                /* Chip omits the CRC. */
-               pkt_len = le64_to_cpu (desc->status & 0xffff);
-               frame_status = le64_to_cpu (desc->status);
+               frame_status = le64_to_cpu(desc->status);
+               pkt_len = frame_status & 0xffff;
                if (--cnt < 0)
                        break;
                /* Update rx error statistics, drop packet. */
@@ -857,15 +862,14 @@ receive_packet (struct net_device *dev)
                        /* Small skbuffs for short packets */
                        if (pkt_len > copy_thresh) {
                                pci_unmap_single (np->pdev,
-                                                 desc->fraginfo & DMA_48BIT_MASK,
+                                                 desc_to_dma(desc),
                                                  np->rx_buf_sz,
                                                  PCI_DMA_FROMDEVICE);
                                skb_put (skb = np->rx_skbuff[entry], pkt_len);
                                np->rx_skbuff[entry] = NULL;
                        } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) {
                                pci_dma_sync_single_for_cpu(np->pdev,
-                                                           desc->fraginfo &
-                                                               DMA_48BIT_MASK,
+                                                           desc_to_dma(desc),
                                                            np->rx_buf_sz,
                                                            PCI_DMA_FROMDEVICE);
                                /* 16 byte align the IP header */
@@ -875,8 +879,7 @@ receive_packet (struct net_device *dev)
                                                  pkt_len);
                                skb_put (skb, pkt_len);
                                pci_dma_sync_single_for_device(np->pdev,
-                                                              desc->fraginfo &
-                                                                DMA_48BIT_MASK,
+                                                              desc_to_dma(desc),
                                                               np->rx_buf_sz,
                                                               PCI_DMA_FROMDEVICE);
                        }
@@ -919,7 +922,7 @@ receive_packet (struct net_device *dev)
                                          PCI_DMA_FROMDEVICE));
                }
                np->rx_ring[entry].fraginfo |=
-                   cpu_to_le64 (np->rx_buf_sz) << 48;
+                   cpu_to_le64((u64)np->rx_buf_sz << 48);
                np->rx_ring[entry].status = 0;
                entry = (entry + 1) % RX_RING_SIZE;
        }
@@ -1121,7 +1124,7 @@ set_multicast (struct net_device *dev)
 
        hash_table[0] = hash_table[1] = 0;
        /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */
-       hash_table[1] |= cpu_to_le32(0x02000000);
+       hash_table[1] |= 0x02000000;
        if (dev->flags & IFF_PROMISC) {
                /* Receive all frames promiscuously. */
                rx_mode = ReceiveAllFrames;
@@ -1762,7 +1765,7 @@ rio_close (struct net_device *dev)
                skb = np->rx_skbuff[i];
                if (skb) {
                        pci_unmap_single(np->pdev,
-                                        np->rx_ring[i].fraginfo & DMA_48BIT_MASK,
+                                        desc_to_dma(&np->rx_ring[i]),
                                         skb->len, PCI_DMA_FROMDEVICE);
                        dev_kfree_skb (skb);
                        np->rx_skbuff[i] = NULL;
@@ -1772,7 +1775,7 @@ rio_close (struct net_device *dev)
                skb = np->tx_skbuff[i];
                if (skb) {
                        pci_unmap_single(np->pdev,
-                                        np->tx_ring[i].fraginfo & DMA_48BIT_MASK,
+                                        desc_to_dma(&np->tx_ring[i]),
                                         skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb (skb);
                        np->tx_skbuff[i] = NULL;
index 5b801775f42dea3806b814a3424ae9880015a8a7..014b77ce96df251701b5213f56af1864b6539ea4 100644 (file)
@@ -633,9 +633,9 @@ struct mii_data {
 
 /* The Rx and Tx buffer descriptors. */
 struct netdev_desc {
-       u64 next_desc;
-       u64 status;
-       u64 fraginfo;
+       __le64 next_desc;
+       __le64 status;
+       __le64 fraginfo;
 };
 
 #define PRIV_ALIGN     15      /* Required alignment mask */
index e1c8a0d023ea13546f5cb4fb006dfa503a874d45..b87402bc83081fd808681b16166b25b1c20a2020 100644 (file)
@@ -1991,13 +1991,12 @@ static int e100_poll(struct napi_struct *napi, int budget)
        struct nic *nic = container_of(napi, struct nic, napi);
        struct net_device *netdev = nic->netdev;
        unsigned int work_done = 0;
-       int tx_cleaned;
 
        e100_rx_clean(nic, &work_done, budget);
-       tx_cleaned = e100_tx_clean(nic);
+       e100_tx_clean(nic);
 
-       /* If no Rx and Tx cleanup work was done, exit polling mode. */
-       if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) {
+       /* If budget not fully consumed, exit the polling mode */
+       if (work_done < budget) {
                netif_rx_complete(netdev, napi);
                e100_enable_irq(nic);
        }
@@ -2737,8 +2736,9 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
                pci_enable_wake(pdev, PCI_D3cold, 0);
        }
 
-       pci_disable_device(pdev);
        free_irq(pdev->irq, netdev);
+
+       pci_disable_device(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
 
        return 0;
@@ -2780,6 +2780,8 @@ static void e100_shutdown(struct pci_dev *pdev)
                pci_enable_wake(pdev, PCI_D3cold, 0);
        }
 
+       free_irq(pdev->irq, netdev);
+
        pci_disable_device(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
 }
index 4f37506ad3744656c86d102f63fb66aac2185876..13d57b0a88fa0936a02273b8e292baa6262ecca8 100644 (file)
@@ -3919,32 +3919,26 @@ e1000_clean(struct napi_struct *napi, int budget)
 {
        struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi);
        struct net_device *poll_dev = adapter->netdev;
-       int tx_cleaned = 0, work_done = 0;
+       int work_done = 0;
 
        /* Must NOT use netdev_priv macro here. */
        adapter = poll_dev->priv;
 
-       /* Keep link state information with original netdev */
-       if (!netif_carrier_ok(poll_dev))
-               goto quit_polling;
-
        /* e1000_clean is called per-cpu.  This lock protects
         * tx_ring[0] from being cleaned by multiple cpus
         * simultaneously.  A failure obtaining the lock means
         * tx_ring[0] is currently being cleaned anyway. */
        if (spin_trylock(&adapter->tx_queue_lock)) {
-               tx_cleaned = e1000_clean_tx_irq(adapter,
-                                               &adapter->tx_ring[0]);
+               e1000_clean_tx_irq(adapter,
+                                  &adapter->tx_ring[0]);
                spin_unlock(&adapter->tx_queue_lock);
        }
 
        adapter->clean_rx(adapter, &adapter->rx_ring[0],
                          &work_done, budget);
 
-       /* If no Tx and not enough Rx work done, exit the polling mode */
-       if ((!tx_cleaned && (work_done == 0)) ||
-          !netif_running(poll_dev)) {
-quit_polling:
+       /* If budget not fully consumed, exit the polling mode */
+       if (work_done < budget) {
                if (likely(adapter->itr_setting & 3))
                        e1000_set_itr(adapter);
                netif_rx_complete(poll_dev, napi);
index 4fd2e23720b69f080569b9c9a789ba2b8fcb7964..4a6fc745377637e85a5784524bd7da58106cd7e5 100644 (file)
@@ -1384,30 +1384,24 @@ static int e1000_clean(struct napi_struct *napi, int budget)
 {
        struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi);
        struct net_device *poll_dev = adapter->netdev;
-       int tx_cleaned = 0, work_done = 0;
+       int work_done = 0;
 
        /* Must NOT use netdev_priv macro here. */
        adapter = poll_dev->priv;
 
-       /* Keep link state information with original netdev */
-       if (!netif_carrier_ok(poll_dev))
-               goto quit_polling;
-
        /* e1000_clean is called per-cpu.  This lock protects
         * tx_ring from being cleaned by multiple cpus
         * simultaneously.  A failure obtaining the lock means
         * tx_ring is currently being cleaned anyway. */
        if (spin_trylock(&adapter->tx_queue_lock)) {
-               tx_cleaned = e1000_clean_tx_irq(adapter);
+               e1000_clean_tx_irq(adapter);
                spin_unlock(&adapter->tx_queue_lock);
        }
 
        adapter->clean_rx(adapter, &work_done, budget);
 
-       /* If no Tx and not enough Rx work done, exit the polling mode */
-       if ((!tx_cleaned && (work_done < budget)) ||
-          !netif_running(poll_dev)) {
-quit_polling:
+       /* If budget not fully consumed, exit the polling mode */
+       if (work_done < budget) {
                if (adapter->itr_setting & 3)
                        e1000_set_itr(adapter);
                netif_rx_complete(poll_dev, napi);
index ecdd3fc8d70ca8af89dc4fbd2f3033139a1fbeb0..0b365b8d947ba8dabd1dd28e94f1710d823cca77 100644 (file)
@@ -1273,7 +1273,7 @@ rx_action:
 
        epic_rx_err(dev, ep);
 
-       if (netif_running(dev) && (work_done < budget)) {
+       if (work_done < budget) {
                unsigned long flags;
                int more;
 
index 8d2904fa57896d33db21f274ca9181fb6f2f828a..ab9637ab3a8d9ccf9ff26e7356a70a559227139d 100644 (file)
@@ -476,11 +476,6 @@ static int fec_enet_rx_common(struct fec_enet_private *ep,
        __u16 pkt_len, sc;
        int curidx;
 
-       if (fpi->use_napi) {
-               if (!netif_running(dev))
-                       return 0;
-       }
-
        /*
         * First, grab all of the stats for the incoming packet.
         * These get messed up if we get called due to a busy condition.
index 79f7eade477356938e113543e354baabef3d81be..f91ee700e605c051990afb27d350ac38c296b6ff 100644 (file)
@@ -568,8 +568,9 @@ static void mpc52xx_fec_reset_stats(struct net_device *dev)
        struct mpc52xx_fec __iomem *fec = priv->fec;
 
        out_be32(&fec->mib_control, FEC_MIB_DISABLE);
-       memset_io(&fec->rmon_t_drop, 0, (__force u32)&fec->reserved10 -
-                       (__force u32)&fec->rmon_t_drop);
+       memset_io(&fec->rmon_t_drop, 0,
+                  offsetof(struct mpc52xx_fec, reserved10) -
+                  offsetof(struct mpc52xx_fec, rmon_t_drop));
        out_be32(&fec->mib_control, 0);
 
        memset(&dev->stats, 0, sizeof(dev->stats));
index a96583cceb5ef77c1e374caa47a45ec43471f151..f84c752997a46c92e03133691ab08d61d37c0c27 100644 (file)
@@ -5199,10 +5199,6 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
                dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff;
                dev->dev_addr[4] = (np->orig_mac[0] >>  8) & 0xff;
                dev->dev_addr[5] = (np->orig_mac[0] >>  0) & 0xff;
-               /* set permanent address to be correct aswell */
-               np->orig_mac[0] = (dev->dev_addr[0] << 0) + (dev->dev_addr[1] << 8) +
-                       (dev->dev_addr[2] << 16) + (dev->dev_addr[3] << 24);
-               np->orig_mac[1] = (dev->dev_addr[4] << 0) + (dev->dev_addr[5] << 8);
                writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll);
        }
        memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
@@ -5414,6 +5410,8 @@ static void __devexit nv_remove(struct pci_dev *pci_dev)
         */
        writel(np->orig_mac[0], base + NvRegMacAddrA);
        writel(np->orig_mac[1], base + NvRegMacAddrB);
+       writel(readl(base + NvRegTransmitPoll) & ~NVREG_TRANSMITPOLL_MAC_ADDR_REV,
+              base + NvRegTransmitPoll);
 
        /* free all structures */
        free_rings(dev);
index f2a4d399a6e5137f63fab69a52677317d6d7c9c9..c83bd65600883d721f40d54d17a8f7e37ab26480 100644 (file)
@@ -96,9 +96,6 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
        u16 pkt_len, sc;
        int curidx;
 
-       if (!netif_running(dev))
-               return 0;
-
        /*
         * First, grab all of the stats for the incoming packet.
         * These get messed up if we get called due to a busy condition.
@@ -897,14 +894,21 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs,
 static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        struct fs_enet_private *fep = netdev_priv(dev);
+
+       if (!fep->phydev)
+               return -ENODEV;
+
        return phy_ethtool_gset(fep->phydev, cmd);
 }
 
 static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        struct fs_enet_private *fep = netdev_priv(dev);
-       phy_ethtool_sset(fep->phydev, cmd);
-       return 0;
+
+       if (!fep->phydev)
+               return -ENODEV;
+
+       return phy_ethtool_sset(fep->phydev, cmd);
 }
 
 static int fs_nway_reset(struct net_device *dev)
index ed407c85708f13c31bcbaf4ad68dc4be995b6fe4..b53f6b6491b3f049bc69562dfbadf0536d47e409 100644 (file)
@@ -204,8 +204,10 @@ KERN_INFO "   Further modifications by Keith Underwood <keithu@parl.clemson.edu>
 /* Condensed bus+endian portability operations. */
 #if ADDRLEN == 64
 #define cpu_to_leXX(addr)      cpu_to_le64(addr)
+#define leXX_to_cpu(addr)      le64_to_cpu(addr)
 #else
 #define cpu_to_leXX(addr)      cpu_to_le32(addr)
+#define leXX_to_cpu(addr)      le32_to_cpu(addr)
 #endif
 
 
@@ -465,12 +467,12 @@ enum intr_status_bits {
 
 /* The Hamachi Rx and Tx buffer descriptors. */
 struct hamachi_desc {
-       u32 status_n_length;
+       __le32 status_n_length;
 #if ADDRLEN == 64
        u32 pad;
-       u64 addr;
+       __le64 addr;
 #else
-       u32 addr;
+       __le32 addr;
 #endif
 };
 
@@ -874,13 +876,13 @@ static int hamachi_open(struct net_device *dev)
 
 #if ADDRLEN == 64
        /* writellll anyone ? */
-       writel(cpu_to_le64(hmp->rx_ring_dma), ioaddr + RxPtr);
-       writel(cpu_to_le64(hmp->rx_ring_dma) >> 32, ioaddr + RxPtr + 4);
-       writel(cpu_to_le64(hmp->tx_ring_dma), ioaddr + TxPtr);
-       writel(cpu_to_le64(hmp->tx_ring_dma) >> 32, ioaddr + TxPtr + 4);
+       writel(hmp->rx_ring_dma, ioaddr + RxPtr);
+       writel(hmp->rx_ring_dma >> 32, ioaddr + RxPtr + 4);
+       writel(hmp->tx_ring_dma, ioaddr + TxPtr);
+       writel(hmp->tx_ring_dma >> 32, ioaddr + TxPtr + 4);
 #else
-       writel(cpu_to_le32(hmp->rx_ring_dma), ioaddr + RxPtr);
-       writel(cpu_to_le32(hmp->tx_ring_dma), ioaddr + TxPtr);
+       writel(hmp->rx_ring_dma, ioaddr + RxPtr);
+       writel(hmp->tx_ring_dma, ioaddr + TxPtr);
 #endif
 
        /* TODO:  It would make sense to organize this as words since the card
@@ -1019,8 +1021,8 @@ static inline int hamachi_tx(struct net_device *dev)
                skb = hmp->tx_skbuff[entry];
                if (skb) {
                        pci_unmap_single(hmp->pci_dev,
-                               hmp->tx_ring[entry].addr, skb->len,
-                               PCI_DMA_TODEVICE);
+                               leXX_to_cpu(hmp->tx_ring[entry].addr),
+                               skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
                        hmp->tx_skbuff[entry] = NULL;
                }
@@ -1071,10 +1073,10 @@ static void hamachi_tx_timeout(struct net_device *dev)
        {
                printk(KERN_DEBUG "  Rx ring %p: ", hmp->rx_ring);
                for (i = 0; i < RX_RING_SIZE; i++)
-                       printk(" %8.8x", (unsigned int)hmp->rx_ring[i].status_n_length);
+                       printk(" %8.8x", le32_to_cpu(hmp->rx_ring[i].status_n_length));
                printk("\n"KERN_DEBUG"  Tx ring %p: ", hmp->tx_ring);
                for (i = 0; i < TX_RING_SIZE; i++)
-                       printk(" %4.4x", hmp->tx_ring[i].status_n_length);
+                       printk(" %4.4x", le32_to_cpu(hmp->tx_ring[i].status_n_length));
                printk("\n");
        }
 
@@ -1099,14 +1101,15 @@ static void hamachi_tx_timeout(struct net_device *dev)
                struct sk_buff *skb;
 
                if (i >= TX_RING_SIZE - 1)
-                       hmp->tx_ring[i].status_n_length = cpu_to_le32(
-                               DescEndRing |
-                               (hmp->tx_ring[i].status_n_length & 0x0000FFFF));
+                       hmp->tx_ring[i].status_n_length =
+                               cpu_to_le32(DescEndRing) |
+                               (hmp->tx_ring[i].status_n_length &
+                                cpu_to_le32(0x0000ffff));
                else
-                       hmp->tx_ring[i].status_n_length &= 0x0000ffff;
+                       hmp->tx_ring[i].status_n_length &= cpu_to_le32(0x0000ffff);
                skb = hmp->tx_skbuff[i];
                if (skb){
-                       pci_unmap_single(hmp->pci_dev, hmp->tx_ring[i].addr,
+                       pci_unmap_single(hmp->pci_dev, leXX_to_cpu(hmp->tx_ring[i].addr),
                                skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
                        hmp->tx_skbuff[i] = NULL;
@@ -1128,7 +1131,8 @@ static void hamachi_tx_timeout(struct net_device *dev)
                struct sk_buff *skb = hmp->rx_skbuff[i];
 
                if (skb){
-                       pci_unmap_single(hmp->pci_dev, hmp->rx_ring[i].addr,
+                       pci_unmap_single(hmp->pci_dev,
+                               leXX_to_cpu(hmp->rx_ring[i].addr),
                                hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
                        dev_kfree_skb(skb);
                        hmp->rx_skbuff[i] = NULL;
@@ -1420,7 +1424,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance)
                                        /* Free the original skb. */
                                        if (skb){
                                                pci_unmap_single(hmp->pci_dev,
-                                                       hmp->tx_ring[entry].addr,
+                                                       leXX_to_cpu(hmp->tx_ring[entry].addr),
                                                        skb->len,
                                                        PCI_DMA_TODEVICE);
                                                dev_kfree_skb_irq(skb);
@@ -1500,11 +1504,11 @@ static int hamachi_rx(struct net_device *dev)
                if (desc_status & DescOwn)
                        break;
                pci_dma_sync_single_for_cpu(hmp->pci_dev,
-                                           desc->addr,
+                                           leXX_to_cpu(desc->addr),
                                            hmp->rx_buf_sz,
                                            PCI_DMA_FROMDEVICE);
                buf_addr = (u8 *) hmp->rx_skbuff[entry]->data;
-               frame_status = le32_to_cpu(get_unaligned((s32*)&(buf_addr[data_size - 12])));
+               frame_status = le32_to_cpu(get_unaligned((__le32*)&(buf_addr[data_size - 12])));
                if (hamachi_debug > 4)
                        printk(KERN_DEBUG "  hamachi_rx() status was %8.8x.\n",
                                frame_status);
@@ -1518,9 +1522,9 @@ static int hamachi_rx(struct net_device *dev)
                                   dev->name, desc, &hmp->rx_ring[hmp->cur_rx % RX_RING_SIZE]);
                        printk(KERN_WARNING "%s: Oversized Ethernet frame -- next status %x/%x last status %x.\n",
                                   dev->name,
-                                  hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length & 0xffff0000,
-                                  hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length & 0x0000ffff,
-                                  hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length);
+                                  le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0xffff0000,
+                                  le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0x0000ffff,
+                                  le32_to_cpu(hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length));
                        hmp->stats.rx_length_errors++;
                } /* else  Omit for prototype errata??? */
                if (frame_status & 0x00380000) {
@@ -1566,7 +1570,7 @@ static int hamachi_rx(struct net_device *dev)
 #endif
                                skb_reserve(skb, 2);    /* 16 byte align the IP header */
                                pci_dma_sync_single_for_cpu(hmp->pci_dev,
-                                                           hmp->rx_ring[entry].addr,
+                                                           leXX_to_cpu(hmp->rx_ring[entry].addr),
                                                            hmp->rx_buf_sz,
                                                            PCI_DMA_FROMDEVICE);
                                /* Call copy + cksum if available. */
@@ -1579,12 +1583,12 @@ static int hamachi_rx(struct net_device *dev)
                                        + entry*sizeof(*desc), pkt_len);
 #endif
                                pci_dma_sync_single_for_device(hmp->pci_dev,
-                                                              hmp->rx_ring[entry].addr,
+                                                              leXX_to_cpu(hmp->rx_ring[entry].addr),
                                                               hmp->rx_buf_sz,
                                                               PCI_DMA_FROMDEVICE);
                        } else {
                                pci_unmap_single(hmp->pci_dev,
-                                                hmp->rx_ring[entry].addr,
+                                                leXX_to_cpu(hmp->rx_ring[entry].addr),
                                                 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
                                skb_put(skb = hmp->rx_skbuff[entry], pkt_len);
                                hmp->rx_skbuff[entry] = NULL;
@@ -1787,21 +1791,21 @@ static int hamachi_close(struct net_device *dev)
        for (i = 0; i < RX_RING_SIZE; i++) {
                skb = hmp->rx_skbuff[i];
                hmp->rx_ring[i].status_n_length = 0;
-               hmp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */
                if (skb) {
                        pci_unmap_single(hmp->pci_dev,
-                               hmp->rx_ring[i].addr, hmp->rx_buf_sz,
-                               PCI_DMA_FROMDEVICE);
+                               leXX_to_cpu(hmp->rx_ring[i].addr),
+                               hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
                        dev_kfree_skb(skb);
                        hmp->rx_skbuff[i] = NULL;
                }
+               hmp->rx_ring[i].addr = cpu_to_leXX(0xBADF00D0); /* An invalid address. */
        }
        for (i = 0; i < TX_RING_SIZE; i++) {
                skb = hmp->tx_skbuff[i];
                if (skb) {
                        pci_unmap_single(hmp->pci_dev,
-                               hmp->tx_ring[i].addr, skb->len,
-                               PCI_DMA_TODEVICE);
+                               leXX_to_cpu(hmp->tx_ring[i].addr),
+                               skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
                        hmp->tx_skbuff[i] = NULL;
                }
index a2fc660ca5d436e35864a6bed6b46581eaacbf50..86b756a30784f844ffd48868edfe5a9161d01d2a 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "core.h"
 
-static spinlock_t emac_dbg_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(emac_dbg_lock);
 
 static void emac_desc_dump(struct emac_instance *p)
 {
index 3021234b1e173f5653603bcde3998db26ea3abba..d2fb88d5cda2773675e87de42d3dee6e0789e8f7 100644 (file)
@@ -320,10 +320,22 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
 void
 ixgb_reset(struct ixgb_adapter *adapter)
 {
+       struct ixgb_hw *hw = &adapter->hw;
 
-       ixgb_adapter_stop(&adapter->hw);
-       if(!ixgb_init_hw(&adapter->hw))
+       ixgb_adapter_stop(hw);
+       if (!ixgb_init_hw(hw))
                DPRINTK(PROBE, ERR, "ixgb_init_hw failed.\n");
+
+       /* restore frame size information */
+       IXGB_WRITE_REG(hw, MFS, hw->max_frame_size << IXGB_MFS_SHIFT);
+       if (hw->max_frame_size >
+           IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) {
+               u32 ctrl0 = IXGB_READ_REG(hw, CTRL0);
+               if (!(ctrl0 & IXGB_CTRL0_JFE)) {
+                       ctrl0 |= IXGB_CTRL0_JFE;
+                       IXGB_WRITE_REG(hw, CTRL0, ctrl0);
+               }
+       }
 }
 
 /**
@@ -1775,14 +1787,13 @@ ixgb_clean(struct napi_struct *napi, int budget)
 {
        struct ixgb_adapter *adapter = container_of(napi, struct ixgb_adapter, napi);
        struct net_device *netdev = adapter->netdev;
-       int tx_cleaned;
        int work_done = 0;
 
-       tx_cleaned = ixgb_clean_tx_irq(adapter);
+       ixgb_clean_tx_irq(adapter);
        ixgb_clean_rx_irq(adapter, &work_done, budget);
 
-       /* if no Tx and not enough Rx work done, exit the polling mode */
-       if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) {
+       /* If budget not fully consumed, exit the polling mode */
+       if (work_done < budget) {
                netif_rx_complete(netdev, napi);
                ixgb_irq_enable(adapter);
        }
index 00bc525c656071aebb25b8c4151eba246ce72686..a56491617661cffef3fd4d370519a169b64da1fc 100644 (file)
@@ -1468,21 +1468,15 @@ static int ixgbe_clean(struct napi_struct *napi, int budget)
        struct ixgbe_adapter *adapter = container_of(napi,
                                        struct ixgbe_adapter, napi);
        struct net_device *netdev = adapter->netdev;
-       int tx_cleaned = 0, work_done = 0;
-
-       /* Keep link state information with original netdev */
-       if (!netif_carrier_ok(adapter->netdev))
-               goto quit_polling;
+       int work_done = 0;
 
        /* In non-MSIX case, there is no multi-Tx/Rx queue */
-       tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring);
+       ixgbe_clean_tx_irq(adapter, adapter->tx_ring);
        ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done,
                           budget);
 
-       /* If no Tx and not enough Rx work done, exit the polling mode */
-       if ((!tx_cleaned && (work_done < budget)) ||
-           !netif_running(adapter->netdev)) {
-quit_polling:
+       /* If budget not fully consumed, exit the polling mode */
+       if (work_done < budget) {
                netif_rx_complete(netdev, napi);
                ixgbe_irq_enable(adapter);
        }
index 6c0dd49149d0d3047d55059fd2c54889a3e7786b..484cb2ba717f97d1df4f84b43701a9b7cf7b4bca 100644 (file)
@@ -135,8 +135,6 @@ static int ixpdev_poll(struct napi_struct *napi, int budget)
        struct net_device *dev = ip->dev;
        int rx;
 
-       /* @@@ Have to stop polling when nds[0] is administratively
-        * downed while we are polling.  */
        rx = 0;
        do {
                ixp2000_reg_write(IXP2000_IRQ_THD_RAW_STATUS_A_0, 0x00ff);
index 662b8d16803ce7fec85f59af645b60aabee75c41..fa147cd5d68c07e2b8e434ffad5db9c55891b58d 100644 (file)
@@ -242,7 +242,7 @@ static void loopback_setup(struct net_device *dev)
                | NETIF_F_NO_CSUM
                | NETIF_F_HIGHDMA
                | NETIF_F_LLTX
-               | NETIF_F_NETNS_LOCAL,
+               | NETIF_F_NETNS_LOCAL;
        dev->ethtool_ops        = &loopback_ethtool_ops;
        dev->header_ops         = &eth_header_ops;
        dev->init = loopback_dev_init;
index 047ea7be4850cfccfb812436c03a410e01661098..e10528ed90814b626751d5488e5bb26233bed360 100644 (file)
@@ -307,8 +307,31 @@ static void macb_tx(struct macb *bp)
                (unsigned long)status);
 
        if (status & MACB_BIT(UND)) {
+               int i;
                printk(KERN_ERR "%s: TX underrun, resetting buffers\n",
-                      bp->dev->name);
+                       bp->dev->name);
+
+               head = bp->tx_head;
+
+               /*Mark all the buffer as used to avoid sending a lost buffer*/
+               for (i = 0; i < TX_RING_SIZE; i++)
+                       bp->tx_ring[i].ctrl = MACB_BIT(TX_USED);
+
+               /* free transmit buffer in upper layer*/
+               for (tail = bp->tx_tail; tail != head; tail = NEXT_TX(tail)) {
+                       struct ring_info *rp = &bp->tx_skb[tail];
+                       struct sk_buff *skb = rp->skb;
+
+                       BUG_ON(skb == NULL);
+
+                       rmb();
+
+                       dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len,
+                                                        DMA_TO_DEVICE);
+                       rp->skb = NULL;
+                       dev_kfree_skb_irq(skb);
+               }
+
                bp->tx_head = bp->tx_tail = 0;
        }
 
index 0c89b028a80c5f04c7b1ca0cdfe3ff62f6b974ce..cdaa8fc218091a947996280d27c63caa16f56f84 100644 (file)
@@ -95,11 +95,14 @@ static inline void load_eaddr(struct net_device *dev)
 {
        int i;
        DECLARE_MAC_BUF(mac);
+       u64 macaddr;
 
-       for (i = 0; i < 6; i++)
-               dev->dev_addr[i] = o2meth_eaddr[i];
        DPRINTK("Loading MAC Address: %s\n", print_mac(mac, dev->dev_addr));
-       mace->eth.mac_addr = (*(unsigned long*)o2meth_eaddr) >> 16;
+       macaddr = 0;
+       for (i = 0; i < 6; i++)
+               macaddr |= dev->dev_addr[i] << ((5 - i) * 8);
+
+       mace->eth.mac_addr = macaddr;
 }
 
 /*
@@ -794,6 +797,7 @@ static int __init meth_probe(struct platform_device *pdev)
 #endif
        dev->irq             = MACE_ETHERNET_IRQ;
        dev->base_addr       = (unsigned long)&mace->eth;
+       memcpy(dev->dev_addr, o2meth_eaddr, 6);
 
        priv = netdev_priv(dev);
        spin_lock_init(&priv->meth_lock);
index 8def8657251f19435fa50960cc9a0f69459f417e..c90958f6d3fe8a807976c79a8a1734b186969f1d 100644 (file)
@@ -1239,7 +1239,7 @@ static int myri10ge_poll(struct napi_struct *napi, int budget)
        /* process as many rx events as NAPI will allow */
        work_done = myri10ge_clean_rx_done(mgp, budget);
 
-       if (work_done < budget || !netif_running(netdev)) {
+       if (work_done < budget) {
                netif_rx_complete(netdev, napi);
                put_be32(htonl(3), mgp->irq_claim);
        }
index 87cde062fd63d3a58caa6cb7175e8c0bd56b68d3..c329a4f5840c7c22ee80a2882343888ea13ffbde 100644 (file)
@@ -2266,7 +2266,7 @@ static int natsemi_poll(struct napi_struct *napi, int budget)
        /* Reenable interrupts providing nothing is trying to shut
         * the chip down. */
        spin_lock(&np->lock);
-       if (!np->hands_off && netif_running(dev))
+       if (!np->hands_off)
                natsemi_irq_enable(dev);
        spin_unlock(&np->lock);
 
index 5267e031daa0b3ab27d3d1dde092cb2fdc8e6159..78d34af13a1ca8c59817a3c203b77e715ae6399d 100644 (file)
@@ -169,8 +169,8 @@ static void netx_eth_receive(struct net_device *ndev)
        ndev->last_rx = jiffies;
        skb->protocol = eth_type_trans(skb, ndev);
        netif_rx(skb);
-       dev->stats.rx_packets++;
-       dev->stats.rx_bytes += len;
+       ndev->stats.rx_packets++;
+       ndev->stats.rx_bytes += len;
 }
 
 static irqreturn_t
index fbc2553275dc82d4dc0b671ba4d5147fb49fc159..a8f63c47b3cd5bcf5cf41826e078cffa7c7c2767 100644 (file)
@@ -65,8 +65,8 @@
 
 #define _NETXEN_NIC_LINUX_MAJOR 3
 #define _NETXEN_NIC_LINUX_MINOR 4
-#define _NETXEN_NIC_LINUX_SUBVERSION 2
-#define NETXEN_NIC_LINUX_VERSIONID  "3.4.2"
+#define _NETXEN_NIC_LINUX_SUBVERSION 18
+#define NETXEN_NIC_LINUX_VERSIONID  "3.4.18"
 
 #define NETXEN_NUM_FLASH_SECTORS (64)
 #define NETXEN_FLASH_SECTOR_SIZE (64 * 1024)
@@ -309,23 +309,26 @@ struct netxen_ring_ctx {
        ((cmd_desc)->port_ctxid |= ((var) & 0xF0))
 
 #define netxen_set_cmd_desc_flags(cmd_desc, val)       \
-       ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \
-       (cmd_desc)->flags_opcode |= cpu_to_le16((val) & 0x7f))
+       (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \
+               ~cpu_to_le16(0x7f)) | cpu_to_le16((val) & 0x7f)
 #define netxen_set_cmd_desc_opcode(cmd_desc, val)      \
-       ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x3f<<7), \
-       (cmd_desc)->flags_opcode |= cpu_to_le16(((val & 0x3f)<<7)))
+       (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \
+               ~cpu_to_le16((u16)0x3f << 7)) | cpu_to_le16(((val) & 0x3f) << 7)
 
 #define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \
-       ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xff), \
-       (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32((val) & 0xff))
+       (cmd_desc)->num_of_buffers_total_length = \
+               ((cmd_desc)->num_of_buffers_total_length & \
+               ~cpu_to_le32(0xff)) | cpu_to_le32((val) & 0xff)
 #define netxen_set_cmd_desc_totallength(cmd_desc, val) \
-       ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xffffff00), \
-       (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32(val << 8))
+       (cmd_desc)->num_of_buffers_total_length = \
+               ((cmd_desc)->num_of_buffers_total_length & \
+               ~cpu_to_le32((u32)0xffffff << 8)) | \
+               cpu_to_le32(((val) & 0xffffff) << 8)
 
 #define netxen_get_cmd_desc_opcode(cmd_desc)   \
-       ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003F)
+       ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003f)
 #define netxen_get_cmd_desc_totallength(cmd_desc)      \
-       (le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8)
+       ((le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) & 0xffffff)
 
 struct cmd_desc_type0 {
        u8 tcp_hdr_offset;      /* For LSO only */
@@ -412,29 +415,29 @@ struct rcv_desc {
 #define netxen_get_sts_desc_lro_last_frag(status_desc) \
        (((status_desc)->lro & 0x80) >> 7)
 
-#define netxen_get_sts_port(status_desc)       \
-       (le64_to_cpu((status_desc)->status_desc_data) & 0x0F)
-#define netxen_get_sts_status(status_desc)     \
-       ((le64_to_cpu((status_desc)->status_desc_data) >> 4) & 0x0F)
-#define netxen_get_sts_type(status_desc)       \
-       ((le64_to_cpu((status_desc)->status_desc_data) >> 8) & 0x0F)
-#define netxen_get_sts_totallength(status_desc)        \
-       ((le64_to_cpu((status_desc)->status_desc_data) >> 12) & 0xFFFF)
-#define netxen_get_sts_refhandle(status_desc)  \
-       ((le64_to_cpu((status_desc)->status_desc_data) >> 28) & 0xFFFF)
-#define netxen_get_sts_prot(status_desc)       \
-       ((le64_to_cpu((status_desc)->status_desc_data) >> 44) & 0x0F)
+#define netxen_get_sts_port(sts_data)  \
+       ((sts_data) & 0x0F)
+#define netxen_get_sts_status(sts_data)        \
+       (((sts_data) >> 4) & 0x0F)
+#define netxen_get_sts_type(sts_data)  \
+       (((sts_data) >> 8) & 0x0F)
+#define netxen_get_sts_totallength(sts_data)   \
+       (((sts_data) >> 12) & 0xFFFF)
+#define netxen_get_sts_refhandle(sts_data)     \
+       (((sts_data) >> 28) & 0xFFFF)
+#define netxen_get_sts_prot(sts_data)  \
+       (((sts_data) >> 44) & 0x0F)
+#define netxen_get_sts_opcode(sts_data)        \
+       (((sts_data) >> 58) & 0x03F)
+
 #define netxen_get_sts_owner(status_desc)      \
        ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03)
-#define netxen_get_sts_opcode(status_desc)     \
-       ((le64_to_cpu((status_desc)->status_desc_data) >> 58) & 0x03F)
-
-#define netxen_clear_sts_owner(status_desc)    \
-       ((status_desc)->status_desc_data &=     \
-       ~cpu_to_le64(((unsigned long long)3) << 56 ))
-#define netxen_set_sts_owner(status_desc, val) \
-       ((status_desc)->status_desc_data |=     \
-       cpu_to_le64(((unsigned long long)((val) & 0x3)) << 56 ))
+#define netxen_set_sts_owner(status_desc, val) { \
+       (status_desc)->status_desc_data = \
+               ((status_desc)->status_desc_data & \
+               ~cpu_to_le64(0x3ULL << 56)) | \
+               cpu_to_le64((u64)((val) & 0x3) << 56); \
+}
 
 struct status_desc {
        /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length
index 37589265297edd86fa6047f2181c6e72fec1e5c1..485ff93989109360f6db7d2607e0892c029146e0 100644 (file)
@@ -1070,16 +1070,17 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
 {
        struct pci_dev *pdev = adapter->pdev;
        struct net_device *netdev = adapter->netdev;
-       int index = netxen_get_sts_refhandle(desc);
+       u64 sts_data = le64_to_cpu(desc->status_desc_data);
+       int index = netxen_get_sts_refhandle(sts_data);
        struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]);
        struct netxen_rx_buffer *buffer;
        struct sk_buff *skb;
-       u32 length = netxen_get_sts_totallength(desc);
+       u32 length = netxen_get_sts_totallength(sts_data);
        u32 desc_ctx;
        struct netxen_rcv_desc_ctx *rcv_desc;
        int ret;
 
-       desc_ctx = netxen_get_sts_type(desc);
+       desc_ctx = netxen_get_sts_type(sts_data);
        if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) {
                printk("%s: %s Bad Rcv descriptor ring\n",
                       netxen_nic_driver_name, netdev->name);
@@ -1119,7 +1120,7 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
        skb = (struct sk_buff *)buffer->skb;
 
        if (likely(adapter->rx_csum &&
-                               netxen_get_sts_status(desc) == STATUS_CKSUM_OK)) {
+                               netxen_get_sts_status(sts_data) == STATUS_CKSUM_OK)) {
                adapter->stats.csummed++;
                skb->ip_summed = CHECKSUM_UNNECESSARY;
        } else
@@ -1209,7 +1210,6 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max)
                        break;
                }
                netxen_process_rcv(adapter, ctxid, desc);
-               netxen_clear_sts_owner(desc);
                netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM);
                consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1);
                count++;
@@ -1248,7 +1248,6 @@ int netxen_process_cmd_ring(unsigned long data)
        struct pci_dev *pdev;
        struct netxen_skb_frag *frag;
        u32 i;
-       struct sk_buff *skb = NULL;
        int done;
 
        spin_lock(&adapter->tx_lock);
@@ -1278,9 +1277,8 @@ int netxen_process_cmd_ring(unsigned long data)
        while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) {
                buffer = &adapter->cmd_buf_arr[last_consumer];
                pdev = adapter->pdev;
-               frag = &buffer->frag_array[0];
-               skb = buffer->skb;
-               if (skb && (cmpxchg(&buffer->skb, skb, 0) == skb)) {
+               if (buffer->skb) {
+                       frag = &buffer->frag_array[0];
                        pci_unmap_single(pdev, frag->dma, frag->length,
                                         PCI_DMA_TODEVICE);
                        frag->dma = 0ULL;
@@ -1293,8 +1291,8 @@ int netxen_process_cmd_ring(unsigned long data)
                        }
 
                        adapter->stats.skbfreed++;
-                       dev_kfree_skb_any(skb);
-                       skb = NULL;
+                       dev_kfree_skb_any(buffer->skb);
+                       buffer->skb = NULL;
                } else if (adapter->proc_cmd_buf_counter == 1) {
                        adapter->stats.txnullskb++;
                }
index a80f0cd6b528878fcf55900a7967305838242289..263b55e36c7a1b0d477bfd6e1e3892fb54097bcc 100644 (file)
@@ -732,11 +732,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
 
        unregister_netdev(netdev);
 
-       if (adapter->stop_port)
-               adapter->stop_port(adapter);
-
-       netxen_nic_disable_int(adapter);
-
        if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
                init_firmware_done++;
                netxen_free_hw_resources(adapter);
@@ -919,6 +914,9 @@ static int netxen_nic_close(struct net_device *netdev)
        netif_stop_queue(netdev);
        napi_disable(&adapter->napi);
 
+       if (adapter->stop_port)
+               adapter->stop_port(adapter);
+
        netxen_nic_disable_int(adapter);
 
        cmd_buff = adapter->cmd_buf_arr;
@@ -996,28 +994,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                return NETDEV_TX_OK;
        }
 
-       /*
-        * Everything is set up. Now, we just need to transmit it out.
-        * Note that we have to copy the contents of buffer over to
-        * right place. Later on, this can be optimized out by de-coupling the
-        * producer index from the buffer index.
-        */
-      retry_getting_window:
-       spin_lock_bh(&adapter->tx_lock);
-       if (adapter->total_threads >= MAX_XMIT_PRODUCERS) {
-               spin_unlock_bh(&adapter->tx_lock);
-               /*
-                * Yield CPU
-                */
-               if (!in_atomic())
-                       schedule();
-               else {
-                       for (i = 0; i < 20; i++)
-                               cpu_relax();    /*This a nop instr on i386 */
-               }
-               goto retry_getting_window;
-       }
-       local_producer = adapter->cmd_producer;
        /* There 4 fragments per descriptor */
        no_of_desc = (frag_count + 3) >> 2;
        if (netdev->features & NETIF_F_TSO) {
@@ -1031,16 +1007,19 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                        }
                }
        }
+
+       spin_lock_bh(&adapter->tx_lock);
+       if (adapter->total_threads >= MAX_XMIT_PRODUCERS) {
+               goto out_requeue;
+       }
+       local_producer = adapter->cmd_producer;
        k = adapter->cmd_producer;
        max_tx_desc_count = adapter->max_tx_desc_count;
        last_cmd_consumer = adapter->last_cmd_consumer;
        if ((k + no_of_desc) >=
            ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count :
             last_cmd_consumer)) {
-               netif_stop_queue(netdev);
-               adapter->flags |= NETXEN_NETDEV_STATUS;
-               spin_unlock_bh(&adapter->tx_lock);
-               return NETDEV_TX_BUSY;
+               goto out_requeue;
        }
        k = get_index_range(k, max_tx_desc_count, no_of_desc);
        adapter->cmd_producer = k;
@@ -1093,6 +1072,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                                                  adapter->max_tx_desc_count);
                        hwdesc = &hw->cmd_desc_head[producer];
                        memset(hwdesc, 0, sizeof(struct cmd_desc_type0));
+                       pbuf = &adapter->cmd_buf_arr[producer];
+                       pbuf->skb = NULL;
                }
                frag = &skb_shinfo(skb)->frags[i - 1];
                len = frag->size;
@@ -1148,6 +1129,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                }
                /* copy the MAC/IP/TCP headers to the cmd descriptor list */
                hwdesc = &hw->cmd_desc_head[producer];
+               pbuf = &adapter->cmd_buf_arr[producer];
+               pbuf->skb = NULL;
 
                /* copy the first 64 bytes */
                memcpy(((void *)hwdesc) + 2,
@@ -1156,6 +1139,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 
                if (more_hdr) {
                        hwdesc = &hw->cmd_desc_head[producer];
+                       pbuf = &adapter->cmd_buf_arr[producer];
+                       pbuf->skb = NULL;
                        /* copy the next 64 bytes - should be enough except
                         * for pathological case
                         */
@@ -1167,16 +1152,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                }
        }
 
-       i = netxen_get_cmd_desc_totallength(&hw->cmd_desc_head[saved_producer]);
-
-       hw->cmd_desc_head[saved_producer].flags_opcode =
-               cpu_to_le16(hw->cmd_desc_head[saved_producer].flags_opcode);
-       hw->cmd_desc_head[saved_producer].num_of_buffers_total_length =
-         cpu_to_le32(hw->cmd_desc_head[saved_producer].
-                         num_of_buffers_total_length);
-
        spin_lock_bh(&adapter->tx_lock);
-       adapter->stats.txbytes += i;
+       adapter->stats.txbytes += skb->len;
 
        /* Code to update the adapter considering how many producer threads
           are currently working */
@@ -1189,14 +1166,17 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        }
 
        adapter->stats.xmitfinished++;
-       spin_unlock_bh(&adapter->tx_lock);
-
        netdev->trans_start = jiffies;
 
-       DPRINTK(INFO, "wrote CMD producer %x to phantom\n", producer);
-
-       DPRINTK(INFO, "Done. Send\n");
+       spin_unlock_bh(&adapter->tx_lock);
        return NETDEV_TX_OK;
+
+out_requeue:
+       netif_stop_queue(netdev);
+       adapter->flags |= NETXEN_NETDEV_STATUS;
+
+       spin_unlock_bh(&adapter->tx_lock);
+       return NETDEV_TX_BUSY;
 }
 
 static void netxen_watchdog(unsigned long v)
@@ -1321,7 +1301,7 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget)
                                                     budget / MAX_RCV_CTX);
        }
 
-       if (work_done >= budget && netxen_nic_rx_has_work(adapter) != 0)
+       if (work_done >= budget)
                done = 0;
 
        if (netxen_process_cmd_ring((unsigned long)adapter) == 0)
index 5b9e1b300fab24f06b879802fe00e3493ed69862..d04ecb77d08c5bd92c96475465ba4bf0fc3a9d89 100644 (file)
@@ -736,12 +736,12 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
        __u32 mac_cfg;
        u32 port = physical_port[adapter->portnum];
 
-       if (port != 0)
+       if (port > NETXEN_NIU_MAX_XG_PORTS)
                return -EINVAL;
+
        mac_cfg = 0;
-       netxen_xg_soft_reset(mac_cfg);
-       if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_CONFIG_0,
-                                  &mac_cfg, 4))
+       if (netxen_nic_hw_write_wx(adapter,
+               NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), &mac_cfg, 4))
                return -EIO;
        return 0;
 }
index abfc61c3a38c36258450dc046a5ec48f706f0503..9a0c6d3adfe982f1c92223ba789ed3c27e7e17a3 100644 (file)
@@ -33,8 +33,8 @@
 
 #define DRV_MODULE_NAME                "niu"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "0.5"
-#define DRV_MODULE_RELDATE     "October 5, 2007"
+#define DRV_MODULE_VERSION     "0.6"
+#define DRV_MODULE_RELDATE     "January 5, 2008"
 
 static char version[] __devinitdata =
        DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
@@ -2241,6 +2241,8 @@ static int niu_process_rx_pkt(struct niu *np, struct rx_ring_info *rp)
        skb->protocol = eth_type_trans(skb, np->dev);
        netif_receive_skb(skb);
 
+       np->dev->last_rx = jiffies;
+
        return num_rcr;
 }
 
@@ -2508,15 +2510,19 @@ static int niu_rx_error(struct niu *np, struct rx_ring_info *rp)
        u64 stat = nr64(RX_DMA_CTL_STAT(rp->rx_channel));
        int err = 0;
 
-       dev_err(np->device, PFX "%s: RX channel %u error, stat[%llx]\n",
-               np->dev->name, rp->rx_channel, (unsigned long long) stat);
-
-       niu_log_rxchan_errors(np, rp, stat);
 
        if (stat & (RX_DMA_CTL_STAT_CHAN_FATAL |
                    RX_DMA_CTL_STAT_PORT_FATAL))
                err = -EINVAL;
 
+       if (err) {
+               dev_err(np->device, PFX "%s: RX channel %u error, stat[%llx]\n",
+                       np->dev->name, rp->rx_channel,
+                       (unsigned long long) stat);
+
+               niu_log_rxchan_errors(np, rp, stat);
+       }
+
        nw64(RX_DMA_CTL_STAT(rp->rx_channel),
             stat & RX_DMA_CTL_WRITE_CLEAR_ERRS);
 
@@ -2749,13 +2755,16 @@ static int niu_device_error(struct niu *np)
        return -ENODEV;
 }
 
-static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp)
+static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp,
+                             u64 v0, u64 v1, u64 v2)
 {
-       u64 v0 = lp->v0;
-       u64 v1 = lp->v1;
-       u64 v2 = lp->v2;
+
        int i, err = 0;
 
+       lp->v0 = v0;
+       lp->v1 = v1;
+       lp->v2 = v2;
+
        if (v1 & 0x00000000ffffffffULL) {
                u32 rx_vec = (v1 & 0xffffffff);
 
@@ -2764,8 +2773,13 @@ static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp)
 
                        if (rx_vec & (1 << rp->rx_channel)) {
                                int r = niu_rx_error(np, rp);
-                               if (r)
+                               if (r) {
                                        err = r;
+                               } else {
+                                       if (!v0)
+                                               nw64(RX_DMA_CTL_STAT(rp->rx_channel),
+                                                    RX_DMA_CTL_STAT_MEX);
+                               }
                        }
                }
        }
@@ -2803,7 +2817,7 @@ static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp)
        if (err)
                niu_enable_interrupts(np, 0);
 
-       return -EINVAL;
+       return err;
 }
 
 static void niu_rxchan_intr(struct niu *np, struct rx_ring_info *rp,
@@ -2905,7 +2919,7 @@ static irqreturn_t niu_interrupt(int irq, void *dev_id)
        }
 
        if (unlikely((v0 & ((u64)1 << LDN_MIF)) || v1 || v2)) {
-               int err = niu_slowpath_interrupt(np, lp);
+               int err = niu_slowpath_interrupt(np, lp, v0, v1, v2);
                if (err)
                        goto out;
        }
@@ -5194,7 +5208,8 @@ static int niu_start_xmit(struct sk_buff *skb, struct net_device *dev)
                }
                kfree_skb(skb);
                skb = skb_new;
-       }
+       } else
+               skb_orphan(skb);
 
        align = ((unsigned long) skb->data & (16 - 1));
        headroom = align + sizeof(struct tx_pkt_hdr);
index ad134a61302ac95700c52e6270031ff0451d2573..288177716a49f90e0c61dc7273960eeef7ddb1ae 100644 (file)
@@ -337,15 +337,15 @@ static int tc574_config(struct pcmcia_device *link)
        struct net_device *dev = link->priv;
        struct el3_private *lp = netdev_priv(dev);
        tuple_t tuple;
-       unsigned short buf[32];
+       __le16 buf[32];
        int last_fn, last_ret, i, j;
        kio_addr_t ioaddr;
-       u16 *phys_addr;
+       __be16 *phys_addr;
        char *cardname;
        union wn3_config config;
        DECLARE_MAC_BUF(mac);
 
-       phys_addr = (u16 *)dev->dev_addr;
+       phys_addr = (__be16 *)dev->dev_addr;
 
        DEBUG(0, "3c574_config(0x%p)\n", link);
 
@@ -378,12 +378,12 @@ static int tc574_config(struct pcmcia_device *link)
        if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
                pcmcia_get_tuple_data(link, &tuple);
                for (i = 0; i < 3; i++)
-                       phys_addr[i] = htons(buf[i]);
+                       phys_addr[i] = htons(le16_to_cpu(buf[i]));
        } else {
                EL3WINDOW(0);
                for (i = 0; i < 3; i++)
                        phys_addr[i] = htons(read_eeprom(ioaddr, i + 10));
-               if (phys_addr[0] == 0x6060) {
+               if (phys_addr[0] == htons(0x6060)) {
                        printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx"
                                   "-0x%03lx\n", dev->base_addr, dev->base_addr+15);
                        goto failed;
index a98fe07cce70e0f6b591334dfa3ecfd038a3feff..e862d14ece79a6afe1069150a1e65fe3bed6acae 100644 (file)
@@ -251,7 +251,8 @@ static int tc589_config(struct pcmcia_device *link)
     struct net_device *dev = link->priv;
     struct el3_private *lp = netdev_priv(dev);
     tuple_t tuple;
-    u16 buf[32], *phys_addr;
+    __le16 buf[32];
+    __be16 *phys_addr;
     int last_fn, last_ret, i, j, multi = 0, fifo;
     kio_addr_t ioaddr;
     char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
@@ -259,7 +260,7 @@ static int tc589_config(struct pcmcia_device *link)
     
     DEBUG(0, "3c589_config(0x%p)\n", link);
 
-    phys_addr = (u16 *)dev->dev_addr;
+    phys_addr = (__be16 *)dev->dev_addr;
     tuple.Attributes = 0;
     tuple.TupleData = (cisdata_t *)buf;
     tuple.TupleDataMax = sizeof(buf);
@@ -298,11 +299,11 @@ static int tc589_config(struct pcmcia_device *link)
     if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
        pcmcia_get_tuple_data(link, &tuple);
        for (i = 0; i < 3; i++)
-           phys_addr[i] = htons(buf[i]);
+           phys_addr[i] = htons(le16_to_cpu(buf[i]));
     } else {
        for (i = 0; i < 3; i++)
            phys_addr[i] = htons(read_eeprom(ioaddr, i));
-       if (phys_addr[0] == 0x6060) {
+       if (phys_addr[0] == htons(0x6060)) {
            printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx"
                   "-0x%03lx\n", dev->base_addr, dev->base_addr+15);
            goto failed;
index db6a97d1d7b1e7292d60a4e642ed1e35e545b2a3..51bbd582f16c2ef40b0d508127d5bb39eb8ea39d 100644 (file)
@@ -1746,6 +1746,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
        PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"),
        PCMCIA_DEVICE_CIS_PROD_ID12("PMX   ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"),
        PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "tamarack.cis"),
+       PCMCIA_DEVICE_PROD_ID12("Ethernet", "CF Size PC Card", 0x00b2e941, 0x43ac239b),
        PCMCIA_DEVICE_PROD_ID123("Fast Ethernet", "CF Size PC Card", "1.0",
                0xb4be14e3, 0x43ac239b, 0x0877b627),
        PCMCIA_DEVICE_NULL
index ff92aca0a7b37ad82daf35a38dfd9190353b356a..90498ffe26f284427b599a2430db3b8941314c54 100644 (file)
@@ -455,9 +455,14 @@ static void pcnet32_netif_start(struct net_device *dev)
 {
 #ifdef CONFIG_PCNET32_NAPI
        struct pcnet32_private *lp = netdev_priv(dev);
+       ulong ioaddr = dev->base_addr;
+       u16 val;
 #endif
        netif_wake_queue(dev);
 #ifdef CONFIG_PCNET32_NAPI
+       val = lp->a.read_csr(ioaddr, CSR3);
+       val &= 0x00ff;
+       lp->a.write_csr(ioaddr, CSR3, val);
        napi_enable(&lp->napi);
 #endif
 }
index a5791114b7bde59eddd6aed9c0dc79c590a8d688..cf0774de6c4154fbf46956deaa0fc420a22358f9 100644 (file)
@@ -2320,14 +2320,9 @@ static int ql_poll(struct napi_struct *napi, int budget)
        unsigned long hw_flags;
        struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
 
-       if (!netif_carrier_ok(ndev))
-               goto quit_polling;
-
        ql_tx_rx_clean(qdev, &tx_cleaned, &rx_cleaned, budget);
 
-       if (tx_cleaned + rx_cleaned != budget ||
-           !netif_running(ndev)) {
-quit_polling:
+       if (tx_cleaned + rx_cleaned != budget) {
                spin_lock_irqsave(&qdev->hw_lock, hw_flags);
                __netif_rx_complete(ndev, napi);
                ql_update_small_bufq_prod_index(qdev);
index 1f647b9ce352128ae65fbc3d15d15062615adeea..3acfeeabdee1ee44cc842695b0d0ddb905e2d044 100644 (file)
@@ -2002,7 +2002,7 @@ static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version)
        u32 clk;
 
        clk = RTL_R8(Config2) & PCI_Clock_66MHz;
-       for (i = 0; i < ARRAY_SIZE(cfg2_info); i++) {
+       for (i = 0; i < ARRAY_SIZE(cfg2_info); i++, p++) {
                if ((p->mac_version == mac_version) && (p->clk == clk)) {
                        RTL_W32(0x7c, p->val);
                        break;
@@ -2211,7 +2211,7 @@ out:
 
 static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
 {
-       desc->addr = 0x0badbadbadbadbadull;
+       desc->addr = cpu_to_le64(0x0badbadbadbadbadull);
        desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask);
 }
 
@@ -2398,6 +2398,8 @@ static void rtl8169_wait_for_quiescence(struct net_device *dev)
        rtl8169_irq_mask_and_ack(ioaddr);
 
 #ifdef CONFIG_R8169_NAPI
+       tp->intr_mask = 0xffff;
+       RTL_W16(IntrMask, tp->intr_event);
        napi_enable(&tp->napi);
 #endif
 }
@@ -2835,7 +2837,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
                }
 
                /* Work around for AMD plateform. */
-               if ((desc->opts2 & 0xfffe000) &&
+               if ((desc->opts2 & cpu_to_le32(0xfffe000)) &&
                    (tp->mac_version == RTL_GIGA_MAC_VER_05)) {
                        desc->opts2 = 0;
                        cur_rx++;
index 73a7e6529ee0f91abb46f1bda1e05bcd21330bef..55a590ab1e1700936fb451f36543d69b08889f03 100644 (file)
@@ -294,7 +294,6 @@ static int rr_reset(struct net_device *dev)
 {
        struct rr_private *rrpriv;
        struct rr_regs __iomem *regs;
-       struct eeprom *hw = NULL;
        u32 start_pc;
        int i;
 
@@ -381,7 +380,8 @@ static int rr_reset(struct net_device *dev)
        writel(RBURST_64|WBURST_64, &regs->PciState);
        wmb();
 
-       start_pc = rr_read_eeprom_word(rrpriv, &hw->rncd_info.FwStart);
+       start_pc = rr_read_eeprom_word(rrpriv,
+                       offsetof(struct eeprom, rncd_info.FwStart));
 
 #if (DEBUG > 1)
        printk("%s: Executing firmware at address 0x%06x\n",
@@ -438,12 +438,12 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
  * it to our CPU byte-order.
  */
 static u32 rr_read_eeprom_word(struct rr_private *rrpriv,
-                           void * offset)
+                           size_t offset)
 {
-       u32 word;
+       __be32 word;
 
-       if ((rr_read_eeprom(rrpriv, (unsigned long)offset,
-                           (char *)&word, 4) == 4))
+       if ((rr_read_eeprom(rrpriv, offset,
+                           (unsigned char *)&word, 4) == 4))
                return be32_to_cpu(word);
        return 0;
 }
@@ -510,7 +510,6 @@ static int __devinit rr_init(struct net_device *dev)
 {
        struct rr_private *rrpriv;
        struct rr_regs __iomem *regs;
-       struct eeprom *hw = NULL;
        u32 sram_size, rev;
        DECLARE_MAC_BUF(mac);
 
@@ -545,14 +544,14 @@ static int __devinit rr_init(struct net_device *dev)
         * other method I've seen.  -VAL
         */
 
-       *(u16 *)(dev->dev_addr) =
-         htons(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA));
-       *(u32 *)(dev->dev_addr+2) =
-         htonl(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA[4]));
+       *(__be16 *)(dev->dev_addr) =
+         htons(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA)));
+       *(__be32 *)(dev->dev_addr+2) =
+         htonl(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA[4])));
 
        printk("  MAC: %s\n", print_mac(mac, dev->dev_addr));
 
-       sram_size = rr_read_eeprom_word(rrpriv, (void *)8);
+       sram_size = rr_read_eeprom_word(rrpriv, 8);
        printk("  SRAM size 0x%06x\n", sram_size);
 
        return 0;
@@ -1477,11 +1476,10 @@ static int rr_load_firmware(struct net_device *dev)
 {
        struct rr_private *rrpriv;
        struct rr_regs __iomem *regs;
-       unsigned long eptr, segptr;
+       size_t eptr, segptr;
        int i, j;
        u32 localctrl, sptr, len, tmp;
        u32 p2len, p2size, nr_seg, revision, io, sram_size;
-       struct eeprom *hw = NULL;
 
        rrpriv = netdev_priv(dev);
        regs = rrpriv->regs;
@@ -1509,7 +1507,7 @@ static int rr_load_firmware(struct net_device *dev)
         */
        io = readl(&regs->ExtIo);
        writel(0, &regs->ExtIo);
-       sram_size = rr_read_eeprom_word(rrpriv, (void *)8);
+       sram_size = rr_read_eeprom_word(rrpriv, 8);
 
        for (i = 200; i < sram_size / 4; i++){
                writel(i * 4, &regs->WinBase);
@@ -1520,13 +1518,13 @@ static int rr_load_firmware(struct net_device *dev)
        writel(io, &regs->ExtIo);
        mb();
 
-       eptr = (unsigned long)rr_read_eeprom_word(rrpriv,
-                                              &hw->rncd_info.AddrRunCodeSegs);
+       eptr = rr_read_eeprom_word(rrpriv,
+                      offsetof(struct eeprom, rncd_info.AddrRunCodeSegs));
        eptr = ((eptr & 0x1fffff) >> 3);
 
-       p2len = rr_read_eeprom_word(rrpriv, (void *)(0x83*4));
+       p2len = rr_read_eeprom_word(rrpriv, 0x83*4);
        p2len = (p2len << 2);
-       p2size = rr_read_eeprom_word(rrpriv, (void *)(0x84*4));
+       p2size = rr_read_eeprom_word(rrpriv, 0x84*4);
        p2size = ((p2size & 0x1fffff) >> 3);
 
        if ((eptr < p2size) || (eptr > (p2size + p2len))){
@@ -1534,7 +1532,8 @@ static int rr_load_firmware(struct net_device *dev)
                goto out;
        }
 
-       revision = rr_read_eeprom_word(rrpriv, &hw->manf.HeaderFmt);
+       revision = rr_read_eeprom_word(rrpriv,
+                       offsetof(struct eeprom, manf.HeaderFmt));
 
        if (revision != 1){
                printk("%s: invalid firmware format (%i)\n",
@@ -1542,18 +1541,18 @@ static int rr_load_firmware(struct net_device *dev)
                goto out;
        }
 
-       nr_seg = rr_read_eeprom_word(rrpriv, (void *)eptr);
+       nr_seg = rr_read_eeprom_word(rrpriv, eptr);
        eptr +=4;
 #if (DEBUG > 1)
        printk("%s: nr_seg %i\n", dev->name, nr_seg);
 #endif
 
        for (i = 0; i < nr_seg; i++){
-               sptr = rr_read_eeprom_word(rrpriv, (void *)eptr);
+               sptr = rr_read_eeprom_word(rrpriv, eptr);
                eptr += 4;
-               len = rr_read_eeprom_word(rrpriv, (void *)eptr);
+               len = rr_read_eeprom_word(rrpriv, eptr);
                eptr += 4;
-               segptr = (unsigned long)rr_read_eeprom_word(rrpriv, (void *)eptr);
+               segptr = rr_read_eeprom_word(rrpriv, eptr);
                segptr = ((segptr & 0x1fffff) >> 3);
                eptr += 4;
 #if (DEBUG > 1)
@@ -1561,7 +1560,7 @@ static int rr_load_firmware(struct net_device *dev)
                       dev->name, i, sptr, len, segptr);
 #endif
                for (j = 0; j < len; j++){
-                       tmp = rr_read_eeprom_word(rrpriv, (void *)segptr);
+                       tmp = rr_read_eeprom_word(rrpriv, segptr);
                        writel(sptr, &regs->WinBase);
                        mb();
                        writel(tmp, &regs->WinData);
index 6a79825bc8cf6b6059efbe8297f547242573eec1..6173f11218dfec0b3fdb9d6319216ef432f65a3e 100644 (file)
@@ -838,7 +838,7 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
                                   unsigned long offset,
                                   unsigned char *buf,
                                   unsigned long length);
-static u32 rr_read_eeprom_word(struct rr_private *rrpriv, void * offset);
+static u32 rr_read_eeprom_word(struct rr_private *rrpriv, size_t offset);
 static int rr_load_firmware(struct net_device *dev);
 static inline void rr_raz_tx(struct rr_private *, struct net_device *);
 static inline void rr_raz_rx(struct rr_private *, struct net_device *);
index 121cb100f93a036fd2ae1ab226f00ffc5c7543ff..fa57c49c0c51fad86de064e98e96a36249efb829 100644 (file)
@@ -2704,9 +2704,6 @@ static int s2io_poll(struct napi_struct *napi, int budget)
        struct XENA_dev_config __iomem *bar0 = nic->bar0;
        int i;
 
-       if (!is_s2io_card_up(nic))
-               return 0;
-
        mac_control = &nic->mac_control;
        config = &nic->config;
 
@@ -3737,7 +3734,7 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
 }
 
 /* Handle software interrupt used during MSI(X) test */
-static irqreturn_t __devinit s2io_test_intr(int irq, void *dev_id)
+static irqreturn_t s2io_test_intr(int irq, void *dev_id)
 {
        struct s2io_nic *sp = dev_id;
 
@@ -3748,7 +3745,7 @@ static irqreturn_t __devinit s2io_test_intr(int irq, void *dev_id)
 }
 
 /* Test interrupt path by forcing a a software IRQ */
-static int __devinit s2io_test_msi(struct s2io_nic *sp)
+static int s2io_test_msi(struct s2io_nic *sp)
 {
        struct pci_dev *pdev = sp->pdev;
        struct XENA_dev_config __iomem *bar0 = sp->bar0;
index 720088396bb917a89552bedf521487c425649b58..7eab072ae79212daad67932a34c0fc4bcb425672 100644 (file)
@@ -474,7 +474,7 @@ static inline void sis190_map_to_asic(struct RxDesc *desc, dma_addr_t mapping,
 static inline void sis190_make_unusable_by_asic(struct RxDesc *desc)
 {
        desc->PSize = 0x0;
-       desc->addr = 0xdeadbeef;
+       desc->addr = cpu_to_le32(0xdeadbeef);
        desc->size &= cpu_to_le32(RingEnd);
        wmb();
        desc->status = 0x0;
@@ -580,7 +580,7 @@ static int sis190_rx_interrupt(struct net_device *dev,
                struct RxDesc *desc = tp->RxDescRing + entry;
                u32 status;
 
-               if (desc->status & OWNbit)
+               if (le32_to_cpu(desc->status) & OWNbit)
                        break;
 
                status = le32_to_cpu(desc->PSize);
@@ -1381,7 +1381,7 @@ out:
        return rc;
 }
 
-static void __devexit sis190_mii_remove(struct net_device *dev)
+static void sis190_mii_remove(struct net_device *dev)
 {
        struct sis190_private *tp = netdev_priv(dev);
 
@@ -1538,9 +1538,9 @@ static int __devinit sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev,
 
        /* Get MAC address from EEPROM */
        for (i = 0; i < MAC_ADDR_LEN / 2; i++) {
-               __le16 w = sis190_read_eeprom(ioaddr, EEPROMMACAddr + i);
+               u16 w = sis190_read_eeprom(ioaddr, EEPROMMACAddr + i);
 
-               ((u16 *)dev->dev_addr)[i] = le16_to_cpu(w);
+               ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(w);
        }
 
        sis190_set_rgmii(tp, sis190_read_eeprom(ioaddr, EEPROMInfo));
index 6197afb3ed8314671583455e89d69a8e7170494a..7023bbe545ee8adab04a4e752d70f651c05a777b 100644 (file)
@@ -822,8 +822,13 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
 
        sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), rx_reg);
 
-       /* Flush Rx MAC FIFO on any flow control or error */
-       sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR);
+       if (hw->chip_id == CHIP_ID_YUKON_XL) {
+               /* Hardware errata - clear flush mask */
+               sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), 0);
+       } else {
+               /* Flush Rx MAC FIFO on any flow control or error */
+               sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR);
+       }
 
        /* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug  */
        reg = RX_GMF_FL_THR_DEF + 1;
@@ -939,7 +944,6 @@ static void tx_init(struct sky2_port *sky2)
        le = get_tx_le(sky2);
        le->addr = 0;
        le->opcode = OP_ADDR64 | HW_OWNER;
-       sky2->tx_addr64 = 0;
 }
 
 static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2,
@@ -973,13 +977,11 @@ static void sky2_rx_add(struct sky2_port *sky2,  u8 op,
                        dma_addr_t map, unsigned len)
 {
        struct sky2_rx_le *le;
-       u32 hi = upper_32_bits(map);
 
-       if (sky2->rx_addr64 != hi) {
+       if (sizeof(dma_addr_t) > sizeof(u32)) {
                le = sky2_next_rx(sky2);
-               le->addr = cpu_to_le32(hi);
+               le->addr = cpu_to_le32(upper_32_bits(map));
                le->opcode = OP_ADDR64 | HW_OWNER;
-               sky2->rx_addr64 = upper_32_bits(map + len);
        }
 
        le = sky2_next_rx(sky2);
@@ -1163,6 +1165,7 @@ static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp
                             TX_VLAN_TAG_OFF);
        }
 
+       sky2_read32(hw, B0_Y2_SP_LISR);
        napi_enable(&hw->napi);
        netif_tx_unlock_bh(dev);
 }
@@ -1474,7 +1477,6 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
        struct tx_ring_info *re;
        unsigned i, len;
        dma_addr_t mapping;
-       u32 addr64;
        u16 mss;
        u8 ctrl;
 
@@ -1487,15 +1489,12 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
 
        len = skb_headlen(skb);
        mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE);
-       addr64 = upper_32_bits(mapping);
 
-       /* Send high bits if changed or crosses boundary */
-       if (addr64 != sky2->tx_addr64 ||
-           upper_32_bits(mapping + len) != sky2->tx_addr64) {
+       /* Send high bits if needed */
+       if (sizeof(dma_addr_t) > sizeof(u32)) {
                le = get_tx_le(sky2);
-               le->addr = cpu_to_le32(addr64);
+               le->addr = cpu_to_le32(upper_32_bits(mapping));
                le->opcode = OP_ADDR64 | HW_OWNER;
-               sky2->tx_addr64 = upper_32_bits(mapping + len);
        }
 
        /* Check for TCP Segmentation Offload */
@@ -1576,13 +1575,12 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
 
                mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset,
                                       frag->size, PCI_DMA_TODEVICE);
-               addr64 = upper_32_bits(mapping);
-               if (addr64 != sky2->tx_addr64) {
+
+               if (sizeof(dma_addr_t) > sizeof(u32)) {
                        le = get_tx_le(sky2);
-                       le->addr = cpu_to_le32(addr64);
+                       le->addr = cpu_to_le32(upper_32_bits(mapping));
                        le->ctrl = 0;
                        le->opcode = OP_ADDR64 | HW_OWNER;
-                       sky2->tx_addr64 = addr64;
                }
 
                le = get_tx_le(sky2);
@@ -2038,6 +2036,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
        err = sky2_rx_start(sky2);
        sky2_write32(hw, B0_IMSK, imask);
 
+       sky2_read32(hw, B0_Y2_SP_LISR);
        napi_enable(&hw->napi);
 
        if (err)
@@ -3856,6 +3855,7 @@ static int sky2_debug_show(struct seq_file *seq, void *v)
                   last = sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_PUT_IDX)),
                   sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_LAST_IDX)));
 
+       sky2_read32(hw, B0_Y2_SP_LISR);
        napi_enable(&hw->napi);
        return 0;
 }
@@ -3949,7 +3949,7 @@ static __exit void sky2_debug_cleanup(void)
 /* Initialize network device */
 static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
                                                     unsigned port,
-                                                    int highmem, int wol)
+                                                    int highmem)
 {
        struct sky2_port *sky2;
        struct net_device *dev = alloc_etherdev(sizeof(*sky2));
@@ -3989,7 +3989,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
        sky2->speed = -1;
        sky2->advertising = sky2_supported_modes(hw);
        sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL);
-       sky2->wol = wol;
+       sky2->wol = sky2_wol_supported(hw) & WAKE_MAGIC;
 
        spin_lock_init(&sky2->phy_lock);
        sky2->tx_pending = TX_DEF_PENDING;
@@ -4086,24 +4086,12 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
        return err;
 }
 
-static int __devinit pci_wake_enabled(struct pci_dev *dev)
-{
-       int pm  = pci_find_capability(dev, PCI_CAP_ID_PM);
-       u16 value;
-
-       if (!pm)
-               return 0;
-       if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value))
-               return 0;
-       return value & PCI_PM_CTRL_PME_ENABLE;
-}
-
 static int __devinit sky2_probe(struct pci_dev *pdev,
                                const struct pci_device_id *ent)
 {
        struct net_device *dev;
        struct sky2_hw *hw;
-       int err, using_dac = 0, wol_default;
+       int err, using_dac = 0;
 
        err = pci_enable_device(pdev);
        if (err) {
@@ -4136,8 +4124,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
                }
        }
 
-       wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0;
-
        err = -ENOMEM;
        hw = kzalloc(sizeof(*hw), GFP_KERNEL);
        if (!hw) {
@@ -4181,7 +4167,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
 
        sky2_reset(hw);
 
-       dev = sky2_init_netdev(hw, 0, using_dac, wol_default);
+       dev = sky2_init_netdev(hw, 0, using_dac);
        if (!dev) {
                err = -ENOMEM;
                goto err_out_free_pci;
@@ -4218,7 +4204,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
        if (hw->ports > 1) {
                struct net_device *dev1;
 
-               dev1 = sky2_init_netdev(hw, 1, using_dac, wol_default);
+               dev1 = sky2_init_netdev(hw, 1, using_dac);
                if (!dev1)
                        dev_warn(&pdev->dev, "allocation for second device failed\n");
                else if ((err = register_netdev(dev1))) {
index bc646a47edd2f04b83a78a5b40da085a90915192..ffe9b8a50a1b75943d1d9b9fec9a07a917b2e71b 100644 (file)
@@ -1991,14 +1991,14 @@ struct sky2_port {
        u16                  tx_cons;           /* next le to check */
        u16                  tx_prod;           /* next le to use */
        u16                  tx_next;           /* debug only */
-       u32                  tx_addr64;
+
        u16                  tx_pending;
        u16                  tx_last_mss;
        u32                  tx_tcpsum;
 
        struct rx_ring_info  *rx_ring ____cacheline_aligned_in_smp;
        struct sky2_rx_le    *rx_le;
-       u32                  rx_addr64;
+
        u16                  rx_next;           /* next re to check */
        u16                  rx_put;            /* next le index to use */
        u16                  rx_pending;
index d04e4fa35206b888d1d65e724d2baf38af1dd3c9..7defa63b9c747efd1cda1ea902079c0124340cac 100644 (file)
@@ -76,7 +76,7 @@
 
 
 
-#if     SMC_USE_PXA_DMA
+#ifdef SMC_USE_PXA_DMA
 #define SMC_USE_DMA
 
 /*
index bcc430bd9e493b0f89d0f0c85cae54debfcb9d86..6e00dc857afabf6b2d5ef3a20ae900d8083b622b 100644 (file)
@@ -1742,7 +1742,7 @@ static void set_rx_mode(struct net_device *dev)
                        if (vlan_group_get_device(np->vlgrp, i)) {
                                if (vlan_count >= 32)
                                        break;
-                               writew(cpu_to_be16(i), filter_addr);
+                               writew(i, filter_addr);
                                filter_addr += 16;
                                vlan_count++;
                        }
index ff98f5d597f117294ec870cce330bfd339a63bca..0a6186d4a48efba7869ce3a95bc6ab07bd439c08 100644 (file)
@@ -340,9 +340,9 @@ enum mac_ctrl1_bits {
 /* Note that using only 32 bit fields simplifies conversion to big-endian
    architectures. */
 struct netdev_desc {
-       u32 next_desc;
-       u32 status;
-       struct desc_frag { u32 addr, length; } frag[1];
+       __le32 next_desc;
+       __le32 status;
+       struct desc_frag { __le32 addr, length; } frag[1];
 };
 
 /* Bits in netdev_desc.status */
@@ -495,8 +495,8 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
                goto err_out_res;
 
        for (i = 0; i < 3; i++)
-               ((u16 *)dev->dev_addr)[i] =
-                       le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET));
+               ((__le16 *)dev->dev_addr)[i] =
+                       cpu_to_le16(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET));
        memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
 
        dev->base_addr = (unsigned long)ioaddr;
@@ -1090,8 +1090,8 @@ reset_tx (struct net_device *dev)
                skb = np->tx_skbuff[i];
                if (skb) {
                        pci_unmap_single(np->pci_dev,
-                               np->tx_ring[i].frag[0].addr, skb->len,
-                               PCI_DMA_TODEVICE);
+                               le32_to_cpu(np->tx_ring[i].frag[0].addr),
+                               skb->len, PCI_DMA_TODEVICE);
                        if (irq)
                                dev_kfree_skb_irq (skb);
                        else
@@ -1214,7 +1214,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
                                skb = np->tx_skbuff[entry];
                                /* Free the original skb. */
                                pci_unmap_single(np->pci_dev,
-                                       np->tx_ring[entry].frag[0].addr,
+                                       le32_to_cpu(np->tx_ring[entry].frag[0].addr),
                                        skb->len, PCI_DMA_TODEVICE);
                                dev_kfree_skb_irq (np->tx_skbuff[entry]);
                                np->tx_skbuff[entry] = NULL;
@@ -1233,7 +1233,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
                                skb = np->tx_skbuff[entry];
                                /* Free the original skb. */
                                pci_unmap_single(np->pci_dev,
-                                       np->tx_ring[entry].frag[0].addr,
+                                       le32_to_cpu(np->tx_ring[entry].frag[0].addr),
                                        skb->len, PCI_DMA_TODEVICE);
                                dev_kfree_skb_irq (np->tx_skbuff[entry]);
                                np->tx_skbuff[entry] = NULL;
@@ -1311,19 +1311,19 @@ static void rx_poll(unsigned long data)
                                && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
                                skb_reserve(skb, 2);    /* 16 byte align the IP header */
                                pci_dma_sync_single_for_cpu(np->pci_dev,
-                                                           desc->frag[0].addr,
+                                                           le32_to_cpu(desc->frag[0].addr),
                                                            np->rx_buf_sz,
                                                            PCI_DMA_FROMDEVICE);
 
                                skb_copy_to_linear_data(skb, np->rx_skbuff[entry]->data, pkt_len);
                                pci_dma_sync_single_for_device(np->pci_dev,
-                                                              desc->frag[0].addr,
+                                                              le32_to_cpu(desc->frag[0].addr),
                                                               np->rx_buf_sz,
                                                               PCI_DMA_FROMDEVICE);
                                skb_put(skb, pkt_len);
                        } else {
                                pci_unmap_single(np->pci_dev,
-                                       desc->frag[0].addr,
+                                       le32_to_cpu(desc->frag[0].addr),
                                        np->rx_buf_sz,
                                        PCI_DMA_FROMDEVICE);
                                skb_put(skb = np->rx_skbuff[entry], pkt_len);
@@ -1709,23 +1709,23 @@ static int netdev_close(struct net_device *dev)
        /* Free all the skbuffs in the Rx queue. */
        for (i = 0; i < RX_RING_SIZE; i++) {
                np->rx_ring[i].status = 0;
-               np->rx_ring[i].frag[0].addr = 0xBADF00D0; /* An invalid address. */
                skb = np->rx_skbuff[i];
                if (skb) {
                        pci_unmap_single(np->pci_dev,
-                               np->rx_ring[i].frag[0].addr, np->rx_buf_sz,
-                               PCI_DMA_FROMDEVICE);
+                               le32_to_cpu(np->rx_ring[i].frag[0].addr),
+                               np->rx_buf_sz, PCI_DMA_FROMDEVICE);
                        dev_kfree_skb(skb);
                        np->rx_skbuff[i] = NULL;
                }
+               np->rx_ring[i].frag[0].addr = cpu_to_le32(0xBADF00D0); /* poison */
        }
        for (i = 0; i < TX_RING_SIZE; i++) {
                np->tx_ring[i].next_desc = 0;
                skb = np->tx_skbuff[i];
                if (skb) {
                        pci_unmap_single(np->pci_dev,
-                               np->tx_ring[i].frag[0].addr, skb->len,
-                               PCI_DMA_TODEVICE);
+                               le32_to_cpu(np->tx_ring[i].frag[0].addr),
+                               skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
                        np->tx_skbuff[i] = NULL;
                }
index 4942f7d18937b9cbbe94fd37607c2d331bb11c70..22eb7c8c1a256fc4a48a4c29b27f946b01fc6386 100644 (file)
@@ -8189,6 +8189,7 @@ static int tg3_get_eeprom_len(struct net_device *dev)
 }
 
 static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val);
+static int tg3_nvram_read_le(struct tg3 *tp, u32 offset, __le32 *val);
 static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val);
 
 static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data)
@@ -8196,7 +8197,8 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
        struct tg3 *tp = netdev_priv(dev);
        int ret;
        u8  *pd;
-       u32 i, offset, len, val, b_offset, b_count;
+       u32 i, offset, len, b_offset, b_count;
+       __le32 val;
 
        if (tp->link_config.phy_is_low_power)
                return -EAGAIN;
@@ -8215,10 +8217,9 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
                        /* i.e. offset=1 len=2 */
                        b_count = len;
                }
-               ret = tg3_nvram_read(tp, offset-b_offset, &val);
+               ret = tg3_nvram_read_le(tp, offset-b_offset, &val);
                if (ret)
                        return ret;
-               val = cpu_to_le32(val);
                memcpy(data, ((char*)&val) + b_offset, b_count);
                len -= b_count;
                offset += b_count;
@@ -8228,12 +8229,11 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
        /* read bytes upto the last 4 byte boundary */
        pd = &data[eeprom->len];
        for (i = 0; i < (len - (len & 3)); i += 4) {
-               ret = tg3_nvram_read(tp, offset + i, &val);
+               ret = tg3_nvram_read_le(tp, offset + i, &val);
                if (ret) {
                        eeprom->len += i;
                        return ret;
                }
-               val = cpu_to_le32(val);
                memcpy(pd + i, &val, 4);
        }
        eeprom->len += i;
@@ -8243,11 +8243,10 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
                pd = &data[eeprom->len];
                b_count = len & 3;
                b_offset = offset + len - b_count;
-               ret = tg3_nvram_read(tp, b_offset, &val);
+               ret = tg3_nvram_read_le(tp, b_offset, &val);
                if (ret)
                        return ret;
-               val = cpu_to_le32(val);
-               memcpy(pd, ((char*)&val), b_count);
+               memcpy(pd, &val, b_count);
                eeprom->len += b_count;
        }
        return 0;
@@ -8259,8 +8258,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
 {
        struct tg3 *tp = netdev_priv(dev);
        int ret;
-       u32 offset, len, b_offset, odd_len, start, end;
+       u32 offset, len, b_offset, odd_len;
        u8 *buf;
+       __le32 start, end;
 
        if (tp->link_config.phy_is_low_power)
                return -EAGAIN;
@@ -8273,10 +8273,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
 
        if ((b_offset = (offset & 3))) {
                /* adjustments to start on required 4 byte boundary */
-               ret = tg3_nvram_read(tp, offset-b_offset, &start);
+               ret = tg3_nvram_read_le(tp, offset-b_offset, &start);
                if (ret)
                        return ret;
-               start = cpu_to_le32(start);
                len += b_offset;
                offset &= ~3;
                if (len < 4)
@@ -8288,10 +8287,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
                /* adjustments to end on required 4 byte boundary */
                odd_len = 1;
                len = (len + 3) & ~3;
-               ret = tg3_nvram_read(tp, offset+len-4, &end);
+               ret = tg3_nvram_read_le(tp, offset+len-4, &end);
                if (ret)
                        return ret;
-               end = cpu_to_le32(end);
        }
 
        buf = data;
@@ -8734,7 +8732,8 @@ static void tg3_get_ethtool_stats (struct net_device *dev,
 
 static int tg3_test_nvram(struct tg3 *tp)
 {
-       u32 *buf, csum, magic;
+       u32 csum, magic;
+       __le32 *buf;
        int i, j, k, err = 0, size;
 
        if (tg3_nvram_read_swab(tp, 0, &magic) != 0)
@@ -8771,21 +8770,19 @@ static int tg3_test_nvram(struct tg3 *tp)
 
        err = -EIO;
        for (i = 0, j = 0; i < size; i += 4, j++) {
-               u32 val;
-
-               if ((err = tg3_nvram_read(tp, i, &val)) != 0)
+               if ((err = tg3_nvram_read_le(tp, i, &buf[j])) != 0)
                        break;
-               buf[j] = cpu_to_le32(val);
        }
        if (i < size)
                goto out;
 
        /* Selfboot format */
-       if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_FW_MSK) ==
+       magic = swab32(le32_to_cpu(buf[0]));
+       if ((magic & TG3_EEPROM_MAGIC_FW_MSK) ==
            TG3_EEPROM_MAGIC_FW) {
                u8 *buf8 = (u8 *) buf, csum8 = 0;
 
-               if ((cpu_to_be32(buf[0]) & TG3_EEPROM_SB_REVISION_MASK) ==
+               if ((magic & TG3_EEPROM_SB_REVISION_MASK) ==
                    TG3_EEPROM_SB_REVISION_2) {
                        /* For rev 2, the csum doesn't include the MBA. */
                        for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++)
@@ -8806,7 +8803,7 @@ static int tg3_test_nvram(struct tg3 *tp)
                goto out;
        }
 
-       if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_HW_MSK) ==
+       if ((magic & TG3_EEPROM_MAGIC_HW_MSK) ==
            TG3_EEPROM_MAGIC_HW) {
                u8 data[NVRAM_SELFBOOT_DATA_SIZE];
                u8 parity[NVRAM_SELFBOOT_DATA_SIZE];
@@ -8852,12 +8849,12 @@ static int tg3_test_nvram(struct tg3 *tp)
 
        /* Bootstrap checksum at offset 0x10 */
        csum = calc_crc((unsigned char *) buf, 0x10);
-       if(csum != cpu_to_le32(buf[0x10/4]))
+       if(csum != le32_to_cpu(buf[0x10/4]))
                goto out;
 
        /* Manufacturing block starts at offset 0x74, checksum at 0xfc */
        csum = calc_crc((unsigned char *) &buf[0x74/4], 0x88);
-       if (csum != cpu_to_le32(buf[0xfc/4]))
+       if (csum != le32_to_cpu(buf[0xfc/4]))
                 goto out;
 
        err = 0;
@@ -10171,6 +10168,15 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
        return ret;
 }
 
+static int tg3_nvram_read_le(struct tg3 *tp, u32 offset, __le32 *val)
+{
+       u32 v;
+       int res = tg3_nvram_read(tp, offset, &v);
+       if (!res)
+               *val = cpu_to_le32(v);
+       return res;
+}
+
 static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val)
 {
        int err;
@@ -10188,13 +10194,14 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp,
        u32 val;
 
        for (i = 0; i < len; i += 4) {
-               u32 addr, data;
+               u32 addr;
+               __le32 data;
 
                addr = offset + i;
 
                memcpy(&data, buf + i, 4);
 
-               tw32(GRC_EEPROM_DATA, cpu_to_le32(data));
+               tw32(GRC_EEPROM_DATA, le32_to_cpu(data));
 
                val = tr32(GRC_EEPROM_ADDR);
                tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE);
@@ -10244,8 +10251,8 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
                phy_addr = offset & ~pagemask;
 
                for (j = 0; j < pagesize; j += 4) {
-                       if ((ret = tg3_nvram_read(tp, phy_addr + j,
-                                               (u32 *) (tmp + j))))
+                       if ((ret = tg3_nvram_read_le(tp, phy_addr + j,
+                                               (__le32 *) (tmp + j))))
                                break;
                }
                if (ret)
@@ -10289,10 +10296,11 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
                        break;
 
                for (j = 0; j < pagesize; j += 4) {
-                       u32 data;
+                       __be32 data;
 
-                       data = *((u32 *) (tmp + j));
-                       tw32(NVRAM_WRDATA, cpu_to_be32(data));
+                       data = *((__be32 *) (tmp + j));
+                       /* swab32(le32_to_cpu(data)), actually */
+                       tw32(NVRAM_WRDATA, be32_to_cpu(data));
 
                        tw32(NVRAM_ADDR, phy_addr + j);
 
@@ -10326,10 +10334,11 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len,
        int i, ret = 0;
 
        for (i = 0; i < len; i += 4, offset += 4) {
-               u32 data, page_off, phy_addr, nvram_cmd;
+               u32 page_off, phy_addr, nvram_cmd;
+               __be32 data;
 
                memcpy(&data, buf + i, 4);
-               tw32(NVRAM_WRDATA, cpu_to_be32(data));
+               tw32(NVRAM_WRDATA, be32_to_cpu(data));
 
                page_off = offset % tp->nvram_pagesize;
 
@@ -10831,6 +10840,7 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
                vpd_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_VPD);
                for (i = 0; i < 256; i += 4) {
                        u32 tmp, j = 0;
+                       __le32 v;
                        u16 tmp16;
 
                        pci_write_config_word(tp->pdev, vpd_cap + PCI_VPD_ADDR,
@@ -10847,8 +10857,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
 
                        pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA,
                                              &tmp);
-                       tmp = cpu_to_le32(tmp);
-                       memcpy(&vpd_data[i], &tmp, 4);
+                       v = cpu_to_le32(tmp);
+                       memcpy(&vpd_data[i], &v, 4);
                }
        }
 
@@ -10941,11 +10951,11 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
 
        offset = offset + ver_offset - start;
        for (i = 0; i < 16; i += 4) {
-               if (tg3_nvram_read(tp, offset + i, &val))
+               __le32 v;
+               if (tg3_nvram_read_le(tp, offset + i, &v))
                        return;
 
-               val = le32_to_cpu(val);
-               memcpy(tp->fw_ver + i, &val, 4);
+               memcpy(tp->fw_ver + i, &v, 4);
        }
 
        if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) ||
@@ -10983,19 +10993,19 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
        tp->fw_ver[bcnt++] = ' ';
 
        for (i = 0; i < 4; i++) {
-               if (tg3_nvram_read(tp, offset, &val))
+               __le32 v;
+               if (tg3_nvram_read_le(tp, offset, &v))
                        return;
 
-               val = le32_to_cpu(val);
-               offset += sizeof(val);
+               offset += sizeof(v);
 
-               if (bcnt > TG3_VER_SIZE - sizeof(val)) {
-                       memcpy(&tp->fw_ver[bcnt], &val, TG3_VER_SIZE - bcnt);
+               if (bcnt > TG3_VER_SIZE - sizeof(v)) {
+                       memcpy(&tp->fw_ver[bcnt], &v, TG3_VER_SIZE - bcnt);
                        break;
                }
 
-               memcpy(&tp->fw_ver[bcnt], &val, sizeof(val));
-               bcnt += sizeof(val);
+               memcpy(&tp->fw_ver[bcnt], &v, sizeof(v));
+               bcnt += sizeof(v);
        }
 
        tp->fw_ver[TG3_VER_SIZE - 1] = 0;
index 5d31519a6c67a3c68f2bdbe4ee220f3fa303c33b..44a06f8b588f2069ca4b841f3c904272797567fb 100644 (file)
@@ -570,7 +570,7 @@ static int xl_open(struct net_device *dev)
        struct xl_private *xl_priv=netdev_priv(dev);
        u8 __iomem *xl_mmio = xl_priv->xl_mmio ; 
        u8 i ; 
-       u16 hwaddr[3] ; /* Should be u8[6] but we get word return values */
+       __le16 hwaddr[3] ; /* Should be u8[6] but we get word return values */
        int open_err ;
 
        u16 switchsettings, switchsettings_eeprom  ;
@@ -580,15 +580,12 @@ static int xl_open(struct net_device *dev)
        }
 
        /* 
-        * Read the information from the EEPROM that we need. I know we
-        * should use ntohs, but the word gets stored reversed in the 16
-        * bit field anyway and it all works its self out when we memcpy
-        * it into dev->dev_addr. 
+        * Read the information from the EEPROM that we need.
         */
        
-       hwaddr[0] = xl_ee_read(dev,0x10) ; 
-       hwaddr[1] = xl_ee_read(dev,0x11) ; 
-       hwaddr[2] = xl_ee_read(dev,0x12) ; 
+       hwaddr[0] = cpu_to_le16(xl_ee_read(dev,0x10));
+       hwaddr[1] = cpu_to_le16(xl_ee_read(dev,0x11));
+       hwaddr[2] = cpu_to_le16(xl_ee_read(dev,0x12));
 
        /* Ring speed */
 
@@ -665,8 +662,8 @@ static int xl_open(struct net_device *dev)
                        break ; 
 
                skb->dev = dev ; 
-               xl_priv->xl_rx_ring[i].upfragaddr = pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; 
-               xl_priv->xl_rx_ring[i].upfraglen = xl_priv->pkt_buf_sz | RXUPLASTFRAG;
+               xl_priv->xl_rx_ring[i].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE));
+               xl_priv->xl_rx_ring[i].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG;
                xl_priv->rx_ring_skb[i] = skb ;         
        }
 
@@ -680,7 +677,7 @@ static int xl_open(struct net_device *dev)
        xl_priv->rx_ring_tail = 0 ; 
        xl_priv->rx_ring_dma_addr = pci_map_single(xl_priv->pdev,xl_priv->xl_rx_ring, sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE, PCI_DMA_TODEVICE) ; 
        for (i=0;i<(xl_priv->rx_ring_no-1);i++) { 
-               xl_priv->xl_rx_ring[i].upnextptr = xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * (i+1)) ; 
+               xl_priv->xl_rx_ring[i].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * (i+1)));
        } 
        xl_priv->xl_rx_ring[i].upnextptr = 0 ; 
 
@@ -698,7 +695,7 @@ static int xl_open(struct net_device *dev)
         * Setup the first dummy DPD entry for polling to start working.
         */
 
-       xl_priv->xl_tx_ring[0].framestartheader = TXDPDEMPTY ; 
+       xl_priv->xl_tx_ring[0].framestartheader = TXDPDEMPTY;
        xl_priv->xl_tx_ring[0].buffer = 0 ; 
        xl_priv->xl_tx_ring[0].buffer_length = 0 ; 
        xl_priv->xl_tx_ring[0].dnnextptr = 0 ; 
@@ -811,17 +808,17 @@ static int xl_open_hw(struct net_device *dev)
                return open_err ; 
        } else { 
                writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 8, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-               xl_priv->asb = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 
+               xl_priv->asb = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
                printk(KERN_INFO "%s: Adapter Opened Details: ",dev->name) ; 
                printk("ASB: %04x",xl_priv->asb ) ; 
                writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 10, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-               printk(", SRB: %04x",ntohs(readw(xl_mmio + MMIO_MACDATA)) ) ; 
+               printk(", SRB: %04x",swab16(readw(xl_mmio + MMIO_MACDATA)) ) ;
  
                writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 12, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-               xl_priv->arb = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 
+               xl_priv->arb = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
                printk(", ARB: %04x \n",xl_priv->arb ) ; 
                writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 14, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-               vsoff = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 
+               vsoff = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
 
                /* 
                 * Interesting, sending the individual characters directly to printk was causing klogd to use
@@ -873,16 +870,15 @@ static int xl_open_hw(struct net_device *dev)
 static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on bloat in xl_rx */ 
 {
        struct xl_private *xl_priv=netdev_priv(dev);
-       int prev_ring_loc ; 
-
-       prev_ring_loc = (xl_priv->rx_ring_tail + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1);
-       xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * xl_priv->rx_ring_tail) ; 
-       xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus = 0 ; 
-       xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upnextptr = 0 ;      
-       xl_priv->rx_ring_tail++ ; 
-       xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1) ; 
-
-       return ; 
+       int n = xl_priv->rx_ring_tail;
+       int prev_ring_loc;
+
+       prev_ring_loc = (n + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1);
+       xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * n));
+       xl_priv->xl_rx_ring[n].framestatus = 0;
+       xl_priv->xl_rx_ring[n].upnextptr = 0;
+       xl_priv->rx_ring_tail++;
+       xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1);
 }
 
 static void xl_rx(struct net_device *dev)
@@ -914,7 +910,7 @@ static void xl_rx(struct net_device *dev)
                                temp_ring_loc &= (XL_RX_RING_SIZE-1) ; 
                        }
 
-                       frame_length = xl_priv->xl_rx_ring[temp_ring_loc].framestatus & 0x7FFF ; 
+                       frame_length = le32_to_cpu(xl_priv->xl_rx_ring[temp_ring_loc].framestatus) & 0x7FFF;
 
                        skb = dev_alloc_skb(frame_length) ;
  
@@ -931,29 +927,29 @@ static void xl_rx(struct net_device *dev)
                        }
        
                        while (xl_priv->rx_ring_tail != temp_ring_loc) { 
-                               copy_len = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen & 0x7FFF ; 
+                               copy_len = le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen) & 0x7FFF;
                                frame_length -= copy_len ;  
-                               pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ;
+                               pci_dma_sync_single_for_cpu(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
                                skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail],
                                                          skb_put(skb, copy_len),
                                                          copy_len);
-                               pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ;
+                               pci_dma_sync_single_for_device(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
                                adv_rx_ring(dev) ; 
                        } 
 
                        /* Now we have found the last fragment */
-                       pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ;
+                       pci_dma_sync_single_for_cpu(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
                        skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail],
                                      skb_put(skb,copy_len), frame_length);
 /*                     memcpy(skb_put(skb,frame_length), bus_to_virt(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), frame_length) ; */
-                       pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ;
+                       pci_dma_sync_single_for_device(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
                        adv_rx_ring(dev) ; 
                        skb->protocol = tr_type_trans(skb,dev) ; 
                        netif_rx(skb) ; 
 
                } else { /* Single Descriptor Used, simply swap buffers over, fast path  */
 
-                       frame_length = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus & 0x7FFF ; 
+                       frame_length = le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus) & 0x7FFF;
                        
                        skb = dev_alloc_skb(xl_priv->pkt_buf_sz) ; 
 
@@ -966,13 +962,13 @@ static void xl_rx(struct net_device *dev)
                        }
 
                        skb2 = xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] ; 
-                       pci_unmap_single(xl_priv->pdev, xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr, xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; 
+                       pci_unmap_single(xl_priv->pdev, le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ;
                        skb_put(skb2, frame_length) ; 
                        skb2->protocol = tr_type_trans(skb2,dev) ; 
 
                        xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] = skb ;     
-                       xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; 
-                       xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = xl_priv->pkt_buf_sz | RXUPLASTFRAG ; 
+                       xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE));
+                       xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG;
                        adv_rx_ring(dev) ; 
                        xl_priv->xl_stats.rx_packets++ ; 
                        xl_priv->xl_stats.rx_bytes += frame_length ;    
@@ -1022,7 +1018,7 @@ static void xl_freemem(struct net_device *dev)
 
        for (i=0;i<XL_RX_RING_SIZE;i++) {
                dev_kfree_skb_irq(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail]) ; 
-               pci_unmap_single(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; 
+               pci_unmap_single(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE);
                xl_priv->rx_ring_tail++ ; 
                xl_priv->rx_ring_tail &= XL_RX_RING_SIZE-1; 
        } 
@@ -1181,9 +1177,9 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev)
 
                txd = &(xl_priv->xl_tx_ring[tx_head]) ; 
                txd->dnnextptr = 0 ; 
-               txd->framestartheader = skb->len | TXDNINDICATE ; 
-               txd->buffer = pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE) ; 
-               txd->buffer_length = skb->len | TXDNFRAGLAST  ; 
+               txd->framestartheader = cpu_to_le32(skb->len) | TXDNINDICATE;
+               txd->buffer = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE));
+               txd->buffer_length = cpu_to_le32(skb->len) | TXDNFRAGLAST;
                xl_priv->tx_ring_skb[tx_head] = skb ; 
                xl_priv->xl_stats.tx_packets++ ; 
                xl_priv->xl_stats.tx_bytes += skb->len ;
@@ -1199,7 +1195,7 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev)
                xl_priv->tx_ring_head &= (XL_TX_RING_SIZE - 1) ;
                xl_priv->free_ring_entries-- ; 
 
-               xl_priv->xl_tx_ring[tx_prev].dnnextptr = xl_priv->tx_ring_dma_addr + (sizeof (struct xl_tx_desc) * tx_head) ; 
+               xl_priv->xl_tx_ring[tx_prev].dnnextptr = cpu_to_le32(xl_priv->tx_ring_dma_addr + (sizeof (struct xl_tx_desc) * tx_head));
 
                /* Sneaky, by doing a read on DnListPtr we can force the card to poll on the DnNextPtr */
                /* readl(xl_mmio + MMIO_DNLISTPTR) ; */
@@ -1237,9 +1233,9 @@ static void xl_dn_comp(struct net_device *dev)
 
        while (xl_priv->xl_tx_ring[xl_priv->tx_ring_tail].framestartheader & TXDNCOMPLETE ) { 
                txd = &(xl_priv->xl_tx_ring[xl_priv->tx_ring_tail]) ;
-               pci_unmap_single(xl_priv->pdev,txd->buffer, xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]->len, PCI_DMA_TODEVICE) ; 
+               pci_unmap_single(xl_priv->pdev, le32_to_cpu(txd->buffer), xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]->len, PCI_DMA_TODEVICE);
                txd->framestartheader = 0 ; 
-               txd->buffer = 0xdeadbeef  ; 
+               txd->buffer = cpu_to_le32(0xdeadbeef);
                txd->buffer_length  = 0 ;  
                dev_kfree_skb_irq(xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]) ;
                xl_priv->tx_ring_tail++ ; 
@@ -1507,9 +1503,9 @@ static void xl_arb_cmd(struct net_device *dev)
        if (arb_cmd == RING_STATUS_CHANGE) { /* Ring.Status.Change */
                writel( ( (MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ;
                 
-               printk(KERN_INFO "%s: Ring Status Change: New Status = %04x\n", dev->name, ntohs(readw(xl_mmio + MMIO_MACDATA) )) ; 
+               printk(KERN_INFO "%s: Ring Status Change: New Status = %04x\n", dev->name, swab16(readw(xl_mmio + MMIO_MACDATA) )) ;
 
-               lan_status = ntohs(readw(xl_mmio + MMIO_MACDATA));
+               lan_status = swab16(readw(xl_mmio + MMIO_MACDATA));
        
                /* Acknowledge interrupt, this tells nic we are done with the arb */
                writel(ACK_INTERRUPT | ARBCACK | LATCH_ACK, xl_mmio + MMIO_COMMAND) ; 
@@ -1573,7 +1569,7 @@ static void xl_arb_cmd(struct net_device *dev)
                printk(KERN_INFO "Received.Data \n") ; 
 #endif                 
                writel( ((MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ;
-               xl_priv->mac_buffer = ntohs(readw(xl_mmio + MMIO_MACDATA)) ;
+               xl_priv->mac_buffer = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
                
                /* Now we are going to be really basic here and not do anything
                 * with the data at all. The tech docs do not give me enough
@@ -1634,7 +1630,7 @@ static void xl_asb_cmd(struct net_device *dev)
        writeb(0x81, xl_mmio + MMIO_MACDATA) ; 
 
        writel(MEM_WORD_WRITE | 0xd0000 | xl_priv->asb | 6, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-       writew(ntohs(xl_priv->mac_buffer), xl_mmio + MMIO_MACDATA) ; 
+       writew(swab16(xl_priv->mac_buffer), xl_mmio + MMIO_MACDATA) ;
 
        xl_wait_misr_flags(dev) ;       
 
index 05c860368852df632d53860d2ffcad757aaa36ea..b880cba0f6fd9429f4b859f9ca1f046e23c29f54 100644 (file)
 #define HOSTERRINT (1<<1)
 
 /* Receive descriptor bits */
-#define RXOVERRUN (1<<19)
-#define RXFC (1<<21)
-#define RXAR (1<<22)
-#define RXUPDCOMPLETE (1<<23)
-#define RXUPDFULL (1<<24)
-#define RXUPLASTFRAG (1<<31)
+#define RXOVERRUN cpu_to_le32(1<<19)
+#define RXFC cpu_to_le32(1<<21)
+#define RXAR cpu_to_le32(1<<22)
+#define RXUPDCOMPLETE cpu_to_le32(1<<23)
+#define RXUPDFULL cpu_to_le32(1<<24)
+#define RXUPLASTFRAG cpu_to_le32(1<<31)
 
 /* Transmit descriptor bits */
-#define TXDNCOMPLETE (1<<16)
-#define TXTXINDICATE (1<<27)
-#define TXDPDEMPTY (1<<29)
-#define TXDNINDICATE (1<<31)
-#define TXDNFRAGLAST (1<<31)
+#define TXDNCOMPLETE cpu_to_le32(1<<16)
+#define TXTXINDICATE cpu_to_le32(1<<27)
+#define TXDPDEMPTY cpu_to_le32(1<<29)
+#define TXDNINDICATE cpu_to_le32(1<<31)
+#define TXDNFRAGLAST cpu_to_le32(1<<31)
 
 /* Interrupts to Acknowledge */
 #define LATCH_ACK 1 
 /* 3c359 data structures */
 
 struct xl_tx_desc {
-       u32 dnnextptr ; 
-       u32 framestartheader ; 
-       u32 buffer ;
-       u32 buffer_length ;
+       __le32 dnnextptr;
+       __le32 framestartheader;
+       __le32 buffer;
+       __le32 buffer_length;
 };
 
 struct xl_rx_desc {
-       u32 upnextptr ; 
-       u32 framestatus ; 
-       u32 upfragaddr ; 
-       u32 upfraglen ; 
+       __le32 upnextptr;
+       __le32 framestatus;
+       __le32 upfragaddr;
+       __le32 upfraglen;
 };
 
 struct xl_private {
index 41f34bb91cad9d12dd0fdb245398d2d60e72a487..6e8b18a3b3ccbd366f7608632627a6f1eace9b57 100644 (file)
@@ -911,7 +911,7 @@ static int     de4x5_init(struct net_device *dev);
 static int     de4x5_sw_reset(struct net_device *dev);
 static int     de4x5_rx(struct net_device *dev);
 static int     de4x5_tx(struct net_device *dev);
-static int     de4x5_ast(struct net_device *dev);
+static void    de4x5_ast(struct net_device *dev);
 static int     de4x5_txur(struct net_device *dev);
 static int     de4x5_rx_ovfc(struct net_device *dev);
 
@@ -984,11 +984,9 @@ static int     test_bad_enet(struct net_device *dev, int status);
 static int     an_exception(struct de4x5_private *lp);
 static char    *build_setup_frame(struct net_device *dev, int mode);
 static void    disable_ast(struct net_device *dev);
-static void    enable_ast(struct net_device *dev, u32 time_out);
 static long    de4x5_switch_mac_port(struct net_device *dev);
 static int     gep_rd(struct net_device *dev);
 static void    gep_wr(s32 data, struct net_device *dev);
-static void    timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec);
 static void    yawn(struct net_device *dev, int state);
 static void    de4x5_parse_params(struct net_device *dev);
 static void    de4x5_dbg_open(struct net_device *dev);
@@ -1139,6 +1137,8 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev)
        lp->gendev = gendev;
        spin_lock_init(&lp->lock);
        init_timer(&lp->timer);
+       lp->timer.function = (void (*)(unsigned long))de4x5_ast;
+       lp->timer.data = (unsigned long)dev;
        de4x5_parse_params(dev);
 
        /*
@@ -1311,7 +1311,7 @@ de4x5_open(struct net_device *dev)
     lp->state = OPEN;
     de4x5_dbg_open(dev);
 
-    if (request_irq(dev->irq, (void *)de4x5_interrupt, IRQF_SHARED,
+    if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED,
                                                     lp->adapter_name, dev)) {
        printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq);
        if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED,
@@ -1737,27 +1737,29 @@ de4x5_tx(struct net_device *dev)
     return 0;
 }
 
-static int
+static void
 de4x5_ast(struct net_device *dev)
 {
-    struct de4x5_private *lp = netdev_priv(dev);
-    int next_tick = DE4X5_AUTOSENSE_MS;
+       struct de4x5_private *lp = netdev_priv(dev);
+       int next_tick = DE4X5_AUTOSENSE_MS;
+       int dt;
 
-    disable_ast(dev);
+       if (lp->useSROM)
+               next_tick = srom_autoconf(dev);
+       else if (lp->chipset == DC21140)
+               next_tick = dc21140m_autoconf(dev);
+       else if (lp->chipset == DC21041)
+               next_tick = dc21041_autoconf(dev);
+       else if (lp->chipset == DC21040)
+               next_tick = dc21040_autoconf(dev);
+       lp->linkOK = 0;
 
-    if (lp->useSROM) {
-       next_tick = srom_autoconf(dev);
-    } else if (lp->chipset == DC21140) {
-       next_tick = dc21140m_autoconf(dev);
-    } else if (lp->chipset == DC21041) {
-       next_tick = dc21041_autoconf(dev);
-    } else if (lp->chipset == DC21040) {
-       next_tick = dc21040_autoconf(dev);
-    }
-    lp->linkOK = 0;
-    enable_ast(dev, next_tick);
+       dt = (next_tick * HZ) / 1000;
 
-    return 0;
+       if (!dt)
+               dt = 1;
+
+       mod_timer(&lp->timer, jiffies + dt);
 }
 
 static int
@@ -2174,7 +2176,7 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
        for (j=0, i=0; i<ETH_ALEN; i++) {
            j += (u_char) *((u_char *)&lp->srom + SROM_HWADD + i);
        }
-       if ((j != 0) && (j != 0x5fa)) {
+       if (j != 0 && j != 6 * 0xff) {
            last.chipset = device;
            last.bus = pb;
            last.irq = irq;
@@ -2371,30 +2373,19 @@ static struct pci_driver de4x5_pci_driver = {
 static int
 autoconf_media(struct net_device *dev)
 {
-    struct de4x5_private *lp = netdev_priv(dev);
-    u_long iobase = dev->base_addr;
-    int next_tick = DE4X5_AUTOSENSE_MS;
+       struct de4x5_private *lp = netdev_priv(dev);
+       u_long iobase = dev->base_addr;
 
-    lp->linkOK = 0;
-    lp->c_media = AUTO;                     /* Bogus last media */
-    disable_ast(dev);
-    inl(DE4X5_MFC);                         /* Zero the lost frames counter */
-    lp->media = INIT;
-    lp->tcount = 0;
+       disable_ast(dev);
 
-    if (lp->useSROM) {
-       next_tick = srom_autoconf(dev);
-    } else if (lp->chipset == DC21040) {
-       next_tick = dc21040_autoconf(dev);
-    } else if (lp->chipset == DC21041) {
-       next_tick = dc21041_autoconf(dev);
-    } else if (lp->chipset == DC21140) {
-       next_tick = dc21140m_autoconf(dev);
-    }
+       lp->c_media = AUTO;                     /* Bogus last media */
+       inl(DE4X5_MFC);                         /* Zero the lost frames counter */
+       lp->media = INIT;
+       lp->tcount = 0;
 
-    enable_ast(dev, next_tick);
+       de4x5_ast(dev);
 
-    return (lp->media);
+       return lp->media;
 }
 
 /*
@@ -4018,20 +4009,22 @@ DevicePresent(struct net_device *dev, u_long aprom_addr)
            outl(0, aprom_addr);       /* Reset Ethernet Address ROM Pointer */
        }
     } else {                           /* Read new srom */
-       u_short tmp, *p = (short *)((char *)&lp->srom + SROM_HWADD);
+       u_short tmp;
+       __le16 *p = (__le16 *)((char *)&lp->srom + SROM_HWADD);
        for (i=0; i<(ETH_ALEN>>1); i++) {
            tmp = srom_rd(aprom_addr, (SROM_HWADD>>1) + i);
-           *p = le16_to_cpu(tmp);
-           j += *p++;
+           j += tmp;   /* for check for 0:0:0:0:0:0 or ff:ff:ff:ff:ff:ff */
+           *p = cpu_to_le16(tmp);
        }
-       if ((j == 0) || (j == 0x2fffd)) {
-           return;
+       if (j == 0 || j == 3 * 0xffff) {
+               /* could get 0 only from all-0 and 3 * 0xffff only from all-1 */
+               return;
        }
 
-       p=(short *)&lp->srom;
+       p = (__le16 *)&lp->srom;
        for (i=0; i<(sizeof(struct de4x5_srom)>>1); i++) {
            tmp = srom_rd(aprom_addr, i);
-           *p++ = le16_to_cpu(tmp);
+           *p++ = cpu_to_le16(tmp);
        }
        de4x5_dbg_srom((struct de4x5_srom *)&lp->srom);
     }
@@ -5160,22 +5153,11 @@ build_setup_frame(struct net_device *dev, int mode)
     return pa;                     /* Points to the next entry */
 }
 
-static void
-enable_ast(struct net_device *dev, u32 time_out)
-{
-    timeout(dev, (void *)&de4x5_ast, (u_long)dev, time_out);
-
-    return;
-}
-
 static void
 disable_ast(struct net_device *dev)
 {
-    struct de4x5_private *lp = netdev_priv(dev);
-
-    del_timer(&lp->timer);
-
-    return;
+       struct de4x5_private *lp = netdev_priv(dev);
+       del_timer_sync(&lp->timer);
 }
 
 static long
@@ -5244,29 +5226,6 @@ gep_rd(struct net_device *dev)
     return 0;
 }
 
-static void
-timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec)
-{
-    struct de4x5_private *lp = netdev_priv(dev);
-    int dt;
-
-    /* First, cancel any pending timer events */
-    del_timer(&lp->timer);
-
-    /* Convert msec to ticks */
-    dt = (msec * HZ) / 1000;
-    if (dt==0) dt=1;
-
-    /* Set up timer */
-    init_timer(&lp->timer);
-    lp->timer.expires = jiffies + dt;
-    lp->timer.function = fn;
-    lp->timer.data = data;
-    add_timer(&lp->timer);
-
-    return;
-}
-
 static void
 yawn(struct net_device *dev, int state)
 {
index 365331446387395ca7e878adb45dd22d0065c156..6284afd14bbb5fe42789b0a6f9531172ef9adf12 100644 (file)
@@ -117,9 +117,6 @@ int tulip_poll(struct napi_struct *napi, int budget)
        int received = 0;
 #endif
 
-       if (!netif_running(dev))
-               goto done;
-
 #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
 
 /* that one buffer is needed for mit activation; or might be a
@@ -151,7 +148,8 @@ int tulip_poll(struct napi_struct *napi, int budget)
                        if (tulip_debug > 5)
                                printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %8.8x.\n",
                                       dev->name, entry, status);
-                      if (work_done++ >= budget)
+
+                      if (++work_done >= budget)
                                goto not_done;
 
                        if ((status & 0x38008300) != 0x0300) {
@@ -260,8 +258,6 @@ int tulip_poll(struct napi_struct *napi, int budget)
                 * finally: amount of IO did not increase at all. */
        } while ((ioread32(tp->base_addr + CSR5) & RxIntr));
 
-done:
-
  #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
 
           /* We use this simplistic scheme for IM. It's proven by
index e5e2c9c4ebfee5cc1174e7c36130d8da5b516a65..ed600bf56e786d6186ad64a04ad16c57dcd16c31 100644 (file)
@@ -797,7 +797,8 @@ static int tulip_close (struct net_device *dev)
 
                tp->rx_ring[i].status = 0;      /* Not owned by Tulip chip. */
                tp->rx_ring[i].length = 0;
-               tp->rx_ring[i].buffer1 = 0xBADF00D0;    /* An invalid address. */
+               /* An invalid address. */
+               tp->rx_ring[i].buffer1 = cpu_to_le32(0xBADF00D0);
                if (skb) {
                        pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ,
                                         PCI_DMA_FROMDEVICE);
index 70befe33e454c63d1a8e4dd4ba2fab0fb728d4a3..8fc7274642eb41f851e78af59d66fb5468954090 100644 (file)
@@ -83,8 +83,8 @@ static int bufferoffsets[NUMDESCRIPTORS] = {128,2048,4096,6144};
 struct xircom_private {
        /* Send and receive buffers, kernel-addressable and dma addressable forms */
 
-       unsigned int *rx_buffer;
-       unsigned int *tx_buffer;
+       __le32 *rx_buffer;
+       __le32 *tx_buffer;
 
        dma_addr_t rx_dma_handle;
        dma_addr_t tx_dma_handle;
@@ -412,19 +412,20 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev)
                        /* FIXME: The specification tells us that the length we send HAS to be a multiple of
                           4 bytes. */
 
-                       card->tx_buffer[4*desc+1] = skb->len;
-                       if (desc == NUMDESCRIPTORS-1)
-                               card->tx_buffer[4*desc+1] |= (1<<25);  /* bit 25: last descriptor of the ring */
+                       card->tx_buffer[4*desc+1] = cpu_to_le32(skb->len);
+                       if (desc == NUMDESCRIPTORS - 1) /* bit 25: last descriptor of the ring */
+                               card->tx_buffer[4*desc+1] |= cpu_to_le32(1<<25);  
 
-                       card->tx_buffer[4*desc+1] |= 0xF0000000;
+                       card->tx_buffer[4*desc+1] |= cpu_to_le32(0xF0000000);
                                                 /* 0xF0... means want interrupts*/
                        card->tx_skb[desc] = skb;
 
                        wmb();
                        /* This gives the descriptor to the card */
-                       card->tx_buffer[4*desc] = 0x80000000;
+                       card->tx_buffer[4*desc] = cpu_to_le32(0x80000000);
                        trigger_transmit(card);
-                       if (((int)card->tx_buffer[nextdescriptor*4])<0) {       /* next descriptor is occupied... */
+                       if (card->tx_buffer[nextdescriptor*4] & cpu_to_le32(0x8000000)) {
+                               /* next descriptor is occupied... */
                                netif_stop_queue(dev);
                        }
                        card->transmit_used = nextdescriptor;
@@ -590,8 +591,7 @@ descriptors and programs the addresses into the card.
 */
 static void setup_descriptors(struct xircom_private *card)
 {
-       unsigned int val;
-       unsigned int address;
+       u32 address;
        int i;
        enter("setup_descriptors");
 
@@ -604,16 +604,16 @@ static void setup_descriptors(struct xircom_private *card)
        for (i=0;i<NUMDESCRIPTORS;i++ ) {
 
                /* Rx Descr0: It's empty, let the card own it, no errors -> 0x80000000 */
-               card->rx_buffer[i*4 + 0] = 0x80000000;
+               card->rx_buffer[i*4 + 0] = cpu_to_le32(0x80000000);
                /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */
-               card->rx_buffer[i*4 + 1] = 1536;
-               if (i==NUMDESCRIPTORS-1)
-                       card->rx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */
+               card->rx_buffer[i*4 + 1] = cpu_to_le32(1536);
+               if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */
+                       card->rx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25);
 
                /* Rx Descr2: address of the buffer
                   we store the buffer at the 2nd half of the page */
 
-               address = (unsigned long) card->rx_dma_handle;
+               address = card->rx_dma_handle;
                card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]);
                /* Rx Desc3: address of 2nd buffer -> 0 */
                card->rx_buffer[i*4 + 3] = 0;
@@ -621,9 +621,8 @@ static void setup_descriptors(struct xircom_private *card)
 
        wmb();
        /* Write the receive descriptor ring address to the card */
-       address = (unsigned long) card->rx_dma_handle;
-       val = cpu_to_le32(address);
-       outl(val, card->io_port + CSR3);        /* Receive descr list address */
+       address = card->rx_dma_handle;
+       outl(address, card->io_port + CSR3);    /* Receive descr list address */
 
 
        /* transmit descriptors */
@@ -633,13 +632,13 @@ static void setup_descriptors(struct xircom_private *card)
                /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */
                card->tx_buffer[i*4 + 0] = 0x00000000;
                /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */
-               card->tx_buffer[i*4 + 1] = 1536;
-               if (i==NUMDESCRIPTORS-1)
-                       card->tx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */
+               card->tx_buffer[i*4 + 1] = cpu_to_le32(1536);
+               if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */
+                       card->tx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25);
 
                /* Tx Descr2: address of the buffer
                   we store the buffer at the 2nd half of the page */
-               address = (unsigned long) card->tx_dma_handle;
+               address = card->tx_dma_handle;
                card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]);
                /* Tx Desc3: address of 2nd buffer -> 0 */
                card->tx_buffer[i*4 + 3] = 0;
@@ -647,9 +646,8 @@ static void setup_descriptors(struct xircom_private *card)
 
        wmb();
        /* wite the transmit descriptor ring to the card */
-       address = (unsigned long) card->tx_dma_handle;
-       val =cpu_to_le32(address);
-       outl(val, card->io_port + CSR4);        /* xmit descr list address */
+       address = card->tx_dma_handle;
+       outl(address, card->io_port + CSR4);    /* xmit descr list address */
 
        leave("setup_descriptors");
 }
@@ -1180,7 +1178,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
                int status;
 
                enter("investigate_read_descriptor");
-               status = card->rx_buffer[4*descnr];
+               status = le32_to_cpu(card->rx_buffer[4*descnr]);
 
                if ((status > 0)) {     /* packet received */
 
@@ -1210,7 +1208,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
 
                      out:
                        /* give the buffer back to the card */
-                       card->rx_buffer[4*descnr] =  0x80000000;
+                       card->rx_buffer[4*descnr] =  cpu_to_le32(0x80000000);
                        trigger_receive(card);
                }
 
@@ -1226,7 +1224,7 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p
 
                enter("investigate_write_descriptor");
 
-               status = card->tx_buffer[4*descnr];
+               status = le32_to_cpu(card->tx_buffer[4*descnr]);
 #if 0
                if (status & 0x8000) {  /* Major error */
                        printk(KERN_ERR "Major transmit error status %x \n", status);
index 1f76446959765ef577382517e7039c0ab044d5c3..f8b8c71187a076f426b40833f5631d9445c9fdf0 100644 (file)
@@ -610,7 +610,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
                        tun->flags &= ~TUN_PERSIST;
 
                DBG(KERN_INFO "%s: persist %s\n",
-                   tun->dev->name, arg ? "disabled" : "enabled");
+                   tun->dev->name, arg ? "enabled" : "disabled");
                break;
 
        case TUNSETOWNER:
index 94ac5869bb18e958578d3f38f7f723328f38dd1c..f50cb520dffbf6029e2c5dcb728bd6ec49dd1861 100644 (file)
@@ -813,8 +813,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
        first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID;
        first_txd->numDesc = 0;
        first_txd->len = 0;
-       first_txd->addr = (u64)((unsigned long) skb) & 0xffffffff;
-       first_txd->addrHi = (u64)((unsigned long) skb) >> 32;
+       first_txd->tx_addr = (u64)((unsigned long) skb);
        first_txd->processFlags = 0;
 
        if(skb->ip_summed == CHECKSUM_PARTIAL) {
@@ -850,8 +849,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
                                       PCI_DMA_TODEVICE);
                txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
                txd->len = cpu_to_le16(skb->len);
-               txd->addr = cpu_to_le32(skb_dma);
-               txd->addrHi = 0;
+               txd->frag.addr = cpu_to_le32(skb_dma);
+               txd->frag.addrHi = 0;
                first_txd->numDesc++;
        } else {
                int i, len;
@@ -861,8 +860,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
                                         PCI_DMA_TODEVICE);
                txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
                txd->len = cpu_to_le16(len);
-               txd->addr = cpu_to_le32(skb_dma);
-               txd->addrHi = 0;
+               txd->frag.addr = cpu_to_le32(skb_dma);
+               txd->frag.addrHi = 0;
                first_txd->numDesc++;
 
                for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
@@ -880,8 +879,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
                                         PCI_DMA_TODEVICE);
                        txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
                        txd->len = cpu_to_le16(len);
-                       txd->addr = cpu_to_le32(skb_dma);
-                       txd->addrHi = 0;
+                       txd->frag.addr = cpu_to_le32(skb_dma);
+                       txd->frag.addrHi = 0;
                        first_txd->numDesc++;
                }
        }
@@ -977,12 +976,12 @@ typhoon_do_get_stats(struct typhoon *tp)
         * ethtool_ops->get_{strings,stats}()
         */
        stats->tx_packets = le32_to_cpu(s->txPackets);
-       stats->tx_bytes = le32_to_cpu(s->txBytes);
+       stats->tx_bytes = le64_to_cpu(s->txBytes);
        stats->tx_errors = le32_to_cpu(s->txCarrierLost);
        stats->tx_carrier_errors = le32_to_cpu(s->txCarrierLost);
        stats->collisions = le32_to_cpu(s->txMultipleCollisions);
        stats->rx_packets = le32_to_cpu(s->rxPacketsGood);
-       stats->rx_bytes = le32_to_cpu(s->rxBytesGood);
+       stats->rx_bytes = le64_to_cpu(s->rxBytesGood);
        stats->rx_fifo_errors = le32_to_cpu(s->rxFifoOverruns);
        stats->rx_errors = le32_to_cpu(s->rxFifoOverruns) +
                        le32_to_cpu(s->BadSSD) + le32_to_cpu(s->rxCrcErrors);
@@ -1056,7 +1055,7 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
                if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) {
                        strcpy(info->fw_version, "Unknown runtime");
                } else {
-                       u32 sleep_ver = xp_resp[0].parm2;
+                       u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2);
                        snprintf(info->fw_version, 32, "%02x.%03x.%03x",
                                 sleep_ver >> 24, (sleep_ver >> 12) & 0xfff,
                                 sleep_ver & 0xfff);
@@ -1157,7 +1156,7 @@ typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        }
 
        INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_XCVR_SELECT);
-       xp_cmd.parm1 = cpu_to_le16(xcvr);
+       xp_cmd.parm1 = xcvr;
        err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL);
        if(err < 0)
                goto out;
@@ -1320,7 +1319,7 @@ typhoon_init_interface(struct typhoon *tp)
        tp->txLoRing.writeRegister = TYPHOON_REG_TX_LO_READY;
        tp->txHiRing.writeRegister = TYPHOON_REG_TX_HI_READY;
 
-       tp->txlo_dma_addr = iface->txLoAddr;
+       tp->txlo_dma_addr = le32_to_cpu(iface->txLoAddr);
        tp->card_state = Sleeping;
        smp_wmb();
 
@@ -1358,7 +1357,7 @@ typhoon_download_firmware(struct typhoon *tp)
        u8 *image_data;
        void *dpage;
        dma_addr_t dpage_dma;
-       unsigned int csum;
+       __sum16 csum;
        u32 irqEnabled;
        u32 irqMasked;
        u32 numSections;
@@ -1450,13 +1449,13 @@ typhoon_download_firmware(struct typhoon *tp)
                         * summing. Fortunately, due to the properties of
                         * the checksum, we can do this once, at the end.
                         */
-                       csum = csum_partial_copy_nocheck(image_data, dpage,
-                                                        len, 0);
-                       csum = csum_fold(csum);
-                       csum = le16_to_cpu(csum);
+                       csum = csum_fold(csum_partial_copy_nocheck(image_data,
+                                                                 dpage, len,
+                                                                 0));
 
                        iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH);
-                       iowrite32(csum, ioaddr + TYPHOON_REG_BOOT_CHECKSUM);
+                       iowrite32(le16_to_cpu((__force __le16)csum),
+                                       ioaddr + TYPHOON_REG_BOOT_CHECKSUM);
                        iowrite32(load_addr,
                                        ioaddr + TYPHOON_REG_BOOT_DEST_ADDR);
                        iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI);
@@ -1551,13 +1550,13 @@ typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing,
                if(type == TYPHOON_TX_DESC) {
                        /* This tx_desc describes a packet.
                         */
-                       unsigned long ptr = tx->addr | ((u64)tx->addrHi << 32);
+                       unsigned long ptr = tx->tx_addr;
                        struct sk_buff *skb = (struct sk_buff *) ptr;
                        dev_kfree_skb_irq(skb);
                } else if(type == TYPHOON_FRAG_DESC) {
                        /* This tx_desc describes a memory mapping. Free it.
                         */
-                       skb_dma = (dma_addr_t) le32_to_cpu(tx->addr);
+                       skb_dma = (dma_addr_t) le32_to_cpu(tx->frag.addr);
                        dma_len = le16_to_cpu(tx->len);
                        pci_unmap_single(tp->pdev, skb_dma, dma_len,
                                       PCI_DMA_TODEVICE);
@@ -1596,7 +1595,7 @@ typhoon_recycle_rx_skb(struct typhoon *tp, u32 idx)
        struct rx_free *r;
 
        if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) ==
-                               indexes->rxBuffCleared) {
+                               le32_to_cpu(indexes->rxBuffCleared)) {
                /* no room in ring, just drop the skb
                 */
                dev_kfree_skb_any(rxb->skb);
@@ -1627,7 +1626,7 @@ typhoon_alloc_rx_skb(struct typhoon *tp, u32 idx)
        rxb->skb = NULL;
 
        if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) ==
-                               indexes->rxBuffCleared)
+                               le32_to_cpu(indexes->rxBuffCleared))
                return -ENOMEM;
 
        skb = dev_alloc_skb(PKT_BUF_SZ);
index 19df20889b820a14c6a4039928d96fa2386db44a..dd7022ca735421763a0cac5bfa2f7fad595f0655 100644 (file)
@@ -73,7 +73,7 @@ struct typhoon_indexes {
        volatile __le32 txLoCleared;
        volatile __le32 txHiCleared;
        volatile __le32 rxLoReady;
-       volatile __u32 rxBuffCleared;   /* AV: really? */
+       volatile __le32 rxBuffCleared;
        volatile __le32 cmdCleared;
        volatile __le32 respReady;
        volatile __le32 rxHiReady;
@@ -166,8 +166,13 @@ struct tx_desc {
 #define TYPHOON_DESC_VALID     0x80
        u8  numDesc;
        __le16 len;
-       u32 addr;
-       u32 addrHi;
+       union {
+               struct {
+                       __le32 addr;
+                       __le32 addrHi;
+               } frag;
+               u64 tx_addr;    /* opaque for hardware, for TX_DESC */
+       };
        __le32 processFlags;
 #define TYPHOON_TX_PF_NO_CRC           __constant_cpu_to_le32(0x00000001)
 #define TYPHOON_TX_PF_IP_CHKSUM                __constant_cpu_to_le32(0x00000002)
@@ -240,8 +245,8 @@ struct rx_desc {
        u8  flags;
        u8  numDesc;
        __le16 frameLen;
-       u32 addr;
-       u32 addrHi;
+       u32 addr;       /* opaque, comes from virtAddr */
+       u32 addrHi;     /* opaque, comes from virtAddrHi */
        __le32 rxStatus;
 #define TYPHOON_RX_ERR_INTERNAL                __constant_cpu_to_le32(0x00000000)
 #define TYPHOON_RX_ERR_FIFO_UNDERRUN   __constant_cpu_to_le32(0x00000001)
index 7f689907ac28485c537559dfb3f90be2898ff741..abac7db3819eac943df7497b86735482a63170ca 100644 (file)
@@ -3447,7 +3447,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
        u16 length, howmany = 0;
        u32 bd_status;
        u8 *bdBuffer;
-       struct net_device * dev;
+       struct net_device *dev;
 
        ugeth_vdbg("%s: IN", __FUNCTION__);
 
index d8343703991916f24c29216d6a3a17ac29a3b3f7..1e45b2028a50c7f07d43d955979afd760acf42b4 100644 (file)
@@ -96,5 +96,5 @@ enum enet_tbi_mii_reg {
 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 __exit uec_mdio_exit(void);
+void uec_mdio_exit(void);
 #endif                         /* __UEC_MII_H */
index 61daa096de665025d7443783f06cdbc3d4be6c21..569028b2baf2d8930a21bca17b775c764f793c39 100644 (file)
@@ -172,45 +172,76 @@ struct asix_data {
 };
 
 struct ax88172_int_data {
-       u16 res1;
+       __le16 res1;
        u8 link;
-       u16 res2;
+       __le16 res2;
        u8 status;
-       u16 res3;
+       __le16 res3;
 } __attribute__ ((packed));
 
 static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
                            u16 size, void *data)
 {
+       void *buf;
+       int err = -ENOMEM;
+
        devdbg(dev,"asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d",
                cmd, value, index, size);
-       return usb_control_msg(
+
+       buf = kmalloc(size, GFP_KERNEL);
+       if (!buf)
+               goto out;
+
+       err = usb_control_msg(
                dev->udev,
                usb_rcvctrlpipe(dev->udev, 0),
                cmd,
                USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                value,
                index,
-               data,
+               buf,
                size,
                USB_CTRL_GET_TIMEOUT);
+       if (err == size)
+               memcpy(data, buf, size);
+       else if (err >= 0)
+               err = -EINVAL;
+       kfree(buf);
+
+out:
+       return err;
 }
 
 static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
                             u16 size, void *data)
 {
+       void *buf = NULL;
+       int err = -ENOMEM;
+
        devdbg(dev,"asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d",
                cmd, value, index, size);
-       return usb_control_msg(
+
+       if (data) {
+               buf = kmalloc(size, GFP_KERNEL);
+               if (!buf)
+                       goto out;
+               memcpy(buf, data, size);
+       }
+
+       err = usb_control_msg(
                dev->udev,
                usb_sndctrlpipe(dev->udev, 0),
                cmd,
                USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                value,
                index,
-               data,
+               buf,
                size,
                USB_CTRL_SET_TIMEOUT);
+       kfree(buf);
+
+out:
+       return err;
 }
 
 static void asix_async_cmd_callback(struct urb *urb)
@@ -402,25 +433,19 @@ static inline int asix_set_hw_mii(struct usbnet *dev)
 
 static inline int asix_get_phy_addr(struct usbnet *dev)
 {
-       int ret = 0;
-       void *buf;
+       u8 buf[2];
+       int ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf);
 
        devdbg(dev, "asix_get_phy_addr()");
 
-       buf = kmalloc(2, GFP_KERNEL);
-       if (!buf)
-               goto out1;
-
-       if ((ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID,
-                                   0, 0, 2, buf)) < 2) {
+       if (ret < 0) {
                deverr(dev, "Error reading PHYID register: %02x", ret);
-               goto out2;
+               goto out;
        }
-       devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((u16 *)buf));
-       ret = *((u8 *)buf + 1);
-out2:
-       kfree(buf);
-out1:
+       devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((__le16 *)buf));
+       ret = buf[1];
+
+out:
        return ret;
 }
 
@@ -437,22 +462,15 @@ static int asix_sw_reset(struct usbnet *dev, u8 flags)
 
 static u16 asix_read_rx_ctl(struct usbnet *dev)
 {
-       u16 ret = 0;
-       void *buf;
-
-       buf = kmalloc(2, GFP_KERNEL);
-       if (!buf)
-               goto out1;
+       __le16 v;
+       int ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL, 0, 0, 2, &v);
 
-       if ((ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL,
-                                   0, 0, 2, buf)) < 2) {
+       if (ret < 0) {
                deverr(dev, "Error reading RX_CTL register: %02x", ret);
-               goto out2;
+               goto out;
        }
-       ret = le16_to_cpu(*((u16 *)buf));
-out2:
-       kfree(buf);
-out1:
+       ret = le16_to_cpu(v);
+out:
        return ret;
 }
 
@@ -471,22 +489,15 @@ static int asix_write_rx_ctl(struct usbnet *dev, u16 mode)
 
 static u16 asix_read_medium_status(struct usbnet *dev)
 {
-       u16 ret = 0;
-       void *buf;
+       __le16 v;
+       int ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS, 0, 0, 2, &v);
 
-       buf = kmalloc(2, GFP_KERNEL);
-       if (!buf)
-               goto out1;
-
-       if ((ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS,
-                                   0, 0, 2, buf)) < 2) {
+       if (ret < 0) {
                deverr(dev, "Error reading Medium Status register: %02x", ret);
-               goto out2;
+               goto out;
        }
-       ret = le16_to_cpu(*((u16 *)buf));
-out2:
-       kfree(buf);
-out1:
+       ret = le16_to_cpu(v);
+out:
        return ret;
 }
 
@@ -568,31 +579,30 @@ static void asix_set_multicast(struct net_device *net)
 static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc)
 {
        struct usbnet *dev = netdev_priv(netdev);
-       u16 res;
+       __le16 res;
 
        mutex_lock(&dev->phy_mutex);
        asix_set_sw_mii(dev);
        asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
-                               (__u16)loc, 2, (u16 *)&res);
+                               (__u16)loc, 2, &res);
        asix_set_hw_mii(dev);
        mutex_unlock(&dev->phy_mutex);
 
-       devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res & 0xffff));
+       devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res));
 
-       return le16_to_cpu(res & 0xffff);
+       return le16_to_cpu(res);
 }
 
 static void
 asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val)
 {
        struct usbnet *dev = netdev_priv(netdev);
-       u16 res = cpu_to_le16(val);
+       __le16 res = cpu_to_le16(val);
 
        devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val);
        mutex_lock(&dev->phy_mutex);
        asix_set_sw_mii(dev);
-       asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id,
-                               (__u16)loc, 2, (u16 *)&res);
+       asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, &res);
        asix_set_hw_mii(dev);
        mutex_unlock(&dev->phy_mutex);
 }
@@ -644,7 +654,6 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
 {
        struct usbnet *dev = netdev_priv(net);
        u8 opt = 0;
-       u8 buf[1];
 
        if (wolinfo->wolopts & WAKE_PHY)
                opt |= AX_MONITOR_LINK;
@@ -654,7 +663,7 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
                opt |= AX_MONITOR_MODE;
 
        if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE,
-                             opt, 0, 0, &buf) < 0)
+                             opt, 0, 0, NULL) < 0)
                return -EINVAL;
 
        return 0;
@@ -672,7 +681,7 @@ static int asix_get_eeprom(struct net_device *net,
                              struct ethtool_eeprom *eeprom, u8 *data)
 {
        struct usbnet *dev = netdev_priv(net);
-       u16 *ebuf = (u16 *)data;
+       __le16 *ebuf = (__le16 *)data;
        int i;
 
        /* Crude hack to ensure that we don't overwrite memory
@@ -801,7 +810,7 @@ static int ax88172_link_reset(struct usbnet *dev)
 static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
 {
        int ret = 0;
-       void *buf;
+       u8 buf[ETH_ALEN];
        int i;
        unsigned long gpio_bits = dev->driver_info->data;
        struct asix_data *data = (struct asix_data *)&dev->data;
@@ -810,30 +819,23 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
 
        usbnet_get_endpoints(dev,intf);
 
-       buf = kmalloc(ETH_ALEN, GFP_KERNEL);
-       if(!buf) {
-               ret = -ENOMEM;
-               goto out1;
-       }
-
        /* Toggle the GPIOs in a manufacturer/model specific way */
        for (i = 2; i >= 0; i--) {
                if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS,
                                        (gpio_bits >> (i * 8)) & 0xff, 0, 0,
-                                       buf)) < 0)
-                       goto out2;
+                                       NULL)) < 0)
+                       goto out;
                msleep(5);
        }
 
        if ((ret = asix_write_rx_ctl(dev, 0x80)) < 0)
-               goto out2;
+               goto out;
 
        /* Get the MAC address */
-       memset(buf, 0, ETH_ALEN);
        if ((ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID,
-                               0, 0, 6, buf)) < 0) {
+                               0, 0, ETH_ALEN, buf)) < 0) {
                dbg("read AX_CMD_READ_NODE_ID failed: %d", ret);
-               goto out2;
+               goto out;
        }
        memcpy(dev->net->dev_addr, buf, ETH_ALEN);
 
@@ -855,9 +857,8 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
        mii_nway_restart(&dev->mii);
 
        return 0;
-out2:
-       kfree(buf);
-out1:
+
+out:
        return ret;
 }
 
@@ -900,66 +901,58 @@ static int ax88772_link_reset(struct usbnet *dev)
 static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
 {
        int ret, embd_phy;
-       void *buf;
        u16 rx_ctl;
        struct asix_data *data = (struct asix_data *)&dev->data;
+       u8 buf[ETH_ALEN];
        u32 phyid;
 
        data->eeprom_len = AX88772_EEPROM_LEN;
 
        usbnet_get_endpoints(dev,intf);
 
-       buf = kmalloc(6, GFP_KERNEL);
-       if(!buf) {
-               dbg ("Cannot allocate memory for buffer");
-               ret = -ENOMEM;
-               goto out1;
-       }
-
        if ((ret = asix_write_gpio(dev,
                        AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0)
-               goto out2;
+               goto out;
 
        /* 0x10 is the phy id of the embedded 10/100 ethernet phy */
        embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0);
        if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT,
-                               embd_phy, 0, 0, buf)) < 0) {
+                               embd_phy, 0, 0, NULL)) < 0) {
                dbg("Select PHY #1 failed: %d", ret);
-               goto out2;
+               goto out;
        }
 
        if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0)
-               goto out2;
+               goto out;
 
        msleep(150);
        if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0)
-               goto out2;
+               goto out;
 
        msleep(150);
        if (embd_phy) {
                if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0)
-                       goto out2;
+                       goto out;
        }
        else {
                if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0)
-                       goto out2;
+                       goto out;
        }
 
        msleep(150);
        rx_ctl = asix_read_rx_ctl(dev);
        dbg("RX_CTL is 0x%04x after software reset", rx_ctl);
        if ((ret = asix_write_rx_ctl(dev, 0x0000)) < 0)
-               goto out2;
+               goto out;
 
        rx_ctl = asix_read_rx_ctl(dev);
        dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl);
 
        /* Get the MAC address */
-       memset(buf, 0, ETH_ALEN);
        if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID,
                                0, 0, ETH_ALEN, buf)) < 0) {
                dbg("Failed to read MAC address: %d", ret);
-               goto out2;
+               goto out;
        }
        memcpy(dev->net->dev_addr, buf, ETH_ALEN);
 
@@ -976,12 +969,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
        dbg("PHYID=0x%08x", phyid);
 
        if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0)
-               goto out2;
+               goto out;
 
        msleep(150);
 
        if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0)
-               goto out2;
+               goto out;
 
        msleep(150);
 
@@ -994,18 +987,18 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
        mii_nway_restart(&dev->mii);
 
        if ((ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT)) < 0)
-               goto out2;
+               goto out;
 
        if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0,
                                AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT,
-                               AX88772_IPG2_DEFAULT, 0, buf)) < 0) {
+                               AX88772_IPG2_DEFAULT, 0, NULL)) < 0) {
                dbg("Write IPG,IPG1,IPG2 failed: %d", ret);
-               goto out2;
+               goto out;
        }
 
        /* Set RX_CTL to default values with 2k buffer, and enable cactus */
        if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0)
-               goto out2;
+               goto out;
 
        rx_ctl = asix_read_rx_ctl(dev);
        dbg("RX_CTL is 0x%04x after all initializations", rx_ctl);
@@ -1013,20 +1006,15 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
        rx_ctl = asix_read_medium_status(dev);
        dbg("Medium Status is 0x%04x after all initializations", rx_ctl);
 
-       kfree(buf);
-
        /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
        if (dev->driver_info->flags & FLAG_FRAMING_AX) {
                /* hard_mtu  is still the default - the device does not support
                   jumbo eth frames */
                dev->rx_urb_size = 2048;
        }
-
        return 0;
 
-out2:
-       kfree(buf);
-out1:
+out:
        return ret;
 }
 
@@ -1195,23 +1183,16 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
 {
        struct asix_data *data = (struct asix_data *)&dev->data;
        int ret;
-       void *buf;
-       u16 eeprom;
+       u8 buf[ETH_ALEN];
+       __le16 eeprom;
+       u8 status;
        int gpio0 = 0;
        u32 phyid;
 
        usbnet_get_endpoints(dev,intf);
 
-       buf = kmalloc(6, GFP_KERNEL);
-       if(!buf) {
-               dbg ("Cannot allocate memory for buffer");
-               ret = -ENOMEM;
-               goto out1;
-       }
-
-       eeprom = 0;
-       asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &eeprom);
-       dbg("GPIO Status: 0x%04x", eeprom);
+       asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status);
+       dbg("GPIO Status: 0x%04x", status);
 
        asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL);
        asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom);
@@ -1219,19 +1200,19 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
 
        dbg("EEPROM index 0x17 is 0x%04x", eeprom);
 
-       if (eeprom == 0xffff) {
+       if (eeprom == cpu_to_le16(0xffff)) {
                data->phymode = PHY_MODE_MARVELL;
                data->ledmode = 0;
                gpio0 = 1;
        } else {
-               data->phymode = eeprom & 7;
-               data->ledmode = eeprom >> 8;
-               gpio0 = (eeprom & 0x80) ? 0 : 1;
+               data->phymode = le16_to_cpu(eeprom) & 7;
+               data->ledmode = le16_to_cpu(eeprom) >> 8;
+               gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1;
        }
        dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode);
 
        asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40);
-       if ((eeprom >> 8) != 1) {
+       if ((le16_to_cpu(eeprom) >> 8) != 1) {
                asix_write_gpio(dev, 0x003c, 30);
                asix_write_gpio(dev, 0x001c, 300);
                asix_write_gpio(dev, 0x003c, 30);
@@ -1250,11 +1231,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
        asix_write_rx_ctl(dev, 0);
 
        /* Get the MAC address */
-       memset(buf, 0, ETH_ALEN);
        if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID,
                                0, 0, ETH_ALEN, buf)) < 0) {
                dbg("Failed to read MAC address: %d", ret);
-               goto out2;
+               goto out;
        }
        memcpy(dev->net->dev_addr, buf, ETH_ALEN);
 
@@ -1289,12 +1269,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
        mii_nway_restart(&dev->mii);
 
        if ((ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT)) < 0)
-               goto out2;
+               goto out;
 
        if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0)
-               goto out2;
-
-       kfree(buf);
+               goto out;
 
        /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
        if (dev->driver_info->flags & FLAG_FRAMING_AX) {
@@ -1302,12 +1280,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
                   jumbo eth frames */
                dev->rx_urb_size = 2048;
        }
-
        return 0;
 
-out2:
-       kfree(buf);
-out1:
+out:
        return ret;
 }
 
index 58a53a641754ba74fefd04fa048c649cc6f4faee..569ad8bfd3833448aec6625f0b1bd87a6441d1a9 100644 (file)
@@ -70,7 +70,7 @@
 #define KAWETH_TX_TIMEOUT              (5 * HZ)
 #define KAWETH_SCRATCH_SIZE            32
 #define KAWETH_FIRMWARE_BUF_SIZE       4096
-#define KAWETH_CONTROL_TIMEOUT         (30 * HZ)
+#define KAWETH_CONTROL_TIMEOUT         (30000)
 
 #define KAWETH_STATUS_BROKEN           0x0000001
 #define KAWETH_STATUS_CLOSING          0x0000002
index f55a5951733ab56b44aaaae2af0939c71c10c15c..5ea7411e13375812f13aa3cb6ccd3a81d50c47bb 100644 (file)
@@ -94,7 +94,7 @@ static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data)
 
        ret = usb_control_msg(xdev, usb_rcvctrlpipe(xdev, 0), MCS7830_RD_BREQ,
                              MCS7830_RD_BMREQ, 0x0000, index, data,
-                             size, msecs_to_jiffies(MCS7830_CTRL_TIMEOUT));
+                             size, MCS7830_CTRL_TIMEOUT);
        return ret;
 }
 
@@ -105,7 +105,7 @@ static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, void *data)
 
        ret = usb_control_msg(xdev, usb_sndctrlpipe(xdev, 0), MCS7830_WR_BREQ,
                              MCS7830_WR_BMREQ, 0x0000, index, data,
-                             size, msecs_to_jiffies(MCS7830_CTRL_TIMEOUT));
+                             size, MCS7830_CTRL_TIMEOUT);
        return ret;
 }
 
index fdd1e034569d9c44fe49f1c9d678e7550de52537..43af9e9b26525ad1fcc4f96df93168d4bfe1990c 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <net/dst.h>
 #include <net/xfrm.h>
-#include <net/veth.h>
+#include <linux/veth.h>
 
 #define DRV_NAME       "veth"
 #define DRV_VERSION    "1.0"
index 8a1778cf98d1cc0bc7b282e2d43610f78e9c8104..d3b28b01b9f91c5e5e52cfb5eb9a60940cb07531 100644 (file)
@@ -503,7 +503,7 @@ static int cycx_netdevice_init(struct net_device *dev)
        dev->addr_len           = 0;            /* hardware address length */
 
        if (!chan->svc)
-               *(u16*)dev->dev_addr = htons(chan->lcn);
+               *(__be16*)dev->dev_addr = htons(chan->lcn);
 
        /* Initialize hardware parameters (just for reference) */
        dev->irq                = wandev->irq;
@@ -565,7 +565,7 @@ static int cycx_netdevice_hard_header(struct sk_buff *skb,
                                      const void *daddr, const void *saddr,
                                      unsigned len)
 {
-       skb->protocol = type;
+       skb->protocol = htons(type);
 
        return dev->hard_header_len;
 }
@@ -600,15 +600,15 @@ static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb,
        struct cycx_device *card = chan->card;
 
        if (!chan->svc)
-               chan->protocol = skb->protocol;
+               chan->protocol = ntohs(skb->protocol);
 
        if (card->wandev.state != WAN_CONNECTED)
                ++chan->ifstats.tx_dropped;
        else if (chan->svc && chan->protocol &&
-                chan->protocol != skb->protocol) {
+                chan->protocol != ntohs(skb->protocol)) {
                printk(KERN_INFO
                       "%s: unsupported Ethertype 0x%04X on interface %s!\n",
-                      card->devname, skb->protocol, dev->name);
+                      card->devname, ntohs(skb->protocol), dev->name);
                ++chan->ifstats.tx_errors;
        } else if (chan->protocol == ETH_P_IP) {
                switch (chan->state) {
@@ -1401,7 +1401,7 @@ static void cycx_x25_set_chan_state(struct net_device *dev, u8 state)
                switch (state) {
                case WAN_CONNECTED:
                        string_state = "connected!";
-                       *(u16*)dev->dev_addr = htons(chan->lcn);
+                       *(__be16*)dev->dev_addr = htons(chan->lcn);
                        netif_wake_queue(dev);
                        reset_timer(dev);
 
index 2b733c5829152e37c78aee1ba069d86f0d3f22e6..c98fc62a3e615ae54dae8efcdd395dd0d9290a8d 100644 (file)
@@ -264,6 +264,7 @@ config IPW2200_DEBUG
 config LIBERTAS
        tristate "Marvell 8xxx Libertas WLAN driver support"
        depends on WLAN_80211
+       select WIRELESS_EXT
        select IEEE80211
        select FW_LOADER
        ---help---
@@ -586,15 +587,66 @@ config ADM8211
 config P54_COMMON
        tristate "Softmac Prism54 support"
        depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL
+       ---help---
+         This is common code for isl38xx based cards.
+         This module does nothing by itself - the USB/PCI frontends
+         also need to be enabled in order to support any devices.
+
+         These devices require softmac firmware which can be found at
+         http://prism54.org/
+
+         If you choose to build a module, it'll be called p54common.
 
 config P54_USB
        tristate "Prism54 USB support"
        depends on P54_COMMON && USB
        select CRC32
+       ---help---
+         This driver is for USB isl38xx based wireless cards.
+         These are USB based adapters found in devices such as:
+
+         3COM 3CRWE254G72
+         SMC 2862W-G
+         Accton 802.11g WN4501 USB
+         Siemens Gigaset USB
+         Netgear WG121
+         Netgear WG111
+         Medion 40900, Roper Europe
+         Shuttle PN15, Airvast WM168g, IOGear GWU513
+         Linksys WUSB54G
+         Linksys WUSB54G Portable
+         DLink DWL-G120 Spinnaker
+         DLink DWL-G122
+         Belkin F5D7050 ver 1000
+         Cohiba Proto board
+         SMC 2862W-G version 2
+         U.S. Robotics U5 802.11g Adapter
+         FUJITSU E-5400 USB D1700
+         Sagem XG703A
+         DLink DWL-G120 Cohiba
+         Spinnaker Proto board
+         Linksys WUSB54AG
+         Inventel UR054G
+         Spinnaker DUT
+
+         These devices require softmac firmware which can be found at
+         http://prism54.org/
+
+         If you choose to build a module, it'll be called p54usb.
 
 config P54_PCI
        tristate "Prism54 PCI support"
        depends on P54_COMMON && PCI
+       ---help---
+         This driver is for PCI isl38xx based wireless cards.
+         This driver supports most devices that are supported by the
+         fullmac prism54 driver plus many devices which are not
+         supported by the fullmac driver/firmware.
+
+         This driver requires softmac firmware which can be found at
+         http://prism54.org/
+
+         If you choose to build a module, it'll be called p54pci.
 
 source "drivers/net/wireless/iwlwifi/Kconfig"
 source "drivers/net/wireless/hostap/Kconfig"
index a28ad230d63e884fee652d2fe420f3137f18e2c7..7b6fc1ab2b904fc607273d8d67946d159107d871 100644 (file)
@@ -273,6 +273,8 @@ enum {
 #define B43_PHYTYPE_A                  0x00
 #define B43_PHYTYPE_B                  0x01
 #define B43_PHYTYPE_G                  0x02
+#define B43_PHYTYPE_N                  0x04
+#define B43_PHYTYPE_LP                 0x05
 
 /* PHYRegisters */
 #define B43_PHY_ILT_A_CTRL             0x0072
index 19e588582c7c4d42ed22493afcdca825ca64e9c9..6c0e2b9f7760d90633071aa9daf54c4115081cc5 100644 (file)
@@ -163,6 +163,9 @@ static void b43_map_led(struct b43_wldev *dev,
                b43_register_led(dev, &dev->led_radio, name,
                                 b43_rfkill_led_name(dev),
                                 led_index, activelow);
+               /* Sync the RF-kill LED state with the switch state. */
+               if (dev->radio_hw_enable)
+                       b43_led_turn_on(dev, led_index, activelow);
                break;
        case B43_LED_WEIRD:
        case B43_LED_ASSOC:
@@ -232,4 +235,5 @@ void b43_leds_exit(struct b43_wldev *dev)
        b43_unregister_led(&dev->led_tx);
        b43_unregister_led(&dev->led_rx);
        b43_unregister_led(&dev->led_assoc);
+       b43_unregister_led(&dev->led_radio);
 }
index b45eecc53c4ae1a5505a4460f6f54e01ab325549..1c93b4f4bfe37abd7f65b7687a945652d337ead0 100644 (file)
@@ -2163,7 +2163,6 @@ static void b43_mgmtframe_txantenna(struct b43_wldev *dev, int antenna)
 static void b43_chip_exit(struct b43_wldev *dev)
 {
        b43_radio_turn_off(dev, 1);
-       b43_leds_exit(dev);
        b43_gpio_cleanup(dev);
        /* firmware is released later */
 }
@@ -2191,11 +2190,10 @@ static int b43_chip_init(struct b43_wldev *dev)
        err = b43_gpio_init(dev);
        if (err)
                goto out;       /* firmware is released later */
-       b43_leds_init(dev);
 
        err = b43_upload_initvals(dev);
        if (err)
-               goto err_leds_exit;
+               goto err_gpio_clean;
        b43_radio_turn_on(dev);
 
        b43_write16(dev, 0x03E6, 0x0000);
@@ -2271,8 +2269,7 @@ out:
 
 err_radio_off:
        b43_radio_turn_off(dev, 1);
-err_leds_exit:
-       b43_leds_exit(dev);
+err_gpio_clean:
        b43_gpio_cleanup(dev);
        return err;
 }
@@ -3273,10 +3270,7 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
                return;
        b43_set_status(dev, B43_STAT_UNINIT);
 
-       mutex_unlock(&dev->wl->mutex);
-       b43_rfkill_exit(dev);
-       mutex_lock(&dev->wl->mutex);
-
+       b43_leds_exit(dev);
        b43_rng_exit(dev->wl);
        b43_pio_free(dev);
        b43_dma_free(dev);
@@ -3405,12 +3399,12 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
        memset(wl->mac_addr, 0, ETH_ALEN);
        b43_upload_card_macaddress(dev);
        b43_security_init(dev);
-       b43_rfkill_init(dev);
        b43_rng_init(wl);
 
        b43_set_status(dev, B43_STAT_INITIALIZED);
 
-      out:
+       b43_leds_init(dev);
+out:
        return err;
 
       err_chip_exit:
@@ -3499,6 +3493,10 @@ static int b43_start(struct ieee80211_hw *hw)
        int did_init = 0;
        int err = 0;
 
+       /* First register RFkill.
+        * LEDs that are registered later depend on it. */
+       b43_rfkill_init(dev);
+
        mutex_lock(&wl->mutex);
 
        if (b43_status(dev) < B43_STAT_INITIALIZED) {
@@ -3528,6 +3526,8 @@ static void b43_stop(struct ieee80211_hw *hw)
        struct b43_wl *wl = hw_to_b43_wl(hw);
        struct b43_wldev *dev = wl->current_dev;
 
+       b43_rfkill_exit(dev);
+
        mutex_lock(&wl->mutex);
        if (b43_status(dev) >= B43_STAT_STARTED)
                b43_wireless_core_stop(dev);
index 284d17da17d1ae73c56deb79e389697cf69c9068..08e2e56e48f493ddd9ade9f66992606819f5a1b1 100644 (file)
 #define PAD_BYTES(nr_bytes)            P4D_BYTES( __LINE__ , (nr_bytes))
 
 /* Lightweight function to convert a frequency (in Mhz) to a channel number. */
-static inline u8 b43_freq_to_channel_a(int freq)
+static inline u8 b43_freq_to_channel_5ghz(int freq)
 {
        return ((freq - 5000) / 5);
 }
-static inline u8 b43_freq_to_channel_bg(int freq)
+static inline u8 b43_freq_to_channel_2ghz(int freq)
 {
        u8 channel;
 
@@ -54,19 +54,13 @@ static inline u8 b43_freq_to_channel_bg(int freq)
 
        return channel;
 }
-static inline u8 b43_freq_to_channel(struct b43_wldev *dev, int freq)
-{
-       if (dev->phy.type == B43_PHYTYPE_A)
-               return b43_freq_to_channel_a(freq);
-       return b43_freq_to_channel_bg(freq);
-}
 
 /* Lightweight function to convert a channel number to a frequency (in Mhz). */
-static inline int b43_channel_to_freq_a(u8 channel)
+static inline int b43_channel_to_freq_5ghz(u8 channel)
 {
        return (5000 + (5 * channel));
 }
-static inline int b43_channel_to_freq_bg(u8 channel)
+static inline int b43_channel_to_freq_2ghz(u8 channel)
 {
        int freq;
 
@@ -77,12 +71,6 @@ static inline int b43_channel_to_freq_bg(u8 channel)
 
        return freq;
 }
-static inline int b43_channel_to_freq(struct b43_wldev *dev, u8 channel)
-{
-       if (dev->phy.type == B43_PHYTYPE_A)
-               return b43_channel_to_freq_a(channel);
-       return b43_channel_to_freq_bg(channel);
-}
 
 static inline int b43_is_cck_rate(int rate)
 {
index 9b1f905ffbf4a7a1c61b9b5f4d2463cac78719c7..98cf70c5fd478d2ef766b02a7315bbd086a1781f 100644 (file)
@@ -25,6 +25,8 @@
 #include "rfkill.h"
 #include "b43.h"
 
+#include <linux/kmod.h>
+
 
 /* Returns TRUE, if the radio is enabled in hardware. */
 static bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
@@ -50,7 +52,10 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
        bool report_change = 0;
 
        mutex_lock(&wl->mutex);
-       B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED);
+       if (unlikely(b43_status(dev) < B43_STAT_INITIALIZED)) {
+               mutex_unlock(&wl->mutex);
+               return;
+       }
        enabled = b43_is_hw_radio_enabled(dev);
        if (unlikely(enabled != dev->radio_hw_enable)) {
                dev->radio_hw_enable = enabled;
@@ -60,8 +65,12 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
        }
        mutex_unlock(&wl->mutex);
 
-       if (unlikely(report_change))
-               input_report_key(poll_dev->input, KEY_WLAN, enabled);
+       /* send the radio switch event to the system - note both a key press
+        * and a release are required */
+       if (unlikely(report_change)) {
+               input_report_key(poll_dev->input, KEY_WLAN, 1);
+               input_report_key(poll_dev->input, KEY_WLAN, 0);
+       }
 }
 
 /* Called when the RFKILL toggled in software. */
@@ -69,13 +78,15 @@ static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state)
 {
        struct b43_wldev *dev = data;
        struct b43_wl *wl = dev->wl;
-       int err = 0;
+       int err = -EBUSY;
 
        if (!wl->rfkill.registered)
                return 0;
 
        mutex_lock(&wl->mutex);
-       B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED);
+       if (b43_status(dev) < B43_STAT_INITIALIZED)
+               goto out_unlock;
+       err = 0;
        switch (state) {
        case RFKILL_STATE_ON:
                if (!dev->radio_hw_enable) {
@@ -133,9 +144,25 @@ void b43_rfkill_init(struct b43_wldev *dev)
        rfk->poll_dev->poll = b43_rfkill_poll;
        rfk->poll_dev->poll_interval = 1000; /* msecs */
 
+       rfk->poll_dev->input->name = rfk->name;
+       rfk->poll_dev->input->id.bustype = BUS_HOST;
+       rfk->poll_dev->input->id.vendor = dev->dev->bus->boardinfo.vendor;
+       rfk->poll_dev->input->evbit[0] = BIT(EV_KEY);
+       set_bit(KEY_WLAN, rfk->poll_dev->input->keybit);
+
        err = rfkill_register(rfk->rfkill);
        if (err)
                goto err_free_polldev;
+
+#ifdef CONFIG_RFKILL_INPUT_MODULE
+       /* B43 RF-kill isn't useful without the rfkill-input subsystem.
+        * Try to load the module. */
+       err = request_module("rfkill-input");
+       if (err)
+               b43warn(wl, "Failed to load the rfkill-input module. "
+                       "The built-in radio LED will not work.\n");
+#endif /* CONFIG_RFKILL_INPUT */
+
        err = input_register_polled_device(rfk->poll_dev);
        if (err)
                goto err_unreg_rfk;
index 0bd6f8a348a8a195821ff8ec5721c167b0443bca..3307ba1856b17ce36d0740784524a8a3ba7d3562 100644 (file)
@@ -531,21 +531,32 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
        switch (chanstat & B43_RX_CHAN_PHYTYPE) {
        case B43_PHYTYPE_A:
                status.phymode = MODE_IEEE80211A;
-               status.freq = chanid;
-               status.channel = b43_freq_to_channel_a(chanid);
-               break;
-       case B43_PHYTYPE_B:
-               status.phymode = MODE_IEEE80211B;
-               status.freq = chanid + 2400;
-               status.channel = b43_freq_to_channel_bg(chanid + 2400);
+               B43_WARN_ON(1);
+               /* FIXME: We don't really know which value the "chanid" contains.
+                *        So the following assignment might be wrong. */
+               status.channel = chanid;
+               status.freq = b43_channel_to_freq_5ghz(status.channel);
                break;
        case B43_PHYTYPE_G:
                status.phymode = MODE_IEEE80211G;
+               /* chanid is the radio channel cookie value as used
+                * to tune the radio. */
                status.freq = chanid + 2400;
-               status.channel = b43_freq_to_channel_bg(chanid + 2400);
+               status.channel = b43_freq_to_channel_2ghz(status.freq);
+               break;
+       case B43_PHYTYPE_N:
+               status.phymode = 0xDEAD /*FIXME MODE_IEEE80211N*/;
+               /* chanid is the SHM channel cookie. Which is the plain
+                * channel number in b43. */
+               status.channel = chanid;
+               if (chanstat & B43_RX_CHAN_5GHZ)
+                       status.freq = b43_freq_to_channel_5ghz(status.freq);
+               else
+                       status.freq = b43_freq_to_channel_2ghz(status.freq);
                break;
        default:
                B43_WARN_ON(1);
+               goto drop;
        }
 
        dev->stats.last_rx = jiffies;
index 03bddd251618472b9f102c0973bd7dc8531741d3..6dc079382f7f105300806e502d148a0b1a86cf9a 100644 (file)
@@ -142,49 +142,56 @@ struct b43_rxhdr_fw4 {
 } __attribute__ ((__packed__));
 
 /* PHY RX Status 0 */
-#define B43_RX_PHYST0_GAINCTL  0x4000  /* Gain Control */
-#define B43_RX_PHYST0_PLCPHCF  0x0200
-#define B43_RX_PHYST0_PLCPFV   0x0100
-#define B43_RX_PHYST0_SHORTPRMBL       0x0080  /* Received with Short Preamble */
+#define B43_RX_PHYST0_GAINCTL          0x4000 /* Gain Control */
+#define B43_RX_PHYST0_PLCPHCF          0x0200
+#define B43_RX_PHYST0_PLCPFV           0x0100
+#define B43_RX_PHYST0_SHORTPRMBL       0x0080 /* Received with Short Preamble */
 #define B43_RX_PHYST0_LCRS             0x0040
-#define B43_RX_PHYST0_ANT              0x0020  /* Antenna */
-#define B43_RX_PHYST0_UNSRATE  0x0010
+#define B43_RX_PHYST0_ANT              0x0020 /* Antenna */
+#define B43_RX_PHYST0_UNSRATE          0x0010
 #define B43_RX_PHYST0_CLIP             0x000C
 #define B43_RX_PHYST0_CLIP_SHIFT       2
-#define B43_RX_PHYST0_FTYPE            0x0003  /* Frame type */
-#define  B43_RX_PHYST0_CCK             0x0000  /* Frame type: CCK */
-#define  B43_RX_PHYST0_OFDM            0x0001  /* Frame type: OFDM */
-#define  B43_RX_PHYST0_PRE_N   0x0002  /* Pre-standard N-PHY frame */
-#define  B43_RX_PHYST0_STD_N   0x0003  /* Standard N-PHY frame */
+#define B43_RX_PHYST0_FTYPE            0x0003 /* Frame type */
+#define  B43_RX_PHYST0_CCK             0x0000 /* Frame type: CCK */
+#define  B43_RX_PHYST0_OFDM            0x0001 /* Frame type: OFDM */
+#define  B43_RX_PHYST0_PRE_N           0x0002 /* Pre-standard N-PHY frame */
+#define  B43_RX_PHYST0_STD_N           0x0003 /* Standard N-PHY frame */
 
 /* PHY RX Status 2 */
-#define B43_RX_PHYST2_LNAG             0xC000  /* LNA Gain */
+#define B43_RX_PHYST2_LNAG             0xC000 /* LNA Gain */
 #define B43_RX_PHYST2_LNAG_SHIFT       14
-#define B43_RX_PHYST2_PNAG             0x3C00  /* PNA Gain */
+#define B43_RX_PHYST2_PNAG             0x3C00 /* PNA Gain */
 #define B43_RX_PHYST2_PNAG_SHIFT       10
-#define B43_RX_PHYST2_FOFF             0x03FF  /* F offset */
+#define B43_RX_PHYST2_FOFF             0x03FF /* F offset */
 
 /* PHY RX Status 3 */
-#define B43_RX_PHYST3_DIGG             0x1800  /* DIG Gain */
+#define B43_RX_PHYST3_DIGG             0x1800 /* DIG Gain */
 #define B43_RX_PHYST3_DIGG_SHIFT       11
-#define B43_RX_PHYST3_TRSTATE  0x0400  /* TR state */
+#define B43_RX_PHYST3_TRSTATE          0x0400 /* TR state */
 
 /* MAC RX Status */
-#define B43_RX_MAC_BEACONSENT  0x00008000      /* Beacon send flag */
-#define B43_RX_MAC_KEYIDX              0x000007E0      /* Key index */
-#define B43_RX_MAC_KEYIDX_SHIFT        5
-#define B43_RX_MAC_DECERR              0x00000010      /* Decrypt error */
-#define B43_RX_MAC_DEC         0x00000008      /* Decryption attempted */
-#define B43_RX_MAC_PADDING             0x00000004      /* Pad bytes present */
-#define B43_RX_MAC_RESP                0x00000002      /* Response frame transmitted */
-#define B43_RX_MAC_FCSERR              0x00000001      /* FCS error */
+#define B43_RX_MAC_RXST_VALID          0x01000000 /* PHY RXST valid */
+#define B43_RX_MAC_TKIP_MICERR         0x00100000 /* TKIP MIC error */
+#define B43_RX_MAC_TKIP_MICATT         0x00080000 /* TKIP MIC attempted */
+#define B43_RX_MAC_AGGTYPE             0x00060000 /* Aggregation type */
+#define B43_RX_MAC_AGGTYPE_SHIFT       17
+#define B43_RX_MAC_AMSDU               0x00010000 /* A-MSDU mask */
+#define B43_RX_MAC_BEACONSENT          0x00008000 /* Beacon sent flag */
+#define B43_RX_MAC_KEYIDX              0x000007E0 /* Key index */
+#define B43_RX_MAC_KEYIDX_SHIFT                5
+#define B43_RX_MAC_DECERR              0x00000010 /* Decrypt error */
+#define B43_RX_MAC_DEC                 0x00000008 /* Decryption attempted */
+#define B43_RX_MAC_PADDING             0x00000004 /* Pad bytes present */
+#define B43_RX_MAC_RESP                        0x00000002 /* Response frame transmitted */
+#define B43_RX_MAC_FCSERR              0x00000001 /* FCS error */
 
 /* RX channel */
-#define B43_RX_CHAN_GAIN               0xFC00  /* Gain */
-#define B43_RX_CHAN_GAIN_SHIFT 10
-#define B43_RX_CHAN_ID         0x03FC  /* Channel ID */
-#define B43_RX_CHAN_ID_SHIFT   2
-#define B43_RX_CHAN_PHYTYPE            0x0003  /* PHY type */
+#define B43_RX_CHAN_40MHZ              0x1000 /* 40 Mhz channel width */
+#define B43_RX_CHAN_5GHZ               0x0800 /* 5 Ghz band */
+#define B43_RX_CHAN_ID                 0x07F8 /* Channel ID */
+#define B43_RX_CHAN_ID_SHIFT           3
+#define B43_RX_CHAN_PHYTYPE            0x0007 /* PHY type */
+
 
 u8 b43_plcp_get_ratecode_cck(const u8 bitrate);
 u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate);
index 35dbe455451306886ee42670648184046416c7f4..76e9dd843faacd23346307774ab974870f38161e 100644 (file)
@@ -219,7 +219,7 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf,
        ssize_t buf_size;
        ssize_t res;
        unsigned long flags;
-       u64 tsf;
+       unsigned long long tsf;
 
        buf_size = min(count, sizeof (really_big_buffer) - 1);
        down(&big_buffer_sem);
index 54f44e5473c0cf427cb276a1d67ef1f9a168b258..88062c1318a89c0c16ab3e20707fdeb7b4afa72b 100644 (file)
@@ -1233,9 +1233,19 @@ static ssize_t show_event_log(struct device *d,
 {
        struct ipw_priv *priv = dev_get_drvdata(d);
        u32 log_len = ipw_get_event_log_len(priv);
-       struct ipw_event log[log_len];
+       u32 log_size;
+       struct ipw_event *log;
        u32 len = 0, i;
 
+       /* not using min() because of its strict type checking */
+       log_size = PAGE_SIZE / sizeof(*log) > log_len ?
+                       sizeof(*log) * log_len : PAGE_SIZE;
+       log = kzalloc(log_size, GFP_KERNEL);
+       if (!log) {
+               IPW_ERROR("Unable to allocate memory for log\n");
+               return 0;
+       }
+       log_len = log_size / sizeof(*log);
        ipw_capture_event_log(priv, log_len, log);
 
        len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len);
@@ -1244,6 +1254,7 @@ static ssize_t show_event_log(struct device *d,
                                "\n%08X%08X%08X",
                                log[i].time, log[i].event, log[i].data);
        len += snprintf(buf + len, PAGE_SIZE - len, "\n");
+       kfree(log);
        return len;
 }
 
@@ -10751,7 +10762,7 @@ static void ipw_bg_link_down(struct work_struct *work)
        mutex_unlock(&priv->mutex);
 }
 
-static int ipw_setup_deferred_work(struct ipw_priv *priv)
+static int __devinit ipw_setup_deferred_work(struct ipw_priv *priv)
 {
        int ret = 0;
 
@@ -11600,7 +11611,8 @@ static void ipw_prom_free(struct ipw_priv *priv)
 #endif
 
 
-static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+static int __devinit ipw_pci_probe(struct pci_dev *pdev,
+                                  const struct pci_device_id *ent)
 {
        int err = 0;
        struct net_device *net_dev;
@@ -11767,7 +11779,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        return err;
 }
 
-static void ipw_pci_remove(struct pci_dev *pdev)
+static void __devexit ipw_pci_remove(struct pci_dev *pdev)
 {
        struct ipw_priv *priv = pci_get_drvdata(pdev);
        struct list_head *p, *q;
index 4bdf237f6adc90b61283624de3e5dc2b7a167822..1a6b0e0edf6f026d8f3c98bc1e1cd454936ef4c0 100644 (file)
@@ -4743,8 +4743,10 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
                 *   when we loaded driver, and is now set to "enable".
                 * After we're Alive, RF_KILL gets handled by
                 *   iwl_rx_card_state_notif() */
-               if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status))
+               if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) {
+                       clear_bit(STATUS_RF_KILL_HW, &priv->status);
                        queue_work(priv->workqueue, &priv->restart);
+               }
 
                handled |= CSR_INT_BIT_RF_KILL;
        }
@@ -6171,6 +6173,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
                mutex_lock(&priv->mutex);
 
                if (rc) {
+                       iwl_rate_control_unregister(priv->hw);
                        IWL_ERROR("Failed to register network "
                                  "device (error %d)\n", rc);
                        return;
@@ -6243,8 +6246,6 @@ static void __iwl_down(struct iwl_priv *priv)
        /* Unblock any waiting calls */
        wake_up_interruptible_all(&priv->wait_command_queue);
 
-       iwl_cancel_deferred_work(priv);
-
        /* Wipe out the EXIT_PENDING status bit if we are not actually
         * exiting the module */
        if (!exit_pending)
@@ -6319,6 +6320,8 @@ static void iwl_down(struct iwl_priv *priv)
        mutex_lock(&priv->mutex);
        __iwl_down(priv);
        mutex_unlock(&priv->mutex);
+
+       iwl_cancel_deferred_work(priv);
 }
 
 #define MAX_HW_RESTARTS 5
@@ -8577,10 +8580,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
 
        IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
 
-       mutex_lock(&priv->mutex);
        set_bit(STATUS_EXIT_PENDING, &priv->status);
-       __iwl_down(priv);
-       mutex_unlock(&priv->mutex);
+
+       iwl_down(priv);
 
        /* Free MAC hash list for ADHOC */
        for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
@@ -8639,12 +8641,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct iwl_priv *priv = pci_get_drvdata(pdev);
 
-       mutex_lock(&priv->mutex);
-
        set_bit(STATUS_IN_SUSPEND, &priv->status);
 
        /* Take down the device; powers it off, etc. */
-       __iwl_down(priv);
+       iwl_down(priv);
 
        if (priv->mac80211_registered)
                ieee80211_stop_queues(priv->hw);
@@ -8653,8 +8653,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        pci_disable_device(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
 
-       mutex_unlock(&priv->mutex);
-
        return 0;
 }
 
@@ -8712,8 +8710,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
 
        printk(KERN_INFO "Coming out of suspend...\n");
 
-       mutex_lock(&priv->mutex);
-
        pci_set_power_state(pdev, PCI_D0);
        err = pci_enable_device(pdev);
        pci_restore_state(pdev);
@@ -8727,7 +8723,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
        pci_write_config_byte(pdev, 0x41, 0x00);
 
        iwl_resume(priv);
-       mutex_unlock(&priv->mutex);
 
        return 0;
 }
index 8f85564ec6fa4b7e0eac18476d661b5d74534e71..6cd57c220631919fd33ced7cdc01a94b84502c0b 100644 (file)
@@ -5059,8 +5059,10 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
                 *   when we loaded driver, and is now set to "enable".
                 * After we're Alive, RF_KILL gets handled by
                 *   iwl_rx_card_state_notif() */
-               if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status))
+               if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) {
+                       clear_bit(STATUS_RF_KILL_HW, &priv->status);
                        queue_work(priv->workqueue, &priv->restart);
+               }
 
                handled |= CSR_INT_BIT_RF_KILL;
        }
@@ -6527,6 +6529,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
                mutex_lock(&priv->mutex);
 
                if (rc) {
+                       iwl_rate_control_unregister(priv->hw);
                        IWL_ERROR("Failed to register network "
                                  "device (error %d)\n", rc);
                        return;
@@ -6598,8 +6601,6 @@ static void __iwl_down(struct iwl_priv *priv)
        /* Unblock any waiting calls */
        wake_up_interruptible_all(&priv->wait_command_queue);
 
-       iwl_cancel_deferred_work(priv);
-
        /* Wipe out the EXIT_PENDING status bit if we are not actually
         * exiting the module */
        if (!exit_pending)
@@ -6674,6 +6675,8 @@ static void iwl_down(struct iwl_priv *priv)
        mutex_lock(&priv->mutex);
        __iwl_down(priv);
        mutex_unlock(&priv->mutex);
+
+       iwl_cancel_deferred_work(priv);
 }
 
 #define MAX_HW_RESTARTS 5
@@ -9171,10 +9174,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
 
        IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
 
-       mutex_lock(&priv->mutex);
        set_bit(STATUS_EXIT_PENDING, &priv->status);
-       __iwl_down(priv);
-       mutex_unlock(&priv->mutex);
+
+       iwl_down(priv);
 
        /* Free MAC hash list for ADHOC */
        for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
@@ -9233,12 +9235,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct iwl_priv *priv = pci_get_drvdata(pdev);
 
-       mutex_lock(&priv->mutex);
-
        set_bit(STATUS_IN_SUSPEND, &priv->status);
 
        /* Take down the device; powers it off, etc. */
-       __iwl_down(priv);
+       iwl_down(priv);
 
        if (priv->mac80211_registered)
                ieee80211_stop_queues(priv->hw);
@@ -9247,8 +9247,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        pci_disable_device(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
 
-       mutex_unlock(&priv->mutex);
-
        return 0;
 }
 
@@ -9306,8 +9304,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
 
        printk(KERN_INFO "Coming out of suspend...\n");
 
-       mutex_lock(&priv->mutex);
-
        pci_set_power_state(pdev, PCI_D0);
        err = pci_enable_device(pdev);
        pci_restore_state(pdev);
@@ -9321,7 +9317,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
        pci_write_config_byte(pdev, 0x41, 0x00);
 
        iwl_resume(priv);
-       mutex_unlock(&priv->mutex);
 
        return 0;
 }
index 50775f9234cc72fb8a2dc34bf52ff59fc1c1fb53..18b1f9145389975df1b28e5b8a1064b34b3e6aff 100644 (file)
@@ -257,7 +257,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = {
 static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev,
                                      __le32 *mac)
 {
-       rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, &mac,
+       rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, mac,
                                      (3 * sizeof(__le16)));
 }
 
index 2780df00623c4f9392e40087868326fbd8bb7522..6d5d9aba0b73449c3bee16c1e90f16d86c09e2b6 100644 (file)
@@ -124,7 +124,10 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
        struct data_entry *entry;
        struct data_desc *rxd;
        struct sk_buff *skb;
+       struct ieee80211_hdr *hdr;
        struct rxdata_entry_desc desc;
+       int header_size;
+       int align;
        u32 word;
 
        while (1) {
@@ -138,17 +141,26 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
                memset(&desc, 0x00, sizeof(desc));
                rt2x00dev->ops->lib->fill_rxdone(entry, &desc);
 
+               hdr = (struct ieee80211_hdr *)entry->data_addr;
+               header_size =
+                   ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
+
+               /*
+                * The data behind the ieee80211 header must be
+                * aligned on a 4 byte boundary.
+                */
+               align = NET_IP_ALIGN + (2 * (header_size % 4 == 0));
+
                /*
                 * Allocate the sk_buffer, initialize it and copy
                 * all data into it.
                 */
-               skb = dev_alloc_skb(desc.size + NET_IP_ALIGN);
+               skb = dev_alloc_skb(desc.size + align);
                if (!skb)
                        return;
 
-               skb_reserve(skb, NET_IP_ALIGN);
-               skb_put(skb, desc.size);
-               memcpy(skb->data, entry->data_addr, desc.size);
+               skb_reserve(skb, align);
+               memcpy(skb_put(skb, desc.size), entry->data_addr, desc.size);
 
                /*
                 * Send the frame to rt2x00lib for further processing.
index 1f5675dd329f78963fbd94a77976ab57687570f2..ab4797ed94c9f176ae36e388ab41b47712ba7a21 100644 (file)
@@ -221,7 +221,9 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
        struct data_ring *ring = entry->ring;
        struct rt2x00_dev *rt2x00dev = ring->rt2x00dev;
        struct sk_buff *skb;
+       struct ieee80211_hdr *hdr;
        struct rxdata_entry_desc desc;
+       int header_size;
        int frame_size;
 
        if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
@@ -253,9 +255,20 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
        skb_put(skb, frame_size);
 
        /*
-        * Trim the skb_buffer to only contain the valid
-        * frame data (so ignore the device's descriptor).
+        * The data behind the ieee80211 header must be
+        * aligned on a 4 byte boundary.
+        * After that trim the entire buffer down to only
+        * contain the valid frame data excluding the device
+        * descriptor.
         */
+       hdr = (struct ieee80211_hdr *)entry->skb->data;
+       header_size =
+           ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
+
+       if (header_size % 4 == 0) {
+               skb_push(entry->skb, 2);
+               memmove(entry->skb->data, entry->skb->data + 2, skb->len - 2);
+       }
        skb_trim(entry->skb, desc.size);
 
        /*
index 01dbef19d651f14f902805f451afa20246fc01a4..ecae968ce091ef595f2ab5e4e5a0394109da033d 100644 (file)
@@ -1738,6 +1738,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
 {
        struct data_ring *ring;
        struct data_entry *entry;
+       struct data_entry *entry_done;
        struct data_desc *txd;
        u32 word;
        u32 reg;
@@ -1791,6 +1792,17 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
                    !rt2x00_get_field32(word, TXD_W0_VALID))
                        return;
 
+               entry_done = rt2x00_get_data_entry_done(ring);
+               while (entry != entry_done) {
+                       /* Catch up. Just report any entries we missed as
+                        * failed. */
+                       WARNING(rt2x00dev,
+                               "TX status report missed for entry %p\n",
+                               entry_done);
+                       rt2x00lib_txdone(entry_done, TX_FAIL_OTHER, 0);
+                       entry_done = rt2x00_get_data_entry_done(ring);
+               }
+
                /*
                 * Obtain the status about this packet.
                 */
index e454ae83e97a369aceaf9fdfe0c7dbe2f38df8dc..bd1ab3b3afc0d6fe505ee94bd216a31ea073f225 100644 (file)
@@ -38,6 +38,8 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
        {USB_DEVICE(0x0846, 0x6a00)},
        /* HP */
        {USB_DEVICE(0x03f0, 0xca02)},
+       /* Sitecom */
+       {USB_DEVICE(0x0df6, 0x000d)},
        {}
 };
 
index a903645e157a70b62111f26f7159fd4b02bf137a..5298a8bf11298496fa2496544355ef29649a9e89 100644 (file)
@@ -1130,6 +1130,8 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb)
        __skb_trim(skb, skb->len -
                        (IEEE80211_FCS_LEN + sizeof(struct rx_status)));
 
+       ZD_ASSERT(IS_ALIGNED((unsigned long)skb->data, 4));
+
        update_qual_rssi(mac, skb->data, skb->len, stats.signal,
                         status->signal_strength);
 
@@ -1166,15 +1168,19 @@ static void do_rx(unsigned long mac_ptr)
 int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length)
 {
        struct sk_buff *skb;
+       unsigned int reserved =
+               ALIGN(max_t(unsigned int,
+                           sizeof(struct zd_rt_hdr), ZD_PLCP_HEADER_SIZE), 4) -
+               ZD_PLCP_HEADER_SIZE;
 
-       skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length);
+       skb = dev_alloc_skb(reserved + length);
        if (!skb) {
                struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
                dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n");
                ieee->stats.rx_dropped++;
                return -ENOMEM;
        }
-       skb_reserve(skb, sizeof(struct zd_rt_hdr));
+       skb_reserve(skb, reserved);
        memcpy(__skb_put(skb, length), buffer, length);
        skb_queue_tail(&mac->rx_queue, skb);
        tasklet_schedule(&mac->rx_tasklet);
index 2a8fc431099f6e1fcd5a652edd043a774629d002..bca37bf0f5455812913e448272749b5d55e7c1a6 100644 (file)
@@ -852,11 +852,6 @@ static int xennet_poll(struct napi_struct *napi, int budget)
 
        spin_lock(&np->rx_lock);
 
-       if (unlikely(!netif_carrier_ok(dev))) {
-               spin_unlock(&np->rx_lock);
-               return 0;
-       }
-
        skb_queue_head_init(&rxq);
        skb_queue_head_init(&errq);
        skb_queue_head_init(&tmpq);
index 87f002ade531150ca3554ebdedaf97e05385599c..fe6ff3e3d5255653f4d42c8b9ed31f459a856881 100644 (file)
@@ -265,10 +265,10 @@ enum yellowfin_offsets {
 /* The Yellowfin Rx and Tx buffer descriptors.
    Elements are written as 32 bit for endian portability. */
 struct yellowfin_desc {
-       u32 dbdma_cmd;
-       u32 addr;
-       u32 branch_addr;
-       u32 result_status;
+       __le32 dbdma_cmd;
+       __le32 addr;
+       __le32 branch_addr;
+       __le32 result_status;
 };
 
 struct tx_status_words {
@@ -922,7 +922,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
                        dev->stats.tx_packets++;
                        dev->stats.tx_bytes += skb->len;
                        /* Free the original skb. */
-                       pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr,
+                       pci_unmap_single(yp->pci_dev, le32_to_cpu(yp->tx_ring[entry].addr),
                                skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb_irq(skb);
                        yp->tx_skbuff[entry] = NULL;
@@ -1056,13 +1056,13 @@ static int yellowfin_rx(struct net_device *dev)
 
                if(!desc->result_status)
                        break;
-               pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr,
+               pci_dma_sync_single_for_cpu(yp->pci_dev, le32_to_cpu(desc->addr),
                        yp->rx_buf_sz, PCI_DMA_FROMDEVICE);
                desc_status = le32_to_cpu(desc->result_status) >> 16;
                buf_addr = rx_skb->data;
                data_size = (le32_to_cpu(desc->dbdma_cmd) -
                        le32_to_cpu(desc->result_status)) & 0xffff;
-               frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2])));
+               frame_status = le16_to_cpu(get_unaligned((__le16*)&(buf_addr[data_size - 2])));
                if (yellowfin_debug > 4)
                        printk(KERN_DEBUG "  yellowfin_rx() status was %4.4x.\n",
                                   frame_status);
@@ -1123,7 +1123,7 @@ static int yellowfin_rx(struct net_device *dev)
                        if (pkt_len > rx_copybreak) {
                                skb_put(skb = rx_skb, pkt_len);
                                pci_unmap_single(yp->pci_dev,
-                                       yp->rx_ring[entry].addr,
+                                       le32_to_cpu(yp->rx_ring[entry].addr),
                                        yp->rx_buf_sz,
                                        PCI_DMA_FROMDEVICE);
                                yp->rx_skbuff[entry] = NULL;
@@ -1134,9 +1134,10 @@ static int yellowfin_rx(struct net_device *dev)
                                skb_reserve(skb, 2);    /* 16 byte align the IP header */
                                skb_copy_to_linear_data(skb, rx_skb->data, pkt_len);
                                skb_put(skb, pkt_len);
-                               pci_dma_sync_single_for_device(yp->pci_dev, desc->addr,
-                                                                                          yp->rx_buf_sz,
-                                                                                          PCI_DMA_FROMDEVICE);
+                               pci_dma_sync_single_for_device(yp->pci_dev,
+                                                               le32_to_cpu(desc->addr),
+                                                               yp->rx_buf_sz,
+                                                               PCI_DMA_FROMDEVICE);
                        }
                        skb->protocol = eth_type_trans(skb, dev);
                        netif_rx(skb);
@@ -1252,7 +1253,7 @@ static int yellowfin_close(struct net_device *dev)
        /* Free all the skbuffs in the Rx queue. */
        for (i = 0; i < RX_RING_SIZE; i++) {
                yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP);
-               yp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */
+               yp->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
                if (yp->rx_skbuff[i]) {
                        dev_kfree_skb(yp->rx_skbuff[i]);
                }
index ed82e41210d1d1e89616105b2b23e7f3322bd292..d950fc34320a61e21a32f9a8b4dc928f9fcc365a 100644 (file)
@@ -384,7 +384,7 @@ parport_device_sysctl_template = {
                {
                        .procname       = "timeslice",
                        .data           = NULL,
-                       .maxlen         = sizeof(int),
+                       .maxlen         = sizeof(unsigned long),
                        .mode           = 0644,
                        .proc_handler   = &proc_doulongvec_ms_jiffies_minmax,
                        .extra1         = (void*) &parport_min_timeslice_value,
index 2f75d695eed767fe9c999edd464370963aa910c7..c5ca3134513a6e848461c2546604c293d4ba2e51 100644 (file)
@@ -455,22 +455,6 @@ struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int
        return child;
 }
 
-static void pci_enable_crs(struct pci_dev *dev)
-{
-       u16 cap, rpctl;
-       int rpcap = pci_find_capability(dev, PCI_CAP_ID_EXP);
-       if (!rpcap)
-               return;
-
-       pci_read_config_word(dev, rpcap + PCI_CAP_FLAGS, &cap);
-       if (((cap & PCI_EXP_FLAGS_TYPE) >> 4) != PCI_EXP_TYPE_ROOT_PORT)
-               return;
-
-       pci_read_config_word(dev, rpcap + PCI_EXP_RTCTL, &rpctl);
-       rpctl |= PCI_EXP_RTCTL_CRSSVE;
-       pci_write_config_word(dev, rpcap + PCI_EXP_RTCTL, rpctl);
-}
-
 static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max)
 {
        struct pci_bus *parent = child->parent;
@@ -517,8 +501,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
        pci_write_config_word(dev, PCI_BRIDGE_CONTROL,
                              bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT);
 
-       pci_enable_crs(dev);
-
        if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus) {
                unsigned int cmax, busnr;
                /*
index 26cc4dcf4f0e381c791c6dba3e6bb28ce3b5e236..72e0bd5d80aced43ef522ff52efdeebd65b86aa6 100644 (file)
@@ -465,6 +465,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,      PCI_DEVICE_ID_INTEL_ICH7_31, quirk
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi );
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi );
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi );
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_ICH8_1, quirk_ich6_lpc_acpi );
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_ICH8_4, quirk_ich6_lpc_acpi );
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_ICH9_2, quirk_ich6_lpc_acpi );
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_ICH9_4, quirk_ich6_lpc_acpi );
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_ICH9_7, quirk_ich6_lpc_acpi );
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_ICH9_8, quirk_ich6_lpc_acpi );
 
 /*
  * VIA ACPI: One IO region pointed to by longword at
index 1510d6cde3e2308e6d26e4ff3fa0824a7429ed21..4a05802213c8bdae09138a359bb92ec025d41d2f 100644 (file)
@@ -213,7 +213,7 @@ static struct pcmcia_low_level lubbock_pcmcia_ops = {
 
 #include "pxa2xx_base.h"
 
-int __init pcmcia_lubbock_init(struct sa1111_dev *sadev)
+int pcmcia_lubbock_init(struct sa1111_dev *sadev)
 {
        int ret = -ENODEV;
 
index 3c5eb374adf8bbcc0a1d0a7dbb85ab6f55587a7d..f7b8648acbfa4bf863d0cdd16c5769e544e3d199 100644 (file)
@@ -76,6 +76,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
        int i = 0;
        int irq;
        int p, t;
+       static unsigned char warned;
 
        if (!valid_IRQ(gsi))
                return;
@@ -83,9 +84,10 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
        while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
               i < PNP_MAX_IRQ)
                i++;
-       if (i >= PNP_MAX_IRQ) {
+       if (i >= PNP_MAX_IRQ && !warned) {
                printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ "
                                "resources: %d \n", PNP_MAX_IRQ);
+               warned = 1;
                return;
        }
        /*
@@ -169,6 +171,7 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
                                                int bus_master, int transfer)
 {
        int i = 0;
+       static unsigned char warned;
 
        while (i < PNP_MAX_DMA &&
               !(res->dma_resource[i].flags & IORESOURCE_UNSET))
@@ -183,9 +186,10 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
                }
                res->dma_resource[i].start = dma;
                res->dma_resource[i].end = dma;
-       } else {
+       } else if (!warned) {
                printk(KERN_ERR "pnpacpi: exceeded the max number of DMA "
                                "resources: %d \n", PNP_MAX_DMA);
+               warned = 1;
        }
 }
 
@@ -193,6 +197,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
                                               u64 io, u64 len, int io_decode)
 {
        int i = 0;
+       static unsigned char warned;
 
        while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
               i < PNP_MAX_PORT)
@@ -207,7 +212,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
                }
                res->port_resource[i].start = io;
                res->port_resource[i].end = io + len - 1;
-       } else {
+       } else if (!warned) {
                printk(KERN_ERR "pnpacpi: exceeded the max number of IO "
                                "resources: %d \n", PNP_MAX_PORT);
        }
@@ -218,6 +223,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
                                                int write_protect)
 {
        int i = 0;
+       static unsigned char warned;
 
        while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
               (i < PNP_MAX_MEM))
@@ -233,7 +239,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
 
                res->mem_resource[i].start = mem;
                res->mem_resource[i].end = mem + len - 1;
-       } else {
+       } else if (!warned) {
                printk(KERN_ERR "pnpacpi: exceeded the max number of mem "
                                "resources: %d\n", PNP_MAX_MEM);
        }
index 9dea585ef8064f656ebeed605dc834179206ee2c..bb8d5b1eec90256a47d524baac8abb51e039c9ef 100644 (file)
@@ -1074,7 +1074,6 @@ static int ps3_vuart_probe(struct ps3_system_bus_device *dev)
        if (result) {
                dev_dbg(&dev->core, "%s:%d: drv->probe failed\n",
                        __func__, __LINE__);
-               down(&vuart_bus_priv.probe_mutex);
                goto fail_probe;
        }
 
index 2999214ca534b411fec6e0ae1c1c760be15c5ddb..d3b9b14267abcdb7f44bdfcc375da355a05fd283 100644 (file)
@@ -225,18 +225,12 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
                goto out;
        }
 
-       ret = request_irq(irq, at32_rtc_interrupt, IRQF_SHARED, "rtc", rtc);
-       if (ret) {
-               dev_dbg(&pdev->dev, "could not request irq %d\n", irq);
-               goto out;
-       }
-
        rtc->irq = irq;
        rtc->regs = ioremap(regs->start, regs->end - regs->start + 1);
        if (!rtc->regs) {
                ret = -ENOMEM;
                dev_dbg(&pdev->dev, "could not map I/O memory\n");
-               goto out_free_irq;
+               goto out;
        }
        spin_lock_init(&rtc->lock);
 
@@ -253,12 +247,18 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
                                | RTC_BIT(CTRL_EN));
        }
 
+       ret = request_irq(irq, at32_rtc_interrupt, IRQF_SHARED, "rtc", rtc);
+       if (ret) {
+               dev_dbg(&pdev->dev, "could not request irq %d\n", irq);
+               goto out_iounmap;
+       }
+
        rtc->rtc = rtc_device_register(pdev->name, &pdev->dev,
                                &at32_rtc_ops, THIS_MODULE);
        if (IS_ERR(rtc->rtc)) {
                dev_dbg(&pdev->dev, "could not register rtc device\n");
                ret = PTR_ERR(rtc->rtc);
-               goto out_iounmap;
+               goto out_free_irq;
        }
 
        platform_set_drvdata(pdev, rtc);
@@ -268,10 +268,10 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
 
        return 0;
 
-out_iounmap:
-       iounmap(rtc->regs);
 out_free_irq:
        free_irq(irq, rtc);
+out_iounmap:
+       iounmap(rtc->regs);
 out:
        kfree(rtc);
        return ret;
index 9dd3952516c548c84b61b0754ab406b14ae36dd0..38a1ee2eacd86a00b9a8c9fa6595126e63a72b04 100644 (file)
@@ -13906,7 +13906,7 @@ static int advansys_release(struct Scsi_Host *shost)
 
 #define ASC_IOADR_TABLE_MAX_IX  11
 
-static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __devinitdata = {
+static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] = {
        0x100, 0x0110, 0x120, 0x0130, 0x140, 0x0150, 0x0190,
        0x0210, 0x0230, 0x0250, 0x0330
 };
index 70f48a1a6d588fe0dc11530fa7d3383bc5cc8e37..b31d1c95c9fbd4d1a16c04856e088a54411801d5 100644 (file)
@@ -906,8 +906,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
        }
 
        pci_set_master(pDev);
-       if (pci_set_dma_mask(pDev, DMA_64BIT_MASK) &&
-           pci_set_dma_mask(pDev, DMA_32BIT_MASK))
+       if (pci_set_dma_mask(pDev, DMA_32BIT_MASK))
                return -EINVAL;
 
        base_addr0_phys = pci_resource_start(pDev,0);
index 4c4465d39a1dabfb21d2fb3f740b729c18086789..01bf0189367dc8ef3bf30ff1668bf8eac31c1c7f 100644 (file)
@@ -2616,6 +2616,7 @@ static void initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * c
                scsi_for_each_sg(cmnd, sglist, cblk->sglen, i) {
                        sg->data = cpu_to_le32((u32)sg_dma_address(sglist));
                        total_len += sg->len = cpu_to_le32((u32)sg_dma_len(sglist));
+                       ++sg;
                }
 
                cblk->buflen = (scsi_bufflen(cmnd) > total_len) ?
@@ -2867,6 +2868,7 @@ static int initio_probe_one(struct pci_dev *pdev,
        }
        host = (struct initio_host *)shost->hostdata;
        memset(host, 0, sizeof(struct initio_host));
+       host->addr = pci_resource_start(pdev, 0);
 
        if (!request_region(host->addr, 256, "i91u")) {
                printk(KERN_WARNING "initio: I/O port range 0x%x is busy.\n", host->addr);
index 146d540f6281fdd0917258fac03ae8c7eeef87e8..28864075609930af90875d2d17522be20899e239 100644 (file)
@@ -3041,7 +3041,6 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
        int cnt;
        int req_cnt;
        int seg_cnt;
-       dma_addr_t dma_handle;
        u8 dir;
 
        ENTER("qla1280_32bit_start_scsi");
@@ -3050,6 +3049,7 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
                cmd->cmnd[0]);
 
        /* Calculate number of entries and segments required. */
+       req_cnt = 1;
        seg_cnt = scsi_dma_map(cmd);
        if (seg_cnt) {
                /*
index a5bcf1f390b35162284dd13e5d181c4105a5cafe..8ecc0470b8f3dceae9f785940e06f6f04c515c09 100644 (file)
@@ -1831,7 +1831,7 @@ probe_out:
        return ret;
 }
 
-static void __devexit
+static void
 qla2x00_remove_one(struct pci_dev *pdev)
 {
        scsi_qla_host_t *ha;
@@ -2965,7 +2965,7 @@ static struct pci_driver qla2xxx_pci_driver = {
        },
        .id_table       = qla2xxx_pci_tbl,
        .probe          = qla2x00_probe_one,
-       .remove         = __devexit_p(qla2x00_remove_one),
+       .remove         = qla2x00_remove_one,
        .err_handler    = &qla2xxx_err_handler,
 };
 
index 0e81e4cf8876766a92cb43333d6883baadefdf03..a9ac5b1b1667f339d5db22760e308b18ac9a3a71 100644 (file)
@@ -1332,7 +1332,7 @@ int scsi_prep_return(struct request_queue *q, struct request *req, int ret)
 }
 EXPORT_SYMBOL(scsi_prep_return);
 
-static int scsi_prep_fn(struct request_queue *q, struct request *req)
+int scsi_prep_fn(struct request_queue *q, struct request *req)
 {
        struct scsi_device *sdev = q->queuedata;
        int ret = BLKPREP_KILL;
index eff0059518954b26c62b116cd737f9e11e78da6a..3f34e9376b0aa148c8dafc58ee0c52c65849b1e1 100644 (file)
@@ -74,6 +74,9 @@ extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
 extern void scsi_free_queue(struct request_queue *q);
 extern int scsi_init_queue(void);
 extern void scsi_exit_queue(void);
+struct request_queue;
+struct request;
+extern int scsi_prep_fn(struct request_queue *, struct request *);
 
 /* scsi_proc.c */
 #ifdef CONFIG_SCSI_PROC_FS
index f374fdcb6815981d3055f171c01e26fee89e0820..00b3866773923c001c44958237020629b6c95027 100644 (file)
@@ -373,12 +373,29 @@ static int scsi_bus_resume(struct device * dev)
        return err;
 }
 
+static int scsi_bus_remove(struct device *dev)
+{
+       struct device_driver *drv = dev->driver;
+       struct scsi_device *sdev = to_scsi_device(dev);
+       int err = 0;
+
+       /* reset the prep_fn back to the default since the
+        * driver may have altered it and it's being removed */
+       blk_queue_prep_rq(sdev->request_queue, scsi_prep_fn);
+
+       if (drv && drv->remove)
+               err = drv->remove(dev);
+
+       return 0;
+}
+
 struct bus_type scsi_bus_type = {
         .name          = "scsi",
         .match         = scsi_bus_match,
        .uevent         = scsi_bus_uevent,
        .suspend        = scsi_bus_suspend,
        .resume         = scsi_bus_resume,
+       .remove         = scsi_bus_remove,
 };
 
 int scsi_sysfs_register(void)
index 44a340bd937b9fb43752ccceb1427c25341f92bc..65c584db33bd6d3348bdfd4b14fd2c35634c584f 100644 (file)
@@ -265,7 +265,8 @@ EXPORT_SYMBOL_GPL(srp_rport_del);
 
 static int do_srp_rport_del(struct device *dev, void *data)
 {
-       srp_rport_del(dev_to_rport(dev));
+       if (scsi_is_srp_rport(dev))
+               srp_rport_del(dev_to_rport(dev));
        return 0;
 }
 
index 98dfd6ea209c69cd42b54fcbad286ac83826d7c7..328c47c6aeb1928a720f901f43f2a25e01ebb52e 100644 (file)
@@ -3611,6 +3611,7 @@ static struct st_buffer *
 
        tb->dma = need_dma;
        tb->buffer_size = got;
+       sg_init_table(tb->sg, max_sg);
 
        return tb;
 }
index 0f74aba5b2378cc4be77412785842e6fb168b4dc..9e0908d1981a99f1fef86f3b6f4bf531e83366fa 100644 (file)
@@ -1243,7 +1243,7 @@ static void sym_free_resources(struct sym_hcb *np, struct pci_dev *pdev)
         *  Free O/S specific resources.
         */
        if (pdev->irq)
-               free_irq(pdev->irq, np);
+               free_irq(pdev->irq, np->s.host);
        if (np->s.ioaddr)
                pci_iounmap(pdev, np->s.ioaddr);
        if (np->s.ramaddr)
index 463f119f20e90c6ab46c6448be3ba4fa57c73f20..254bdaeb35ff69d970fffd76533e944fd60577b2 100644 (file)
@@ -2791,7 +2791,7 @@ irqreturn_t sym_interrupt(struct Scsi_Host *shost)
        istat = INB(np, nc_istat);
        if (istat & INTF) {
                OUTB(np, nc_istat, (istat & SIGP) | INTF | np->istat_sem);
-               istat = INB(np, nc_istat);              /* DUMMY READ */
+               istat |= INB(np, nc_istat);             /* DUMMY READ */
                if (DEBUG_FLAGS & DEBUG_TINY) printf ("F ");
                sym_wakeup_done(np);
        }
index 707c5b03bce92c1694f62721bbfe455a405b98bb..a2d4a19550ab9be4c5fbf99abf93c7e68e248ee1 100644 (file)
@@ -52,7 +52,7 @@ void sunserial_unregister_minors(struct uart_driver *drv, int count)
 }
 EXPORT_SYMBOL(sunserial_unregister_minors);
 
-int __init sunserial_console_match(struct console *con, struct device_node *dp,
+int sunserial_console_match(struct console *con, struct device_node *dp,
                            struct uart_driver *drv, int line)
 {
        int off;
index 81639c6be1c73c052dafaa09ae1a99a80cb55d4f..f7f8580edad86c9be126ce1b6abd97d7629ee261 100644 (file)
@@ -184,6 +184,7 @@ int spi_bitbang_setup(struct spi_device *spi)
        struct spi_bitbang_cs   *cs = spi->controller_state;
        struct spi_bitbang      *bitbang;
        int                     retval;
+       unsigned long           flags;
 
        bitbang = spi_master_get_devdata(spi->master);
 
@@ -222,12 +223,12 @@ int spi_bitbang_setup(struct spi_device *spi)
         */
 
        /* deselect chip (low or high) */
-       spin_lock(&bitbang->lock);
+       spin_lock_irqsave(&bitbang->lock, flags);
        if (!bitbang->busy) {
                bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
                ndelay(cs->nsecs);
        }
-       spin_unlock(&bitbang->lock);
+       spin_unlock_irqrestore(&bitbang->lock, flags);
 
        return 0;
 }
index 96258c60919da86f84edd4896b0760f2a67ec13a..63ee5cfbefbbe983e87030757c21c1ba8666da8b 100644 (file)
@@ -388,6 +388,17 @@ int ssb_bus_scan(struct ssb_bus *bus,
                case SSB_DEV_PCI:
                case SSB_DEV_PCIE:
 #ifdef CONFIG_SSB_DRIVER_PCICORE
+                       if (bus->bustype == SSB_BUSTYPE_PCI) {
+                               /* Ignore PCI cores on PCI-E cards.
+                                * Ignore PCI-E cores on PCI cards. */
+                               if (dev->id.coreid == SSB_DEV_PCI) {
+                                       if (bus->host_pci->is_pcie)
+                                               continue;
+                               } else {
+                                       if (!bus->host_pci->is_pcie)
+                                               continue;
+                               }
+                       }
                        if (bus->pcicore.dev) {
                                ssb_printk(KERN_WARNING PFX
                                           "WARNING: Multiple PCI(E) cores found\n");
index 9bb7f64a85cdb9b0e5041f00162b3f89d0b957dd..038e7d7b4da1c13845ae944f07b5aaeabf27b0ec 100644 (file)
@@ -1318,7 +1318,7 @@ static void setup_received_irq(struct fsl_udc *udc,
                                | USB_TYPE_STANDARD)) {
                        /* Note: The driver has not include OTG support yet.
                         * This will be set when OTG support is added */
-                       if (!gadget_is_otg(udc->gadget))
+                       if (!gadget_is_otg(&udc->gadget))
                                break;
                        else if (setup->bRequest == USB_DEVICE_B_HNP_ENABLE)
                                udc->gadget.b_hnp_enable = 1;
index da16b5157816b691df56ab8a692c3b812cc86bde..22833589c4bedcc17ea2120552f6eaf9118a88b3 100644 (file)
@@ -55,6 +55,7 @@ static int debug;
 static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */
        { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */
+       { USB_DEVICE(0x0FCF, 0x1004) }, /* Dynastream ANT2USB */
        { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */
        { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */
        { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */
index cf8add91de0585a3f40fe150f6d03f9b9100f4dd..0da1df9c79bf044677e703c125212a0dd5f0f52f 100644 (file)
@@ -483,6 +483,13 @@ static void pl2303_set_termios(struct usb_serial_port *port,
        }
        spin_unlock_irqrestore(&priv->lock, flags);
 
+       /* The PL2303 is reported to lose bytes if you change
+          serial settings even to the same values as before. Thus
+          we actually need to filter in this specific case */
+
+       if (!tty_termios_hw_change(port->tty->termios, old_termios))
+               return;
+
        cflag = port->tty->termios->c_cflag;
 
        buf = kzalloc(7, GFP_KERNEL);
index e5c274044a5fdd9accf3d2a4225e089565d56d57..c295d0495f96f9a6a490494e504ee0510f9a40fb 100644 (file)
@@ -109,6 +109,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
        { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
        { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */
+       { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */
        { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
        { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/
        { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/
@@ -146,6 +147,7 @@ static struct usb_device_id id_table_3port [] = {
        { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
        { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
        { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */
+       { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */
        { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
        { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/
        { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/
index 11a3a222dfc3b7a8a6f59991adf0b0354a2af73d..7c30cc8df71eb057b313a841f3c120ad75ae05dd 100644 (file)
@@ -801,5 +801,5 @@ module_init(atmel_lcdfb_init);
 module_exit(atmel_lcdfb_exit);
 
 MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver");
-MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@rfo.atmel.com>");
+MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@atmel.com>");
 MODULE_LICENSE("GPL");
index 9c56c492a6939b6dda69fc454299dbb134771343..044a423a72cbe406e0a5811796b246cb788f1ec3 100644 (file)
@@ -51,7 +51,8 @@
 #define L1GPU_DISPLAY_SYNC_HSYNC               1
 #define L1GPU_DISPLAY_SYNC_VSYNC               2
 
-#define GPU_CMD_BUF_SIZE                       (64 * 1024)
+#define GPU_CMD_BUF_SIZE                       (2 * 1024 * 1024)
+#define GPU_FB_START                           (64 * 1024)
 #define GPU_IOIF                               (0x0d000000UL)
 #define GPU_ALIGN_UP(x)                                _ALIGN_UP((x), 64)
 #define GPU_MAX_LINE_LENGTH                    (65536 - 64)
@@ -406,6 +407,7 @@ static void ps3fb_sync_image(struct device *dev, u64 frame_offset,
        if (src_line_length != dst_line_length)
                line_length |= (u64)src_line_length << 32;
 
+       src_offset += GPU_FB_START;
        status = lv1_gpu_context_attribute(ps3fb.context_handle,
                                           L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
                                           dst_offset, GPU_IOIF + src_offset,
@@ -441,8 +443,6 @@ static int ps3fb_sync(struct fb_info *info, u32 frame)
        u32 ddr_line_length, xdr_line_length;
        u64 ddr_base, xdr_base;
 
-       acquire_console_sem();
-
        if (frame > par->num_frames - 1) {
                dev_dbg(info->device, "%s: invalid frame number (%u)\n",
                        __func__, frame);
@@ -462,7 +462,6 @@ static int ps3fb_sync(struct fb_info *info, u32 frame)
                         xdr_line_length);
 
 out:
-       release_console_sem();
        return error;
 }
 
@@ -477,7 +476,10 @@ static int ps3fb_release(struct fb_info *info, int user)
        if (atomic_dec_and_test(&ps3fb.f_count)) {
                if (atomic_read(&ps3fb.ext_flip)) {
                        atomic_set(&ps3fb.ext_flip, 0);
-                       ps3fb_sync(info, 0);    /* single buffer */
+                       if (!try_acquire_console_sem()) {
+                               ps3fb_sync(info, 0);    /* single buffer */
+                               release_console_sem();
+                       }
                }
        }
        return 0;
@@ -863,7 +865,9 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd,
                        break;
 
                dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val);
+               acquire_console_sem();
                retval = ps3fb_sync(info, val);
+               release_console_sem();
                break;
 
        default:
@@ -883,7 +887,9 @@ static int ps3fbd(void *arg)
                set_current_state(TASK_INTERRUPTIBLE);
                if (ps3fb.is_kicked) {
                        ps3fb.is_kicked = 0;
+                       acquire_console_sem();
                        ps3fb_sync(info, 0);    /* single buffer */
+                       release_console_sem();
                }
                schedule();
        }
@@ -976,9 +982,8 @@ static int ps3fb_xdr_settings(u64 xdr_lpar, struct device *dev)
 
        status = lv1_gpu_context_attribute(ps3fb.context_handle,
                                           L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP,
-                                          xdr_lpar + ps3fb.xdr_size,
-                                          GPU_CMD_BUF_SIZE,
-                                          GPU_IOIF + ps3fb.xdr_size, 0);
+                                          xdr_lpar, GPU_CMD_BUF_SIZE,
+                                          GPU_IOIF, 0);
        if (status) {
                dev_err(dev,
                        "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n",
@@ -1061,6 +1066,11 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
        struct task_struct *task;
        unsigned long max_ps3fb_size;
 
+       if (ps3fb_videomemory.size < GPU_CMD_BUF_SIZE) {
+               dev_err(&dev->core, "%s: Not enough video memory\n", __func__);
+               return -ENOMEM;
+       }
+
        status = ps3_open_hv_device(dev);
        if (status) {
                dev_err(&dev->core, "%s: ps3_open_hv_device failed\n",
@@ -1131,8 +1141,14 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
        /* Clear memory to prevent kernel info leakage into userspace */
        memset(ps3fb.xdr_ea, 0, ps3fb_videomemory.size);
 
-       /* The GPU command buffer is at the end of video memory */
-       ps3fb.xdr_size = ps3fb_videomemory.size - GPU_CMD_BUF_SIZE;
+       /*
+        * The GPU command buffer is at the start of video memory
+        * As we don't use the full command buffer, we can put the actual
+        * frame buffer at offset GPU_FB_START and save some precious XDR
+        * memory
+        */
+       ps3fb.xdr_ea += GPU_FB_START;
+       ps3fb.xdr_size = ps3fb_videomemory.size - GPU_FB_START;
 
        retval = ps3fb_xdr_settings(xdr_lpar, &dev->core);
        if (retval)
@@ -1200,7 +1216,7 @@ err_fb_dealloc:
 err_framebuffer_release:
        framebuffer_release(info);
 err_free_irq:
-       free_irq(ps3fb.irq_no, dev);
+       free_irq(ps3fb.irq_no, &dev->core);
        ps3_irq_plug_destroy(ps3fb.irq_no);
 err_iounmap_dinfo:
        iounmap((u8 __iomem *)ps3fb.dinfo);
@@ -1222,12 +1238,6 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
        ps3fb_flip_ctl(0, &ps3fb);      /* flip off */
        ps3fb.dinfo->irq.mask = 0;
 
-       if (info) {
-               unregister_framebuffer(info);
-               fb_dealloc_cmap(&info->cmap);
-               framebuffer_release(info);
-       }
-
        ps3av_register_flip_ctl(NULL, NULL);
        if (ps3fb.task) {
                struct task_struct *task = ps3fb.task;
@@ -1235,9 +1245,15 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
                kthread_stop(task);
        }
        if (ps3fb.irq_no) {
-               free_irq(ps3fb.irq_no, dev);
+               free_irq(ps3fb.irq_no, &dev->core);
                ps3_irq_plug_destroy(ps3fb.irq_no);
        }
+       if (info) {
+               unregister_framebuffer(info);
+               fb_dealloc_cmap(&info->cmap);
+               framebuffer_release(info);
+               info = dev->core.driver_data = NULL;
+       }
        iounmap((u8 __iomem *)ps3fb.dinfo);
 
        status = lv1_gpu_context_free(ps3fb.context_handle);
index 5857ccf5f6b15208f64a7221405063f280b2d44a..ad35033f1a48947832f8896ed3db0c9936344d06 100644 (file)
@@ -1026,7 +1026,7 @@ static int s3c2410fb_resume(struct platform_device *dev)
        clk_enable(info->clk);
        msleep(1);
 
-       s3c2410fb_init_registers(info);
+       s3c2410fb_init_registers(fbinfo);
 
        return 0;
 }
index d1d6c0facd549737ef290d6325a4f4c29b7901d4..a14ef894d5716e4413affaea26cd59725b752341 100644 (file)
@@ -43,7 +43,7 @@ static struct fb_fix_screeninfo uvesafb_fix __devinitdata = {
 };
 
 static int mtrr                __devinitdata = 3; /* enable mtrr by default */
-static int blank       __devinitdata = 1; /* enable blanking by default */
+static int blank       = 1;               /* enable blanking by default */
 static int ypan                __devinitdata = 1; /* 0: scroll, 1: ypan, 2: ywrap */
 static int pmi_setpal  __devinitdata = 1; /* use PMI for palette changes */
 static int nocrtc      __devinitdata; /* ignore CRTC settings */
@@ -1549,7 +1549,7 @@ static void __devinit uvesafb_init_info(struct fb_info *info,
                info->fbops->fb_pan_display = NULL;
 }
 
-static void uvesafb_init_mtrr(struct fb_info *info)
+static void __devinit uvesafb_init_mtrr(struct fb_info *info)
 {
 #ifdef CONFIG_MTRR
        if (mtrr && !(info->fix.smem_start & (PAGE_SIZE - 1))) {
index 070217322c9fb30e98b1db28c476bc68b5cdbbef..33e50310e9e02418763188665457b127f4ae7520 100644 (file)
@@ -869,11 +869,9 @@ void w1_search_process(struct w1_master *dev, u8 search_type)
        w1_search_devices(dev, search_type, w1_slave_found);
 
        list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) {
-               if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl) {
+               if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl)
                        w1_slave_detach(sl);
-
-                       dev->slave_count--;
-               } else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags))
+               else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags))
                        sl->ttl = dev->slave_ttl;
        }
 
index 635f3e286ad83a01a062d5bad763d6be54101b93..487236c658374a1ecdbbc88ec8f2cd365a283bba 100644 (file)
@@ -1305,7 +1305,7 @@ config JFFS2_COMPRESSION_OPTIONS
        help
          Enabling this option allows you to explicitly choose which
          compression modules, if any, are enabled in JFFS2. Removing
-         compressors and mean you cannot read existing file systems,
+         compressors can mean you cannot read existing file systems,
          and enabling experimental compressors can mean that you
          write a file system which cannot be read by a standard kernel.
 
index e176d195e7e53982659388b970d60270f9bb695b..7596e1e94cde858df0ba7ea0907f9b86d1f4132e 100644 (file)
@@ -319,7 +319,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
        current->mm->free_area_cache = current->mm->mmap_base;
        current->mm->cached_hole_size = 0;
 
-       current->mm->mmap = NULL;
        compute_creds(bprm);
        current->flags &= ~PF_FORKNOEXEC;
 #ifdef __sparc__
index ba8de7ca260bea7e0cf456b4a7bfe56434ad502f..f0b3171842f22e75796d2aa68a7713f30af2f111 100644 (file)
@@ -1384,7 +1384,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
        prstatus->pr_sigpend = p->pending.signal.sig[0];
        prstatus->pr_sighold = p->blocked.sig[0];
        prstatus->pr_pid = task_pid_vnr(p);
-       prstatus->pr_ppid = task_pid_vnr(p->parent);
+       prstatus->pr_ppid = task_pid_vnr(p->real_parent);
        prstatus->pr_pgrp = task_pgrp_vnr(p);
        prstatus->pr_sid = task_session_vnr(p);
        if (thread_group_leader(p)) {
@@ -1430,7 +1430,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
        psinfo->pr_psargs[len] = 0;
 
        psinfo->pr_pid = task_pid_vnr(p);
-       psinfo->pr_ppid = task_pid_vnr(p->parent);
+       psinfo->pr_ppid = task_pid_vnr(p->real_parent);
        psinfo->pr_pgrp = task_pgrp_vnr(p);
        psinfo->pr_sid = task_session_vnr(p);
 
index e8b7c3a98a544922f886cf19631aab5a258ec101..da8cb3b3592c96ade1614ab8e553b5e16597b42a 100644 (file)
@@ -10,6 +10,8 @@
  * ioctls.
  */
 
+#include <linux/joystick.h>
+
 #include <linux/types.h>
 #include <linux/compat.h>
 #include <linux/kernel.h>
@@ -2642,6 +2644,12 @@ COMPATIBLE_IOCTL(VIDEO_SET_ATTRIBUTES)
 COMPATIBLE_IOCTL(VIDEO_GET_SIZE)
 COMPATIBLE_IOCTL(VIDEO_GET_FRAME_RATE)
 
+/* joystick */
+COMPATIBLE_IOCTL(JSIOCGVERSION)
+COMPATIBLE_IOCTL(JSIOCGAXES)
+COMPATIBLE_IOCTL(JSIOCGBUTTONS)
+COMPATIBLE_IOCTL(JSIOCGNAME(0))
+
 /* now things that need handlers */
 HANDLE_IOCTL(MEMREADOOB32, mtd_rw_oob)
 HANDLE_IOCTL(MEMWRITEOOB32, mtd_rw_oob)
index 2809768d9c4106e20f14d75ab86ccc408ea689c5..cee7c6f428f0fa518e80bda281eb92421a5ac295 100644 (file)
@@ -827,6 +827,18 @@ static inline void dquot_decr_space(struct dquot *dquot, qsize_t number)
        clear_bit(DQ_BLKS_B, &dquot->dq_flags);
 }
 
+static int warning_issued(struct dquot *dquot, const int warntype)
+{
+       int flag = (warntype == QUOTA_NL_BHARDWARN ||
+               warntype == QUOTA_NL_BSOFTLONGWARN) ? DQ_BLKS_B :
+               ((warntype == QUOTA_NL_IHARDWARN ||
+               warntype == QUOTA_NL_ISOFTLONGWARN) ? DQ_INODES_B : 0);
+
+       if (!flag)
+               return 0;
+       return test_and_set_bit(flag, &dquot->dq_flags);
+}
+
 #ifdef CONFIG_PRINT_QUOTA_WARNING
 static int flag_print_warnings = 1;
 
@@ -845,16 +857,12 @@ static inline int need_print_warning(struct dquot *dquot)
 }
 
 /* Print warning to user which exceeded quota */
-static void print_warning(struct dquot *dquot, const char warntype)
+static void print_warning(struct dquot *dquot, const int warntype)
 {
        char *msg = NULL;
        struct tty_struct *tty;
-       int flag = (warntype == QUOTA_NL_BHARDWARN ||
-               warntype == QUOTA_NL_BSOFTLONGWARN) ? DQ_BLKS_B :
-               ((warntype == QUOTA_NL_IHARDWARN ||
-               warntype == QUOTA_NL_ISOFTLONGWARN) ? DQ_INODES_B : 0);
 
-       if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags)))
+       if (!need_print_warning(dquot))
                return;
 
        mutex_lock(&tty_mutex);
@@ -895,9 +903,6 @@ out_lock:
 
 #ifdef CONFIG_QUOTA_NETLINK_INTERFACE
 
-/* Size of quota netlink message - actually an upperbound for buffer size */
-#define QUOTA_NL_MSG_SIZE 32
-
 /* Netlink family structure for quota */
 static struct genl_family quota_genl_family = {
        .id = GENL_ID_GENERATE,
@@ -914,11 +919,13 @@ static void send_warning(const struct dquot *dquot, const char warntype)
        struct sk_buff *skb;
        void *msg_head;
        int ret;
+       int msg_size = 4 * nla_total_size(sizeof(u32)) +
+                      2 * nla_total_size(sizeof(u64));
 
        /* We have to allocate using GFP_NOFS as we are called from a
         * filesystem performing write and thus further recursion into
         * the fs to free some data could cause deadlocks. */
-       skb = genlmsg_new(QUOTA_NL_MSG_SIZE, GFP_NOFS);
+       skb = genlmsg_new(msg_size, GFP_NOFS);
        if (!skb) {
                printk(KERN_ERR
                  "VFS: Not enough memory to send quota warning.\n");
@@ -959,18 +966,19 @@ static void send_warning(const struct dquot *dquot, const char warntype)
                        "VFS: Failed to send notification message: %d\n", ret);
        return;
 attr_err_out:
-       printk(KERN_ERR "VFS: Failed to compose quota message: %d\n", ret);
+       printk(KERN_ERR "VFS: Not enough space to compose quota message!\n");
 err_out:
        kfree_skb(skb);
 }
 #endif
 
-static inline void flush_warnings(struct dquot **dquots, char *warntype)
+static inline void flush_warnings(struct dquot * const *dquots, char *warntype)
 {
        int i;
 
        for (i = 0; i < MAXQUOTAS; i++)
-               if (dquots[i] != NODQUOT && warntype[i] != QUOTA_NL_NOWARN) {
+               if (dquots[i] != NODQUOT && warntype[i] != QUOTA_NL_NOWARN &&
+                   !warning_issued(dquots[i], warntype[i])) {
 #ifdef CONFIG_PRINT_QUOTA_WARNING
                        print_warning(dquots[i], warntype[i]);
 #endif
@@ -1216,7 +1224,7 @@ warn_put_all:
                for (cnt = 0; cnt < MAXQUOTAS; cnt++)
                        if (inode->i_dquot[cnt])
                                mark_dquot_dirty(inode->i_dquot[cnt]);
-       flush_warnings((struct dquot **)inode->i_dquot, warntype);
+       flush_warnings(inode->i_dquot, warntype);
        up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
        return ret;
 }
index bbed2fd40fdcd59d125e269afde868880c495724..f8ef0af919e70d27acdb9292acbd0d3d95669bd7 100644 (file)
@@ -799,7 +799,7 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat)
        rc = ecryptfs_crypto_api_algify_cipher_name(&full_alg_name,
                                                    crypt_stat->cipher, "cbc");
        if (rc)
-               goto out;
+               goto out_unlock;
        crypt_stat->tfm = crypto_alloc_blkcipher(full_alg_name, 0,
                                                 CRYPTO_ALG_ASYNC);
        kfree(full_alg_name);
@@ -808,12 +808,12 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat)
                ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): "
                                "Error initializing cipher [%s]\n",
                                crypt_stat->cipher);
-               mutex_unlock(&crypt_stat->cs_tfm_mutex);
-               goto out;
+               goto out_unlock;
        }
        crypto_blkcipher_set_flags(crypt_stat->tfm, CRYPTO_TFM_REQ_WEAK_KEY);
-       mutex_unlock(&crypt_stat->cs_tfm_mutex);
        rc = 0;
+out_unlock:
+       mutex_unlock(&crypt_stat->cs_tfm_mutex);
 out:
        return rc;
 }
@@ -1847,6 +1847,7 @@ ecryptfs_add_new_key_tfm(struct ecryptfs_key_tfm **key_tfm, char *cipher_name,
        mutex_init(&tmp_tfm->key_tfm_mutex);
        strncpy(tmp_tfm->cipher_name, cipher_name,
                ECRYPTFS_MAX_CIPHER_NAME_SIZE);
+       tmp_tfm->cipher_name[ECRYPTFS_MAX_CIPHER_NAME_SIZE] = '\0';
        tmp_tfm->key_size = key_size;
        rc = ecryptfs_process_key_cipher(&tmp_tfm->key_tfm,
                                         tmp_tfm->cipher_name,
index 0b1ab016fa2e513589c004373323c376af1de9ba..5a719180983cb36ebf3e264dc45c1559ebc209c0 100644 (file)
@@ -120,22 +120,9 @@ ecryptfs_do_create(struct inode *directory_inode,
        rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode,
                                             ecryptfs_dentry, mode, nd);
        if (rc) {
-               struct inode *ecryptfs_inode = ecryptfs_dentry->d_inode;
-               struct ecryptfs_inode_info *inode_info =
-                       ecryptfs_inode_to_private(ecryptfs_inode);
-
-               printk(KERN_WARNING "%s: Error creating underlying file; "
-                      "rc = [%d]; checking for existing\n", __FUNCTION__, rc);
-               if (inode_info) {
-                       mutex_lock(&inode_info->lower_file_mutex);
-                       if (!inode_info->lower_file) {
-                               mutex_unlock(&inode_info->lower_file_mutex);
-                               printk(KERN_ERR "%s: Failure to set underlying "
-                                      "file; rc = [%d]\n", __FUNCTION__, rc);
-                               goto out_lock;
-                       }
-                       mutex_unlock(&inode_info->lower_file_mutex);
-               }
+               printk(KERN_ERR "%s: Failure to create dentry in lower fs; "
+                      "rc = [%d]\n", __FUNCTION__, rc);
+               goto out_lock;
        }
        rc = ecryptfs_interpose(lower_dentry, ecryptfs_dentry,
                                directory_inode->i_sb, 0);
@@ -451,6 +438,7 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
        dentry->d_inode->i_nlink =
                ecryptfs_inode_to_lower(dentry->d_inode)->i_nlink;
        dentry->d_inode->i_ctime = dir->i_ctime;
+       d_drop(dentry);
 out_unlock:
        unlock_parent(lower_dentry);
        return rc;
index 263fed88c0cabac8e37e8b6801d50bdac0500326..f458c1f355655fcee80e3b8d4346d611686f3bc9 100644 (file)
@@ -1860,7 +1860,7 @@ ecryptfs_add_global_auth_tok(struct ecryptfs_mount_crypt_stat *mount_crypt_stat,
        struct ecryptfs_global_auth_tok *new_auth_tok;
        int rc = 0;
 
-       new_auth_tok = kmem_cache_alloc(ecryptfs_global_auth_tok_cache,
+       new_auth_tok = kmem_cache_zalloc(ecryptfs_global_auth_tok_cache,
                                        GFP_KERNEL);
        if (!new_auth_tok) {
                rc = -ENOMEM;
index b83a512b7e085183e6ea3edb15c8dda3047889b5..e5580bcb923a20e7d86e147f9bb9646b42722d15 100644 (file)
@@ -138,11 +138,14 @@ int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry)
                inode_info->lower_file = dentry_open(lower_dentry,
                                                     lower_mnt,
                                                     (O_RDWR | O_LARGEFILE));
-               if (IS_ERR(inode_info->lower_file))
+               if (IS_ERR(inode_info->lower_file)) {
+                       dget(lower_dentry);
+                       mntget(lower_mnt);
                        inode_info->lower_file = dentry_open(lower_dentry,
                                                             lower_mnt,
                                                             (O_RDONLY
                                                              | O_LARGEFILE));
+               }
                if (IS_ERR(inode_info->lower_file)) {
                        printk(KERN_ERR "Error opening lower persistent file "
                               "for lower_dentry [0x%p] and lower_mnt [0x%p]\n",
@@ -523,6 +526,7 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
        lower_mnt = nd.mnt;
        ecryptfs_set_superblock_lower(sb, lower_root->d_sb);
        sb->s_maxbytes = lower_root->d_sb->s_maxbytes;
+       sb->s_blocksize = lower_root->d_sb->s_blocksize;
        ecryptfs_set_dentry_lower(sb->s_root, lower_root);
        ecryptfs_set_dentry_lower_mnt(sb->s_root, lower_mnt);
        rc = ecryptfs_interpose(lower_root, sb->s_root, sb, 0);
index a96d341d154d0d0082047ca291632bd4002a7ac9..9cc2aec27b0dc5b8de698dd8779b0cb4e70682b8 100644 (file)
@@ -427,6 +427,7 @@ int ecryptfs_init_messaging(unsigned int transport)
        if (!ecryptfs_daemon_id_hash) {
                rc = -ENOMEM;
                ecryptfs_printk(KERN_ERR, "Failed to allocate memory\n");
+               mutex_unlock(&ecryptfs_daemon_id_hash_mux);
                goto out;
        }
        for (i = 0; i < ecryptfs_hash_buckets; i++)
index 16a7a555f39264a829ce70a9d2e8c9ba954c87c3..32c5711d79a320593e9a536590f3b347905055bd 100644 (file)
@@ -263,14 +263,13 @@ out:
        return 0;
 }
 
+/* This function must zero any hole we create */
 static int ecryptfs_prepare_write(struct file *file, struct page *page,
                                  unsigned from, unsigned to)
 {
        int rc = 0;
+       loff_t prev_page_end_size;
 
-       if (from == 0 && to == PAGE_CACHE_SIZE)
-               goto out;       /* If we are writing a full page, it will be
-                                  up to date. */
        if (!PageUptodate(page)) {
                rc = ecryptfs_read_lower_page_segment(page, page->index, 0,
                                                      PAGE_CACHE_SIZE,
@@ -283,22 +282,32 @@ static int ecryptfs_prepare_write(struct file *file, struct page *page,
                } else
                        SetPageUptodate(page);
        }
-       if (page->index != 0) {
-               loff_t end_of_prev_pg_pos =
-                       (((loff_t)page->index << PAGE_CACHE_SHIFT) - 1);
 
-               if (end_of_prev_pg_pos > i_size_read(page->mapping->host)) {
+       prev_page_end_size = ((loff_t)page->index << PAGE_CACHE_SHIFT);
+
+       /*
+        * If creating a page or more of holes, zero them out via truncate.
+        * Note, this will increase i_size.
+        */
+       if (page->index != 0) {
+               if (prev_page_end_size > i_size_read(page->mapping->host)) {
                        rc = ecryptfs_truncate(file->f_path.dentry,
-                                              end_of_prev_pg_pos);
+                                              prev_page_end_size);
                        if (rc) {
                                printk(KERN_ERR "Error on attempt to "
                                       "truncate to (higher) offset [%lld];"
-                                      " rc = [%d]\n", end_of_prev_pg_pos, rc);
+                                      " rc = [%d]\n", prev_page_end_size, rc);
                                goto out;
                        }
                }
-               if (end_of_prev_pg_pos + 1 > i_size_read(page->mapping->host))
-                       zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
+       }
+       /*
+        * Writing to a new page, and creating a small hole from start of page?
+        * Zero it out.
+        */
+       if ((i_size_read(page->mapping->host) == prev_page_end_size) &&
+           (from != 0)) {
+               zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
        }
 out:
        return rc;
index 6b7474a4336a5844cd004d3b8af923f19d6fc536..948f57624c05dd2bb1750ff05628f7931f44f2b7 100644 (file)
@@ -124,6 +124,10 @@ int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset,
        loff_t pos;
        int rc = 0;
 
+       /*
+        * if we are writing beyond current size, then start pos
+        * at the current size - we'll fill in zeros from there.
+        */
        if (offset > ecryptfs_file_size)
                pos = ecryptfs_file_size;
        else
@@ -137,6 +141,7 @@ int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset,
                if (num_bytes > total_remaining_bytes)
                        num_bytes = total_remaining_bytes;
                if (pos < offset) {
+                       /* remaining zeros to write, up to destination offset */
                        size_t total_remaining_zeros = (offset - pos);
 
                        if (num_bytes > total_remaining_zeros)
@@ -167,17 +172,27 @@ int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset,
                        }
                }
                ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0);
+
+               /*
+                * pos: where we're now writing, offset: where the request was
+                * If current pos is before request, we are filling zeros
+                * If we are at or beyond request, we are writing the *data*
+                * If we're in a fresh page beyond eof, zero it in either case
+                */
+               if (pos < offset || !start_offset_in_page) {
+                       /* We are extending past the previous end of the file.
+                        * Fill in zero values to the end of the page */
+                       memset(((char *)ecryptfs_page_virt
+                               + start_offset_in_page), 0,
+                               PAGE_CACHE_SIZE - start_offset_in_page);
+               }
+
+               /* pos >= offset, we are now writing the data request */
                if (pos >= offset) {
                        memcpy(((char *)ecryptfs_page_virt
                                + start_offset_in_page),
                               (data + data_offset), num_bytes);
                        data_offset += num_bytes;
-               } else {
-                       /* We are extending past the previous end of the file.
-                        * Fill in zero values up to the start of where we
-                        * will be writing data. */
-                       memset(((char *)ecryptfs_page_virt
-                               + start_offset_in_page), 0, num_bytes);
                }
                kunmap_atomic(ecryptfs_page_virt, KM_USER0);
                flush_dcache_page(ecryptfs_page);
index f8cdab2bee3d717dee1b1cf5d4db2a512e54bb4e..4859c4eecd654c8b7493f51fec4fee228a9f3d8f 100644 (file)
@@ -86,7 +86,6 @@ static void ecryptfs_destroy_inode(struct inode *inode)
                        fput(inode_info->lower_file);
                        inode_info->lower_file = NULL;
                        d_drop(lower_dentry);
-                       d_delete(lower_dentry);
                }
        }
        mutex_unlock(&inode_info->lower_file_mutex);
index de55da9e28ba618b85b7d7831793dec0e44a7d72..cb14de1502c35783fd89d11f4b362cd28faaf91c 100644 (file)
@@ -1676,7 +1676,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
        sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);
        sbi->s_frags_per_group = le32_to_cpu(es->s_frags_per_group);
        sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);
-       if (EXT3_INODE_SIZE(sb) == 0)
+       if (EXT3_INODE_SIZE(sb) == 0 || EXT3_INODES_PER_GROUP(sb) == 0)
                goto cantfind_ext3;
        sbi->s_inodes_per_block = blocksize / EXT3_INODE_SIZE(sb);
        if (sbi->s_inodes_per_block == 0)
index 8031dc0e24e5d7eccc2f984a9ac92d24e97c40d2..1ca0f546c466193e46c519879e8329a18c1b1af1 100644 (file)
@@ -1797,7 +1797,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
                sbi->s_desc_size = EXT4_MIN_DESC_SIZE;
        sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);
        sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);
-       if (EXT4_INODE_SIZE(sb) == 0)
+       if (EXT4_INODE_SIZE(sb) == 0 || EXT4_INODES_PER_GROUP(sb) == 0)
                goto cantfind_ext4;
        sbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb);
        if (sbi->s_inodes_per_block == 0)
index 2c1b73fb82ae29f5a135342c75c2d73fe0d5d931..5fb366992b73dcfdbf6a936c510622087b324444 100644 (file)
@@ -590,21 +590,49 @@ error:
 
 EXPORT_SYMBOL_GPL(fat_free_clusters);
 
+/* 128kb is the whole sectors for FAT12 and FAT16 */
+#define FAT_READA_SIZE         (128 * 1024)
+
+static void fat_ent_reada(struct super_block *sb, struct fat_entry *fatent,
+                         unsigned long reada_blocks)
+{
+       struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops;
+       sector_t blocknr;
+       int i, offset;
+
+       ops->ent_blocknr(sb, fatent->entry, &offset, &blocknr);
+
+       for (i = 0; i < reada_blocks; i++)
+               sb_breadahead(sb, blocknr + i);
+}
+
 int fat_count_free_clusters(struct super_block *sb)
 {
        struct msdos_sb_info *sbi = MSDOS_SB(sb);
        struct fatent_operations *ops = sbi->fatent_ops;
        struct fat_entry fatent;
+       unsigned long reada_blocks, reada_mask, cur_block;
        int err = 0, free;
 
        lock_fat(sbi);
        if (sbi->free_clusters != -1)
                goto out;
 
+       reada_blocks = FAT_READA_SIZE >> sb->s_blocksize_bits;
+       reada_mask = reada_blocks - 1;
+       cur_block = 0;
+
        free = 0;
        fatent_init(&fatent);
        fatent_set_entry(&fatent, FAT_START_ENT);
        while (fatent.entry < sbi->max_cluster) {
+               /* readahead of fat blocks */
+               if ((cur_block & reada_mask) == 0) {
+                       unsigned long rest = sbi->fat_length - cur_block;
+                       fat_ent_reada(sb, &fatent, min(reada_blocks, rest));
+               }
+               cur_block++;
+
                err = fat_ent_read_block(sb, &fatent);
                if (err)
                        goto out;
index f13f1494d4fe8099ca8779c8aaf0771ca1ec95c9..f8452a0eab562085ddd50e3f3e52352bebcc4cb2 100644 (file)
@@ -52,6 +52,10 @@ int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd)
                rec = (e + b) / 2;
                len = hfs_brec_lenoff(bnode, rec, &off);
                keylen = hfs_brec_keylen(bnode, rec);
+               if (keylen == HFS_BAD_KEYLEN) {
+                       res = -EINVAL;
+                       goto done;
+               }
                hfs_bnode_read(bnode, fd->key, off, keylen);
                cmpval = bnode->tree->keycmp(fd->key, fd->search_key);
                if (!cmpval) {
@@ -67,6 +71,10 @@ int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd)
        if (rec != e && e >= 0) {
                len = hfs_brec_lenoff(bnode, e, &off);
                keylen = hfs_brec_keylen(bnode, e);
+               if (keylen == HFS_BAD_KEYLEN) {
+                       res = -EINVAL;
+                       goto done;
+               }
                hfs_bnode_read(bnode, fd->key, off, keylen);
        }
 done:
@@ -198,6 +206,10 @@ int hfs_brec_goto(struct hfs_find_data *fd, int cnt)
 
        len = hfs_brec_lenoff(bnode, fd->record, &off);
        keylen = hfs_brec_keylen(bnode, fd->record);
+       if (keylen == HFS_BAD_KEYLEN) {
+               res = -EINVAL;
+               goto out;
+       }
        fd->keyoffset = off;
        fd->keylength = keylen;
        fd->entryoffset = off + keylen;
index 5c87cf4801fcb00f05311d2883c9977dbfa5ef2f..8626ee375ea811d3a4e794a5f72a05d96b09bea0 100644 (file)
@@ -44,10 +44,21 @@ u16 hfs_brec_keylen(struct hfs_bnode *node, u16 rec)
                recoff = hfs_bnode_read_u16(node, node->tree->node_size - (rec + 1) * 2);
                if (!recoff)
                        return 0;
-               if (node->tree->attributes & HFS_TREE_BIGKEYS)
+               if (node->tree->attributes & HFS_TREE_BIGKEYS) {
                        retval = hfs_bnode_read_u16(node, recoff) + 2;
-               else
+                       if (retval > node->tree->max_key_len + 2) {
+                               printk(KERN_ERR "hfs: keylen %d too large\n",
+                                       retval);
+                               retval = HFS_BAD_KEYLEN;
+                       }
+               } else {
                        retval = (hfs_bnode_read_u8(node, recoff) | 1) + 1;
+                       if (retval > node->tree->max_key_len + 1) {
+                               printk(KERN_ERR "hfs: keylen %d too large\n",
+                                       retval);
+                               retval = HFS_BAD_KEYLEN;
+                       }
+               }
        }
        return retval;
 }
index 8a3a650abc87a9ed4520318a811fb76619933a7e..31284c77bba87b8a393d5cc78789cd13f2e02b31 100644 (file)
@@ -81,6 +81,17 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
                goto fail_page;
        if (!tree->node_count)
                goto fail_page;
+       if ((id == HFS_EXT_CNID) && (tree->max_key_len != HFS_MAX_EXT_KEYLEN)) {
+               printk(KERN_ERR "hfs: invalid extent max_key_len %d\n",
+                       tree->max_key_len);
+               goto fail_page;
+       }
+       if ((id == HFS_CAT_CNID) && (tree->max_key_len != HFS_MAX_CAT_KEYLEN)) {
+               printk(KERN_ERR "hfs: invalid catalog max_key_len %d\n",
+                       tree->max_key_len);
+               goto fail_page;
+       }
+
        tree->node_size_shift = ffs(size) - 1;
        tree->pages_per_bnode = (tree->node_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 
@@ -89,9 +100,9 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
        return tree;
 
  fail_page:
-       tree->inode->i_mapping->a_ops = &hfs_aops;
        page_cache_release(page);
  free_tree:
+       tree->inode->i_mapping->a_ops = &hfs_aops;
        iput(tree->inode);
        kfree(tree);
        return NULL;
index 1445e3a56ed45695428a1633a344c2f5f6462d1b..c6aae61adfe6f098f9c0fc260b1090b1331d29d9 100644 (file)
@@ -28,6 +28,8 @@
 #define HFS_MAX_NAMELEN                128
 #define HFS_MAX_VALENCE                32767U
 
+#define HFS_BAD_KEYLEN         0xFF
+
 /* Meanings of the drAtrb field of the MDB,
  * Reference: _Inside Macintosh: Files_ p. 2-61
  */
@@ -167,6 +169,9 @@ typedef union hfs_btree_key {
        struct hfs_ext_key ext;
 } hfs_btree_key;
 
+#define HFS_MAX_CAT_KEYLEN     (sizeof(struct hfs_cat_key) - sizeof(u8))
+#define HFS_MAX_EXT_KEYLEN     (sizeof(struct hfs_ext_key) - sizeof(u8))
+
 typedef union hfs_btree_key btree_key;
 
 struct hfs_extent {
index 3b993db26cee2c2df753f883239e6e917039bd38..73e2e665817a100c9f05c33a12756f639d9c5ae7 100644 (file)
@@ -1605,7 +1605,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
        if (S_ISLNK(inode->i_mode))
                return -ELOOP;
        
-       if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE))
+       if (S_ISDIR(inode->i_mode) && (acc_mode & MAY_WRITE))
                return -EISDIR;
 
        /*
@@ -1620,7 +1620,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
                        return -EACCES;
 
                flag &= ~O_TRUNC;
-       } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE))
+       } else if (IS_RDONLY(inode) && (acc_mode & MAY_WRITE))
                return -EROFS;
 
        error = vfs_permission(nd, acc_mode);
index b35069a2aa9e575bd81fa09f59b67048718cca48..bd1b9d663fb9545893dc0b95722185c98a0666fa 100644 (file)
@@ -115,6 +115,7 @@ struct nfs4_lock_state {
 #define NFS_LOCK_INITIALIZED 1
        int                     ls_flags;
        struct nfs_seqid_counter        ls_seqid;
+       struct rpc_sequence     ls_sequence;
        struct nfs_unique_id    ls_id;
        nfs4_stateid            ls_stateid;
        atomic_t                ls_count;
index f03d9d5f5ba40d9d3db91a1dbb4ef43d74ab64bc..9e2e1c7291dbfd5959ba53389351f72c233629b8 100644 (file)
@@ -741,10 +741,10 @@ static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata)
        if (data->rpc_status == 0) {
                memcpy(data->o_res.stateid.data, data->c_res.stateid.data,
                                sizeof(data->o_res.stateid.data));
+               nfs_confirm_seqid(&data->owner->so_seqid, 0);
                renew_lease(data->o_res.server, data->timestamp);
                data->rpc_done = 1;
        }
-       nfs_confirm_seqid(&data->owner->so_seqid, data->rpc_status);
        nfs_increment_open_seqid(data->rpc_status, data->c_arg.seqid);
 }
 
@@ -759,7 +759,6 @@ static void nfs4_open_confirm_release(void *calldata)
        /* In case of error, no cleanup! */
        if (!data->rpc_done)
                goto out_free;
-       nfs_confirm_seqid(&data->owner->so_seqid, 0);
        state = nfs4_opendata_to_nfs4_state(data);
        if (!IS_ERR(state))
                nfs4_close_state(&data->path, state, data->o_arg.open_flags);
@@ -886,7 +885,6 @@ static void nfs4_open_release(void *calldata)
        /* In case we need an open_confirm, no cleanup! */
        if (data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM)
                goto out_free;
-       nfs_confirm_seqid(&data->owner->so_seqid, 0);
        state = nfs4_opendata_to_nfs4_state(data);
        if (!IS_ERR(state))
                nfs4_close_state(&data->path, state, data->o_arg.open_flags);
@@ -3333,6 +3331,12 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
 
        p->arg.fh = NFS_FH(inode);
        p->arg.fl = &p->fl;
+       if (!(lsp->ls_seqid.flags & NFS_SEQID_CONFIRMED)) {
+               p->arg.open_seqid = nfs_alloc_seqid(&lsp->ls_state->owner->so_seqid);
+               if (p->arg.open_seqid == NULL)
+                       goto out_free;
+
+       }
        p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid);
        if (p->arg.lock_seqid == NULL)
                goto out_free;
@@ -3345,6 +3349,8 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
        memcpy(&p->fl, fl, sizeof(p->fl));
        return p;
 out_free:
+       if (p->arg.open_seqid != NULL)
+               nfs_free_seqid(p->arg.open_seqid);
        kfree(p);
        return NULL;
 }
@@ -3361,23 +3367,23 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
                .rpc_cred = sp->so_cred,
        };
 
-       if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
-               return;
        dprintk("%s: begin!\n", __FUNCTION__);
        /* Do we need to do an open_to_lock_owner? */
        if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) {
-               data->arg.open_seqid = nfs_alloc_seqid(&sp->so_seqid);
-               if (data->arg.open_seqid == NULL) {
-                       data->rpc_status = -ENOMEM;
-                       task->tk_action = NULL;
-                       goto out;
-               }
+               if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0)
+                       return;
                data->arg.open_stateid = &state->stateid;
                data->arg.new_lock_owner = 1;
+               /* Retest in case we raced... */
+               if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED))
+                       goto do_rpc;
        }
+       if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
+               return;
+       data->arg.new_lock_owner = 0;
+do_rpc:        
        data->timestamp = jiffies;
        rpc_call_setup(task, &msg, 0);
-out:
        dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status);
 }
 
@@ -3413,8 +3419,6 @@ static void nfs4_lock_release(void *calldata)
        struct nfs4_lockdata *data = calldata;
 
        dprintk("%s: begin!\n", __FUNCTION__);
-       if (data->arg.open_seqid != NULL)
-               nfs_free_seqid(data->arg.open_seqid);
        if (data->cancelled != 0) {
                struct rpc_task *task;
                task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp,
@@ -3424,6 +3428,8 @@ static void nfs4_lock_release(void *calldata)
                dprintk("%s: cancelling lock!\n", __FUNCTION__);
        } else
                nfs_free_seqid(data->arg.lock_seqid);
+       if (data->arg.open_seqid != NULL)
+               nfs_free_seqid(data->arg.open_seqid);
        nfs4_put_lock_state(data->lsp);
        put_nfs_open_context(data->ctx);
        kfree(data);
index 3ea352d82eba23dc0db2b2d890904e352d7dba78..5e2e4af1a0e6c016237448b8e810165da63190d3 100644 (file)
@@ -133,9 +133,7 @@ nfs4_renewd_prepare_shutdown(struct nfs_server *server)
 void
 nfs4_kill_renewd(struct nfs_client *clp)
 {
-       down_read(&clp->cl_sem);
        cancel_delayed_work_sync(&clp->cl_renewd);
-       up_read(&clp->cl_sem);
 }
 
 /*
index 23a9a36556bf5f5ca4dba357157cbb35dc9ac331..5a39c6f78acf9394960885a1b774392d84019629 100644 (file)
@@ -509,7 +509,10 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f
        lsp = kzalloc(sizeof(*lsp), GFP_KERNEL);
        if (lsp == NULL)
                return NULL;
-       lsp->ls_seqid.sequence = &state->owner->so_sequence;
+       rpc_init_wait_queue(&lsp->ls_sequence.wait, "lock_seqid_waitqueue");
+       spin_lock_init(&lsp->ls_sequence.lock);
+       INIT_LIST_HEAD(&lsp->ls_sequence.list);
+       lsp->ls_seqid.sequence = &lsp->ls_sequence;
        atomic_set(&lsp->ls_count, 1);
        lsp->ls_owner = fl_owner;
        spin_lock(&clp->cl_lock);
index ea929207f27412e24a04631a301339b5990f7830..0b0c72a072ffd5c5c772a518d01db5a75fe4392a 100644 (file)
@@ -1475,7 +1475,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
                error = PTR_ERR(mntroot);
                goto error_splat_super;
        }
-       if (mntroot->d_inode->i_op != server->nfs_client->rpc_ops->dir_inode_ops) {
+       if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
                dput(mntroot);
                error = -ESTALE;
                goto error_splat_super;
@@ -1826,6 +1826,11 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
                error = PTR_ERR(mntroot);
                goto error_splat_super;
        }
+       if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
+               dput(mntroot);
+               error = -ESTALE;
+               goto error_splat_super;
+       }
 
        s->s_flags |= MS_ACTIVE;
        mnt->mnt_sb = s;
@@ -1900,6 +1905,11 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
                error = PTR_ERR(mntroot);
                goto error_splat_super;
        }
+       if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
+               dput(mntroot);
+               error = -ESTALE;
+               goto error_splat_super;
+       }
 
        s->s_flags |= MS_ACTIVE;
        mnt->mnt_sb = s;
index 2d116d2298f8e3aec23982bc04795dd9daf69ca2..f917fd25858af81a4edaf712fffa3480ee3a8e6b 100644 (file)
@@ -388,8 +388,11 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
         * Round the length of the data which was specified up to
         * the next multiple of XDR units and then compare that
         * against the length which was actually received.
+        * Note that when RPCSEC/GSS (for example) is used, the
+        * data buffer can be padded so dlen might be larger
+        * than required.  It must never be smaller.
         */
-       if (dlen != XDR_QUADLEN(len)*4)
+       if (dlen < XDR_QUADLEN(len)*4)
                return 0;
 
        if (args->count > max_blocksize) {
index 986f9b32083c655f792ada9476d3658a71bb37d7..b86e3658a0af10ebce825e260ee1fc5fd879f367 100644 (file)
@@ -313,8 +313,11 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
         * Round the length of the data which was specified up to
         * the next multiple of XDR units and then compare that
         * against the length which was actually received.
+        * Note that when RPCSEC/GSS (for example) is used, the
+        * data buffer can be padded so dlen might be larger
+        * than required.  It must never be smaller.
         */
-       if (dlen != XDR_QUADLEN(len)*4)
+       if (dlen < XDR_QUADLEN(len)*4)
                return 0;
 
        rqstp->rq_vec[0].iov_base = (void*)p;
index 65c62e1bfd6f6cb6170c53a55c90473fe10d5e6b..eb97f2897e2b50724046446be149951c1685c650 100644 (file)
@@ -169,7 +169,7 @@ static inline char *task_state(struct task_struct *p, char *buffer)
        ppid = pid_alive(p) ?
                task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
        tpid = pid_alive(p) && p->ptrace ?
-               task_ppid_nr_ns(rcu_dereference(p->parent), ns) : 0;
+               task_pid_nr_ns(rcu_dereference(p->parent), ns) : 0;
        buffer += sprintf(buffer,
                "State:\t%s\n"
                "Tgid:\t%d\n"
@@ -464,8 +464,8 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
                }
 
                sid = task_session_nr_ns(task, ns);
+               ppid = task_tgid_nr_ns(task->real_parent, ns);
                pgid = task_pgrp_nr_ns(task, ns);
-               ppid = task_ppid_nr_ns(task, ns);
 
                unlock_task_sighand(task, &flags);
        }
index 02a63ac04178e64c8f7e2a3bddee2fcadeaf8254..7411bfb0b7cce2823d7d604eea7b9c981c269fdd 100644 (file)
@@ -202,6 +202,26 @@ static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vf
         (task->state == TASK_STOPPED || task->state == TASK_TRACED) && \
         security_ptrace(current,task) == 0))
 
+struct mm_struct *mm_for_maps(struct task_struct *task)
+{
+       struct mm_struct *mm = get_task_mm(task);
+       if (!mm)
+               return NULL;
+       down_read(&mm->mmap_sem);
+       task_lock(task);
+       if (task->mm != mm)
+               goto out;
+       if (task->mm != current->mm && __ptrace_may_attach(task) < 0)
+               goto out;
+       task_unlock(task);
+       return mm;
+out:
+       task_unlock(task);
+       up_read(&mm->mmap_sem);
+       mmput(mm);
+       return NULL;
+}
+
 static int proc_pid_cmdline(struct task_struct *task, char * buffer)
 {
        int res = 0;
index 1820eb2ef7623a2c222e9be9b61d0e749f259187..05b3e9006262c49145f640e482062bbd0b6d14ad 100644 (file)
@@ -27,6 +27,8 @@ struct vmalloc_info {
        unsigned long   largest_chunk;
 };
 
+extern struct mm_struct *mm_for_maps(struct task_struct *);
+
 #ifdef CONFIG_MMU
 #define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
 extern void get_vmalloc_info(struct vmalloc_info *vmi);
index e0d064e9764ef55422cf79119b7624b3e6b87373..3462bfde89f68224a4ec48629e26c81feee0e44b 100644 (file)
@@ -410,7 +410,7 @@ static const struct file_operations proc_modules_operations = {
 };
 #endif
 
-#ifdef CONFIG_SLAB
+#ifdef CONFIG_SLABINFO
 static int slabinfo_open(struct inode *inode, struct file *file)
 {
        return seq_open(file, &slabinfo_op);
@@ -728,7 +728,7 @@ void __init proc_misc_init(void)
 #endif
        create_seq_entry("stat", 0, &proc_stat_operations);
        create_seq_entry("interrupts", 0, &proc_interrupts_operations);
-#ifdef CONFIG_SLAB
+#ifdef CONFIG_SLABINFO
        create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
 #ifdef CONFIG_DEBUG_SLAB_LEAK
        create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations);
index c24d81a5a040e2a91825673434339e3c2f1dcdda..8043a3eab52ce49f14f0b23f863b8fb77c6916ba 100644 (file)
@@ -397,12 +397,11 @@ static void *m_start(struct seq_file *m, loff_t *pos)
        if (!priv->task)
                return NULL;
 
-       mm = get_task_mm(priv->task);
+       mm = mm_for_maps(priv->task);
        if (!mm)
                return NULL;
 
        priv->tail_vma = tail_vma = get_gate_vma(priv->task);
-       down_read(&mm->mmap_sem);
 
        /* Start with last addr hint */
        if (last_addr && (vma = find_vma(mm, last_addr))) {
index d8b8c7183c243d86455390f1246da6c12891d396..1932c2ca345729580c60f5a0a2b8187779b9c450 100644 (file)
@@ -165,15 +165,13 @@ static void *m_start(struct seq_file *m, loff_t *pos)
        if (!priv->task)
                return NULL;
 
-       mm = get_task_mm(priv->task);
+       mm = mm_for_maps(priv->task);
        if (!mm) {
                put_task_struct(priv->task);
                priv->task = NULL;
                return NULL;
        }
 
-       down_read(&mm->mmap_sem);
-
        /* start from the Nth VMA */
        for (vml = mm->context.vmlist; vml; vml = vml->next)
                if (n-- == 0)
index 54c564693d93d287fb030b6f44e945838b35b85f..21a1c2b1c5fcf716b779fb973ef31fa5acb6114c 100644 (file)
@@ -261,9 +261,9 @@ xfs_file_readdir(
 #else
 
 struct hack_dirent {
-       int             namlen;
-       loff_t          offset;
        u64             ino;
+       loff_t          offset;
+       int             namlen;
        unsigned int    d_type;
        char            name[];
 };
@@ -285,8 +285,10 @@ xfs_hack_filldir(
 {
        struct hack_callback *buf = __buf;
        struct hack_dirent *de = (struct hack_dirent *)(buf->dirent + buf->used);
+       unsigned int reclen;
 
-       if (buf->used + sizeof(struct hack_dirent) + namlen > buf->len)
+       reclen = ALIGN(sizeof(struct hack_dirent) + namlen, sizeof(u64));
+       if (buf->used + reclen > buf->len)
                return -EINVAL;
 
        de->namlen = namlen;
@@ -294,7 +296,7 @@ xfs_hack_filldir(
        de->ino = ino;
        de->d_type = d_type;
        memcpy(de->name, name, namlen);
-       buf->used += sizeof(struct hack_dirent) + namlen;
+       buf->used += reclen;
        return 0;
 }
 
@@ -334,7 +336,8 @@ xfs_file_readdir(
                offset = filp->f_pos;
 
        while (!eof) {
-               int reclen;
+               unsigned int reclen;
+
                start_offset = offset;
 
                buf.used = 0;
@@ -347,6 +350,7 @@ xfs_file_readdir(
 
                size = buf.used;
                de = (struct hack_dirent *)buf.dirent;
+               curr_offset = de->offset /* & 0x7fffffff */;
                while (size > 0) {
                        if (filldir(dirent, de->name, de->namlen,
                                        curr_offset & 0x7fffffff,
@@ -354,15 +358,16 @@ xfs_file_readdir(
                                goto done;
                        }
 
-                       reclen = sizeof(struct hack_dirent) + de->namlen;
+                       reclen = ALIGN(sizeof(struct hack_dirent) + de->namlen,
+                                      sizeof(u64));
                        size -= reclen;
-                       curr_offset = de->offset /* & 0x7fffffff */;
                        de = (struct hack_dirent *)((char *)de + reclen);
+                       curr_offset = de->offset /* & 0x7fffffff */;
                }
        }
 
  done:
-       if (!error) {
+       if (!error) {
                if (size == 0)
                        filp->f_pos = offset & 0x7fffffff;
                else if (de)
index 37e116779eb187945edba30b9322b9b708518b5a..5e8bb7f71b5ae214ab7802b77cae09a6c44901bf 100644 (file)
@@ -332,9 +332,7 @@ xfs_vn_mknod(
                ASSERT(vp);
                ip = vn_to_inode(vp);
 
-               if (S_ISCHR(mode) || S_ISBLK(mode))
-                       ip->i_rdev = rdev;
-               else if (S_ISDIR(mode))
+               if (S_ISDIR(mode))
                        xfs_validate_fields(ip);
                d_instantiate(dentry, ip);
                xfs_validate_fields(dir);
index c171767e242ad3b3d19c8c93ea4651f0e30146ea..a5f4f4fb88683df96b65d9f883abbec35a1d2f8d 100644 (file)
@@ -508,7 +508,7 @@ xfs_dir2_block_getdents(
                        continue;
 
                cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
-                                                   ptr - (char *)block);
+                                           (char *)dep - (char *)block);
                ino = be64_to_cpu(dep->inumber);
 #if XFS_BIG_INUMS
                ino += mp->m_inoadd;
@@ -519,9 +519,7 @@ xfs_dir2_block_getdents(
                 */
                if (filldir(dirent, dep->name, dep->namelen, cook,
                            ino, DT_UNKNOWN)) {
-                       *offset = xfs_dir2_db_off_to_dataptr(mp,
-                                       mp->m_dirdatablk,
-                                       (char *)dep - (char *)block);
+                       *offset = cook;
                        xfs_da_brelse(NULL, bp);
                        return 0;
                }
index e7c12fa1303ee06c2d2837e781083b61cd0f7944..0ca0020ba09f0cd6c927d45d786712d80a87c2a1 100644 (file)
@@ -1091,7 +1091,7 @@ xfs_dir2_leaf_getdents(
                 * Won't fit.  Return to caller.
                 */
                if (filldir(dirent, dep->name, dep->namelen,
-                           xfs_dir2_byte_to_dataptr(mp, curoff + length),
+                           xfs_dir2_byte_to_dataptr(mp, curoff),
                            ino, DT_UNKNOWN))
                        break;
 
index 182c70315ad175b20e1ec5192bec92d9604c5635..919d275a1cef41c70fcb8d204104cfc918669f7a 100644 (file)
@@ -752,7 +752,7 @@ xfs_dir2_sf_getdents(
 #if XFS_BIG_INUMS
                ino += mp->m_inoadd;
 #endif
-               if (filldir(dirent, ".", 1, dotdot_offset, ino, DT_DIR)) {
+               if (filldir(dirent, ".", 1, dot_offset, ino, DT_DIR)) {
                        *offset = dot_offset;
                        return 0;
                }
@@ -762,13 +762,11 @@ xfs_dir2_sf_getdents(
         * Put .. entry unless we're starting past it.
         */
        if (*offset <= dotdot_offset) {
-               off = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
-                                                 XFS_DIR2_DATA_FIRST_OFFSET);
                ino = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent);
 #if XFS_BIG_INUMS
                ino += mp->m_inoadd;
 #endif
-               if (filldir(dirent, "..", 2, off, ino, DT_DIR)) {
+               if (filldir(dirent, "..", 2, dotdot_offset, ino, DT_DIR)) {
                        *offset = dotdot_offset;
                        return 0;
                }
@@ -793,8 +791,7 @@ xfs_dir2_sf_getdents(
 #endif
 
                if (filldir(dirent, sfep->name, sfep->namelen,
-                           off + xfs_dir2_data_entsize(sfep->namelen),
-                           ino, DT_UNKNOWN)) {
+                                           off, ino, DT_UNKNOWN)) {
                        *offset = off;
                        return 0;
                }
index abf509a88915e95aae00dcebec502170b1280b38..344948082819d94b82c72c5967d14e83e140cc36 100644 (file)
@@ -1459,8 +1459,10 @@ xfs_itruncate_start(
        mp = ip->i_mount;
        vp = XFS_ITOV(ip);
 
-       vn_iowait(ip);  /* wait for the completion of any pending DIOs */
-       
+       /* wait for the completion of any pending DIOs */
+       if (new_size < ip->i_size)
+               vn_iowait(ip);
+
        /*
         * Call toss_pages or flushinval_pages to get rid of pages
         * overlapping the region being removed.  We have to use
index b10d1aa4cdd1d7b22d1b38084c093db59ee31fb0..1c77f10b4b36328ffbf69a2f4bae5d8529a4272d 100644 (file)
@@ -72,25 +72,29 @@ IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a)
 __EXTERN_INLINE u8
 IO_CONCAT(__IO_PREFIX,readb)(const volatile void __iomem *a)
 {
-       return IO_CONCAT(__IO_PREFIX,ioread8)((void __iomem *)a);
+       void __iomem *addr = (void __iomem *)a;
+       return IO_CONCAT(__IO_PREFIX,ioread8)(addr);
 }
 
 __EXTERN_INLINE u16
 IO_CONCAT(__IO_PREFIX,readw)(const volatile void __iomem *a)
 {
-       return IO_CONCAT(__IO_PREFIX,ioread16)((void __iomem *)a);
+       void __iomem *addr = (void __iomem *)a;
+       return IO_CONCAT(__IO_PREFIX,ioread16)(addr);
 }
 
 __EXTERN_INLINE void
 IO_CONCAT(__IO_PREFIX,writeb)(u8 b, volatile void __iomem *a)
 {
-       IO_CONCAT(__IO_PREFIX,iowrite8)(b, (void __iomem *)a);
+       void __iomem *addr = (void __iomem *)a;
+       IO_CONCAT(__IO_PREFIX,iowrite8)(b, addr);
 }
 
 __EXTERN_INLINE void
 IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a)
 {
-       IO_CONCAT(__IO_PREFIX,iowrite16)(b, (void __iomem *)a);
+       void __iomem *addr = (void __iomem *)a;
+       IO_CONCAT(__IO_PREFIX,iowrite16)(b, addr);
 }
 #endif
 
index ab2d963e742a46c26185c7358e8ad28a0438ee51..e25558faa5a480f7b2c2fa78d444244e071e9ae6 100644 (file)
 
 #define cpu_is_pxa21x()                                        \
        ({                                              \
-               unsigned int id = read_cpuid(CPUID_ID); \
-               __cpu_is_pxa21x(id);                    \
+               __cpu_is_pxa21x(read_cpuid_id());       \
        })
 
 #define cpu_is_pxa25x()                                        \
        ({                                              \
-               unsigned int id = read_cpuid(CPUID_ID); \
-               __cpu_is_pxa25x(id);                    \
+               __cpu_is_pxa25x(read_cpuid_id());       \
        })
 
 #define cpu_is_pxa27x()                                        \
        ({                                              \
-               unsigned int id = read_cpuid(CPUID_ID); \
-               __cpu_is_pxa27x(id);                    \
+               __cpu_is_pxa27x(read_cpuid_id());       \
        })
 
 #define cpu_is_pxa300()                                        \
        ({                                              \
-               unsigned int id = read_cpuid(CPUID_ID); \
-               __cpu_is_pxa300(id);                    \
+               __cpu_is_pxa300(read_cpuid_id());       \
         })
 
 #define cpu_is_pxa310()                                        \
        ({                                              \
-               unsigned int id = read_cpuid(CPUID_ID); \
-               __cpu_is_pxa310(id);                    \
+               __cpu_is_pxa310(read_cpuid_id());       \
         })
 
 #define cpu_is_pxa320()                                        \
        ({                                              \
-               unsigned int id = read_cpuid(CPUID_ID); \
-               __cpu_is_pxa320(id);                    \
+               __cpu_is_pxa320(read_cpuid_id());       \
         })
 
 /*
 
 #define cpu_is_pxa2xx()                                        \
        ({                                              \
-               unsigned int id = read_cpuid(CPUID_ID); \
-               __cpu_is_pxa2xx(id);                    \
+               __cpu_is_pxa2xx(read_cpuid_id());       \
         })
 
 #define cpu_is_pxa3xx()                                        \
        ({                                              \
-               unsigned int id = read_cpuid(CPUID_ID); \
-               __cpu_is_pxa3xx(id);                    \
+               __cpu_is_pxa3xx(read_cpuid_id());       \
         })
 
 /*
index 94ea8c6dc1a4485014fd9bb8fbd7c29078e69696..28425c473e71c72c7a959f6650fc6707a89d6b0e 100644 (file)
 #ifndef __ASSEMBLY__
 
 #include <linux/linkage.h>
+#include <linux/stringify.h>
 #include <linux/irqflags.h>
 
+/*
+ * The CPU ID never changes at run time, so we might as well tell the
+ * compiler that it's constant.  Use this function to read the CPU ID
+ * rather than directly reading processor_id or read_cpuid() directly.
+ */
+static inline unsigned int read_cpuid_id(void) __attribute_const__;
+
+static inline unsigned int read_cpuid_id(void)
+{
+       return read_cpuid(CPUID_ID);
+}
+
 #define __exception    __attribute__((section(".exception.text")))
 
 struct thread_info;
index 6f2d924f4fd6d0f1421a46666ae81ad9c418b52f..bd57a794917057c20f7312f1661a97a9cfd473c8 100644 (file)
 #define __ARCH_WANT_SYS_SIGPENDING
 #define __ARCH_WANT_SYS_SIGPROCMASK
 #define __ARCH_WANT_SYS_RT_SIGACTION
+#define __ARCH_WANT_SYS_RT_SIGSUSPEND
 
 /*
  * "Conditional" syscalls
index f490e43a90b90a09e1cfe78a9f1215b66d3df74e..75f2bfab614f40639090702a2a6268f34864df75 100644 (file)
@@ -14,6 +14,7 @@
 #define _ASM_GENERIC__TLB_H
 
 #include <linux/swap.h>
+#include <linux/quicklist.h>
 #include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
 
index a977affaebeca34b02b1e9bb991f4ad83cd35281..a1b9719f5fbb7ba11071a92ddcd611e6945e2c2e 100644 (file)
@@ -124,10 +124,21 @@ clear_bit_unlock (int nr, volatile void *addr)
 /**
  * __clear_bit_unlock - Non-atomically clear a bit with release
  *
- * This is like clear_bit_unlock, but the implementation may use a non-atomic
- * store (this one uses an atomic, however).
+ * This is like clear_bit_unlock, but the implementation uses a store
+ * with release semantics. See also __raw_spin_unlock().
  */
-#define __clear_bit_unlock clear_bit_unlock
+static __inline__ void
+__clear_bit_unlock(int nr, volatile void *addr)
+{
+       __u32 mask, new;
+       volatile __u32 *m;
+
+       m = (volatile __u32 *)addr + (nr >> 5);
+       mask = ~(1 << (nr & 31));
+       new = *m & mask;
+       barrier();
+       ia64_st4_rel_nta(m, new);
+}
 
 /**
  * __clear_bit - Clears a bit in memory (non-atomic version)
index 4fb4e439b05c35eca06daf2762936939c3e1b333..e58d3298fa109eb4ba733d580e39d3b06580dbcc 100644 (file)
@@ -191,6 +191,11 @@ register unsigned long ia64_r13 asm ("r13") __attribute_used__;
        asm volatile ("ldf.fill %0=[%1]" :"=f"(__f__): "r"(x)); \
 })
 
+#define ia64_st4_rel_nta(m, val)                                       \
+({                                                                     \
+       asm volatile ("st4.rel.nta [%0] = %1\n\t" :: "r"(m), "r"(val)); \
+})
+
 #define ia64_stfs(x, regnum)                                           \
 ({                                                                     \
        register double __f__ asm ("f"#regnum);                         \
index bba5baa3c7fc97ca9fcfd9f63d26d118c8c24a98..7e6e3779670a3c82690a92d357d0d992247fba12 100644 (file)
@@ -63,7 +63,7 @@ extern int ia64_last_device_vector;
 #define IA64_NUM_DEVICE_VECTORS                (IA64_LAST_DEVICE_VECTOR - IA64_FIRST_DEVICE_VECTOR + 1)
 
 #define IA64_MCA_RENDEZ_VECTOR         0xe8    /* MCA rendez interrupt */
-#define IA64_PERFMON_VECTOR            0xee    /* performanc monitor interrupt vector */
+#define IA64_PERFMON_VECTOR            0xee    /* performance monitor interrupt vector */
 #define IA64_TIMER_VECTOR              0xef    /* use highest-prio group 15 interrupt for timer */
 #define        IA64_MCA_WAKEUP_VECTOR          0xf0    /* MCA wakeup (must be >MCA_RENDEZ_VECTOR) */
 #define IA64_IPI_LOCAL_TLB_FLUSH       0xfc    /* SMP flush local TLB */
index d069b6acddce1e82838001f739fee3de431195be..a520d103d80869d358a5e3d442c5b63a144dbdbc 100644 (file)
 #define ia64_st4_rel           __st4_rel
 #define ia64_st8_rel           __st8_rel
 
+/* FIXME: need st4.rel.nta intrinsic */
+#define ia64_st4_rel_nta       __st4_rel
+
 #define ia64_ld1_acq           __ld1_acq
 #define ia64_ld2_acq           __ld2_acq
 #define ia64_ld4_acq           __ld4_acq
index 5335d87ca5f8e080b756ec6dec7478822c87be1f..a0d214f4311560cf100b4f568d78998f4a62b112 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2000-2006 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2007 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
 
@@ -150,6 +150,35 @@ typedef enum {
        BTEFAIL_NOTAVAIL,       /* BTE not available */
 } bte_result_t;
 
+#define BTEFAIL_SH2_RESP_SHORT 0x1     /* bit 000001 */
+#define BTEFAIL_SH2_RESP_LONG  0x2     /* bit 000010 */
+#define BTEFAIL_SH2_RESP_DSP   0x4     /* bit 000100 */
+#define BTEFAIL_SH2_RESP_ACCESS        0x8     /* bit 001000 */
+#define BTEFAIL_SH2_CRB_TO     0x10    /* bit 010000 */
+#define BTEFAIL_SH2_NACK_LIMIT 0x20    /* bit 100000 */
+#define BTEFAIL_SH2_ALL                0x3F    /* bit 111111 */
+
+#define        BTE_ERR_BITS    0x3FUL
+#define        BTE_ERR_SHIFT   36
+#define BTE_ERR_MASK   (BTE_ERR_BITS << BTE_ERR_SHIFT)
+
+#define BTE_ERROR_RETRY(value)                                         \
+       (is_shub2() ? (value != BTEFAIL_SH2_CRB_TO)                     \
+               : (value != BTEFAIL_TOUT))
+
+/*
+ * On shub1 BTE_ERR_MASK will always be false, so no need for is_shub2()
+ */
+#define BTE_SHUB2_ERROR(_status)                                       \
+       ((_status & BTE_ERR_MASK)                                       \
+          ? (((_status >> BTE_ERR_SHIFT) & BTE_ERR_BITS) | IBLS_ERROR) \
+          : _status)
+
+#define BTE_GET_ERROR_STATUS(_status)                                  \
+       (BTE_SHUB2_ERROR(_status) & ~IBLS_ERROR)
+
+#define BTE_VALID_SH2_ERROR(value)                                     \
+       ((value >= BTEFAIL_SH2_RESP_SHORT) && (value <= BTEFAIL_SH2_ALL))
 
 /*
  * Structure defining a bte.  An instance of this
index 6f807e0193b77600f7a3abd03125fdb9cebc2b13..f7711b308e48e4d9216756dbcaa6ab5d0275bbd9 100644 (file)
@@ -86,7 +86,7 @@ xp_bte_copy(u64 src, u64 vdst, u64 len, u64 mode, void *notification)
        BUG_ON(REGION_NUMBER(vdst) != RGN_KERNEL);
 
        ret = bte_copy(src, pdst, len, mode, notification);
-       if (ret != BTE_SUCCESS) {
+       if ((ret != BTE_SUCCESS) && BTE_ERROR_RETRY(ret)) {
                if (!in_interrupt()) {
                        cond_resched();
                }
@@ -244,7 +244,30 @@ enum xpc_retval {
 
        xpcDisconnected,        /* 51: channel disconnected (closed) */
 
-       xpcUnknownReason        /* 52: unknown reason -- must be last in list */
+       xpcBteSh2Start,         /* 52: BTE CRB timeout */
+
+                               /* 53: 0x1 BTE Error Response Short */
+       xpcBteSh2RspShort = xpcBteSh2Start + BTEFAIL_SH2_RESP_SHORT,
+
+                               /* 54: 0x2 BTE Error Response Long */
+       xpcBteSh2RspLong = xpcBteSh2Start + BTEFAIL_SH2_RESP_LONG,
+
+                               /* 56: 0x4 BTE Error Response DSB */
+       xpcBteSh2RspDSB = xpcBteSh2Start + BTEFAIL_SH2_RESP_DSP,
+
+                               /* 60: 0x8 BTE Error Response Access */
+       xpcBteSh2RspAccess = xpcBteSh2Start + BTEFAIL_SH2_RESP_ACCESS,
+
+                               /* 68: 0x10 BTE Error CRB timeout */
+       xpcBteSh2CRBTO = xpcBteSh2Start + BTEFAIL_SH2_CRB_TO,
+
+                               /* 84: 0x20 BTE Error NACK limit */
+       xpcBteSh2NACKLimit = xpcBteSh2Start + BTEFAIL_SH2_NACK_LIMIT,
+
+                               /* 115: BTE end */
+       xpcBteSh2End = xpcBteSh2Start + BTEFAIL_SH2_ALL,
+
+       xpcUnknownReason        /* 116: unknown reason -- must be last in list */
 };
 
 
index e52b8508083be5dcd37243200795211b5423aff2..3c0900ab8003172b4d41f1dcd8f2139a1c1a6013 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2004-2006 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2004-2007 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
 
@@ -1211,6 +1211,14 @@ xpc_IPI_init(int index)
 static inline enum xpc_retval
 xpc_map_bte_errors(bte_result_t error)
 {
+       if (error == BTE_SUCCESS)
+               return xpcSuccess;
+
+       if (is_shub2()) {
+               if (BTE_VALID_SH2_ERROR(error))
+                       return xpcBteSh2Start + error;
+               return xpcBteUnmappedError;
+       }
        switch (error) {
        case BTE_SUCCESS:       return xpcSuccess;
        case BTEFAIL_DIR:       return xpcBteDirectoryError;
index 80bcb0a38e8adfbb7022ea9fff1a8e0f08534cc8..7774a1cac0cc42f77ac551d046604d31ee616004 100644 (file)
@@ -92,6 +92,10 @@ void smp_local_flush_tlb(void);
 #define smp_local_flush_tlb()
 #endif
 
-#define flush_tlb_kernel_range(start, end)     flush_tlb_all() /* XXX fix me */
+static inline void flush_tlb_kernel_range(unsigned long start,
+                                         unsigned long end)
+{
+       flush_tlb_all();        /* XXX fix me */
+}
 
 #endif /* _ASM_IA64_TLBFLUSH_H */
index 82328dec2b527d2ecdd05b0694ca2d8562c0558d..951e2487aa69019e80bd83b2d6ef8b12180afaf2 100644 (file)
@@ -286,6 +286,7 @@ extern void hpte_init_iSeries(void);
 extern void hpte_init_beat(void);
 extern void hpte_init_beat_v3(void);
 
+extern void slb_shadow_clear_all(void);
 extern void stabs_alloc(void);
 extern void slb_initialize(void);
 extern void slb_flush_and_rebolt(void);
index b1accce77bb5a84a52a5f3b165bff1350137770e..34b7807f068b3a0f1300bebdbd1046baad1da8d0 100644 (file)
@@ -246,6 +246,7 @@ struct spufs_calls {
                                                __u32 __user *ustatus);
        int (*coredump_extra_notes_size)(void);
        int (*coredump_extra_notes_write)(struct file *file, loff_t *foffset);
+       void (*notify_spus_active)(void);
        struct module *owner;
 };
 
@@ -298,6 +299,9 @@ struct notifier_block;
 int spu_switch_event_register(struct notifier_block * n);
 int spu_switch_event_unregister(struct notifier_block * n);
 
+extern void notify_spus_active(void);
+extern void do_notify_spus_active(void);
+
 /*
  * This defines the Local Store, Problem Area and Privlege Area of an SPU.
  */
index 9d528ada3c148615b6e09371aacaced7fdfcc867..e034c3604111b2ac99ffda62cd05bb6a88831381 100644 (file)
@@ -43,6 +43,12 @@ extern void __flush_purge_region(void *start, int size);
 extern void __flush_invalidate_region(void *start, int size);
 #endif
 
+#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
+static inline void flush_kernel_dcache_page(struct page *page)
+{
+       flush_dcache_page(page);
+}
+
 #if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF)
 extern void copy_to_user_page(struct vm_area_struct *vma,
        struct page *page, unsigned long vaddr, void *dst, const void *src,
index f18a1a5c95c0ad4856685ab050d71a48b8cf5081..77c391fa93d6380b1f25996a692dc77ca5af66dc 100644 (file)
@@ -73,38 +73,26 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
 /*
  * __access_ok: Check if address with size is OK or not.
  *
- * We do three checks:
- * (1) is it user space?
- * (2) addr + size --> carry?
- * (3) addr + size >= 0x80000000  (PAGE_OFFSET)
+ * Uhhuh, this needs 33-bit arithmetic. We have a carry..
  *
- * (1) (2) (3) | RESULT
- *  0   0   0  |  ok
- *  0   0   1  |  ok
- *  0   1   0  |  bad
- *  0   1   1  |  bad
- *  1   0   0  |  ok
- *  1   0   1  |  bad
- *  1   1   0  |  bad
- *  1   1   1  |  bad
+ * sum := addr + size;  carry? --> flag = true;
+ * if (sum >= addr_limit) flag = true;
  */
 static inline int __access_ok(unsigned long addr, unsigned long size)
 {
-       unsigned long flag, tmp;
-
-       __asm__("stc    r7_bank, %0\n\t"
-               "mov.l  @(8,%0), %0\n\t"
-               "clrt\n\t"
-               "addc   %2, %1\n\t"
-               "and    %1, %0\n\t"
-               "rotcl  %0\n\t"
-               "rotcl  %0\n\t"
-               "and    #3, %0"
-               : "=&z" (flag), "=r" (tmp)
-               : "r" (addr), "1" (size)
-               : "t");
-
+       unsigned long flag, sum;
+
+       __asm__("clrt\n\t"
+               "addc   %3, %1\n\t"
+               "movt   %0\n\t"
+               "cmp/hi %4, %1\n\t"
+               "rotcl  %0"
+               :"=&r" (flag), "=r" (sum)
+               :"1" (addr), "r" (size),
+                "r" (current_thread_info()->addr_limit.seg)
+               :"t");
        return flag == 0;
+
 }
 #endif /* CONFIG_MMU */
 
index 1fc655452b812cba0421f54211ccc451f076478e..38cbec76a33f1c04bd14948786891e90185c9277 100644 (file)
@@ -25,15 +25,9 @@ struct dma_ops {
        void (*sync_single_for_cpu)(struct device *dev,
                                    dma_addr_t dma_handle, size_t size,
                                    enum dma_data_direction direction);
-       void (*sync_single_for_device)(struct device *dev,
-                                      dma_addr_t dma_handle, size_t size,
-                                      enum dma_data_direction direction);
        void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg,
                                int nelems,
                                enum dma_data_direction direction);
-       void (*sync_sg_for_device)(struct device *dev, struct scatterlist *sg,
-                                  int nelems,
-                                  enum dma_data_direction direction);
 };
 extern const struct dma_ops *dma_ops;
 
@@ -105,7 +99,7 @@ static inline void dma_sync_single_for_device(struct device *dev,
                                              size_t size,
                                              enum dma_data_direction direction)
 {
-       dma_ops->sync_single_for_device(dev, dma_handle, size, direction);
+       /* No flushing needed to sync cpu writes to the device.  */
 }
 
 static inline void dma_sync_single_range_for_cpu(struct device *dev,
@@ -123,7 +117,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
                                                    size_t size,
                                                    enum dma_data_direction direction)
 {
-       dma_sync_single_for_device(dev, dma_handle+offset, size, direction);
+       /* No flushing needed to sync cpu writes to the device.  */
 }
 
 
@@ -138,7 +132,7 @@ static inline void dma_sync_sg_for_device(struct device *dev,
                                          struct scatterlist *sg, int nelems,
                                          enum dma_data_direction direction)
 {
-       dma_ops->sync_sg_for_device(dev, sg, nelems, direction);
+       /* No flushing needed to sync cpu writes to the device.  */
 }
 
 static inline int dma_mapping_error(dma_addr_t dma_addr)
index 1393e57d50fb0c2bbee86edc1fb814d1bca90b39..f59f2571295b69e8304ba406d54d17d7e6260b49 100644 (file)
@@ -200,6 +200,10 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 struct device_node;
 extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev);
 
+#define HAVE_ARCH_PCI_RESOURCE_TO_USER
+extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
+                                const struct resource *rsrc,
+                                resource_size_t *start, resource_size_t *end);
 #endif /* __KERNEL__ */
 
 #endif /* __SPARC64_PCI_H */
index 1f2d6d5bf20dd7659b38365982d781534f6e6a8c..fe2f2e5d51baf2bbe66e649c88d5de1713b56c42 100644 (file)
@@ -30,13 +30,13 @@ static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val)
        } v;
        v.u = val;
 #ifdef CONFIG_X86_BSWAP
-       asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
+       __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
            : "=r" (v.s.a), "=r" (v.s.b)
            : "0" (v.s.a), "1" (v.s.b));
 #else
        v.s.a = ___arch__swab32(v.s.a);
        v.s.b = ___arch__swab32(v.s.b);
-       asm("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b));
+       __asm__("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b));
 #endif
        return v.u;
 }
index b772d5b386855cd4f3de9c52ab13f747f9257e25..9fe8f3bddfd563fc7e70cabd9e495411d241f349 100644 (file)
@@ -73,7 +73,7 @@ struct kprobe_ctlblk {
        unsigned long kprobe_status;
        unsigned long kprobe_old_eflags;
        unsigned long kprobe_saved_eflags;
-       long *jprobe_saved_esp;
+       unsigned long *jprobe_saved_esp;
        struct pt_regs jprobe_saved_regs;
        kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
        struct prev_kprobe prev_kprobe;
index 53f4d85073545641421291911acc3a319488868c..743d76218fc97d44c023d7885ce6b21fbc31d1b1 100644 (file)
@@ -66,7 +66,7 @@ struct kprobe_ctlblk {
        unsigned long kprobe_status;
        unsigned long kprobe_old_rflags;
        unsigned long kprobe_saved_rflags;
-       long *jprobe_saved_rsp;
+       unsigned long *jprobe_saved_rsp;
        struct pt_regs jprobe_saved_regs;
        kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
        struct prev_kprobe prev_kprobe;
index ba4b3143212073bdfa1190158b130f63bde9906e..664a2fa7adc90baf18bad2d2424f3136b53ee96d 100644 (file)
@@ -191,38 +191,6 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
 
 #define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32)
 
-/* wrmsr with exception handling */
-#define wrmsr_safe(msr,a,b) ({ int ret__;                      \
-       asm volatile("2: wrmsr ; xorl %0,%0\n"                  \
-                    "1:\n\t"                                   \
-                    ".section .fixup,\"ax\"\n\t"               \
-                    "3:  movl %4,%0 ; jmp 1b\n\t"              \
-                    ".previous\n\t"                            \
-                    ".section __ex_table,\"a\"\n"              \
-                    "   .align 8\n\t"                          \
-                    "   .quad  2b,3b\n\t"                      \
-                    ".previous"                                \
-                    : "=a" (ret__)                             \
-                    : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT)); \
-       ret__; })
-
-#define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32))
-
-#define rdmsr_safe(msr,a,b) \
-       ({ int ret__;                                           \
-         asm volatile ("1:       rdmsr\n"                      \
-                       "2:\n"                                  \
-                       ".section .fixup,\"ax\"\n"              \
-                       "3:       movl %4,%0\n"                 \
-                       " jmp 2b\n"                             \
-                       ".previous\n"                           \
-                       ".section __ex_table,\"a\"\n"           \
-                       " .align 8\n"                           \
-                       " .quad 1b,3b\n"                                \
-                       ".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b)) \
-                       :"c"(msr), "i"(-EIO), "0"(0));                  \
-         ret__; })
-
 #define rdtsc(low,high) \
      __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
 
@@ -230,17 +198,17 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
      __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")
 
 #define rdtscp(low,high,aux) \
-     asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux))
+     __asm__ __volatile__ (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux))
 
 #define rdtscll(val) do { \
      unsigned int __a,__d; \
-     asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \
+     __asm__ __volatile__("rdtsc" : "=a" (__a), "=d" (__d)); \
      (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \
 } while(0)
 
 #define rdtscpll(val, aux) do { \
      unsigned long __a, __d; \
-     asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \
+     __asm__ __volatile__ (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \
      (val) = (__d << 32) | __a; \
 } while (0)
 
@@ -253,6 +221,7 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
                          : "=a" (low), "=d" (high) \
                          : "c" (counter))
 
+
 static inline void cpuid(int op, unsigned int *eax, unsigned int *ebx,
                         unsigned int *ecx, unsigned int *edx)
 {
@@ -320,6 +289,40 @@ static inline unsigned int cpuid_edx(unsigned int op)
        return edx;
 }
 
+#ifdef __KERNEL__
+
+/* wrmsr with exception handling */
+#define wrmsr_safe(msr,a,b) ({ int ret__;                      \
+       asm volatile("2: wrmsr ; xorl %0,%0\n"                  \
+                    "1:\n\t"                                   \
+                    ".section .fixup,\"ax\"\n\t"               \
+                    "3:  movl %4,%0 ; jmp 1b\n\t"              \
+                    ".previous\n\t"                            \
+                    ".section __ex_table,\"a\"\n"              \
+                    "   .align 8\n\t"                          \
+                    "   .quad  2b,3b\n\t"                      \
+                    ".previous"                                \
+                    : "=a" (ret__)                             \
+                    : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT)); \
+       ret__; })
+
+#define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32))
+
+#define rdmsr_safe(msr,a,b) \
+       ({ int ret__;                                           \
+         asm volatile ("1:       rdmsr\n"                      \
+                       "2:\n"                                  \
+                       ".section .fixup,\"ax\"\n"              \
+                       "3:       movl %4,%0\n"                 \
+                       " jmp 2b\n"                             \
+                       ".previous\n"                           \
+                       ".section __ex_table,\"a\"\n"           \
+                       " .align 8\n"                           \
+                       " .quad 1b,3b\n"                                \
+                       ".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b)) \
+                       :"c"(msr), "i"(-EIO), "0"(0));                  \
+         ret__; })
+
 #ifdef CONFIG_SMP
 void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
 void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
@@ -343,6 +346,7 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
        return wrmsr_safe(msr_no, l, h);
 }
 #endif  /* CONFIG_SMP */
+#endif  /* __KERNEL__ */
 #endif  /* __ASSEMBLY__ */
 
 #endif  /* !__i386__ */
index 4cb23848d4605c436730c353c17c60728af8f373..6e9e4841a2da25836a997f07941676a6c599459a 100644 (file)
@@ -7,6 +7,13 @@
 
 #ifdef __KERNEL__
 
+/* entries in ARCH_DLINFO: */
+#ifdef CONFIG_IA32_EMULATION
+# define AT_VECTOR_SIZE_ARCH 2
+#else
+# define AT_VECTOR_SIZE_ARCH 1
+#endif
+
 #define __SAVE(reg,offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t"
 #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t"
 
index 37bfa19d8064857897c1144101da3b2e9b44f198..f30fa92a44a1ef951771050d0fa5378fdf812522 100644 (file)
@@ -145,7 +145,6 @@ header-y += sound.h
 header-y += taskstats.h
 header-y += telephony.h
 header-y += termios.h
-header-y += ticable.h
 header-y += times.h
 header-y += tiocl.h
 header-y += tipc.h
@@ -154,6 +153,7 @@ header-y += toshiba.h
 header-y += ultrasound.h
 header-y += un.h
 header-y += utime.h
+header-y += veth.h
 header-y += video_decoder.h
 header-y += video_encoder.h
 header-y += videotext.h
index 9754baa1492171fbd89e6512fdf3160eb1a9e279..01a6244c9bc9b52f0583449d667a1a34f2a95dd7 100644 (file)
@@ -18,6 +18,9 @@
 
 #include <linux/types.h>
 
+typedef unsigned short apm_event_t;
+typedef unsigned short apm_eventinfo_t;
+
 struct apm_bios_info {
        __u16   version;
        __u16   cseg;
@@ -32,9 +35,6 @@ struct apm_bios_info {
 
 #ifdef __KERNEL__
 
-typedef unsigned short apm_event_t;
-typedef unsigned short apm_eventinfo_t;
-
 #define APM_CS         (GDT_ENTRY_APMBIOS_BASE * 8)
 #define APM_CS_16      (APM_CS + 8)
 #define APM_DS         (APM_CS_16 + 8)
index 5c4e54a2a8d65361aaf7ff9ee691baab67cb642e..72ab80801ef61d3f82c3a3cb7e980a2ca6c0f275 100644 (file)
@@ -190,6 +190,8 @@ enum {
        ATA_CMD_READ_LOG_EXT    = 0x2f,
        ATA_CMD_PMP_READ        = 0xE4,
        ATA_CMD_PMP_WRITE       = 0xE8,
+       ATA_CMD_CONF_OVERLAY    = 0xB1,
+       ATA_CMD_SEC_FREEZE_LOCK = 0xF5,
 
        /* READ_LOG_EXT pages */
        ATA_LOG_SATA_NCQ        = 0x10,
@@ -239,6 +241,19 @@ enum {
        SATA_AN                 = 0x05,  /* Asynchronous Notification */
        SATA_DIPM               = 0x03,  /* Device Initiated Power Management */
 
+       /* feature values for SET_MAX */
+       ATA_SET_MAX_ADDR        = 0x00,
+       ATA_SET_MAX_PASSWD      = 0x01,
+       ATA_SET_MAX_LOCK        = 0x02,
+       ATA_SET_MAX_UNLOCK      = 0x03,
+       ATA_SET_MAX_FREEZE_LOCK = 0x04,
+
+       /* feature values for DEVICE CONFIGURATION OVERLAY */
+       ATA_DCO_RESTORE         = 0xC0,
+       ATA_DCO_FREEZE_LOCK     = 0xC1,
+       ATA_DCO_IDENTIFY        = 0xC2,
+       ATA_DCO_SET             = 0xC3,
+
        /* ATAPI stuff */
        ATAPI_PKT_DMA           = (1 << 0),
        ATAPI_DMADIR            = (1 << 2),     /* ATAPI data dir:
index b79c5756936728ca8a576c3ea13142f71f333f4c..92f2029a34f33522c255f08f961416e1e22647a7 100644 (file)
@@ -107,7 +107,6 @@ extern void unlock_cpu_hotplug(void);
 #define register_hotcpu_notifier(nb)   register_cpu_notifier(nb)
 #define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
 int cpu_down(unsigned int cpu);
-#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
 
 #else          /* CONFIG_HOTPLUG_CPU */
 
@@ -122,9 +121,6 @@ static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
 /* These aren't inline functions due to a GCC bug. */
 #define register_hotcpu_notifier(nb)   ({ (void)(nb); 0; })
 #define unregister_hotcpu_notifier(nb) ({ (void)(nb); })
-
-/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */
-static inline int cpu_is_offline(int cpu) { return 0; }
 #endif         /* CONFIG_HOTPLUG_CPU */
 
 #ifdef CONFIG_PM_SLEEP_SMP
index 23f55140ccd570fd45c321b8275ce04edc451288..85bd790c201eeaafb62da1b03006c13b29e61598 100644 (file)
@@ -397,6 +397,8 @@ extern cpumask_t cpu_present_map;
 #define cpu_present(cpu)       ((cpu) == 0)
 #endif
 
+#define cpu_is_offline(cpu)    unlikely(!cpu_online(cpu))
+
 #ifdef CONFIG_SMP
 extern int nr_cpu_ids;
 #define any_online_cpu(mask) __any_online_cpu(&(mask))
index b8b7c51389fe0ecff2608f63b928140601347a3f..e765e191663dde89ecc150639d2d4eee1096ae88 100644 (file)
@@ -115,6 +115,7 @@ struct io_restrictions {
        unsigned short          max_hw_segments;
        unsigned short          hardsect_size;
        unsigned int            max_segment_size;
+       unsigned int            max_hw_sectors;
        unsigned long           seg_boundary_mask;
        unsigned long           bounce_pfn;
        unsigned char           no_cluster; /* inverted so that 0 is default */
index e8f42133a61676ae438ab0ca5ea860d47b221f81..639624b55fbe34914f7bd7eb7d80d3deab756cb4 100644 (file)
@@ -119,7 +119,7 @@ extern void elv_put_request(struct request_queue *, struct request *);
 /*
  * io scheduler registration
  */
-extern int elv_register(struct elevator_type *);
+extern void elv_register(struct elevator_type *);
 extern void elv_unregister(struct elevator_type *);
 
 /*
index 24968790bc3e3c451f178a1605e9eecb01acf918..30d606afcafe98c9f22cce117082cc3cb2af83ed 100644 (file)
@@ -33,7 +33,7 @@ void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
 
 extern unsigned long max_huge_pages;
 extern unsigned long hugepages_treat_as_movable;
-extern int hugetlb_dynamic_pool;
+extern unsigned long nr_overcommit_huge_pages;
 extern const unsigned long hugetlb_zero, hugetlb_infinity;
 extern int sysctl_hugetlb_shm_group;
 
index 7463833d647fe993235bd318ed427b7b14692de8..c473204a636e9aad45cdec3b19d505bdc31001a5 100644 (file)
 #ifndef LINUX_I2C_ID_H
 #define LINUX_I2C_ID_H
 
+/* Please note that I2C driver IDs are optional. They are only needed if a
+   legacy chip driver needs to identify a bus or a bus driver needs to
+   identify a legacy client. If you don't need them, just don't set them. */
+
 /*
  * ---- Driver types -----------------------------------------------------
  */
index efc88538b2bae91a854e9bf3fbffc4832c77d7e4..4669be08061799641263078c61297293f3643eb7 100644 (file)
@@ -339,6 +339,13 @@ extern void
 __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
                  const char *name);
 
+/* caller has locked the irq_desc and both params are valid */
+static inline void __set_irq_handler_unlocked(int irq,
+                                             irq_flow_handler_t handler)
+{
+       irq_desc[irq].handle_irq = handler;
+}
+
 /*
  * Set a highlevel flow handler for a given IRQ:
  */
index fcdbd5ed227b56ce486b09fb76f3ef1052f364b6..a70b8a8f20058c60a5bc6916deeaceda5040ea6e 100644 (file)
@@ -290,7 +290,7 @@ extern void key_init(void);
 #define key_get(k)                     ({ NULL; })
 #define key_put(k)                     do { } while(0)
 #define key_ref_put(k)                 do { } while(0)
-#define make_key_ref(k)                        ({ NULL; })
+#define make_key_ref(k, p)                     ({ NULL; })
 #define key_ref_to_ptr(k)              ({ NULL; })
 #define is_key_possessed(k)            0
 #define alloc_uid_keyring(u,c)         0
index ef52a07c43d8da63eba34a0dd571dc90c8d3310e..124033cb5e9bf6c6540a83f7b696852912d75913 100644 (file)
@@ -119,6 +119,8 @@ enum {
        ATA_DEF_BUSY_WAIT       = 10000,
        ATA_SHORT_PAUSE         = (HZ >> 6) + 1,
 
+       ATAPI_MAX_DRAIN         = 16 << 10,
+
        ATA_SHT_EMULATED        = 1,
        ATA_SHT_CMD_PER_LUN     = 1,
        ATA_SHT_THIS_ID         = -1,
@@ -211,7 +213,7 @@ enum {
 
        ATA_PFLAG_SUSPENDED     = (1 << 17), /* port is suspended (power) */
        ATA_PFLAG_PM_PENDING    = (1 << 18), /* PM operation pending */
-       ATA_PFLAG_GTM_VALID     = (1 << 19), /* acpi_gtm data valid */
+       ATA_PFLAG_INIT_GTM_VALID = (1 << 19), /* initial gtm data valid */
 
        /* struct ata_queued_cmd flags */
        ATA_QCFLAG_ACTIVE       = (1 << 0), /* cmd not yet ack'd to scsi lyer */
@@ -498,6 +500,7 @@ struct ata_device {
        struct scsi_device      *sdev;          /* attached SCSI device */
 #ifdef CONFIG_ATA_ACPI
        acpi_handle             acpi_handle;
+       union acpi_object       *gtf_cache;
 #endif
        /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
        u64                     n_sectors;      /* size of device, if ATA */
@@ -653,7 +656,7 @@ struct ata_port {
 
 #ifdef CONFIG_ATA_ACPI
        acpi_handle             acpi_handle;
-       struct ata_acpi_gtm     acpi_gtm;
+       struct ata_acpi_gtm     __acpi_init_gtm; /* use ata_acpi_init_gtm() */
 #endif
        u8                      sector_buf[ATA_SECT_SIZE]; /* owned by EH */
 };
@@ -939,10 +942,20 @@ enum {
 
 /* libata-acpi.c */
 #ifdef CONFIG_ATA_ACPI
+static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
+{
+       if (ap->pflags & ATA_PFLAG_INIT_GTM_VALID)
+               return &ap->__acpi_init_gtm;
+       return NULL;
+}
 extern int ata_acpi_cbl_80wire(struct ata_port *ap);
-int ata_acpi_stm(const struct ata_port *ap, struct ata_acpi_gtm *stm);
-int ata_acpi_gtm(const struct ata_port *ap, struct ata_acpi_gtm *stm);
+int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm);
+int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm);
 #else
+static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
+{
+       return NULL;
+}
 static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; }
 #endif
 
@@ -1013,18 +1026,18 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
  * printk helpers
  */
 #define ata_port_printk(ap, lv, fmt, args...) \
-       printk(lv"ata%u: "fmt, (ap)->print_id , ##args)
+       printk("%sata%u: "fmt, lv, (ap)->print_id , ##args)
 
 #define ata_link_printk(link, lv, fmt, args...) do { \
        if ((link)->ap->nr_pmp_links) \
-               printk(lv"ata%u.%02u: "fmt, (link)->ap->print_id, \
+               printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id,   \
                       (link)->pmp , ##args); \
        else \
-               printk(lv"ata%u: "fmt, (link)->ap->print_id , ##args); \
+               printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \
        } while(0)
 
 #define ata_dev_printk(dev, lv, fmt, args...) \
-       printk(lv"ata%u.%02u: "fmt, (dev)->link->ap->print_id, \
+       printk("%sata%u.%02u: "fmt, lv, (dev)->link->ap->print_id,      \
               (dev)->link->pmp + (dev)->devno , ##args)
 
 /*
index 125eee1407ff1c5ee34d2cce2984d0a6fc14c5f0..7ab962fa1d738ffd540e4a260bb6822830b802da 100644 (file)
@@ -118,10 +118,6 @@ struct mmc_host {
        unsigned int            removed:1;      /* host is being removed */
 #endif
 
-       unsigned int            mode;           /* current card mode of host */
-#define MMC_MODE_MMC           0
-#define MMC_MODE_SD            1
-
        struct mmc_card         *card;          /* device attached to this host */
 
        wait_queue_head_t       wq;
index 1e6af4f174b6cd5affaf7baf75597490e6915fce..b0813c3286b1bbfd035415c86cf592f39a52245b 100644 (file)
@@ -319,21 +319,29 @@ struct napi_struct {
 enum
 {
        NAPI_STATE_SCHED,       /* Poll is scheduled */
+       NAPI_STATE_DISABLE,     /* Disable pending */
 };
 
 extern void FASTCALL(__napi_schedule(struct napi_struct *n));
 
+static inline int napi_disable_pending(struct napi_struct *n)
+{
+       return test_bit(NAPI_STATE_DISABLE, &n->state);
+}
+
 /**
  *     napi_schedule_prep - check if napi can be scheduled
  *     @n: napi context
  *
  * Test if NAPI routine is already running, and if not mark
  * it as running.  This is used as a condition variable
- * insure only one NAPI poll instance runs
+ * insure only one NAPI poll instance runs.  We also make
+ * sure there is no pending NAPI disable.
  */
 static inline int napi_schedule_prep(struct napi_struct *n)
 {
-       return !test_and_set_bit(NAPI_STATE_SCHED, &n->state);
+       return !napi_disable_pending(n) &&
+               !test_and_set_bit(NAPI_STATE_SCHED, &n->state);
 }
 
 /**
@@ -389,8 +397,10 @@ static inline void napi_complete(struct napi_struct *n)
  */
 static inline void napi_disable(struct napi_struct *n)
 {
+       set_bit(NAPI_STATE_DISABLE, &n->state);
        while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
                msleep(1);
+       clear_bit(NAPI_STATE_DISABLE, &n->state);
 }
 
 /**
@@ -1268,7 +1278,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
 static inline int netif_rx_schedule_prep(struct net_device *dev,
                                         struct napi_struct *napi)
 {
-       return netif_running(dev) && napi_schedule_prep(napi);
+       return napi_schedule_prep(napi);
 }
 
 /* Add interface to tail of rx poll list. This assumes that _prep has
@@ -1277,7 +1287,6 @@ static inline int netif_rx_schedule_prep(struct net_device *dev,
 static inline void __netif_rx_schedule(struct net_device *dev,
                                       struct napi_struct *napi)
 {
-       dev_hold(dev);
        __napi_schedule(napi);
 }
 
@@ -1308,7 +1317,6 @@ static inline void __netif_rx_complete(struct net_device *dev,
                                       struct napi_struct *napi)
 {
        __napi_complete(napi);
-       dev_put(dev);
 }
 
 /* Remove interface from poll list: it must be in the poll list
index 111aa10f11369deed862766a8cb7b27956099f87..7f2215139e9aa83012ba7236dc2caadee6d0a4cb 100644 (file)
 #define PCI_DEVICE_ID_JMICRON_JMB365   0x2365
 #define PCI_DEVICE_ID_JMICRON_JMB366   0x2366
 #define PCI_DEVICE_ID_JMICRON_JMB368   0x2368
+#define PCI_DEVICE_ID_JMICRON_JMB38X_SD        0x2381
 
 #define PCI_VENDOR_ID_KORENIX          0x1982
 #define PCI_DEVICE_ID_KORENIX_JETCARDF0        0x1600
 #define PCI_DEVICE_ID_INTEL_ICH9_4     0x2914
 #define PCI_DEVICE_ID_INTEL_ICH9_5     0x2919
 #define PCI_DEVICE_ID_INTEL_ICH9_6     0x2930
+#define PCI_DEVICE_ID_INTEL_ICH9_7     0x2916
+#define PCI_DEVICE_ID_INTEL_ICH9_8     0x2918
 #define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
 #define PCI_DEVICE_ID_INTEL_82830_HB   0x3575
 #define PCI_DEVICE_ID_INTEL_82830_CGC  0x3577
index 09a309b7b5d2d4565b48b1eb5f59acd5c13265fe..b78e0295adf4342732b42d8ffd588a48771e2b79 100644 (file)
@@ -246,6 +246,15 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
                device_set_wakeup_enable(dev,val); \
        } while(0)
 
+/*
+ * Global Power Management flags
+ * Used to keep APM and ACPI from both being active
+ */
+extern unsigned int    pm_flags;
+
+#define PM_APM 1
+#define PM_ACPI        2
+
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_PM_H */
index 514729a446888e21dee4289db2ea4e71f80f6eaa..446f4f42b952894b3ffe1c2cb2cf91780e86ee33 100644 (file)
@@ -4,10 +4,6 @@
 
 #ifdef CONFIG_PM_LEGACY
 
-extern int pm_active;
-
-#define PM_IS_ACTIVE() (pm_active != 0)
-
 /*
  * Register a device with power management
  */
@@ -21,8 +17,6 @@ int __deprecated pm_send_all(pm_request_t rqst, void *data);
 
 #else /* CONFIG_PM_LEGACY */
 
-#define PM_IS_ACTIVE() 0
-
 static inline struct pm_dev *pm_register(pm_dev_t type,
                                         unsigned long id,
                                         pm_callback callback)
index 0a0426c2867d7f03bbf257887d588db4ea0be7af..2a6d62c7d2d1a5d8f58baad15d82e9a198eb4993 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/errno.h>
 #include <linux/mod_devicetable.h>
 
-#define PNP_MAX_PORT           24
+#define PNP_MAX_PORT           40
 #define PNP_MAX_MEM            12
 #define PNP_MAX_IRQ            2
 #define PNP_MAX_DMA            2
index ae8146abd7463b694f0690353a13545c840890fd..3ea5750a0f7e2ac74c1c90e1aecd4910b7a74bc7 100644 (file)
@@ -97,6 +97,7 @@ extern void __ptrace_link(struct task_struct *child,
 extern void __ptrace_unlink(struct task_struct *child);
 extern void ptrace_untrace(struct task_struct *child);
 extern int ptrace_may_attach(struct task_struct *task);
+extern int __ptrace_may_attach(struct task_struct *task);
 
 static inline void ptrace_link(struct task_struct *child,
                               struct task_struct *new_parent)
index 9371c6116df3488d995ecc2bfd3ede17f2b232e6..39b66713a0bba015c9a1d94df6c54d9e781d3991 100644 (file)
@@ -56,14 +56,6 @@ static inline void __quicklist_free(int nr, void (*dtor)(void *), void *p,
        struct page *page)
 {
        struct quicklist *q;
-       int nid = page_to_nid(page);
-
-       if (unlikely(nid != numa_node_id())) {
-               if (dtor)
-                       dtor(p);
-               __free_page(page);
-               return;
-       }
 
        q = &get_cpu_var(quicklist)[nr];
        *(void **)p = q->page;
index 416e000dfe81c0febed74c4f8aef8bcd979565db..e3ff21dbac536f11d7f62be1dae027d37466b465 100644 (file)
@@ -191,8 +191,8 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
        /*
         * offset and length are unused for chain entry.  Clear them.
         */
-       prv->offset = 0;
-       prv->length = 0;
+       prv[prv_nents - 1].offset = 0;
+       prv[prv_nents - 1].length = 0;
 
        /*
         * Set lowest bit to indicate a link pointer, and make sure to clear
index ac3d496fbd20266ad6ef88848f967eb8a550047a..cc14656f86829abb4dbb9d5329d5eabeaecbbcb1 100644 (file)
@@ -1255,13 +1255,6 @@ struct pid_namespace;
  *
  * set_task_vxid()   : assigns a virtual id to a task;
  *
- * task_ppid_nr_ns() : the parent's id as seen from the namespace specified.
- *                     the result depends on the namespace and whether the
- *                     task in question is the namespace's init. e.g. for the
- *                     namespace's init this will return 0 when called from
- *                     the namespace of this init, or appropriate id otherwise.
- *
- *
  * see also pid_nr() etc in include/linux/pid.h
  */
 
@@ -1317,12 +1310,6 @@ static inline pid_t task_session_vnr(struct task_struct *tsk)
 }
 
 
-static inline pid_t task_ppid_nr_ns(struct task_struct *tsk,
-               struct pid_namespace *ns)
-{
-       return pid_nr_ns(task_pid(rcu_dereference(tsk->real_parent)), ns);
-}
-
 /**
  * pid_alive - check that a task structure is not stale
  * @p: Task structure to be checked.
index f3a8eecd99f3c4b5eb68d10389e3b96546699f4d..f62caaad94e00876d7877c8cb738c95f5e61021c 100644 (file)
@@ -271,5 +271,10 @@ static inline void *kzalloc(size_t size, gfp_t flags)
        return kmalloc(size, flags | __GFP_ZERO);
 }
 
+#ifdef CONFIG_SLABINFO
+extern const struct seq_operations slabinfo_op;
+ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* _LINUX_SLAB_H */
index 32bdc2ffd7151599c9d6468ee4ad448117f097de..fcc48096ee6406be0200c19ea7d6b1a64609dda5 100644 (file)
@@ -95,7 +95,4 @@ found:
 
 #endif /* CONFIG_NUMA */
 
-extern const struct seq_operations slabinfo_op;
-ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
-
 #endif /* _LINUX_SLAB_DEF_H */
index 78dfbac363759ccfd2c0700a031c189973a3df3d..6dac0d7365cc3704056143be3268471c6c70f1c9 100644 (file)
@@ -2,3 +2,4 @@ header-y += tc_gact.h
 header-y += tc_ipt.h
 header-y += tc_mirred.h
 header-y += tc_pedit.h
+header-y += tc_nat.h
index c555f5442bd7c2c99cad45fb49370bb2280a8629..defd2ab72449d4b9ef91f4def9a9e1cb2635364f 100644 (file)
@@ -319,6 +319,7 @@ extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
 extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud);
 extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud);
 extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
+extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
 
 extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
 extern void tty_ldisc_deref(struct tty_ldisc *);
similarity index 100%
rename from include/net/veth.h
rename to include/linux/veth.h
index 4e3cd93f81fcf0418f1fea085afcc91008d7f992..32a57e1dee3a4f526cc43491b909948b55d0c6d1 100644 (file)
@@ -35,7 +35,7 @@
 #define AX25_P_ATALK                   0xca    /* Appletalk                  */
 #define AX25_P_ATALK_ARP               0xcb    /* Appletalk ARP              */
 #define AX25_P_IP                      0xcc    /* ARPA Internet Protocol     */
-#define AX25_P_ARP                     0xcd    /* ARPA Adress Resolution     */
+#define AX25_P_ARP                     0xcd    /* ARPA Address Resolution    */
 #define AX25_P_FLEXNET                 0xce    /* FlexNet                    */
 #define AX25_P_NETROM                  0xcf    /* NET/ROM                    */
 #define AX25_P_TEXT                    0xF0    /* No layer 3 protocol impl.  */
index 29c9da707c7a6d63f73c677923cf0b6778ddd3c2..c17fa1fdc3567fb23a30c600fc1d053841b3752f 100644 (file)
@@ -23,7 +23,7 @@ struct ip6_tnl {
        struct net_device *dev; /* virtual device associated with tunnel */
        struct net_device_stats stat;   /* statistics for tunnel device */
        int recursion;          /* depth of hard_start_xmit recursion */
-       struct ip6_tnl_parm parms;      /* tunnel configuration paramters */
+       struct ip6_tnl_parm parms;      /* tunnel configuration parameters */
        struct flowi fl;        /* flowi template for xmit */
        struct dst_entry *dst_cache;    /* cached dst */
        u32 dst_cookie;
index eb0f9de472943b3521ff187c9b23e0d061dd5370..e4efad1f9effd473e9eea66f0a3a8c09c90ae9dd 100644 (file)
@@ -80,7 +80,7 @@ typedef struct discovery_t {
        irda_queue_t    q;              /* Must be first! */
 
        discinfo_t      data;           /* Basic discovery information */
-       int             name_len;       /* Lenght of nickname */
+       int             name_len;       /* Length of nickname */
 
        LAP_REASON      condition;      /* More info about the discovery */
        int             gen_addr_bit;   /* Need to generate a new device
index 90fb66d99d0c1a25ead5470b74e2c153cc4b08ec..4ac5ab187c2a0ad0281b4700d8d9420243be01e5 100644 (file)
@@ -249,6 +249,7 @@ static inline int nf_ct_is_untracked(const struct sk_buff *skb)
        return (skb->nfct == &nf_conntrack_untracked.ct_general);
 }
 
+extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
 extern unsigned int nf_conntrack_htable_size;
 extern int nf_conntrack_checksum;
 extern atomic_t nf_conntrack_count;
index c9265518a378ac6ca93ab1a74745d8149d8fcf2b..4c3b35153c3722b2a5871cf78ed11023f7fa9e17 100644 (file)
@@ -325,7 +325,6 @@ static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask)
                n->tc_verd = SET_TC_VERD(n->tc_verd, 0);
                n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd);
                n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
-               n->iif = skb->iif;
        }
        return n;
 }
index 002a00a4e6be0447ac654bdab49a7c5a5f824077..bb965742b64e4bb73610698e6b9f3f15a61d2d17 100644 (file)
@@ -301,7 +301,7 @@ struct sctp_sock {
        /* The default SACK delay timeout for new associations. */
        __u32 sackdelay;
 
-       /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+       /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
        __u32 param_flags;
 
        struct sctp_initmsg initmsg;
@@ -955,7 +955,7 @@ struct sctp_transport {
        /* PMTU       : The current known path MTU.  */
        __u32 pathmtu;
 
-       /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+       /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
        __u32 param_flags;
 
        /* The number of times INIT has been sent on this transport. */
@@ -1638,7 +1638,7 @@ struct sctp_association {
         */
        __u32 pathmtu;
 
-       /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+       /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
        __u32 param_flags;
 
        /* SACK delay timeout */
index 00848b641f59d592d933452ee309ab22ee499047..954090b1e354143bd851a384f9b858a844096634 100644 (file)
@@ -450,7 +450,7 @@ enum sctp_sn_type {
        SCTP_SHUTDOWN_EVENT,
        SCTP_PARTIAL_DELIVERY_EVENT,
        SCTP_ADAPTATION_INDICATION,
-       SCTP_AUTHENTICATION_EVENT,
+       SCTP_AUTHENTICATION_INDICATION,
 };
 
 /* Notification error codes used to fill up the error fields in some
index 67e35c7e230c42a08bb718e6508d3826dbbe6cdd..6e1542da33a1ae26ddc93b80a2071401c6f73c09 100644 (file)
@@ -944,7 +944,7 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
                return err;
        
        rcu_read_lock_bh();
-       filter = sk->sk_filter;
+       filter = rcu_dereference(sk->sk_filter);
        if (filter) {
                unsigned int pkt_len = sk_run_filter(skb, filter->insns,
                                filter->len);
index 58dfa82889aa498be489d11ada7a163f3277f134..1dd20cf17982663b8881f55c76440d7dd096d98d 100644 (file)
@@ -1188,10 +1188,15 @@ static inline int xfrm_aevent_is_on(void)
        return ret;
 }
 
+static inline int xfrm_alg_len(struct xfrm_algo *alg)
+{
+       return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
+}
+
 #ifdef CONFIG_XFRM_MIGRATE
 static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
 {
-       return (struct xfrm_algo *)kmemdup(orig, sizeof(*orig) + orig->alg_key_len, GFP_KERNEL);
+       return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL);
 }
 
 static inline void xfrm_states_put(struct xfrm_state **states, int n)
index 404bbf3699becba6bc43dbe9c945506ad1a93d2c..b9d11a899b8861576be26f883882c969d170701f 100644 (file)
@@ -658,6 +658,12 @@ endchoice
 
 endmenu                # General setup
 
+config SLABINFO
+       bool
+       depends on PROC_FS
+       depends on SLAB || SLUB
+       default y
+
 config RT_MUTEXES
        boolean
        select PLIST
index cf19547cc9e42d346c49b0e51e89aa5fb19364d6..521dfa53cb999657ce8971494f1f573d88d55df7 100644 (file)
@@ -482,7 +482,7 @@ static void do_acct_process(struct file *file)
 #endif
 #if ACCT_VERSION==3
        ac.ac_pid = current->tgid;
-       ac.ac_ppid = current->parent->tgid;
+       ac.ac_ppid = current->real_parent->tgid;
 #endif
 
        spin_lock_irq(&current->sighand->siglock);
index 172a1aeeafdb5a148f6a0063bc3bc719b1974096..db9824de8bf061323b734d88377a6fa606fb9a86 100644 (file)
@@ -1097,15 +1097,15 @@ static void unqueue_me_pi(struct futex_q *q)
 }
 
 /*
- * Fixup the pi_state owner with current.
+ * Fixup the pi_state owner with the new owner.
  *
  * Must be called with hash bucket lock held and mm->sem held for non
  * private futexes.
  */
 static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
-                               struct task_struct *curr)
+                               struct task_struct *newowner)
 {
-       u32 newtid = task_pid_vnr(curr) | FUTEX_WAITERS;
+       u32 newtid = task_pid_vnr(newowner) | FUTEX_WAITERS;
        struct futex_pi_state *pi_state = q->pi_state;
        u32 uval, curval, newval;
        int ret;
@@ -1119,12 +1119,12 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
        } else
                newtid |= FUTEX_OWNER_DIED;
 
-       pi_state->owner = curr;
+       pi_state->owner = newowner;
 
-       spin_lock_irq(&curr->pi_lock);
+       spin_lock_irq(&newowner->pi_lock);
        WARN_ON(!list_empty(&pi_state->list));
-       list_add(&pi_state->list, &curr->pi_state_list);
-       spin_unlock_irq(&curr->pi_lock);
+       list_add(&pi_state->list, &newowner->pi_state_list);
+       spin_unlock_irq(&newowner->pi_lock);
 
        /*
         * We own it, so we have to replace the pending owner
@@ -1508,9 +1508,40 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
                 * when we were on the way back before we locked the
                 * hash bucket.
                 */
-               if (q.pi_state->owner == curr &&
-                   rt_mutex_trylock(&q.pi_state->pi_mutex)) {
-                       ret = 0;
+               if (q.pi_state->owner == curr) {
+                       /*
+                        * Try to get the rt_mutex now. This might
+                        * fail as some other task acquired the
+                        * rt_mutex after we removed ourself from the
+                        * rt_mutex waiters list.
+                        */
+                       if (rt_mutex_trylock(&q.pi_state->pi_mutex))
+                               ret = 0;
+                       else {
+                               /*
+                                * pi_state is incorrect, some other
+                                * task did a lock steal and we
+                                * returned due to timeout or signal
+                                * without taking the rt_mutex. Too
+                                * late. We can access the
+                                * rt_mutex_owner without locking, as
+                                * the other task is now blocked on
+                                * the hash bucket lock. Fix the state
+                                * up.
+                                */
+                               struct task_struct *owner;
+                               int res;
+
+                               owner = rt_mutex_owner(&q.pi_state->pi_mutex);
+                               res = fixup_pi_state_owner(uaddr, &q, owner);
+
+                               WARN_ON(rt_mutex_owner(&q.pi_state->pi_mutex) !=
+                                       owner);
+
+                               /* propagate -EFAULT, if the fixup failed */
+                               if (res)
+                                       ret = res;
+                       }
                } else {
                        /*
                         * Paranoia check. If we did not take the lock
index 9b5dff6b3f6a2bcf3a0ae76625b48edeb4f4334b..44019ce30a14213991a73c61c852073d4d6c8112 100644 (file)
@@ -297,18 +297,13 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
 
        if (unlikely(desc->status & IRQ_INPROGRESS))
                goto out_unlock;
+       desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
        kstat_cpu(cpu).irqs[irq]++;
 
        action = desc->action;
-       if (unlikely(!action || (desc->status & IRQ_DISABLED))) {
-               if (desc->chip->mask)
-                       desc->chip->mask(irq);
-               desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
-               desc->status |= IRQ_PENDING;
+       if (unlikely(!action || (desc->status & IRQ_DISABLED)))
                goto out_unlock;
-       }
 
-       desc->status &= ~(IRQ_REPLAY | IRQ_WAITING | IRQ_PENDING);
        desc->status |= IRQ_INPROGRESS;
        spin_unlock(&desc->lock);
 
index aa74a1ef2da8003768519e4283d2b392be0a4171..9a26eec9eb04b858cfb7d3244071b94f4d4872c9 100644 (file)
@@ -1404,6 +1404,7 @@ static int __init crash_save_vmcoreinfo_init(void)
        VMCOREINFO_OFFSET(list_head, next);
        VMCOREINFO_OFFSET(list_head, prev);
        VMCOREINFO_LENGTH(zone.free_area, MAX_ORDER);
+       VMCOREINFO_LENGTH(free_area.free_list, MIGRATE_TYPES);
        VMCOREINFO_NUMBER(NR_FREE_PAGES);
 
        arch_crash_save_vmcoreinfo();
index 91fe6958b6e1b253f98c2ab08518693df00a1497..c2e3e2e98801df8c45bc91a49975e97a16619053 100644 (file)
@@ -2214,29 +2214,34 @@ static const char *get_ksymbol(struct module *mod,
 /* For kallsyms to ask for address resolution.  NULL means not found.
    We don't lock, as this is used for oops resolution and races are a
    lesser concern. */
+/* FIXME: Risky: returns a pointer into a module w/o lock */
 const char *module_address_lookup(unsigned long addr,
                                  unsigned long *size,
                                  unsigned long *offset,
                                  char **modname)
 {
        struct module *mod;
+       const char *ret = NULL;
 
+       preempt_disable();
        list_for_each_entry(mod, &modules, list) {
                if (within(addr, mod->module_init, mod->init_size)
                    || within(addr, mod->module_core, mod->core_size)) {
                        if (modname)
                                *modname = mod->name;
-                       return get_ksymbol(mod, addr, size, offset);
+                       ret = get_ksymbol(mod, addr, size, offset);
+                       break;
                }
        }
-       return NULL;
+       preempt_enable();
+       return ret;
 }
 
 int lookup_module_symbol_name(unsigned long addr, char *symname)
 {
        struct module *mod;
 
-       mutex_lock(&module_mutex);
+       preempt_disable();
        list_for_each_entry(mod, &modules, list) {
                if (within(addr, mod->module_init, mod->init_size) ||
                    within(addr, mod->module_core, mod->core_size)) {
@@ -2246,12 +2251,12 @@ int lookup_module_symbol_name(unsigned long addr, char *symname)
                        if (!sym)
                                goto out;
                        strlcpy(symname, sym, KSYM_NAME_LEN);
-                       mutex_unlock(&module_mutex);
+                       preempt_enable();
                        return 0;
                }
        }
 out:
-       mutex_unlock(&module_mutex);
+       preempt_enable();
        return -ERANGE;
 }
 
@@ -2260,7 +2265,7 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,
 {
        struct module *mod;
 
-       mutex_lock(&module_mutex);
+       preempt_disable();
        list_for_each_entry(mod, &modules, list) {
                if (within(addr, mod->module_init, mod->init_size) ||
                    within(addr, mod->module_core, mod->core_size)) {
@@ -2273,12 +2278,12 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,
                                strlcpy(modname, mod->name, MODULE_NAME_LEN);
                        if (name)
                                strlcpy(name, sym, KSYM_NAME_LEN);
-                       mutex_unlock(&module_mutex);
+                       preempt_enable();
                        return 0;
                }
        }
 out:
-       mutex_unlock(&module_mutex);
+       preempt_enable();
        return -ERANGE;
 }
 
@@ -2287,7 +2292,7 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
 {
        struct module *mod;
 
-       mutex_lock(&module_mutex);
+       preempt_disable();
        list_for_each_entry(mod, &modules, list) {
                if (symnum < mod->num_symtab) {
                        *value = mod->symtab[symnum].st_value;
@@ -2296,12 +2301,12 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
                                KSYM_NAME_LEN);
                        strlcpy(module_name, mod->name, MODULE_NAME_LEN);
                        *exported = is_exported(name, mod);
-                       mutex_unlock(&module_mutex);
+                       preempt_enable();
                        return 0;
                }
                symnum -= mod->num_symtab;
        }
-       mutex_unlock(&module_mutex);
+       preempt_enable();
        return -ERANGE;
 }
 
@@ -2324,6 +2329,7 @@ unsigned long module_kallsyms_lookup_name(const char *name)
        unsigned long ret = 0;
 
        /* Don't lock: we're in enough trouble already. */
+       preempt_disable();
        if ((colon = strchr(name, ':')) != NULL) {
                *colon = '\0';
                if ((mod = find_module(name)) != NULL)
@@ -2334,6 +2340,7 @@ unsigned long module_kallsyms_lookup_name(const char *name)
                        if ((ret = mod_find_symname(mod, name)) != 0)
                                break;
        }
+       preempt_enable();
        return ret;
 }
 #endif /* CONFIG_KALLSYMS */
index 6f6e03e91595f7f1959a282c5a35697efb02c79d..da4d6bac270e90dcdc0dfc6052dbb49f935cc981 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/nmi.h>
 #include <linux/kexec.h>
 #include <linux/debug_locks.h>
+#include <linux/random.h>
 
 int panic_on_oops;
 int tainted;
@@ -265,6 +266,20 @@ void oops_enter(void)
        do_oops_enter_exit();
 }
 
+/*
+ * 64-bit random ID for oopses:
+ */
+static u64 oops_id;
+
+static int init_oops_id(void)
+{
+       if (!oops_id)
+               get_random_bytes(&oops_id, sizeof(oops_id));
+
+       return 0;
+}
+late_initcall(init_oops_id);
+
 /*
  * Called when the architecture exits its oops handler, after printing
  * everything.
@@ -272,6 +287,9 @@ void oops_enter(void)
 void oops_exit(void)
 {
        do_oops_enter_exit();
+       init_oops_id();
+       printk(KERN_WARNING "---[ end trace %016llx ]---\n",
+               (unsigned long long)oops_id);
 }
 
 #ifdef CONFIG_CC_STACKPROTECTOR
index 2a4c51487e7257e1865ae33d805a22e3dbb7f9ae..7686417ee00eba070b7d9b5c9dd293f9991199f1 100644 (file)
@@ -697,8 +697,18 @@ static struct kset_uevent_ops module_uevent_ops = {
 decl_subsys(module, &module_ktype, &module_uevent_ops);
 int module_sysfs_initialized;
 
+static void module_release(struct kobject *kobj)
+{
+       /*
+        * Stupid empty release function to allow the memory for the kobject to
+        * be properly cleaned up.  This will not need to be present for 2.6.25
+        * with the upcoming kobject core rework.
+        */
+}
+
 static struct kobj_type module_ktype = {
        .sysfs_ops =    &module_sysfs_ops,
+       .release =      module_release,
 };
 
 /*
index 3cdf95b1dc92af97e13e8a6c68c4e0a6f8d42153..f71c9504a5c5edd9a91b617ba9595e9c40e1ff1d 100644 (file)
@@ -28,6 +28,9 @@ BLOCKING_NOTIFIER_HEAD(pm_chain_head);
 
 DEFINE_MUTEX(pm_mutex);
 
+unsigned int pm_flags;
+EXPORT_SYMBOL(pm_flags);
+
 #ifdef CONFIG_SUSPEND
 
 /* This is just an arbitrary number */
index c50d15266c1096d42d61e296ea4da13d34cb57ec..60c73fa670d5a65b38f454c941201a22b7d4bf35 100644 (file)
@@ -27,8 +27,6 @@
 #include <linux/interrupt.h>
 #include <linux/mutex.h>
 
-int pm_active;
-
 /*
  *     Locking notes:
  *             pm_devs_lock can be a semaphore providing pm ops are not called
@@ -204,6 +202,4 @@ int pm_send_all(pm_request_t rqst, void *data)
 
 EXPORT_SYMBOL(pm_register);
 EXPORT_SYMBOL(pm_send_all);
-EXPORT_SYMBOL(pm_active);
-
 
index 9c1fe0b3efff93646231a6904b9751fb6a955f51..f9904482d63d9990555e0750142606fc6f9a21a4 100644 (file)
@@ -839,7 +839,7 @@ __setup("console=", console_setup);
  * commonly to provide a default console (ie from PROM variables) when
  * the user has not supplied one.
  */
-int __init add_preferred_console(char *name, int idx, char *options)
+int add_preferred_console(char *name, int idx, char *options)
 {
        struct console_cmdline *c;
        int i;
index 7c76f2ffaeaad78060cfb3223857a89c7a4ccb8f..c25db863081dac8d999b849e4b34d05dac96840e 100644 (file)
@@ -120,7 +120,7 @@ int ptrace_check_attach(struct task_struct *child, int kill)
        return ret;
 }
 
-static int may_attach(struct task_struct *task)
+int __ptrace_may_attach(struct task_struct *task)
 {
        /* May we inspect the given task?
         * This check is used both for attaching with ptrace
@@ -154,7 +154,7 @@ int ptrace_may_attach(struct task_struct *task)
 {
        int err;
        task_lock(task);
-       err = may_attach(task);
+       err = __ptrace_may_attach(task);
        task_unlock(task);
        return !err;
 }
@@ -196,7 +196,7 @@ repeat:
        /* the same process cannot be attached many times */
        if (task->ptrace & PT_PTRACED)
                goto bad;
-       retval = may_attach(task);
+       retval = __ptrace_may_attach(task);
        if (retval)
                goto bad;
 
index 1ec620c03064d109a5f1de5f925f00ae07cd946a..cae050b05f5ef91b22547dc88e6b6abc39877018 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <linux/module.h>
 #include <linux/rwsem.h>
 
@@ -15,7 +16,7 @@
 /*
  * lock for reading
  */
-void down_read(struct rw_semaphore *sem)
+void __sched down_read(struct rw_semaphore *sem)
 {
        might_sleep();
        rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_);
@@ -42,7 +43,7 @@ EXPORT_SYMBOL(down_read_trylock);
 /*
  * lock for writing
  */
-void down_write(struct rw_semaphore *sem)
+void __sched down_write(struct rw_semaphore *sem)
 {
        might_sleep();
        rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_);
index c6e551de795be75247f25634d5d27a70740f1948..37cf07aa41647741e1581f8120b4cb2a291c5545 100644 (file)
@@ -508,10 +508,15 @@ EXPORT_SYMBOL_GPL(cpu_clock);
 # define finish_arch_switch(prev)      do { } while (0)
 #endif
 
+static inline int task_current(struct rq *rq, struct task_struct *p)
+{
+       return rq->curr == p;
+}
+
 #ifndef __ARCH_WANT_UNLOCKED_CTXSW
 static inline int task_running(struct rq *rq, struct task_struct *p)
 {
-       return rq->curr == p;
+       return task_current(rq, p);
 }
 
 static inline void prepare_lock_switch(struct rq *rq, struct task_struct *next)
@@ -540,7 +545,7 @@ static inline int task_running(struct rq *rq, struct task_struct *p)
 #ifdef CONFIG_SMP
        return p->oncpu;
 #else
-       return rq->curr == p;
+       return task_current(rq, p);
 #endif
 }
 
@@ -663,6 +668,7 @@ void sched_clock_idle_wakeup_event(u64 delta_ns)
        struct rq *rq = cpu_rq(smp_processor_id());
        u64 now = sched_clock();
 
+       touch_softlockup_watchdog();
        rq->idle_clock += delta_ns;
        /*
         * Override the previous timestamp and ignore all
@@ -3334,7 +3340,7 @@ unsigned long long task_sched_runtime(struct task_struct *p)
 
        rq = task_rq_lock(p, &flags);
        ns = p->se.sum_exec_runtime;
-       if (rq->curr == p) {
+       if (task_current(rq, p)) {
                update_rq_clock(rq);
                delta_exec = rq->clock - p->se.exec_start;
                if ((s64)delta_exec > 0)
@@ -4021,7 +4027,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
 
        oldprio = p->prio;
        on_rq = p->se.on_rq;
-       running = task_running(rq, p);
+       running = task_current(rq, p);
        if (on_rq) {
                dequeue_task(rq, p, 0);
                if (running)
@@ -4332,7 +4338,7 @@ recheck:
        }
        update_rq_clock(rq);
        on_rq = p->se.on_rq;
-       running = task_running(rq, p);
+       running = task_current(rq, p);
        if (on_rq) {
                deactivate_task(rq, p, 0);
                if (running)
@@ -4912,7 +4918,7 @@ static void show_task(struct task_struct *p)
        }
 #endif
        printk(KERN_CONT "%5lu %5d %6d\n", free,
-               task_pid_nr(p), task_pid_nr(p->parent));
+               task_pid_nr(p), task_pid_nr(p->real_parent));
 
        if (state != TASK_RUNNING)
                show_stack(p, NULL);
@@ -7101,7 +7107,7 @@ void sched_move_task(struct task_struct *tsk)
 
        update_rq_clock(rq);
 
-       running = task_running(rq, tsk);
+       running = task_current(rq, tsk);
        on_rq = tsk->se.on_rq;
 
        if (on_rq) {
index d30467b47ddd0cd681f6da0afbe9c96c8b52df93..80fbbfc042909fb73ab5d1c8d96f3e114baf142f 100644 (file)
@@ -31,9 +31,9 @@
 /*
  * Ease the printing of nsec fields:
  */
-static long long nsec_high(long long nsec)
+static long long nsec_high(unsigned long long nsec)
 {
-       if (nsec < 0) {
+       if ((long long)nsec < 0) {
                nsec = -nsec;
                do_div(nsec, 1000000);
                return -nsec;
@@ -43,9 +43,9 @@ static long long nsec_high(long long nsec)
        return nsec;
 }
 
-static unsigned long nsec_low(long long nsec)
+static unsigned long nsec_low(unsigned long long nsec)
 {
-       if (nsec < 0)
+       if ((long long)nsec < 0)
                nsec = -nsec;
 
        return do_div(nsec, 1000000);
index c33f0ceb3de9a64dc43538f7d9427c89a4b98eeb..da7c061e72062eacd6afee8a9870e9044ad0e2c5 100644 (file)
@@ -511,8 +511,7 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
 
        if (!initial) {
                /* sleeps upto a single latency don't count. */
-               if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se) &&
-                               task_of(se)->policy != SCHED_BATCH)
+               if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se))
                        vruntime -= sysctl_sched_latency;
 
                /* ensure we never gain time by being placed backwards. */
index ee9c8b6529e9bad0c0b09708713c861e13363675..9ba3daa03475cfeed642eeaacbd21f5b3aa118eb 100644 (file)
@@ -208,6 +208,8 @@ move_one_task_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
 
 static void task_tick_rt(struct rq *rq, struct task_struct *p)
 {
+       update_curr_rt(rq);
+
        /*
         * RR tasks need a special form of timeslice management.
         * FIFO tasks have no timeslices.
index 8ac51714b08ca7ec4261b8544fc62524dad8a3e4..c68f68dcc605052c9bcc81d1719b343acb482e5b 100644 (file)
@@ -225,10 +225,10 @@ static struct ctl_table root_table[] = {
 };
 
 #ifdef CONFIG_SCHED_DEBUG
-static unsigned long min_sched_granularity_ns = 100000;                /* 100 usecs */
-static unsigned long max_sched_granularity_ns = NSEC_PER_SEC;  /* 1 second */
-static unsigned long min_wakeup_granularity_ns;                        /* 0 usecs */
-static unsigned long max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
+static int min_sched_granularity_ns = 100000;          /* 100 usecs */
+static int max_sched_granularity_ns = NSEC_PER_SEC;    /* 1 second */
+static int min_wakeup_granularity_ns;                  /* 0 usecs */
+static int max_wakeup_granularity_ns = NSEC_PER_SEC;   /* 1 second */
 #endif
 
 static struct ctl_table kern_table[] = {
@@ -906,11 +906,11 @@ static struct ctl_table vm_table[] = {
        },
        {
                .ctl_name       = CTL_UNNUMBERED,
-               .procname       = "hugetlb_dynamic_pool",
-               .data           = &hugetlb_dynamic_pool,
-               .maxlen         = sizeof(hugetlb_dynamic_pool),
+               .procname       = "nr_overcommit_hugepages",
+               .data           = &nr_overcommit_huge_pages,
+               .maxlen         = sizeof(nr_overcommit_huge_pages),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
+               .proc_handler   = &proc_doulongvec_minmax,
        },
 #endif
        {
index bed939f82c31577aadb15ef84714f0869942d34f..a68425a5cc1d7f114fb26c9d515758ff56bcbeb5 100644 (file)
@@ -428,7 +428,7 @@ static struct trans_ctl_table trans_net_netrom_table[] = {
        {}
 };
 
-static struct trans_ctl_table trans_net_ax25_table[] = {
+static struct trans_ctl_table trans_net_ax25_param_table[] = {
        { NET_AX25_IP_DEFAULT_MODE,     "ip_default_mode" },
        { NET_AX25_DEFAULT_MODE,        "ax25_default_mode" },
        { NET_AX25_BACKOFF_TYPE,        "backoff_type" },
@@ -446,6 +446,11 @@ static struct trans_ctl_table trans_net_ax25_table[] = {
        {}
 };
 
+static struct trans_ctl_table trans_net_ax25_table[] = {
+       { 0, NULL, trans_net_ax25_param_table },
+       {}
+};
+
 static struct trans_ctl_table trans_net_bridge_table[] = {
        { NET_BRIDGE_NF_CALL_ARPTABLES,         "bridge-nf-call-arptables" },
        { NET_BRIDGE_NF_CALL_IPTABLES,          "bridge-nf-call-iptables" },
index aa82d7bf478a7adc8eb34700b3a5b540e672b28d..5b86698faa0b08cc1411331c71aaf0ce466ee106 100644 (file)
@@ -383,33 +383,6 @@ int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
        return 0;
 }
 
-/*
- * Reprogram the broadcast device:
- *
- * Called with tick_broadcast_lock held and interrupts disabled.
- */
-static int tick_broadcast_reprogram(void)
-{
-       ktime_t expires = { .tv64 = KTIME_MAX };
-       struct tick_device *td;
-       int cpu;
-
-       /*
-        * Find the event which expires next:
-        */
-       for (cpu = first_cpu(tick_broadcast_oneshot_mask); cpu != NR_CPUS;
-            cpu = next_cpu(cpu, tick_broadcast_oneshot_mask)) {
-               td = &per_cpu(tick_cpu_device, cpu);
-               if (td->evtdev->next_event.tv64 < expires.tv64)
-                       expires = td->evtdev->next_event;
-       }
-
-       if (expires.tv64 == KTIME_MAX)
-               return 0;
-
-       return tick_broadcast_set_event(expires, 0);
-}
-
 /*
  * Handle oneshot mode broadcasting
  */
@@ -417,12 +390,13 @@ static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
 {
        struct tick_device *td;
        cpumask_t mask;
-       ktime_t now;
+       ktime_t now, next_event;
        int cpu;
 
        spin_lock(&tick_broadcast_lock);
 again:
        dev->next_event.tv64 = KTIME_MAX;
+       next_event.tv64 = KTIME_MAX;
        mask = CPU_MASK_NONE;
        now = ktime_get();
        /* Find all expired events */
@@ -431,19 +405,31 @@ again:
                td = &per_cpu(tick_cpu_device, cpu);
                if (td->evtdev->next_event.tv64 <= now.tv64)
                        cpu_set(cpu, mask);
+               else if (td->evtdev->next_event.tv64 < next_event.tv64)
+                       next_event.tv64 = td->evtdev->next_event.tv64;
        }
 
        /*
-        * Wakeup the cpus which have an expired event. The broadcast
-        * device is reprogrammed in the return from idle code.
+        * Wakeup the cpus which have an expired event.
+        */
+       tick_do_broadcast(mask);
+
+       /*
+        * Two reasons for reprogram:
+        *
+        * - The global event did not expire any CPU local
+        * events. This happens in dyntick mode, as the maximum PIT
+        * delta is quite small.
+        *
+        * - There are pending events on sleeping CPUs which were not
+        * in the event mask
         */
-       if (!tick_do_broadcast(mask)) {
+       if (next_event.tv64 != KTIME_MAX) {
                /*
-                * The global event did not expire any CPU local
-                * events. This happens in dyntick mode, as the
-                * maximum PIT delta is quite small.
+                * Rearm the broadcast device. If event expired,
+                * repeat the above
                 */
-               if (tick_broadcast_reprogram())
+               if (tick_broadcast_set_event(next_event, 0))
                        goto again;
        }
        spin_unlock(&tick_broadcast_lock);
index a05817c021d62c1f93819ee666f2fc5bdb735f6a..26671f4db07f58aef440dbdf8e963e7bb17d8f5c 100644 (file)
@@ -978,7 +978,7 @@ asmlinkage long sys_getppid(void)
        int pid;
 
        rcu_read_lock();
-       pid = task_ppid_nr_ns(current, current->nsproxy->pid_ns);
+       pid = task_tgid_nr_ns(current->real_parent, current->nsproxy->pid_ns);
        rcu_read_unlock();
 
        return pid;
@@ -1219,11 +1219,11 @@ asmlinkage long sys_sysinfo(struct sysinfo __user *info)
  */
 static struct lock_class_key base_lock_keys[NR_CPUS];
 
-static int __devinit init_timers_cpu(int cpu)
+static int __cpuinit init_timers_cpu(int cpu)
 {
        int j;
        tvec_base_t *base;
-       static char __devinitdata tvec_base_done[NR_CPUS];
+       static char __cpuinitdata tvec_base_done[NR_CPUS];
 
        if (!tvec_base_done[cpu]) {
                static char boot_done;
index 332d8c58184d4964406dfe71179b877fd9f927f6..9508d9a7af3ef9ba482925a9d1cdc34ef2fddd0e 100644 (file)
@@ -190,6 +190,8 @@ prop_adjust_shift(int *pl_shift, unsigned long *pl_period, int new_shift)
  * PERCPU
  */
 
+#define PROP_BATCH (8*(1+ilog2(nr_cpu_ids)))
+
 int prop_local_init_percpu(struct prop_local_percpu *pl)
 {
        spin_lock_init(&pl->lock);
@@ -230,31 +232,24 @@ void prop_norm_percpu(struct prop_global *pg, struct prop_local_percpu *pl)
 
        spin_lock_irqsave(&pl->lock, flags);
        prop_adjust_shift(&pl->shift, &pl->period, pg->shift);
+
        /*
         * For each missed period, we half the local counter.
         * basically:
         *   pl->events >> (global_period - pl->period);
-        *
-        * but since the distributed nature of percpu counters make division
-        * rather hard, use a regular subtraction loop. This is safe, because
-        * the events will only every be incremented, hence the subtraction
-        * can never result in a negative number.
         */
-       while (pl->period != global_period) {
-               unsigned long val = percpu_counter_read(&pl->events);
-               unsigned long half = (val + 1) >> 1;
-
-               /*
-                * Half of zero won't be much less, break out.
-                * This limits the loop to shift iterations, even
-                * if we missed a million.
-                */
-               if (!val)
-                       break;
-
-               percpu_counter_add(&pl->events, -half);
-               pl->period += period;
-       }
+       period = (global_period - pl->period) >> (pg->shift - 1);
+       if (period < BITS_PER_LONG) {
+               s64 val = percpu_counter_read(&pl->events);
+
+               if (val < (nr_cpu_ids * PROP_BATCH))
+                       val = percpu_counter_sum(&pl->events);
+
+               __percpu_counter_add(&pl->events, -val + (val >> period),
+                                       PROP_BATCH);
+       } else
+               percpu_counter_set(&pl->events, 0);
+
        pl->period = global_period;
        spin_unlock_irqrestore(&pl->lock, flags);
 }
@@ -267,7 +262,7 @@ void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl)
        struct prop_global *pg = prop_get_global(pd);
 
        prop_norm_percpu(pg, pl);
-       percpu_counter_add(&pl->events, 1);
+       __percpu_counter_add(&pl->events, 1, PROP_BATCH);
        percpu_counter_add(&pg->events, 1);
        prop_put_global(pd, pg);
 }
index cdb4e3d0560733c2706a27ccd20681017da2e34a..7d02700a4b0e131ae0dfba2e6da6ecf75b6a8d2c 100644 (file)
@@ -146,7 +146,7 @@ __rwsem_do_wake(struct rw_semaphore *sem, int downgrading)
 /*
  * wait for a lock to be granted
  */
-static struct rw_semaphore *
+static struct rw_semaphore __sched *
 rwsem_down_failed_common(struct rw_semaphore *sem,
                        struct rwsem_waiter *waiter, signed long adjustment)
 {
index c070ec0c15bfeee19c59659a668f7ab920ee77b3..9ef97417a0b92d1b163c55efe6ced4b2e4ce4c73 100644 (file)
@@ -112,18 +112,17 @@ config SPARSEMEM_EXTREME
        def_bool y
        depends on SPARSEMEM && !SPARSEMEM_STATIC
 
-#
-# SPARSEMEM_VMEMMAP uses a virtually mapped mem_map to optimise pfn_to_page
-# and page_to_pfn.  The most efficient option where kernel virtual space is
-# not under pressure.
-#
 config SPARSEMEM_VMEMMAP_ENABLE
        def_bool n
 
 config SPARSEMEM_VMEMMAP
-       bool
-       depends on SPARSEMEM
-       default y if (SPARSEMEM_VMEMMAP_ENABLE)
+       bool "Sparse Memory virtual memmap"
+       depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
+       default y
+       help
+        SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
+        pfn_to_page and page_to_pfn operations.  This is the most
+        efficient option when sufficient kernel resources are available.
 
 # eventually, we can have this option just 'select SPARSEMEM'
 config MEMORY_HOTPLUG
index 188cf5fd3e8d4acedec4e74c05375238526506e5..f4d0cded0e10aa21b02707fcaf99c4cbcafa4f06 100644 (file)
@@ -124,6 +124,18 @@ void __remove_from_page_cache(struct page *page)
        mapping->nrpages--;
        __dec_zone_page_state(page, NR_FILE_PAGES);
        BUG_ON(page_mapped(page));
+
+       /*
+        * Some filesystems seem to re-dirty the page even after
+        * the VM has canceled the dirty bit (eg ext3 journaling).
+        *
+        * Fix it up by doing a final dirty accounting check after
+        * having removed the page entirely.
+        */
+       if (PageDirty(page) && mapping_cap_account_dirty(mapping)) {
+               dec_zone_page_state(page, NR_FILE_DIRTY);
+               dec_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
+       }
 }
 
 void remove_from_page_cache(struct page *page)
index e233fff61b4bd036382a26811849653ebfd4b9e5..f874ae818ad3812f7cd051972c823c743a154d33 100644 (file)
@@ -25,14 +25,15 @@ static struct page *__xip_sparse_page;
 static struct page *xip_sparse_page(void)
 {
        if (!__xip_sparse_page) {
-               unsigned long zeroes = get_zeroed_page(GFP_HIGHUSER);
-               if (zeroes) {
+               struct page *page = alloc_page(GFP_HIGHUSER | __GFP_ZERO);
+
+               if (page) {
                        static DEFINE_SPINLOCK(xip_alloc_lock);
                        spin_lock(&xip_alloc_lock);
                        if (!__xip_sparse_page)
-                               __xip_sparse_page = virt_to_page(zeroes);
+                               __xip_sparse_page = page;
                        else
-                               free_page(zeroes);
+                               __free_page(page);
                        spin_unlock(&xip_alloc_lock);
                }
        }
index 6f978218c2c808b7dad3e0c184cc44ec35f2585d..e0fda156f0212a1a44c0d27f13dc8ffd1cda1064 100644 (file)
@@ -31,7 +31,7 @@ static unsigned int free_huge_pages_node[MAX_NUMNODES];
 static unsigned int surplus_huge_pages_node[MAX_NUMNODES];
 static gfp_t htlb_alloc_mask = GFP_HIGHUSER;
 unsigned long hugepages_treat_as_movable;
-int hugetlb_dynamic_pool;
+unsigned long nr_overcommit_huge_pages;
 static int hugetlb_next_nid;
 
 /*
@@ -227,22 +227,58 @@ static struct page *alloc_buddy_huge_page(struct vm_area_struct *vma,
                                                unsigned long address)
 {
        struct page *page;
+       unsigned int nid;
 
-       /* Check if the dynamic pool is enabled */
-       if (!hugetlb_dynamic_pool)
+       /*
+        * Assume we will successfully allocate the surplus page to
+        * prevent racing processes from causing the surplus to exceed
+        * overcommit
+        *
+        * This however introduces a different race, where a process B
+        * tries to grow the static hugepage pool while alloc_pages() is
+        * called by process A. B will only examine the per-node
+        * counters in determining if surplus huge pages can be
+        * converted to normal huge pages in adjust_pool_surplus(). A
+        * won't be able to increment the per-node counter, until the
+        * lock is dropped by B, but B doesn't drop hugetlb_lock until
+        * no more huge pages can be converted from surplus to normal
+        * state (and doesn't try to convert again). Thus, we have a
+        * case where a surplus huge page exists, the pool is grown, and
+        * the surplus huge page still exists after, even though it
+        * should just have been converted to a normal huge page. This
+        * does not leak memory, though, as the hugepage will be freed
+        * once it is out of use. It also does not allow the counters to
+        * go out of whack in adjust_pool_surplus() as we don't modify
+        * the node values until we've gotten the hugepage and only the
+        * per-node value is checked there.
+        */
+       spin_lock(&hugetlb_lock);
+       if (surplus_huge_pages >= nr_overcommit_huge_pages) {
+               spin_unlock(&hugetlb_lock);
                return NULL;
+       } else {
+               nr_huge_pages++;
+               surplus_huge_pages++;
+       }
+       spin_unlock(&hugetlb_lock);
 
        page = alloc_pages(htlb_alloc_mask|__GFP_COMP|__GFP_NOWARN,
                                        HUGETLB_PAGE_ORDER);
+
+       spin_lock(&hugetlb_lock);
        if (page) {
+               nid = page_to_nid(page);
                set_compound_page_dtor(page, free_huge_page);
-               spin_lock(&hugetlb_lock);
-               nr_huge_pages++;
-               nr_huge_pages_node[page_to_nid(page)]++;
-               surplus_huge_pages++;
-               surplus_huge_pages_node[page_to_nid(page)]++;
-               spin_unlock(&hugetlb_lock);
+               /*
+                * We incremented the global counters already
+                */
+               nr_huge_pages_node[nid]++;
+               surplus_huge_pages_node[nid]++;
+       } else {
+               nr_huge_pages--;
+               surplus_huge_pages--;
        }
+       spin_unlock(&hugetlb_lock);
 
        return page;
 }
@@ -382,9 +418,14 @@ static struct page *alloc_huge_page_private(struct vm_area_struct *vma,
        if (free_huge_pages > resv_huge_pages)
                page = dequeue_huge_page(vma, addr);
        spin_unlock(&hugetlb_lock);
-       if (!page)
+       if (!page) {
                page = alloc_buddy_huge_page(vma, addr);
-       return page ? page : ERR_PTR(-VM_FAULT_OOM);
+               if (!page) {
+                       hugetlb_put_quota(vma->vm_file->f_mapping, 1);
+                       return ERR_PTR(-VM_FAULT_OOM);
+               }
+       }
+       return page;
 }
 
 static struct page *alloc_huge_page(struct vm_area_struct *vma,
@@ -481,6 +522,12 @@ static unsigned long set_max_huge_pages(unsigned long count)
         * Increase the pool size
         * First take pages out of surplus state.  Then make up the
         * remaining difference by allocating fresh huge pages.
+        *
+        * We might race with alloc_buddy_huge_page() here and be unable
+        * to convert a surplus huge page to a normal huge page. That is
+        * not critical, though, it just means the overall size of the
+        * pool might be one hugepage larger than it needs to be, but
+        * within all the constraints specified by the sysctls.
         */
        spin_lock(&hugetlb_lock);
        while (surplus_huge_pages && count > persistent_huge_pages) {
@@ -509,6 +556,14 @@ static unsigned long set_max_huge_pages(unsigned long count)
         * to keep enough around to satisfy reservations).  Then place
         * pages into surplus state as needed so the pool will shrink
         * to the desired size as pages become free.
+        *
+        * By placing pages into the surplus state independent of the
+        * overcommit value, we are allowing the surplus pool size to
+        * exceed overcommit. There are few sane options here. Since
+        * alloc_buddy_huge_page() is checking the global counter,
+        * though, we'll note that we're not allowed to exceed surplus
+        * and won't grow the pool anywhere else. Not until one of the
+        * sysctls are changed, or the surplus pages go out of use.
         */
        min_count = resv_huge_pages + nr_huge_pages - free_huge_pages;
        min_count = max(count, min_count);
@@ -1156,8 +1211,10 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to)
        if (hugetlb_get_quota(inode->i_mapping, chg))
                return -ENOSPC;
        ret = hugetlb_acct_memory(chg);
-       if (ret < 0)
+       if (ret < 0) {
+               hugetlb_put_quota(inode->i_mapping, chg);
                return ret;
+       }
        region_add(&inode->i_mapping->private_list, from, to);
        return 0;
 }
index b5a58d476c1a66a7cc6ce94adaedfc9e2aff0a06..e1028fae3ebbd2644628316cc08f94fa55ae0dad 100644 (file)
@@ -847,8 +847,19 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
                struct page *page = __rmqueue(zone, order, migratetype);
                if (unlikely(page == NULL))
                        break;
+
+               /*
+                * Split buddy pages returned by expand() are received here
+                * in physical page order. The page is added to the callers and
+                * list and the list head then moves forward. From the callers
+                * perspective, the linked list is ordered by page number in
+                * some conditions. This is useful for IO devices that can
+                * merge IO requests if the physical pages are ordered
+                * properly.
+                */
                list_add(&page->lru, list);
                set_page_private(page, migratetype);
+               list = &page->lru;
        }
        spin_unlock(&zone->lock);
        return i;
@@ -3427,7 +3438,7 @@ static void __init_refok alloc_node_mem_map(struct pglist_data *pgdat)
                mem_map = NODE_DATA(0)->node_mem_map;
 #ifdef CONFIG_ARCH_POPULATES_NODE_MAP
                if (page_to_pfn(mem_map) != pgdat->node_start_pfn)
-                       mem_map -= pgdat->node_start_pfn;
+                       mem_map -= (pgdat->node_start_pfn - ARCH_PFN_OFFSET);
 #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
        }
 #endif
index ae8189c2799e99d936c01b76330b607593980a73..3f703f7cb398056547af212577909a3d6c46b116 100644 (file)
@@ -26,9 +26,17 @@ DEFINE_PER_CPU(struct quicklist, quicklist)[CONFIG_NR_QUICK];
 static unsigned long max_pages(unsigned long min_pages)
 {
        unsigned long node_free_pages, max;
+       struct zone *zones = NODE_DATA(numa_node_id())->node_zones;
+
+       node_free_pages =
+#ifdef CONFIG_ZONE_DMA
+               zone_page_state(&zones[ZONE_DMA], NR_FREE_PAGES) +
+#endif
+#ifdef CONFIG_ZONE_DMA32
+               zone_page_state(&zones[ZONE_DMA32], NR_FREE_PAGES) +
+#endif
+               zone_page_state(&zones[ZONE_NORMAL], NR_FREE_PAGES);
 
-       node_free_pages = node_page_state(numa_node_id(),
-                       NR_FREE_PAGES);
        max = node_free_pages / FRACTION_OF_NODE_MEM;
        return max(max, min_pages);
 }
index 2e338a5f7b14c6d29216f4c54a74ef5259be01fa..aebb9f68557a514d0b962f268937bcf037249211 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4105,7 +4105,7 @@ out:
        schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_CPUC));
 }
 
-#ifdef CONFIG_PROC_FS
+#ifdef CONFIG_SLABINFO
 
 static void print_slabinfo_header(struct seq_file *m)
 {
index 9c1d9f3b364f63d7a6be5cdc5f98f2b18f8f797a..474945ecd89d828478fd8048558c2a8d980604b3 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -172,7 +172,7 @@ static inline void ClearSlabDebug(struct page *page)
  * Mininum number of partial slabs. These will be left on the partial
  * lists even if they are empty. kmem_cache_shrink may reclaim them.
  */
-#define MIN_PARTIAL 2
+#define MIN_PARTIAL 5
 
 /*
  * Maximum number of desirable partial slabs.
@@ -1468,9 +1468,6 @@ static void *__slab_alloc(struct kmem_cache *s,
        void **object;
        struct page *new;
 
-       /* We handle __GFP_ZERO in the caller */
-       gfpflags &= ~__GFP_ZERO;
-
        if (!c->page)
                goto new_slab;
 
@@ -1616,7 +1613,7 @@ checks_ok:
         * then add it.
         */
        if (unlikely(!prior))
-               add_partial(get_node(s, page_to_nid(page)), page);
+               add_partial_tail(get_node(s, page_to_nid(page)), page);
 
 out_unlock:
        slab_unlock(page);
@@ -3079,6 +3076,19 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
        return slab_alloc(s, gfpflags, node, caller);
 }
 
+static unsigned long count_partial(struct kmem_cache_node *n)
+{
+       unsigned long flags;
+       unsigned long x = 0;
+       struct page *page;
+
+       spin_lock_irqsave(&n->list_lock, flags);
+       list_for_each_entry(page, &n->partial, lru)
+               x += page->inuse;
+       spin_unlock_irqrestore(&n->list_lock, flags);
+       return x;
+}
+
 #if defined(CONFIG_SYSFS) && defined(CONFIG_SLUB_DEBUG)
 static int validate_slab(struct kmem_cache *s, struct page *page,
                                                unsigned long *map)
@@ -3461,19 +3471,6 @@ static int list_locations(struct kmem_cache *s, char *buf,
        return n;
 }
 
-static unsigned long count_partial(struct kmem_cache_node *n)
-{
-       unsigned long flags;
-       unsigned long x = 0;
-       struct page *page;
-
-       spin_lock_irqsave(&n->list_lock, flags);
-       list_for_each_entry(page, &n->partial, lru)
-               x += page->inuse;
-       spin_unlock_irqrestore(&n->list_lock, flags);
-       return x;
-}
-
 enum slab_stat_type {
        SL_FULL,
        SL_PARTIAL,
@@ -4126,3 +4123,89 @@ static int __init slab_sysfs_init(void)
 
 __initcall(slab_sysfs_init);
 #endif
+
+/*
+ * The /proc/slabinfo ABI
+ */
+#ifdef CONFIG_SLABINFO
+
+ssize_t slabinfo_write(struct file *file, const char __user * buffer,
+                       size_t count, loff_t *ppos)
+{
+       return -EINVAL;
+}
+
+
+static void print_slabinfo_header(struct seq_file *m)
+{
+       seq_puts(m, "slabinfo - version: 2.1\n");
+       seq_puts(m, "# name            <active_objs> <num_objs> <objsize> "
+                "<objperslab> <pagesperslab>");
+       seq_puts(m, " : tunables <limit> <batchcount> <sharedfactor>");
+       seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
+       seq_putc(m, '\n');
+}
+
+static void *s_start(struct seq_file *m, loff_t *pos)
+{
+       loff_t n = *pos;
+
+       down_read(&slub_lock);
+       if (!n)
+               print_slabinfo_header(m);
+
+       return seq_list_start(&slab_caches, *pos);
+}
+
+static void *s_next(struct seq_file *m, void *p, loff_t *pos)
+{
+       return seq_list_next(p, &slab_caches, pos);
+}
+
+static void s_stop(struct seq_file *m, void *p)
+{
+       up_read(&slub_lock);
+}
+
+static int s_show(struct seq_file *m, void *p)
+{
+       unsigned long nr_partials = 0;
+       unsigned long nr_slabs = 0;
+       unsigned long nr_inuse = 0;
+       unsigned long nr_objs;
+       struct kmem_cache *s;
+       int node;
+
+       s = list_entry(p, struct kmem_cache, list);
+
+       for_each_online_node(node) {
+               struct kmem_cache_node *n = get_node(s, node);
+
+               if (!n)
+                       continue;
+
+               nr_partials += n->nr_partial;
+               nr_slabs += atomic_long_read(&n->nr_slabs);
+               nr_inuse += count_partial(n);
+       }
+
+       nr_objs = nr_slabs * s->objects;
+       nr_inuse += (nr_slabs - nr_partials) * s->objects;
+
+       seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d", s->name, nr_inuse,
+                  nr_objs, s->size, s->objects, (1 << s->order));
+       seq_printf(m, " : tunables %4u %4u %4u", 0, 0, 0);
+       seq_printf(m, " : slabdata %6lu %6lu %6lu", nr_slabs, nr_slabs,
+                  0UL);
+       seq_putc(m, '\n');
+       return 0;
+}
+
+const struct seq_operations slabinfo_op = {
+       .start = s_start,
+       .next = s_next,
+       .stop = s_stop,
+       .show = s_show,
+};
+
+#endif /* CONFIG_SLABINFO */
index e06f514fe04faa748c5e50e3f4cb25789d977238..a2183cb5d5242a0f05695f00b65d5f0f6d25715e 100644 (file)
@@ -83,6 +83,8 @@ static int __meminit sparse_index_init(unsigned long section_nr, int nid)
                return -EEXIST;
 
        section = sparse_index_alloc(nid);
+       if (!section)
+               return -ENOMEM;
        /*
         * This lock keeps two different sections from
         * reallocating for the same index
@@ -389,9 +391,17 @@ int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
         * no locking for this, because it does its own
         * plus, it does a kmalloc
         */
-       sparse_index_init(section_nr, pgdat->node_id);
+       ret = sparse_index_init(section_nr, pgdat->node_id);
+       if (ret < 0 && ret != -EEXIST)
+               return ret;
        memmap = kmalloc_section_memmap(section_nr, pgdat->node_id, nr_pages);
+       if (!memmap)
+               return -ENOMEM;
        usemap = __kmalloc_section_usemap();
+       if (!usemap) {
+               __kfree_section_memmap(memmap, nr_pages);
+               return -ENOMEM;
+       }
 
        pgdat_resize_lock(pgdat, &flags);
 
@@ -401,18 +411,16 @@ int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
                goto out;
        }
 
-       if (!usemap) {
-               ret = -ENOMEM;
-               goto out;
-       }
        ms->section_mem_map |= SECTION_MARKED_PRESENT;
 
        ret = sparse_init_one_section(ms, section_nr, memmap, usemap);
 
 out:
        pgdat_resize_unlock(pgdat, &flags);
-       if (ret <= 0)
+       if (ret <= 0) {
+               kfree(usemap);
                __kfree_section_memmap(memmap, nr_pages);
+       }
        return ret;
 }
 #endif
index 2086396de177557a71d9e1da1a7c52bf218ae359..9c7f712fc7e9c331e4dcd3c3b1d9c0fbdae3b01b 100644 (file)
@@ -542,6 +542,13 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev)
        if (eth->h_proto != htons(ETH_P_IP))
                goto non_ip; /* Multi-Protocol Over ATM :-) */
 
+       /* Weed out funny packets (e.g., AF_PACKET or raw). */
+       if (skb->len < ETH_HLEN + sizeof(struct iphdr))
+               goto non_ip;
+       skb_set_network_header(skb, ETH_HLEN);
+       if (skb->len < ETH_HLEN + ip_hdr(skb)->ihl * 4 || ip_hdr(skb)->ihl < 5)
+               goto non_ip;
+
        while (i < mpc->number_of_mps_macs) {
                if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN)))
                        if ( send_via_shortcut(skb, mpc) == 0 )           /* try shortcut */
index 3b7d1720c2eee2c3d652526f74f92094bb4634b4..d1be080dcb25c242d9af620470f20bd3cf8de307 100644 (file)
@@ -124,7 +124,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
                }
 
                skb_pull(skb, 1);       /* Remove PID */
-               skb_reset_mac_header(skb);
+               skb->mac_header = skb->network_header;
                skb_reset_network_header(skb);
                skb->dev      = ax25->ax25_dev->dev;
                skb->pkt_type = PACKET_HOST;
index 9483320f6dad01e967e219297ff798c5d1a29af0..34d1a3c822bf54b4cdef61add3ab243ac9c8fd13 100644 (file)
@@ -259,22 +259,14 @@ int hci_conn_del(struct hci_conn *conn)
        }
 
        tasklet_disable(&hdev->tx_task);
-
-       hci_conn_del_sysfs(conn);
-
        hci_conn_hash_del(hdev, conn);
        if (hdev->notify)
                hdev->notify(hdev, HCI_NOTIFY_CONN_DEL);
-
        tasklet_enable(&hdev->tx_task);
-
        skb_queue_purge(&conn->data_q);
-
+       hci_conn_del_sysfs(conn);
        hci_dev_put(hdev);
 
-       /* will free via device release */
-       put_device(&conn->dev);
-
        return 0;
 }
 
index cef1e3e1881ca70e1bf193b45f5874e2c1c44698..cad510309dcf88bafa2c3c056fa0ae4828e962a4 100644 (file)
@@ -320,6 +320,7 @@ static void del_conn(struct work_struct *work)
 {
        struct hci_conn *conn = container_of(work, struct hci_conn, work);
        device_del(&conn->dev);
+       put_device(&conn->dev);
 }
 
 void hci_conn_del_sysfs(struct hci_conn *conn)
index d74d82155d78e20cd008a289751bcaca70b27f7a..377e560ab5c98bb99cc5d83340082c926b2c39de 100644 (file)
@@ -254,6 +254,8 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
        if (copy_to_user(CMSG_COMPAT_DATA(cm), data, cmlen - sizeof(struct compat_cmsghdr)))
                return -EFAULT;
        cmlen = CMSG_COMPAT_SPACE(len);
+       if (kmsg->msg_controllen < cmlen)
+               cmlen = kmsg->msg_controllen;
        kmsg->msg_control += cmlen;
        kmsg->msg_controllen -= cmlen;
        return 0;
index 26a3a3a15be063564c95addc815b64457860c585..0879f52115eb9bada2f73bb3de2188ef9bf9a910 100644 (file)
@@ -2207,8 +2207,12 @@ static void net_rx_action(struct softirq_action *h)
                 * still "owns" the NAPI instance and therefore can
                 * move the instance around on the list at-will.
                 */
-               if (unlikely(work == weight))
-                       list_move_tail(&n->poll_list, list);
+               if (unlikely(work == weight)) {
+                       if (unlikely(napi_disable_pending(n)))
+                               __napi_complete(n);
+                       else
+                               list_move_tail(&n->poll_list, list);
+               }
 
                netpoll_poll_unlock(have);
        }
@@ -2819,7 +2823,7 @@ void dev_set_allmulti(struct net_device *dev, int inc)
 /*
  *     Upload unicast and multicast address lists to device and
  *     configure RX filtering. When the device doesn't support unicast
- *     filtering it is put in promiscous mode while unicast addresses
+ *     filtering it is put in promiscuous mode while unicast addresses
  *     are present.
  */
 void __dev_set_rx_mode(struct net_device *dev)
index 100ba6d9d478d7df1082a3790ddfac0e6c012d73..10f5c65f6a470cc914de500b43d63990e89db1b6 100644 (file)
@@ -196,6 +196,8 @@ int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data)
        if (copy_to_user(CMSG_DATA(cm), data, cmlen - sizeof(struct cmsghdr)))
                goto out;
        cmlen = CMSG_SPACE(len);
+       if (msg->msg_controllen < cmlen)
+               cmlen = msg->msg_controllen;
        msg->msg_control += cmlen;
        msg->msg_controllen -= cmlen;
        err = 0;
index 5b4ce9b4dd2060c9fd5920bfad967493b7e7eea6..b6283779e93d4432f9f9cad9f4c7a1610b3d1763 100644 (file)
@@ -416,16 +416,17 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
        C(len);
        C(data_len);
        C(mac_len);
-       n->cloned = 1;
        n->hdr_len = skb->nohdr ? skb_headroom(skb) : skb->hdr_len;
+       n->cloned = 1;
        n->nohdr = 0;
        n->destructor = NULL;
-       C(truesize);
-       atomic_set(&n->users, 1);
-       C(head);
-       C(data);
+       C(iif);
        C(tail);
        C(end);
+       C(head);
+       C(data);
+       C(truesize);
+       atomic_set(&n->users, 1);
 
        atomic_inc(&(skb_shinfo(skb)->dataref));
        skb->cloned = 1;
index 9ef0737043ee4e226938af84edb1e31edc39f7c8..9671ecd17e00581c8fb81d222cf975ba27a70f68 100644 (file)
@@ -71,7 +71,7 @@ struct dccp_ackvec {
  * @dccpavr_ack_ackno - sequence number being acknowledged
  * @dccpavr_ack_ptr - pointer into dccpav_buf where this record starts
  * @dccpavr_ack_nonce - dccpav_ack_nonce at the time this record was sent
- * @dccpavr_sent_len - lenght of the record in dccpav_buf
+ * @dccpavr_sent_len - length of the record in dccpav_buf
  */
 struct dccp_ackvec_record {
        struct list_head dccpavr_node;
index 19b33586333d96da26906773c87d0eb00195de1f..d133416d3970f2d8b74e9ea2abdfeccbb8b99d3a 100644 (file)
@@ -239,7 +239,7 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
                               ccid3_tx_state_name(hctx->ccid3hctx_state),
                               (unsigned)(hctx->ccid3hctx_x >> 6));
                /* The value of R is still undefined and so we can not recompute
-                * the timout value. Keep initial value as per [RFC 4342, 5]. */
+                * the timeout value. Keep initial value as per [RFC 4342, 5]. */
                t_nfb = TFRC_INITIAL_TIMEOUT;
                ccid3_update_send_interval(hctx);
                break;
index b3f366a33a5cd4f834a512f2dfa7bad2963356f4..08174a2aa8789ad8b3adb49b9f1d0fc1ac6edd06 100644 (file)
@@ -706,7 +706,7 @@ static int arp_process(struct sk_buff *skb)
        struct arphdr *arp;
        unsigned char *arp_ptr;
        struct rtable *rt;
-       unsigned char *sha, *tha;
+       unsigned char *sha;
        __be32 sip, tip;
        u16 dev_type = dev->type;
        int addr_type;
@@ -771,7 +771,6 @@ static int arp_process(struct sk_buff *skb)
        arp_ptr += dev->addr_len;
        memcpy(&sip, arp_ptr, 4);
        arp_ptr += 4;
-       tha     = arp_ptr;
        arp_ptr += dev->addr_len;
        memcpy(&tip, arp_ptr, 4);
 /*
index 3168c3de49193922a0b1ca641bcc3680e6a5107e..b42f74617bacfffaaf3af90856cc014ecf239dd5 100644 (file)
@@ -1027,7 +1027,7 @@ static void inetdev_changename(struct net_device *dev, struct in_device *in_dev)
                memcpy(ifa->ifa_label, dev->name, IFNAMSIZ);
                if (named++ == 0)
                        continue;
-               dot = strchr(ifa->ifa_label, ':');
+               dot = strchr(old, ':');
                if (dot == NULL) {
                        sprintf(old, ":%d", named);
                        dot = old;
index 732d8f088b13298fdfef8eb1051477c7f6453080..97abf934d1852931d36a18f8027d1597fa66e135 100644 (file)
@@ -804,10 +804,13 @@ static void nl_fib_input(struct sk_buff *skb)
 
        nlh = nlmsg_hdr(skb);
        if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len ||
-           nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) {
-               kfree_skb(skb);
+           nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn)))
                return;
-       }
+
+       skb = skb_clone(skb, GFP_KERNEL);
+       if (skb == NULL)
+               return;
+       nlh = nlmsg_hdr(skb);
 
        frn = (struct fib_result_nl *) NLMSG_DATA(nlh);
        tb = fib_get_table(frn->tb_id_in);
index 9a96c277393d3d72a5d622087c3df0a263e824a5..4a4d49fca1f2518a12eebbfbae02211eace06a19 100644 (file)
@@ -310,7 +310,7 @@ static void lro_flush(struct net_lro_mgr *lro_mgr,
        skb_shinfo(lro_desc->parent)->gso_size = lro_desc->mss;
 
        if (lro_desc->vgrp) {
-               if (test_bit(LRO_F_NAPI, &lro_mgr->features))
+               if (lro_mgr->features & LRO_F_NAPI)
                        vlan_hwaccel_receive_skb(lro_desc->parent,
                                                 lro_desc->vgrp,
                                                 lro_desc->vlan_tag);
@@ -320,7 +320,7 @@ static void lro_flush(struct net_lro_mgr *lro_mgr,
                                        lro_desc->vlan_tag);
 
        } else {
-               if (test_bit(LRO_F_NAPI, &lro_mgr->features))
+               if (lro_mgr->features & LRO_F_NAPI)
                        netif_receive_skb(lro_desc->parent);
                else
                        netif_rx(lro_desc->parent);
@@ -352,7 +352,7 @@ static int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb,
                goto out;
 
        if ((skb->protocol == htons(ETH_P_8021Q))
-           && !test_bit(LRO_F_EXTRACT_VLAN_ID, &lro_mgr->features))
+           && !(lro_mgr->features & LRO_F_EXTRACT_VLAN_ID))
                vlan_hdr_len = VLAN_HLEN;
 
        if (!lro_desc->active) { /* start new lro session */
@@ -474,7 +474,7 @@ static struct sk_buff *__lro_proc_segment(struct net_lro_mgr *lro_mgr,
                        goto out;
 
                if ((skb->protocol == htons(ETH_P_8021Q))
-                   && !test_bit(LRO_F_EXTRACT_VLAN_ID, &lro_mgr->features))
+                   && !(lro_mgr->features & LRO_F_EXTRACT_VLAN_ID))
                        vlan_hdr_len = VLAN_HLEN;
 
                iph = (void *)(skb->data + vlan_hdr_len);
@@ -516,7 +516,7 @@ void lro_receive_skb(struct net_lro_mgr *lro_mgr,
                     void *priv)
 {
        if (__lro_proc_skb(lro_mgr, skb, NULL, 0, priv)) {
-               if (test_bit(LRO_F_NAPI, &lro_mgr->features))
+               if (lro_mgr->features & LRO_F_NAPI)
                        netif_receive_skb(skb);
                else
                        netif_rx(skb);
@@ -531,7 +531,7 @@ void lro_vlan_hwaccel_receive_skb(struct net_lro_mgr *lro_mgr,
                                  void *priv)
 {
        if (__lro_proc_skb(lro_mgr, skb, vgrp, vlan_tag, priv)) {
-               if (test_bit(LRO_F_NAPI, &lro_mgr->features))
+               if (lro_mgr->features & LRO_F_NAPI)
                        vlan_hwaccel_receive_skb(skb, vgrp, vlan_tag);
                else
                        vlan_hwaccel_rx(skb, vgrp, vlan_tag);
@@ -550,7 +550,7 @@ void lro_receive_frags(struct net_lro_mgr *lro_mgr,
        if (!skb)
                return;
 
-       if (test_bit(LRO_F_NAPI, &lro_mgr->features))
+       if (lro_mgr->features & LRO_F_NAPI)
                netif_receive_skb(skb);
        else
                netif_rx(skb);
@@ -570,7 +570,7 @@ void lro_vlan_hwaccel_receive_frags(struct net_lro_mgr *lro_mgr,
        if (!skb)
                return;
 
-       if (test_bit(LRO_F_NAPI, &lro_mgr->features))
+       if (lro_mgr->features & LRO_F_NAPI)
                vlan_hwaccel_receive_skb(skb, vgrp, vlan_tag);
        else
                vlan_hwaccel_rx(skb, vgrp, vlan_tag);
index 02b02a8d681c85680d33d05bc2bdd7b710ef2672..4b93f32de10dc5213232a936d064b4fdefd49f06 100644 (file)
@@ -613,7 +613,7 @@ static int ipgre_rcv(struct sk_buff *skb)
                                offset += 4;
                }
 
-               skb_reset_mac_header(skb);
+               skb->mac_header = skb->network_header;
                __pskb_pull(skb, offset);
                skb_reset_network_header(skb);
                skb_postpull_rcsum(skb, skb_transport_header(skb), offset);
index 96400b0bd08a9bca5237f5c9938143ec697cdb51..b8f7763b2261474e4e5d35961193bcdcbebf26cd 100644 (file)
@@ -1403,6 +1403,9 @@ static int __init ic_proto_name(char *name)
        if (!strcmp(name, "on") || !strcmp(name, "any")) {
                return 1;
        }
+       if (!strcmp(name, "off") || !strcmp(name, "none")) {
+               return 0;
+       }
 #ifdef CONFIG_IP_PNP_DHCP
        else if (!strcmp(name, "dhcp")) {
                ic_proto_enabled &= ~IC_RARP;
@@ -1436,17 +1439,24 @@ static int __init ip_auto_config_setup(char *addrs)
        int num = 0;
 
        ic_set_manually = 1;
+       ic_enable = 1;
 
-       ic_enable = (*addrs &&
-               (strcmp(addrs, "off") != 0) &&
-               (strcmp(addrs, "none") != 0));
-       if (!ic_enable)
+       /*
+        * If any dhcp, bootp etc options are set, leave autoconfig on
+        * and skip the below static IP processing.
+        */
+       if (ic_proto_name(addrs))
                return 1;
 
-       if (ic_proto_name(addrs))
+       /* If no static IP is given, turn off autoconfig and bail.  */
+       if (*addrs == 0 ||
+           strcmp(addrs, "off") == 0 ||
+           strcmp(addrs, "none") == 0) {
+               ic_enable = 0;
                return 1;
+       }
 
-       /* Parse the whole string */
+       /* Parse string for static IP assignment.  */
        ip = addrs;
        while (ip && *ip) {
                if ((cp = strchr(ip, ':')))
@@ -1484,7 +1494,10 @@ static int __init ip_auto_config_setup(char *addrs)
                                strlcpy(user_dev_name, ip, sizeof(user_dev_name));
                                break;
                        case 6:
-                               ic_proto_name(ip);
+                               if (ic_proto_name(ip) == 0 &&
+                                   ic_myaddr == NONE) {
+                                       ic_enable = 0;
+                               }
                                break;
                        }
                }
index 831e9b29806d2101eea4d9c3d2de35c941d3836e..910dae732a0f14c3987bd4792ebce42137013636 100644 (file)
@@ -419,6 +419,9 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 __read_mostly = {
        .me              = THIS_MODULE,
 };
 
+module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint,
+                 &nf_conntrack_htable_size, 0600);
+
 MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET));
 MODULE_ALIAS("ip_conntrack");
 MODULE_LICENSE("GPL");
index 3ca98971a1e92c3385e7398fffb87168ad900c46..8996ccb757dbb31c5e1d9e54b446647cd965ad5b 100644 (file)
@@ -165,7 +165,7 @@ static int mangle_content_len(struct sk_buff *skb,
 
        dataoff = ip_hdrlen(skb) + sizeof(struct udphdr);
 
-       /* Get actual SDP lenght */
+       /* Get actual SDP length */
        if (ct_sip_get_info(ct, dptr, skb->len - dataoff, &matchoff,
                            &matchlen, POS_SDP_HEADER) > 0) {
 
index 66b42f547bf9c0b21bd2462a4534e54978b2813f..e7050f8eabebb63c6d0e3f46b55e4aef65da96b4 100644 (file)
@@ -271,6 +271,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
        int hh_len;
        struct iphdr *iph;
        struct sk_buff *skb;
+       unsigned int iphlen;
        int err;
 
        if (length > rt->u.dst.dev->mtu) {
@@ -304,7 +305,8 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
                goto error_fault;
 
        /* We don't modify invalid header */
-       if (length >= sizeof(*iph) && iph->ihl * 4U <= length) {
+       iphlen = iph->ihl * 4;
+       if (iphlen >= sizeof(*iph) && iphlen <= length) {
                if (!iph->saddr)
                        iph->saddr = rt->rt_src;
                iph->check   = 0;
index d2bc6148a7378452bde89de27cd7a0876a18c78d..d3377069ce05bcdcf2a2a69a1963b6fc7f25b03c 100644 (file)
@@ -2626,11 +2626,10 @@ int ip_rt_dump(struct sk_buff *skb,  struct netlink_callback *cb)
        int idx, s_idx;
 
        s_h = cb->args[0];
+       if (s_h < 0)
+               s_h = 0;
        s_idx = idx = cb->args[1];
-       for (h = 0; h <= rt_hash_mask; h++) {
-               if (h < s_h) continue;
-               if (h > s_h)
-                       s_idx = 0;
+       for (h = s_h; h <= rt_hash_mask; h++) {
                rcu_read_lock_bh();
                for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt;
                     rt = rcu_dereference(rt->u.dst.rt_next), idx++) {
@@ -2647,6 +2646,7 @@ int ip_rt_dump(struct sk_buff *skb,  struct netlink_callback *cb)
                        dst_release(xchg(&skb->dst, NULL));
                }
                rcu_read_unlock_bh();
+               s_idx = 0;
        }
 
 done:
index 889c89362bfcb303dac3a760bc4b3d60d6b4cbf6..b39f0d86e44cb06abfc76fcfbebbad27c86ab367 100644 (file)
@@ -2651,6 +2651,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
        u32 cnt = 0;
        u32 reord = tp->packets_out;
        s32 seq_rtt = -1;
+       s32 ca_seq_rtt = -1;
        ktime_t last_ackt = net_invalid_timestamp();
 
        while ((skb = tcp_write_queue_head(sk)) && skb != tcp_send_head(sk)) {
@@ -2659,6 +2660,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
                u32 packets_acked;
                u8 sacked = scb->sacked;
 
+               /* Determine how many packets and what bytes were acked, tso and else */
                if (after(scb->end_seq, tp->snd_una)) {
                        if (tcp_skb_pcount(skb) == 1 ||
                            !after(tp->snd_una, scb->seq))
@@ -2686,15 +2688,16 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
                                if (sacked & TCPCB_SACKED_RETRANS)
                                        tp->retrans_out -= packets_acked;
                                flag |= FLAG_RETRANS_DATA_ACKED;
+                               ca_seq_rtt = -1;
                                seq_rtt = -1;
                                if ((flag & FLAG_DATA_ACKED) ||
                                    (packets_acked > 1))
                                        flag |= FLAG_NONHEAD_RETRANS_ACKED;
                        } else {
+                               ca_seq_rtt = now - scb->when;
+                               last_ackt = skb->tstamp;
                                if (seq_rtt < 0) {
-                                       seq_rtt = now - scb->when;
-                                       if (fully_acked)
-                                               last_ackt = skb->tstamp;
+                                       seq_rtt = ca_seq_rtt;
                                }
                                if (!(sacked & TCPCB_SACKED_ACKED))
                                        reord = min(cnt, reord);
@@ -2709,10 +2712,10 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
                            !before(end_seq, tp->snd_up))
                                tp->urg_mode = 0;
                } else {
+                       ca_seq_rtt = now - scb->when;
+                       last_ackt = skb->tstamp;
                        if (seq_rtt < 0) {
-                               seq_rtt = now - scb->when;
-                               if (fully_acked)
-                                       last_ackt = skb->tstamp;
+                               seq_rtt = ca_seq_rtt;
                        }
                        reord = min(cnt, reord);
                }
@@ -2772,8 +2775,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
                                                 net_invalid_timestamp()))
                                        rtt_us = ktime_us_delta(ktime_get_real(),
                                                                last_ackt);
-                               else if (seq_rtt > 0)
-                                       rtt_us = jiffies_to_usecs(seq_rtt);
+                               else if (ca_seq_rtt > 0)
+                                       rtt_us = jiffies_to_usecs(ca_seq_rtt);
                        }
 
                        ca_ops->pkts_acked(sk, pkts_acked, rtt_us);
index 2ed689ac449ec67cd6e0519b1a4ddab4d156e43d..5d4245ab4183fa0d47b4557471ac2b09f4459b47 100644 (file)
@@ -123,11 +123,11 @@ ipv4_connected:
                                goto out;
                        }
                        sk->sk_bound_dev_if = usin->sin6_scope_id;
-                       if (!sk->sk_bound_dev_if &&
-                           (addr_type & IPV6_ADDR_MULTICAST))
-                               fl.oif = np->mcast_oif;
                }
 
+               if (!sk->sk_bound_dev_if && (addr_type & IPV6_ADDR_MULTICAST))
+                       sk->sk_bound_dev_if = np->mcast_oif;
+
                /* Connect to link-local address requires an interface */
                if (!sk->sk_bound_dev_if) {
                        err = -EINVAL;
index 67997a74ddce15d85e43c8146a9ed62f91085f77..777ed733b2d72b3c57a0efb8086d0074669defab 100644 (file)
@@ -612,7 +612,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
         * optimistic addresses, but we may send the solicitation
         * if we don't include the sllao.  So here we check
         * if our address is optimistic, and if so, we
-        * supress the inclusion of the sllao.
+        * suppress the inclusion of the sllao.
         */
        if (send_sllao) {
                struct inet6_ifaddr *ifp = ipv6_get_ifaddr(saddr, dev, 1);
index 48ce59a6e0265bf6bef19fa79b2e056e85aa9bdd..d5e4dd75200b784420a7e00172e6ffcf69abc28f 100644 (file)
@@ -1118,8 +1118,6 @@ static int irda_create(struct net *net, struct socket *sock, int protocol)
                        self->max_sdu_size_rx = TTP_SAR_UNBOUND;
                        break;
                default:
-                       IRDA_ERROR("%s: protocol not supported!\n",
-                                  __FUNCTION__);
                        return -ESOCKTNOSUPPORT;
                }
                break;
index e5e4792a0314d8e1d21652abf61d29d977c336fb..598dcbe4a501617d10ccc7314f5cca4289772894 100644 (file)
@@ -496,7 +496,7 @@ static int ircomm_param_poll(void *instance, irda_param_t *param, int get)
        IRDA_ASSERT(self != NULL, return -1;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 
-       /* Poll parameters are always of lenght 0 (just a signal) */
+       /* Poll parameters are always of length 0 (just a signal) */
        if (!get) {
                /* Respond with DTE line settings */
                ircomm_param_request(self, IRCOMM_DTE, TRUE);
index c68220773d28ee2d62dd8af780dc72adc9a80794..1ab91f787cc1803b4688c42d55edfe762fdc9d97 100644 (file)
@@ -342,7 +342,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev)
 
        if (dev->flags & IFF_PROMISC) {
                /* Enable promiscuous mode */
-               IRDA_WARNING("Promiscous mode not implemented by IrLAN!\n");
+               IRDA_WARNING("Promiscuous mode not implemented by IrLAN!\n");
        }
        else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS) {
                /* Disable promiscuous mode, use normal mode. */
index 4f3764546b2fe1eae1d4aef2582d97c807c120e4..7c132d6342af5b5c9f992c5fcec50d96eb147b59 100644 (file)
@@ -144,7 +144,7 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos)
        frame->control = SNRM_CMD | PF_BIT;
 
        /*
-        *  If we are establishing a connection then insert QoS paramerters
+        *  If we are establishing a connection then insert QoS parameters
         */
        if (qos) {
                skb_put(tx_skb, 9); /* 25 left */
index 7183e9ef79963910b3b9a46ee1483fe767f98822..722bbe044d9ce83abf2fcfa6894cbd66f11d3dca 100644 (file)
@@ -133,7 +133,7 @@ static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi,
        int err;
 
        p.pi = pi;             /* In case handler needs to know */
-       p.pl = type & PV_MASK; /* The integer type codes the lenght as well */
+       p.pl = type & PV_MASK; /* The integer type codes the length as well */
        p.pv.i = 0;            /* Clear value */
 
        /* Call handler for this parameter */
@@ -142,7 +142,7 @@ static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi,
                return err;
 
        /*
-        * If parameter lenght is still 0, then (1) this is an any length
+        * If parameter length is still 0, then (1) this is an any length
         * integer, and (2) the handler function does not care which length
         * we choose to use, so we pick the one the gives the fewest bytes.
         */
@@ -206,11 +206,11 @@ static int irda_extract_integer(void *self, __u8 *buf, int len, __u8 pi,
 {
        irda_param_t p;
        int n = 0;
-       int extract_len;        /* Real lenght we extract */
+       int extract_len;        /* Real length we extract */
        int err;
 
        p.pi = pi;     /* In case handler needs to know */
-       p.pl = buf[1]; /* Extract lenght of value */
+       p.pl = buf[1]; /* Extract length of value */
        p.pv.i = 0;    /* Clear value */
        extract_len = p.pl;     /* Default : extract all */
 
@@ -297,7 +297,7 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi,
        IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
 
        p.pi = pi;     /* In case handler needs to know */
-       p.pl = buf[1]; /* Extract lenght of value */
+       p.pl = buf[1]; /* Extract length of value */
 
        IRDA_DEBUG(2, "%s(), pi=%#x, pl=%d\n", __FUNCTION__,
                   p.pi, p.pl);
@@ -339,7 +339,7 @@ static int irda_extract_octseq(void *self, __u8 *buf, int len, __u8 pi,
        irda_param_t p;
 
        p.pi = pi;     /* In case handler needs to know */
-       p.pl = buf[1]; /* Extract lenght of value */
+       p.pl = buf[1]; /* Extract length of value */
 
        /* Check if buffer is long enough for parsing */
        if (len < (2+p.pl)) {
index e71286768a480994141f6d9b97b270c212112ccf..c246983308b820eec331312fc78befa838be2312 100644 (file)
@@ -238,7 +238,7 @@ async_bump(struct net_device *dev,
        skb_reserve(newskb, 1);
 
        if(docopy) {
-               /* Copy data without CRC (lenght already checked) */
+               /* Copy data without CRC (length already checked) */
                skb_copy_to_linear_data(newskb, rx_buff->data,
                                        rx_buff->len - 2);
                /* Deliver this skb */
index 878039b9557dddae70eddd32a342fed056261581..26d5e63c4cc5d946c61e5bdf6702dacb8d32640a 100644 (file)
@@ -2784,12 +2784,22 @@ static struct sadb_msg *pfkey_get_base_msg(struct sk_buff *skb, int *errp)
 
 static inline int aalg_tmpl_set(struct xfrm_tmpl *t, struct xfrm_algo_desc *d)
 {
-       return t->aalgos & (1 << d->desc.sadb_alg_id);
+       unsigned int id = d->desc.sadb_alg_id;
+
+       if (id >= sizeof(t->aalgos) * 8)
+               return 0;
+
+       return (t->aalgos >> id) & 1;
 }
 
 static inline int ealg_tmpl_set(struct xfrm_tmpl *t, struct xfrm_algo_desc *d)
 {
-       return t->ealgos & (1 << d->desc.sadb_alg_id);
+       unsigned int id = d->desc.sadb_alg_id;
+
+       if (id >= sizeof(t->ealgos) * 8)
+               return 0;
+
+       return (t->ealgos >> id) & 1;
 }
 
 static int count_ah_combs(struct xfrm_tmpl *t)
index 505af1f067ab06620fcb2050a2725a711c321f66..6378850d85805860416e9e67f7b0e308e76e6e0a 100644 (file)
@@ -427,7 +427,6 @@ static const struct header_ops ieee80211_header_ops = {
 void ieee80211_if_setup(struct net_device *dev)
 {
        ether_setup(dev);
-       dev->header_ops = &ieee80211_header_ops;
        dev->hard_start_xmit = ieee80211_subif_start_xmit;
        dev->wireless_handlers = &ieee80211_iw_handler_def;
        dev->set_multicast_list = ieee80211_set_multicast_list;
index 7027eed4d4ae3a374fff7439110e80d44069a8fb..308bbe4a13333b103bd4d31f676da35fadcb4e48 100644 (file)
@@ -591,7 +591,7 @@ static int ieee80211_ioctl_siwrate(struct net_device *dev,
        sdata->bss->force_unicast_rateidx = -1;
        if (rate->value < 0)
                return 0;
-       for (i=0; i< mode->num_rates; i++) {
+       for (i=0; i < mode->num_rates; i++) {
                struct ieee80211_rate *rates = &mode->rates[i];
                int this_rate = rates->rate;
 
@@ -599,10 +599,10 @@ static int ieee80211_ioctl_siwrate(struct net_device *dev,
                        sdata->bss->max_ratectrl_rateidx = i;
                        if (rate->fixed)
                                sdata->bss->force_unicast_rateidx = i;
-                       break;
+                       return 0;
                }
        }
-       return 0;
+       return -EINVAL;
 }
 
 static int ieee80211_ioctl_giwrate(struct net_device *dev,
index 7254bd6098398e0f408afe8f6eff40922dfe3c71..c3f2783937419a8c0afae47b302657288d647184 100644 (file)
@@ -33,6 +33,7 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops)
                if (!strcmp(alg->ops->name, ops->name)) {
                        /* don't register an algorithm twice */
                        WARN_ON(1);
+                       mutex_unlock(&rate_ctrl_mutex);
                        return -EALREADY;
                }
        }
@@ -59,11 +60,11 @@ void ieee80211_rate_control_unregister(struct rate_control_ops *ops)
        list_for_each_entry(alg, &rate_ctrl_algs, list) {
                if (alg->ops == ops) {
                        list_del(&alg->list);
+                       kfree(alg);
                        break;
                }
        }
        mutex_unlock(&rate_ctrl_mutex);
-       kfree(alg);
 }
 EXPORT_SYMBOL(ieee80211_rate_control_unregister);
 
index 16afd24d4f6b2bb392914e9fac06434ed205b54f..bee8080f2249ff5c0ab56a33293bd02dca7ea5ec 100644 (file)
@@ -808,12 +808,8 @@ static void ieee80211_associated(struct net_device *dev,
                sta_info_put(sta);
        }
        if (disassoc) {
-               union iwreq_data wrqu;
-               memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
-               wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-               wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
-               mod_timer(&ifsta->timer, jiffies +
-                                     IEEE80211_MONITORING_INTERVAL + 30 * HZ);
+               ifsta->state = IEEE80211_DISABLED;
+               ieee80211_set_associated(dev, ifsta, 0);
        } else {
                mod_timer(&ifsta->timer, jiffies +
                                      IEEE80211_MONITORING_INTERVAL);
index 00f908d9275e3e69a92daf1cc4d6741015d051d5..a7263fc476bdd4a0936f983b3acf298a36faafa1 100644 (file)
@@ -1443,6 +1443,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
        struct ieee80211_sub_if_data *prev = NULL;
        struct sk_buff *skb_new;
        u8 *bssid;
+       int hdrlen;
 
        /*
         * key references and virtual interfaces are protected using RCU
@@ -1472,6 +1473,18 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
        rx.fc = le16_to_cpu(hdr->frame_control);
        type = rx.fc & IEEE80211_FCTL_FTYPE;
 
+       /*
+        * Drivers are required to align the payload data to a four-byte
+        * boundary, so the last two bits of the address where it starts
+        * may not be set. The header is required to be directly before
+        * the payload data, padding like atheros hardware adds which is
+        * inbetween the 802.11 header and the payload is not supported,
+        * the driver is required to move the 802.11 header further back
+        * in that case.
+        */
+       hdrlen = ieee80211_get_hdrlen(rx.fc);
+       WARN_ON_ONCE(((unsigned long)(skb->data + hdrlen)) & 3);
+
        if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT)
                local->dot11ReceivedFragmentCount++;
 
index e8491554a5dc1129950d25f94022391304102598..cfd8ee9adad0e13df8a57d6c95190b15ce3212ab 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <linux/skbuff.h>
 #include <linux/if_arp.h>
+#include <linux/timer.h>
 
 #include <net/mac80211.h>
 #include "ieee80211_i.h"
@@ -306,7 +307,8 @@ static void sta_info_cleanup(unsigned long data)
        }
        read_unlock_bh(&local->sta_lock);
 
-       local->sta_cleanup.expires = jiffies + STA_INFO_CLEANUP_INTERVAL;
+       local->sta_cleanup.expires =
+               round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL);
        add_timer(&local->sta_cleanup);
 }
 
@@ -345,7 +347,8 @@ void sta_info_init(struct ieee80211_local *local)
        INIT_LIST_HEAD(&local->sta_list);
 
        init_timer(&local->sta_cleanup);
-       local->sta_cleanup.expires = jiffies + STA_INFO_CLEANUP_INTERVAL;
+       local->sta_cleanup.expires =
+               round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL);
        local->sta_cleanup.data = (unsigned long) local;
        local->sta_cleanup.function = sta_info_cleanup;
 
index 000c2fb462d07996106270e33eadc72fb07718e6..a4d5cdeb0110c73fbf52ddc35cb6221741228600 100644 (file)
@@ -1016,7 +1016,7 @@ struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced)
 }
 EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
 
-int set_hashsize(const char *val, struct kernel_param *kp)
+int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
 {
        int i, bucket, hashsize, vmalloced;
        int old_vmalloced, old_size;
@@ -1063,8 +1063,9 @@ int set_hashsize(const char *val, struct kernel_param *kp)
        nf_ct_free_hashtable(old_hash, old_vmalloced, old_size);
        return 0;
 }
+EXPORT_SYMBOL_GPL(nf_conntrack_set_hashsize);
 
-module_param_call(hashsize, set_hashsize, param_get_uint,
+module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint,
                  &nf_conntrack_htable_size, 0600);
 
 int __init nf_conntrack_init(void)
index 8f8b5a48df386ed65065e3f40ef88893a573c747..515abffc4a09807d3a06a4097eb826458e45c57f 100644 (file)
@@ -187,7 +187,7 @@ static const struct sip_header_nfo ct_sip_hdrs[] = {
        }
 };
 
-/* get line lenght until first CR or LF seen. */
+/* get line length until first CR or LF seen. */
 int ct_sip_lnlen(const char *line, const char *limit)
 {
        const char *k = line;
@@ -236,7 +236,7 @@ static int digits_len(struct nf_conn *ct, const char *dptr,
        return len;
 }
 
-/* get digits lenght, skiping blank spaces. */
+/* get digits length, skipping blank spaces. */
 static int skp_digits_len(struct nf_conn *ct, const char *dptr,
                          const char *limit, int *shift)
 {
index 56483377997a0550a39e4ab56ea4cdb87910eea9..9c41464d58d16c7419c1bc8b057473678d64e10e 100644 (file)
@@ -71,7 +71,7 @@ static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {
 };
 
 /*
- * NetLabel Misc Managment Functions
+ * NetLabel Misc Management Functions
  */
 
 /**
index 8c68da5ef0a17840a017dcf92993e8842d744952..6caf459665f2c78e5d1f1b35344c227bdd5da813 100644 (file)
@@ -56,7 +56,7 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
 
        /* Spoof incoming device */
        skb->dev      = dev;
-       skb_reset_mac_header(skb);
+       skb->mac_header = skb->network_header;
        skb_reset_network_header(skb);
        skb->pkt_type = PACKET_HOST;
 
index 55e7e4530f4310b1eacecb081f7e318426c9aa6f..a6ad491e434b90bb7fb866ac743adea3180224b5 100644 (file)
@@ -160,7 +160,7 @@ struct hfsc_class
        u64     cl_vtoff;               /* inter-period cumulative vt offset */
        u64     cl_cvtmax;              /* max child's vt in the last period */
        u64     cl_cvtoff;              /* cumulative cvtmax of all periods */
-       u64     cl_pcvtoff;             /* parent's cvtoff at initalization
+       u64     cl_pcvtoff;             /* parent's cvtoff at initialization
                                           time */
 
        struct internal_sc cl_rsc;      /* internal real-time service curve */
index f4876291bb5e6279cdfbb324474682e673305573..3cc629d3c9ff80593c24d128dfcdc729111b89dc 100644 (file)
@@ -210,6 +210,9 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
        chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types);
        chunksize += sizeof(ecap_param);
 
+       if (sctp_prsctp_enable)
+               chunksize += sizeof(prsctp_param);
+
        /* ADDIP: Section 4.2.7:
         *  An implementation supporting this extension [ADDIP] MUST list
         *  the ASCONF,the ASCONF-ACK, and the AUTH  chunks in its INIT and
@@ -286,7 +289,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
 
        sctp_addto_chunk(retval, sizeof(ecap_param), &ecap_param);
 
-       /* Add the supported extensions paramter.  Be nice and add this
+       /* Add the supported extensions parameter.  Be nice and add this
         * fist before addiding the parameters for the extensions themselves
         */
        if (num_ext) {
@@ -369,6 +372,9 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
        if (asoc->peer.ecn_capable)
                chunksize += sizeof(ecap_param);
 
+       if (sctp_prsctp_enable)
+               chunksize += sizeof(prsctp_param);
+
        if (sctp_addip_enable) {
                extensions[num_ext] = SCTP_CID_ASCONF;
                extensions[num_ext+1] = SCTP_CID_ASCONF_ACK;
@@ -2859,7 +2865,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
        chunk_len -= length;
 
        /* Skip the address parameter and store a pointer to the first
-        * asconf paramter.
+        * asconf parameter.
         */
        length = ntohs(addr_param->v4.param_hdr.length);
        asconf_param = (sctp_addip_param_t *)((void *)addr_param + length);
@@ -2868,7 +2874,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
        /* create an ASCONF_ACK chunk.
         * Based on the definitions of parameters, we know that the size of
         * ASCONF_ACK parameters are less than or equal to the twice of ASCONF
-        * paramters.
+        * parameters.
         */
        asconf_ack = sctp_make_asconf_ack(asoc, serial, chunk_len * 2);
        if (!asconf_ack)
@@ -3062,7 +3068,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,
        asconf_len -= length;
 
        /* Skip the address parameter in the last asconf sent and store a
-        * pointer to the first asconf paramter.
+        * pointer to the first asconf parameter.
         */
        length = ntohs(addr_param->v4.param_hdr.length);
        asconf_param = (sctp_addip_param_t *)((void *)addr_param + length);
index 5fb84778846d9b2e353a2346e1e6c4f458eaea0e..d247ed4ee42369c69aa8c8a3f26c83a370e906fc 100644 (file)
@@ -1309,26 +1309,6 @@ static void sctp_tietags_populate(struct sctp_association *new_asoc,
        new_asoc->c.initial_tsn         = asoc->c.initial_tsn;
 }
 
-static void sctp_auth_params_populate(struct sctp_association *new_asoc,
-                                   const struct sctp_association *asoc)
-{
-       /* Only perform this if AUTH extension is enabled */
-       if (!sctp_auth_enable)
-               return;
-
-       /* We need to provide the same parameter information as
-        * was in the original INIT.  This means that we need to copy
-        * the HMACS, CHUNKS, and RANDOM parameter from the original
-        * assocaition.
-        */
-       memcpy(new_asoc->c.auth_random, asoc->c.auth_random,
-               sizeof(asoc->c.auth_random));
-       memcpy(new_asoc->c.auth_hmacs, asoc->c.auth_hmacs,
-               sizeof(asoc->c.auth_hmacs));
-       memcpy(new_asoc->c.auth_chunks, asoc->c.auth_chunks,
-               sizeof(asoc->c.auth_chunks));
-}
-
 /*
  * Compare vtag/tietag values to determine unexpected COOKIE-ECHO
  * handling action.
@@ -1486,8 +1466,6 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
 
        sctp_tietags_populate(new_asoc, asoc);
 
-       sctp_auth_params_populate(new_asoc, asoc);
-
        /* B) "Z" shall respond immediately with an INIT ACK chunk.  */
 
        /* If there are errors need to be reported for unknown parameters,
index 2c17c7efad461b33f016c83401c4570068843e84..307314356e1662317c25be57050f79f366a9395e 100644 (file)
@@ -830,7 +830,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_authkey(
        ak = (struct sctp_authkey_event *)
                skb_put(skb, sizeof(struct sctp_authkey_event));
 
-       ak->auth_type = SCTP_AUTHENTICATION_EVENT;
+       ak->auth_type = SCTP_AUTHENTICATION_INDICATION;
        ak->auth_flags = 0;
        ak->auth_length = sizeof(struct sctp_authkey_event);
 
index a6e57d1c2eb6210c86b174ac3b5eb2a132f23cbe..1f2d85e869c0a2760de7641f7d3c125d80d54adb 100644 (file)
@@ -625,7 +625,7 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
        err = -EINVAL;
        gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor);
        if (!gss_auth->mech) {
-               printk(KERN_WARNING "%s: Pseudoflavor %d not found!",
+               printk(KERN_WARNING "%s: Pseudoflavor %d not found!\n",
                                __FUNCTION__, flavor);
                goto err_free;
        }
index 8738ec7ce69336dd1960d9e3c8c9a0e1fa68a0e4..34478035e05edd64131525b438eab2bedc55791c 100644 (file)
@@ -118,13 +118,14 @@ int x25_forward_data(int lci, struct x25_neigh *from, struct sk_buff *skb) {
                goto out;
 
        if ( (skbn = pskb_copy(skb, GFP_ATOMIC)) == NULL){
-               goto out;
+               goto output;
 
        }
        x25_transmit_link(skbn, nb);
 
-       x25_neigh_put(nb);
        rc = 1;
+output:
+       x25_neigh_put(nb);
 out:
        return rc;
 }
index b91b16671c1e78842f3e6b1496e0ef880c636a66..26b846e11bfb3241f268f86c7daa45c872a65164 100644 (file)
@@ -2162,7 +2162,7 @@ xfrm_audit_policy_add(struct xfrm_policy *xp, int result, u32 auid, u32 sid)
 
        if (audit_enabled == 0)
                return;
-       audit_buf = xfrm_audit_start(sid, auid);
+       audit_buf = xfrm_audit_start(auid, sid);
        if (audit_buf == NULL)
                return;
        audit_log_format(audit_buf, " op=SPD-add res=%u", result);
@@ -2179,7 +2179,7 @@ xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, u32 auid, u32 sid)
 
        if (audit_enabled == 0)
                return;
-       audit_buf = xfrm_audit_start(sid, auid);
+       audit_buf = xfrm_audit_start(auid, sid);
        if (audit_buf == NULL)
                return;
        audit_log_format(audit_buf, " op=SPD-delete res=%u", result);
index 1af522bf12cae6126442717a46174b6433be044b..f26aaaca1fae78dd92efe9d4e456e2dc1e60d822 100644 (file)
@@ -1749,6 +1749,7 @@ void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid)
 }
 EXPORT_SYMBOL(km_policy_expired);
 
+#ifdef CONFIG_XFRM_MIGRATE
 int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
               struct xfrm_migrate *m, int num_migrate)
 {
@@ -1768,6 +1769,7 @@ int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
        return err;
 }
 EXPORT_SYMBOL(km_migrate);
+#endif
 
 int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr)
 {
@@ -2033,7 +2035,7 @@ xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid)
 
        if (audit_enabled == 0)
                return;
-       audit_buf = xfrm_audit_start(sid, auid);
+       audit_buf = xfrm_audit_start(auid, sid);
        if (audit_buf == NULL)
                return;
        audit_log_format(audit_buf, " op=SAD-add res=%u",result);
@@ -2053,7 +2055,7 @@ xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid)
 
        if (audit_enabled == 0)
                return;
-       audit_buf = xfrm_audit_start(sid, auid);
+       audit_buf = xfrm_audit_start(auid, sid);
        if (audit_buf == NULL)
                return;
        audit_log_format(audit_buf, " op=SAD-delete res=%u",result);
index e75dbdcb08a49674b846f2ce14b02598b2ba6b3e..c4f6419b176943bd54752c644f0b4cc937587327 100644 (file)
 #include <linux/in6.h>
 #endif
 
-static inline int alg_len(struct xfrm_algo *alg)
-{
-       return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
-}
-
 static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type)
 {
        struct nlattr *rt = attrs[type];
@@ -45,7 +40,7 @@ static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type)
                return 0;
 
        algp = nla_data(rt);
-       if (nla_len(rt) < alg_len(algp))
+       if (nla_len(rt) < xfrm_alg_len(algp))
                return -EINVAL;
 
        switch (type) {
@@ -204,7 +199,7 @@ static int attach_one_algo(struct xfrm_algo **algpp, u8 *props,
                return -ENOSYS;
        *props = algo->desc.sadb_alg_id;
 
-       p = kmemdup(ualg, alg_len(ualg), GFP_KERNEL);
+       p = kmemdup(ualg, xfrm_alg_len(ualg), GFP_KERNEL);
        if (!p)
                return -ENOMEM;
 
@@ -516,9 +511,9 @@ static int copy_to_user_state_extra(struct xfrm_state *x,
                NLA_PUT_U64(skb, XFRMA_LASTUSED, x->lastused);
 
        if (x->aalg)
-               NLA_PUT(skb, XFRMA_ALG_AUTH, alg_len(x->aalg), x->aalg);
+               NLA_PUT(skb, XFRMA_ALG_AUTH, xfrm_alg_len(x->aalg), x->aalg);
        if (x->ealg)
-               NLA_PUT(skb, XFRMA_ALG_CRYPT, alg_len(x->ealg), x->ealg);
+               NLA_PUT(skb, XFRMA_ALG_CRYPT, xfrm_alg_len(x->ealg), x->ealg);
        if (x->calg)
                NLA_PUT(skb, XFRMA_ALG_COMP, sizeof(*(x->calg)), x->calg);
 
@@ -1978,9 +1973,9 @@ static inline size_t xfrm_sa_len(struct xfrm_state *x)
 {
        size_t l = 0;
        if (x->aalg)
-               l += nla_total_size(alg_len(x->aalg));
+               l += nla_total_size(xfrm_alg_len(x->aalg));
        if (x->ealg)
-               l += nla_total_size(alg_len(x->ealg));
+               l += nla_total_size(xfrm_alg_len(x->ealg));
        if (x->calg)
                l += nla_total_size(sizeof(*x->calg));
        if (x->encap)
index ce59fc2d8de496ee6c12e4032949136a27ee3b62..6501a50e17f0e157dab2dab3d64d8807fc3669da 100755 (executable)
@@ -18,7 +18,8 @@ def getsizes(file):
     for l in os.popen("nm --size-sort " + file).readlines():
         size, type, name = l[:-1].split()
         if type in "tTdDbB":
-            if "." in name: name = "static." + name.split(".")[0]
+            # function names begin with '.' on 64-bit powerpc
+            if "." in name[1:]: name = "static." + name.split(".")[0]
             sym[name] = sym.get(name, 0) + int(size, 16)
     return sym
 
index a38787a881ea29bd876efdcbc483867827189b9d..8d6f17490c5efe753e34b28e38158997f6226567 100644 (file)
@@ -374,7 +374,8 @@ static int conf_choice(struct menu *menu)
                                continue;
                        break;
                case set_random:
-                       def = (random() % cnt) + 1;
+                       if (is_new)
+                               def = (random() % cnt) + 1;
                case set_default:
                case set_yes:
                case set_mod:
index 3ace4a5680ba532ec394e2dcaef8d8b21eb18c08..c5a5ab9cae8cace6edc773a4eb9a3e9b3a700f9a 100644 (file)
@@ -925,6 +925,68 @@ static void mixer_slot_clear(struct snd_mixer_oss_slot *rslot)
        rslot->number = idx;
 }
 
+/* In a separate function to keep gcc 3.2 happy - do NOT merge this in
+   snd_mixer_oss_build_input! */
+static int snd_mixer_oss_build_test_all(struct snd_mixer_oss *mixer,
+                                       struct snd_mixer_oss_assign_table *ptr,
+                                       struct slot *slot)
+{
+       char str[64];
+       int err;
+
+       err = snd_mixer_oss_build_test(mixer, slot, ptr->name, ptr->index,
+                                      SNDRV_MIXER_OSS_ITEM_GLOBAL);
+       if (err)
+               return err;
+       sprintf(str, "%s Switch", ptr->name);
+       err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
+                                      SNDRV_MIXER_OSS_ITEM_GSWITCH);
+       if (err)
+               return err;
+       sprintf(str, "%s Route", ptr->name);
+       err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
+                                      SNDRV_MIXER_OSS_ITEM_GROUTE);
+       if (err)
+               return err;
+       sprintf(str, "%s Volume", ptr->name);
+       err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
+                                      SNDRV_MIXER_OSS_ITEM_GVOLUME);
+       if (err)
+               return err;
+       sprintf(str, "%s Playback Switch", ptr->name);
+       err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
+                                      SNDRV_MIXER_OSS_ITEM_PSWITCH);
+       if (err)
+               return err;
+       sprintf(str, "%s Playback Route", ptr->name);
+       err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
+                                      SNDRV_MIXER_OSS_ITEM_PROUTE);
+       if (err)
+               return err;
+       sprintf(str, "%s Playback Volume", ptr->name);
+       err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
+                                      SNDRV_MIXER_OSS_ITEM_PVOLUME);
+       if (err)
+               return err;
+       sprintf(str, "%s Capture Switch", ptr->name);
+       err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
+                                      SNDRV_MIXER_OSS_ITEM_CSWITCH);
+       if (err)
+               return err;
+       sprintf(str, "%s Capture Route", ptr->name);
+       err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
+                                      SNDRV_MIXER_OSS_ITEM_CROUTE);
+       if (err)
+               return err;
+       sprintf(str, "%s Capture Volume", ptr->name);
+       err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
+                                      SNDRV_MIXER_OSS_ITEM_CVOLUME);
+       if (err)
+               return err;
+
+       return 0;
+}
+
 /*
  * build an OSS mixer element.
  * ptr_allocated means the entry is dynamically allocated (change via proc file).
@@ -944,44 +1006,7 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix
 
        memset(&slot, 0, sizeof(slot));
        memset(slot.numid, 0xff, sizeof(slot.numid)); /* ID_UNKNOWN */
-       if (snd_mixer_oss_build_test(mixer, &slot, ptr->name, ptr->index,
-                                    SNDRV_MIXER_OSS_ITEM_GLOBAL))
-               return 0;
-       sprintf(str, "%s Switch", ptr->name);
-       if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
-                                    SNDRV_MIXER_OSS_ITEM_GSWITCH))
-               return 0;
-       sprintf(str, "%s Route", ptr->name);
-       if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
-                                    SNDRV_MIXER_OSS_ITEM_GROUTE))
-               return 0;
-       sprintf(str, "%s Volume", ptr->name);
-       if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
-                                    SNDRV_MIXER_OSS_ITEM_GVOLUME))
-               return 0;
-       sprintf(str, "%s Playback Switch", ptr->name);
-       if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
-                                    SNDRV_MIXER_OSS_ITEM_PSWITCH))
-               return 0;
-       sprintf(str, "%s Playback Route", ptr->name);
-       if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
-                                    SNDRV_MIXER_OSS_ITEM_PROUTE))
-               return 0;
-       sprintf(str, "%s Playback Volume", ptr->name);
-       if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
-                                    SNDRV_MIXER_OSS_ITEM_PVOLUME))
-               return 0;
-       sprintf(str, "%s Capture Switch", ptr->name);
-       if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
-                                    SNDRV_MIXER_OSS_ITEM_CSWITCH))
-               return 0;
-       sprintf(str, "%s Capture Route", ptr->name);
-       if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
-                                    SNDRV_MIXER_OSS_ITEM_CROUTE))
-               return 0;
-       sprintf(str, "%s Capture Volume", ptr->name);
-       if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
-                                    SNDRV_MIXER_OSS_ITEM_CVOLUME))
+       if (snd_mixer_oss_build_test_all(mixer, ptr, &slot))
                return 0;
        down_read(&mixer->card->controls_rwsem);
        if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) {
index 05cf7865be5e60c3df82172b163d288a0670d43a..d0ca582c4583e302f171c21e653ea4e5c43f7959 100644 (file)
@@ -233,8 +233,8 @@ typedef struct multisound_dev {
        spinlock_t lock;
        int nresets;
        unsigned long recsrc;
-       int left_levels[16];
-       int right_levels[16];
+       int left_levels[32];
+       int right_levels[32];
        int mixer_mod_count;
        int calibrate_signal;
        int play_sample_size, play_sample_rate, play_channels;