Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
Linus Torvalds [Sat, 14 Aug 2010 04:23:57 +0000 (21:23 -0700)]
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6:
  [IA64] Add latest crop of syscalls
  [IA64] Fix 64-bit atomic routines to return "long"

219 files changed:
Documentation/filesystems/Locking
Documentation/filesystems/vfs.txt
Makefile
arch/alpha/kernel/osf_sys.c
arch/alpha/kernel/process.c
arch/arm/kernel/sys_arm.c
arch/arm/kernel/sys_oabi-compat.c
arch/avr32/include/asm/syscalls.h
arch/avr32/kernel/process.c
arch/blackfin/kernel/process.c
arch/frv/kernel/process.c
arch/h8300/kernel/process.c
arch/ia64/include/asm/unistd.h
arch/ia64/kernel/process.c
arch/m32r/kernel/process.c
arch/m68k/kernel/process.c
arch/m68knommu/kernel/process.c
arch/microblaze/kernel/sys_microblaze.c
arch/mips/kernel/syscall.c
arch/mn10300/kernel/process.c
arch/parisc/hpux/fs.c
arch/powerpc/kernel/process.c
arch/powerpc/kernel/sys_ppc32.c
arch/s390/appldata/appldata_net_sum.c
arch/s390/include/asm/unistd.h
arch/s390/kernel/compat_linux.c
arch/s390/kernel/compat_linux.h
arch/s390/kernel/compat_wrapper.S
arch/s390/kernel/entry.h
arch/s390/kernel/process.c
arch/s390/kernel/sys_s390.c
arch/s390/kernel/syscalls.S
arch/sh/include/asm/syscalls_32.h
arch/sh/include/asm/syscalls_64.h
arch/sh/kernel/process_64.c
arch/sparc/kernel/sys_sparc32.c
arch/um/kernel/exec.c
arch/um/kernel/internal.h
arch/um/kernel/syscall.c
arch/x86/ia32/sys_ia32.c
arch/x86/include/asm/kdebug.h
arch/x86/include/asm/page.h
arch/x86/include/asm/sys_ia32.h
arch/x86/include/asm/syscalls.h
arch/x86/include/asm/uv/uv_bau.h
arch/x86/kernel/apic/apic.c
arch/x86/kernel/apic/x2apic_uv_x.c
arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
arch/x86/kernel/cpu/perf_event_p4.c
arch/x86/kernel/crash.c
arch/x86/kernel/entry_64.S
arch/x86/kernel/mpparse.c
arch/x86/kernel/process.c
arch/x86/kernel/tlb_uv.c
arch/x86/lib/atomic64_386_32.S
arch/x86/mm/fault.c
arch/x86/oprofile/nmi_int.c
arch/xtensa/kernel/process.c
drivers/crypto/Kconfig
drivers/firmware/Kconfig
drivers/firmware/iscsi_ibft.c
drivers/gpu/drm/i915/i915_opregion.c
drivers/input/joystick/amijoy.c
drivers/input/keyboard/hil_kbd.c
drivers/isdn/hardware/avm/c4.c
drivers/isdn/hardware/avm/t1pci.c
drivers/isdn/hardware/mISDN/mISDNinfineon.c
drivers/media/IR/Kconfig
drivers/media/dvb/dm1105/Kconfig
drivers/media/dvb/dvb-usb/Kconfig
drivers/media/dvb/siano/Kconfig
drivers/media/dvb/ttpci/Kconfig
drivers/media/video/bt8xx/Kconfig
drivers/media/video/cx18/Kconfig
drivers/media/video/cx231xx/Kconfig
drivers/media/video/cx23885/Kconfig
drivers/media/video/cx88/Kconfig
drivers/media/video/em28xx/Kconfig
drivers/media/video/ivtv/Kconfig
drivers/media/video/saa7134/Kconfig
drivers/media/video/tlg2300/Kconfig
drivers/media/video/v4l2-compat-ioctl32.c
drivers/media/video/v4l2-ctrls.c
drivers/mmc/host/Kconfig
drivers/mmc/host/Makefile
drivers/mmc/host/msm_sdcc.c
drivers/net/caif/caif_spi_slave.c
drivers/net/pcmcia/xirc2ps_cs.c
drivers/net/phy/Kconfig
drivers/net/phy/phy.c
drivers/net/qlcnic/qlcnic_main.c
drivers/net/usb/usbnet.c
drivers/net/wan/farsync.c
drivers/net/wireless/iwlwifi/iwl-1000.c
drivers/net/wireless/iwlwifi/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/libertas/cfg.c
drivers/net/wireless/p54/p54pci.c
drivers/platform/x86/Kconfig
drivers/platform/x86/Makefile
drivers/platform/x86/ideapad_acpi.c [new file with mode: 0644]
drivers/s390/block/dasd.c
drivers/s390/net/claw.c
drivers/s390/net/claw.h
drivers/s390/net/ctcm_fsms.c
drivers/s390/net/ctcm_main.c
drivers/s390/net/ctcm_main.h
drivers/s390/net/ctcm_mpc.c
drivers/s390/net/ctcm_sysfs.c
drivers/watchdog/Kconfig
drivers/watchdog/hpwdt.c
fs/afs/cell.c
fs/afs/dir.c
fs/afs/inode.c
fs/afs/internal.h
fs/afs/mntpt.c
fs/afs/proc.c
fs/afs/super.c
fs/bad_inode.c
fs/cifs/README
fs/compat.c
fs/compat_ioctl.c
fs/file_table.c
fs/ioctl.c
fs/jbd2/transaction.c
fs/logfs/dir.c
fs/logfs/file.c
fs/logfs/logfs.h
fs/nfs/Kconfig
fs/nfs/dns_resolve.c
fs/nfs/dns_resolve.h
fs/notify/fanotify/fanotify.c
fs/notify/fanotify/fanotify_user.c
fs/notify/fsnotify.c
fs/notify/inotify/inotify_fsnotify.c
fs/notify/notification.c
fs/ocfs2/acl.c
fs/ocfs2/cluster/tcp.c
fs/ocfs2/dlm/dlmmaster.c
fs/ocfs2/dlm/dlmrecovery.c
fs/ocfs2/dlm/dlmthread.c
fs/ocfs2/refcounttree.c
fs/partitions/ibm.c
fs/proc/inode.c
fs/stat.c
fs/utimes.c
include/linux/compat.h
include/linux/dma-mapping.h
include/linux/etherdevice.h
include/linux/fs.h
include/linux/fsnotify.h
include/linux/fsnotify_backend.h
include/linux/netpoll.h
include/linux/syscalls.h
include/linux/time.h
include/net/bluetooth/l2cap.h
include/net/sock.h
kernel/audit_watch.c
kernel/time/timekeeping.c
mm/memory.c
mm/nommu.c
net/bluetooth/l2cap.c
net/caif/cfpkt_skbuff.c
net/can/bcm.c
net/dns_resolver/dns_key.c
net/dns_resolver/dns_query.c
net/dsa/Kconfig
net/sched/sch_api.c
net/sched/sch_atm.c
net/sched/sch_sfq.c
net/sched/sch_tbf.c
net/sched/sch_teql.c
net/wireless/mlme.c
scripts/kconfig/conf.c
scripts/kconfig/confdata.c
scripts/kconfig/expr.c
scripts/kconfig/lkc.h
scripts/kconfig/nconf.c
scripts/setlocalversion
tools/perf/Makefile
tools/perf/builtin-annotate.c
tools/perf/builtin-report.c
tools/perf/builtin-timechart.c
tools/perf/builtin-trace.c
tools/perf/util/debug.c
tools/perf/util/debug.h
tools/perf/util/hist.c
tools/perf/util/hist.h
tools/perf/util/include/linux/list.h
tools/perf/util/include/linux/types.h
tools/perf/util/newt.c [deleted file]
tools/perf/util/probe-event.c
tools/perf/util/probe-finder.c
tools/perf/util/pstack.h
tools/perf/util/sort.c
tools/perf/util/symbol.c
tools/perf/util/symbol.h
tools/perf/util/ui/browser.c [new file with mode: 0644]
tools/perf/util/ui/browser.h [new file with mode: 0644]
tools/perf/util/ui/browsers/annotate.c [new file with mode: 0644]
tools/perf/util/ui/browsers/hists.c [new file with mode: 0644]
tools/perf/util/ui/browsers/map.c [new file with mode: 0644]
tools/perf/util/ui/browsers/map.h [new file with mode: 0644]
tools/perf/util/ui/helpline.c [new file with mode: 0644]
tools/perf/util/ui/helpline.h [new file with mode: 0644]
tools/perf/util/ui/libslang.h [new file with mode: 0644]
tools/perf/util/ui/progress.c [new file with mode: 0644]
tools/perf/util/ui/progress.h [new file with mode: 0644]
tools/perf/util/ui/setup.c [new file with mode: 0644]
tools/perf/util/ui/util.c [new file with mode: 0644]
tools/perf/util/ui/util.h [new file with mode: 0644]

index bbcc156..2db4283 100644 (file)
@@ -374,8 +374,6 @@ prototypes:
        ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
        int (*readdir) (struct file *, void *, filldir_t);
        unsigned int (*poll) (struct file *, struct poll_table_struct *);
-       int (*ioctl) (struct inode *, struct file *, unsigned int,
-                       unsigned long);
        long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
        long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
        int (*mmap) (struct file *, struct vm_area_struct *);
@@ -409,8 +407,7 @@ write:                      no
 aio_write:             no
 readdir:               no
 poll:                  no
-ioctl:                 yes     (see below)
-unlocked_ioctl:                no      (see below)
+unlocked_ioctl:                no
 compat_ioctl:          no
 mmap:                  no
 open:                  no
@@ -453,9 +450,6 @@ move ->readdir() to inode_operations and use a separate method for directory
 anything that resembles union-mount we won't have a struct file for all
 components. And there are other reasons why the current interface is a mess...
 
-->ioctl() on regular files is superceded by the ->unlocked_ioctl() that
-doesn't take the BKL.
-
 ->read on directories probably must go away - we should just enforce -EISDIR
 in sys_read() and friends.
 
index 94677e7..ed7e5ef 100644 (file)
@@ -727,7 +727,6 @@ struct file_operations {
        ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
        int (*readdir) (struct file *, void *, filldir_t);
        unsigned int (*poll) (struct file *, struct poll_table_struct *);
-       int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
        long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
        long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
        int (*mmap) (struct file *, struct vm_area_struct *);
@@ -768,10 +767,7 @@ otherwise noted.
        activity on this file and (optionally) go to sleep until there
        is activity. Called by the select(2) and poll(2) system calls
 
-  ioctl: called by the ioctl(2) system call
-
-  unlocked_ioctl: called by the ioctl(2) system call. Filesystems that do not
-       require the BKL should use this method instead of the ioctl() above.
+  unlocked_ioctl: called by the ioctl(2) system call.
 
   compat_ioctl: called by the ioctl(2) system call when 32 bit system calls
         are used on 64 bit kernels.
index 7431c28..788111d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -189,7 +189,6 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
 export KBUILD_BUILDHOST := $(SUBARCH)
 ARCH           ?= $(SUBARCH)
-CROSS_COMPILE  ?=
 CROSS_COMPILE  ?= $(CONFIG_CROSS_COMPILE:"%"=%)
 
 # Architecture as present in compile.h
index 88131c6..fb58150 100644 (file)
@@ -244,7 +244,7 @@ do_osf_statfs(struct path *path, struct osf_statfs __user *buffer,
        return error;   
 }
 
-SYSCALL_DEFINE3(osf_statfs, char __user *, pathname,
+SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname,
                struct osf_statfs __user *, buffer, unsigned long, bufsiz)
 {
        struct path path;
@@ -358,7 +358,7 @@ osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags)
        return do_mount("", dirname, "proc", flags, NULL);
 }
 
-SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, char __user *, path,
+SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
                int, flag, void __user *, data)
 {
        int retval;
@@ -932,7 +932,7 @@ SYSCALL_DEFINE3(osf_setitimer, int, which, struct itimerval32 __user *, in,
 
 }
 
-SYSCALL_DEFINE2(osf_utimes, char __user *, filename,
+SYSCALL_DEFINE2(osf_utimes, const char __user *, filename,
                struct timeval32 __user *, tvs)
 {
        struct timespec tv[2];
index 395a464..88e608a 100644 (file)
@@ -387,7 +387,7 @@ EXPORT_SYMBOL(dump_elf_task_fp);
  * sys_execve() executes a new program.
  */
 asmlinkage int
-do_sys_execve(char __user *ufilename, char __user * __user *argv,
+do_sys_execve(const char __user *ufilename, char __user * __user *argv,
              char __user * __user *envp, struct pt_regs *regs)
 {
        int error;
index c235018..5b7c541 100644 (file)
@@ -62,7 +62,7 @@ asmlinkage int sys_vfork(struct pt_regs *regs)
 /* sys_execve() executes a new program.
  * This is called indirectly via a small wrapper
  */
-asmlinkage int sys_execve(char __user *filenamei, char __user * __user *argv,
+asmlinkage int sys_execve(const char __user *filenamei, char __user * __user *argv,
                          char __user * __user *envp, struct pt_regs *regs)
 {
        int error;
@@ -84,7 +84,7 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
        int ret;
 
        memset(&regs, 0, sizeof(struct pt_regs));
-       ret = do_execve((char *)filename, (char __user * __user *)argv,
+       ret = do_execve(filename, (char __user * __user *)argv,
                        (char __user * __user *)envp, &regs);
        if (ret < 0)
                goto out;
index 33ff678..4ad8da1 100644 (file)
@@ -141,7 +141,7 @@ static long cp_oldabi_stat64(struct kstat *stat,
        return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
 }
 
-asmlinkage long sys_oabi_stat64(char __user * filename,
+asmlinkage long sys_oabi_stat64(const char __user * filename,
                                struct oldabi_stat64 __user * statbuf)
 {
        struct kstat stat;
@@ -151,7 +151,7 @@ asmlinkage long sys_oabi_stat64(char __user * filename,
        return error;
 }
 
-asmlinkage long sys_oabi_lstat64(char __user * filename,
+asmlinkage long sys_oabi_lstat64(const char __user * filename,
                                 struct oldabi_stat64 __user * statbuf)
 {
        struct kstat stat;
@@ -172,7 +172,7 @@ asmlinkage long sys_oabi_fstat64(unsigned long fd,
 }
 
 asmlinkage long sys_oabi_fstatat64(int dfd,
-                                  char __user *filename,
+                                  const char __user *filename,
                                   struct oldabi_stat64  __user *statbuf,
                                   int flag)
 {
index 66a1972..ab608b7 100644 (file)
@@ -21,7 +21,7 @@ asmlinkage int sys_clone(unsigned long, unsigned long,
                         unsigned long, unsigned long,
                         struct pt_regs *);
 asmlinkage int sys_vfork(struct pt_regs *);
-asmlinkage int sys_execve(char __user *, char __user *__user *,
+asmlinkage int sys_execve(const char __user *, char __user *__user *,
                          char __user *__user *, struct pt_regs *);
 
 /* kernel/signal.c */
index 2d76515..e5daddf 100644 (file)
@@ -383,7 +383,8 @@ asmlinkage int sys_vfork(struct pt_regs *regs)
                       0, NULL, NULL);
 }
 
-asmlinkage int sys_execve(char __user *ufilename, char __user *__user *uargv,
+asmlinkage int sys_execve(const char __user *ufilename,
+                         char __user *__user *uargv,
                          char __user *__user *uenvp, struct pt_regs *regs)
 {
        int error;
index 93ec07d..a566f61 100644 (file)
@@ -209,7 +209,7 @@ copy_thread(unsigned long clone_flags,
 /*
  * sys_execve() executes a new program.
  */
-asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp)
+asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp)
 {
        int error;
        char *filename;
index 21d0fd1..428931c 100644 (file)
@@ -250,7 +250,8 @@ int copy_thread(unsigned long clone_flags,
 /*
  * sys_execve() executes a new program.
  */
-asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp)
+asmlinkage int sys_execve(const char __user *name, char __user * __user *argv,
+                         char __user * __user *envp)
 {
        int error;
        char * filename;
index 8c8b0ff..8b7b78d 100644 (file)
@@ -212,7 +212,7 @@ int copy_thread(unsigned long clone_flags,
 /*
  * sys_execve() executes a new program.
  */
-asmlinkage int sys_execve(char *name, char **argv, char **envp,int dummy,...)
+asmlinkage int sys_execve(const char *name, char **argv, char **envp,int dummy,...)
 {
        int error;
        char * filename;
index 637e90f..87f1bd1 100644 (file)
@@ -356,7 +356,7 @@ asmlinkage unsigned long sys_mmap2(
                                int fd, long pgoff);
 struct pt_regs;
 struct sigaction;
-long sys_execve(char __user *filename, char __user * __user *argv,
+long sys_execve(const char __user *filename, char __user * __user *argv,
                           char __user * __user *envp, struct pt_regs *regs);
 asmlinkage long sys_ia64_pipe(void);
 asmlinkage long sys_rt_sigaction(int sig,
index 53f1648..a879c03 100644 (file)
@@ -633,7 +633,7 @@ dump_fpu (struct pt_regs *pt, elf_fpregset_t dst)
 }
 
 long
-sys_execve (char __user *filename, char __user * __user *argv, char __user * __user *envp,
+sys_execve (const char __user *filename, char __user * __user *argv, char __user * __user *envp,
            struct pt_regs *regs)
 {
        char *fname;
index bc8c8c1..8665a4d 100644 (file)
@@ -288,7 +288,8 @@ asmlinkage int sys_vfork(unsigned long r0, unsigned long r1, unsigned long r2,
 /*
  * sys_execve() executes a new program.
  */
-asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv,
+asmlinkage int sys_execve(const char __user *ufilename,
+                         char __user * __user *uargv,
                          char __user * __user *uenvp,
                          unsigned long r3, unsigned long r4, unsigned long r5,
                          unsigned long r6, struct pt_regs regs)
index 1a6be27..221d0b7 100644 (file)
@@ -315,7 +315,7 @@ EXPORT_SYMBOL(dump_fpu);
 /*
  * sys_execve() executes a new program.
  */
-asmlinkage int sys_execve(char __user *name, char __user * __user *argv, char __user * __user *envp)
+asmlinkage int sys_execve(const char __user *name, char __user * __user *argv, char __user * __user *envp)
 {
        int error;
        char * filename;
index 6aa6613..6350f68 100644 (file)
@@ -350,7 +350,7 @@ void dump(struct pt_regs *fp)
 /*
  * sys_execve() executes a new program.
  */
-asmlinkage int sys_execve(char *name, char **argv, char **envp)
+asmlinkage int sys_execve(const char *name, char **argv, char **envp)
 {
        int error;
        char * filename;
index f4e00b7..6abab6e 100644 (file)
@@ -47,7 +47,7 @@ asmlinkage long microblaze_clone(int flags, unsigned long stack, struct pt_regs
        return do_fork(flags, stack, regs, 0, NULL, NULL);
 }
 
-asmlinkage long microblaze_execve(char __user *filenamei, char __user *__user *argv,
+asmlinkage long microblaze_execve(const char __user *filenamei, char __user *__user *argv,
                        char __user *__user *envp, struct pt_regs *regs)
 {
        int error;
index 58bab2e..bddce0b 100644 (file)
@@ -254,7 +254,7 @@ asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs)
        int error;
        char * filename;
 
-       filename = getname((char __user *) (long)regs.regs[4]);
+       filename = getname((const char __user *) (long)regs.regs[4]);
        error = PTR_ERR(filename);
        if (IS_ERR(filename))
                goto out;
index 82b817c..762eb32 100644 (file)
@@ -268,7 +268,7 @@ asmlinkage long sys_vfork(void)
                       0, NULL, NULL);
 }
 
-asmlinkage long sys_execve(char __user *name,
+asmlinkage long sys_execve(const char __user *name,
                           char __user * __user *argv,
                           char __user * __user *envp)
 {
index 6935123..1444875 100644 (file)
@@ -36,7 +36,7 @@ int hpux_execve(struct pt_regs *regs)
        int error;
        char *filename;
 
-       filename = getname((char __user *) regs->gr[26]);
+       filename = getname((const char __user *) regs->gr[26]);
        error = PTR_ERR(filename);
        if (IS_ERR(filename))
                goto out;
@@ -169,7 +169,7 @@ static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 __user *statbuf)
        return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
 }
 
-long hpux_stat64(char __user *filename, struct hpux_stat64 __user *statbuf)
+long hpux_stat64(const char __user *filename, struct hpux_stat64 __user *statbuf)
 {
        struct kstat stat;
        int error = vfs_stat(filename, &stat);
@@ -191,7 +191,8 @@ long hpux_fstat64(unsigned int fd, struct hpux_stat64 __user *statbuf)
        return error;
 }
 
-long hpux_lstat64(char __user *filename, struct hpux_stat64 __user *statbuf)
+long hpux_lstat64(const char __user *filename,
+                 struct hpux_stat64 __user *statbuf)
 {
        struct kstat stat;
        int error = vfs_lstat(filename, &stat);
index e78a5ad..feacfb7 100644 (file)
@@ -1027,7 +1027,7 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
        int error;
        char *filename;
 
-       filename = getname((char __user *) a0);
+       filename = getname((const char __user *) a0);
        error = PTR_ERR(filename);
        if (IS_ERR(filename))
                goto out;
index 19471a1..20fd701 100644 (file)
@@ -546,7 +546,7 @@ compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_siz
        return sys_pread64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo);
 }
 
-compat_ssize_t compat_sys_pwrite64(unsigned int fd, char __user *ubuf, compat_size_t count,
+compat_ssize_t compat_sys_pwrite64(unsigned int fd, const char __user *ubuf, compat_size_t count,
                              u32 reg6, u32 poshi, u32 poslo)
 {
        return sys_pwrite64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo);
index f02e89c..5da7c56 100644 (file)
@@ -85,9 +85,10 @@ static void appldata_get_net_sum_data(void *data)
 
        rcu_read_lock();
        for_each_netdev_rcu(&init_net, dev) {
+               const struct rtnl_link_stats64 *stats;
                struct rtnl_link_stats64 temp;
-               const struct net_device_stats *stats = dev_get_stats(dev, &temp);
 
+               stats = dev_get_stats(dev, &temp);
                rx_packets += stats->rx_packets;
                tx_packets += stats->tx_packets;
                rx_bytes   += stats->rx_bytes;
index 5f00751..1049ef2 100644 (file)
 #define        __NR_pwritev            329
 #define __NR_rt_tgsigqueueinfo 330
 #define __NR_perf_event_open   331
-#define NR_syscalls 332
+#define __NR_fanotify_init     332
+#define __NR_fanotify_mark     333
+#define __NR_prlimit64         334
+#define NR_syscalls 335
 
 /* 
  * There are some system calls that are not present on 64 bit, some
index 73b624e..1e6449c 100644 (file)
@@ -436,7 +436,7 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
  * sys32_execve() executes a new program after the asm stub has set
  * things up for us.  This should basically do what I want it to.
  */
-asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv,
+asmlinkage long sys32_execve(const char __user *name, compat_uptr_t __user *argv,
                             compat_uptr_t __user *envp)
 {
        struct pt_regs *regs = task_pt_regs(current);
@@ -570,7 +570,7 @@ static int cp_stat64(struct stat64_emu31 __user *ubuf, struct kstat *stat)
        return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 
 }
 
-asmlinkage long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf)
+asmlinkage long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf)
 {
        struct kstat stat;
        int ret = vfs_stat(filename, &stat);
@@ -579,7 +579,7 @@ asmlinkage long sys32_stat64(char __user * filename, struct stat64_emu31 __user
        return ret;
 }
 
-asmlinkage long sys32_lstat64(char __user * filename, struct stat64_emu31 __user * statbuf)
+asmlinkage long sys32_lstat64(const char __user * filename, struct stat64_emu31 __user * statbuf)
 {
        struct kstat stat;
        int ret = vfs_lstat(filename, &stat);
@@ -597,7 +597,7 @@ asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * sta
        return ret;
 }
 
-asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename,
+asmlinkage long sys32_fstatat64(unsigned int dfd, const char __user *filename,
                                struct stat64_emu31 __user* statbuf, int flag)
 {
        struct kstat stat;
@@ -655,7 +655,7 @@ asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
        return sys_read(fd, buf, count);
 }
 
-asmlinkage long sys32_write(unsigned int fd, char __user * buf, size_t count)
+asmlinkage long sys32_write(unsigned int fd, const char __user * buf, size_t count)
 {
        if ((compat_ssize_t) count < 0)
                return -EINVAL; 
index cb97afc..9635d75 100644 (file)
@@ -193,7 +193,7 @@ long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
                          compat_sigset_t __user *oset, size_t sigsetsize);
 long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize);
 long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo);
-long sys32_execve(char __user *name, compat_uptr_t __user *argv,
+long sys32_execve(const char __user *name, compat_uptr_t __user *argv,
                  compat_uptr_t __user *envp);
 long sys32_init_module(void __user *umod, unsigned long len,
                       const char __user *uargs);
@@ -207,16 +207,16 @@ long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
                    size_t count);
 long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset,
                      s32 count);
-long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf);
-long sys32_lstat64(char __user * filename,
+long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf);
+long sys32_lstat64(const char __user * filename,
                   struct stat64_emu31 __user * statbuf);
 long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf);
-long sys32_fstatat64(unsigned int dfd, char __user *filename,
+long sys32_fstatat64(unsigned int dfd, const char __user *filename,
                     struct stat64_emu31 __user* statbuf, int flag);
 unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg);
 long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg);
 long sys32_read(unsigned int fd, char __user * buf, size_t count);
-long sys32_write(unsigned int fd, char __user * buf, size_t count);
+long sys32_write(unsigned int fd, const char __user * buf, size_t count);
 long sys32_fadvise64(int fd, loff_t offset, size_t len, int advise);
 long sys32_fadvise64_64(struct fadvise64_64_args __user *args);
 long sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
index 672ce52..8e60fb2 100644 (file)
@@ -614,7 +614,7 @@ sys32_sysfs_wrapper:
 
        .globl  sys32_personality_wrapper
 sys32_personality_wrapper:
-       llgfr   %r2,%r2                 # unsigned long
+       llgfr   %r2,%r2                 # unsigned int
        jg      sys_s390_personality    # branch to system call
 
        .globl  sys32_setfsuid16_wrapper
@@ -1853,3 +1853,27 @@ sys32_execve_wrapper:
        llgtr   %r3,%r3                 # compat_uptr_t *
        llgtr   %r4,%r4                 # compat_uptr_t *
        jg      sys32_execve            # branch to system call
+
+       .globl  sys_fanotify_init_wrapper
+sys_fanotify_init_wrapper:
+       llgfr   %r2,%r2                 # unsigned int
+       llgfr   %r3,%r3                 # unsigned int
+       jg      sys_fanotify_init       # branch to system call
+
+       .globl  sys_fanotify_mark_wrapper
+sys_fanotify_mark_wrapper:
+       lgfr    %r2,%r2                 # int
+       llgfr   %r3,%r3                 # unsigned int
+       sllg    %r4,%r4,32              # get high word of 64bit mask
+       lr      %r4,%r5                 # get low word of 64bit mask
+       llgfr   %r5,%r6                 # unsigned int
+       llgt    %r6,164(%r15)           # char *
+       jg      sys_fanotify_mark       # branch to system call
+
+       .globl  sys_prlimit64_wrapper
+sys_prlimit64_wrapper:
+       lgfr    %r2,%r2                 # pid_t
+       llgfr   %r3,%r3                 # unsigned int
+       llgtr   %r4,%r4                 # const struct rlimit64 __user *
+       llgtr   %r5,%r5                 # struct rlimit64 __user *
+       jg      sys_prlimit64           # branch to system call
index eb15c12..403fb43 100644 (file)
@@ -31,7 +31,7 @@ struct old_sigaction;
 long sys_mmap2(struct s390_mmap_arg_struct __user  *arg);
 long sys_s390_ipc(uint call, int first, unsigned long second,
             unsigned long third, void __user *ptr);
-long sys_s390_personality(unsigned long personality);
+long sys_s390_personality(unsigned int personality);
 long sys_s390_fadvise64(int fd, u32 offset_high, u32 offset_low,
                    size_t len, int advice);
 long sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
@@ -42,7 +42,7 @@ long sys_clone(unsigned long newsp, unsigned long clone_flags,
               int __user *parent_tidptr, int __user *child_tidptr);
 long sys_vfork(void);
 void execve_tail(void);
-long sys_execve(char __user *name, char __user * __user *argv,
+long sys_execve(const char __user *name, char __user * __user *argv,
                char __user * __user *envp);
 long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
 long sys_sigaction(int sig, const struct old_sigaction __user *act,
index 1039fde..7eafaf2 100644 (file)
@@ -267,7 +267,7 @@ asmlinkage void execve_tail(void)
 /*
  * sys_execve() executes a new program.
  */
-SYSCALL_DEFINE3(execve, char __user *, name, char __user * __user *, argv,
+SYSCALL_DEFINE3(execve, const char __user *, name, char __user * __user *, argv,
                char __user * __user *, envp)
 {
        struct pt_regs *regs = task_pt_regs(current);
index 7b6b0f8..4760814 100644 (file)
@@ -131,9 +131,9 @@ SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
 }
 
 #ifdef CONFIG_64BIT
-SYSCALL_DEFINE1(s390_personality, unsigned long, personality)
+SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
 {
-       int ret;
+       unsigned int ret;
 
        if (current->personality == PER_LINUX32 && personality == PER_LINUX)
                personality = PER_LINUX32;
index 201ce6b..a8fee1b 100644 (file)
@@ -340,3 +340,6 @@ SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper)
 SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper)
 SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */
 SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
+SYSCALL(sys_fanotify_init,sys_fanotify_init,sys_fanotify_init_wrapper)
+SYSCALL(sys_fanotify_mark,sys_fanotify_mark,sys_fanotify_mark_wrapper)
+SYSCALL(sys_prlimit64,sys_prlimit64,sys_prlimit64_wrapper)
index 8b30200..be201fd 100644 (file)
@@ -19,7 +19,7 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
 asmlinkage int sys_vfork(unsigned long r4, unsigned long r5,
                         unsigned long r6, unsigned long r7,
                         struct pt_regs __regs);
-asmlinkage int sys_execve(char __user *ufilename, char __user * __user *uargv,
+asmlinkage int sys_execve(const char __user *ufilename, char __user * __user *uargv,
                          char __user * __user *uenvp, unsigned long r7,
                          struct pt_regs __regs);
 asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r5,
index 751fd88..ee519f4 100644 (file)
@@ -21,7 +21,7 @@ asmlinkage int sys_vfork(unsigned long r2, unsigned long r3,
                         unsigned long r4, unsigned long r5,
                         unsigned long r6, unsigned long r7,
                         struct pt_regs *pregs);
-asmlinkage int sys_execve(char *ufilename, char **uargv,
+asmlinkage int sys_execve(const char *ufilename, char **uargv,
                          char **uenvp, unsigned long r5,
                          unsigned long r6, unsigned long r7,
                          struct pt_regs *pregs);
index d4ca648..68d128d 100644 (file)
@@ -483,7 +483,7 @@ asmlinkage int sys_vfork(unsigned long r2, unsigned long r3,
 /*
  * sys_execve() executes a new program.
  */
-asmlinkage int sys_execve(char *ufilename, char **uargv,
+asmlinkage int sys_execve(const char *ufilename, char **uargv,
                          char **uenvp, unsigned long r5,
                          unsigned long r6, unsigned long r7,
                          struct pt_regs *pregs)
index c0ca875..e6375a7 100644 (file)
@@ -162,7 +162,7 @@ static int cp_compat_stat64(struct kstat *stat,
        return err;
 }
 
-asmlinkage long compat_sys_stat64(char __user * filename,
+asmlinkage long compat_sys_stat64(const char __user * filename,
                struct compat_stat64 __user *statbuf)
 {
        struct kstat stat;
@@ -173,7 +173,7 @@ asmlinkage long compat_sys_stat64(char __user * filename,
        return error;
 }
 
-asmlinkage long compat_sys_lstat64(char __user * filename,
+asmlinkage long compat_sys_lstat64(const char __user * filename,
                struct compat_stat64 __user *statbuf)
 {
        struct kstat stat;
@@ -195,7 +195,8 @@ asmlinkage long compat_sys_fstat64(unsigned int fd,
        return error;
 }
 
-asmlinkage long compat_sys_fstatat64(unsigned int dfd, char __user *filename,
+asmlinkage long compat_sys_fstatat64(unsigned int dfd,
+               const char __user *filename,
                struct compat_stat64 __user * statbuf, int flag)
 {
        struct kstat stat;
index 97974c1..59b20d9 100644 (file)
@@ -44,7 +44,7 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
        PT_REGS_SP(regs) = esp;
 }
 
-static long execve1(char *file, char __user * __user *argv,
+static long execve1(const char *file, char __user * __user *argv,
                    char __user *__user *env)
 {
        long error;
@@ -61,7 +61,7 @@ static long execve1(char *file, char __user * __user *argv,
        return error;
 }
 
-long um_execve(char *file, char __user *__user *argv, char __user *__user *env)
+long um_execve(const char *file, char __user *__user *argv, char __user *__user *env)
 {
        long err;
 
@@ -71,7 +71,7 @@ long um_execve(char *file, char __user *__user *argv, char __user *__user *env)
        return err;
 }
 
-long sys_execve(char __user *file, char __user *__user *argv,
+long sys_execve(const char __user *file, char __user *__user *argv,
                char __user *__user *env)
 {
        long error;
index 3bda43c..1303a10 100644 (file)
@@ -1 +1 @@
-extern long um_execve(char *file, char __user *__user *argv, char __user *__user *env);
+extern long um_execve(const char *file, char __user *__user *argv, char __user *__user *env);
index 4393173..7427c0b 100644 (file)
@@ -58,7 +58,7 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
 
        fs = get_fs();
        set_fs(KERNEL_DS);
-       ret = um_execve((char *)filename, (char __user *__user *)argv,
+       ret = um_execve(filename, (char __user *__user *)argv,
                        (char __user *__user *) envp);
        set_fs(fs);
 
index 3d09331..849813f 100644 (file)
@@ -51,7 +51,7 @@
 #define AA(__x)                ((unsigned long)(__x))
 
 
-asmlinkage long sys32_truncate64(char __user *filename,
+asmlinkage long sys32_truncate64(const char __user *filename,
                                 unsigned long offset_low,
                                 unsigned long offset_high)
 {
@@ -96,7 +96,7 @@ static int cp_stat64(struct stat64 __user *ubuf, struct kstat *stat)
        return 0;
 }
 
-asmlinkage long sys32_stat64(char __user *filename,
+asmlinkage long sys32_stat64(const char __user *filename,
                             struct stat64 __user *statbuf)
 {
        struct kstat stat;
@@ -107,7 +107,7 @@ asmlinkage long sys32_stat64(char __user *filename,
        return ret;
 }
 
-asmlinkage long sys32_lstat64(char __user *filename,
+asmlinkage long sys32_lstat64(const char __user *filename,
                              struct stat64 __user *statbuf)
 {
        struct kstat stat;
@@ -126,7 +126,7 @@ asmlinkage long sys32_fstat64(unsigned int fd, struct stat64 __user *statbuf)
        return ret;
 }
 
-asmlinkage long sys32_fstatat(unsigned int dfd, char __user *filename,
+asmlinkage long sys32_fstatat(unsigned int dfd, const char __user *filename,
                              struct stat64 __user *statbuf, int flag)
 {
        struct kstat stat;
@@ -408,8 +408,8 @@ asmlinkage long sys32_pread(unsigned int fd, char __user *ubuf, u32 count,
                         ((loff_t)AA(poshi) << 32) | AA(poslo));
 }
 
-asmlinkage long sys32_pwrite(unsigned int fd, char __user *ubuf, u32 count,
-                            u32 poslo, u32 poshi)
+asmlinkage long sys32_pwrite(unsigned int fd, const char __user *ubuf,
+                            u32 count, u32 poslo, u32 poshi)
 {
        return sys_pwrite64(fd, ubuf, count,
                          ((loff_t)AA(poshi) << 32) | AA(poslo));
@@ -449,7 +449,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd,
        return ret;
 }
 
-asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv,
+asmlinkage long sys32_execve(const char __user *name, compat_uptr_t __user *argv,
                             compat_uptr_t __user *envp, struct pt_regs *regs)
 {
        long error;
index fa7c0b9..5bdfca8 100644 (file)
@@ -33,5 +33,11 @@ extern void __show_regs(struct pt_regs *regs, int all);
 extern void show_regs(struct pt_regs *regs);
 extern unsigned long oops_begin(void);
 extern void oops_end(unsigned long, struct pt_regs *, int signr);
+#ifdef CONFIG_KEXEC
+extern int in_crash_kexec;
+#else
+/* no crash dump is ever in progress if no crash kernel can be kexec'd */
+#define in_crash_kexec 0
+#endif
 
 #endif /* _ASM_X86_KDEBUG_H */
index 625c3f0..8ca8283 100644 (file)
@@ -37,6 +37,13 @@ static inline void copy_user_page(void *to, void *from, unsigned long vaddr,
 #define __pa_nodebug(x)        __phys_addr_nodebug((unsigned long)(x))
 /* __pa_symbol should be used for C visible symbols.
    This seems to be the official gcc blessed way to do such arithmetic. */
+/*
+ * We need __phys_reloc_hide() here because gcc may assume that there is no
+ * overflow during __pa() calculation and can optimize it unexpectedly.
+ * Newer versions of gcc provide -fno-strict-overflow switch to handle this
+ * case properly. Once all supported versions of gcc understand it, we can
+ * remove this Voodoo magic stuff. (i.e. once gcc3.x is deprecated)
+ */
 #define __pa_symbol(x) __pa(__phys_reloc_hide((unsigned long)(x)))
 
 #define __va(x)                        ((void *)((unsigned long)(x)+PAGE_OFFSET))
index cf4e2e3..cb23852 100644 (file)
 #include <asm/ia32.h>
 
 /* ia32/sys_ia32.c */
-asmlinkage long sys32_truncate64(char __user *, unsigned long, unsigned long);
+asmlinkage long sys32_truncate64(const char __user *, unsigned long, unsigned long);
 asmlinkage long sys32_ftruncate64(unsigned int, unsigned long, unsigned long);
 
-asmlinkage long sys32_stat64(char __user *, struct stat64 __user *);
-asmlinkage long sys32_lstat64(char __user *, struct stat64 __user *);
+asmlinkage long sys32_stat64(const char __user *, struct stat64 __user *);
+asmlinkage long sys32_lstat64(const char __user *, struct stat64 __user *);
 asmlinkage long sys32_fstat64(unsigned int, struct stat64 __user *);
-asmlinkage long sys32_fstatat(unsigned int, char __user *,
+asmlinkage long sys32_fstatat(unsigned int, const char __user *,
                              struct stat64 __user *, int);
 struct mmap_arg_struct32;
 asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *);
@@ -49,12 +49,12 @@ asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *, compat_size_t);
 asmlinkage long sys32_rt_sigqueueinfo(int, int, compat_siginfo_t __user *);
 
 asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32);
-asmlinkage long sys32_pwrite(unsigned int, char __user *, u32, u32, u32);
+asmlinkage long sys32_pwrite(unsigned int, const char __user *, u32, u32, u32);
 
 asmlinkage long sys32_personality(unsigned long);
 asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32);
 
-asmlinkage long sys32_execve(char __user *, compat_uptr_t __user *,
+asmlinkage long sys32_execve(const char __user *, compat_uptr_t __user *,
                             compat_uptr_t __user *, struct pt_regs *);
 asmlinkage long sys32_clone(unsigned int, unsigned int, struct pt_regs *);
 
index 5c044b4..feb2ff9 100644 (file)
@@ -23,7 +23,7 @@ long sys_iopl(unsigned int, struct pt_regs *);
 /* kernel/process.c */
 int sys_fork(struct pt_regs *);
 int sys_vfork(struct pt_regs *);
-long sys_execve(char __user *, char __user * __user *,
+long sys_execve(const char __user *, char __user * __user *,
                char __user * __user *, struct pt_regs *);
 long sys_clone(unsigned long, unsigned long, void __user *,
               void __user *, struct pt_regs *);
index aa558ac..42d412f 100644 (file)
@@ -34,6 +34,7 @@
  */
 
 #define UV_ITEMS_PER_DESCRIPTOR                8
+/* the 'throttle' to prevent the hardware stay-busy bug */
 #define MAX_BAU_CONCURRENT             3
 #define UV_CPUS_PER_ACT_STATUS         32
 #define UV_ACT_STATUS_MASK             0x3
 #define UV_DESC_BASE_PNODE_SHIFT       49
 #define UV_PAYLOADQ_PNODE_SHIFT                49
 #define UV_PTC_BASENAME                        "sgi_uv/ptc_statistics"
+#define UV_BAU_BASENAME                        "sgi_uv/bau_tunables"
+#define UV_BAU_TUNABLES_DIR            "sgi_uv"
+#define UV_BAU_TUNABLES_FILE           "bau_tunables"
+#define WHITESPACE                     " \t\n"
 #define uv_physnodeaddr(x)             ((__pa((unsigned long)(x)) & uv_mmask))
 #define UV_ENABLE_INTD_SOFT_ACK_MODE_SHIFT 15
 #define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHIFT 16
-#define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD 0x000000000bUL
+#define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD 0x0000000009UL
+/* [19:16] SOFT_ACK timeout period  19: 1 is urgency 7  17:16 1 is multiplier */
+#define BAU_MISC_CONTROL_MULT_MASK 3
+
+#define UVH_AGING_PRESCALE_SEL 0x000000b000UL
+/* [30:28] URGENCY_7  an index into a table of times */
+#define BAU_URGENCY_7_SHIFT 28
+#define BAU_URGENCY_7_MASK 7
+
+#define UVH_TRANSACTION_TIMEOUT 0x000000b200UL
+/* [45:40] BAU - BAU transaction timeout select - a multiplier */
+#define BAU_TRANS_SHIFT 40
+#define BAU_TRANS_MASK 0x3f
 
 /*
  * bits in UVH_LB_BAU_SB_ACTIVATION_STATUS_0/1
 #define DESC_STATUS_SOURCE_TIMEOUT     3
 
 /*
- * source side threshholds at which message retries print a warning
- */
-#define SOURCE_TIMEOUT_LIMIT           20
-#define DESTINATION_TIMEOUT_LIMIT      20
-
-/*
- * misc. delays, in microseconds
+ * delay for 'plugged' timeout retries, in microseconds
  */
-#define THROTTLE_DELAY                 10
-#define TIMEOUT_DELAY                  10
-#define BIOS_TO                                1000
-/* BIOS is assumed to set the destination timeout to 1003520 nanoseconds */
+#define PLUGGED_DELAY                  10
 
 /*
  * threshholds at which to use IPI to free resources
  */
+/* after this # consecutive 'plugged' timeouts, use IPI to release resources */
 #define PLUGSB4RESET 100
-#define TIMEOUTSB4RESET 100
+/* after this many consecutive timeouts, use IPI to release resources */
+#define TIMEOUTSB4RESET 1
+/* at this number uses of IPI to release resources, giveup the request */
+#define IPI_RESET_LIMIT 1
+/* after this # consecutive successes, bump up the throttle if it was lowered */
+#define COMPLETE_THRESHOLD 5
 
 /*
  * number of entries in the destination side payload queue
 #define FLUSH_COMPLETE                 4
 
 /*
+ * tuning the action when the numalink network is extremely delayed
+ */
+#define CONGESTED_RESPONSE_US 1000 /* 'long' response time, in microseconds */
+#define CONGESTED_REPS 10 /* long delays averaged over this many broadcasts */
+#define CONGESTED_PERIOD 30 /* time for the bau to be disabled, in seconds */
+
+/*
  * Distribution: 32 bytes (256 bits) (bytes 0-0x1f of descriptor)
  * If the 'multilevel' flag in the header portion of the descriptor
  * has been set to 0, then endpoint multi-unicast mode is selected.
@@ -300,37 +321,16 @@ struct bau_payload_queue_entry {
        /* bytes 24-31 */
 };
 
-/*
- * one per-cpu; to locate the software tables
- */
-struct bau_control {
-       struct bau_desc *descriptor_base;
+struct msg_desc {
+       struct bau_payload_queue_entry *msg;
+       int msg_slot;
+       int sw_ack_slot;
        struct bau_payload_queue_entry *va_queue_first;
        struct bau_payload_queue_entry *va_queue_last;
-       struct bau_payload_queue_entry *bau_msg_head;
-       struct bau_control *uvhub_master;
-       struct bau_control *socket_master;
-       unsigned long timeout_interval;
-       atomic_t active_descriptor_count;
-       int max_concurrent;
-       int max_concurrent_constant;
-       int retry_message_scans;
-       int plugged_tries;
-       int timeout_tries;
-       int ipi_attempts;
-       int conseccompletes;
-       short cpu;
-       short uvhub_cpu;
-       short uvhub;
-       short cpus_in_socket;
-       short cpus_in_uvhub;
-       unsigned short message_number;
-       unsigned short uvhub_quiesce;
-       short socket_acknowledge_count[DEST_Q_SIZE];
-       cycles_t send_message;
-       spinlock_t masks_lock;
-       spinlock_t uvhub_lock;
-       spinlock_t queue_lock;
+};
+
+struct reset_args {
+       int sender;
 };
 
 /*
@@ -344,18 +344,25 @@ struct ptc_stats {
        unsigned long s_dtimeout; /* destination side timeouts */
        unsigned long s_time; /* time spent in sending side */
        unsigned long s_retriesok; /* successful retries */
-       unsigned long s_ntargcpu; /* number of cpus targeted */
-       unsigned long s_ntarguvhub; /* number of uvhubs targeted */
-       unsigned long s_ntarguvhub16; /* number of times >= 16 target hubs */
-       unsigned long s_ntarguvhub8; /* number of times >= 8 target hubs */
-       unsigned long s_ntarguvhub4; /* number of times >= 4 target hubs */
-       unsigned long s_ntarguvhub2; /* number of times >= 2 target hubs */
-       unsigned long s_ntarguvhub1; /* number of times == 1 target hub */
+       unsigned long s_ntargcpu; /* total number of cpu's targeted */
+       unsigned long s_ntargself; /* times the sending cpu was targeted */
+       unsigned long s_ntarglocals; /* targets of cpus on the local blade */
+       unsigned long s_ntargremotes; /* targets of cpus on remote blades */
+       unsigned long s_ntarglocaluvhub; /* targets of the local hub */
+       unsigned long s_ntargremoteuvhub; /* remotes hubs targeted */
+       unsigned long s_ntarguvhub; /* total number of uvhubs targeted */
+       unsigned long s_ntarguvhub16; /* number of times target hubs >= 16*/
+       unsigned long s_ntarguvhub8; /* number of times target hubs >= 8 */
+       unsigned long s_ntarguvhub4; /* number of times target hubs >= 4 */
+       unsigned long s_ntarguvhub2; /* number of times target hubs >= 2 */
+       unsigned long s_ntarguvhub1; /* number of times target hubs == 1 */
        unsigned long s_resets_plug; /* ipi-style resets from plug state */
        unsigned long s_resets_timeout; /* ipi-style resets from timeouts */
        unsigned long s_busy; /* status stayed busy past s/w timer */
        unsigned long s_throttles; /* waits in throttle */
        unsigned long s_retry_messages; /* retry broadcasts */
+       unsigned long s_bau_reenabled; /* for bau enable/disable */
+       unsigned long s_bau_disabled; /* for bau enable/disable */
        /* destination statistics */
        unsigned long d_alltlb; /* times all tlb's on this cpu were flushed */
        unsigned long d_onetlb; /* times just one tlb on this cpu was flushed */
@@ -370,6 +377,52 @@ struct ptc_stats {
        unsigned long d_rcanceled; /* number of messages canceled by resets */
 };
 
+/*
+ * one per-cpu; to locate the software tables
+ */
+struct bau_control {
+       struct bau_desc *descriptor_base;
+       struct bau_payload_queue_entry *va_queue_first;
+       struct bau_payload_queue_entry *va_queue_last;
+       struct bau_payload_queue_entry *bau_msg_head;
+       struct bau_control *uvhub_master;
+       struct bau_control *socket_master;
+       struct ptc_stats *statp;
+       unsigned long timeout_interval;
+       unsigned long set_bau_on_time;
+       atomic_t active_descriptor_count;
+       int plugged_tries;
+       int timeout_tries;
+       int ipi_attempts;
+       int conseccompletes;
+       int baudisabled;
+       int set_bau_off;
+       short cpu;
+       short uvhub_cpu;
+       short uvhub;
+       short cpus_in_socket;
+       short cpus_in_uvhub;
+       unsigned short message_number;
+       unsigned short uvhub_quiesce;
+       short socket_acknowledge_count[DEST_Q_SIZE];
+       cycles_t send_message;
+       spinlock_t uvhub_lock;
+       spinlock_t queue_lock;
+       /* tunables */
+       int max_bau_concurrent;
+       int max_bau_concurrent_constant;
+       int plugged_delay;
+       int plugsb4reset;
+       int timeoutsb4reset;
+       int ipi_reset_limit;
+       int complete_threshold;
+       int congested_response_us;
+       int congested_reps;
+       int congested_period;
+       cycles_t period_time;
+       long period_requests;
+};
+
 static inline int bau_uvhub_isset(int uvhub, struct bau_target_uvhubmask *dstp)
 {
        return constant_test_bit(uvhub, &dstp->bits[0]);
index 980508c..e3b534c 100644 (file)
@@ -1606,7 +1606,7 @@ void __init init_apic_mappings(void)
                 * acpi lapic path already maps that address in
                 * acpi_register_lapic_address()
                 */
-               if (!acpi_lapic)
+               if (!acpi_lapic && !smp_found_config)
                        set_fixmap_nocache(FIX_APIC_BASE, apic_phys);
 
                apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n",
index e46f98f..7b598b8 100644 (file)
@@ -604,6 +604,10 @@ int uv_handle_nmi(struct notifier_block *self, unsigned long reason, void *data)
 {
        if (reason != DIE_NMI_IPI)
                return NOTIFY_OK;
+
+       if (in_crash_kexec)
+               /* do nothing if entering the crash kernel */
+               return NOTIFY_OK;
        /*
         * Use a lock so only one cpu prints at a time
         * to prevent intermixed output.
index 246cd3a..cd8da24 100644 (file)
@@ -72,7 +72,7 @@ struct acpi_cpufreq_data {
 static DEFINE_PER_CPU(struct acpi_cpufreq_data *, acfreq_data);
 
 /* acpi_perf_data is a pointer to percpu data. */
-static struct acpi_processor_performance *acpi_perf_data;
+static struct acpi_processor_performance __percpu *acpi_perf_data;
 
 static struct cpufreq_driver acpi_cpufreq_driver;
 
index 107711b..febb12c 100644 (file)
@@ -656,6 +656,7 @@ static int p4_pmu_handle_irq(struct pt_regs *regs)
        cpuc = &__get_cpu_var(cpu_hw_events);
 
        for (idx = 0; idx < x86_pmu.num_counters; idx++) {
+               int overflow;
 
                if (!test_bit(idx, cpuc->active_mask))
                        continue;
@@ -666,12 +667,14 @@ static int p4_pmu_handle_irq(struct pt_regs *regs)
                WARN_ON_ONCE(hwc->idx != idx);
 
                /* it might be unflagged overflow */
-               handled = p4_pmu_clear_cccr_ovf(hwc);
+               overflow = p4_pmu_clear_cccr_ovf(hwc);
 
                val = x86_perf_event_update(event);
-               if (!handled && (val & (1ULL << (x86_pmu.cntval_bits - 1))))
+               if (!overflow && (val & (1ULL << (x86_pmu.cntval_bits - 1))))
                        continue;
 
+               handled += overflow;
+
                /* event overflow for sure */
                data.period = event->hw.last_period;
 
@@ -687,7 +690,7 @@ static int p4_pmu_handle_irq(struct pt_regs *regs)
                inc_irq_stat(apic_perf_irqs);
        }
 
-       return handled;
+       return handled > 0;
 }
 
 /*
index ebd4c51..764c7c2 100644 (file)
@@ -28,6 +28,8 @@
 #include <asm/reboot.h>
 #include <asm/virtext.h>
 
+int in_crash_kexec;
+
 #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
 
 static void kdump_nmi_callback(int cpu, struct die_args *args)
@@ -61,6 +63,7 @@ static void kdump_nmi_callback(int cpu, struct die_args *args)
 
 static void kdump_nmi_shootdown_cpus(void)
 {
+       in_crash_kexec = 1;
        nmi_shootdown_cpus(kdump_nmi_callback);
 
        disable_local_APIC();
index c5ea5cd..17be5ec 100644 (file)
@@ -1185,13 +1185,13 @@ END(kernel_thread_helper)
  * execve(). This function needs to use IRET, not SYSRET, to set up all state properly.
  *
  * C extern interface:
- *      extern long execve(char *name, char **argv, char **envp)
+ *      extern long execve(const char *name, char **argv, char **envp)
  *
  * asm input arguments:
  *     rdi: name, rsi: argv, rdx: envp
  *
  * We want to fallback into:
- *     extern long sys_execve(char *name, char **argv,char **envp, struct pt_regs *regs)
+ *     extern long sys_execve(const char *name, char **argv,char **envp, struct pt_regs *regs)
  *
  * do_sys_execve asm fallback arguments:
  *     rdi: name, rsi: argv, rdx: envp, rcx: fake frame on the stack
index d86dbf7..d7b6f7f 100644 (file)
@@ -274,6 +274,18 @@ static void __init smp_dump_mptable(struct mpc_table *mpc, unsigned char *mpt)
 
 void __init default_smp_read_mpc_oem(struct mpc_table *mpc) { }
 
+static void __init smp_register_lapic_address(unsigned long address)
+{
+       mp_lapic_addr = address;
+
+       set_fixmap_nocache(FIX_APIC_BASE, address);
+       if (boot_cpu_physical_apicid == -1U) {
+               boot_cpu_physical_apicid  = read_apic_id();
+               apic_version[boot_cpu_physical_apicid] =
+                        GET_APIC_VERSION(apic_read(APIC_LVR));
+       }
+}
+
 static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
 {
        char str[16];
@@ -295,6 +307,10 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
        if (early)
                return 1;
 
+       /* Initialize the lapic mapping */
+       if (!acpi_lapic)
+               smp_register_lapic_address(mpc->lapic);
+
        if (mpc->oemptr)
                x86_init.mpparse.smp_read_mpc_oem(mpc);
 
index d401f1d..64ecaf0 100644 (file)
@@ -301,7 +301,7 @@ EXPORT_SYMBOL(kernel_thread);
 /*
  * sys_execve() executes a new program.
  */
-long sys_execve(char __user *name, char __user * __user *argv,
+long sys_execve(const char __user *name, char __user * __user *argv,
                char __user * __user *envp, struct pt_regs *regs)
 {
        long error;
index 7fea555..312ef02 100644 (file)
@@ -8,6 +8,7 @@
  */
 #include <linux/seq_file.h>
 #include <linux/proc_fs.h>
+#include <linux/debugfs.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 
 #include <asm/irq_vectors.h>
 #include <asm/timer.h>
 
-struct msg_desc {
-       struct bau_payload_queue_entry *msg;
-       int msg_slot;
-       int sw_ack_slot;
-       struct bau_payload_queue_entry *va_queue_first;
-       struct bau_payload_queue_entry *va_queue_last;
+/* timeouts in nanoseconds (indexed by UVH_AGING_PRESCALE_SEL urgency7 30:28) */
+static int timeout_base_ns[] = {
+               20,
+               160,
+               1280,
+               10240,
+               81920,
+               655360,
+               5242880,
+               167772160
 };
-
-#define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD        0x000000000bUL
-
-static int uv_bau_max_concurrent __read_mostly;
-
+static int timeout_us;
 static int nobau;
+static int baudisabled;
+static spinlock_t disable_lock;
+static cycles_t congested_cycles;
+
+/* tunables: */
+static int max_bau_concurrent = MAX_BAU_CONCURRENT;
+static int max_bau_concurrent_constant = MAX_BAU_CONCURRENT;
+static int plugged_delay = PLUGGED_DELAY;
+static int plugsb4reset = PLUGSB4RESET;
+static int timeoutsb4reset = TIMEOUTSB4RESET;
+static int ipi_reset_limit = IPI_RESET_LIMIT;
+static int complete_threshold = COMPLETE_THRESHOLD;
+static int congested_response_us = CONGESTED_RESPONSE_US;
+static int congested_reps = CONGESTED_REPS;
+static int congested_period = CONGESTED_PERIOD;
+static struct dentry *tunables_dir;
+static struct dentry *tunables_file;
+
 static int __init setup_nobau(char *arg)
 {
        nobau = 1;
@@ -52,10 +71,6 @@ static DEFINE_PER_CPU(struct ptc_stats, ptcstats);
 static DEFINE_PER_CPU(struct bau_control, bau_control);
 static DEFINE_PER_CPU(cpumask_var_t, uv_flush_tlb_mask);
 
-struct reset_args {
-       int sender;
-};
-
 /*
  * Determine the first node on a uvhub. 'Nodes' are used for kernel
  * memory allocation.
@@ -126,7 +141,7 @@ static inline void uv_bau_process_retry_msg(struct msg_desc *mdp,
        struct ptc_stats *stat;
 
        msg = mdp->msg;
-       stat = &per_cpu(ptcstats, bcp->cpu);
+       stat = bcp->statp;
        stat->d_retries++;
        /*
         * cancel any message from msg+1 to the retry itself
@@ -146,15 +161,14 @@ static inline void uv_bau_process_retry_msg(struct msg_desc *mdp,
                        slot2 = msg2 - mdp->va_queue_first;
                        mmr = uv_read_local_mmr
                                (UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE);
-                       msg_res = ((msg2->sw_ack_vector << 8) |
-                                  msg2->sw_ack_vector);
+                       msg_res = msg2->sw_ack_vector;
                        /*
                         * This is a message retry; clear the resources held
                         * by the previous message only if they timed out.
                         * If it has not timed out we have an unexpected
                         * situation to report.
                         */
-                       if (mmr & (msg_res << 8)) {
+                       if (mmr & (msg_res << UV_SW_ACK_NPENDING)) {
                                /*
                                 * is the resource timed out?
                                 * make everyone ignore the cancelled message.
@@ -164,9 +178,9 @@ static inline void uv_bau_process_retry_msg(struct msg_desc *mdp,
                                cancel_count++;
                                uv_write_local_mmr(
                                    UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS,
-                                       (msg_res << 8) | msg_res);
-                       } else
-                               printk(KERN_INFO "note bau retry: no effect\n");
+                                       (msg_res << UV_SW_ACK_NPENDING) |
+                                        msg_res);
+                       }
                }
        }
        if (!cancel_count)
@@ -190,7 +204,7 @@ static void uv_bau_process_message(struct msg_desc *mdp,
         * This must be a normal message, or retry of a normal message
         */
        msg = mdp->msg;
-       stat = &per_cpu(ptcstats, bcp->cpu);
+       stat = bcp->statp;
        if (msg->address == TLB_FLUSH_ALL) {
                local_flush_tlb();
                stat->d_alltlb++;
@@ -274,7 +288,7 @@ uv_do_reset(void *ptr)
 
        bcp = &per_cpu(bau_control, smp_processor_id());
        rap = (struct reset_args *)ptr;
-       stat = &per_cpu(ptcstats, bcp->cpu);
+       stat = bcp->statp;
        stat->d_resets++;
 
        /*
@@ -302,13 +316,13 @@ uv_do_reset(void *ptr)
                         */
                        mmr = uv_read_local_mmr
                                        (UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE);
-                       msg_res = ((msg->sw_ack_vector << 8) |
-                                                  msg->sw_ack_vector);
+                       msg_res = msg->sw_ack_vector;
                        if (mmr & msg_res) {
                                stat->d_rcanceled++;
                                uv_write_local_mmr(
                                    UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS,
-                                                       msg_res);
+                                       (msg_res << UV_SW_ACK_NPENDING) |
+                                        msg_res);
                        }
                }
        }
@@ -386,17 +400,12 @@ static int uv_wait_completion(struct bau_desc *bau_desc,
        unsigned long mmr_offset, int right_shift, int this_cpu,
        struct bau_control *bcp, struct bau_control *smaster, long try)
 {
-       int relaxes = 0;
        unsigned long descriptor_status;
-       unsigned long mmr;
-       unsigned long mask;
        cycles_t ttime;
-       cycles_t timeout_time;
-       struct ptc_stats *stat = &per_cpu(ptcstats, this_cpu);
+       struct ptc_stats *stat = bcp->statp;
        struct bau_control *hmaster;
 
        hmaster = bcp->uvhub_master;
-       timeout_time = get_cycles() + bcp->timeout_interval;
 
        /* spin on the status MMR, waiting for it to go idle */
        while ((descriptor_status = (((unsigned long)
@@ -423,7 +432,8 @@ static int uv_wait_completion(struct bau_desc *bau_desc,
                         * pending.  In that case hardware returns the
                         * ERROR that looks like a destination timeout.
                         */
-                       if (cycles_2_us(ttime - bcp->send_message) < BIOS_TO) {
+                       if (cycles_2_us(ttime - bcp->send_message) <
+                                                       timeout_us) {
                                bcp->conseccompletes = 0;
                                return FLUSH_RETRY_PLUGGED;
                        }
@@ -435,26 +445,6 @@ static int uv_wait_completion(struct bau_desc *bau_desc,
                         * descriptor_status is still BUSY
                         */
                        cpu_relax();
-                       relaxes++;
-                       if (relaxes >= 10000) {
-                               relaxes = 0;
-                               if (get_cycles() > timeout_time) {
-                                       quiesce_local_uvhub(hmaster);
-
-                                       /* single-thread the register change */
-                                       spin_lock(&hmaster->masks_lock);
-                                       mmr = uv_read_local_mmr(mmr_offset);
-                                       mask = 0UL;
-                                       mask |= (3UL < right_shift);
-                                       mask = ~mask;
-                                       mmr &= mask;
-                                       uv_write_local_mmr(mmr_offset, mmr);
-                                       spin_unlock(&hmaster->masks_lock);
-                                       end_uvhub_quiesce(hmaster);
-                                       stat->s_busy++;
-                                       return FLUSH_GIVEUP;
-                               }
-                       }
                }
        }
        bcp->conseccompletes++;
@@ -494,56 +484,116 @@ static inline int atomic_inc_unless_ge(spinlock_t *lock, atomic_t *v, int u)
        return 1;
 }
 
+/*
+ * Our retries are blocked by all destination swack resources being
+ * in use, and a timeout is pending. In that case hardware immediately
+ * returns the ERROR that looks like a destination timeout.
+ */
+static void
+destination_plugged(struct bau_desc *bau_desc, struct bau_control *bcp,
+                       struct bau_control *hmaster, struct ptc_stats *stat)
+{
+       udelay(bcp->plugged_delay);
+       bcp->plugged_tries++;
+       if (bcp->plugged_tries >= bcp->plugsb4reset) {
+               bcp->plugged_tries = 0;
+               quiesce_local_uvhub(hmaster);
+               spin_lock(&hmaster->queue_lock);
+               uv_reset_with_ipi(&bau_desc->distribution, bcp->cpu);
+               spin_unlock(&hmaster->queue_lock);
+               end_uvhub_quiesce(hmaster);
+               bcp->ipi_attempts++;
+               stat->s_resets_plug++;
+       }
+}
+
+static void
+destination_timeout(struct bau_desc *bau_desc, struct bau_control *bcp,
+                       struct bau_control *hmaster, struct ptc_stats *stat)
+{
+       hmaster->max_bau_concurrent = 1;
+       bcp->timeout_tries++;
+       if (bcp->timeout_tries >= bcp->timeoutsb4reset) {
+               bcp->timeout_tries = 0;
+               quiesce_local_uvhub(hmaster);
+               spin_lock(&hmaster->queue_lock);
+               uv_reset_with_ipi(&bau_desc->distribution, bcp->cpu);
+               spin_unlock(&hmaster->queue_lock);
+               end_uvhub_quiesce(hmaster);
+               bcp->ipi_attempts++;
+               stat->s_resets_timeout++;
+       }
+}
+
+/*
+ * Completions are taking a very long time due to a congested numalink
+ * network.
+ */
+static void
+disable_for_congestion(struct bau_control *bcp, struct ptc_stats *stat)
+{
+       int tcpu;
+       struct bau_control *tbcp;
+
+       /* let only one cpu do this disabling */
+       spin_lock(&disable_lock);
+       if (!baudisabled && bcp->period_requests &&
+           ((bcp->period_time / bcp->period_requests) > congested_cycles)) {
+               /* it becomes this cpu's job to turn on the use of the
+                  BAU again */
+               baudisabled = 1;
+               bcp->set_bau_off = 1;
+               bcp->set_bau_on_time = get_cycles() +
+                       sec_2_cycles(bcp->congested_period);
+               stat->s_bau_disabled++;
+               for_each_present_cpu(tcpu) {
+                       tbcp = &per_cpu(bau_control, tcpu);
+                               tbcp->baudisabled = 1;
+               }
+       }
+       spin_unlock(&disable_lock);
+}
+
 /**
  * uv_flush_send_and_wait
  *
  * Send a broadcast and wait for it to complete.
  *
- * The flush_mask contains the cpus the broadcast is to be sent to, plus
+ * The flush_mask contains the cpus the broadcast is to be sent to including
  * cpus that are on the local uvhub.
  *
- * Returns NULL if all flushing represented in the mask was done. The mask
- * is zeroed.
- * Returns @flush_mask if some remote flushing remains to be done. The
- * mask will have some bits still set, representing any cpus on the local
- * uvhub (not current cpu) and any on remote uvhubs if the broadcast failed.
+ * Returns 0 if all flushing represented in the mask was done.
+ * Returns 1 if it gives up entirely and the original cpu mask is to be
+ * returned to the kernel.
  */
-const struct cpumask *uv_flush_send_and_wait(struct bau_desc *bau_desc,
-                                            struct cpumask *flush_mask,
-                                            struct bau_control *bcp)
+int uv_flush_send_and_wait(struct bau_desc *bau_desc,
+                          struct cpumask *flush_mask, struct bau_control *bcp)
 {
        int right_shift;
-       int uvhub;
-       int bit;
        int completion_status = 0;
        int seq_number = 0;
        long try = 0;
        int cpu = bcp->uvhub_cpu;
        int this_cpu = bcp->cpu;
-       int this_uvhub = bcp->uvhub;
        unsigned long mmr_offset;
        unsigned long index;
        cycles_t time1;
        cycles_t time2;
-       struct ptc_stats *stat = &per_cpu(ptcstats, bcp->cpu);
+       cycles_t elapsed;
+       struct ptc_stats *stat = bcp->statp;
        struct bau_control *smaster = bcp->socket_master;
        struct bau_control *hmaster = bcp->uvhub_master;
 
-       /*
-        * Spin here while there are hmaster->max_concurrent or more active
-        * descriptors. This is the per-uvhub 'throttle'.
-        */
        if (!atomic_inc_unless_ge(&hmaster->uvhub_lock,
                        &hmaster->active_descriptor_count,
-                       hmaster->max_concurrent)) {
+                       hmaster->max_bau_concurrent)) {
                stat->s_throttles++;
                do {
                        cpu_relax();
                } while (!atomic_inc_unless_ge(&hmaster->uvhub_lock,
                        &hmaster->active_descriptor_count,
-                       hmaster->max_concurrent));
+                       hmaster->max_bau_concurrent));
        }
-
        while (hmaster->uvhub_quiesce)
                cpu_relax();
 
@@ -557,23 +607,10 @@ const struct cpumask *uv_flush_send_and_wait(struct bau_desc *bau_desc,
        }
        time1 = get_cycles();
        do {
-               /*
-                * Every message from any given cpu gets a unique message
-                * sequence number. But retries use that same number.
-                * Our message may have timed out at the destination because
-                * all sw-ack resources are in use and there is a timeout
-                * pending there.  In that case, our last send never got
-                * placed into the queue and we need to persist until it
-                * does.
-                *
-                * Make any retry a type MSG_RETRY so that the destination will
-                * free any resource held by a previous message from this cpu.
-                */
                if (try == 0) {
-                       /* use message type set by the caller the first time */
+                       bau_desc->header.msg_type = MSG_REGULAR;
                        seq_number = bcp->message_number++;
                } else {
-                       /* use RETRY type on all the rest; same sequence */
                        bau_desc->header.msg_type = MSG_RETRY;
                        stat->s_retry_messages++;
                }
@@ -581,50 +618,17 @@ const struct cpumask *uv_flush_send_and_wait(struct bau_desc *bau_desc,
                index = (1UL << UVH_LB_BAU_SB_ACTIVATION_CONTROL_PUSH_SHFT) |
                        bcp->uvhub_cpu;
                bcp->send_message = get_cycles();
-
                uv_write_local_mmr(UVH_LB_BAU_SB_ACTIVATION_CONTROL, index);
-
                try++;
                completion_status = uv_wait_completion(bau_desc, mmr_offset,
                        right_shift, this_cpu, bcp, smaster, try);
 
                if (completion_status == FLUSH_RETRY_PLUGGED) {
-                       /*
-                        * Our retries may be blocked by all destination swack
-                        * resources being consumed, and a timeout pending. In
-                        * that case hardware immediately returns the ERROR
-                        * that looks like a destination timeout.
-                        */
-                       udelay(TIMEOUT_DELAY);
-                       bcp->plugged_tries++;
-                       if (bcp->plugged_tries >= PLUGSB4RESET) {
-                               bcp->plugged_tries = 0;
-                               quiesce_local_uvhub(hmaster);
-                               spin_lock(&hmaster->queue_lock);
-                               uv_reset_with_ipi(&bau_desc->distribution,
-                                                       this_cpu);
-                               spin_unlock(&hmaster->queue_lock);
-                               end_uvhub_quiesce(hmaster);
-                               bcp->ipi_attempts++;
-                               stat->s_resets_plug++;
-                       }
+                       destination_plugged(bau_desc, bcp, hmaster, stat);
                } else if (completion_status == FLUSH_RETRY_TIMEOUT) {
-                       hmaster->max_concurrent = 1;
-                       bcp->timeout_tries++;
-                       udelay(TIMEOUT_DELAY);
-                       if (bcp->timeout_tries >= TIMEOUTSB4RESET) {
-                               bcp->timeout_tries = 0;
-                               quiesce_local_uvhub(hmaster);
-                               spin_lock(&hmaster->queue_lock);
-                               uv_reset_with_ipi(&bau_desc->distribution,
-                                                               this_cpu);
-                               spin_unlock(&hmaster->queue_lock);
-                               end_uvhub_quiesce(hmaster);
-                               bcp->ipi_attempts++;
-                               stat->s_resets_timeout++;
-                       }
+                       destination_timeout(bau_desc, bcp, hmaster, stat);
                }
-               if (bcp->ipi_attempts >= 3) {
+               if (bcp->ipi_attempts >= bcp->ipi_reset_limit) {
                        bcp->ipi_attempts = 0;
                        completion_status = FLUSH_GIVEUP;
                        break;
@@ -633,49 +637,36 @@ const struct cpumask *uv_flush_send_and_wait(struct bau_desc *bau_desc,
        } while ((completion_status == FLUSH_RETRY_PLUGGED) ||
                 (completion_status == FLUSH_RETRY_TIMEOUT));
        time2 = get_cycles();
-
-       if ((completion_status == FLUSH_COMPLETE) && (bcp->conseccompletes > 5)
-           && (hmaster->max_concurrent < hmaster->max_concurrent_constant))
-                       hmaster->max_concurrent++;
-
-       /*
-        * hold any cpu not timing out here; no other cpu currently held by
-        * the 'throttle' should enter the activation code
-        */
+       bcp->plugged_tries = 0;
+       bcp->timeout_tries = 0;
+       if ((completion_status == FLUSH_COMPLETE) &&
+           (bcp->conseccompletes > bcp->complete_threshold) &&
+           (hmaster->max_bau_concurrent <
+                                       hmaster->max_bau_concurrent_constant))
+                       hmaster->max_bau_concurrent++;
        while (hmaster->uvhub_quiesce)
                cpu_relax();
        atomic_dec(&hmaster->active_descriptor_count);
-
-       /* guard against cycles wrap */
-       if (time2 > time1)
-               stat->s_time += (time2 - time1);
-       else
-               stat->s_requestor--; /* don't count this one */
+       if (time2 > time1) {
+               elapsed = time2 - time1;
+               stat->s_time += elapsed;
+               if ((completion_status == FLUSH_COMPLETE) && (try == 1)) {
+                       bcp->period_requests++;
+                       bcp->period_time += elapsed;
+                       if ((elapsed > congested_cycles) &&
+                           (bcp->period_requests > bcp->congested_reps)) {
+                               disable_for_congestion(bcp, stat);
+                       }
+               }
+       } else
+               stat->s_requestor--;
        if (completion_status == FLUSH_COMPLETE && try > 1)
                stat->s_retriesok++;
        else if (completion_status == FLUSH_GIVEUP) {
-               /*
-                * Cause the caller to do an IPI-style TLB shootdown on
-                * the target cpu's, all of which are still in the mask.
-                */
                stat->s_giveup++;
-               return flush_mask;
-       }
-
-       /*
-        * Success, so clear the remote cpu's from the mask so we don't
-        * use the IPI method of shootdown on them.
-        */
-       for_each_cpu(bit, flush_mask) {
-               uvhub = uv_cpu_to_blade_id(bit);
-               if (uvhub == this_uvhub)
-                       continue;
-               cpumask_clear_cpu(bit, flush_mask);
+               return 1;
        }
-       if (!cpumask_empty(flush_mask))
-               return flush_mask;
-
-       return NULL;
+       return 0;
 }
 
 /**
@@ -707,70 +698,89 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
                                          struct mm_struct *mm,
                                          unsigned long va, unsigned int cpu)
 {
-       int remotes;
        int tcpu;
        int uvhub;
        int locals = 0;
+       int remotes = 0;
+       int hubs = 0;
        struct bau_desc *bau_desc;
        struct cpumask *flush_mask;
        struct ptc_stats *stat;
        struct bau_control *bcp;
+       struct bau_control *tbcp;
 
+       /* kernel was booted 'nobau' */
        if (nobau)
                return cpumask;
 
        bcp = &per_cpu(bau_control, cpu);
+       stat = bcp->statp;
+
+       /* bau was disabled due to slow response */
+       if (bcp->baudisabled) {
+               /* the cpu that disabled it must re-enable it */
+               if (bcp->set_bau_off) {
+                       if (get_cycles() >= bcp->set_bau_on_time) {
+                               stat->s_bau_reenabled++;
+                               baudisabled = 0;
+                               for_each_present_cpu(tcpu) {
+                                       tbcp = &per_cpu(bau_control, tcpu);
+                                       tbcp->baudisabled = 0;
+                                       tbcp->period_requests = 0;
+                                       tbcp->period_time = 0;
+                               }
+                       }
+               }
+               return cpumask;
+       }
+
        /*
         * Each sending cpu has a per-cpu mask which it fills from the caller's
-        * cpu mask.  Only remote cpus are converted to uvhubs and copied.
+        * cpu mask.  All cpus are converted to uvhubs and copied to the
+        * activation descriptor.
         */
        flush_mask = (struct cpumask *)per_cpu(uv_flush_tlb_mask, cpu);
-       /*
-        * copy cpumask to flush_mask, removing current cpu
-        * (current cpu should already have been flushed by the caller and
-        *  should never be returned if we return flush_mask)
-        */
+       /* don't actually do a shootdown of the local cpu */
        cpumask_andnot(flush_mask, cpumask, cpumask_of(cpu));
        if (cpu_isset(cpu, *cpumask))
-               locals++;  /* current cpu was targeted */
+               stat->s_ntargself++;
 
        bau_desc = bcp->descriptor_base;
        bau_desc += UV_ITEMS_PER_DESCRIPTOR * bcp->uvhub_cpu;
-
        bau_uvhubs_clear(&bau_desc->distribution, UV_DISTRIBUTION_SIZE);
-       remotes = 0;
+
+       /* cpu statistics */
        for_each_cpu(tcpu, flush_mask) {
                uvhub = uv_cpu_to_blade_id(tcpu);
-               if (uvhub == bcp->uvhub) {
-                       locals++;
-                       continue;
-               }
                bau_uvhub_set(uvhub, &bau_desc->distribution);
-               remotes++;
-       }
-       if (remotes == 0) {
-               /*
-                * No off_hub flushing; return status for local hub.
-                * Return the caller's mask if all were local (the current
-                * cpu may be in that mask).
-                */
-               if (locals)
-                       return cpumask;
+               if (uvhub == bcp->uvhub)
+                       locals++;
                else
-                       return NULL;
+                       remotes++;
        }
-       stat = &per_cpu(ptcstats, cpu);
+       if ((locals + remotes) == 0)
+               return NULL;
        stat->s_requestor++;
-       stat->s_ntargcpu += remotes;
+       stat->s_ntargcpu += remotes + locals;
+       stat->s_ntargremotes += remotes;
+       stat->s_ntarglocals += locals;
        remotes = bau_uvhub_weight(&bau_desc->distribution);
-       stat->s_ntarguvhub += remotes;
-       if (remotes >= 16)
+
+       /* uvhub statistics */
+       hubs = bau_uvhub_weight(&bau_desc->distribution);
+       if (locals) {
+               stat->s_ntarglocaluvhub++;
+               stat->s_ntargremoteuvhub += (hubs - 1);
+       } else
+               stat->s_ntargremoteuvhub += hubs;
+       stat->s_ntarguvhub += hubs;
+       if (hubs >= 16)
                stat->s_ntarguvhub16++;
-       else if (remotes >= 8)
+       else if (hubs >= 8)
                stat->s_ntarguvhub8++;
-       else if (remotes >= 4)
+       else if (hubs >= 4)
                stat->s_ntarguvhub4++;
-       else if (remotes >= 2)
+       else if (hubs >= 2)
                stat->s_ntarguvhub2++;
        else
                stat->s_ntarguvhub1++;
@@ -779,10 +789,13 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
        bau_desc->payload.sending_cpu = cpu;
 
        /*
-        * uv_flush_send_and_wait returns null if all cpu's were messaged, or
-        * the adjusted flush_mask if any cpu's were not messaged.
+        * uv_flush_send_and_wait returns 0 if all cpu's were messaged,
+        * or 1 if it gave up and the original cpumask should be returned.
         */
-       return uv_flush_send_and_wait(bau_desc, flush_mask, bcp);
+       if (!uv_flush_send_and_wait(bau_desc, flush_mask, bcp))
+               return NULL;
+       else
+               return cpumask;
 }
 
 /*
@@ -810,7 +823,7 @@ void uv_bau_message_interrupt(struct pt_regs *regs)
 
        time_start = get_cycles();
        bcp = &per_cpu(bau_control, smp_processor_id());
-       stat = &per_cpu(ptcstats, smp_processor_id());
+       stat = bcp->statp;
        msgdesc.va_queue_first = bcp->va_queue_first;
        msgdesc.va_queue_last = bcp->va_queue_last;
        msg = bcp->bau_msg_head;
@@ -908,12 +921,12 @@ static void uv_ptc_seq_stop(struct seq_file *file, void *data)
 }
 
 static inline unsigned long long
-millisec_2_cycles(unsigned long millisec)
+microsec_2_cycles(unsigned long microsec)
 {
        unsigned long ns;
        unsigned long long cyc;
 
-       ns = millisec * 1000;
+       ns = microsec * 1000;
        cyc = (ns << CYC2NS_SCALE_FACTOR)/(per_cpu(cyc2ns, smp_processor_id()));
        return cyc;
 }
@@ -931,15 +944,19 @@ static int uv_ptc_seq_show(struct seq_file *file, void *data)
 
        if (!cpu) {
                seq_printf(file,
-                       "# cpu sent stime numuvhubs numuvhubs16 numuvhubs8 ");
+                       "# cpu sent stime self locals remotes ncpus localhub ");
+               seq_printf(file,
+                       "remotehub numuvhubs numuvhubs16 numuvhubs8 ");
                seq_printf(file,
-                       "numuvhubs4 numuvhubs2 numuvhubs1 numcpus dto ");
+                       "numuvhubs4 numuvhubs2 numuvhubs1 dto ");
                seq_printf(file,
                        "retries rok resetp resett giveup sto bz throt ");
                seq_printf(file,
                        "sw_ack recv rtime all ");
                seq_printf(file,
-                       "one mult none retry canc nocan reset rcan\n");
+                       "one mult none retry canc nocan reset rcan ");
+               seq_printf(file,
+                       "disable enable\n");
        }
        if (cpu < num_possible_cpus() && cpu_online(cpu)) {
                stat = &per_cpu(ptcstats, cpu);
@@ -947,18 +964,23 @@ static int uv_ptc_seq_show(struct seq_file *file, void *data)
                seq_printf(file,
                        "cpu %d %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld ",
                           cpu, stat->s_requestor, cycles_2_us(stat->s_time),
-                          stat->s_ntarguvhub, stat->s_ntarguvhub16,
+                          stat->s_ntargself, stat->s_ntarglocals,
+                          stat->s_ntargremotes, stat->s_ntargcpu,
+                          stat->s_ntarglocaluvhub, stat->s_ntargremoteuvhub,
+                          stat->s_ntarguvhub, stat->s_ntarguvhub16);
+               seq_printf(file, "%ld %ld %ld %ld %ld ",
                           stat->s_ntarguvhub8, stat->s_ntarguvhub4,
                           stat->s_ntarguvhub2, stat->s_ntarguvhub1,
-                          stat->s_ntargcpu, stat->s_dtimeout);
+                          stat->s_dtimeout);
                seq_printf(file, "%ld %ld %ld %ld %ld %ld %ld %ld ",
                           stat->s_retry_messages, stat->s_retriesok,
                           stat->s_resets_plug, stat->s_resets_timeout,
                           stat->s_giveup, stat->s_stimeout,
                           stat->s_busy, stat->s_throttles);
+
                /* destination side statistics */
                seq_printf(file,
-                          "%lx %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n",
+                          "%lx %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld ",
                           uv_read_global_mmr64(uv_cpu_to_pnode(cpu),
                                        UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE),
                           stat->d_requestee, cycles_2_us(stat->d_time),
@@ -966,15 +988,36 @@ static int uv_ptc_seq_show(struct seq_file *file, void *data)
                           stat->d_nomsg, stat->d_retries, stat->d_canceled,
                           stat->d_nocanceled, stat->d_resets,
                           stat->d_rcanceled);
+               seq_printf(file, "%ld %ld\n",
+                       stat->s_bau_disabled, stat->s_bau_reenabled);
        }
 
        return 0;
 }
 
 /*
+ * Display the tunables thru debugfs
+ */
+static ssize_t tunables_read(struct file *file, char __user *userbuf,
+                                               size_t count, loff_t *ppos)
+{
+       char buf[300];
+       int ret;
+
+       ret = snprintf(buf, 300, "%s %s %s\n%d %d %d %d %d %d %d %d %d\n",
+               "max_bau_concurrent plugged_delay plugsb4reset",
+               "timeoutsb4reset ipi_reset_limit complete_threshold",
+               "congested_response_us congested_reps congested_period",
+               max_bau_concurrent, plugged_delay, plugsb4reset,
+               timeoutsb4reset, ipi_reset_limit, complete_threshold,
+               congested_response_us, congested_reps, congested_period);
+
+       return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
+}
+
+/*
  * -1: resetf the statistics
  *  0: display meaning of the statistics
- * >0: maximum concurrent active descriptors per uvhub (throttle)
  */
 static ssize_t uv_ptc_proc_write(struct file *file, const char __user *user,
                                 size_t count, loff_t *data)
@@ -983,7 +1026,6 @@ static ssize_t uv_ptc_proc_write(struct file *file, const char __user *user,
        long input_arg;
        char optstr[64];
        struct ptc_stats *stat;
-       struct bau_control *bcp;
 
        if (count == 0 || count > sizeof(optstr))
                return -EINVAL;
@@ -1059,29 +1101,158 @@ static ssize_t uv_ptc_proc_write(struct file *file, const char __user *user,
                "reset:    number of ipi-style reset requests processed\n");
                printk(KERN_DEBUG
                "rcan:     number messages canceled by reset requests\n");
+               printk(KERN_DEBUG
+               "disable:  number times use of the BAU was disabled\n");
+               printk(KERN_DEBUG
+               "enable:   number times use of the BAU was re-enabled\n");
        } else if (input_arg == -1) {
                for_each_present_cpu(cpu) {
                        stat = &per_cpu(ptcstats, cpu);
                        memset(stat, 0, sizeof(struct ptc_stats));
                }
-       } else {
-               uv_bau_max_concurrent = input_arg;
-               bcp = &per_cpu(bau_control, smp_processor_id());
-               if (uv_bau_max_concurrent < 1 ||
-                   uv_bau_max_concurrent > bcp->cpus_in_uvhub) {
-                       printk(KERN_DEBUG
-                               "Error: BAU max concurrent %d; %d is invalid\n",
-                               bcp->max_concurrent, uv_bau_max_concurrent);
-                       return -EINVAL;
-               }
-               printk(KERN_DEBUG "Set BAU max concurrent:%d\n",
-                      uv_bau_max_concurrent);
-               for_each_present_cpu(cpu) {
-                       bcp = &per_cpu(bau_control, cpu);
-                       bcp->max_concurrent = uv_bau_max_concurrent;
+       }
+
+       return count;
+}
+
+static int local_atoi(const char *name)
+{
+       int val = 0;
+
+       for (;; name++) {
+               switch (*name) {
+               case '0' ... '9':
+                       val = 10*val+(*name-'0');
+                       break;
+               default:
+                       return val;
                }
        }
+}
+
+/*
+ * set the tunables
+ * 0 values reset them to defaults
+ */
+static ssize_t tunables_write(struct file *file, const char __user *user,
+                                size_t count, loff_t *data)
+{
+       int cpu;
+       int cnt = 0;
+       int val;
+       char *p;
+       char *q;
+       char instr[64];
+       struct bau_control *bcp;
+
+       if (count == 0 || count > sizeof(instr)-1)
+               return -EINVAL;
+       if (copy_from_user(instr, user, count))
+               return -EFAULT;
 
+       instr[count] = '\0';
+       /* count the fields */
+       p = instr + strspn(instr, WHITESPACE);
+       q = p;
+       for (; *p; p = q + strspn(q, WHITESPACE)) {
+               q = p + strcspn(p, WHITESPACE);
+               cnt++;
+               if (q == p)
+                       break;
+       }
+       if (cnt != 9) {
+               printk(KERN_INFO "bau tunable error: should be 9 numbers\n");
+               return -EINVAL;
+       }
+
+       p = instr + strspn(instr, WHITESPACE);
+       q = p;
+       for (cnt = 0; *p; p = q + strspn(q, WHITESPACE), cnt++) {
+               q = p + strcspn(p, WHITESPACE);
+               val = local_atoi(p);
+               switch (cnt) {
+               case 0:
+                       if (val == 0) {
+                               max_bau_concurrent = MAX_BAU_CONCURRENT;
+                               max_bau_concurrent_constant =
+                                                       MAX_BAU_CONCURRENT;
+                               continue;
+                       }
+                       bcp = &per_cpu(bau_control, smp_processor_id());
+                       if (val < 1 || val > bcp->cpus_in_uvhub) {
+                               printk(KERN_DEBUG
+                               "Error: BAU max concurrent %d is invalid\n",
+                               val);
+                               return -EINVAL;
+                       }
+                       max_bau_concurrent = val;
+                       max_bau_concurrent_constant = val;
+                       continue;
+               case 1:
+                       if (val == 0)
+                               plugged_delay = PLUGGED_DELAY;
+                       else
+                               plugged_delay = val;
+                       continue;
+               case 2:
+                       if (val == 0)
+                               plugsb4reset = PLUGSB4RESET;
+                       else
+                               plugsb4reset = val;
+                       continue;
+               case 3:
+                       if (val == 0)
+                               timeoutsb4reset = TIMEOUTSB4RESET;
+                       else
+                               timeoutsb4reset = val;
+                       continue;
+               case 4:
+                       if (val == 0)
+                               ipi_reset_limit = IPI_RESET_LIMIT;
+                       else
+                               ipi_reset_limit = val;
+                       continue;
+               case 5:
+                       if (val == 0)
+                               complete_threshold = COMPLETE_THRESHOLD;
+                       else
+                               complete_threshold = val;
+                       continue;
+               case 6:
+                       if (val == 0)
+                               congested_response_us = CONGESTED_RESPONSE_US;
+                       else
+                               congested_response_us = val;
+                       continue;
+               case 7:
+                       if (val == 0)
+                               congested_reps = CONGESTED_REPS;
+                       else
+                               congested_reps = val;
+                       continue;
+               case 8:
+                       if (val == 0)
+                               congested_period = CONGESTED_PERIOD;
+                       else
+                               congested_period = val;
+                       continue;
+               }
+               if (q == p)
+                       break;
+       }
+       for_each_present_cpu(cpu) {
+               bcp = &per_cpu(bau_control, cpu);
+               bcp->max_bau_concurrent = max_bau_concurrent;
+               bcp->max_bau_concurrent_constant = max_bau_concurrent;
+               bcp->plugged_delay = plugged_delay;
+               bcp->plugsb4reset = plugsb4reset;
+               bcp->timeoutsb4reset = timeoutsb4reset;
+               bcp->ipi_reset_limit = ipi_reset_limit;
+               bcp->complete_threshold = complete_threshold;
+               bcp->congested_response_us = congested_response_us;
+               bcp->congested_reps = congested_reps;
+               bcp->congested_period = congested_period;
+       }
        return count;
 }
 
@@ -1097,6 +1268,11 @@ static int uv_ptc_proc_open(struct inode *inode, struct file *file)
        return seq_open(file, &uv_ptc_seq_ops);
 }
 
+static int tunables_open(struct inode *inode, struct file *file)
+{
+       return 0;
+}
+
 static const struct file_operations proc_uv_ptc_operations = {
        .open           = uv_ptc_proc_open,
        .read           = seq_read,
@@ -1105,6 +1281,12 @@ static const struct file_operations proc_uv_ptc_operations = {
        .release        = seq_release,
 };
 
+static const struct file_operations tunables_fops = {
+       .open           = tunables_open,
+       .read           = tunables_read,
+       .write          = tunables_write,
+};
+
 static int __init uv_ptc_init(void)
 {
        struct proc_dir_entry *proc_uv_ptc;
@@ -1119,6 +1301,20 @@ static int __init uv_ptc_init(void)
                       UV_PTC_BASENAME);
                return -EINVAL;
        }
+
+       tunables_dir = debugfs_create_dir(UV_BAU_TUNABLES_DIR, NULL);
+       if (!tunables_dir) {
+               printk(KERN_ERR "unable to create debugfs directory %s\n",
+                      UV_BAU_TUNABLES_DIR);
+               return -EINVAL;
+       }
+       tunables_file = debugfs_create_file(UV_BAU_TUNABLES_FILE, 0600,
+                       tunables_dir, NULL, &tunables_fops);
+       if (!tunables_file) {
+               printk(KERN_ERR "unable to create debugfs file %s\n",
+                      UV_BAU_TUNABLES_FILE);
+               return -EINVAL;
+       }
        return 0;
 }
 
@@ -1259,15 +1455,45 @@ static void __init uv_init_uvhub(int uvhub, int vector)
 }
 
 /*
+ * We will set BAU_MISC_CONTROL with a timeout period.
+ * But the BIOS has set UVH_AGING_PRESCALE_SEL and UVH_TRANSACTION_TIMEOUT.
+ * So the destination timeout period has be be calculated from them.
+ */
+static int
+calculate_destination_timeout(void)
+{
+       unsigned long mmr_image;
+       int mult1;
+       int mult2;
+       int index;
+       int base;
+       int ret;
+       unsigned long ts_ns;
+
+       mult1 = UV_INTD_SOFT_ACK_TIMEOUT_PERIOD & BAU_MISC_CONTROL_MULT_MASK;
+       mmr_image = uv_read_local_mmr(UVH_AGING_PRESCALE_SEL);
+       index = (mmr_image >> BAU_URGENCY_7_SHIFT) & BAU_URGENCY_7_MASK;
+       mmr_image = uv_read_local_mmr(UVH_TRANSACTION_TIMEOUT);
+       mult2 = (mmr_image >> BAU_TRANS_SHIFT) & BAU_TRANS_MASK;
+       base = timeout_base_ns[index];
+       ts_ns = base * mult1 * mult2;
+       ret = ts_ns / 1000;
+       return ret;
+}
+
+/*
  * initialize the bau_control structure for each cpu
  */
-static void uv_init_per_cpu(int nuvhubs)
+static void __init uv_init_per_cpu(int nuvhubs)
 {
-       int i, j, k;
+       int i;
        int cpu;
        int pnode;
        int uvhub;
+       int have_hmaster;
        short socket = 0;
+       unsigned short socket_mask;
+       unsigned char *uvhub_mask;
        struct bau_control *bcp;
        struct uvhub_desc *bdp;
        struct socket_desc *sdp;
@@ -1278,7 +1504,7 @@ static void uv_init_per_cpu(int nuvhubs)
                short cpu_number[16];
        };
        struct uvhub_desc {
-               short num_sockets;
+               unsigned short socket_mask;
                short num_cpus;
                short uvhub;
                short pnode;
@@ -1286,57 +1512,84 @@ static void uv_init_per_cpu(int nuvhubs)
        };
        struct uvhub_desc *uvhub_descs;
 
+       timeout_us = calculate_destination_timeout();
+
        uvhub_descs = (struct uvhub_desc *)
                kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
        memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
+       uvhub_mask = kzalloc((nuvhubs+7)/8, GFP_KERNEL);
        for_each_present_cpu(cpu) {
                bcp = &per_cpu(bau_control, cpu);
                memset(bcp, 0, sizeof(struct bau_control));
-               spin_lock_init(&bcp->masks_lock);
-               bcp->max_concurrent = uv_bau_max_concurrent;
                pnode = uv_cpu_hub_info(cpu)->pnode;
                uvhub = uv_cpu_hub_info(cpu)->numa_blade_id;
+               *(uvhub_mask + (uvhub/8)) |= (1 << (uvhub%8));
                bdp = &uvhub_descs[uvhub];
                bdp->num_cpus++;
                bdp->uvhub = uvhub;
                bdp->pnode = pnode;
-               /* time interval to catch a hardware stay-busy bug */
-               bcp->timeout_interval = millisec_2_cycles(3);
-               /* kludge: assume uv_hub.h is constant */
-               socket = (cpu_physical_id(cpu)>>5)&1;
-               if (socket >= bdp->num_sockets)
-                       bdp->num_sockets = socket+1;
+               /* kludge: 'assuming' one node per socket, and assuming that
+                  disabling a socket just leaves a gap in node numbers */
+               socket = (cpu_to_node(cpu) & 1);
+               bdp->socket_mask |= (1 << socket);
                sdp = &bdp->socket[socket];
                sdp->cpu_number[sdp->num_cpus] = cpu;
                sdp->num_cpus++;
        }
-       socket = 0;
-       for_each_possible_blade(uvhub) {
+       for (uvhub = 0; uvhub < nuvhubs; uvhub++) {
+               if (!(*(uvhub_mask + (uvhub/8)) & (1 << (uvhub%8))))
+                       continue;
+               have_hmaster = 0;
                bdp = &uvhub_descs[uvhub];
-               for (i = 0; i < bdp->num_sockets; i++) {
-                       sdp = &bdp->socket[i];
-                       for (j = 0; j < sdp->num_cpus; j++) {
-                               cpu = sdp->cpu_number[j];
+               socket_mask = bdp->socket_mask;
+               socket = 0;
+               while (socket_mask) {
+                       if (!(socket_mask & 1))
+                               goto nextsocket;
+                       sdp = &bdp->socket[socket];
+                       for (i = 0; i < sdp->num_cpus; i++) {
+                               cpu = sdp->cpu_number[i];
                                bcp = &per_cpu(bau_control, cpu);
                                bcp->cpu = cpu;
-                               if (j == 0) {
+                               if (i == 0) {
                                        smaster = bcp;
-                                       if (i == 0)
+                                       if (!have_hmaster) {
+                                               have_hmaster++;
                                                hmaster = bcp;
+                                       }
                                }
                                bcp->cpus_in_uvhub = bdp->num_cpus;
                                bcp->cpus_in_socket = sdp->num_cpus;
                                bcp->socket_master = smaster;
+                               bcp->uvhub = bdp->uvhub;
                                bcp->uvhub_master = hmaster;
-                               for (k = 0; k < DEST_Q_SIZE; k++)
-                                       bcp->socket_acknowledge_count[k] = 0;
-                               bcp->uvhub_cpu =
-                                 uv_cpu_hub_info(cpu)->blade_processor_id;
+                               bcp->uvhub_cpu = uv_cpu_hub_info(cpu)->
+                                               blade_processor_id;
                        }
+nextsocket:
                        socket++;
+                       socket_mask = (socket_mask >> 1);
                }
        }
        kfree(uvhub_descs);
+       kfree(uvhub_mask);
+       for_each_present_cpu(cpu) {
+               bcp = &per_cpu(bau_control, cpu);
+               bcp->baudisabled = 0;
+               bcp->statp = &per_cpu(ptcstats, cpu);
+               /* time interval to catch a hardware stay-busy bug */
+               bcp->timeout_interval = microsec_2_cycles(2*timeout_us);
+               bcp->max_bau_concurrent = max_bau_concurrent;
+               bcp->max_bau_concurrent_constant = max_bau_concurrent;
+               bcp->plugged_delay = plugged_delay;
+               bcp->plugsb4reset = plugsb4reset;
+               bcp->timeoutsb4reset = timeoutsb4reset;
+               bcp->ipi_reset_limit = ipi_reset_limit;
+               bcp->complete_threshold = complete_threshold;
+               bcp->congested_response_us = congested_response_us;
+               bcp->congested_reps = congested_reps;
+               bcp->congested_period = congested_period;
+       }
 }
 
 /*
@@ -1361,10 +1614,11 @@ static int __init uv_bau_init(void)
                zalloc_cpumask_var_node(&per_cpu(uv_flush_tlb_mask, cur_cpu),
                                       GFP_KERNEL, cpu_to_node(cur_cpu));
 
-       uv_bau_max_concurrent = MAX_BAU_CONCURRENT;
        uv_nshift = uv_hub_info->m_val;
        uv_mmask = (1UL << uv_hub_info->m_val) - 1;
        nuvhubs = uv_num_possible_blades();
+       spin_lock_init(&disable_lock);
+       congested_cycles = microsec_2_cycles(congested_response_us);
 
        uv_init_per_cpu(nuvhubs);
 
@@ -1383,15 +1637,19 @@ static int __init uv_bau_init(void)
        alloc_intr_gate(vector, uv_bau_message_intr1);
 
        for_each_possible_blade(uvhub) {
-               pnode = uv_blade_to_pnode(uvhub);
-               /* INIT the bau */
-               uv_write_global_mmr64(pnode, UVH_LB_BAU_SB_ACTIVATION_CONTROL,
-                                     ((unsigned long)1 << 63));
-               mmr = 1; /* should be 1 to broadcast to both sockets */
-               uv_write_global_mmr64(pnode, UVH_BAU_DATA_BROADCAST, mmr);
+               if (uv_blade_nr_possible_cpus(uvhub)) {
+                       pnode = uv_blade_to_pnode(uvhub);
+                       /* INIT the bau */
+                       uv_write_global_mmr64(pnode,
+                                       UVH_LB_BAU_SB_ACTIVATION_CONTROL,
+                                       ((unsigned long)1 << 63));
+                       mmr = 1; /* should be 1 to broadcast to both sockets */
+                       uv_write_global_mmr64(pnode, UVH_BAU_DATA_BROADCAST,
+                                               mmr);
+               }
        }
 
        return 0;
 }
 core_initcall(uv_bau_init);
-core_initcall(uv_ptc_init);
+fs_initcall(uv_ptc_init);
index 4a5979a..2cda60a 100644 (file)
        CFI_ADJUST_CFA_OFFSET -4
 .endm
 
-.macro BEGIN func reg
-$v = \reg
-
-ENTRY(atomic64_\func\()_386)
-       CFI_STARTPROC
-       LOCK $v
-
-.macro RETURN
-       UNLOCK $v
+#define BEGIN(op) \
+.macro endp; \
+       CFI_ENDPROC; \
+ENDPROC(atomic64_##op##_386); \
+.purgem endp; \
+.endm; \
+ENTRY(atomic64_##op##_386); \
+       CFI_STARTPROC; \
+       LOCK v;
+
+#define ENDP endp
+
+#define RET \
+       UNLOCK v; \
        ret
-.endm
-
-.macro END_
-       CFI_ENDPROC
-ENDPROC(atomic64_\func\()_386)
-.purgem RETURN
-.purgem END_
-.purgem END
-.endm
-
-.macro END
-RETURN
-END_
-.endm
-.endm
 
-BEGIN read %ecx
-       movl  ($v), %eax
-       movl 4($v), %edx
-END
-
-BEGIN set %esi
-       movl %ebx,  ($v)
-       movl %ecx, 4($v)
-END
-
-BEGIN xchg %esi
-       movl  ($v), %eax
-       movl 4($v), %edx
-       movl %ebx,  ($v)
-       movl %ecx, 4($v)
-END
-
-BEGIN add %ecx
-       addl %eax,  ($v)
-       adcl %edx, 4($v)
-END
-
-BEGIN add_return %ecx
-       addl  ($v), %eax
-       adcl 4($v), %edx
-       movl %eax,  ($v)
-       movl %edx, 4($v)
-END
-
-BEGIN sub %ecx
-       subl %eax,  ($v)
-       sbbl %edx, 4($v)
-END
-
-BEGIN sub_return %ecx
+#define RET_ENDP \
+       RET; \
+       ENDP
+
+#define v %ecx
+BEGIN(read)
+       movl  (v), %eax
+       movl 4(v), %edx
+RET_ENDP
+#undef v
+
+#define v %esi
+BEGIN(set)
+       movl %ebx,  (v)
+       movl %ecx, 4(v)
+RET_ENDP
+#undef v
+
+#define v  %esi
+BEGIN(xchg)
+       movl  (v), %eax
+       movl 4(v), %edx
+       movl %ebx,  (v)
+       movl %ecx, 4(v)
+RET_ENDP
+#undef v
+
+#define v %ecx
+BEGIN(add)
+       addl %eax,  (v)
+       adcl %edx, 4(v)
+RET_ENDP
+#undef v
+
+#define v %ecx
+BEGIN(add_return)
+       addl  (v), %eax
+       adcl 4(v), %edx
+       movl %eax,  (v)
+       movl %edx, 4(v)
+RET_ENDP
+#undef v
+
+#define v %ecx
+BEGIN(sub)
+       subl %eax,  (v)
+       sbbl %edx, 4(v)
+RET_ENDP
+#undef v
+
+#define v %ecx
+BEGIN(sub_return)
        negl %edx
        negl %eax
        sbbl $0, %edx
-       addl  ($v), %eax
-       adcl 4($v), %edx
-       movl %eax,  ($v)
-       movl %edx, 4($v)
-END
-
-BEGIN inc %esi
-       addl $1,  ($v)
-       adcl $0, 4($v)
-END
-
-BEGIN inc_return %esi
-       movl  ($v), %eax
-       movl 4($v), %edx
+       addl  (v), %eax
+       adcl 4(v), %edx
+       movl %eax,  (v)
+       movl %edx, 4(v)
+RET_ENDP
+#undef v
+
+#define v %esi
+BEGIN(inc)
+       addl $1,  (v)
+       adcl $0, 4(v)
+RET_ENDP
+#undef v
+
+#define v %esi
+BEGIN(inc_return)
+       movl  (v), %eax
+       movl 4(v), %edx
        addl $1, %eax
        adcl $0, %edx
-       movl %eax,  ($v)
-       movl %edx, 4($v)
-END
-
-BEGIN dec %esi
-       subl $1,  ($v)
-       sbbl $0, 4($v)
-END
-
-BEGIN dec_return %esi
-       movl  ($v), %eax
-       movl 4($v), %edx
+       movl %eax,  (v)
+       movl %edx, 4(v)
+RET_ENDP
+#undef v
+
+#define v %esi
+BEGIN(dec)
+       subl $1,  (v)
+       sbbl $0, 4(v)
+RET_ENDP
+#undef v
+
+#define v %esi
+BEGIN(dec_return)
+       movl  (v), %eax
+       movl 4(v), %edx
        subl $1, %eax
        sbbl $0, %edx
-       movl %eax,  ($v)
-       movl %edx, 4($v)
-END
+       movl %eax,  (v)
+       movl %edx, 4(v)
+RET_ENDP
+#undef v
 
-BEGIN add_unless %ecx
+#define v %ecx
+BEGIN(add_unless)
        addl %eax, %esi
        adcl %edx, %edi
-       addl  ($v), %eax
-       adcl 4($v), %edx
+       addl  (v), %eax
+       adcl 4(v), %edx
        cmpl %eax, %esi
        je 3f
 1:
-       movl %eax,  ($v)
-       movl %edx, 4($v)
+       movl %eax,  (v)
+       movl %edx, 4(v)
        movl $1, %eax
 2:
-RETURN
+       RET
 3:
        cmpl %edx, %edi
        jne 1b
        xorl %eax, %eax
        jmp 2b
-END_
+ENDP
+#undef v
 
-BEGIN inc_not_zero %esi
-       movl  ($v), %eax
-       movl 4($v), %edx
+#define v %esi
+BEGIN(inc_not_zero)
+       movl  (v), %eax
+       movl 4(v), %edx
        testl %eax, %eax
        je 3f
 1:
        addl $1, %eax
        adcl $0, %edx
-       movl %eax,  ($v)
-       movl %edx, 4($v)
+       movl %eax,  (v)
+       movl %edx, 4(v)
        movl $1, %eax
 2:
-RETURN
+       RET
 3:
        testl %edx, %edx
        jne 1b
        jmp 2b
-END_
+ENDP
+#undef v
 
-BEGIN dec_if_positive %esi
-       movl  ($v), %eax
-       movl 4($v), %edx
+#define v %esi
+BEGIN(dec_if_positive)
+       movl  (v), %eax
+       movl 4(v), %edx
        subl $1, %eax
        sbbl $0, %edx
        js 1f
-       movl %eax,  ($v)
-       movl %edx, 4($v)
+       movl %eax,  (v)
+       movl %edx, 4(v)
 1:
-END
+RET_ENDP
+#undef v
index f627779..4c4508e 100644 (file)
@@ -802,8 +802,10 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
        up_read(&mm->mmap_sem);
 
        /* Kernel mode? Handle exceptions or die: */
-       if (!(error_code & PF_USER))
+       if (!(error_code & PF_USER)) {
                no_context(regs, error_code, address);
+               return;
+       }
 
        /* User-space => ok to do another page fault: */
        if (is_prefetch(regs, error_code, address))
index 1ba67dc..f6b48f6 100644 (file)
@@ -668,6 +668,7 @@ static int __init ppro_init(char **cpu_type)
                *cpu_type = "i386/core_2";
                break;
        case 0x1a:
+       case 0x1e:
        case 0x2e:
                spec = &op_arch_perfmon_spec;
                *cpu_type = "i386/core_i7";
index f167e0f..7c2f38f 100644 (file)
@@ -318,7 +318,7 @@ long xtensa_clone(unsigned long clone_flags, unsigned long newsp,
  */
 
 asmlinkage
-long xtensa_execve(char __user *name, char __user * __user *argv,
+long xtensa_execve(const char __user *name, char __user * __user *argv,
                    char __user * __user *envp,
                    long a3, long a4, long a5,
                    struct pt_regs *regs)
index fbf94cf..ea0b386 100644 (file)
@@ -77,7 +77,7 @@ config ZCRYPT
 
 config ZCRYPT_MONOLITHIC
        bool "Monolithic zcrypt module"
-       depends on ZCRYPT="m"
+       depends on ZCRYPT
        help
          Select this option if you want to have a single module z90crypt,
          that contains all parts of the crypto device driver (ap bus,
index a6c670b..d4ed8e9 100644 (file)
@@ -133,7 +133,7 @@ config ISCSI_BOOT_SYSFS
 config ISCSI_IBFT
        tristate "iSCSI Boot Firmware Table Attributes module"
        select ISCSI_BOOT_SYSFS
-       depends on ISCSI_IBFT_FIND
+       depends on ISCSI_IBFT_FIND && SCSI
        default n
        help
          This option enables support for detection and exposing of iSCSI
index 4f04ec0..6148a1c 100644 (file)
@@ -727,8 +727,10 @@ static void ibft_unregister(void)
 
 static void ibft_cleanup(void)
 {
-       ibft_unregister();
-       iscsi_boot_destroy_kset(boot_kset);
+       if (boot_kset) {
+               ibft_unregister();
+               iscsi_boot_destroy_kset(boot_kset);
+       }
 }
 
 static void __exit ibft_exit(void)
index 8fcc75c..d1bf92b 100644 (file)
@@ -535,6 +535,7 @@ int intel_opregion_init(struct drm_device *dev, int resume)
 err_out:
        iounmap(opregion->header);
        opregion->header = NULL;
+       acpi_video_register();
        return err;
 }
 
index e90694f..0bc8620 100644 (file)
@@ -139,7 +139,7 @@ static int __init amijoy_init(void)
                amijoy_dev[i]->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
                        BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
                for (j = 0; j < 2; j++) {
-                       XXinput_set_abs_params(amijoy_dev[i], ABS_X + j,
+                       input_set_abs_params(amijoy_dev[i], ABS_X + j,
                                             -1, 1, 0, 0);
                }
 
index ddd5afd..dcc86b9 100644 (file)
@@ -235,7 +235,7 @@ static void hil_dev_handle_ptr_events(struct hil_dev *ptr)
                        if (val < input_abs_min(dev, ABS_X + i))
                                input_abs_set_min(dev, ABS_X + i, val);
                        if (val > input_abs_max(dev, ABS_X + i))
-                               XXinput_abs_set_max(dev, ABS_X + i, val);
+                               input_abs_set_max(dev, ABS_X + i, val);
 #endif
                        if (i % 3)
                                val = input_abs_max(dev, ABS_X + i) - val;
@@ -391,7 +391,7 @@ static void hil_dev_pointer_setup(struct hil_dev *ptr)
                        int diff = input_abs_max(input_dev, ABS_X + i) / 10;
                        input_abs_set_min(input_dev, ABS_X + i,
                                input_abs_min(input_dev, ABS_X + i) + diff)
-                       XXinput_abs_set_max(input_dev, ABS_X + i,
+                       input_abs_set_max(input_dev, ABS_X + i,
                                input_abs_max(input_dev, ABS_X + i) - diff)
                }
 #endif
index 7715d32..d3530f6 100644 (file)
@@ -1273,6 +1273,7 @@ static int __devinit c4_probe(struct pci_dev *dev,
        if (retval != 0) {
                printk(KERN_ERR "c4: no AVM-C%d at i/o %#x, irq %d detected, mem %#x\n",
                       nr, param.port, param.irq, param.membase);
+               pci_disable_device(dev);
                return -ENODEV;
        }
        return 0;
index 5a3f830..a79eb5a 100644 (file)
@@ -210,6 +210,7 @@ static int __devinit t1pci_probe(struct pci_dev *dev,
        if (retval != 0) {
                printk(KERN_ERR "t1pci: no AVM-T1-PCI at i/o %#x, irq %d detected, mem %#x\n",
                       param.port, param.irq, param.membase);
+               pci_disable_device(dev);
                return -ENODEV;
        }
        return 0;
index d2dd61d..af25e1f 100644 (file)
@@ -1094,6 +1094,7 @@ inf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                pr_info("mISDN: do not have informations about adapter at %s\n",
                        pci_name(pdev));
                kfree(card);
+               pci_disable_device(pdev);
                return -EINVAL;
        } else
                pr_notice("mISDN: found adapter %s at %s\n",
@@ -1103,7 +1104,7 @@ inf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        pci_set_drvdata(pdev, card);
        err = setup_instance(card);
        if (err) {
-               pci_disable_device(card->pdev);
+               pci_disable_device(pdev);
                kfree(card);
                pci_set_drvdata(pdev, NULL);
        } else if (ent->driver_data == INF_SCT_1) {
@@ -1114,6 +1115,7 @@ inf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                        sc = kzalloc(sizeof(struct inf_hw), GFP_KERNEL);
                        if (!sc) {
                                release_card(card);
+                               pci_disable_device(pdev);
                                return -ENOMEM;
                        }
                        sc->irq = card->irq;
@@ -1121,6 +1123,7 @@ inf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                        sc->ci = card->ci + i;
                        err = setup_instance(sc);
                        if (err) {
+                               pci_disable_device(pdev);
                                kfree(sc);
                                release_card(card);
                                break;
index 30e0491..490c57c 100644 (file)
@@ -2,14 +2,21 @@ menuconfig IR_CORE
        tristate "Infrared remote controller adapters"
        depends on INPUT
        default INPUT
+       ---help---
+         Enable support for Remote Controllers on Linux. This is
+         needed in order to support several video capture adapters.
 
-if IR_CORE
+         Enable this option if you have a video capture board even
+         if you don't need IR, as otherwise, you may not be able to
+         compile the driver for your adapter.
 
 config VIDEO_IR
        tristate
        depends on IR_CORE
        default IR_CORE
 
+if IR_CORE
+
 config LIRC
        tristate
        default y
index 6952392..a6ceb08 100644 (file)
@@ -9,7 +9,7 @@ config DVB_DM1105
        select DVB_CX24116 if !DVB_FE_CUSTOMISE
        select DVB_SI21XX if !DVB_FE_CUSTOMISE
        select DVB_DS3000 if !DVB_FE_CUSTOMISE
-       select VIDEO_IR
+       depends on VIDEO_IR
        help
          Support for cards based on the SDMC DM1105 PCI chip like
          DvbWorld 2002
index 553b48a..fdc19bb 100644 (file)
@@ -1,6 +1,6 @@
 config DVB_USB
        tristate "Support for various USB DVB devices"
-       depends on DVB_CORE && USB && I2C && INPUT
+       depends on DVB_CORE && USB && I2C && IR_CORE
        help
          By enabling this you will be able to choose the various supported
          USB1.1 and USB2.0 DVB devices.
index 85a222c..e520bce 100644 (file)
@@ -4,7 +4,7 @@
 
 config SMS_SIANO_MDTV
        tristate "Siano SMS1xxx based MDTV receiver"
-       depends on DVB_CORE && INPUT && HAS_DMA
+       depends on DVB_CORE && IR_CORE && HAS_DMA
        ---help---
          Choose Y or M here if you have MDTV receiver with a Siano chipset.
 
index 32a7ec6..debea8d 100644 (file)
@@ -98,7 +98,7 @@ config DVB_BUDGET_CI
        select DVB_LNBP21 if !DVB_FE_CUSTOMISE
        select DVB_TDA10023 if !DVB_FE_CUSTOMISE
        select MEDIA_TUNER_TDA827X if !MEDIA_TUNER_CUSTOMISE
-       select VIDEO_IR
+       depends on VIDEO_IR
        help
          Support for simple SAA7146 based DVB cards
          (so called Budget- or Nova-PCI cards) without onboard
index 3077c45..1a4a89f 100644 (file)
@@ -4,7 +4,7 @@ config VIDEO_BT848
        select I2C_ALGOBIT
        select VIDEO_BTCX
        select VIDEOBUF_DMA_SG
-       select VIDEO_IR
+       depends on VIDEO_IR
        select VIDEO_TUNER
        select VIDEO_TVEEPROM
        select VIDEO_MSP3400 if VIDEO_HELPER_CHIPS_AUTO
index baf7e91..76c054d 100644 (file)
@@ -3,7 +3,7 @@ config VIDEO_CX18
        depends on VIDEO_V4L2 && DVB_CORE && PCI && I2C && EXPERIMENTAL
        depends on INPUT        # due to VIDEO_IR
        select I2C_ALGOBIT
-       select VIDEO_IR
+       depends on VIDEO_IR
        select VIDEO_TUNER
        select VIDEO_TVEEPROM
        select VIDEO_CX2341X
index 477d4ab..5ac7ece 100644 (file)
@@ -3,7 +3,7 @@ config VIDEO_CX231XX
        depends on VIDEO_DEV && I2C && INPUT
        select VIDEO_TUNER
        select VIDEO_TVEEPROM
-       select VIDEO_IR
+       depends on VIDEO_IR
        select VIDEOBUF_VMALLOC
        select VIDEO_CX25840
 
index 768f000..e1367b3 100644 (file)
@@ -5,7 +5,7 @@ config VIDEO_CX23885
        select VIDEO_BTCX
        select VIDEO_TUNER
        select VIDEO_TVEEPROM
-       select IR_CORE
+       depends on IR_CORE
        select VIDEOBUF_DVB
        select VIDEOBUF_DMA_SG
        select VIDEO_CX25840
index c7e5851..99dbae1 100644 (file)
@@ -6,7 +6,7 @@ config VIDEO_CX88
        select VIDEOBUF_DMA_SG
        select VIDEO_TUNER
        select VIDEO_TVEEPROM
-       select VIDEO_IR
+       depends on VIDEO_IR
        select VIDEO_WM8775 if VIDEO_HELPER_CHIPS_AUTO
        ---help---
          This is a video4linux driver for Conexant 2388x based
index c7be0e0..66aefd6 100644 (file)
@@ -3,7 +3,7 @@ config VIDEO_EM28XX
        depends on VIDEO_DEV && I2C && INPUT
        select VIDEO_TUNER
        select VIDEO_TVEEPROM
-       select VIDEO_IR
+       depends on VIDEO_IR
        select VIDEOBUF_VMALLOC
        select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO
        select VIDEO_TVP5150 if VIDEO_HELPER_CHIPS_AUTO
index c46bfb1..be4af1f 100644 (file)
@@ -3,7 +3,7 @@ config VIDEO_IVTV
        depends on VIDEO_V4L2 && PCI && I2C
        depends on INPUT   # due to VIDEO_IR
        select I2C_ALGOBIT
-       select VIDEO_IR
+       depends on VIDEO_IR
        select VIDEO_TUNER
        select VIDEO_TVEEPROM
        select VIDEO_CX2341X
index 22bfd62..fda005e 100644 (file)
@@ -2,7 +2,7 @@ config VIDEO_SAA7134
        tristate "Philips SAA7134 support"
        depends on VIDEO_DEV && PCI && I2C && INPUT
        select VIDEOBUF_DMA_SG
-       select VIDEO_IR
+       depends on VIDEO_IR
        select VIDEO_TUNER
        select VIDEO_TVEEPROM
        select CRC32
index 2c29ec6..1686ebf 100644 (file)
@@ -3,7 +3,7 @@ config VIDEO_TLG2300
        depends on VIDEO_DEV && I2C && INPUT && SND && DVB_CORE
        select VIDEO_TUNER
        select VIDEO_TVEEPROM
-       select VIDEO_IR
+       depends on VIDEO_IR
        select VIDEOBUF_VMALLOC
        select SND_PCM
        select VIDEOBUF_DVB
index d2f20c2..073f013 100644 (file)
@@ -228,11 +228,6 @@ static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
        if (file->f_op->unlocked_ioctl)
                ret = file->f_op->unlocked_ioctl(file, cmd, arg);
-       else if (file->f_op->ioctl) {
-               lock_kernel();
-               ret = file->f_op->ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
-               unlock_kernel();
-       }
 
        return ret;
 }
@@ -973,7 +968,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
 {
        long ret = -ENOIOCTLCMD;
 
-       if (!file->f_op->ioctl && !file->f_op->unlocked_ioctl)
+       if (!file->f_op->unlocked_ioctl)
                return ret;
 
        switch (cmd) {
index 84c1a53..ea8d32c 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <linux/ctype.h>
+#include <linux/slab.h>
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ctrls.h>
index c997474..283190b 100644 (file)
@@ -256,12 +256,13 @@ config MMC_IMX
 
          If unsure, say N.
 
-config MMC_MSM7X00A
-       tristate "Qualcomm MSM 7X00A SDCC Controller Support"
-       depends on MMC && ARCH_MSM && !ARCH_MSM7X30
+config MMC_MSM
+       tristate "Qualcomm SDCC Controller Support"
+       depends on MMC && ARCH_MSM
        help
          This provides support for the SD/MMC cell found in the
-          MSM 7X00A controllers from Qualcomm.
+         MSM and QSD SOCs from Qualcomm. The controller also has
+         support for SDIO devices.
 
 config MMC_MXC
        tristate "Freescale i.MX2/3 Multimedia Card Interface support"
index fe0ba4e..840bcb5 100644 (file)
@@ -21,7 +21,7 @@ obj-$(CONFIG_MMC_OMAP_HS)     += omap_hsmmc.o
 obj-$(CONFIG_MMC_AT91)         += at91_mci.o
 obj-$(CONFIG_MMC_ATMELMCI)     += atmel-mci.o
 obj-$(CONFIG_MMC_TIFM_SD)      += tifm_sd.o
-obj-$(CONFIG_MMC_MSM7X00A)     += msm_sdcc.o
+obj-$(CONFIG_MMC_MSM)          += msm_sdcc.o
 obj-$(CONFIG_MMC_MVSDIO)       += mvsdio.o
 obj-$(CONFIG_MMC_DAVINCI)       += davinci_mmc.o
 obj-$(CONFIG_MMC_SPI)          += mmc_spi.o
index 6824917..ff77523 100644 (file)
@@ -160,18 +160,7 @@ msmsdcc_stop_data(struct msmsdcc_host *host)
 
 uint32_t msmsdcc_fifo_addr(struct msmsdcc_host *host)
 {
-       switch (host->pdev_id) {
-       case 1:
-               return MSM_SDC1_PHYS + MMCIFIFO;
-       case 2:
-               return MSM_SDC2_PHYS + MMCIFIFO;
-       case 3:
-               return MSM_SDC3_PHYS + MMCIFIFO;
-       case 4:
-               return MSM_SDC4_PHYS + MMCIFIFO;
-       }
-       BUG();
-       return 0;
+       return host->memres->start + MMCIFIFO;
 }
 
 static inline void
@@ -1289,6 +1278,24 @@ msmsdcc_probe(struct platform_device *pdev)
        return ret;
 }
 
+#ifdef CONFIG_PM
+#ifdef CONFIG_MMC_MSM7X00A_RESUME_IN_WQ
+static void
+do_resume_work(struct work_struct *work)
+{
+       struct msmsdcc_host *host =
+               container_of(work, struct msmsdcc_host, resume_task);
+       struct mmc_host *mmc = host->mmc;
+
+       if (mmc) {
+               mmc_resume_host(mmc);
+               if (host->stat_irq)
+                       enable_irq(host->stat_irq);
+       }
+}
+#endif
+
+
 static int
 msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
 {
@@ -1333,6 +1340,10 @@ msmsdcc_resume(struct platform_device *dev)
        }
        return 0;
 }
+#else
+#define msmsdcc_suspend        0
+#define msmsdcc_resume 0
+#endif
 
 static struct platform_driver msmsdcc_driver = {
        .probe          = msmsdcc_probe,
index 077ccf8..2111dbf 100644 (file)
 #include <net/caif/caif_spi.h>
 
 #ifndef CONFIG_CAIF_SPI_SYNC
-#define SPI_DATA_POS SPI_CMD_SZ
+#define SPI_DATA_POS 0
 static inline int forward_to_spi_cmd(struct cfspi *cfspi)
 {
        return cfspi->rx_cpck_len;
 }
 #else
-#define SPI_DATA_POS 0
+#define SPI_DATA_POS SPI_CMD_SZ
 static inline int forward_to_spi_cmd(struct cfspi *cfspi)
 {
        return 0;
index 4eb6f98..f581952 100644 (file)
@@ -808,6 +808,7 @@ xirc2ps_config(struct pcmcia_device * link)
     }
 
     link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
+    link->io_lines = 10;
     if (local->modem) {
        int pass;
 
@@ -839,7 +840,6 @@ xirc2ps_config(struct pcmcia_device * link)
        }
        printk(KNOT_XIRC "no ports available\n");
     } else {
-       link->io_lines = 10;
        link->resource[0]->end = 16;
        for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
            link->resource[0]->start = ioaddr;
index a527e37..eb799b3 100644 (file)
@@ -5,7 +5,7 @@
 menuconfig PHYLIB
        tristate "PHY Device support and infrastructure"
        depends on !S390
-       depends on NET_ETHERNET
+       depends on NETDEVICES
        help
          Ethernet controllers are usually attached to PHY
          devices.  This option provides infrastructure for
index 5130db8..1bb16cb 100644 (file)
@@ -301,7 +301,7 @@ EXPORT_SYMBOL(phy_ethtool_gset);
 /**
  * phy_mii_ioctl - generic PHY MII ioctl interface
  * @phydev: the phy_device struct
- * @mii_data: MII ioctl data
+ * @ifr: &struct ifreq for socket ioctl's
  * @cmd: ioctl cmd to execute
  *
  * Note that this function is currently incompatible with the
index b9615bd..bf6d87a 100644 (file)
@@ -473,48 +473,58 @@ qlcnic_cleanup_pci_map(struct qlcnic_adapter *adapter)
 static int
 qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
 {
-       struct qlcnic_pci_info pci_info[QLCNIC_MAX_PCI_FUNC];
+       struct qlcnic_pci_info *pci_info;
        int i, ret = 0, err;
        u8 pfn;
 
-       if (!adapter->npars)
-               adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) *
-                               QLCNIC_MAX_PCI_FUNC, GFP_KERNEL);
-       if (!adapter->npars)
+       pci_info = kcalloc(QLCNIC_MAX_PCI_FUNC, sizeof(*pci_info), GFP_KERNEL);
+       if (!pci_info)
                return -ENOMEM;
 
-       if (!adapter->eswitch)
-               adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) *
+       adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) *
+                               QLCNIC_MAX_PCI_FUNC, GFP_KERNEL);
+       if (!adapter->npars) {
+               err = -ENOMEM;
+               goto err_pci_info;
+       }
+
+       adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) *
                                QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL);
        if (!adapter->eswitch) {
                err = -ENOMEM;
-               goto err_eswitch;
+               goto err_npars;
        }
 
        ret = qlcnic_get_pci_info(adapter, pci_info);
-       if (!ret) {
-               for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
-                       pfn = pci_info[i].id;
-                       if (pfn > QLCNIC_MAX_PCI_FUNC)
-                               return QL_STATUS_INVALID_PARAM;
-                       adapter->npars[pfn].active = pci_info[i].active;
-                       adapter->npars[pfn].type = pci_info[i].type;
-                       adapter->npars[pfn].phy_port = pci_info[i].default_port;
-                       adapter->npars[pfn].mac_learning = DEFAULT_MAC_LEARN;
-                       adapter->npars[pfn].min_bw = pci_info[i].tx_min_bw;
-                       adapter->npars[pfn].max_bw = pci_info[i].tx_max_bw;
-               }
-
-               for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++)
-                       adapter->eswitch[i].flags |= QLCNIC_SWITCH_ENABLE;
+       if (ret)
+               goto err_eswitch;
 
-               return ret;
+       for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
+               pfn = pci_info[i].id;
+               if (pfn > QLCNIC_MAX_PCI_FUNC)
+                       return QL_STATUS_INVALID_PARAM;
+               adapter->npars[pfn].active = pci_info[i].active;
+               adapter->npars[pfn].type = pci_info[i].type;
+               adapter->npars[pfn].phy_port = pci_info[i].default_port;
+               adapter->npars[pfn].mac_learning = DEFAULT_MAC_LEARN;
+               adapter->npars[pfn].min_bw = pci_info[i].tx_min_bw;
+               adapter->npars[pfn].max_bw = pci_info[i].tx_max_bw;
        }
 
+       for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++)
+               adapter->eswitch[i].flags |= QLCNIC_SWITCH_ENABLE;
+
+       kfree(pci_info);
+       return 0;
+
+err_eswitch:
        kfree(adapter->eswitch);
        adapter->eswitch = NULL;
-err_eswitch:
+err_npars:
        kfree(adapter->npars);
+       adapter->npars = NULL;
+err_pci_info:
+       kfree(pci_info);
 
        return ret;
 }
@@ -3361,15 +3371,21 @@ qlcnic_sysfs_read_pci_config(struct file *file, struct kobject *kobj,
        struct device *dev = container_of(kobj, struct device, kobj);
        struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
        struct qlcnic_pci_func_cfg pci_cfg[QLCNIC_MAX_PCI_FUNC];
-       struct qlcnic_pci_info  pci_info[QLCNIC_MAX_PCI_FUNC];
+       struct qlcnic_pci_info *pci_info;
        int i, ret;
 
        if (size != sizeof(pci_cfg))
                return QL_STATUS_INVALID_PARAM;
 
+       pci_info = kcalloc(QLCNIC_MAX_PCI_FUNC, sizeof(*pci_info), GFP_KERNEL);
+       if (!pci_info)
+               return -ENOMEM;
+
        ret = qlcnic_get_pci_info(adapter, pci_info);
-       if (ret)
+       if (ret) {
+               kfree(pci_info);
                return ret;
+       }
 
        for (i = 0; i < QLCNIC_MAX_PCI_FUNC ; i++) {
                pci_cfg[i].pci_func = pci_info[i].id;
@@ -3380,8 +3396,8 @@ qlcnic_sysfs_read_pci_config(struct file *file, struct kobject *kobj,
                memcpy(&pci_cfg[i].def_mac_addr, &pci_info[i].mac, ETH_ALEN);
        }
        memcpy(buf, &pci_cfg, size);
+       kfree(pci_info);
        return size;
-
 }
 static struct bin_attribute bin_attr_npar_config = {
        .attr = {.name = "npar_config", .mode = (S_IRUGO | S_IWUSR)},
index 7f62e2d..ca7fc9d 100644 (file)
@@ -315,7 +315,7 @@ EXPORT_SYMBOL_GPL(usbnet_defer_kevent);
 
 static void rx_complete (struct urb *urb);
 
-static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
+static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
 {
        struct sk_buff          *skb;
        struct skb_data         *entry;
@@ -327,7 +327,7 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
                netif_dbg(dev, rx_err, dev->net, "no rx skb\n");
                usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
                usb_free_urb (urb);
-               return;
+               return -ENOMEM;
        }
        skb_reserve (skb, NET_IP_ALIGN);
 
@@ -357,6 +357,9 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
                        netif_dbg(dev, ifdown, dev->net, "device gone\n");
                        netif_device_detach (dev->net);
                        break;
+               case -EHOSTUNREACH:
+                       retval = -ENOLINK;
+                       break;
                default:
                        netif_dbg(dev, rx_err, dev->net,
                                  "rx submit, %d\n", retval);
@@ -374,6 +377,7 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
                dev_kfree_skb_any (skb);
                usb_free_urb (urb);
        }
+       return retval;
 }
 
 
@@ -912,6 +916,7 @@ fail_halt:
        /* tasklet could resubmit itself forever if memory is tight */
        if (test_bit (EVENT_RX_MEMORY, &dev->flags)) {
                struct urb      *urb = NULL;
+               int resched = 1;
 
                if (netif_running (dev->net))
                        urb = usb_alloc_urb (0, GFP_KERNEL);
@@ -922,10 +927,12 @@ fail_halt:
                        status = usb_autopm_get_interface(dev->intf);
                        if (status < 0)
                                goto fail_lowmem;
-                       rx_submit (dev, urb, GFP_KERNEL);
+                       if (rx_submit (dev, urb, GFP_KERNEL) == -ENOLINK)
+                               resched = 0;
                        usb_autopm_put_interface(dev->intf);
 fail_lowmem:
-                       tasklet_schedule (&dev->bh);
+                       if (resched)
+                               tasklet_schedule (&dev->bh);
                }
        }
 
@@ -1175,8 +1182,11 @@ static void usbnet_bh (unsigned long param)
                        // don't refill the queue all at once
                        for (i = 0; i < 10 && dev->rxq.qlen < qlen; i++) {
                                urb = usb_alloc_urb (0, GFP_ATOMIC);
-                               if (urb != NULL)
-                                       rx_submit (dev, urb, GFP_ATOMIC);
+                               if (urb != NULL) {
+                                       if (rx_submit (dev, urb, GFP_ATOMIC) ==
+                                           -ENOLINK)
+                                               return;
+                               }
                        }
                        if (temp != dev->rxq.qlen)
                                netif_dbg(dev, link, dev->net,
index ad7719f..e050bd6 100644 (file)
@@ -885,20 +885,21 @@ fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
  *      Receive a frame through the DMA
  */
 static inline void
-fst_rx_dma(struct fst_card_info *card, unsigned char *skb,
-          unsigned char *mem, int len)
+fst_rx_dma(struct fst_card_info *card, dma_addr_t skb,
+          dma_addr_t mem, int len)
 {
        /*
         * This routine will setup the DMA and start it
         */
 
-       dbg(DBG_RX, "In fst_rx_dma %p %p %d\n", skb, mem, len);
+       dbg(DBG_RX, "In fst_rx_dma %lx %lx %d\n",
+           (unsigned long) skb, (unsigned long) mem, len);
        if (card->dmarx_in_progress) {
                dbg(DBG_ASS, "In fst_rx_dma while dma in progress\n");
        }
 
-       outl((unsigned long) skb, card->pci_conf + DMAPADR0);   /* Copy to here */
-       outl((unsigned long) mem, card->pci_conf + DMALADR0);   /* from here */
+       outl(skb, card->pci_conf + DMAPADR0);   /* Copy to here */
+       outl(mem, card->pci_conf + DMALADR0);   /* from here */
        outl(len, card->pci_conf + DMASIZ0);    /* for this length */
        outl(0x00000000c, card->pci_conf + DMADPR0);    /* In this direction */
 
@@ -1309,8 +1310,8 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port)
                card->dma_port_rx = port;
                card->dma_len_rx = len;
                card->dma_rxpos = rxp;
-               fst_rx_dma(card, (char *) card->rx_dma_handle_card,
-                          (char *) BUF_OFFSET(rxBuffer[pi][rxp][0]), len);
+               fst_rx_dma(card, card->rx_dma_handle_card,
+                          BUF_OFFSET(rxBuffer[pi][rxp][0]), len);
        }
        if (rxp != port->rxpos) {
                dbg(DBG_ASS, "About to increment rxpos by more than 1\n");
index 8848333..fec0262 100644 (file)
@@ -260,7 +260,7 @@ struct iwl_cfg iwl1000_bgn_cfg = {
        .shadow_ram_support = false,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .support_ct_kill_exit = true,
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF,
index a07310f..6950a78 100644 (file)
@@ -769,22 +769,6 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv,
                rts_retry_limit = data_retry_limit;
        tx_cmd->rts_retry_limit = rts_retry_limit;
 
-       if (ieee80211_is_mgmt(fc)) {
-               switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) {
-               case cpu_to_le16(IEEE80211_STYPE_AUTH):
-               case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
-               case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ):
-               case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ):
-                       if (tx_flags & TX_CMD_FLG_RTS_MSK) {
-                               tx_flags &= ~TX_CMD_FLG_RTS_MSK;
-                               tx_flags |= TX_CMD_FLG_CTS_MSK;
-                       }
-                       break;
-               default:
-                       break;
-               }
-       }
-
        tx_cmd->rate = rate;
        tx_cmd->tx_flags = tx_flags;
 
@@ -2717,7 +2701,7 @@ static struct iwl_lib_ops iwl3945_lib = {
 static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
        .get_hcmd_size = iwl3945_get_hcmd_size,
        .build_addsta_hcmd = iwl3945_build_addsta_hcmd,
-       .rts_tx_cmd_flag = iwlcore_rts_tx_cmd_flag,
+       .tx_cmd_protection = iwlcore_tx_cmd_protection,
        .request_scan = iwl3945_request_scan,
 };
 
index d6531ad..d6da356 100644 (file)
@@ -2223,7 +2223,7 @@ static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = {
        .build_addsta_hcmd = iwl4965_build_addsta_hcmd,
        .chain_noise_reset = iwl4965_chain_noise_reset,
        .gain_computation = iwl4965_gain_computation,
-       .rts_tx_cmd_flag = iwlcore_rts_tx_cmd_flag,
+       .tx_cmd_protection = iwlcore_tx_cmd_protection,
        .calc_rssi = iwl4965_calc_rssi,
        .request_scan = iwlagn_request_scan,
 };
index 8093ce2..aacf377 100644 (file)
@@ -506,7 +506,7 @@ struct iwl_cfg iwl5300_agn_cfg = {
        .use_bsm = false,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
        .chain_noise_scale = 1000,
@@ -537,7 +537,7 @@ struct iwl_cfg iwl5100_bgn_cfg = {
        .use_bsm = false,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
        .chain_noise_scale = 1000,
@@ -597,7 +597,7 @@ struct iwl_cfg iwl5100_agn_cfg = {
        .use_bsm = false,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
        .chain_noise_scale = 1000,
@@ -628,7 +628,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
        .use_bsm = false,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
        .chain_noise_scale = 1000,
@@ -659,7 +659,7 @@ struct iwl_cfg iwl5150_agn_cfg = {
        .use_bsm = false,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
        .chain_noise_scale = 1000,
index 5827052..af4fd50 100644 (file)
@@ -381,7 +381,7 @@ struct iwl_cfg iwl6000g2a_2agn_cfg = {
        .shadow_ram_support = true,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .supports_idle = true,
        .adv_thermal_throttle = true,
@@ -489,7 +489,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = {
        .shadow_ram_support = true,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .supports_idle = true,
        .adv_thermal_throttle = true,
@@ -563,7 +563,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = {
        .shadow_ram_support = true,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .supports_idle = true,
        .adv_thermal_throttle = true,
@@ -637,7 +637,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = {
        .shadow_ram_support = true,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .supports_idle = true,
        .adv_thermal_throttle = true,
@@ -714,7 +714,7 @@ struct iwl_cfg iwl6000i_2agn_cfg = {
        .shadow_ram_support = true,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .supports_idle = true,
        .adv_thermal_throttle = true,
@@ -821,7 +821,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
        .shadow_ram_support = true,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .supports_idle = true,
        .adv_thermal_throttle = true,
@@ -859,7 +859,7 @@ struct iwl_cfg iwl6050g2_bgn_cfg = {
        .shadow_ram_support = true,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .supports_idle = true,
        .adv_thermal_throttle = true,
@@ -933,7 +933,7 @@ struct iwl_cfg iwl6000_3agn_cfg = {
        .shadow_ram_support = true,
        .ht_greenfield_support = true,
        .led_compensation = 51,
-       .use_rts_for_ht = true, /* use rts/cts protection */
+       .use_rts_for_aggregation = true, /* use rts/cts protection */
        .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
        .supports_idle = true,
        .adv_thermal_throttle = true,
index a7216dd..75b901b 100644 (file)
@@ -211,10 +211,21 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
        }
 }
 
-static void iwlagn_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
-                       __le32 *tx_flags)
+static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
+                                    struct ieee80211_tx_info *info,
+                                    __le16 fc, __le32 *tx_flags)
 {
-       *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
+       if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
+           info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
+               *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
+               return;
+       }
+
+       if (priv->cfg->use_rts_for_aggregation &&
+           info->flags & IEEE80211_TX_CTL_AMPDU) {
+               *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
+               return;
+       }
 }
 
 /* Calc max signal level (dBm) among 3 possible receivers */
@@ -268,7 +279,7 @@ struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = {
        .build_addsta_hcmd = iwlagn_build_addsta_hcmd,
        .gain_computation = iwlagn_gain_computation,
        .chain_noise_reset = iwlagn_chain_noise_reset,
-       .rts_tx_cmd_flag = iwlagn_rts_tx_cmd_flag,
+       .tx_cmd_protection = iwlagn_tx_cmd_protection,
        .calc_rssi = iwlagn_calc_rssi,
        .request_scan = iwlagn_request_scan,
 };
index d04502d..69155aa 100644 (file)
@@ -379,10 +379,7 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv,
                tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
        }
 
-       priv->cfg->ops->utils->rts_tx_cmd_flag(info, &tx_flags);
-
-       if ((tx_flags & TX_CMD_FLG_RTS_MSK) || (tx_flags & TX_CMD_FLG_CTS_MSK))
-               tx_flags |= TX_CMD_FLG_FULL_TXOP_PROT_MSK;
+       priv->cfg->ops->utils->tx_cmd_protection(priv, info, fc, &tx_flags);
 
        tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK);
        if (ieee80211_is_mgmt(fc)) {
@@ -456,21 +453,6 @@ static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv,
        if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE))
                rate_flags |= RATE_MCS_CCK_MSK;
 
-       /* Set up RTS and CTS flags for certain packets */
-       switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) {
-       case cpu_to_le16(IEEE80211_STYPE_AUTH):
-       case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
-       case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ):
-       case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ):
-               if (tx_cmd->tx_flags & TX_CMD_FLG_RTS_MSK) {
-                       tx_cmd->tx_flags &= ~TX_CMD_FLG_RTS_MSK;
-                       tx_cmd->tx_flags |= TX_CMD_FLG_CTS_MSK;
-               }
-               break;
-       default:
-               break;
-       }
-
        /* Set up antennas */
        priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant,
                                              priv->hw_params.valid_tx_ant);
index 35337b1..c1882fd 100644 (file)
@@ -202,13 +202,6 @@ int iwl_commit_rxon(struct iwl_priv *priv)
 
        priv->start_calib = 0;
        if (new_assoc) {
-               /*
-                * allow CTS-to-self if possible for new association.
-                * this is relevant only for 5000 series and up,
-                * but will not damage 4965
-                */
-               priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN;
-
                /* Apply the new configuration
                 * RXON assoc doesn't clear the station table in uCode,
                 */
@@ -1618,45 +1611,9 @@ static ssize_t store_tx_power(struct device *d,
 
 static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);
 
-static ssize_t show_rts_ht_protection(struct device *d,
-                            struct device_attribute *attr, char *buf)
-{
-       struct iwl_priv *priv = dev_get_drvdata(d);
-
-       return sprintf(buf, "%s\n",
-               priv->cfg->use_rts_for_ht ? "RTS/CTS" : "CTS-to-self");
-}
-
-static ssize_t store_rts_ht_protection(struct device *d,
-                             struct device_attribute *attr,
-                             const char *buf, size_t count)
-{
-       struct iwl_priv *priv = dev_get_drvdata(d);
-       unsigned long val;
-       int ret;
-
-       ret = strict_strtoul(buf, 10, &val);
-       if (ret)
-               IWL_INFO(priv, "Input is not in decimal form.\n");
-       else {
-               if (!iwl_is_associated(priv))
-                       priv->cfg->use_rts_for_ht = val ? true : false;
-               else
-                       IWL_ERR(priv, "Sta associated with AP - "
-                               "Change protection mechanism is not allowed\n");
-               ret = count;
-       }
-       return ret;
-}
-
-static DEVICE_ATTR(rts_ht_protection, S_IWUSR | S_IRUGO,
-                       show_rts_ht_protection, store_rts_ht_protection);
-
-
 static struct attribute *iwl_sysfs_entries[] = {
        &dev_attr_temperature.attr,
        &dev_attr_tx_power.attr,
-       &dev_attr_rts_ht_protection.attr,
 #ifdef CONFIG_IWLWIFI_DEBUG
        &dev_attr_debug_level.attr,
 #endif
@@ -3464,25 +3421,6 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
        return ret;
 }
 
-/*
- * switch to RTS/CTS for TX
- */
-static void iwl_enable_rts_cts(struct iwl_priv *priv)
-{
-
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
-               return;
-
-       priv->staging_rxon.flags &= ~RXON_FLG_SELF_CTS_EN;
-       if (!test_bit(STATUS_SCANNING, &priv->status)) {
-               IWL_DEBUG_INFO(priv, "use RTS/CTS protection\n");
-               iwlcore_commit_rxon(priv);
-       } else {
-               /* scanning, defer the request until scan completed */
-               IWL_DEBUG_INFO(priv, "defer setting RTS/CTS protection\n");
-       }
-}
-
 static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
                                struct ieee80211_vif *vif,
                                enum ieee80211_ampdu_mlme_action action,
@@ -3529,14 +3467,33 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
                }
                if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                        ret = 0;
+               if (priv->cfg->use_rts_for_aggregation) {
+                       struct iwl_station_priv *sta_priv =
+                               (void *) sta->drv_priv;
+                       /*
+                        * switch off RTS/CTS if it was previously enabled
+                        */
+
+                       sta_priv->lq_sta.lq.general_params.flags &=
+                               ~LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK;
+                       iwl_send_lq_cmd(priv, &sta_priv->lq_sta.lq,
+                               CMD_ASYNC, false);
+               }
                break;
        case IEEE80211_AMPDU_TX_OPERATIONAL:
-               if (priv->cfg->use_rts_for_ht) {
+               if (priv->cfg->use_rts_for_aggregation) {
+                       struct iwl_station_priv *sta_priv =
+                               (void *) sta->drv_priv;
+
                        /*
                         * switch to RTS/CTS if it is the prefer protection
                         * method for HT traffic
                         */
-                       iwl_enable_rts_cts(priv);
+
+                       sta_priv->lq_sta.lq.general_params.flags |=
+                               LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK;
+                       iwl_send_lq_cmd(priv, &sta_priv->lq_sta.lq,
+                               CMD_ASYNC, false);
                }
                ret = 0;
                break;
index 8ccb6d2..2c03c6e 100644 (file)
@@ -401,21 +401,38 @@ void iwlcore_free_geos(struct iwl_priv *priv)
 EXPORT_SYMBOL(iwlcore_free_geos);
 
 /*
- *  iwlcore_rts_tx_cmd_flag: Set rts/cts. 3945 and 4965 only share this
+ *  iwlcore_tx_cmd_protection: Set rts/cts. 3945 and 4965 only share this
  *  function.
  */
-void iwlcore_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
-                               __le32 *tx_flags)
+void iwlcore_tx_cmd_protection(struct iwl_priv *priv,
+                              struct ieee80211_tx_info *info,
+                              __le16 fc, __le32 *tx_flags)
 {
        if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) {
                *tx_flags |= TX_CMD_FLG_RTS_MSK;
                *tx_flags &= ~TX_CMD_FLG_CTS_MSK;
+               *tx_flags |= TX_CMD_FLG_FULL_TXOP_PROT_MSK;
+
+               if (!ieee80211_is_mgmt(fc))
+                       return;
+
+               switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) {
+               case cpu_to_le16(IEEE80211_STYPE_AUTH):
+               case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
+               case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ):
+               case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ):
+                       *tx_flags &= ~TX_CMD_FLG_RTS_MSK;
+                       *tx_flags |= TX_CMD_FLG_CTS_MSK;
+                       break;
+               }
        } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
                *tx_flags &= ~TX_CMD_FLG_RTS_MSK;
                *tx_flags |= TX_CMD_FLG_CTS_MSK;
+               *tx_flags |= TX_CMD_FLG_FULL_TXOP_PROT_MSK;
        }
 }
-EXPORT_SYMBOL(iwlcore_rts_tx_cmd_flag);
+EXPORT_SYMBOL(iwlcore_tx_cmd_protection);
+
 
 static bool is_single_rx_stream(struct iwl_priv *priv)
 {
@@ -1869,6 +1886,10 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
                        priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK;
                else
                        priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
+               if (bss_conf->use_cts_prot)
+                       priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN;
+               else
+                       priv->staging_rxon.flags &= ~RXON_FLG_SELF_CTS_EN;
        }
 
        if (changes & BSS_CHANGED_BASIC_RATES) {
index e9d23f2..4a71dfb 100644 (file)
@@ -104,8 +104,9 @@ struct iwl_hcmd_utils_ops {
                        u32 min_average_noise,
                        u8 default_chain);
        void (*chain_noise_reset)(struct iwl_priv *priv);
-       void (*rts_tx_cmd_flag)(struct ieee80211_tx_info *info,
-                       __le32 *tx_flags);
+       void (*tx_cmd_protection)(struct iwl_priv *priv,
+                                 struct ieee80211_tx_info *info,
+                                 __le16 fc, __le32 *tx_flags);
        int  (*calc_rssi)(struct iwl_priv *priv,
                          struct iwl_rx_phy_res *rx_resp);
        void (*request_scan)(struct iwl_priv *priv, struct ieee80211_vif *vif);
@@ -249,7 +250,7 @@ struct iwl_mod_params {
  * @led_compensation: compensate on the led on/off time per HW according
  *     to the deviation to achieve the desired led frequency.
  *     The detail algorithm is described in iwl-led.c
- * @use_rts_for_ht: use rts/cts protection for HT traffic
+ * @use_rts_for_aggregation: use rts/cts protection for HT traffic
  * @chain_noise_num_beacons: number of beacons used to compute chain noise
  * @adv_thermal_throttle: support advance thermal throttle
  * @support_ct_kill_exit: support ct kill exit condition
@@ -318,7 +319,7 @@ struct iwl_cfg {
        const bool ht_greenfield_support;
        u16 led_compensation;
        const bool broken_powersave;
-       bool use_rts_for_ht;
+       bool use_rts_for_aggregation;
        int chain_noise_num_beacons;
        const bool supports_idle;
        bool adv_thermal_throttle;
@@ -390,8 +391,9 @@ void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif);
 void iwl_mac_reset_tsf(struct ieee80211_hw *hw);
 int iwl_alloc_txq_mem(struct iwl_priv *priv);
 void iwl_free_txq_mem(struct iwl_priv *priv);
-void iwlcore_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
-                               __le32 *tx_flags);
+void iwlcore_tx_cmd_protection(struct iwl_priv *priv,
+                              struct ieee80211_tx_info *info,
+                              __le16 fc, __le32 *tx_flags);
 #ifdef CONFIG_IWLWIFI_DEBUGFS
 int iwl_alloc_traffic_mem(struct iwl_priv *priv);
 void iwl_free_traffic_mem(struct iwl_priv *priv);
index d24eb47..70c4b8f 100644 (file)
@@ -435,10 +435,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
                tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
        }
 
-       priv->cfg->ops->utils->rts_tx_cmd_flag(info, &tx_flags);
-
-       if ((tx_flags & TX_CMD_FLG_RTS_MSK) || (tx_flags & TX_CMD_FLG_CTS_MSK))
-               tx_flags |= TX_CMD_FLG_FULL_TXOP_PROT_MSK;
+       priv->cfg->ops->utils->tx_cmd_protection(priv, info, fc, &tx_flags);
 
        tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK);
        if (ieee80211_is_mgmt(fc)) {
index 2372abb..3e82f16 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/sched.h>
 #include <linux/wait.h>
 #include <linux/slab.h>
+#include <linux/sched.h>
 #include <linux/ieee80211.h>
 #include <net/cfg80211.h>
 #include <asm/unaligned.h>
index 71a101f..822f8dc 100644 (file)
@@ -43,8 +43,6 @@ static DEFINE_PCI_DEVICE_TABLE(p54p_table) = {
        { PCI_DEVICE(0x1260, 0x3886) },
        /* Intersil PRISM Xbow Wireless LAN adapter (Symbol AP-300) */
        { PCI_DEVICE(0x1260, 0xffff) },
-       /* Standard Microsystems Corp SMC2802W Wireless PCI */
-       { PCI_DEVICE(0x10b8, 0x2802) },
        { },
 };
 
index 79baa63..044f430 100644 (file)
@@ -219,6 +219,13 @@ config SONYPI_COMPAT
          ---help---
          Build the sonypi driver compatibility code into the sony-laptop driver.
 
+config IDEAPAD_ACPI
+       tristate "Lenovo IdeaPad ACPI Laptop Extras"
+       depends on ACPI
+       depends on RFKILL
+       help
+         This is a driver for the rfkill switches on Lenovo IdeaPad netbooks.
+
 config THINKPAD_ACPI
        tristate "ThinkPad ACPI Laptop Extras"
        depends on ACPI
index 4744c77..85fb2b8 100644 (file)
@@ -15,6 +15,7 @@ obj-$(CONFIG_ACERHDF)         += acerhdf.o
 obj-$(CONFIG_HP_WMI)           += hp-wmi.o
 obj-$(CONFIG_TC1100_WMI)       += tc1100-wmi.o
 obj-$(CONFIG_SONY_LAPTOP)      += sony-laptop.o
+obj-$(CONFIG_IDEAPAD_ACPI)     += ideapad_acpi.o
 obj-$(CONFIG_THINKPAD_ACPI)    += thinkpad_acpi.o
 obj-$(CONFIG_FUJITSU_LAPTOP)   += fujitsu-laptop.o
 obj-$(CONFIG_PANASONIC_LAPTOP) += panasonic-laptop.o
diff --git a/drivers/platform/x86/ideapad_acpi.c b/drivers/platform/x86/ideapad_acpi.c
new file mode 100644 (file)
index 0000000..7984963
--- /dev/null
@@ -0,0 +1,306 @@
+/*
+ *  ideapad_acpi.c - Lenovo IdeaPad ACPI Extras
+ *
+ *  Copyright © 2010 Intel Corporation
+ *  Copyright © 2010 David Woodhouse <dwmw2@infradead.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA
+ *  02110-1301, USA.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <acpi/acpi_bus.h>
+#include <acpi/acpi_drivers.h>
+#include <linux/rfkill.h>
+
+#define IDEAPAD_DEV_CAMERA     0
+#define IDEAPAD_DEV_WLAN       1
+#define IDEAPAD_DEV_BLUETOOTH  2
+#define IDEAPAD_DEV_3G         3
+#define IDEAPAD_DEV_KILLSW     4
+
+struct ideapad_private {
+       struct rfkill *rfk[5];
+};
+
+static struct {
+       char *name;
+       int type;
+} ideapad_rfk_data[] = {
+       /* camera has no rfkill */
+       { "ideapad_wlan",       RFKILL_TYPE_WLAN },
+       { "ideapad_bluetooth",  RFKILL_TYPE_BLUETOOTH },
+       { "ideapad_3g",         RFKILL_TYPE_WWAN },
+       { "ideapad_killsw",     RFKILL_TYPE_WLAN }
+};
+
+static int ideapad_dev_exists(int device)
+{
+       acpi_status status;
+       union acpi_object in_param;
+       struct acpi_object_list input = { 1, &in_param };
+       struct acpi_buffer output;
+       union acpi_object out_obj;
+
+       output.length = sizeof(out_obj);
+       output.pointer = &out_obj;
+
+       in_param.type = ACPI_TYPE_INTEGER;
+       in_param.integer.value = device + 1;
+
+       status = acpi_evaluate_object(NULL, "\\_SB_.DECN", &input, &output);
+       if (ACPI_FAILURE(status)) {
+               printk(KERN_WARNING "IdeaPAD \\_SB_.DECN method failed %d. Is this an IdeaPAD?\n", status);
+               return -ENODEV;
+       }
+       if (out_obj.type != ACPI_TYPE_INTEGER) {
+               printk(KERN_WARNING "IdeaPAD \\_SB_.DECN method returned unexpected type\n");
+               return -ENODEV;
+       }
+       return out_obj.integer.value;
+}
+
+static int ideapad_dev_get_state(int device)
+{
+       acpi_status status;
+       union acpi_object in_param;
+       struct acpi_object_list input = { 1, &in_param };
+       struct acpi_buffer output;
+       union acpi_object out_obj;
+
+       output.length = sizeof(out_obj);
+       output.pointer = &out_obj;
+
+       in_param.type = ACPI_TYPE_INTEGER;
+       in_param.integer.value = device + 1;
+
+       status = acpi_evaluate_object(NULL, "\\_SB_.GECN", &input, &output);
+       if (ACPI_FAILURE(status)) {
+               printk(KERN_WARNING "IdeaPAD \\_SB_.GECN method failed %d\n", status);
+               return -ENODEV;
+       }
+       if (out_obj.type != ACPI_TYPE_INTEGER) {
+               printk(KERN_WARNING "IdeaPAD \\_SB_.GECN method returned unexpected type\n");
+               return -ENODEV;
+       }
+       return out_obj.integer.value;
+}
+
+static int ideapad_dev_set_state(int device, int state)
+{
+       acpi_status status;
+       union acpi_object in_params[2];
+       struct acpi_object_list input = { 2, in_params };
+
+       in_params[0].type = ACPI_TYPE_INTEGER;
+       in_params[0].integer.value = device + 1;
+       in_params[1].type = ACPI_TYPE_INTEGER;
+       in_params[1].integer.value = state;
+
+       status = acpi_evaluate_object(NULL, "\\_SB_.SECN", &input, NULL);
+       if (ACPI_FAILURE(status)) {
+               printk(KERN_WARNING "IdeaPAD \\_SB_.SECN method failed %d\n", status);
+               return -ENODEV;
+       }
+       return 0;
+}
+static ssize_t show_ideapad_cam(struct device *dev,
+                               struct device_attribute *attr,
+                               char *buf)
+{
+       int state = ideapad_dev_get_state(IDEAPAD_DEV_CAMERA);
+       if (state < 0)
+               return state;
+
+       return sprintf(buf, "%d\n", state);
+}
+
+static ssize_t store_ideapad_cam(struct device *dev,
+                                struct device_attribute *attr,
+                                const char *buf, size_t count)
+{
+       int ret, state;
+
+       if (!count)
+               return 0;
+       if (sscanf(buf, "%i", &state) != 1)
+               return -EINVAL;
+       ret = ideapad_dev_set_state(IDEAPAD_DEV_CAMERA, !!state);
+       if (ret < 0)
+               return ret;
+       return count;
+}
+
+static DEVICE_ATTR(camera_power, 0644, show_ideapad_cam, store_ideapad_cam);
+
+static int ideapad_rfk_set(void *data, bool blocked)
+{
+       int device = (unsigned long)data;
+
+       if (device == IDEAPAD_DEV_KILLSW)
+               return -EINVAL;
+       return ideapad_dev_set_state(device, !blocked);
+}
+
+static struct rfkill_ops ideapad_rfk_ops = {
+       .set_block = ideapad_rfk_set,
+};
+
+static void ideapad_sync_rfk_state(struct acpi_device *adevice)
+{
+       struct ideapad_private *priv = dev_get_drvdata(&adevice->dev);
+       int hw_blocked = !ideapad_dev_get_state(IDEAPAD_DEV_KILLSW);
+       int i;
+
+       rfkill_set_hw_state(priv->rfk[IDEAPAD_DEV_KILLSW], hw_blocked);
+       for (i = IDEAPAD_DEV_WLAN; i < IDEAPAD_DEV_KILLSW; i++)
+               if (priv->rfk[i])
+                       rfkill_set_hw_state(priv->rfk[i], hw_blocked);
+       if (hw_blocked)
+               return;
+
+       for (i = IDEAPAD_DEV_WLAN; i < IDEAPAD_DEV_KILLSW; i++)
+               if (priv->rfk[i])
+                       rfkill_set_sw_state(priv->rfk[i], !ideapad_dev_get_state(i));
+}
+
+static int ideapad_register_rfkill(struct acpi_device *adevice, int dev)
+{
+       struct ideapad_private *priv = dev_get_drvdata(&adevice->dev);
+       int ret;
+
+       priv->rfk[dev] = rfkill_alloc(ideapad_rfk_data[dev-1].name, &adevice->dev,
+                                     ideapad_rfk_data[dev-1].type, &ideapad_rfk_ops,
+                                     (void *)(long)dev);
+       if (!priv->rfk[dev])
+               return -ENOMEM;
+
+       ret = rfkill_register(priv->rfk[dev]);
+       if (ret) {
+               rfkill_destroy(priv->rfk[dev]);
+               return ret;
+       }
+       return 0;
+}
+
+static void ideapad_unregister_rfkill(struct acpi_device *adevice, int dev)
+{
+       struct ideapad_private *priv = dev_get_drvdata(&adevice->dev);
+
+       if (!priv->rfk[dev])
+               return;
+
+       rfkill_unregister(priv->rfk[dev]);
+       rfkill_destroy(priv->rfk[dev]);
+}
+
+static const struct acpi_device_id ideapad_device_ids[] = {
+       { "VPC2004", 0},
+       { "", 0},
+};
+MODULE_DEVICE_TABLE(acpi, ideapad_device_ids);
+
+static int ideapad_acpi_add(struct acpi_device *adevice)
+{
+       int i;
+       int devs_present[5];
+       struct ideapad_private *priv;
+
+       for (i = IDEAPAD_DEV_CAMERA; i < IDEAPAD_DEV_KILLSW; i++) {
+               devs_present[i] = ideapad_dev_exists(i);
+               if (devs_present[i] < 0)
+                       return devs_present[i];
+       }
+
+       /* The hardware switch is always present */
+       devs_present[IDEAPAD_DEV_KILLSW] = 1;
+
+       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+       if (!priv)
+               return -ENOMEM;
+
+       if (devs_present[IDEAPAD_DEV_CAMERA]) {
+               int ret = device_create_file(&adevice->dev, &dev_attr_camera_power);
+               if (ret) {
+                       kfree(priv);
+                       return ret;
+               }
+       }
+
+       dev_set_drvdata(&adevice->dev, priv);
+       for (i = IDEAPAD_DEV_WLAN; i <= IDEAPAD_DEV_KILLSW; i++) {
+               if (!devs_present[i])
+                       continue;
+
+               ideapad_register_rfkill(adevice, i);
+       }
+       ideapad_sync_rfk_state(adevice);
+       return 0;
+}
+
+static int ideapad_acpi_remove(struct acpi_device *adevice, int type)
+{
+       struct ideapad_private *priv = dev_get_drvdata(&adevice->dev);
+       int i;
+
+       device_remove_file(&adevice->dev, &dev_attr_camera_power);
+
+       for (i = IDEAPAD_DEV_WLAN; i <= IDEAPAD_DEV_KILLSW; i++)
+               ideapad_unregister_rfkill(adevice, i);
+
+       dev_set_drvdata(&adevice->dev, NULL);
+       kfree(priv);
+       return 0;
+}
+
+static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
+{
+       ideapad_sync_rfk_state(adevice);
+}
+
+static struct acpi_driver ideapad_acpi_driver = {
+       .name = "ideapad_acpi",
+       .class = "IdeaPad",
+       .ids = ideapad_device_ids,
+       .ops.add = ideapad_acpi_add,
+       .ops.remove = ideapad_acpi_remove,
+       .ops.notify = ideapad_acpi_notify,
+       .owner = THIS_MODULE,
+};
+
+
+static int __init ideapad_acpi_module_init(void)
+{
+       acpi_bus_register_driver(&ideapad_acpi_driver);
+
+       return 0;
+}
+
+
+static void __exit ideapad_acpi_module_exit(void)
+{
+       acpi_bus_unregister_driver(&ideapad_acpi_driver);
+
+}
+
+MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
+MODULE_DESCRIPTION("IdeaPad ACPI Extras");
+MODULE_LICENSE("GPL");
+
+module_init(ideapad_acpi_module_init);
+module_exit(ideapad_acpi_module_exit);
index 1a84fae..8373ca0 100644 (file)
@@ -1325,14 +1325,14 @@ static void __dasd_device_check_expire(struct dasd_device *device)
                if (device->discipline->term_IO(cqr) != 0) {
                        /* Hmpf, try again in 5 sec */
                        dev_err(&device->cdev->dev,
-                               "cqr %p timed out (%is) but cannot be "
+                               "cqr %p timed out (%lus) but cannot be "
                                "ended, retrying in 5 s\n",
                                cqr, (cqr->expires/HZ));
                        cqr->expires += 5*HZ;
                        dasd_device_set_timer(device, 5*HZ);
                } else {
                        dev_err(&device->cdev->dev,
-                               "cqr %p timed out (%is), %i retries "
+                               "cqr %p timed out (%lus), %i retries "
                                "remaining\n", cqr, (cqr->expires/HZ),
                                cqr->retries);
                }
index a75ed30..8e4153d 100644 (file)
@@ -386,7 +386,7 @@ claw_tx(struct sk_buff *skb, struct net_device *dev)
         struct chbk *p_ch;
 
        CLAW_DBF_TEXT(4, trace, "claw_tx");
-        p_ch=&privptr->channel[WRITE];
+       p_ch = &privptr->channel[WRITE_CHANNEL];
         spin_lock_irqsave(get_ccwdev_lock(p_ch->cdev), saveflags);
         rc=claw_hw_tx( skb, dev, 1 );
         spin_unlock_irqrestore(get_ccwdev_lock(p_ch->cdev), saveflags);
@@ -407,7 +407,7 @@ static struct sk_buff *
 claw_pack_skb(struct claw_privbk *privptr)
 {
        struct sk_buff *new_skb,*held_skb;
-       struct chbk *p_ch = &privptr->channel[WRITE];
+       struct chbk *p_ch = &privptr->channel[WRITE_CHANNEL];
        struct claw_env  *p_env = privptr->p_env;
        int     pkt_cnt,pk_ind,so_far;
 
@@ -515,15 +515,15 @@ claw_open(struct net_device *dev)
                privptr->p_env->write_size=CLAW_FRAME_SIZE;
        }
         claw_set_busy(dev);
-       tasklet_init(&privptr->channel[READ].tasklet, claw_irq_tasklet,
-               (unsigned long) &privptr->channel[READ]);
+       tasklet_init(&privptr->channel[READ_CHANNEL].tasklet, claw_irq_tasklet,
+               (unsigned long) &privptr->channel[READ_CHANNEL]);
         for ( i = 0; i < 2;  i++) {
                CLAW_DBF_TEXT_(2, trace, "opn_ch%d", i);
                 init_waitqueue_head(&privptr->channel[i].wait);
                /* skb_queue_head_init(&p_ch->io_queue); */
-               if (i == WRITE)
+               if (i == WRITE_CHANNEL)
                        skb_queue_head_init(
-                               &privptr->channel[WRITE].collect_queue);
+                               &privptr->channel[WRITE_CHANNEL].collect_queue);
                 privptr->channel[i].flag_a = 0;
                 privptr->channel[i].IO_active = 0;
                 privptr->channel[i].flag  &= ~CLAW_TIMER;
@@ -551,12 +551,12 @@ claw_open(struct net_device *dev)
                 if((privptr->channel[i].flag & CLAW_TIMER) == 0x00)
                         del_timer(&timer);
         }
-        if ((((privptr->channel[READ].last_dstat |
-               privptr->channel[WRITE].last_dstat) &
+       if ((((privptr->channel[READ_CHANNEL].last_dstat |
+               privptr->channel[WRITE_CHANNEL].last_dstat) &
            ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) ||
-           (((privptr->channel[READ].flag |
-               privptr->channel[WRITE].flag) & CLAW_TIMER) != 0x00)) {
-               dev_info(&privptr->channel[READ].cdev->dev,
+          (((privptr->channel[READ_CHANNEL].flag |
+               privptr->channel[WRITE_CHANNEL].flag) & CLAW_TIMER) != 0x00)) {
+               dev_info(&privptr->channel[READ_CHANNEL].cdev->dev,
                        "%s: remote side is not ready\n", dev->name);
                CLAW_DBF_TEXT(2, trace, "notrdy");
 
@@ -608,8 +608,8 @@ claw_open(struct net_device *dev)
                         }
                 }
                privptr->buffs_alloc = 0;
-               privptr->channel[READ].flag= 0x00;
-               privptr->channel[WRITE].flag = 0x00;
+               privptr->channel[READ_CHANNEL].flag = 0x00;
+               privptr->channel[WRITE_CHANNEL].flag = 0x00;
                 privptr->p_buff_ccw=NULL;
                 privptr->p_buff_read=NULL;
                 privptr->p_buff_write=NULL;
@@ -652,10 +652,10 @@ claw_irq_handler(struct ccw_device *cdev,
         }
 
        /* Try to extract channel from driver data. */
-       if (privptr->channel[READ].cdev == cdev)
-               p_ch = &privptr->channel[READ];
-       else if (privptr->channel[WRITE].cdev == cdev)
-               p_ch = &privptr->channel[WRITE];
+       if (privptr->channel[READ_CHANNEL].cdev == cdev)
+               p_ch = &privptr->channel[READ_CHANNEL];
+       else if (privptr->channel[WRITE_CHANNEL].cdev == cdev)
+               p_ch = &privptr->channel[WRITE_CHANNEL];
        else {
                dev_warn(&cdev->dev, "The device is not a CLAW device\n");
                CLAW_DBF_TEXT(2, trace, "badchan");
@@ -813,7 +813,7 @@ claw_irq_handler(struct ccw_device *cdev,
                        claw_clearbit_busy(TB_TX, dev);
                        claw_clear_busy(dev);
                }
-               p_ch_r = (struct chbk *)&privptr->channel[READ];
+               p_ch_r = (struct chbk *)&privptr->channel[READ_CHANNEL];
                if (test_and_set_bit(CLAW_BH_ACTIVE,
                        (void *)&p_ch_r->flag_a) == 0)
                        tasklet_schedule(&p_ch_r->tasklet);
@@ -878,13 +878,13 @@ claw_release(struct net_device *dev)
         for ( i = 1; i >=0 ;  i--) {
                 spin_lock_irqsave(
                        get_ccwdev_lock(privptr->channel[i].cdev), saveflags);
-             /*   del_timer(&privptr->channel[READ].timer);  */
+            /*   del_timer(&privptr->channel[READ_CHANNEL].timer);  */
                privptr->channel[i].claw_state = CLAW_STOP;
                 privptr->channel[i].IO_active = 0;
                 parm = (unsigned long) &privptr->channel[i];
-               if (i == WRITE)
+               if (i == WRITE_CHANNEL)
                        claw_purge_skb_queue(
-                               &privptr->channel[WRITE].collect_queue);
+                               &privptr->channel[WRITE_CHANNEL].collect_queue);
                 rc = ccw_device_halt (privptr->channel[i].cdev, parm);
                if (privptr->system_validate_comp==0x00)  /* never opened? */
                    init_waitqueue_head(&privptr->channel[i].wait);
@@ -971,16 +971,16 @@ claw_release(struct net_device *dev)
         privptr->mtc_skipping = 1;
         privptr->mtc_offset=0;
 
-        if (((privptr->channel[READ].last_dstat |
-               privptr->channel[WRITE].last_dstat) &
+       if (((privptr->channel[READ_CHANNEL].last_dstat |
+               privptr->channel[WRITE_CHANNEL].last_dstat) &
                ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) {
-               dev_warn(&privptr->channel[READ].cdev->dev,
+               dev_warn(&privptr->channel[READ_CHANNEL].cdev->dev,
                        "Deactivating %s completed with incorrect"
                        " subchannel status "
                        "(read %02x, write %02x)\n",
                 dev->name,
-               privptr->channel[READ].last_dstat,
-               privptr->channel[WRITE].last_dstat);
+               privptr->channel[READ_CHANNEL].last_dstat,
+               privptr->channel[WRITE_CHANNEL].last_dstat);
                 CLAW_DBF_TEXT(2, trace, "badclose");
         }
        CLAW_DBF_TEXT(4, trace, "rlsexit");
@@ -1324,7 +1324,7 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid)
 
        CLAW_DBF_TEXT(4, trace, "hw_tx");
        privptr = (struct claw_privbk *)(dev->ml_priv);
-        p_ch=(struct chbk *)&privptr->channel[WRITE];
+       p_ch = (struct chbk *)&privptr->channel[WRITE_CHANNEL];
        p_env =privptr->p_env;
        claw_free_wrt_buf(dev); /* Clean up free chain if posible */
         /*  scan the write queue to free any completed write packets   */
@@ -1357,7 +1357,7 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid)
                                 claw_strt_out_IO(dev );
                                 claw_free_wrt_buf( dev );
                                 if (privptr->write_free_count==0) {
-                                       ch = &privptr->channel[WRITE];
+                                       ch = &privptr->channel[WRITE_CHANNEL];
                                        atomic_inc(&skb->users);
                                        skb_queue_tail(&ch->collect_queue, skb);
                                        goto Done;
@@ -1369,7 +1369,7 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid)
                 }
                 /*  tx lock  */
                 if (claw_test_and_setbit_busy(TB_TX,dev)) { /* set to busy */
-                       ch = &privptr->channel[WRITE];
+                       ch = &privptr->channel[WRITE_CHANNEL];
                        atomic_inc(&skb->users);
                        skb_queue_tail(&ch->collect_queue, skb);
                         claw_strt_out_IO(dev );
@@ -1385,7 +1385,7 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid)
             privptr->p_write_free_chain == NULL ) {
 
                 claw_setbit_busy(TB_NOBUFFER,dev);
-               ch = &privptr->channel[WRITE];
+               ch = &privptr->channel[WRITE_CHANNEL];
                atomic_inc(&skb->users);
                skb_queue_tail(&ch->collect_queue, skb);
                CLAW_DBF_TEXT(2, trace, "clawbusy");
@@ -1397,7 +1397,7 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid)
         while (len_of_data > 0) {
                 p_this_ccw=privptr->p_write_free_chain;  /* get a block */
                if (p_this_ccw == NULL) { /* lost the race */
-                       ch = &privptr->channel[WRITE];
+                       ch = &privptr->channel[WRITE_CHANNEL];
                        atomic_inc(&skb->users);
                        skb_queue_tail(&ch->collect_queue, skb);
                        goto Done2;
@@ -2067,7 +2067,7 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                        *catch up to each other */
        privptr = dev->ml_priv;
         p_env=privptr->p_env;
-       tdev = &privptr->channel[READ].cdev->dev;
+       tdev = &privptr->channel[READ_CHANNEL].cdev->dev;
        memcpy( &temp_host_name, p_env->host_name, 8);
         memcpy( &temp_ws_name, p_env->adapter_name , 8);
        dev_info(tdev, "%s: CLAW device %.8s: "
@@ -2245,7 +2245,7 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                        dev->name, temp_ws_name,
                        p_ctlbk->linkid);
                        privptr->active_link_ID = p_ctlbk->linkid;
-                       p_ch = &privptr->channel[WRITE];
+                       p_ch = &privptr->channel[WRITE_CHANNEL];
                        wake_up(&p_ch->wait);  /* wake up claw_open ( WRITE) */
                break;
        case CONNECTION_RESPONSE:
@@ -2296,7 +2296,7 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                                "%s: Confirmed Now packing\n", dev->name);
                                p_env->packing = DO_PACKED;
                        }
-                       p_ch = &privptr->channel[WRITE];
+                       p_ch = &privptr->channel[WRITE_CHANNEL];
                        wake_up(&p_ch->wait);
                } else {
                        dev_warn(tdev, "Activating %s failed because of"
@@ -2556,7 +2556,7 @@ unpack_read(struct net_device *dev )
        p_packd=NULL;
        privptr = dev->ml_priv;
 
-       p_dev = &privptr->channel[READ].cdev->dev;
+       p_dev = &privptr->channel[READ_CHANNEL].cdev->dev;
        p_env = privptr->p_env;
         p_this_ccw=privptr->p_read_active_first;
        while (p_this_ccw!=NULL && p_this_ccw->header.flag!=CLAW_PENDING) {
@@ -2728,7 +2728,7 @@ claw_strt_read (struct net_device *dev, int lock )
         struct ccwbk*p_ccwbk;
         struct chbk *p_ch;
         struct clawh *p_clawh;
-        p_ch=&privptr->channel[READ];
+       p_ch = &privptr->channel[READ_CHANNEL];
 
        CLAW_DBF_TEXT(4, trace, "StRdNter");
         p_clawh=(struct clawh *)privptr->p_claw_signal_blk;
@@ -2782,7 +2782,7 @@ claw_strt_out_IO( struct net_device *dev )
                return;
        }
        privptr = (struct claw_privbk *)dev->ml_priv;
-        p_ch=&privptr->channel[WRITE];
+       p_ch = &privptr->channel[WRITE_CHANNEL];
 
        CLAW_DBF_TEXT(4, trace, "strt_io");
         p_first_ccw=privptr->p_write_active_first;
@@ -2875,7 +2875,7 @@ claw_free_netdevice(struct net_device * dev, int free_dev)
        if (dev->flags & IFF_RUNNING)
                claw_release(dev);
        if (privptr) {
-               privptr->channel[READ].ndev = NULL;  /* say it's free */
+               privptr->channel[READ_CHANNEL].ndev = NULL;  /* say it's free */
        }
        dev->ml_priv = NULL;
 #ifdef MODULE
@@ -2960,18 +2960,18 @@ claw_new_device(struct ccwgroup_device *cgdev)
        struct ccw_dev_id dev_id;
 
        dev_info(&cgdev->dev, "add for %s\n",
-                dev_name(&cgdev->cdev[READ]->dev));
+                dev_name(&cgdev->cdev[READ_CHANNEL]->dev));
        CLAW_DBF_TEXT(2, setup, "new_dev");
        privptr = dev_get_drvdata(&cgdev->dev);
-       dev_set_drvdata(&cgdev->cdev[READ]->dev, privptr);
-       dev_set_drvdata(&cgdev->cdev[WRITE]->dev, privptr);
+       dev_set_drvdata(&cgdev->cdev[READ_CHANNEL]->dev, privptr);
+       dev_set_drvdata(&cgdev->cdev[WRITE_CHANNEL]->dev, privptr);
        if (!privptr)
                return -ENODEV;
        p_env = privptr->p_env;
-       ccw_device_get_id(cgdev->cdev[READ], &dev_id);
-       p_env->devno[READ] = dev_id.devno;
-       ccw_device_get_id(cgdev->cdev[WRITE], &dev_id);
-       p_env->devno[WRITE] = dev_id.devno;
+       ccw_device_get_id(cgdev->cdev[READ_CHANNEL], &dev_id);
+       p_env->devno[READ_CHANNEL] = dev_id.devno;
+       ccw_device_get_id(cgdev->cdev[WRITE_CHANNEL], &dev_id);
+       p_env->devno[WRITE_CHANNEL] = dev_id.devno;
        ret = add_channel(cgdev->cdev[0],0,privptr);
        if (ret == 0)
                ret = add_channel(cgdev->cdev[1],1,privptr);
@@ -2980,14 +2980,14 @@ claw_new_device(struct ccwgroup_device *cgdev)
                        " failed with error code %d\n", ret);
                goto out;
        }
-       ret = ccw_device_set_online(cgdev->cdev[READ]);
+       ret = ccw_device_set_online(cgdev->cdev[READ_CHANNEL]);
        if (ret != 0) {
                dev_warn(&cgdev->dev,
                        "Setting the read subchannel online"
                        " failed with error code %d\n", ret);
                goto out;
        }
-       ret = ccw_device_set_online(cgdev->cdev[WRITE]);
+       ret = ccw_device_set_online(cgdev->cdev[WRITE_CHANNEL]);
        if (ret != 0) {
                dev_warn(&cgdev->dev,
                        "Setting the write subchannel online "
@@ -3002,8 +3002,8 @@ claw_new_device(struct ccwgroup_device *cgdev)
        }
        dev->ml_priv = privptr;
        dev_set_drvdata(&cgdev->dev, privptr);
-       dev_set_drvdata(&cgdev->cdev[READ]->dev, privptr);
-       dev_set_drvdata(&cgdev->cdev[WRITE]->dev, privptr);
+       dev_set_drvdata(&cgdev->cdev[READ_CHANNEL]->dev, privptr);
+       dev_set_drvdata(&cgdev->cdev[WRITE_CHANNEL]->dev, privptr);
        /* sysfs magic */
         SET_NETDEV_DEV(dev, &cgdev->dev);
        if (register_netdev(dev) != 0) {
@@ -3021,16 +3021,16 @@ claw_new_device(struct ccwgroup_device *cgdev)
                        goto out;
                }
        }
-       privptr->channel[READ].ndev = dev;
-       privptr->channel[WRITE].ndev = dev;
+       privptr->channel[READ_CHANNEL].ndev = dev;
+       privptr->channel[WRITE_CHANNEL].ndev = dev;
        privptr->p_env->ndev = dev;
 
        dev_info(&cgdev->dev, "%s:readsize=%d  writesize=%d "
                "readbuffer=%d writebuffer=%d read=0x%04x write=0x%04x\n",
                 dev->name, p_env->read_size,
                p_env->write_size, p_env->read_buffers,
-                p_env->write_buffers, p_env->devno[READ],
-               p_env->devno[WRITE]);
+               p_env->write_buffers, p_env->devno[READ_CHANNEL],
+               p_env->devno[WRITE_CHANNEL]);
        dev_info(&cgdev->dev, "%s:host_name:%.8s, adapter_name "
                ":%.8s api_type: %.8s\n",
                 dev->name, p_env->host_name,
@@ -3072,10 +3072,10 @@ claw_shutdown_device(struct ccwgroup_device *cgdev)
        priv = dev_get_drvdata(&cgdev->dev);
        if (!priv)
                return -ENODEV;
-       ndev = priv->channel[READ].ndev;
+       ndev = priv->channel[READ_CHANNEL].ndev;
        if (ndev) {
                /* Close the device */
-               dev_info(&cgdev->dev, "%s: shutting down \n",
+               dev_info(&cgdev->dev, "%s: shutting down\n",
                        ndev->name);
                if (ndev->flags & IFF_RUNNING)
                        ret = claw_release(ndev);
@@ -3083,8 +3083,8 @@ claw_shutdown_device(struct ccwgroup_device *cgdev)
                unregister_netdev(ndev);
                ndev->ml_priv = NULL;  /* cgdev data, not ndev's to free */
                claw_free_netdevice(ndev, 1);
-               priv->channel[READ].ndev = NULL;
-               priv->channel[WRITE].ndev = NULL;
+               priv->channel[READ_CHANNEL].ndev = NULL;
+               priv->channel[WRITE_CHANNEL].ndev = NULL;
                priv->p_env->ndev = NULL;
        }
        ccw_device_set_offline(cgdev->cdev[1]);
@@ -3115,8 +3115,8 @@ claw_remove_device(struct ccwgroup_device *cgdev)
        priv->channel[1].irb=NULL;
        kfree(priv);
        dev_set_drvdata(&cgdev->dev, NULL);
-       dev_set_drvdata(&cgdev->cdev[READ]->dev, NULL);
-       dev_set_drvdata(&cgdev->cdev[WRITE]->dev, NULL);
+       dev_set_drvdata(&cgdev->cdev[READ_CHANNEL]->dev, NULL);
+       dev_set_drvdata(&cgdev->cdev[WRITE_CHANNEL]->dev, NULL);
        put_device(&cgdev->dev);
 
        return;
index 46d59a1..1bc5904 100644 (file)
@@ -74,8 +74,8 @@
 #define MAX_ENVELOPE_SIZE       65536
 #define CLAW_DEFAULT_MTU_SIZE   4096
 #define DEF_PACK_BUFSIZE       32768
-#define READ                    0
-#define WRITE                   1
+#define READ_CHANNEL           0
+#define WRITE_CHANNEL          1
 
 #define TB_TX                   0          /* sk buffer handling in process  */
 #define TB_STOP                 1          /* network device stop in process */
index 70eb7f1..8c921fc 100644 (file)
@@ -454,7 +454,7 @@ static void chx_firstio(fsm_instance *fi, int event, void *arg)
        if ((fsmstate == CTC_STATE_SETUPWAIT) &&
            (ch->protocol == CTCM_PROTO_OS390)) {
                /* OS/390 resp. z/OS */
-               if (CHANNEL_DIRECTION(ch->flags) == READ) {
+               if (CHANNEL_DIRECTION(ch->flags) == CTCM_READ) {
                        *((__u16 *)ch->trans_skb->data) = CTCM_INITIAL_BLOCKLEN;
                        fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC,
                                     CTC_EVENT_TIMER, ch);
@@ -472,14 +472,14 @@ static void chx_firstio(fsm_instance *fi, int event, void *arg)
         * if in compatibility mode, since VM TCP delays the initial
         * frame until it has some data to send.
         */
-       if ((CHANNEL_DIRECTION(ch->flags) == WRITE) ||
+       if ((CHANNEL_DIRECTION(ch->flags) == CTCM_WRITE) ||
            (ch->protocol != CTCM_PROTO_S390))
                fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch);
 
        *((__u16 *)ch->trans_skb->data) = CTCM_INITIAL_BLOCKLEN;
        ch->ccw[1].count = 2;   /* Transfer only length */
 
-       fsm_newstate(fi, (CHANNEL_DIRECTION(ch->flags) == READ)
+       fsm_newstate(fi, (CHANNEL_DIRECTION(ch->flags) == CTCM_READ)
                     ? CTC_STATE_RXINIT : CTC_STATE_TXINIT);
        rc = ccw_device_start(ch->cdev, &ch->ccw[0],
                                        (unsigned long)ch, 0xff, 0);
@@ -495,7 +495,7 @@ static void chx_firstio(fsm_instance *fi, int event, void *arg)
         * reply from VM TCP which brings up the RX channel to it's
         * final state.
         */
-       if ((CHANNEL_DIRECTION(ch->flags) == READ) &&
+       if ((CHANNEL_DIRECTION(ch->flags) == CTCM_READ) &&
            (ch->protocol == CTCM_PROTO_S390)) {
                struct net_device *dev = ch->netdev;
                struct ctcm_priv *priv = dev->ml_priv;
@@ -600,15 +600,15 @@ static void ctcm_chx_start(fsm_instance *fi, int event, void *arg)
        int rc;
 
        CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, "%s(%s): %s",
-                       CTCM_FUNTAIL, ch->id,
-                       (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX");
+               CTCM_FUNTAIL, ch->id,
+               (CHANNEL_DIRECTION(ch->flags) == CTCM_READ) ? "RX" : "TX");
 
        if (ch->trans_skb != NULL) {
                clear_normalized_cda(&ch->ccw[1]);
                dev_kfree_skb(ch->trans_skb);
                ch->trans_skb = NULL;
        }
-       if (CHANNEL_DIRECTION(ch->flags) == READ) {
+       if (CHANNEL_DIRECTION(ch->flags) == CTCM_READ) {
                ch->ccw[1].cmd_code = CCW_CMD_READ;
                ch->ccw[1].flags = CCW_FLAG_SLI;
                ch->ccw[1].count = 0;
@@ -622,7 +622,8 @@ static void ctcm_chx_start(fsm_instance *fi, int event, void *arg)
                        "%s(%s): %s trans_skb alloc delayed "
                        "until first transfer",
                        CTCM_FUNTAIL, ch->id,
-                       (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX");
+                       (CHANNEL_DIRECTION(ch->flags) == CTCM_READ) ?
+                               "RX" : "TX");
        }
        ch->ccw[0].cmd_code = CCW_CMD_PREPARE;
        ch->ccw[0].flags = CCW_FLAG_SLI | CCW_FLAG_CC;
@@ -720,7 +721,7 @@ static void ctcm_chx_cleanup(fsm_instance *fi, int state,
 
        ch->th_seg = 0x00;
        ch->th_seq_num = 0x00;
-       if (CHANNEL_DIRECTION(ch->flags) == READ) {
+       if (CHANNEL_DIRECTION(ch->flags) == CTCM_READ) {
                skb_queue_purge(&ch->io_queue);
                fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev);
        } else {
@@ -799,7 +800,8 @@ static void ctcm_chx_setuperr(fsm_instance *fi, int event, void *arg)
                fsm_newstate(fi, CTC_STATE_STARTRETRY);
                fsm_deltimer(&ch->timer);
                fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch);
-               if (!IS_MPC(ch) && (CHANNEL_DIRECTION(ch->flags) == READ)) {
+               if (!IS_MPC(ch) &&
+                   (CHANNEL_DIRECTION(ch->flags) == CTCM_READ)) {
                        int rc = ccw_device_halt(ch->cdev, (unsigned long)ch);
                        if (rc != 0)
                                ctcm_ccw_check_rc(ch, rc,
@@ -811,10 +813,10 @@ static void ctcm_chx_setuperr(fsm_instance *fi, int event, void *arg)
        CTCM_DBF_TEXT_(ERROR, CTC_DBF_CRIT,
                "%s(%s) : %s error during %s channel setup state=%s\n",
                CTCM_FUNTAIL, dev->name, ctc_ch_event_names[event],
-               (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX",
+               (CHANNEL_DIRECTION(ch->flags) == CTCM_READ) ? "RX" : "TX",
                fsm_getstate_str(fi));
 
-       if (CHANNEL_DIRECTION(ch->flags) == READ) {
+       if (CHANNEL_DIRECTION(ch->flags) == CTCM_READ) {
                fsm_newstate(fi, CTC_STATE_RXERR);
                fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev);
        } else {
@@ -945,7 +947,7 @@ static void ctcm_chx_rxdisc(fsm_instance *fi, int event, void *arg)
        fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev);
 
        fsm_newstate(fi, CTC_STATE_DTERM);
-       ch2 = priv->channel[WRITE];
+       ch2 = priv->channel[CTCM_WRITE];
        fsm_newstate(ch2->fsm, CTC_STATE_DTERM);
 
        ccw_device_halt(ch->cdev, (unsigned long)ch);
@@ -1074,13 +1076,13 @@ static void ctcm_chx_iofatal(fsm_instance *fi, int event, void *arg)
        fsm_deltimer(&ch->timer);
        CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR,
                "%s: %s: %s unrecoverable channel error",
-                       CTCM_FUNTAIL, ch->id, rd == READ ? "RX" : "TX");
+                       CTCM_FUNTAIL, ch->id, rd == CTCM_READ ? "RX" : "TX");
 
        if (IS_MPC(ch)) {
                priv->stats.tx_dropped++;
                priv->stats.tx_errors++;
        }
-       if (rd == READ) {
+       if (rd == CTCM_READ) {
                fsm_newstate(fi, CTC_STATE_RXERR);
                fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev);
        } else {
@@ -1503,7 +1505,7 @@ static void ctcmpc_chx_firstio(fsm_instance *fi, int event, void *arg)
        switch (fsm_getstate(fi)) {
        case CTC_STATE_STARTRETRY:
        case CTC_STATE_SETUPWAIT:
-               if (CHANNEL_DIRECTION(ch->flags) == READ) {
+               if (CHANNEL_DIRECTION(ch->flags) == CTCM_READ) {
                        ctcmpc_chx_rxidle(fi, event, arg);
                } else {
                        fsm_newstate(fi, CTC_STATE_TXIDLE);
@@ -1514,7 +1516,7 @@ static void ctcmpc_chx_firstio(fsm_instance *fi, int event, void *arg)
                break;
        };
 
-       fsm_newstate(fi, (CHANNEL_DIRECTION(ch->flags) == READ)
+       fsm_newstate(fi, (CHANNEL_DIRECTION(ch->flags) == CTCM_READ)
                     ? CTC_STATE_RXINIT : CTC_STATE_TXINIT);
 
 done:
@@ -1753,8 +1755,8 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg)
        struct net_device *dev = ach->netdev;
        struct ctcm_priv *priv = dev->ml_priv;
        struct mpc_group *grp = priv->mpcg;
-       struct channel *wch = priv->channel[WRITE];
-       struct channel *rch = priv->channel[READ];
+       struct channel *wch = priv->channel[CTCM_WRITE];
+       struct channel *rch = priv->channel[CTCM_READ];
        struct sk_buff *skb;
        struct th_sweep *header;
        int rc = 0;
@@ -2070,7 +2072,7 @@ static void dev_action_start(fsm_instance *fi, int event, void *arg)
        fsm_newstate(fi, DEV_STATE_STARTWAIT_RXTX);
        if (IS_MPC(priv))
                priv->mpcg->channels_terminating = 0;
-       for (direction = READ; direction <= WRITE; direction++) {
+       for (direction = CTCM_READ; direction <= CTCM_WRITE; direction++) {
                struct channel *ch = priv->channel[direction];
                fsm_event(ch->fsm, CTC_EVENT_START, ch);
        }
@@ -2092,7 +2094,7 @@ static void dev_action_stop(fsm_instance *fi, int event, void *arg)
        CTCMY_DBF_DEV_NAME(SETUP, dev, "");
 
        fsm_newstate(fi, DEV_STATE_STOPWAIT_RXTX);
-       for (direction = READ; direction <= WRITE; direction++) {
+       for (direction = CTCM_READ; direction <= CTCM_WRITE; direction++) {
                struct channel *ch = priv->channel[direction];
                fsm_event(ch->fsm, CTC_EVENT_STOP, ch);
                ch->th_seq_num = 0x00;
@@ -2183,11 +2185,11 @@ static void dev_action_chup(fsm_instance *fi, int event, void *arg)
 
        if (IS_MPC(priv)) {
                if (event == DEV_EVENT_RXUP)
-                       mpc_channel_action(priv->channel[READ],
-                               READ, MPC_CHANNEL_ADD);
+                       mpc_channel_action(priv->channel[CTCM_READ],
+                               CTCM_READ, MPC_CHANNEL_ADD);
                else
-                       mpc_channel_action(priv->channel[WRITE],
-                               WRITE, MPC_CHANNEL_ADD);
+                       mpc_channel_action(priv->channel[CTCM_WRITE],
+                               CTCM_WRITE, MPC_CHANNEL_ADD);
        }
 }
 
@@ -2239,11 +2241,11 @@ static void dev_action_chdown(fsm_instance *fi, int event, void *arg)
        }
        if (IS_MPC(priv)) {
                if (event == DEV_EVENT_RXDOWN)
-                       mpc_channel_action(priv->channel[READ],
-                               READ, MPC_CHANNEL_REMOVE);
+                       mpc_channel_action(priv->channel[CTCM_READ],
+                               CTCM_READ, MPC_CHANNEL_REMOVE);
                else
-                       mpc_channel_action(priv->channel[WRITE],
-                               WRITE, MPC_CHANNEL_REMOVE);
+                       mpc_channel_action(priv->channel[CTCM_WRITE],
+                               CTCM_WRITE, MPC_CHANNEL_REMOVE);
        }
 }
 
index 4ecafbf..6edf20b 100644 (file)
@@ -267,7 +267,7 @@ static struct channel *channel_get(enum ctcm_channel_types type,
                else {
                        ch->flags |= CHANNEL_FLAGS_INUSE;
                        ch->flags &= ~CHANNEL_FLAGS_RWMASK;
-                       ch->flags |= (direction == WRITE)
+                       ch->flags |= (direction == CTCM_WRITE)
                            ? CHANNEL_FLAGS_WRITE : CHANNEL_FLAGS_READ;
                        fsm_newstate(ch->fsm, CTC_STATE_STOPPED);
                }
@@ -388,7 +388,8 @@ int ctcm_ch_alloc_buffer(struct channel *ch)
                CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR,
                        "%s(%s): %s trans_skb allocation error",
                        CTCM_FUNTAIL, ch->id,
-                       (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX");
+                       (CHANNEL_DIRECTION(ch->flags) == CTCM_READ) ?
+                               "RX" : "TX");
                return -ENOMEM;
        }
 
@@ -399,7 +400,8 @@ int ctcm_ch_alloc_buffer(struct channel *ch)
                CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR,
                        "%s(%s): %s set norm_cda failed",
                        CTCM_FUNTAIL, ch->id,
-                       (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX");
+                       (CHANNEL_DIRECTION(ch->flags) == CTCM_READ) ?
+                               "RX" : "TX");
                return -ENOMEM;
        }
 
@@ -603,14 +605,14 @@ static void ctcmpc_send_sweep_req(struct channel *rch)
 
        priv = dev->ml_priv;
        grp = priv->mpcg;
-       ch = priv->channel[WRITE];
+       ch = priv->channel[CTCM_WRITE];
 
        /* sweep processing is not complete until response and request */
        /* has completed for all read channels in group                */
        if (grp->in_sweep == 0) {
                grp->in_sweep = 1;
-               grp->sweep_rsp_pend_num = grp->active_channels[READ];
-               grp->sweep_req_pend_num = grp->active_channels[READ];
+               grp->sweep_rsp_pend_num = grp->active_channels[CTCM_READ];
+               grp->sweep_req_pend_num = grp->active_channels[CTCM_READ];
        }
 
        sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA);
@@ -911,7 +913,7 @@ static int ctcm_tx(struct sk_buff *skb, struct net_device *dev)
                return NETDEV_TX_BUSY;
 
        dev->trans_start = jiffies;
-       if (ctcm_transmit_skb(priv->channel[WRITE], skb) != 0)
+       if (ctcm_transmit_skb(priv->channel[CTCM_WRITE], skb) != 0)
                return NETDEV_TX_BUSY;
        return NETDEV_TX_OK;
 }
@@ -994,7 +996,7 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev)
        }
 
        dev->trans_start = jiffies;
-       if (ctcmpc_transmit_skb(priv->channel[WRITE], skb) != 0) {
+       if (ctcmpc_transmit_skb(priv->channel[CTCM_WRITE], skb) != 0) {
                CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR,
                        "%s(%s): device error - dropped",
                                        CTCM_FUNTAIL, dev->name);
@@ -1035,7 +1037,7 @@ static int ctcm_change_mtu(struct net_device *dev, int new_mtu)
                return -EINVAL;
 
        priv = dev->ml_priv;
-       max_bufsize = priv->channel[READ]->max_bufsize;
+       max_bufsize = priv->channel[CTCM_READ]->max_bufsize;
 
        if (IS_MPC(priv)) {
                if (new_mtu > max_bufsize - TH_HEADER_LENGTH)
@@ -1226,10 +1228,10 @@ static void ctcm_irq_handler(struct ccw_device *cdev,
        priv = dev_get_drvdata(&cgdev->dev);
 
        /* Try to extract channel from driver data. */
-       if (priv->channel[READ]->cdev == cdev)
-               ch = priv->channel[READ];
-       else if (priv->channel[WRITE]->cdev == cdev)
-               ch = priv->channel[WRITE];
+       if (priv->channel[CTCM_READ]->cdev == cdev)
+               ch = priv->channel[CTCM_READ];
+       else if (priv->channel[CTCM_WRITE]->cdev == cdev)
+               ch = priv->channel[CTCM_WRITE];
        else {
                dev_err(&cdev->dev,
                        "%s: Internal error: Can't determine channel for "
@@ -1587,13 +1589,13 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev)
                goto out_ccw2;
        }
 
-       for (direction = READ; direction <= WRITE; direction++) {
+       for (direction = CTCM_READ; direction <= CTCM_WRITE; direction++) {
                priv->channel[direction] =
-                   channel_get(type, direction == READ ? read_id : write_id,
-                               direction);
+                       channel_get(type, direction == CTCM_READ ?
+                               read_id : write_id, direction);
                if (priv->channel[direction] == NULL) {
-                       if (direction == WRITE)
-                               channel_free(priv->channel[READ]);
+                       if (direction == CTCM_WRITE)
+                               channel_free(priv->channel[CTCM_READ]);
                        goto out_dev;
                }
                priv->channel[direction]->netdev = dev;
@@ -1617,13 +1619,13 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev)
 
        dev_info(&dev->dev,
                "setup OK : r/w = %s/%s, protocol : %d\n",
-                       priv->channel[READ]->id,
-                       priv->channel[WRITE]->id, priv->protocol);
+                       priv->channel[CTCM_READ]->id,
+                       priv->channel[CTCM_WRITE]->id, priv->protocol);
 
        CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO,
                "setup(%s) OK : r/w = %s/%s, protocol : %d", dev->name,
-                       priv->channel[READ]->id,
-                       priv->channel[WRITE]->id, priv->protocol);
+                       priv->channel[CTCM_READ]->id,
+                       priv->channel[CTCM_WRITE]->id, priv->protocol);
 
        return 0;
 out_unregister:
@@ -1635,10 +1637,10 @@ out_ccw2:
 out_ccw1:
        ccw_device_set_offline(cgdev->cdev[0]);
 out_remove_channel2:
-       readc = channel_get(type, read_id, READ);
+       readc = channel_get(type, read_id, CTCM_READ);
        channel_remove(readc);
 out_remove_channel1:
-       writec = channel_get(type, write_id, WRITE);
+       writec = channel_get(type, write_id, CTCM_WRITE);
        channel_remove(writec);
 out_err_result:
        return result;
@@ -1660,19 +1662,19 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev)
        if (!priv)
                return -ENODEV;
 
-       if (priv->channel[READ]) {
-               dev = priv->channel[READ]->netdev;
+       if (priv->channel[CTCM_READ]) {
+               dev = priv->channel[CTCM_READ]->netdev;
                CTCM_DBF_DEV(SETUP, dev, "");
                /* Close the device */
                ctcm_close(dev);
                dev->flags &= ~IFF_RUNNING;
                ctcm_remove_attributes(&cgdev->dev);
-               channel_free(priv->channel[READ]);
+               channel_free(priv->channel[CTCM_READ]);
        } else
                dev = NULL;
 
-       if (priv->channel[WRITE])
-               channel_free(priv->channel[WRITE]);
+       if (priv->channel[CTCM_WRITE])
+               channel_free(priv->channel[CTCM_WRITE]);
 
        if (dev) {
                unregister_netdev(dev);
@@ -1685,11 +1687,11 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev)
        ccw_device_set_offline(cgdev->cdev[1]);
        ccw_device_set_offline(cgdev->cdev[0]);
 
-       if (priv->channel[READ])
-               channel_remove(priv->channel[READ]);
-       if (priv->channel[WRITE])
-               channel_remove(priv->channel[WRITE]);
-       priv->channel[READ] = priv->channel[WRITE] = NULL;
+       if (priv->channel[CTCM_READ])
+               channel_remove(priv->channel[CTCM_READ]);
+       if (priv->channel[CTCM_WRITE])
+               channel_remove(priv->channel[CTCM_WRITE]);
+       priv->channel[CTCM_READ] = priv->channel[CTCM_WRITE] = NULL;
 
        return 0;
 
@@ -1720,11 +1722,11 @@ static int ctcm_pm_suspend(struct ccwgroup_device *gdev)
 
        if (gdev->state == CCWGROUP_OFFLINE)
                return 0;
-       netif_device_detach(priv->channel[READ]->netdev);
-       ctcm_close(priv->channel[READ]->netdev);
+       netif_device_detach(priv->channel[CTCM_READ]->netdev);
+       ctcm_close(priv->channel[CTCM_READ]->netdev);
        if (!wait_event_timeout(priv->fsm->wait_q,
            fsm_getstate(priv->fsm) == DEV_STATE_STOPPED, CTCM_TIME_5_SEC)) {
-               netif_device_attach(priv->channel[READ]->netdev);
+               netif_device_attach(priv->channel[CTCM_READ]->netdev);
                return -EBUSY;
        }
        ccw_device_set_offline(gdev->cdev[1]);
@@ -1745,9 +1747,9 @@ static int ctcm_pm_resume(struct ccwgroup_device *gdev)
        rc = ccw_device_set_online(gdev->cdev[0]);
        if (rc)
                goto err_out;
-       ctcm_open(priv->channel[READ]->netdev);
+       ctcm_open(priv->channel[CTCM_READ]->netdev);
 err_out:
-       netif_device_attach(priv->channel[READ]->netdev);
+       netif_device_attach(priv->channel[CTCM_READ]->netdev);
        return rc;
 }
 
index d34fa14..24d5215 100644 (file)
@@ -111,8 +111,8 @@ enum ctcm_channel_types {
 
 #define CTCM_INITIAL_BLOCKLEN  2
 
-#define READ                   0
-#define WRITE                  1
+#define CTCM_READ              0
+#define CTCM_WRITE             1
 
 #define CTCM_ID_SIZE           20+3
 
index 87c24d2..2861e78 100644 (file)
@@ -419,8 +419,8 @@ void ctc_mpc_establish_connectivity(int port_num,
                return;
        priv = dev->ml_priv;
        grp = priv->mpcg;
-       rch = priv->channel[READ];
-       wch = priv->channel[WRITE];
+       rch = priv->channel[CTCM_READ];
+       wch = priv->channel[CTCM_WRITE];
 
        CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_INFO,
                        "%s(%s): state=%s",
@@ -578,7 +578,7 @@ void ctc_mpc_flow_control(int port_num, int flowc)
                        "%s: %s: flowc = %d",
                                CTCM_FUNTAIL, dev->name, flowc);
 
-       rch = priv->channel[READ];
+       rch = priv->channel[CTCM_READ];
 
        mpcg_state = fsm_getstate(grp->fsm);
        switch (flowc) {
@@ -622,7 +622,7 @@ static void mpc_rcvd_sweep_resp(struct mpcg_info *mpcginfo)
        struct net_device *dev = rch->netdev;
        struct ctcm_priv   *priv = dev->ml_priv;
        struct mpc_group  *grp = priv->mpcg;
-       struct channel    *ch = priv->channel[WRITE];
+       struct channel    *ch = priv->channel[CTCM_WRITE];
 
        CTCM_PR_DEBUG("%s: ch=0x%p id=%s\n", __func__, ch, ch->id);
        CTCM_D3_DUMP((char *)mpcginfo->sweep, TH_SWEEP_LENGTH);
@@ -656,7 +656,7 @@ static void ctcmpc_send_sweep_resp(struct channel *rch)
        int rc = 0;
        struct th_sweep *header;
        struct sk_buff *sweep_skb;
-       struct channel *ch  = priv->channel[WRITE];
+       struct channel *ch  = priv->channel[CTCM_WRITE];
 
        CTCM_PR_DEBUG("%s: ch=0x%p id=%s\n", __func__, rch, rch->id);
 
@@ -712,7 +712,7 @@ static void mpc_rcvd_sweep_req(struct mpcg_info *mpcginfo)
        struct net_device *dev     = rch->netdev;
        struct ctcm_priv  *priv = dev->ml_priv;
        struct mpc_group  *grp  = priv->mpcg;
-       struct channel    *ch      = priv->channel[WRITE];
+       struct channel    *ch      = priv->channel[CTCM_WRITE];
 
        if (do_debug)
                CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG,
@@ -721,8 +721,8 @@ static void mpc_rcvd_sweep_req(struct mpcg_info *mpcginfo)
        if (grp->in_sweep == 0) {
                grp->in_sweep = 1;
                ctcm_test_and_set_busy(dev);
-               grp->sweep_req_pend_num = grp->active_channels[READ];
-               grp->sweep_rsp_pend_num = grp->active_channels[READ];
+               grp->sweep_req_pend_num = grp->active_channels[CTCM_READ];
+               grp->sweep_rsp_pend_num = grp->active_channels[CTCM_READ];
        }
 
        CTCM_D3_DUMP((char *)mpcginfo->sweep, TH_SWEEP_LENGTH);
@@ -906,14 +906,14 @@ void mpc_group_ready(unsigned long adev)
        fsm_newstate(grp->fsm, MPCG_STATE_READY);
 
        /* Put up a read on the channel */
-       ch = priv->channel[READ];
+       ch = priv->channel[CTCM_READ];
        ch->pdu_seq = 0;
        CTCM_PR_DBGDAT