Merge http://www.kernel.org/pub/scm/linux/kernel/git/perex/alsa
authorGreg Kroah-Hartman <gregkh@suse.de>
Sat, 5 Aug 2006 17:49:32 +0000 (10:49 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 5 Aug 2006 17:49:32 +0000 (10:49 -0700)
88 files changed:
Documentation/cpu-freq/user-guide.txt
Documentation/infiniband/ipoib.txt
MAINTAINERS
arch/i386/kernel/cpu/cpufreq/Kconfig
arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
arch/i386/kernel/cpu/cpufreq/longhaul.c
arch/ia64/hp/sim/simscsi.c
arch/ia64/kernel/efi.c
arch/ia64/kernel/head.S
arch/ia64/kernel/ia64_ksyms.c
arch/ia64/kernel/pal.S
arch/ia64/kernel/palinfo.c
arch/ia64/kernel/uncached.c
arch/ia64/lib/Makefile
arch/ia64/mm/contig.c
arch/ia64/mm/discontig.c
arch/ia64/mm/init.c
arch/ia64/mm/ioremap.c
arch/ia64/sn/kernel/xpc_main.c
arch/ia64/sn/pci/tioce_provider.c
drivers/acpi/dock.c
drivers/char/keyboard.c
drivers/char/snsc.c
drivers/cpufreq/cpufreq.c
drivers/infiniband/core/cm.c
drivers/infiniband/core/uverbs.h
drivers/infiniband/core/uverbs_main.c
drivers/infiniband/hw/mthca/mthca_allocator.c
drivers/infiniband/ulp/ipoib/Kconfig
drivers/infiniband/ulp/srp/ib_srp.c
drivers/input/evdev.c
drivers/input/gameport/fm801-gp.c
drivers/input/gameport/gameport.c
drivers/input/input.c
drivers/input/joystick/iforce/iforce-main.c
drivers/input/joystick/spaceball.c
drivers/input/keyboard/atkbd.c
drivers/input/misc/wistron_btns.c
drivers/input/mouse/logips2pp.c
drivers/input/mouse/trackpoint.c
drivers/input/serio/libps2.c
drivers/input/serio/serio.c
drivers/net/myri10ge/myri10ge.c
drivers/net/phy/phy.c
drivers/net/s2io.c
drivers/net/s2io.h
drivers/net/wireless/zd1211rw/zd_chip.c
drivers/net/wireless/zd1211rw/zd_chip.h
drivers/net/wireless/zd1211rw/zd_mac.c
drivers/net/wireless/zd1211rw/zd_usb.c
drivers/pci/hotplug/acpiphp_core.c
drivers/pci/hotplug/acpiphp_glue.c
drivers/pci/pcie/portdrv_pci.c
drivers/pci/quirks.c
drivers/pci/search.c
drivers/pnp/interface.c
drivers/scsi/ahci.c
drivers/usb/input/ati_remote.c
drivers/usb/input/hid-input.c
drivers/usb/input/hiddev.c
fs/jfs/inode.c
fs/jfs/jfs_inode.h
fs/jfs/super.c
fs/lockd/svclock.c
fs/namei.c
fs/nfs/namespace.c
fs/nfs/read.c
fs/nfs/write.c
include/asm-ia64/meminit.h
include/asm-ia64/pal.h
include/asm-ia64/sn/xpc.h
include/asm-ia64/system.h
include/linux/audit.h
include/linux/fsnotify.h
include/linux/input.h
include/linux/kobject.h
include/linux/lockd/lockd.h
include/linux/nfs_fs.h
include/linux/pci_ids.h
include/linux/sunrpc/xprt.h
kernel/audit.c
kernel/auditfilter.c
kernel/auditsc.c
lib/kobject_uevent.c
net/sunrpc/clnt.c
net/sunrpc/rpc_pipe.c
net/sunrpc/xprt.c
net/sunrpc/xprtsock.c

index 7fedc00..555c8cf 100644 (file)
@@ -153,10 +153,13 @@ scaling_governor,         and by "echoing" the name of another
                                that some governors won't load - they only
                                work on some specific architectures or
                                processors.
-scaling_min_freq and 
+scaling_min_freq and
 scaling_max_freq               show the current "policy limits" (in
                                kHz). By echoing new values into these
                                files, you can change these limits.
+                               NOTE: when setting a policy you need to
+                               first set scaling_max_freq, then
+                               scaling_min_freq.
 
 
 If you have selected the "userspace" governor which allows you to
index 1870355..864ff32 100644 (file)
@@ -51,8 +51,6 @@ Debugging Information
 
 References
 
-  IETF IP over InfiniBand (ipoib) Working Group
-    http://ietf.org/html.charters/ipoib-charter.html
   Transmission of IP over InfiniBand (IPoIB) (RFC 4391)
     http://ietf.org/rfc/rfc4391.txt 
   IP over InfiniBand (IPoIB) Architecture (RFC 4392)
index 8c267aa..b6c3c54 100644 (file)
@@ -214,6 +214,12 @@ W: http://acpi.sourceforge.net/
 T:     git kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git
 S:     Maintained
 
+ACPI PCI HOTPLUG DRIVER
+P:     Kristen Carlson Accardi
+M:     kristen.c.accardi@intel.com
+L:     pcihpd-discuss@lists.sourceforge.net
+S:     Maintained
+
 AD1816 SOUND DRIVER
 P:     Thorsten Knabe
 M:     Thorsten Knabe <linux@thorsten-knabe.de>
index e44a4c6..ccc1edf 100644 (file)
@@ -96,6 +96,7 @@ config X86_POWERNOW_K8_ACPI
 
 config X86_GX_SUSPMOD
        tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation"
+       depends on PCI
        help
         This add the CPUFreq driver for NatSemi Geode processors which
         support suspend modulation.
@@ -202,7 +203,7 @@ config X86_LONGRUN
 config X86_LONGHAUL
        tristate "VIA Cyrix III Longhaul"
        select CPU_FREQ_TABLE
-       depends on BROKEN
+       depends on ACPI_PROCESSOR
        help
          This adds the CPUFreq driver for VIA Samuel/CyrixIII,
          VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T
index 567b39b..efb41e8 100644 (file)
@@ -384,8 +384,7 @@ static int acpi_cpufreq_early_init_acpi(void)
        }
 
        /* Do initialization in ACPI core */
-       acpi_processor_preregister_performance(acpi_perf_data);
-       return 0;
+       return acpi_processor_preregister_performance(acpi_perf_data);
 }
 
 static int
index 146f607..4f2c3ae 100644 (file)
 #include <linux/cpufreq.h>
 #include <linux/slab.h>
 #include <linux/string.h>
-#include <linux/pci.h>
 
 #include <asm/msr.h>
 #include <asm/timex.h>
 #include <asm/io.h>
+#include <asm/acpi.h>
+#include <linux/acpi.h>
+#include <acpi/processor.h>
 
 #include "longhaul.h"
 
@@ -56,6 +58,8 @@ static int minvid, maxvid;
 static unsigned int minmult, maxmult;
 static int can_scale_voltage;
 static int vrmrev;
+static struct acpi_processor *pr = NULL;
+static struct acpi_processor_cx *cx = NULL;
 
 /* Module parameters */
 static int dont_scale_voltage;
@@ -118,84 +122,65 @@ static int longhaul_get_cpu_mult(void)
        return eblcr_table[invalue];
 }
 
+/* For processor with BCR2 MSR */
 
-static void do_powersaver(union msr_longhaul *longhaul,
-                       unsigned int clock_ratio_index)
+static void do_longhaul1(int cx_address, unsigned int clock_ratio_index)
 {
-       struct pci_dev *dev;
-       unsigned long flags;
-       unsigned int tmp_mask;
-       int version;
-       int i;
-       u16 pci_cmd;
-       u16 cmd_state[64];
+       union msr_bcr2 bcr2;
+       u32 t;
 
-       switch (cpu_model) {
-       case CPU_EZRA_T:
-               version = 3;
-               break;
-       case CPU_NEHEMIAH:
-               version = 0xf;
-               break;
-       default:
-               return;
-       }
+       rdmsrl(MSR_VIA_BCR2, bcr2.val);
+       /* Enable software clock multiplier */
+       bcr2.bits.ESOFTBF = 1;
+       bcr2.bits.CLOCKMUL = clock_ratio_index;
 
-       rdmsrl(MSR_VIA_LONGHAUL, longhaul->val);
-       longhaul->bits.SoftBusRatio = clock_ratio_index & 0xf;
-       longhaul->bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4;
-       longhaul->bits.EnableSoftBusRatio = 1;
-       longhaul->bits.RevisionKey = 0;
+       /* Sync to timer tick */
+       safe_halt();
+       ACPI_FLUSH_CPU_CACHE();
+       /* Change frequency on next halt or sleep */
+       wrmsrl(MSR_VIA_BCR2, bcr2.val);
+       /* Invoke C3 */
+       inb(cx_address);
+       /* Dummy op - must do something useless after P_LVL3 read */
+       t = inl(acpi_fadt.xpm_tmr_blk.address);
+
+       /* Disable software clock multiplier */
+       local_irq_disable();
+       rdmsrl(MSR_VIA_BCR2, bcr2.val);
+       bcr2.bits.ESOFTBF = 0;
+       wrmsrl(MSR_VIA_BCR2, bcr2.val);
+}
 
-       preempt_disable();
-       local_irq_save(flags);
+/* For processor with Longhaul MSR */
 
-       /*
-        * get current pci bus master state for all devices
-        * and clear bus master bit
-        */
-       dev = NULL;
-       i = 0;
-       do {
-               dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev);
-               if (dev != NULL) {
-                       pci_read_config_word(dev, PCI_COMMAND, &pci_cmd);
-                       cmd_state[i++] = pci_cmd;
-                       pci_cmd &= ~PCI_COMMAND_MASTER;
-                       pci_write_config_word(dev, PCI_COMMAND, pci_cmd);
-               }
-       } while (dev != NULL);
+static void do_powersaver(int cx_address, unsigned int clock_ratio_index)
+{
+       union msr_longhaul longhaul;
+       u32 t;
 
-       tmp_mask=inb(0x21);     /* works on C3. save mask. */
-       outb(0xFE,0x21);        /* TMR0 only */
-       outb(0xFF,0x80);        /* delay */
+       rdmsrl(MSR_VIA_LONGHAUL, longhaul.val);
+       longhaul.bits.RevisionKey = longhaul.bits.RevisionID;
+       longhaul.bits.SoftBusRatio = clock_ratio_index & 0xf;
+       longhaul.bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4;
+       longhaul.bits.EnableSoftBusRatio = 1;
 
+       /* Sync to timer tick */
        safe_halt();
-       wrmsrl(MSR_VIA_LONGHAUL, longhaul->val);
-       halt();
-
+       ACPI_FLUSH_CPU_CACHE();
+       /* Change frequency on next halt or sleep */
+       wrmsrl(MSR_VIA_LONGHAUL, longhaul.val);
+       /* Invoke C3 */
+       inb(cx_address);
+       /* Dummy op - must do something useless after P_LVL3 read */
+       t = inl(acpi_fadt.xpm_tmr_blk.address);
+
+       /* Disable bus ratio bit */
        local_irq_disable();
-
-       outb(tmp_mask,0x21);    /* restore mask */
-
-       /* restore pci bus master state for all devices */
-       dev = NULL;
-       i = 0;
-       do {
-               dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev);
-               if (dev != NULL) {
-                       pci_cmd = cmd_state[i++];
-                       pci_write_config_byte(dev, PCI_COMMAND, pci_cmd);
-               }
-       } while (dev != NULL);
-       local_irq_restore(flags);
-       preempt_enable();
-
-       /* disable bus ratio bit */
-       rdmsrl(MSR_VIA_LONGHAUL, longhaul->val);
-       longhaul->bits.EnableSoftBusRatio = 0;
-       longhaul->bits.RevisionKey = version;
-       wrmsrl(MSR_VIA_LONGHAUL, longhaul->val);
+       longhaul.bits.RevisionKey = longhaul.bits.RevisionID;
+       longhaul.bits.EnableSoftBusRatio = 0;
+       longhaul.bits.EnableSoftBSEL = 0;
+       longhaul.bits.EnableSoftVID = 0;
+       wrmsrl(MSR_VIA_LONGHAUL, longhaul.val);
 }
 
 /**
@@ -209,9 +194,9 @@ static void longhaul_setstate(unsigned int clock_ratio_index)
 {
        int speed, mult;
        struct cpufreq_freqs freqs;
-       union msr_longhaul longhaul;
-       union msr_bcr2 bcr2;
        static unsigned int old_ratio=-1;
+       unsigned long flags;
+       unsigned int pic1_mask, pic2_mask;
 
        if (old_ratio == clock_ratio_index)
                return;
@@ -234,6 +219,20 @@ static void longhaul_setstate(unsigned int clock_ratio_index)
        dprintk ("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n",
                        fsb, mult/10, mult%10, print_speed(speed/1000));
 
+       preempt_disable();
+       local_irq_save(flags);
+
+       pic2_mask = inb(0xA1);
+       pic1_mask = inb(0x21);  /* works on C3. save mask. */
+       outb(0xFF,0xA1);        /* Overkill */
+       outb(0xFE,0x21);        /* TMR0 only */
+
+       /* Disable bus master arbitration */
+       if (pr->flags.bm_check) {
+               acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1,
+                                 ACPI_MTX_DO_NOT_LOCK);
+       }
+
        switch (longhaul_version) {
 
        /*
@@ -245,20 +244,7 @@ static void longhaul_setstate(unsigned int clock_ratio_index)
         */
        case TYPE_LONGHAUL_V1:
        case TYPE_LONGHAUL_V2:
-               rdmsrl (MSR_VIA_BCR2, bcr2.val);
-               /* Enable software clock multiplier */
-               bcr2.bits.ESOFTBF = 1;
-               bcr2.bits.CLOCKMUL = clock_ratio_index;
-               local_irq_disable();
-               wrmsrl (MSR_VIA_BCR2, bcr2.val);
-               safe_halt();
-
-               /* Disable software clock multiplier */
-               rdmsrl (MSR_VIA_BCR2, bcr2.val);
-               bcr2.bits.ESOFTBF = 0;
-               local_irq_disable();
-               wrmsrl (MSR_VIA_BCR2, bcr2.val);
-               local_irq_enable();
+               do_longhaul1(cx->address, clock_ratio_index);
                break;
 
        /*
@@ -273,10 +259,22 @@ static void longhaul_setstate(unsigned int clock_ratio_index)
         * to work in practice.
         */
        case TYPE_POWERSAVER:
-               do_powersaver(&longhaul, clock_ratio_index);
+               do_powersaver(cx->address, clock_ratio_index);
                break;
        }
 
+       /* Enable bus master arbitration */
+       if (pr->flags.bm_check) {
+               acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0,
+                                 ACPI_MTX_DO_NOT_LOCK);
+       }
+
+       outb(pic2_mask,0xA1);   /* restore mask */
+       outb(pic1_mask,0x21);
+
+       local_irq_restore(flags);
+       preempt_enable();
+
        cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
 }
 
@@ -324,9 +322,11 @@ static int guess_fsb(void)
 static int __init longhaul_get_ranges(void)
 {
        unsigned long invalue;
-       unsigned int multipliers[32]= {
-               50,30,40,100,55,35,45,95,90,70,80,60,120,75,85,65,
-               -1,110,120,-1,135,115,125,105,130,150,160,140,-1,155,-1,145 };
+       unsigned int ezra_t_multipliers[32]= {
+                       90,  30,  40, 100,  55,  35,  45,  95,
+                       50,  70,  80,  60, 120,  75,  85,  65,
+                       -1, 110, 120,  -1, 135, 115, 125, 105,
+                       130, 150, 160, 140,  -1, 155,  -1, 145 };
        unsigned int j, k = 0;
        union msr_longhaul longhaul;
        unsigned long lo, hi;
@@ -355,13 +355,13 @@ static int __init longhaul_get_ranges(void)
                        invalue = longhaul.bits.MaxMHzBR;
                        if (longhaul.bits.MaxMHzBR4)
                                invalue += 16;
-                       maxmult=multipliers[invalue];
+                       maxmult=ezra_t_multipliers[invalue];
 
                        invalue = longhaul.bits.MinMHzBR;
                        if (longhaul.bits.MinMHzBR4 == 1)
                                minmult = 30;
                        else
-                               minmult = multipliers[invalue];
+                               minmult = ezra_t_multipliers[invalue];
                        fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB];
                        break;
                }
@@ -527,6 +527,18 @@ static unsigned int longhaul_get(unsigned int cpu)
        return calc_speed(longhaul_get_cpu_mult());
 }
 
+static acpi_status longhaul_walk_callback(acpi_handle obj_handle,
+                                         u32 nesting_level,
+                                         void *context, void **return_value)
+{
+       struct acpi_device *d;
+
+       if ( acpi_bus_get_device(obj_handle, &d) ) {
+               return 0;
+       }
+       *return_value = (void *)acpi_driver_data(d);
+       return 1;
+}
 
 static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
 {
@@ -534,6 +546,15 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
        char *cpuname=NULL;
        int ret;
 
+       /* Check ACPI support for C3 state */
+       acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+                        &longhaul_walk_callback, NULL, (void *)&pr);
+       if (pr == NULL) goto err_acpi;
+
+       cx = &pr->power.states[ACPI_STATE_C3];
+       if (cx->address == 0 || cx->latency > 1000) goto err_acpi;
+
+       /* Now check what we have on this motherboard */
        switch (c->x86_model) {
        case 6:
                cpu_model = CPU_SAMUEL;
@@ -634,6 +655,10 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
        cpufreq_frequency_table_get_attr(longhaul_table, policy->cpu);
 
        return 0;
+
+err_acpi:
+       printk(KERN_ERR PFX "No ACPI support for CPU frequency changes.\n");
+       return -ENODEV;
 }
 
 static int __devexit longhaul_cpu_exit(struct cpufreq_policy *policy)
@@ -666,6 +691,18 @@ static int __init longhaul_init(void)
        if (c->x86_vendor != X86_VENDOR_CENTAUR || c->x86 != 6)
                return -ENODEV;
 
+#ifdef CONFIG_SMP
+       if (num_online_cpus() > 1) {
+               return -ENODEV;
+               printk(KERN_ERR PFX "More than 1 CPU detected, longhaul disabled.\n");
+       }
+#endif
+#ifdef CONFIG_X86_IO_APIC
+       if (cpu_has_apic) {
+               printk(KERN_ERR PFX "APIC detected. Longhaul is currently broken in this configuration.\n");
+               return -ENODEV;
+       }
+#endif
        switch (c->x86_model) {
        case 6 ... 9:
                return cpufreq_register_driver(&longhaul_driver);
@@ -699,6 +736,6 @@ MODULE_AUTHOR ("Dave Jones <davej@codemonkey.org.uk>");
 MODULE_DESCRIPTION ("Longhaul driver for VIA Cyrix processors.");
 MODULE_LICENSE ("GPL");
 
-module_init(longhaul_init);
+late_initcall(longhaul_init);
 module_exit(longhaul_exit);
 
index a3fe975..8a4f0d0 100644 (file)
@@ -151,7 +151,7 @@ static void
 simscsi_sg_readwrite (struct scsi_cmnd *sc, int mode, unsigned long offset)
 {
        int list_len = sc->use_sg;
-       struct scatterlist *sl = (struct scatterlist *)sc->buffer;
+       struct scatterlist *sl = (struct scatterlist *)sc->request_buffer;
        struct disk_stat stat;
        struct disk_req req;
 
@@ -244,7 +244,7 @@ static void simscsi_fillresult(struct scsi_cmnd *sc, char *buf, unsigned len)
 
        if (scatterlen == 0)
                memcpy(sc->request_buffer, buf, len);
-       else for (slp = (struct scatterlist *)sc->buffer; scatterlen-- > 0 && len > 0; slp++) {
+       else for (slp = (struct scatterlist *)sc->request_buffer; scatterlen-- > 0 && len > 0; slp++) {
                unsigned thislen = min(len, slp->length);
 
                memcpy(page_address(slp->page) + slp->offset, buf, thislen);
index e4bfa9d..bb8770a 100644 (file)
@@ -632,7 +632,7 @@ kern_memory_descriptor (unsigned long phys_addr)
                if (phys_addr - md->start < (md->num_pages << EFI_PAGE_SHIFT))
                         return md;
        }
-       return 0;
+       return NULL;
 }
 
 static efi_memory_desc_t *
@@ -652,7 +652,7 @@ efi_memory_descriptor (unsigned long phys_addr)
                if (phys_addr - md->phys_addr < (md->num_pages << EFI_PAGE_SHIFT))
                         return md;
        }
-       return 0;
+       return NULL;
 }
 
 u32
@@ -923,7 +923,7 @@ find_memmap_space (void)
 void
 efi_memmap_init(unsigned long *s, unsigned long *e)
 {
-       struct kern_memdesc *k, *prev = 0;
+       struct kern_memdesc *k, *prev = NULL;
        u64     contig_low=0, contig_high=0;
        u64     as, ae, lim;
        void *efi_map_start, *efi_map_end, *p, *q;
index 561b8f1..29236f0 100644 (file)
@@ -853,7 +853,6 @@ END(__ia64_init_fpu)
  */
 GLOBAL_ENTRY(ia64_switch_mode_phys)
  {
-       alloc r2=ar.pfs,0,0,0,0
        rsm psr.i | psr.ic              // disable interrupts and interrupt collection
        mov r15=ip
  }
@@ -902,7 +901,6 @@ END(ia64_switch_mode_phys)
  */
 GLOBAL_ENTRY(ia64_switch_mode_virt)
  {
-       alloc r2=ar.pfs,0,0,0,0
        rsm psr.i | psr.ic              // disable interrupts and interrupt collection
        mov r15=ip
  }
index b7cf651..3ead20f 100644 (file)
@@ -62,7 +62,7 @@ EXPORT_SYMBOL(__udivdi3);
 EXPORT_SYMBOL(__moddi3);
 EXPORT_SYMBOL(__umoddi3);
 
-#if defined(CONFIG_MD_RAID5) || defined(CONFIG_MD_RAID5_MODULE)
+#if defined(CONFIG_MD_RAID456) || defined(CONFIG_MD_RAID456_MODULE)
 extern void xor_ia64_2(void);
 extern void xor_ia64_3(void);
 extern void xor_ia64_4(void);
index 5018c7f..ebaf1e6 100644 (file)
@@ -217,12 +217,7 @@ GLOBAL_ENTRY(ia64_pal_call_phys_stacked)
        .body
        ;;
        ld8 loc2 = [loc2]               // loc2 <- entry point
-       mov out0 = in0          // first argument
-       mov out1 = in1          // copy arg2
-       mov out2 = in2          // copy arg3
-       mov out3 = in3          // copy arg3
-       ;;
-       mov loc3 = psr          // save psr
+       mov loc3 = psr                  // save psr
        ;;
        mov loc4=ar.rsc                 // save RSE configuration
        dep.z loc2=loc2,0,61            // convert pal entry point to physical
@@ -236,18 +231,23 @@ GLOBAL_ENTRY(ia64_pal_call_phys_stacked)
        ;;
        andcm r16=loc3,r16              // removes bits to clear from psr
        br.call.sptk.many rp=ia64_switch_mode_phys
-.ret6:
+
+       mov out0 = in0                  // first argument
+       mov out1 = in1                  // copy arg2
+       mov out2 = in2                  // copy arg3
+       mov out3 = in3                  // copy arg3
        mov loc5 = r19
        mov loc6 = r20
+
        br.call.sptk.many rp=b7         // now make the call
-.ret7:
+
        mov ar.rsc=0                    // put RSE in enforced lazy, LE mode
        mov r16=loc3                    // r16= original psr
        mov r19=loc5
        mov r20=loc6
        br.call.sptk.many rp=ia64_switch_mode_virt      // return to virtual mode
 
-.ret8: mov psr.l  = loc3               // restore init PSR
+       mov psr.l  = loc3               // restore init PSR
        mov ar.pfs = loc1
        mov rp = loc0
        ;;
index ab5b524..0b546e2 100644 (file)
@@ -566,29 +566,23 @@ version_info(char *page)
        pal_version_u_t min_ver, cur_ver;
        char *p = page;
 
-       /* The PAL_VERSION call is advertised as being able to support
-        * both physical and virtual mode calls. This seems to be a documentation
-        * bug rather than firmware bug. In fact, it does only support physical mode.
-        * So now the code reflects this fact and the pal_version() has been updated
-        * accordingly.
-        */
-       if (ia64_pal_version(&min_ver, &cur_ver) != 0) return 0;
+       if (ia64_pal_version(&min_ver, &cur_ver) != 0)
+               return 0;
 
        p += sprintf(p,
                     "PAL_vendor : 0x%02x (min=0x%02x)\n"
-                    "PAL_A      : %x.%x.%x (min=%x.%x.%x)\n"
-                    "PAL_B      : %x.%x.%x (min=%x.%x.%x)\n",
-                    cur_ver.pal_version_s.pv_pal_vendor, min_ver.pal_version_s.pv_pal_vendor,
-
-                    cur_ver.pal_version_s.pv_pal_a_model>>4,
-                    cur_ver.pal_version_s.pv_pal_a_model&0xf, cur_ver.pal_version_s.pv_pal_a_rev,
-                    min_ver.pal_version_s.pv_pal_a_model>>4,
-                    min_ver.pal_version_s.pv_pal_a_model&0xf, min_ver.pal_version_s.pv_pal_a_rev,
-
-                    cur_ver.pal_version_s.pv_pal_b_model>>4,
-                    cur_ver.pal_version_s.pv_pal_b_model&0xf, cur_ver.pal_version_s.pv_pal_b_rev,
-                    min_ver.pal_version_s.pv_pal_b_model>>4,
-                    min_ver.pal_version_s.pv_pal_b_model&0xf, min_ver.pal_version_s.pv_pal_b_rev);
+                    "PAL_A      : %02x.%02x (min=%02x.%02x)\n"
+                    "PAL_B      : %02x.%02x (min=%02x.%02x)\n",
+                    cur_ver.pal_version_s.pv_pal_vendor,
+                    min_ver.pal_version_s.pv_pal_vendor,
+                    cur_ver.pal_version_s.pv_pal_a_model,
+                    cur_ver.pal_version_s.pv_pal_a_rev,
+                    min_ver.pal_version_s.pv_pal_a_model,
+                    min_ver.pal_version_s.pv_pal_a_rev,
+                    cur_ver.pal_version_s.pv_pal_b_model,
+                    cur_ver.pal_version_s.pv_pal_b_rev,
+                    min_ver.pal_version_s.pv_pal_b_model,
+                    min_ver.pal_version_s.pv_pal_b_rev);
        return p - page;
 }
 
index 5f03b9e..4c73a67 100644 (file)
 
 extern void __init efi_memmap_walk_uc(efi_freemem_callback_t, void *);
 
-#define MAX_UNCACHED_GRANULES  5
-static int allocated_granules;
+struct uncached_pool {
+       struct gen_pool *pool;
+       struct mutex add_chunk_mutex;   /* serialize adding a converted chunk */
+       int nchunks_added;              /* #of converted chunks added to pool */
+       atomic_t status;                /* smp called function's return status*/
+};
+
+#define MAX_CONVERTED_CHUNKS_PER_NODE  2
 
-struct gen_pool *uncached_pool[MAX_NUMNODES];
+struct uncached_pool uncached_pools[MAX_NUMNODES];
 
 
 static void uncached_ipi_visibility(void *data)
 {
        int status;
+       struct uncached_pool *uc_pool = (struct uncached_pool *)data;
 
        status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL);
        if ((status != PAL_VISIBILITY_OK) &&
            (status != PAL_VISIBILITY_OK_REMOTE_NEEDED))
-               printk(KERN_DEBUG "pal_prefetch_visibility() returns %i on "
-                      "CPU %i\n", status, raw_smp_processor_id());
+               atomic_inc(&uc_pool->status);
 }
 
 
 static void uncached_ipi_mc_drain(void *data)
 {
        int status;
+       struct uncached_pool *uc_pool = (struct uncached_pool *)data;
 
        status = ia64_pal_mc_drain();
-       if (status)
-               printk(KERN_WARNING "ia64_pal_mc_drain() failed with %i on "
-                      "CPU %i\n", status, raw_smp_processor_id());
+       if (status != PAL_STATUS_SUCCESS)
+               atomic_inc(&uc_pool->status);
 }
 
 
@@ -70,21 +76,34 @@ static void uncached_ipi_mc_drain(void *data)
  * This is accomplished by first allocating a granule of cached memory pages
  * and then converting them to uncached memory pages.
  */
-static int uncached_add_chunk(struct gen_pool *pool, int nid)
+static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid)
 {
        struct page *page;
-       int status, i;
+       int status, i, nchunks_added = uc_pool->nchunks_added;
        unsigned long c_addr, uc_addr;
 
-       if (allocated_granules >= MAX_UNCACHED_GRANULES)
+       if (mutex_lock_interruptible(&uc_pool->add_chunk_mutex) != 0)
+               return -1;      /* interrupted by a signal */
+
+       if (uc_pool->nchunks_added > nchunks_added) {
+               /* someone added a new chunk while we were waiting */
+               mutex_unlock(&uc_pool->add_chunk_mutex);
+               return 0;
+       }
+
+       if (uc_pool->nchunks_added >= MAX_CONVERTED_CHUNKS_PER_NODE) {
+               mutex_unlock(&uc_pool->add_chunk_mutex);
                return -1;
+       }
 
        /* attempt to allocate a granule's worth of cached memory pages */
 
        page = alloc_pages_node(nid, GFP_KERNEL | __GFP_ZERO,
                                IA64_GRANULE_SHIFT-PAGE_SHIFT);
-       if (!page)
+       if (!page) {
+               mutex_unlock(&uc_pool->add_chunk_mutex);
                return -1;
+       }
 
        /* convert the memory pages from cached to uncached */
 
@@ -102,11 +121,14 @@ static int uncached_add_chunk(struct gen_pool *pool, int nid)
        flush_tlb_kernel_range(uc_addr, uc_adddr + IA64_GRANULE_SIZE);
 
        status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL);
-       if (!status) {
-               status = smp_call_function(uncached_ipi_visibility, NULL, 0, 1);
-               if (status)
+       if (status == PAL_VISIBILITY_OK_REMOTE_NEEDED) {
+               atomic_set(&uc_pool->status, 0);
+               status = smp_call_function(uncached_ipi_visibility, uc_pool,
+                                          0, 1);
+               if (status || atomic_read(&uc_pool->status))
                        goto failed;
-       }
+       } else if (status != PAL_VISIBILITY_OK)
+               goto failed;
 
        preempt_disable();
 
@@ -120,20 +142,24 @@ static int uncached_add_chunk(struct gen_pool *pool, int nid)
 
        preempt_enable();
 
-       ia64_pal_mc_drain();
-       status = smp_call_function(uncached_ipi_mc_drain, NULL, 0, 1);
-       if (status)
+       status = ia64_pal_mc_drain();
+       if (status != PAL_STATUS_SUCCESS)
+               goto failed;
+       atomic_set(&uc_pool->status, 0);
+       status = smp_call_function(uncached_ipi_mc_drain, uc_pool, 0, 1);
+       if (status || atomic_read(&uc_pool->status))
                goto failed;
 
        /*
         * The chunk of memory pages has been converted to uncached so now we
         * can add it to the pool.
         */
-       status = gen_pool_add(pool, uc_addr, IA64_GRANULE_SIZE, nid);
+       status = gen_pool_add(uc_pool->pool, uc_addr, IA64_GRANULE_SIZE, nid);
        if (status)
                goto failed;
 
-       allocated_granules++;
+       uc_pool->nchunks_added++;
+       mutex_unlock(&uc_pool->add_chunk_mutex);
        return 0;
 
        /* failed to convert or add the chunk so give it back to the kernel */
@@ -142,6 +168,7 @@ failed:
                ClearPageUncached(&page[i]);
 
        free_pages(c_addr, IA64_GRANULE_SHIFT-PAGE_SHIFT);
+       mutex_unlock(&uc_pool->add_chunk_mutex);
        return -1;
 }
 
@@ -158,7 +185,7 @@ failed:
 unsigned long uncached_alloc_page(int starting_nid)
 {
        unsigned long uc_addr;
-       struct gen_pool *pool;
+       struct uncached_pool *uc_pool;
        int nid;
 
        if (unlikely(starting_nid >= MAX_NUMNODES))
@@ -171,14 +198,14 @@ unsigned long uncached_alloc_page(int starting_nid)
        do {
                if (!node_online(nid))
                        continue;
-               pool = uncached_pool[nid];
-               if (pool == NULL)
+               uc_pool = &uncached_pools[nid];
+               if (uc_pool->pool == NULL)
                        continue;
                do {
-                       uc_addr = gen_pool_alloc(pool, PAGE_SIZE);
+                       uc_addr = gen_pool_alloc(uc_pool->pool, PAGE_SIZE);
                        if (uc_addr != 0)
                                return uc_addr;
-               } while (uncached_add_chunk(pool, nid) == 0);
+               } while (uncached_add_chunk(uc_pool, nid) == 0);
 
        } while ((nid = (nid + 1) % MAX_NUMNODES) != starting_nid);
 
@@ -197,7 +224,7 @@ EXPORT_SYMBOL(uncached_alloc_page);
 void uncached_free_page(unsigned long uc_addr)
 {
        int nid = paddr_to_nid(uc_addr - __IA64_UNCACHED_OFFSET);
-       struct gen_pool *pool = uncached_pool[nid];
+       struct gen_pool *pool = uncached_pools[nid].pool;
 
        if (unlikely(pool == NULL))
                return;
@@ -224,7 +251,7 @@ static int __init uncached_build_memmap(unsigned long uc_start,
                                        unsigned long uc_end, void *arg)
 {
        int nid = paddr_to_nid(uc_start - __IA64_UNCACHED_OFFSET);
-       struct gen_pool *pool = uncached_pool[nid];
+       struct gen_pool *pool = uncached_pools[nid].pool;
        size_t size = uc_end - uc_start;
 
        touch_softlockup_watchdog();
@@ -242,7 +269,8 @@ static int __init uncached_init(void)
        int nid;
 
        for_each_online_node(nid) {
-               uncached_pool[nid] = gen_pool_create(PAGE_SHIFT, nid);
+               uncached_pools[nid].pool = gen_pool_create(PAGE_SHIFT, nid);
+               mutex_init(&uncached_pools[nid].add_chunk_mutex);
        }
 
        efi_memmap_walk_uc(uncached_build_memmap, NULL);
index d8536a2..38fa6e4 100644 (file)
@@ -14,7 +14,7 @@ lib-y := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o                        \
 lib-$(CONFIG_ITANIUM)  += copy_page.o copy_user.o memcpy.o
 lib-$(CONFIG_MCKINLEY) += copy_page_mck.o memcpy_mck.o
 lib-$(CONFIG_PERFMON)  += carta_random.o
-lib-$(CONFIG_MD_RAID5) += xor.o
+lib-$(CONFIG_MD_RAID456)       += xor.o
 
 AFLAGS___divdi3.o      =
 AFLAGS___udivdi3.o     = -DUNSIGNED
index 2a88cdd..e004143 100644 (file)
@@ -27,6 +27,7 @@
 
 #ifdef CONFIG_VIRTUAL_MEM_MAP
 static unsigned long num_dma_physpages;
+static unsigned long max_gap;
 #endif
 
 /**
@@ -45,9 +46,15 @@ show_mem (void)
 
        printk("Free swap:       %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
        i = max_mapnr;
-       while (i-- > 0) {
-               if (!pfn_valid(i))
+       for (i = 0; i < max_mapnr; i++) {
+               if (!pfn_valid(i)) {
+#ifdef CONFIG_VIRTUAL_MEM_MAP
+                       if (max_gap < LARGE_GAP)
+                               continue;
+                       i = vmemmap_find_next_valid_pfn(0, i) - 1;
+#endif
                        continue;
+               }
                total++;
                if (PageReserved(mem_map+i))
                        reserved++;
@@ -234,7 +241,6 @@ paging_init (void)
        unsigned long zones_size[MAX_NR_ZONES];
 #ifdef CONFIG_VIRTUAL_MEM_MAP
        unsigned long zholes_size[MAX_NR_ZONES];
-       unsigned long max_gap;
 #endif
 
        /* initialize mem_map[] */
@@ -266,7 +272,6 @@ paging_init (void)
                }
        }
 
-       max_gap = 0;
        efi_memmap_walk(find_largest_hole, (u64 *)&max_gap);
        if (max_gap < LARGE_GAP) {
                vmem_map = (struct page *) 0;
@@ -277,7 +282,8 @@ paging_init (void)
 
                /* allocate virtual_mem_map */
 
-               map_size = PAGE_ALIGN(max_low_pfn * sizeof(struct page));
+               map_size = PAGE_ALIGN(ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) *
+                       sizeof(struct page));
                vmalloc_end -= map_size;
                vmem_map = (struct page *) vmalloc_end;
                efi_memmap_walk(create_mem_map_page_table, NULL);
index 99bd9e3..d260bff 100644 (file)
@@ -534,68 +534,6 @@ void __cpuinit *per_cpu_init(void)
 }
 #endif /* CONFIG_SMP */
 
-#ifdef CONFIG_VIRTUAL_MEM_MAP
-static inline int find_next_valid_pfn_for_pgdat(pg_data_t *pgdat, int i)
-{
-       unsigned long end_address, hole_next_pfn;
-       unsigned long stop_address;
-
-       end_address = (unsigned long) &vmem_map[pgdat->node_start_pfn + i];
-       end_address = PAGE_ALIGN(end_address);
-
-       stop_address = (unsigned long) &vmem_map[
-               pgdat->node_start_pfn + pgdat->node_spanned_pages];
-
-       do {
-               pgd_t *pgd;
-               pud_t *pud;
-               pmd_t *pmd;
-               pte_t *pte;
-
-               pgd = pgd_offset_k(end_address);
-               if (pgd_none(*pgd)) {
-                       end_address += PGDIR_SIZE;
-                       continue;
-               }
-
-               pud = pud_offset(pgd, end_address);
-               if (pud_none(*pud)) {
-                       end_address += PUD_SIZE;
-                       continue;
-               }
-
-               pmd = pmd_offset(pud, end_address);
-               if (pmd_none(*pmd)) {
-                       end_address += PMD_SIZE;
-                       continue;
-               }
-
-               pte = pte_offset_kernel(pmd, end_address);
-retry_pte:
-               if (pte_none(*pte)) {
-                       end_address += PAGE_SIZE;
-                       pte++;
-                       if ((end_address < stop_address) &&
-                           (end_address != ALIGN(end_address, 1UL << PMD_SHIFT)))
-                               goto retry_pte;
-                       continue;
-               }
-               /* Found next valid vmem_map page */
-               break;
-       } while (end_address < stop_address);
-
-       end_address = min(end_address, stop_address);
-       end_address = end_address - (unsigned long) vmem_map + sizeof(struct page) - 1;
-       hole_next_pfn = end_address / sizeof(struct page);
-       return hole_next_pfn - pgdat->node_start_pfn;
-}
-#else
-static inline int find_next_valid_pfn_for_pgdat(pg_data_t *pgdat, int i)
-{
-       return i + 1;
-}
-#endif
-
 /**
  * show_mem - give short summary of memory stats
  *
@@ -625,7 +563,8 @@ void show_mem(void)
                        if (pfn_valid(pgdat->node_start_pfn + i))
                                page = pfn_to_page(pgdat->node_start_pfn + i);
                        else {
-                               i = find_next_valid_pfn_for_pgdat(pgdat, i) - 1;
+                               i = vmemmap_find_next_valid_pfn(pgdat->node_id,
+                                        i) - 1;
                                continue;
                        }
                        if (PageReserved(page))
@@ -751,7 +690,8 @@ void __init paging_init(void)
        efi_memmap_walk(filter_rsvd_memory, count_node_pages);
 
 #ifdef CONFIG_VIRTUAL_MEM_MAP
-       vmalloc_end -= PAGE_ALIGN(max_low_pfn * sizeof(struct page));
+       vmalloc_end -= PAGE_ALIGN(ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) *
+               sizeof(struct page));
        vmem_map = (struct page *) vmalloc_end;
        efi_memmap_walk(create_mem_map_page_table, NULL);
        printk("Virtual mem_map starts at 0x%p\n", vmem_map);
index 2f50c06..30617cc 100644 (file)
@@ -415,6 +415,61 @@ ia64_mmu_init (void *my_cpu_data)
 }
 
 #ifdef CONFIG_VIRTUAL_MEM_MAP
+int vmemmap_find_next_valid_pfn(int node, int i)
+{
+       unsigned long end_address, hole_next_pfn;
+       unsigned long stop_address;
+       pg_data_t *pgdat = NODE_DATA(node);
+
+       end_address = (unsigned long) &vmem_map[pgdat->node_start_pfn + i];
+       end_address = PAGE_ALIGN(end_address);
+
+       stop_address = (unsigned long) &vmem_map[
+               pgdat->node_start_pfn + pgdat->node_spanned_pages];
+
+       do {
+               pgd_t *pgd;
+               pud_t *pud;
+               pmd_t *pmd;
+               pte_t *pte;
+
+               pgd = pgd_offset_k(end_address);
+               if (pgd_none(*pgd)) {
+                       end_address += PGDIR_SIZE;
+                       continue;
+               }
+
+               pud = pud_offset(pgd, end_address);
+               if (pud_none(*pud)) {
+                       end_address += PUD_SIZE;
+                       continue;
+               }
+
+               pmd = pmd_offset(pud, end_address);
+               if (pmd_none(*pmd)) {
+                       end_address += PMD_SIZE;
+                       continue;
+               }
+
+               pte = pte_offset_kernel(pmd, end_address);
+retry_pte:
+               if (pte_none(*pte)) {
+                       end_address += PAGE_SIZE;
+                       pte++;
+                       if ((end_address < stop_address) &&
+                           (end_address != ALIGN(end_address, 1UL << PMD_SHIFT)))
+                               goto retry_pte;
+                       continue;
+               }
+               /* Found next valid vmem_map page */
+               break;
+       } while (end_address < stop_address);
+
+       end_address = min(end_address, stop_address);
+       end_address = end_address - (unsigned long) vmem_map + sizeof(struct page) - 1;
+       hole_next_pfn = end_address / sizeof(struct page);
+       return hole_next_pfn - pgdat->node_start_pfn;
+}
 
 int __init
 create_mem_map_page_table (u64 start, u64 end, void *arg)
index 07bd02b..4280c07 100644 (file)
@@ -32,7 +32,7 @@ ioremap (unsigned long offset, unsigned long size)
         */
        attr = kern_mem_attribute(offset, size);
        if (attr & EFI_MEMORY_WB)
-               return phys_to_virt(offset);
+               return (void __iomem *) phys_to_virt(offset);
        else if (attr & EFI_MEMORY_UC)
                return __ioremap(offset, size);
 
@@ -43,7 +43,7 @@ ioremap (unsigned long offset, unsigned long size)
        gran_base = GRANULEROUNDDOWN(offset);
        gran_size = GRANULEROUNDUP(offset + size) - gran_base;
        if (efi_mem_attribute(gran_base, gran_size) & EFI_MEMORY_WB)
-               return phys_to_virt(offset);
+               return (void __iomem *) phys_to_virt(offset);
 
        return __ioremap(offset, size);
 }
@@ -53,7 +53,7 @@ void __iomem *
 ioremap_nocache (unsigned long offset, unsigned long size)
 {
        if (kern_mem_attribute(offset, size) & EFI_MEMORY_WB)
-               return 0;
+               return NULL;
 
        return __ioremap(offset, size);
 }
index 99b123a..5e8e59e 100644 (file)
@@ -480,7 +480,7 @@ xpc_activating(void *__partid)
        partid_t partid = (u64) __partid;
        struct xpc_partition *part = &xpc_partitions[partid];
        unsigned long irq_flags;
-       struct sched_param param = { sched_priority: MAX_RT_PRIO - 1 };
+       struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };
        int ret;
 
 
index 17cd342..af7171a 100644 (file)
@@ -74,7 +74,7 @@ tioce_mmr_war_pre(struct tioce_kernel *kern, void *mmr_addr)
                else
                        mmr_war_offset = 0x158;
 
-               readq_relaxed((void *)(mmr_base + mmr_war_offset));
+               readq_relaxed((void __iomem *)(mmr_base + mmr_war_offset));
        }
 }
 
@@ -92,8 +92,8 @@ tioce_mmr_war_post(struct tioce_kernel *kern, void *mmr_addr)
 
        if (mmr_offset < 0x45000) {
                if (mmr_offset == 0x100)
-                       readq_relaxed((void *)(mmr_base + 0x38));
-               readq_relaxed((void *)(mmr_base + 0xb050));
+                       readq_relaxed((void __iomem *)(mmr_base + 0x38));
+               readq_relaxed((void __iomem *)(mmr_base + 0xb050));
        }
 }
 
index 1c0a39d..578b99b 100644 (file)
@@ -58,8 +58,8 @@ struct dock_dependent_device {
 };
 
 #define DOCK_DOCKING   0x00000001
-#define DOCK_EVENT     KOBJ_DOCK
-#define UNDOCK_EVENT   KOBJ_UNDOCK
+#define DOCK_EVENT     3
+#define UNDOCK_EVENT   2
 
 static struct dock_station *dock_station;
 
@@ -322,11 +322,10 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event)
 
 static void dock_event(struct dock_station *ds, u32 event, int num)
 {
-       struct acpi_device *device;
-
-       device = dock_create_acpi_device(ds->handle);
-       if (device)
-               kobject_uevent(&device->kobj, num);
+       /*
+        * we don't do events until someone tells me that
+        * they would like to have them.
+        */
 }
 
 /**
index 056ebe8..3e90aac 100644 (file)
@@ -107,7 +107,6 @@ const int NR_TYPES = ARRAY_SIZE(max_vals);
 
 struct kbd_struct kbd_table[MAX_NR_CONSOLES];
 static struct kbd_struct *kbd = kbd_table;
-static struct kbd_struct kbd0;
 
 int spawnpid, spawnsig;
 
@@ -223,13 +222,13 @@ static void kd_nosound(unsigned long ignored)
 {
        struct list_head *node;
 
-       list_for_each(node,&kbd_handler.h_list) {
+       list_for_each(node, &kbd_handler.h_list) {
                struct input_handle *handle = to_handle_h(node);
                if (test_bit(EV_SND, handle->dev->evbit)) {
                        if (test_bit(SND_TONE, handle->dev->sndbit))
-                               input_event(handle->dev, EV_SND, SND_TONE, 0);
+                               input_inject_event(handle, EV_SND, SND_TONE, 0);
                        if (test_bit(SND_BELL, handle->dev->sndbit))
-                               input_event(handle->dev, EV_SND, SND_BELL, 0);
+                               input_inject_event(handle, EV_SND, SND_BELL, 0);
                }
        }
 }
@@ -247,11 +246,11 @@ void kd_mksound(unsigned int hz, unsigned int ticks)
                        struct input_handle *handle = to_handle_h(node);
                        if (test_bit(EV_SND, handle->dev->evbit)) {
                                if (test_bit(SND_TONE, handle->dev->sndbit)) {
-                                       input_event(handle->dev, EV_SND, SND_TONE, hz);
+                                       input_inject_event(handle, EV_SND, SND_TONE, hz);
                                        break;
                                }
                                if (test_bit(SND_BELL, handle->dev->sndbit)) {
-                                       input_event(handle->dev, EV_SND, SND_BELL, 1);
+                                       input_inject_event(handle, EV_SND, SND_BELL, 1);
                                        break;
                                }
                        }
@@ -272,15 +271,15 @@ int kbd_rate(struct kbd_repeat *rep)
        unsigned int d = 0;
        unsigned int p = 0;
 
-       list_for_each(node,&kbd_handler.h_list) {
+       list_for_each(node, &kbd_handler.h_list) {
                struct input_handle *handle = to_handle_h(node);
                struct input_dev *dev = handle->dev;
 
                if (test_bit(EV_REP, dev->evbit)) {
                        if (rep->delay > 0)
-                               input_event(dev, EV_REP, REP_DELAY, rep->delay);
+                               input_inject_event(handle, EV_REP, REP_DELAY, rep->delay);
                        if (rep->period > 0)
-                               input_event(dev, EV_REP, REP_PERIOD, rep->period);
+                               input_inject_event(handle, EV_REP, REP_PERIOD, rep->period);
                        d = dev->rep[REP_DELAY];
                        p = dev->rep[REP_PERIOD];
                }
@@ -988,7 +987,7 @@ static inline unsigned char getleds(void)
  * interrupt routines for this thing allows us to easily mask
  * this when we don't want any of the above to happen.
  * This allows for easy and efficient race-condition prevention
- * for kbd_refresh_leds => input_event(dev, EV_LED, ...) => ...
+ * for kbd_start => input_inject_event(dev, EV_LED, ...) => ...
  */
 
 static void kbd_bh(unsigned long dummy)
@@ -998,11 +997,11 @@ static void kbd_bh(unsigned long dummy)
 
        if (leds != ledstate) {
                list_for_each(node, &kbd_handler.h_list) {
-                       struct input_handle * handle = to_handle_h(node);
-                       input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01));
-                       input_event(handle->dev, EV_LED, LED_NUML,    !!(leds & 0x02));
-                       input_event(handle->dev, EV_LED, LED_CAPSL,   !!(leds & 0x04));
-                       input_sync(handle->dev);
+                       struct input_handle *handle = to_handle_h(node);
+                       input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01));
+                       input_inject_event(handle, EV_LED, LED_NUML,    !!(leds & 0x02));
+                       input_inject_event(handle, EV_LED, LED_CAPSL,   !!(leds & 0x04));
+                       input_inject_event(handle, EV_SYN, SYN_REPORT, 0);
                }
        }
 
@@ -1011,23 +1010,6 @@ static void kbd_bh(unsigned long dummy)
 
 DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0);
 
-/*
- * This allows a newly plugged keyboard to pick the LED state.
- */
-static void kbd_refresh_leds(struct input_handle *handle)
-{
-       unsigned char leds = ledstate;
-
-       tasklet_disable(&keyboard_tasklet);
-       if (leds != 0xff) {
-               input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01));
-               input_event(handle->dev, EV_LED, LED_NUML,    !!(leds & 0x02));
-               input_event(handle->dev, EV_LED, LED_CAPSL,   !!(leds & 0x04));
-               input_sync(handle->dev);
-       }
-       tasklet_enable(&keyboard_tasklet);
-}
-
 #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\
     defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\
     defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\
@@ -1043,7 +1025,7 @@ static const unsigned short x86_keycodes[256] =
         48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
         64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
         80, 81, 82, 83, 84,118, 86, 87, 88,115,120,119,121,112,123, 92,
-       284,285,309,298,312, 91,327,328,329,331,333,335,336,337,338,339,
+       284,285,309,  0,312, 91,327,328,329,331,333,335,336,337,338,339,
        367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349,
        360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355,
        103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361,
@@ -1065,38 +1047,55 @@ extern void sun_do_break(void);
 static int emulate_raw(struct vc_data *vc, unsigned int keycode,
                       unsigned char up_flag)
 {
-       if (keycode > 255 || !x86_keycodes[keycode])
-               return -1;
+       int code;
 
        switch (keycode) {
                case KEY_PAUSE:
                        put_queue(vc, 0xe1);
                        put_queue(vc, 0x1d | up_flag);
                        put_queue(vc, 0x45 | up_flag);
-                       return 0;
+                       break;
+
                case KEY_HANGEUL:
                        if (!up_flag)
                                put_queue(vc, 0xf2);
-                       return 0;
+                       break;
+
                case KEY_HANJA:
                        if (!up_flag)
                                put_queue(vc, 0xf1);
-                       return 0;
-       }
+                       break;
 
-       if (keycode == KEY_SYSRQ && sysrq_alt) {
-               put_queue(vc, 0x54 | up_flag);
-               return 0;
-       }
+               case KEY_SYSRQ:
+                       /*
+                        * Real AT keyboards (that's what we're trying
+                        * to emulate here emit 0xe0 0x2a 0xe0 0x37 when
+                        * pressing PrtSc/SysRq alone, but simply 0x54
+                        * when pressing Alt+PrtSc/SysRq.
+                        */
+                       if (sysrq_alt) {
+                               put_queue(vc, 0x54 | up_flag);
+                       } else {
+                               put_queue(vc, 0xe0);
+                               put_queue(vc, 0x2a | up_flag);
+                               put_queue(vc, 0xe0);
+                               put_queue(vc, 0x37 | up_flag);
+                       }
+                       break;
+
+               default:
+                       if (keycode > 255)
+                               return -1;
 
-       if (x86_keycodes[keycode] & 0x100)
-               put_queue(vc, 0xe0);
+                       code = x86_keycodes[keycode];
+                       if (!code)
+                               return -1;
 
-       put_queue(vc, (x86_keycodes[keycode] & 0x7f) | up_flag);
+                       if (code & 0x100)
+                               put_queue(vc, 0xe0);
+                       put_queue(vc, (code & 0x7f) | up_flag);
 
-       if (keycode == KEY_SYSRQ) {
-               put_queue(vc, 0xe0);
-               put_queue(vc, 0x37 | up_flag);
+                       break;
        }
 
        return 0;
@@ -1298,16 +1297,15 @@ static struct input_handle *kbd_connect(struct input_handler *handler,
        if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit))
                return NULL;
 
-       if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL)))
+       handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
+       if (!handle)
                return NULL;
-       memset(handle, 0, sizeof(struct input_handle));
 
        handle->dev = dev;
        handle->handler = handler;
        handle->name = "kbd";
 
        input_open_device(handle);
-       kbd_refresh_leds(handle);
 
        return handle;
 }
@@ -1318,6 +1316,24 @@ static void kbd_disconnect(struct input_handle *handle)
        kfree(handle);
 }
 
+/*
+ * Start keyboard handler on the new keyboard by refreshing LED state to
+ * match the rest of the system.
+ */
+static void kbd_start(struct input_handle *handle)
+{
+       unsigned char leds = ledstate;
+
+       tasklet_disable(&keyboard_tasklet);
+       if (leds != 0xff) {
+               input_inject_event(handle, EV_LED, LED_SCROLLL, !!(leds & 0x01));
+               input_inject_event(handle, EV_LED, LED_NUML,    !!(leds & 0x02));
+               input_inject_event(handle, EV_LED, LED_CAPSL,   !!(leds & 0x04));
+               input_inject_event(handle, EV_SYN, SYN_REPORT, 0);
+       }
+       tasklet_enable(&keyboard_tasklet);
+}
+
 static struct input_device_id kbd_ids[] = {
        {
                 .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
@@ -1338,6 +1354,7 @@ static struct input_handler kbd_handler = {
        .event          = kbd_event,
        .connect        = kbd_connect,
        .disconnect     = kbd_disconnect,
+       .start          = kbd_start,
        .name           = "kbd",
        .id_table       = kbd_ids,
 };
@@ -1346,15 +1363,15 @@ int __init kbd_init(void)
 {
        int i;
 
-        kbd0.ledflagstate = kbd0.default_ledflagstate = KBD_DEFLEDS;
-        kbd0.ledmode = LED_SHOW_FLAGS;
-        kbd0.lockstate = KBD_DEFLOCK;
-        kbd0.slockstate = 0;
-        kbd0.modeflags = KBD_DEFMODE;
-        kbd0.kbdmode = VC_XLATE;
-
-        for (i = 0 ; i < MAX_NR_CONSOLES ; i++)
-                kbd_table[i] = kbd0;
+        for (i = 0; i < MAX_NR_CONSOLES; i++) {
+               kbd_table[i].ledflagstate = KBD_DEFLEDS;
+               kbd_table[i].default_ledflagstate = KBD_DEFLEDS;
+               kbd_table[i].ledmode = LED_SHOW_FLAGS;
+               kbd_table[i].lockstate = KBD_DEFLOCK;
+               kbd_table[i].slockstate = 0;
+               kbd_table[i].modeflags = KBD_DEFMODE;
+               kbd_table[i].kbdmode = VC_XLATE;
+       }
 
        input_register_handler(&kbd_handler);
 
index afc6eda..07e0b75 100644 (file)
@@ -374,7 +374,12 @@ scdrv_init(void)
        struct sysctl_data_s *scd;
        void *salbuf;
        dev_t first_dev, dev;
-       nasid_t event_nasid = ia64_sn_get_console_nasid();
+       nasid_t event_nasid;
+
+       if (!ia64_platform_is("sn2"))
+               return -ENODEV;
+
+       event_nasid = ia64_sn_get_console_nasid();
 
        if (alloc_chrdev_region(&first_dev, 0, num_cnodes,
                                SYSCTL_BASENAME) < 0) {
index bc1088d..b3df613 100644 (file)
@@ -284,39 +284,69 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition);
  *                          SYSFS INTERFACE                          *
  *********************************************************************/
 
+static struct cpufreq_governor *__find_governor(const char *str_governor)
+{
+       struct cpufreq_governor *t;
+
+       list_for_each_entry(t, &cpufreq_governor_list, governor_list)
+               if (!strnicmp(str_governor,t->name,CPUFREQ_NAME_LEN))
+                       return t;
+
+       return NULL;
+}
+
 /**
  * cpufreq_parse_governor - parse a governor string
  */
 static int cpufreq_parse_governor (char *str_governor, unsigned int *policy,
                                struct cpufreq_governor **governor)
 {
+       int err = -EINVAL;
+
        if (!cpufreq_driver)
-               return -EINVAL;
+               goto out;
+
        if (cpufreq_driver->setpolicy) {
                if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) {
                        *policy = CPUFREQ_POLICY_PERFORMANCE;
-                       return 0;
+                       err = 0;
                } else if (!strnicmp(str_governor, "powersave", CPUFREQ_NAME_LEN)) {
                        *policy = CPUFREQ_POLICY_POWERSAVE;
-                       return 0;
+                       err = 0;
                }
-               return -EINVAL;
-       } else {
+       } else if (cpufreq_driver->target) {
                struct cpufreq_governor *t;
+
                mutex_lock(&cpufreq_governor_mutex);
-               if (!cpufreq_driver || !cpufreq_driver->target)
-                       goto out;
-               list_for_each_entry(t, &cpufreq_governor_list, governor_list) {
-                       if (!strnicmp(str_governor,t->name,CPUFREQ_NAME_LEN)) {
-                               *governor = t;
+
+               t = __find_governor(str_governor);
+
+               if (t == NULL) {
+                       char *name = kasprintf(GFP_KERNEL, "cpufreq_%s", str_governor);
+
+                       if (name) {
+                               int ret;
+
                                mutex_unlock(&cpufreq_governor_mutex);
-                               return 0;
+                               ret = request_module(name);
+                               mutex_lock(&cpufreq_governor_mutex);
+
+                               if (ret == 0)
+                                       t = __find_governor(str_governor);
                        }
+
+                       kfree(name);
                }
-out:
+
+               if (t != NULL) {
+                       *governor = t;
+                       err = 0;
+               }
+
                mutex_unlock(&cpufreq_governor_mutex);
        }
-       return -EINVAL;
+  out:
+       return err;
 }
 
 
@@ -1265,23 +1295,21 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event)
 
 int cpufreq_register_governor(struct cpufreq_governor *governor)
 {
-       struct cpufreq_governor *t;
+       int err;
 
        if (!governor)
                return -EINVAL;
 
        mutex_lock(&cpufreq_governor_mutex);
 
-       list_for_each_entry(t, &cpufreq_governor_list, governor_list) {
-               if (!strnicmp(governor->name,t->name,CPUFREQ_NAME_LEN)) {
-                       mutex_unlock(&cpufreq_governor_mutex);
-                       return -EBUSY;
-               }
+       err = -EBUSY;
+       if (__find_governor(governor->name) == NULL) {
+               err = 0;
+               list_add(&governor->governor_list, &cpufreq_governor_list);
        }
-       list_add(&governor->governor_list, &cpufreq_governor_list);
 
        mutex_unlock(&cpufreq_governor_mutex);
-       return 0;
+       return err;
 }
 EXPORT_SYMBOL_GPL(cpufreq_register_governor);
 
@@ -1343,6 +1371,11 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data, struct cpufreq_poli
 
        memcpy(&policy->cpuinfo, &data->cpuinfo, sizeof(struct cpufreq_cpuinfo));
 
+       if (policy->min > data->min && policy->min > policy->max) {
+               ret = -EINVAL;
+               goto error_out;
+       }
+
        /* verify the cpu speed can be set within this limit */
        ret = cpufreq_driver->verify(policy);
        if (ret)
index f85c97f..0de335b 100644 (file)
@@ -975,8 +975,10 @@ int ib_send_cm_req(struct ib_cm_id *cm_id,
 
        cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv->
                                                            id.local_id);
-       if (IS_ERR(cm_id_priv->timewait_info))
+       if (IS_ERR(cm_id_priv->timewait_info)) {
+               ret = PTR_ERR(cm_id_priv->timewait_info);
                goto out;
+       }
 
        ret = cm_init_av_by_path(param->primary_path, &cm_id_priv->av);
        if (ret)
index bb9bee5..102a59c 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/kref.h>
 #include <linux/idr.h>
 #include <linux/mutex.h>
+#include <linux/completion.h>
 
 #include <rdma/ib_verbs.h>
 #include <rdma/ib_user_verbs.h>
@@ -69,6 +70,7 @@
 
 struct ib_uverbs_device {
        struct kref                             ref;
+       struct completion                       comp;
        int                                     devnum;
        struct cdev                            *dev;
        struct class_device                    *class_dev;
index e725ccc..4e16314 100644 (file)
@@ -122,7 +122,7 @@ static void ib_uverbs_release_dev(struct kref *ref)
        struct ib_uverbs_device *dev =
                container_of(ref, struct ib_uverbs_device, ref);
 
-       kfree(dev);
+       complete(&dev->comp);
 }
 
 void ib_uverbs_release_ucq(struct ib_uverbs_file *file,
@@ -740,6 +740,7 @@ static void ib_uverbs_add_one(struct ib_device *device)
                return;
 
        kref_init(&uverbs_dev->ref);
+       init_completion(&uverbs_dev->comp);
 
        spin_lock(&map_lock);
        uverbs_dev->devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES);
@@ -793,6 +794,8 @@ err_cdev:
 
 err:
        kref_put(&uverbs_dev->ref, ib_uverbs_release_dev);
+       wait_for_completion(&uverbs_dev->comp);
+       kfree(uverbs_dev);
        return;
 }
 
@@ -812,7 +815,10 @@ static void ib_uverbs_remove_one(struct ib_device *device)
        spin_unlock(&map_lock);
 
        clear_bit(uverbs_dev->devnum, dev_map);
+
        kref_put(&uverbs_dev->ref, ib_uverbs_release_dev);
+       wait_for_completion(&uverbs_dev->comp);
+       kfree(uverbs_dev);
 }
 
 static int uverbs_event_get_sb(struct file_system_type *fs_type, int flags,
index 9ba3211..25157f5 100644 (file)
@@ -108,14 +108,15 @@ void mthca_alloc_cleanup(struct mthca_alloc *alloc)
  * serialize access to the array.
  */
 
+#define MTHCA_ARRAY_MASK (PAGE_SIZE / sizeof (void *) - 1)
+
 void *mthca_array_get(struct mthca_array *array, int index)
 {
        int p = (index * sizeof (void *)) >> PAGE_SHIFT;
 
-       if (array->page_list[p].page) {
-               int i = index & (PAGE_SIZE / sizeof (void *) - 1);
-               return array->page_list[p].page[i];
-       } else
+       if (array->page_list[p].page)
+               return array->page_list[p].page[index & MTHCA_ARRAY_MASK];
+       else
                return NULL;
 }
 
@@ -130,8 +131,7 @@ int mthca_array_set(struct mthca_array *array, int index, void *value)
        if (!array->page_list[p].page)
                return -ENOMEM;
 
-       array->page_list[p].page[index & (PAGE_SIZE / sizeof (void *) - 1)] =
-               value;
+       array->page_list[p].page[index & MTHCA_ARRAY_MASK] = value;
        ++array->page_list[p].used;
 
        return 0;
@@ -144,7 +144,8 @@ void mthca_array_clear(struct mthca_array *array, int index)
        if (--array->page_list[p].used == 0) {
                free_page((unsigned long) array->page_list[p].page);
                array->page_list[p].page = NULL;
-       }
+       } else
+               array->page_list[p].page[index & MTHCA_ARRAY_MASK] = NULL;
 
        if (array->page_list[p].used < 0)
                pr_debug("Array %p index %d page %d with ref count %d < 0\n",
index 13d6d01..d74653d 100644 (file)
@@ -6,8 +6,7 @@ config INFINIBAND_IPOIB
          transports IP packets over InfiniBand so you can use your IB
          device as a fancy NIC.
 
-         The IPoIB protocol is defined by the IETF ipoib working
-         group: <http://www.ietf.org/html.charters/ipoib-charter.html>.
+         See Documentation/infiniband/ipoib.txt for more information
 
 config INFINIBAND_IPOIB_DEBUG
        bool "IP-over-InfiniBand debugging" if EMBEDDED
index 8f472e7..8257d5a 100644 (file)
@@ -77,6 +77,14 @@ MODULE_PARM_DESC(topspin_workarounds,
 
 static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad };
 
+static int mellanox_workarounds = 1;
+
+module_param(mellanox_workarounds, int, 0444);
+MODULE_PARM_DESC(mellanox_workarounds,
+                "Enable workarounds for Mellanox SRP target bugs if != 0");
+
+static const u8 mellanox_oui[3] = { 0x00, 0x02, 0xc9 };
+
 static void srp_add_one(struct ib_device *device);
 static void srp_remove_one(struct ib_device *device);
 static void srp_completion(struct ib_cq *cq, void *target_ptr);
@@ -526,8 +534,10 @@ static int srp_reconnect_target(struct srp_target_port *target)
        while (ib_poll_cq(target->cq, 1, &wc) > 0)
                ; /* nothing */
 
+       spin_lock_irq(target->scsi_host->host_lock);
        list_for_each_entry_safe(req, tmp, &target->req_queue, list)
                srp_reset_req(target, req);
+       spin_unlock_irq(target->scsi_host->host_lock);
 
        target->rx_head  = 0;
        target->tx_head  = 0;
@@ -567,7 +577,7 @@ err:
        return ret;
 }
 
-static int srp_map_fmr(struct srp_device *dev, struct scatterlist *scat,
+static int srp_map_fmr(struct srp_target_port *target, struct scatterlist *scat,
                       int sg_cnt, struct srp_request *req,
                       struct srp_direct_buf *buf)
 {
@@ -577,10 +587,15 @@ static int srp_map_fmr(struct srp_device *dev, struct scatterlist *scat,
        int page_cnt;
        int i, j;
        int ret;
+       struct srp_device *dev = target->srp_host->dev;
 
        if (!dev->fmr_pool)
                return -ENODEV;
 
+       if ((sg_dma_address(&scat[0]) & ~dev->fmr_page_mask) &&
+           mellanox_workarounds && !memcmp(&target->ioc_guid, mellanox_oui, 3))
+               return -EINVAL;
+
        len = page_cnt = 0;
        for (i = 0; i < sg_cnt; ++i) {
                if (sg_dma_address(&scat[i]) & ~dev->fmr_page_mask) {
@@ -683,7 +698,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target,
                buf->va  = cpu_to_be64(sg_dma_address(scat));
                buf->key = cpu_to_be32(target->srp_host->dev->mr->rkey);
                buf->len = cpu_to_be32(sg_dma_len(scat));
-       } else if (srp_map_fmr(target->srp_host->dev, scat, count, req,
+       } else if (srp_map_fmr(target, scat, count, req,
                               (void *) cmd->add_data)) {
                /*
                 * FMR mapping failed, and the scatterlist has more
index a29d5ce..4bf4818 100644 (file)
@@ -127,14 +127,10 @@ static int evdev_open(struct inode * inode, struct file * file)
 {
        struct evdev_list *list;
        int i = iminor(inode) - EVDEV_MINOR_BASE;
-       int accept_err;
 
        if (i >= EVDEV_MINORS || !evdev_table[i] || !evdev_table[i]->exist)
                return -ENODEV;
 
-       if ((accept_err = input_accept_process(&(evdev_table[i]->handle), file)))
-               return accept_err;
-
        if (!(list = kzalloc(sizeof(struct evdev_list), GFP_KERNEL)))
                return -ENOMEM;
 
@@ -260,7 +256,7 @@ static ssize_t evdev_write(struct file * file, const char __user * buffer, size_
 
                if (evdev_event_from_user(buffer + retval, &event))
                        return -EFAULT;
-               input_event(list->evdev->handle.dev, event.type, event.code, event.value);
+               input_inject_event(&list->evdev->handle, event.type, event.code, event.value);
                retval += evdev_event_size();
        }
 
@@ -428,8 +424,8 @@ static long evdev_ioctl_handler(struct file *file, unsigned int cmd,
                        if (get_user(v, ip + 1))
                                return -EFAULT;
 
-                       input_event(dev, EV_REP, REP_DELAY, u);
-                       input_event(dev, EV_REP, REP_PERIOD, v);
+                       input_inject_event(&evdev->handle, EV_REP, REP_DELAY, u);
+                       input_inject_event(&evdev->handle, EV_REP, REP_PERIOD, v);
 
                        return 0;
 
index 47e93da..90de5af 100644 (file)
@@ -106,10 +106,10 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device
        gp->gameport = port;
        gp->res_port = request_region(port->io, 0x10, "FM801 GP");
        if (!gp->res_port) {
-               kfree(gp);
-               gameport_free_port(port);
                printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n",
                        port->io, port->io + 0x0f);
+               gameport_free_port(port);
+               kfree(gp);
                return -EBUSY;
        }
 
index 36644bf..3f47ae5 100644 (file)
@@ -53,6 +53,7 @@ static LIST_HEAD(gameport_list);
 
 static struct bus_type gameport_bus;
 
+static void gameport_add_driver(struct gameport_driver *drv);
 static void gameport_add_port(struct gameport *gameport);
 static void gameport_destroy_port(struct gameport *gameport);
 static void gameport_reconnect_port(struct gameport *gameport);
@@ -211,8 +212,14 @@ static void gameport_release_driver(struct gameport *gameport)
 
 static void gameport_find_driver(struct gameport *gameport)
 {
+       int error;
+
        down_write(&gameport_bus.subsys.rwsem);
-       device_attach(&gameport->dev);
+       error = device_attach(&gameport->dev);
+       if (error < 0)
+               printk(KERN_WARNING
+                       "gameport: device_attach() failed for %s (%s), error: %d\n",
+                       gameport->phys, gameport->name, error);
        up_write(&gameport_bus.subsys.rwsem);
 }
 
@@ -316,7 +323,6 @@ static void gameport_remove_duplicate_events(struct gameport_event *event)
        spin_unlock_irqrestore(&gameport_event_lock, flags);
 }
 
-
 static struct gameport_event *gameport_get_event(void)
 {
        struct gameport_event *event;
@@ -342,7 +348,6 @@ static struct gameport_event *gameport_get_event(void)
 static void gameport_handle_event(void)
 {
        struct gameport_event *event;
-       struct gameport_driver *gameport_drv;
 
        mutex_lock(&gameport_mutex);
 
@@ -369,8 +374,7 @@ static void gameport_handle_event(void)
                                break;
 
                        case GAMEPORT_REGISTER_DRIVER:
-                               gameport_drv = event->object;
-                               driver_register(&gameport_drv->driver);
+                               gameport_add_driver(event->object);
                                break;
 
                        default:
@@ -532,6 +536,7 @@ static void gameport_init_port(struct gameport *gameport)
        if (gameport->parent)
                gameport->dev.parent = &gameport->parent->dev;
 
+       INIT_LIST_HEAD(&gameport->node);
        spin_lock_init(&gameport->timer_lock);
        init_timer(&gameport->poll_timer);
        gameport->poll_timer.function = gameport_run_poll_handler;
@@ -544,6 +549,8 @@ static void gameport_init_port(struct gameport *gameport)
  */
 static void gameport_add_port(struct gameport *gameport)
 {
+       int error;
+
        if (gameport->parent)
                gameport->parent->child = gameport;
 
@@ -558,8 +565,13 @@ static void gameport_add_port(struct gameport *gameport)
                printk(KERN_INFO "gameport: %s is %s, speed %dkHz\n",
                        gameport->name, gameport->phys, gameport->speed);
 
-       device_add(&gameport->dev);
-       gameport->registered = 1;
+       error = device_add(&gameport->dev);
+       if (error)
+               printk(KERN_ERR
+                       "gameport: device_add() failed for %s (%s), error: %d\n",
+                       gameport->phys, gameport->name, error);
+       else
+               gameport->registered = 1;
 }
 
 /*
@@ -583,10 +595,11 @@ static void gameport_destroy_port(struct gameport *gameport)
 
        if (gameport->registered) {
                device_del(&gameport->dev);
-               list_del_init(&gameport->node);
                gameport->registered = 0;
        }
 
+       list_del_init(&gameport->node);
+
        gameport_remove_pending_events(gameport);
        put_device(&gameport->dev);
 }
@@ -704,11 +717,22 @@ static int gameport_driver_remove(struct device *dev)
 }
 
 static struct bus_type gameport_bus = {
-       .name = "gameport",
-       .probe = gameport_driver_probe,
-       .remove = gameport_driver_remove,
+       .name   = "gameport",
+       .probe  = gameport_driver_probe,
+       .remove = gameport_driver_remove,
 };
 
+static void gameport_add_driver(struct gameport_driver *drv)
+{
+       int error;
+
+       error = driver_register(&drv->driver);
+       if (error)
+               printk(KERN_ERR
+                       "gameport: driver_register() failed for %s, error: %d\n",
+                       drv->driver.name, error);
+}
+
 void __gameport_register_driver(struct gameport_driver *drv, struct module *owner)
 {
        drv->driver.bus = &gameport_bus;
@@ -778,16 +802,24 @@ void gameport_close(struct gameport *gameport)
 
 static int __init gameport_init(void)
 {
-       gameport_task = kthread_run(gameport_thread, NULL, "kgameportd");
-       if (IS_ERR(gameport_task)) {
-               printk(KERN_ERR "gameport: Failed to start kgameportd\n");
-               return PTR_ERR(gameport_task);
-       }
+       int error;
 
        gameport_bus.dev_attrs = gameport_device_attrs;
        gameport_bus.drv_attrs = gameport_driver_attrs;
        gameport_bus.match = gameport_bus_match;
-       bus_register(&gameport_bus);
+       error = bus_register(&gameport_bus);
+       if (error) {
+               printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error);
+               return error;
+       }
+
+       gameport_task = kthread_run(gameport_thread, NULL, "kgameportd");
+       if (IS_ERR(gameport_task)) {
+               bus_unregister(&gameport_bus);
+               error = PTR_ERR(gameport_task);
+               printk(KERN_ERR "gameport: Failed to start kgameportd, error: %d\n", error);
+               return error;
+       }
 
        return 0;
 }
index a90486f..9cb4b9a 100644 (file)
@@ -35,6 +35,16 @@ static LIST_HEAD(input_handler_list);
 
 static struct input_handler *input_table[8];
 
+/**
+ * input_event() - report new input event
+ * @handle: device that generated the event
+ * @type: type of the event
+ * @code: event code
+ * @value: value of the event
+ *
+ * This function should be used by drivers implementing various input devices
+ * See also input_inject_event()
+ */
 void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
 {
        struct input_handle *handle;
@@ -183,6 +193,23 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
 }
 EXPORT_SYMBOL(input_event);
 
+/**
+ * input_inject_event() - send input event from input handler
+ * @handle: input handle to send event through
+ * @type: type of the event
+ * @code: event code
+ * @value: value of the event
+ *
+ * Similar to input_event() but will ignore event if device is "grabbed" and handle
+ * injecting event is not the one that owns the device.
+ */
+void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
+{
+       if (!handle->dev->grab || handle->dev->grab == handle)
+               input_event(handle->dev, type, code, value);
+}
+EXPORT_SYMBOL(input_inject_event);
+
 static void input_repeat_key(unsigned long data)
 {
        struct input_dev *dev = (void *) data;
@@ -197,15 +224,6 @@ static void input_repeat_key(unsigned long data)
                mod_timer(&dev->timer, jiffies + msecs_to_jiffies(dev->rep[REP_PERIOD]));
 }
 
-int input_accept_process(struct input_handle *handle, struct file *file)
-{
-       if (handle->dev->accept)
-               return handle->dev->accept(handle->dev, file);
-
-       return 0;
-}
-EXPORT_SYMBOL(input_accept_process);
-
 int input_grab_device(struct input_handle *handle)
 {
        if (handle->dev->grab)
@@ -218,8 +236,15 @@ EXPORT_SYMBOL(input_grab_device);
 
 void input_release_device(struct input_handle *handle)
 {
-       if (handle->dev->grab == handle)
-               handle->dev->grab = NULL;
+       struct input_dev *dev = handle->dev;
+
+       if (dev->grab == handle) {
+               dev->grab = NULL;
+
+               list_for_each_entry(handle, &dev->h_list, d_node)
+                       if (handle->handler->start)
+                               handle->handler->start(handle);
+       }
 }
 EXPORT_SYMBOL(input_release_device);
 
@@ -963,8 +988,11 @@ int input_register_device(struct input_dev *dev)
        list_for_each_entry(handler, &input_handler_list, node)
                if (!handler->blacklist || !input_match_device(handler->blacklist, dev))
                        if ((id = input_match_device(handler->id_table, dev)))
-                               if ((handle = handler->connect(handler, dev, id)))
+                               if ((handle = handler->connect(handler, dev, id))) {
                                        input_link_handle(handle);
+                                       if (handler->start)
+                                               handler->start(handle);
+                               }
 
        input_wakeup_procfs_readers();
 
@@ -1028,8 +1056,11 @@ void input_register_handler(struct input_handler *handler)
        list_for_each_entry(dev, &input_dev_list, node)
                if (!handler->blacklist || !input_match_device(handler->blacklist, dev))
                        if ((id = input_match_device(handler->id_table, dev)))
-                               if ((handle = handler->connect(handler, dev, id)))
+                               if ((handle = handler->connect(handler, dev, id))) {
                                        input_link_handle(handle);
+                                       if (handler->start)
+                                               handler->start(handle);
+                               }
 
        input_wakeup_procfs_readers();
 }
index 6d99e3c..b4914e7 100644 (file)
@@ -79,6 +79,7 @@ static struct iforce_device iforce_device[] = {
        { 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback",       btn_wheel, abs_wheel, ff_iforce }, //?
        { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel",      btn_wheel, abs_wheel, ff_iforce }, //?
        { 0x06f8, 0x0004, "Gullemot Jet Leader 3D",                     btn_joystick, abs_joystick, ff_iforce }, //?
+       { 0x06d6, 0x29bc, "Trust Force Feedback Race Master",           btn_wheel, abs_wheel, ff_iforce },
        { 0x0000, 0x0000, "Unknown I-Force Device [%04x:%04x]",         btn_joystick, abs_joystick, ff_iforce }
 };
 
@@ -222,22 +223,22 @@ static int iforce_erase_effect(struct input_dev *dev, int effect_id)
        int err = 0;
        struct iforce_core_effect* core_effect;
 
-       /* Check who is trying to erase this effect */
-       if (iforce->core_effects[effect_id].owner != current->pid) {
-               printk(KERN_WARNING "iforce-main.c: %d tried to erase an effect belonging to %d\n", current->pid, iforce->core_effects[effect_id].owner);
-               return -EACCES;
-       }
-
        if (effect_id < 0 || effect_id >= FF_EFFECTS_MAX)
                return -EINVAL;
 
-       core_effect = iforce->core_effects + effect_id;
+       core_effect = &iforce->core_effects[effect_id];
+
+       /* Check who is trying to erase this effect */
+       if (core_effect->owner != current->pid) {
+               printk(KERN_WARNING "iforce-main.c: %d tried to erase an effect belonging to %d\n", current->pid, core_effect->owner);
+               return -EACCES;
+       }
 
        if (test_bit(FF_MOD1_IS_USED, core_effect->flags))
-               err = release_resource(&(iforce->core_effects[effect_id].mod1_chunk));
+               err = release_resource(&core_effect->mod1_chunk);
 
        if (!err && test_bit(FF_MOD2_IS_USED, core_effect->flags))
-               err = release_resource(&(iforce->core_effects[effect_id].mod2_chunk));
+               err = release_resource(&core_effect->mod2_chunk);
 
        /*TODO: remember to change that if more FF_MOD* bits are added */
        core_effect->flags[0] = 0;
index 75eb5ca..7a19ee0 100644 (file)
@@ -50,7 +50,7 @@ MODULE_LICENSE("GPL");
  */
 
 #define SPACEBALL_MAX_LENGTH   128
-#define SPACEBALL_MAX_ID       8
+#define SPACEBALL_MAX_ID       9
 
 #define SPACEBALL_1003      1
 #define SPACEBALL_2003B     3
index ce1f10e..6bfa0cf 100644 (file)
@@ -482,13 +482,7 @@ out:
        return IRQ_HANDLED;
 }
 
-/*
- * atkbd_event_work() is used to complete processing of events that
- * can not be processed by input_event() which is often called from
- * interrupt context.
- */
-
-static void atkbd_event_work(void *data)
+static int atkbd_set_repeat_rate(struct atkbd *atkbd)
 {
        const short period[32] =
                { 33,  37,  42,  46,  50,  54,  58,  63,  67,  75,  83,  92, 100, 109, 116, 125,
@@ -496,41 +490,64 @@ static void atkbd_event_work(void *data)
        const short delay[4] =
                { 250, 500, 750, 1000 };
 
-       struct atkbd *atkbd = data;
+       struct input_dev *dev = atkbd->dev;
+       unsigned char param;
+       int i = 0, j = 0;
+
+       while (i < ARRAY_SIZE(period) - 1 && period[i] < dev->rep[REP_PERIOD])
+               i++;
+       dev->rep[REP_PERIOD] = period[i];
+
+       while (j < ARRAY_SIZE(period) - 1 && delay[j] < dev->rep[REP_DELAY])
+               j++;
+       dev->rep[REP_DELAY] = delay[j];
+
+       param = i | (j << 5);
+       return ps2_command(&atkbd->ps2dev, &param, ATKBD_CMD_SETREP);
+}
+
+static int atkbd_set_leds(struct atkbd *atkbd)
+{
        struct input_dev *dev = atkbd->dev;
        unsigned char param[2];
-       int i, j;
 
-       mutex_lock(&atkbd->event_mutex);
+       param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0)
+                | (test_bit(LED_NUML,    dev->led) ? 2 : 0)
+                | (test_bit(LED_CAPSL,   dev->led) ? 4 : 0);
+       if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS))
+               return -1;
 
-       if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) {
-               param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0)
-                        | (test_bit(LED_NUML,    dev->led) ? 2 : 0)
-                        | (test_bit(LED_CAPSL,   dev->led) ? 4 : 0);
-               ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS);
-
-               if (atkbd->extra) {
-                       param[0] = 0;
-                       param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0)
-                                | (test_bit(LED_SLEEP,   dev->led) ? 0x02 : 0)
-                                | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0)
-                                | (test_bit(LED_MISC,    dev->led) ? 0x10 : 0)
-                                | (test_bit(LED_MUTE,    dev->led) ? 0x20 : 0);
-                       ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS);
-               }
+       if (atkbd->extra) {
+               param[0] = 0;
+               param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0)
+                        | (test_bit(LED_SLEEP,   dev->led) ? 0x02 : 0)
+                        | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0)
+                        | (test_bit(LED_MISC,    dev->led) ? 0x10 : 0)
+                        | (test_bit(LED_MUTE,    dev->led) ? 0x20 : 0);
+               if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS))
+                       return -1;
        }
 
-       if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) {
-               i = j = 0;
-               while (i < 31 && period[i] < dev->rep[REP_PERIOD])
-                       i++;
-               while (j < 3 && delay[j] < dev->rep[REP_DELAY])
-                       j++;
-               dev->rep[REP_PERIOD] = period[i];
-               dev->rep[REP_DELAY] = delay[j];
-               param[0] = i | (j << 5);
-               ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP);
-       }
+       return 0;
+}
+
+/*
+ * atkbd_event_work() is used to complete processing of events that
+ * can not be processed by input_event() which is often called from
+ * interrupt context.
+ */
+
+static void atkbd_event_work(void *data)
+{
+       struct atkbd *atkbd = data;
+
+       mutex_lock(&atkbd->event_mutex);
+
+       if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask))
+               atkbd_set_leds(atkbd);
+
+       if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask))
+               atkbd_set_repeat_rate(atkbd);
 
        mutex_unlock(&atkbd->event_mutex);
 }
@@ -975,7 +992,6 @@ static int atkbd_reconnect(struct serio *serio)
 {
        struct atkbd *atkbd = serio_get_drvdata(serio);
        struct serio_driver *drv = serio->drv;
-       unsigned char param[1];
 
        if (!atkbd || !drv) {
                printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n");
@@ -985,10 +1001,6 @@ static int atkbd_reconnect(struct serio *serio)
        atkbd_disable(atkbd);
 
        if (atkbd->write) {
-               param[0] = (test_bit(LED_SCROLLL, atkbd->dev->led) ? 1 : 0)
-                        | (test_bit(LED_NUML,    atkbd->dev->led) ? 2 : 0)
-                        | (test_bit(LED_CAPSL,   atkbd->dev->led) ? 4 : 0);
-
                if (atkbd_probe(atkbd))
                        return -1;
                if (atkbd->set != atkbd_select_set(atkbd, atkbd->set, atkbd->extra))
@@ -996,8 +1008,13 @@ static int atkbd_reconnect(struct serio *serio)
 
                atkbd_activate(atkbd);
 
-               if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS))
-                       return -1;
+/*
+ * Restore repeat rate and LEDs (that were reset by atkbd_activate)
+ * to pre-resume state
+ */
+               if (!atkbd->softrepeat)
+                       atkbd_set_repeat_rate(atkbd);
+               atkbd_set_leds(atkbd);
        }
 
        atkbd_enable(atkbd);
index ccf0fae..a8efc1a 100644 (file)
@@ -94,7 +94,7 @@ static void call_bios(struct regs *regs)
 
 static ssize_t __init locate_wistron_bios(void __iomem *base)
 {
-       static const unsigned char __initdata signature[] =
+       static unsigned char __initdata signature[] =
                { 0x42, 0x21, 0x55, 0x30 };
        ssize_t offset;
 
@@ -259,11 +259,11 @@ static int __init dmi_matched(struct dmi_system_id *dmi)
        return 1;
 }
 
-static struct key_entry keymap_empty[] = {
+static struct key_entry keymap_empty[] __initdata = {
        { KE_END, 0 }
 };
 
-static struct key_entry keymap_fs_amilo_pro_v2000[] = {
+static struct key_entry keymap_fs_amilo_pro_v2000[] __initdata = {
        { KE_KEY,  0x01, KEY_HELP },
        { KE_KEY,  0x11, KEY_PROG1 },
        { KE_KEY,  0x12, KEY_PROG2 },
@@ -273,7 +273,7 @@ static struct key_entry keymap_fs_amilo_pro_v2000[] = {
        { KE_END,  0 }
 };
 
-static struct key_entry keymap_fujitsu_n3510[] = {
+static struct key_entry keymap_fujitsu_n3510[] __initdata = {
        { KE_KEY, 0x11, KEY_PROG1 },
        { KE_KEY, 0x12, KEY_PROG2 },
        { KE_KEY, 0x36, KEY_WWW },
@@ -285,7 +285,7 @@ static struct key_entry keymap_fujitsu_n3510[] = {
        { KE_END, 0 }
 };
 
-static struct key_entry keymap_wistron_ms2111[] = {
+static struct key_entry keymap_wistron_ms2111[] __initdata = {
        { KE_KEY,  0x11, KEY_PROG1 },
        { KE_KEY,  0x12, KEY_PROG2 },
        { KE_KEY,  0x13, KEY_PROG3 },
@@ -294,7 +294,7 @@ static struct key_entry keymap_wistron_ms2111[] = {
        { KE_END,  0 }
 };
 
-static struct key_entry keymap_wistron_ms2141[] = {
+static struct key_entry keymap_wistron_ms2141[] __initdata = {
        { KE_KEY,  0x11, KEY_PROG1 },
        { KE_KEY,  0x12, KEY_PROG2 },
        { KE_WIFI, 0x30, 0 },
@@ -307,7 +307,7 @@ static struct key_entry keymap_wistron_ms2141[] = {
        { KE_END,  0 }
 };
 
-static struct key_entry keymap_acer_aspire_1500[] = {
+static struct key_entry keymap_acer_aspire_1500[] __initdata = {
        { KE_KEY, 0x11, KEY_PROG1 },
        { KE_KEY, 0x12, KEY_PROG2 },
        { KE_WIFI, 0x30, 0 },
@@ -317,7 +317,7 @@ static struct key_entry keymap_acer_aspire_1500[] = {
        { KE_END, 0 }
 };
 
-static struct key_entry keymap_acer_travelmate_240[] = {
+static struct key_entry keymap_acer_travelmate_240[] __initdata = {
        { KE_KEY, 0x31, KEY_MAIL },
        { KE_KEY, 0x36, KEY_WWW },
        { KE_KEY, 0x11, KEY_PROG1 },
@@ -327,7 +327,7 @@ static struct key_entry keymap_acer_travelmate_240[] = {
        { KE_END, 0 }
 };
 
-static struct key_entry keymap_aopen_1559as[] = {
+static struct key_entry keymap_aopen_1559as[] __initdata = {
        { KE_KEY,  0x01, KEY_HELP },
        { KE_KEY,  0x06, KEY_PROG3 },
        { KE_KEY,  0x11, KEY_PROG1 },
@@ -343,7 +343,7 @@ static struct key_entry keymap_aopen_1559as[] = {
  * a list of buttons and their key codes (reported when loading this module
  * with force=1) and the output of dmidecode to $MODULE_AUTHOR.
  */
-static struct dmi_system_id dmi_ids[] = {
+static struct dmi_system_id dmi_ids[] __initdata = {
        {
                .callback = dmi_matched,
                .ident = "Fujitsu-Siemens Amilo Pro V2000",
index 2f0d288..54b696c 100644 (file)
@@ -238,8 +238,7 @@ static struct ps2pp_info *get_model_info(unsigned char model)
                { 100,  PS2PP_KIND_MX,                                  /* MX510 */
                                PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
                                PS2PP_EXTRA_BTN | PS2PP_NAV_BTN },
-               { 111,  PS2PP_KIND_MX,                                  /* MX300 */
-                               PS2PP_WHEEL | PS2PP_EXTRA_BTN | PS2PP_TASK_BTN },
+               { 111,  PS2PP_KIND_MX,  PS2PP_WHEEL | PS2PP_SIDE_BTN }, /* MX300 reports task button as side */
                { 112,  PS2PP_KIND_MX,                                  /* MX500 */
                                PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
                                PS2PP_EXTRA_BTN | PS2PP_NAV_BTN },
index 6d9ec9a..ae5871a 100644 (file)
@@ -183,21 +183,26 @@ static struct attribute_group trackpoint_attr_group = {
        .attrs = trackpoint_attrs,
 };
 
-static void trackpoint_disconnect(struct psmouse *psmouse)
+static int trackpoint_start_protocol(struct psmouse *psmouse, unsigned char *firmware_id)
 {
-       sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, &trackpoint_attr_group);
+       unsigned char param[2] = { 0 };
 
-       kfree(psmouse->private);
-       psmouse->private = NULL;
+       if (ps2_command(&psmouse->ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID)))
+               return -1;
+
+       if (param[0] != TP_MAGIC_IDENT)
+               return -1;
+
+       if (firmware_id)
+               *firmware_id = param[1];
+
+       return 0;
 }
 
 static int trackpoint_sync(struct psmouse *psmouse)
 {
-       unsigned char toggle;
        struct trackpoint_data *tp = psmouse->private;
-
-       if (!tp)
-               return -1;
+       unsigned char toggle;
 
        /* Disable features that may make device unusable with this driver */
        trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle);
@@ -263,27 +268,38 @@ static void trackpoint_defaults(struct trackpoint_data *tp)
        tp->ext_dev = TP_DEF_EXT_DEV;
 }
 
+static void trackpoint_disconnect(struct psmouse *psmouse)
+{
+       sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, &trackpoint_attr_group);
+
+       kfree(psmouse->private);
+       psmouse->private = NULL;
+}
+
+static int trackpoint_reconnect(struct psmouse *psmouse)
+{
+       if (trackpoint_start_protocol(psmouse, NULL))
+               return -1;
+
+       if (trackpoint_sync(psmouse))
+               return -1;
+
+       return 0;
+}
+
 int trackpoint_detect(struct psmouse *psmouse, int set_properties)
 {
        struct trackpoint_data *priv;
        struct ps2dev *ps2dev = &psmouse->ps2dev;
        unsigned char firmware_id;
        unsigned char button_info;
-       unsigned char param[2];
-
-       param[0] = param[1] = 0;
 
-       if (ps2_command(ps2dev, param, MAKE_PS2_CMD(0, 2, TP_READ_ID)))
-               return -1;
-
-       if (param[0] != TP_MAGIC_IDENT)
+       if (trackpoint_start_protocol(psmouse, &firmware_id))
                return -1;
 
        if (!set_properties)
                return 0;
 
-       firmware_id = param[1];
-
        if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) {
                printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n");
                button_info = 0;
@@ -296,7 +312,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
        psmouse->vendor = "IBM";
        psmouse->name = "TrackPoint";
 
-       psmouse->reconnect = trackpoint_sync;
+       psmouse->reconnect = trackpoint_reconnect;
        psmouse->disconnect = trackpoint_disconnect;
 
        trackpoint_defaults(priv);
index 61a6f97..ed202f2 100644 (file)
@@ -177,6 +177,11 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
                return -1;
        }
 
+       if (send && !param) {
+               WARN_ON(1);
+               return -1;
+       }
+
        mutex_lock_nested(&ps2dev->cmd_mutex, SINGLE_DEPTH_NESTING);
 
        serio_pause_rx(ps2dev->serio);
index 6521034..3e76ad7 100644 (file)
@@ -62,6 +62,7 @@ static LIST_HEAD(serio_list);
 
 static struct bus_type serio_bus;
 
+static void serio_add_driver(struct serio_driver *drv);
 static void serio_add_port(struct serio *serio);
 static void serio_destroy_port(struct serio *serio);
 static void serio_reconnect_port(struct serio *serio);
@@ -140,8 +141,14 @@ static void serio_release_driver(struct serio *serio)
 
 static void serio_find_driver(struct serio *serio)
 {
+       int error;
+
        down_write(&serio_bus.subsys.rwsem);
-       device_attach(&serio->dev);
+       error = device_attach(&serio->dev);
+       if (error < 0)
+               printk(KERN_WARNING
+                       "serio: device_attach() failed for %s (%s), error: %d\n",
+                       serio->phys, serio->name, error);
        up_write(&serio_bus.subsys.rwsem);
 }
 
@@ -272,7 +279,6 @@ static struct serio_event *serio_get_event(void)
 static void serio_handle_event(void)
 {
        struct serio_event *event;
-       struct serio_driver *serio_drv;
 
        mutex_lock(&serio_mutex);
 
@@ -304,8 +310,7 @@ static void serio_handle_event(void)
                                break;
 
                        case SERIO_REGISTER_DRIVER:
-                               serio_drv = event->object;
-                               driver_register(&serio_drv->driver);
+                               serio_add_driver(event->object);
                                break;
 
                        default:
@@ -525,6 +530,7 @@ static void serio_init_port(struct serio *serio)
 
        __module_get(THIS_MODULE);
 
+       INIT_LIST_HEAD(&serio->node);
        spin_lock_init(&serio->lock);
        mutex_init(&serio->drv_mutex);
        device_initialize(&serio->dev);
@@ -542,6 +548,8 @@ static void serio_init_port(struct serio *serio)
  */
 static void serio_add_port(struct serio *serio)
 {
+       int error;
+
        if (serio->parent) {
                serio_pause_rx(serio->parent);
                serio->parent->child = serio;
@@ -551,9 +559,19 @@ static void serio_add_port(struct serio *serio)
        list_add_tail(&serio->node, &serio_list);
        if (serio->start)
                serio->start(serio);
-       device_add(&serio->dev);
-       sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group);
-       serio->registered = 1;
+       error = device_add(&serio->dev);
+       if (error)
+               printk(KERN_ERR
+                       "serio: device_add() failed for %s (%s), error: %d\n",
+                       serio->phys, serio->name, error);
+       else {
+               serio->registered = 1;
+               error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group);
+               if (error)
+                       printk(KERN_ERR
+                               "serio: sysfs_create_group() failed for %s (%s), error: %d\n",
+                               serio->phys, serio->name, error);
+       }
 }
 
 /*
@@ -583,10 +601,10 @@ static void serio_destroy_port(struct serio *serio)
        if (serio->registered) {
                sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group);
                device_del(&serio->dev);
-               list_del_init(&serio->node);
                serio->registered = 0;
        }
 
+       list_del_init(&serio->node);
        serio_remove_pending_events(serio);
        put_device(&serio->dev);
 }
@@ -756,6 +774,17 @@ static struct bus_type serio_bus = {
        .remove = serio_driver_remove,
 };
 
+static void serio_add_driver(struct serio_driver *drv)
+{
+       int error;
+
+       error = driver_register(&drv->driver);
+       if (error)
+               printk(KERN_ERR
+                       "serio: driver_register() failed for %s, error: %d\n",
+                       drv->driver.name, error);
+}
+
 void __serio_register_driver(struct serio_driver *drv, struct module *owner)
 {
        drv->driver.bus = &serio_bus;
@@ -903,18 +932,26 @@ irqreturn_t serio_interrupt(struct serio *serio,
 
 static int __init serio_init(void)
 {
-       serio_task = kthread_run(serio_thread, NULL, "kseriod");
-       if (IS_ERR(serio_task)) {
-               printk(KERN_ERR "serio: Failed to start kseriod\n");
-               return PTR_ERR(serio_task);
-       }
+       int error;
 
        serio_bus.dev_attrs = serio_device_attrs;
        serio_bus.drv_attrs = serio_driver_attrs;
        serio_bus.match = serio_bus_match;
        serio_bus.uevent = serio_uevent;
        serio_bus.resume = serio_resume;
-       bus_register(&serio_bus);
+       error = bus_register(&serio_bus);
+       if (error) {
+               printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error);
+               return error;
+       }
+
+       serio_task = kthread_run(serio_thread, NULL, "kseriod");
+       if (IS_ERR(serio_task)) {
+               bus_unregister(&serio_bus);
+               error = PTR_ERR(serio_task);
+               printk(KERN_ERR "serio: Failed to start kseriod, error: %d\n", error);
+               return error;
+       }
 
        return 0;
 }
index c3e52c8..06440a8 100644 (file)
@@ -177,6 +177,7 @@ struct myri10ge_priv {
        struct work_struct watchdog_work;
        struct timer_list watchdog_timer;
        int watchdog_tx_done;
+       int watchdog_tx_req;
        int watchdog_resets;
        int tx_linearized;
        int pause;
@@ -448,6 +449,7 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size)
        struct mcp_gen_header *hdr;
        size_t hdr_offset;
        int status;
+       unsigned i;
 
        if ((status = request_firmware(&fw, mgp->fw_name, dev)) < 0) {
                dev_err(dev, "Unable to load %s firmware image via hotplug\n",
@@ -479,18 +481,12 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size)
                goto abort_with_fw;
 
        crc = crc32(~0, fw->data, fw->size);
-       if (mgp->tx.boundary == 2048) {
-               /* Avoid PCI burst on chipset with unaligned completions. */
-               int i;
-               __iomem u32 *ptr = (__iomem u32 *) (mgp->sram +
-                                                   MYRI10GE_FW_OFFSET);
-               for (i = 0; i < fw->size / 4; i++) {
-                       __raw_writel(((u32 *) fw->data)[i], ptr + i);
-                       wmb();
-               }
-       } else {
-               myri10ge_pio_copy(mgp->sram + MYRI10GE_FW_OFFSET, fw->data,
-                                 fw->size);
+       for (i = 0; i < fw->size; i += 256) {
+               myri10ge_pio_copy(mgp->sram + MYRI10GE_FW_OFFSET + i,
+                                 fw->data + i,
+                                 min(256U, (unsigned)(fw->size - i)));
+               mb();
+               readb(mgp->sram);
        }
        /* corruption checking is good for parity recovery and buggy chipset */
        memcpy_fromio(fw->data, mgp->sram + MYRI10GE_FW_OFFSET, fw->size);
@@ -2547,7 +2543,8 @@ static void myri10ge_watchdog_timer(unsigned long arg)
 
        mgp = (struct myri10ge_priv *)arg;
        if (mgp->tx.req != mgp->tx.done &&
-           mgp->tx.done == mgp->watchdog_tx_done)
+           mgp->tx.done == mgp->watchdog_tx_done &&
+           mgp->watchdog_tx_req != mgp->watchdog_tx_done)
                /* nic seems like it might be stuck.. */
                schedule_work(&mgp->watchdog_work);
        else
@@ -2556,6 +2553,7 @@ static void myri10ge_watchdog_timer(unsigned long arg)
                          jiffies + myri10ge_watchdog_timeout * HZ);
 
        mgp->watchdog_tx_done = mgp->tx.done;
+       mgp->watchdog_tx_req = mgp->tx.req;
 }
 
 static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
index 7d5c223..f5aad77 100644 (file)
@@ -419,9 +419,8 @@ void phy_start_machine(struct phy_device *phydev,
 
 /* phy_stop_machine
  *
- * description: Stops the state machine timer, sets the state to
- *   UP (unless it wasn't up yet), and then frees the interrupt,
- *   if it is in use. This function must be called BEFORE
+ * description: Stops the state machine timer, sets the state to UP
+ *   (unless it wasn't up yet). This function must be called BEFORE
  *   phy_detach.
  */
 void phy_stop_machine(struct phy_device *phydev)
@@ -433,9 +432,6 @@ void phy_stop_machine(struct phy_device *phydev)
                phydev->state = PHY_UP;
        spin_unlock(&phydev->lock);
 
-       if (phydev->irq != PHY_POLL)
-               phy_stop_interrupts(phydev);
-
        phydev->adjust_state = NULL;
 }
 
index e1fe3a0..132ed32 100644 (file)
@@ -76,7 +76,7 @@
 #include "s2io.h"
 #include "s2io-regs.h"
 
-#define DRV_VERSION "2.0.14.2"
+#define DRV_VERSION "2.0.15.2"
 
 /* S2io Driver name & version. */
 static char s2io_driver_name[] = "Neterion";
@@ -370,38 +370,50 @@ static const u64 fix_mac[] = {
        END_SIGN
 };
 
+MODULE_AUTHOR("Raghavendra Koushik <raghavendra.koushik@neterion.com>");
+MODULE_LICENSE("GPL");
+MODULE_VERSION(DRV_VERSION);
+
+
 /* Module Loadable parameters. */
-static unsigned int tx_fifo_num = 1;
-static unsigned int tx_fifo_len[MAX_TX_FIFOS] =
-    {DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN};
-static unsigned int rx_ring_num = 1;
-static unsigned int rx_ring_sz[MAX_RX_RINGS] =
-    {[0 ...(MAX_RX_RINGS - 1)] = SMALL_BLK_CNT};
-static unsigned int rts_frm_len[MAX_RX_RINGS] =
-    {[0 ...(MAX_RX_RINGS - 1)] = 0 };
-static unsigned int rx_ring_mode = 1;
-static unsigned int use_continuous_tx_intrs = 1;
-static unsigned int rmac_pause_time = 0x100;
-static unsigned int mc_pause_threshold_q0q3 = 187;
-static unsigned int mc_pause_threshold_q4q7 = 187;
-static unsigned int shared_splits;
-static unsigned int tmac_util_period = 5;
-static unsigned int rmac_util_period = 5;
-static unsigned int bimodal = 0;
-static unsigned int l3l4hdr_size = 128;
-#ifndef CONFIG_S2IO_NAPI
-static unsigned int indicate_max_pkts;
-#endif
+S2IO_PARM_INT(tx_fifo_num, 1);
+S2IO_PARM_INT(rx_ring_num, 1);
+
+
+S2IO_PARM_INT(rx_ring_mode, 1);
+S2IO_PARM_INT(use_continuous_tx_intrs, 1);
+S2IO_PARM_INT(rmac_pause_time, 0x100);
+S2IO_PARM_INT(mc_pause_threshold_q0q3, 187);
+S2IO_PARM_INT(mc_pause_threshold_q4q7, 187);
+S2IO_PARM_INT(shared_splits, 0);
+S2IO_PARM_INT(tmac_util_period, 5);
+S2IO_PARM_INT(rmac_util_period, 5);
+S2IO_PARM_INT(bimodal, 0);
+S2IO_PARM_INT(l3l4hdr_size, 128);
 /* Frequency of Rx desc syncs expressed as power of 2 */
-static unsigned int rxsync_frequency = 3;
+S2IO_PARM_INT(rxsync_frequency, 3);
 /* Interrupt type. Values can be 0(INTA), 1(MSI), 2(MSI_X) */
-static unsigned int intr_type = 0;
+S2IO_PARM_INT(intr_type, 0);
 /* Large receive offload feature */
-static unsigned int lro = 0;
+S2IO_PARM_INT(lro, 0);
 /* Max pkts to be aggregated by LRO at one time. If not specified,
  * aggregation happens until we hit max IP pkt size(64K)
  */
-static unsigned int lro_max_pkts = 0xFFFF;
+S2IO_PARM_INT(lro_max_pkts, 0xFFFF);
+#ifndef CONFIG_S2IO_NAPI
+S2IO_PARM_INT(indicate_max_pkts, 0);
+#endif
+
+static unsigned int tx_fifo_len[MAX_TX_FIFOS] =
+    {DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN};
+static unsigned int rx_ring_sz[MAX_RX_RINGS] =
+    {[0 ...(MAX_RX_RINGS - 1)] = SMALL_BLK_CNT};
+static unsigned int rts_frm_len[MAX_RX_RINGS] =
+    {[0 ...(MAX_RX_RINGS - 1)] = 0 };
+
+module_param_array(tx_fifo_len, uint, NULL, 0);
+module_param_array(rx_ring_sz, uint, NULL, 0);
+module_param_array(rts_frm_len, uint, NULL, 0);
 
 /*
  * S2IO device table.
@@ -464,10 +476,9 @@ static int init_shared_mem(struct s2io_nic *nic)
                size += config->tx_cfg[i].fifo_len;
        }
        if (size > MAX_AVAILABLE_TXDS) {
-               DBG_PRINT(ERR_DBG, "%s: Requested TxDs too high, ",
-                         __FUNCTION__);
+               DBG_PRINT(ERR_DBG, "s2io: Requested TxDs too high, ");
                DBG_PRINT(ERR_DBG, "Requested: %d, max supported: 8192\n", size);
-               return FAILURE;
+               return -EINVAL;
        }
 
        lst_size = (sizeof(TxD_t) * config->max_txds);
@@ -547,6 +558,7 @@ static int init_shared_mem(struct s2io_nic *nic)
        nic->ufo_in_band_v = kmalloc((sizeof(u64) * size), GFP_KERNEL);
        if (!nic->ufo_in_band_v)
                return -ENOMEM;
+       memset(nic->ufo_in_band_v, 0, size);
 
        /* Allocation and initialization of RXDs in Rings */
        size = 0;
@@ -1213,7 +1225,7 @@ static int init_nic(struct s2io_nic *nic)
                break;
        }
 
-       /* Enable Tx FIFO partition 0. */
+       /* Enable all configured Tx FIFO partitions */
        val64 = readq(&bar0->tx_fifo_partition_0);
        val64 |= (TX_FIFO_PARTITION_EN);
        writeq(val64, &bar0->tx_fifo_partition_0);
@@ -1650,7 +1662,7 @@ static void en_dis_able_nic_intrs(struct s2io_nic *nic, u16 mask, int flag)
                        writeq(temp64, &bar0->general_int_mask);
                        /*
                         * If Hercules adapter enable GPIO otherwise
-                        * disabled all PCIX, Flash, MDIO, IIC and GPIO
+                        * disable all PCIX, Flash, MDIO, IIC and GPIO
                         * interrupts for now.
                         * TODO
                         */
@@ -2119,7 +2131,7 @@ static struct sk_buff *s2io_txdl_getskb(fifo_info_t *fifo_data, TxD_t *txdlp, in
                                       frag->size, PCI_DMA_TODEVICE);
                }
        }
-       txdlp->Host_Control = 0;
+       memset(txdlp,0, (sizeof(TxD_t) * fifo_data->max_txds));
        return(skb);
 }
 
@@ -2371,9 +2383,14 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
                        skb->data = (void *) (unsigned long)tmp;
                        skb->tail = (void *) (unsigned long)tmp;
 
-                       ((RxD3_t*)rxdp)->Buffer0_ptr =
-                           pci_map_single(nic->pdev, ba->ba_0, BUF0_LEN,
+                       if (!(((RxD3_t*)rxdp)->Buffer0_ptr))
+                               ((RxD3_t*)rxdp)->Buffer0_ptr =
+                                  pci_map_single(nic->pdev, ba->ba_0, BUF0_LEN,
                                           PCI_DMA_FROMDEVICE);
+                       else
+                               pci_dma_sync_single_for_device(nic->pdev,
+                                   (dma_addr_t) ((RxD3_t*)rxdp)->Buffer0_ptr,
+                                   BUF0_LEN, PCI_DMA_FROMDEVICE);
                        rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN);
                        if (nic->rxd_mode == RXD_MODE_3B) {
                                /* Two buffer mode */
@@ -2386,10 +2403,13 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
                                (nic->pdev, skb->data, dev->mtu + 4,
                                                PCI_DMA_FROMDEVICE);
 
-                               /* Buffer-1 will be dummy buffer not used */
-                               ((RxD3_t*)rxdp)->Buffer1_ptr =
-                               pci_map_single(nic->pdev, ba->ba_1, BUF1_LEN,
-                                       PCI_DMA_FROMDEVICE);
+                               /* Buffer-1 will be dummy buffer. Not used */
+                               if (!(((RxD3_t*)rxdp)->Buffer1_ptr)) {
+                                       ((RxD3_t*)rxdp)->Buffer1_ptr =
+                                               pci_map_single(nic->pdev, 
+                                               ba->ba_1, BUF1_LEN,
+                                               PCI_DMA_FROMDEVICE);
+                               }
                                rxdp->Control_2 |= SET_BUFFER1_SIZE_3(1);
                                rxdp->Control_2 |= SET_BUFFER2_SIZE_3
                                                                (dev->mtu + 4);
@@ -2614,23 +2634,23 @@ no_rx:
 }
 #endif
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
 /**
- * s2io_netpoll - Rx interrupt service handler for netpoll support
+ * s2io_netpoll - netpoll event handler entry point
  * @dev : pointer to the device structure.
  * Description:
- * Polling 'interrupt' - used by things like netconsole to send skbs
- * without having to re-enable interrupts. It's not called while
- * the interrupt routine is executing.
+ *     This function will be called by upper layer to check for events on the
+ * interface in situations where interrupts are disabled. It is used for
+ * specific in-kernel networking tasks, such as remote consoles and kernel
+ * debugging over the network (example netdump in RedHat).
  */
-
-#ifdef CONFIG_NET_POLL_CONTROLLER
 static void s2io_netpoll(struct net_device *dev)
 {
        nic_t *nic = dev->priv;
        mac_info_t *mac_control;
        struct config_param *config;
        XENA_dev_config_t __iomem *bar0 = nic->bar0;
-       u64 val64;
+       u64 val64 = 0xFFFFFFFFFFFFFFFFULL;
        int i;
 
        disable_irq(dev->irq);
@@ -2639,9 +2659,17 @@ static void s2io_netpoll(struct net_device *dev)
        mac_control = &nic->mac_control;
        config = &nic->config;
 
-       val64 = readq(&bar0->rx_traffic_int);
        writeq(val64, &bar0->rx_traffic_int);
+       writeq(val64, &bar0->tx_traffic_int);
 
+       /* we need to free up the transmitted skbufs or else netpoll will 
+        * run out of skbs and will fail and eventually netpoll application such
+        * as netdump will fail.
+        */
+       for (i = 0; i < config->tx_fifo_num; i++)
+               tx_intr_handler(&mac_control->fifos[i]);
+
+       /* check for received packet and indicate up to network */
        for (i = 0; i < config->rx_ring_num; i++)
                rx_intr_handler(&mac_control->rings[i]);
 
@@ -2708,7 +2736,7 @@ static void rx_intr_handler(ring_info_t *ring_data)
                /* If your are next to put index then it's FIFO full condition */
                if ((get_block == put_block) &&
                    (get_info.offset + 1) == put_info.offset) {
-                       DBG_PRINT(ERR_DBG, "%s: Ring Full\n",dev->name);
+                       DBG_PRINT(INTR_DBG, "%s: Ring Full\n",dev->name);
                        break;
                }
                skb = (struct sk_buff *) ((unsigned long)rxdp->Host_Control);
@@ -2728,18 +2756,15 @@ static void rx_intr_handler(ring_info_t *ring_data)
                                 HEADER_SNAP_SIZE,
                                 PCI_DMA_FROMDEVICE);
                } else if (nic->rxd_mode == RXD_MODE_3B) {
-                       pci_unmap_single(nic->pdev, (dma_addr_t)
+                       pci_dma_sync_single_for_cpu(nic->pdev, (dma_addr_t)
                                 ((RxD3_t*)rxdp)->Buffer0_ptr,
                                 BUF0_LEN, PCI_DMA_FROMDEVICE);
-                       pci_unmap_single(nic->pdev, (dma_addr_t)
-                                ((RxD3_t*)rxdp)->Buffer1_ptr,
-                                BUF1_LEN, PCI_DMA_FROMDEVICE);
                        pci_unmap_single(nic->pdev, (dma_addr_t)
                                 ((RxD3_t*)rxdp)->Buffer2_ptr,
                                 dev->mtu + 4,
                                 PCI_DMA_FROMDEVICE);
                } else {
-                       pci_unmap_single(nic->pdev, (dma_addr_t)
+                       pci_dma_sync_single_for_cpu(nic->pdev, (dma_addr_t)
                                         ((RxD3_t*)rxdp)->Buffer0_ptr, BUF0_LEN,
                                         PCI_DMA_FROMDEVICE);
                        pci_unmap_single(nic->pdev, (dma_addr_t)
@@ -3327,7 +3352,7 @@ static void s2io_reset(nic_t * sp)
 
        /* Clear certain PCI/PCI-X fields after reset */
        if (sp->device_type == XFRAME_II_DEVICE) {
-               /* Clear parity err detect bit */
+               /* Clear "detected parity error" bit */
                pci_write_config_word(sp->pdev, PCI_STATUS, 0x8000);
 
                /* Clearing PCIX Ecc status register */
@@ -3528,7 +3553,7 @@ static void restore_xmsi_data(nic_t *nic)
        u64 val64;
        int i;
 
-       for (i=0; i< nic->avail_msix_vectors; i++) {
+       for (i=0; i < MAX_REQUESTED_MSI_X; i++) {
                writeq(nic->msix_info[i].addr, &bar0->xmsi_address);
                writeq(nic->msix_info[i].data, &bar0->xmsi_data);
                val64 = (BIT(7) | BIT(15) | vBIT(i, 26, 6));
@@ -3547,7 +3572,7 @@ static void store_xmsi_data(nic_t *nic)
        int i;
 
        /* Store and display */
-       for (i=0; i< nic->avail_msix_vectors; i++) {
+       for (i=0; i < MAX_REQUESTED_MSI_X; i++) {
                val64 = (BIT(15) | vBIT(i, 26, 6));
                writeq(val64, &bar0->xmsi_access);
                if (wait_for_msix_trans(nic, i)) {
@@ -3808,13 +3833,11 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
        TxD_t *txdp;
        TxFIFO_element_t __iomem *tx_fifo;
        unsigned long flags;
-#ifdef NETIF_F_TSO
-       int mss;
-#endif
        u16 vlan_tag = 0;
        int vlan_priority = 0;
        mac_info_t *mac_control;
        struct config_param *config;
+       int offload_type;
 
        mac_control = &sp->mac_control;
        config = &sp->config;
@@ -3862,13 +3885,11 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
                return 0;
        }
 
-       txdp->Control_1 = 0;
-       txdp->Control_2 = 0;
+       offload_type = s2io_offload_type(skb);
 #ifdef NETIF_F_TSO
-       mss = skb_shinfo(skb)->gso_size;
-       if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) {
+       if (offload_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) {
                txdp->Control_1 |= TXD_TCP_LSO_EN;
-               txdp->Control_1 |= TXD_TCP_LSO_MSS(mss);
+               txdp->Control_1 |= TXD_TCP_LSO_MSS(s2io_tcp_mss(skb));
        }
 #endif
        if (skb->ip_summed == CHECKSUM_HW) {
@@ -3886,10 +3907,10 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
        frg_len = skb->len - skb->data_len;
-       if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP) {
+       if (offload_type == SKB_GSO_UDP) {
                int ufo_size;
 
-               ufo_size = skb_shinfo(skb)->gso_size;
+               ufo_size = s2io_udp_mss(skb);
                ufo_size &= ~7;
                txdp->Control_1 |= TXD_UFO_EN;
                txdp->Control_1 |= TXD_UFO_MSS(ufo_size);
@@ -3906,16 +3927,13 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
                                        sp->ufo_in_band_v,
                                        sizeof(u64), PCI_DMA_TODEVICE);
                txdp++;
-               txdp->Control_1 = 0;
-               txdp->Control_2 = 0;
        }
 
        txdp->Buffer_Pointer = pci_map_single
            (sp->pdev, skb->data, frg_len, PCI_DMA_TODEVICE);
        txdp->Host_Control = (unsigned long) skb;
        txdp->Control_1 |= TXD_BUFFER0_SIZE(frg_len);
-
-       if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP)
+       if (offload_type == SKB_GSO_UDP)
                txdp->Control_1 |= TXD_UFO_EN;
 
        frg_cnt = skb_shinfo(skb)->nr_frags;
@@ -3930,12 +3948,12 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
                    (sp->pdev, frag->page, frag->page_offset,
                     frag->size, PCI_DMA_TODEVICE);
                txdp->Control_1 = TXD_BUFFER0_SIZE(frag->size);
-               if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP)
+               if (offload_type == SKB_GSO_UDP)
                        txdp->Control_1 |= TXD_UFO_EN;
        }
        txdp->Control_1 |= TXD_GATHER_CODE_LAST;
 
-       if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP)
+       if (offload_type == SKB_GSO_UDP)
                frg_cnt++; /* as Txd0 was used for inband header */
 
        tx_fifo = mac_control->tx_FIFO_start[queue];
@@ -3944,13 +3962,9 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
 
        val64 = (TX_FIFO_LAST_TXD_NUM(frg_cnt) | TX_FIFO_FIRST_LIST |
                 TX_FIFO_LAST_LIST);
-
-#ifdef NETIF_F_TSO
-       if (mss)
-               val64 |= TX_FIFO_SPECIAL_FUNC;
-#endif
-       if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP)
+       if (offload_type)
                val64 |= TX_FIFO_SPECIAL_FUNC;
+
        writeq(val64, &tx_fifo->List_Control);
 
        mmiowb();
@@ -3984,13 +3998,41 @@ s2io_alarm_handle(unsigned long data)
        mod_timer(&sp->alarm_timer, jiffies + HZ / 2);
 }
 
+static int s2io_chk_rx_buffers(nic_t *sp, int rng_n)
+{
+       int rxb_size, level;
+
+       if (!sp->lro) {
+               rxb_size = atomic_read(&sp->rx_bufs_left[rng_n]);
+               level = rx_buffer_level(sp, rxb_size, rng_n);
+
+               if ((level == PANIC) && (!TASKLET_IN_USE)) {
+                       int ret;
+                       DBG_PRINT(INTR_DBG, "%s: Rx BD hit ", __FUNCTION__);
+                       DBG_PRINT(INTR_DBG, "PANIC levels\n");
+                       if ((ret = fill_rx_buffers(sp, rng_n)) == -ENOMEM) {
+                               DBG_PRINT(ERR_DBG, "Out of memory in %s",
+                                         __FUNCTION__);
+                               clear_bit(0, (&sp->tasklet_status));
+                               return -1;
+                       }
+                       clear_bit(0, (&sp->tasklet_status));
+               } else if (level == LOW)
+                       tasklet_schedule(&sp->task);
+
+       } else if (fill_rx_buffers(sp, rng_n) == -ENOMEM) {
+                       DBG_PRINT(ERR_DBG, "%s:Out of memory", sp->dev->name);
+                       DBG_PRINT(ERR_DBG, " in Rx Intr!!\n");
+       }
+       return 0;
+}
+
 static irqreturn_t
 s2io_msi_handle(int irq, void *dev_id, struct pt_regs *regs)
 {
        struct net_device *dev = (struct net_device *) dev_id;
        nic_t *sp = dev->priv;
        int i;
-       int ret;
        mac_info_t *mac_control;
        struct config_param *config;
 
@@ -4012,35 +4054,8 @@ s2io_msi_handle(int irq, void *dev_id, struct pt_regs *regs)
         * reallocate the buffers from the interrupt handler itself,
         * else schedule a tasklet to reallocate the buffers.
         */
-       for (i = 0; i < config->rx_ring_num; i++) {
-               if (!sp->lro) {
-                       int rxb_size = atomic_read(&sp->rx_bufs_left[i]);
-                       int level = rx_buffer_level(sp, rxb_size, i);
-
-                       if ((level == PANIC) && (!TASKLET_IN_USE)) {
-                               DBG_PRINT(INTR_DBG, "%s: Rx BD hit ", 
-                                                       dev->name);
-                               DBG_PRINT(INTR_DBG, "PANIC levels\n");
-                               if ((ret = fill_rx_buffers(sp, i)) == -ENOMEM) {
-                                       DBG_PRINT(ERR_DBG, "%s:Out of memory",
-                                                 dev->name);
-                                       DBG_PRINT(ERR_DBG, " in ISR!!\n");
-                                       clear_bit(0, (&sp->tasklet_status));
-                                       atomic_dec(&sp->isr_cnt);
-                                       return IRQ_HANDLED;
-                               }
-                               clear_bit(0, (&sp->tasklet_status));
-                       } else if (level == LOW) {
-                               tasklet_schedule(&sp->task);
-                       }
-               }
-               else if (fill_rx_buffers(sp, i) == -ENOMEM) {
-                               DBG_PRINT(ERR_DBG, "%s:Out of memory",
-                                                       dev->name);
-                               DBG_PRINT(ERR_DBG, " in Rx Intr!!\n");
-                               break;
-               }
-       }
+       for (i = 0; i < config->rx_ring_num; i++)
+               s2io_chk_rx_buffers(sp, i);
 
        atomic_dec(&sp->isr_cnt);
        return IRQ_HANDLED;
@@ -4051,39 +4066,13 @@ s2io_msix_ring_handle(int irq, void *dev_id, struct pt_regs *regs)
 {
        ring_info_t *ring = (ring_info_t *)dev_id;
        nic_t *sp = ring->nic;
-       struct net_device *dev = (struct net_device *) dev_id;
-       int rxb_size, level, rng_n;
 
        atomic_inc(&sp->isr_cnt);
-       rx_intr_handler(ring);
-
-       rng_n = ring->ring_no;
-       if (!sp->lro) {
-               rxb_size = atomic_read(&sp->rx_bufs_left[rng_n]);
-               level = rx_buffer_level(sp, rxb_size, rng_n);
 
-               if ((level == PANIC) && (!TASKLET_IN_USE)) {
-                       int ret;
-                       DBG_PRINT(INTR_DBG, "%s: Rx BD hit ", __FUNCTION__);
-                       DBG_PRINT(INTR_DBG, "PANIC levels\n");
-                       if ((ret = fill_rx_buffers(sp, rng_n)) == -ENOMEM) {
-                               DBG_PRINT(ERR_DBG, "Out of memory in %s",
-                                         __FUNCTION__);
-                               clear_bit(0, (&sp->tasklet_status));
-                               return IRQ_HANDLED;
-                       }
-                       clear_bit(0, (&sp->tasklet_status));
-               } else if (level == LOW) {
-                       tasklet_schedule(&sp->task);
-               }
-       }
-       else if (fill_rx_buffers(sp, rng_n) == -ENOMEM) {
-                       DBG_PRINT(ERR_DBG, "%s:Out of memory", dev->name);
-                       DBG_PRINT(ERR_DBG, " in Rx Intr!!\n");
-       }
+       rx_intr_handler(ring);
+       s2io_chk_rx_buffers(sp, ring->ring_no);
 
        atomic_dec(&sp->isr_cnt);
-
        return IRQ_HANDLED;
 }
 
@@ -4248,37 +4237,8 @@ static irqreturn_t s2io_isr(int irq, void *dev_id, struct pt_regs *regs)
         * else schedule a tasklet to reallocate the buffers.
         */
 #ifndef CONFIG_S2IO_NAPI
-       for (i = 0; i < config->rx_ring_num; i++) {
-               if (!sp->lro) {
-                       int ret;
-                       int rxb_size = atomic_read(&sp->rx_bufs_left[i]);
-                       int level = rx_buffer_level(sp, rxb_size, i);
-
-                       if ((level == PANIC) && (!TASKLET_IN_USE)) {
-                               DBG_PRINT(INTR_DBG, "%s: Rx BD hit ", 
-                                                       dev->name);
-                               DBG_PRINT(INTR_DBG, "PANIC levels\n");
-                               if ((ret = fill_rx_buffers(sp, i)) == -ENOMEM) {
-                                       DBG_PRINT(ERR_DBG, "%s:Out of memory",
-                                                 dev->name);
-                                       DBG_PRINT(ERR_DBG, " in ISR!!\n");
-                                       clear_bit(0, (&sp->tasklet_status));
-                                       atomic_dec(&sp->isr_cnt);
-                                       writeq(org_mask, &bar0->general_int_mask);
-                                       return IRQ_HANDLED;
-                               }
-                               clear_bit(0, (&sp->tasklet_status));
-                       } else if (level == LOW) {
-                               tasklet_schedule(&sp->task);
-                       }
-               }
-               else if (fill_rx_buffers(sp, i) == -ENOMEM) {
-                               DBG_PRINT(ERR_DBG, "%s:Out of memory",
-                                                       dev->name);
-                               DBG_PRINT(ERR_DBG, " in Rx intr!!\n");
-                               break;
-               }
-       }
+       for (i = 0; i < config->rx_ring_num; i++)
+               s2io_chk_rx_buffers(sp, i);
 #endif
        writeq(org_mask, &bar0->general_int_mask);
        atomic_dec(&sp->isr_cnt);
@@ -4308,6 +4268,8 @@ static void s2io_updt_stats(nic_t *sp)
                        if (cnt == 5)
                                break; /* Updt failed */
                } while(1);
+       } else {
+               memset(sp->mac_control.stats_info, 0, sizeof(StatInfo_t));
        }
 }
 
@@ -4942,7 +4904,8 @@ static int write_eeprom(nic_t * sp, int off, u64 data, int cnt)
 }
 static void s2io_vpd_read(nic_t *nic)
 {
-       u8 vpd_data[256],data;
+       u8 *vpd_data;
+       u8 data;
        int i=0, cnt, fail = 0;
        int vpd_addr = 0x80;
 
@@ -4955,6 +4918,10 @@ static void s2io_vpd_read(nic_t *nic)
                vpd_addr = 0x50;
        }
 
+       vpd_data = kmalloc(256, GFP_KERNEL);
+       if (!vpd_data)
+               return;
+
        for (i = 0; i < 256; i +=4 ) {
                pci_write_config_byte(nic->pdev, (vpd_addr + 2), i);
                pci_read_config_byte(nic->pdev,  (vpd_addr + 2), &data);
@@ -4977,6 +4944,7 @@ static void s2io_vpd_read(nic_t *nic)
                memset(nic->product_name, 0, vpd_data[1]);
                memcpy(nic->product_name, &vpd_data[3], vpd_data[1]);
        }
+       kfree(vpd_data);
 }
 
 /**
@@ -5295,7 +5263,7 @@ static int s2io_link_test(nic_t * sp, uint64_t * data)
        else
                *data = 0;
 
-       return 0;
+       return *data;
 }
 
 /**
@@ -5753,6 +5721,19 @@ static int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
        return 0;
 }
 
+static u32 s2io_ethtool_op_get_tso(struct net_device *dev)
+{
+       return (dev->features & NETIF_F_TSO) != 0;
+}
+static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data)
+{
+       if (data)
+               dev->features |= (NETIF_F_TSO | NETIF_F_TSO6);
+       else
+               dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
+
+       return 0;
+}
 
 static struct ethtool_ops netdev_ethtool_ops = {
        .get_settings = s2io_ethtool_gset,
@@ -5773,8 +5754,8 @@ static struct ethtool_ops netdev_ethtool_ops = {
        .get_sg = ethtool_op_get_sg,
        .set_sg = ethtool_op_set_sg,
 #ifdef NETIF_F_TSO
-       .get_tso = ethtool_op_get_tso,
-       .set_tso = ethtool_op_set_tso,
+       .get_tso = s2io_ethtool_op_get_tso,
+       .set_tso = s2io_ethtool_op_set_tso,
 #endif
        .get_ufo = ethtool_op_get_ufo,
        .set_ufo = ethtool_op_set_ufo,
@@ -6337,7 +6318,7 @@ static int s2io_card_up(nic_t * sp)
        s2io_set_multicast(dev);
 
        if (sp->lro) {
-               /* Initialize max aggregatable pkts based on MTU */
+               /* Initialize max aggregatable pkts per session based on MTU */
                sp->lro_max_aggr_per_sess = ((1<<16) - 1) / dev->mtu;
                /* Check if we can use(if specified) user provided value */
                if (lro_max_pkts < sp->lro_max_aggr_per_sess)
@@ -6438,7 +6419,7 @@ static void s2io_tx_watchdog(struct net_device *dev)
  *   @cksum : FCS checksum of the frame.
  *   @ring_no : the ring from which this RxD was extracted.
  *   Description:
- *   This function is called by the Tx interrupt serivce routine to perform
+ *   This function is called by the Rx interrupt serivce routine to perform
  *   some OS related operations on the SKB before passing it to the upper
  *   layers. It mainly checks if the checksum is OK, if so adds it to the
  *   SKBs cksum variable, increments the Rx packet count and passes the SKB
@@ -6698,33 +6679,6 @@ static void s2io_init_pci(nic_t * sp)
        pci_read_config_word(sp->pdev, PCI_COMMAND, &pci_cmd);
 }
 
-MODULE_AUTHOR("Raghavendra Koushik <raghavendra.koushik@neterion.com>");
-MODULE_LICENSE("GPL");
-MODULE_VERSION(DRV_VERSION);
-
-module_param(tx_fifo_num, int, 0);
-module_param(rx_ring_num, int, 0);
-module_param(rx_ring_mode, int, 0);
-module_param_array(tx_fifo_len, uint, NULL, 0);
-module_param_array(rx_ring_sz, uint, NULL, 0);
-module_param_array(rts_frm_len, uint, NULL, 0);
-module_param(use_continuous_tx_intrs, int, 1);
-module_param(rmac_pause_time, int, 0);
-module_param(mc_pause_threshold_q0q3, int, 0);
-module_param(mc_pause_threshold_q4q7, int, 0);
-module_param(shared_splits, int, 0);
-module_param(tmac_util_period, int, 0);
-module_param(rmac_util_period, int, 0);
-module_param(bimodal, bool, 0);
-module_param(l3l4hdr_size, int , 0);
-#ifndef CONFIG_S2IO_NAPI
-module_param(indicate_max_pkts, int, 0);
-#endif
-module_param(rxsync_frequency, int, 0);
-module_param(intr_type, int, 0);
-module_param(lro, int, 0);
-module_param(lro_max_pkts, int, 0);
-
 static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type)
 {
        if ( tx_fifo_num > 8) {
@@ -6832,8 +6786,8 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
        }
        if (dev_intr_type != MSI_X) {
                if (pci_request_regions(pdev, s2io_driver_name)) {
-                       DBG_PRINT(ERR_DBG, "Request Regions failed\n"),
-                           pci_disable_device(pdev);
+                       DBG_PRINT(ERR_DBG, "Request Regions failed\n");
+                       pci_disable_device(pdev);
                        return -ENODEV;
                }
        }
@@ -6957,7 +6911,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
        /*  initialize the shared memory used by the NIC and the host */
        if (init_shared_mem(sp)) {
                DBG_PRINT(ERR_DBG, "%s: Memory allocation failed\n",
-                         __FUNCTION__);
+                         dev->name);
                ret = -ENOMEM;
                goto mem_alloc_failed;
        }
@@ -7094,6 +7048,9 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
        dev->addr_len = ETH_ALEN;
        memcpy(dev->dev_addr, sp->def_mac_addr, ETH_ALEN);
 
+       /* reset Nic and bring it to known state */
+       s2io_reset(sp);
+
        /*
         * Initialize the tasklet status and link state flags
         * and the card state parameter
@@ -7131,11 +7088,11 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
                goto register_failed;
        }
        s2io_vpd_read(sp);
-       DBG_PRINT(ERR_DBG, "%s: Neterion %s",dev->name, sp->product_name);
-       DBG_PRINT(ERR_DBG, "(rev %d), Driver version %s\n",
-                               get_xena_rev_id(sp->pdev),
-                               s2io_driver_version);
        DBG_PRINT(ERR_DBG, "Copyright(c) 2002-2005 Neterion Inc.\n");
+       DBG_PRINT(ERR_DBG, "%s: Neterion %s (rev %d)\n",dev->name,
+                 sp->product_name, get_xena_rev_id(sp->pdev));
+       DBG_PRINT(ERR_DBG, "%s: Driver version %s\n", dev->name,
+                 s2io_driver_version);
        DBG_PRINT(ERR_DBG, "%s: MAC ADDR: "
                          "%02x:%02x:%02x:%02x:%02x:%02x\n", dev->name,
                          sp->def_mac_addr[0].mac_addr[0],
@@ -7436,8 +7393,13 @@ static int verify_l3_l4_lro_capable(lro_t *l_lro, struct iphdr *ip,
        if (ip->ihl != 5) /* IP has options */
                return -1;
 
+       /* If we see CE codepoint in IP header, packet is not mergeable */
+       if (INET_ECN_is_ce(ipv4_get_dsfield(ip)))
+               return -1;
+
+       /* If we see ECE or CWR flags in TCP header, packet is not mergeable */
        if (tcp->urg || tcp->psh || tcp->rst || tcp->syn || tcp->fin ||
-                                                               !tcp->ack) {
+                                   tcp->ece || tcp->cwr || !tcp->ack) {
                /*
                 * Currently recognize only the ack control word and
                 * any other control field being set would result in
@@ -7591,18 +7553,16 @@ static void queue_rx_frame(struct sk_buff *skb)
 static void lro_append_pkt(nic_t *sp, lro_t *lro, struct sk_buff *skb,
                           u32 tcp_len)
 {
-       struct sk_buff *tmp, *first = lro->parent;
+       struct sk_buff *first = lro->parent;
 
        first->len += tcp_len;
        first->data_len = lro->frags_len;
        skb_pull(skb, (skb->len - tcp_len));
-       if ((tmp = skb_shinfo(first)->frag_list)) {
-               while (tmp->next)
-                       tmp = tmp->next;
-               tmp->next = skb;
-       }
+       if (skb_shinfo(first)->frag_list)
+               lro->last_frag->next = skb;
        else
                skb_shinfo(first)->frag_list = skb;
+       lro->last_frag = skb;
        sp->mac_control.stats_info->sw_stat.clubbed_frms_cnt++;
        return;
 }
index 217097b..5ed49c3 100644 (file)
@@ -719,6 +719,7 @@ struct msix_info_st {
 /* Data structure to represent a LRO session */
 typedef struct lro {
        struct sk_buff  *parent;
+       struct sk_buff  *last_frag;
        u8              *l2h;
        struct iphdr    *iph;
        struct tcphdr   *tcph;
@@ -1011,4 +1012,13 @@ static void clear_lro_session(lro_t *lro);
 static void queue_rx_frame(struct sk_buff *skb);
 static void update_L3L4_header(nic_t *sp, lro_t *lro);
 static void lro_append_pkt(nic_t *sp, lro_t *lro, struct sk_buff *skb, u32 tcp_len);
+
+#define s2io_tcp_mss(skb) skb_shinfo(skb)->gso_size
+#define s2io_udp_mss(skb) skb_shinfo(skb)->gso_size
+#define s2io_offload_type(skb) skb_shinfo(skb)->gso_type
+
+#define S2IO_PARM_INT(X, def_val) \
+       static unsigned int X = def_val;\
+               module_param(X , uint, 0);
+
 #endif                         /* _S2IO_H */
index efc9c4b..da9d06b 100644 (file)
@@ -797,7 +797,7 @@ static int zd1211_hw_init_hmac(struct zd_chip *chip)
                { CR_ADDA_MBIAS_WARMTIME,       0x30000808 },
                { CR_ZD1211_RETRY_MAX,          0x2 },
                { CR_SNIFFER_ON,                0 },
-               { CR_RX_FILTER,                 AP_RX_FILTER },
+               { CR_RX_FILTER,                 STA_RX_FILTER },
                { CR_GROUP_HASH_P1,             0x00 },
                { CR_GROUP_HASH_P2,             0x80000000 },
                { CR_REG1,                      0xa4 },
@@ -844,7 +844,7 @@ static int zd1211b_hw_init_hmac(struct zd_chip *chip)
                { CR_ZD1211B_AIFS_CTL2,         0x008C003C },
                { CR_ZD1211B_TXOP,              0x01800824 },
                { CR_SNIFFER_ON,                0 },
-               { CR_RX_FILTER,                 AP_RX_FILTER },
+               { CR_RX_FILTER,                 STA_RX_FILTER },
                { CR_GROUP_HASH_P1,             0x00 },
                { CR_GROUP_HASH_P2,             0x80000000 },
                { CR_REG1,                      0xa4 },
index 8051210..069d2b4 100644 (file)
 
 #define CR_RX_FILTER                   CTL_REG(0x068c)
 #define RX_FILTER_ASSOC_RESPONSE       0x0002
+#define RX_FILTER_REASSOC_RESPONSE     0x0008
 #define RX_FILTER_PROBE_RESPONSE       0x0020
 #define RX_FILTER_BEACON               0x0100
+#define RX_FILTER_DISASSOC             0x0400
 #define RX_FILTER_AUTH                 0x0800
-/* Sniff modus sets filter to 0xfffff */
+#define AP_RX_FILTER                   0x0400feff
+#define STA_RX_FILTER                  0x0000ffff
+
+/* Monitor mode sets filter to 0xfffff */
 
 #define CR_ACK_TIMEOUT_EXT             CTL_REG(0x0690)
 #define CR_BCN_FIFO_SEMAPHORE          CTL_REG(0x0694)
 #define CR_ZD1211B_TXOP                        CTL_REG(0x0b20)
 #define CR_ZD1211B_RETRY_MAX           CTL_REG(0x0b28)
 
-#define AP_RX_FILTER                   0x0400feff
-#define STA_RX_FILTER                  0x0000ffff
-
 #define CWIN_SIZE                      0x007f043f
 
 
index 3bdc54d..d6f3e02 100644 (file)
@@ -108,7 +108,9 @@ int zd_mac_init_hw(struct zd_mac *mac, u8 device_type)
        if (r)
                goto disable_int;
 
-       r = zd_set_encryption_type(chip, NO_WEP);
+       /* We must inform the device that we are doing encryption/decryption in
+        * software at the moment. */
+       r = zd_set_encryption_type(chip, ENC_SNIFFER);
        if (r)
                goto disable_int;
 
@@ -136,10 +138,8 @@ static int reset_mode(struct zd_mac *mac)
 {
        struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
        struct zd_ioreq32 ioreqs[3] = {
-               { CR_RX_FILTER, RX_FILTER_BEACON|RX_FILTER_PROBE_RESPONSE|
-                               RX_FILTER_AUTH|RX_FILTER_ASSOC_RESPONSE },
+               { CR_RX_FILTER, STA_RX_FILTER },
                { CR_SNIFFER_ON, 0U },
-               { CR_ENCRYPTION_TYPE, NO_WEP },
        };
 
        if (ieee->iw_mode == IW_MODE_MONITOR) {
@@ -713,10 +713,10 @@ static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri)
 struct zd_rt_hdr {
        struct ieee80211_radiotap_header rt_hdr;
        u8  rt_flags;
+       u8  rt_rate;
        u16 rt_channel;
        u16 rt_chbitmask;
-       u16 rt_rate;
-};
+} __attribute__((packed));
 
 static void fill_rt_header(void *buffer, struct zd_mac *mac,
                           const struct ieee80211_rx_stats *stats,
@@ -735,14 +735,14 @@ static void fill_rt_header(void *buffer, struct zd_mac *mac,
        if (status->decryption_type & (ZD_RX_WEP64|ZD_RX_WEP128|ZD_RX_WEP256))
                hdr->rt_flags |= IEEE80211_RADIOTAP_F_WEP;
 
+       hdr->rt_rate = stats->rate / 5;
+
        /* FIXME: 802.11a */
        hdr->rt_channel = cpu_to_le16(ieee80211chan2mhz(
                                             _zd_chip_get_channel(&mac->chip)));
        hdr->rt_chbitmask = cpu_to_le16(IEEE80211_CHAN_2GHZ |
                ((status->frame_status & ZD_RX_FRAME_MODULATION_MASK) ==
                ZD_RX_OFDM ? IEEE80211_CHAN_OFDM : IEEE80211_CHAN_CCK));
-
-       hdr->rt_rate = stats->rate / 5;
 }
 
 /* Returns 1 if the data packet is for us and 0 otherwise. */
index 72f9052..6320984 100644 (file)
@@ -323,7 +323,6 @@ static void disable_read_regs_int(struct zd_usb *usb)
 {
        struct zd_usb_interrupt *intr = &usb->intr;
 
-       ZD_ASSERT(in_interrupt());
        spin_lock(&intr->lock);
        intr->read_regs_enabled = 0;
        spin_unlock(&intr->lock);
@@ -545,11 +544,11 @@ static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer,
         * be padded. Unaligned access might also happen if the length_info
         * structure is not present.
         */
-       if (get_unaligned(&length_info->tag) == RX_LENGTH_INFO_TAG) {
+       if (get_unaligned(&length_info->tag) == cpu_to_le16(RX_LENGTH_INFO_TAG))
+       {
                unsigned int l, k, n;
                for (i = 0, l = 0;; i++) {
-                       k = le16_to_cpu(get_unaligned(
-                               &length_info->length[i]));
+                       k = le16_to_cpu(get_unaligned(&length_info->length[i]));
                        n = l+k;
                        if (n > length)
                                return;
index 34de569..e2fef60 100644 (file)
@@ -27,8 +27,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * Send feedback to <gregkh@us.ibm.com>,
- *                 <t-kochi@bq.jp.nec.com>
+ * Send feedback to <kristen.c.accardi@intel.com>
  *
  */
 
index ef95d12..ae67a8f 100644 (file)
@@ -26,7 +26,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * Send feedback to <t-kochi@bq.jp.nec.com>
+ * Send feedback to <kristen.c.accardi@intel.com>
  *
  */
 
index 50bfc1b..478d0d2 100644 (file)
@@ -30,23 +30,6 @@ MODULE_LICENSE("GPL");
 /* global data */
 static const char device_name[] = "pcieport-driver";
 
-static int pcie_portdrv_save_config(struct pci_dev *dev)
-{
-       return pci_save_state(dev);
-}
-
-static int pcie_portdrv_restore_config(struct pci_dev *dev)
-{
-       int retval;
-
-       pci_restore_state(dev);
-       retval = pci_enable_device(dev);
-       if (retval)
-               return retval;
-       pci_set_master(dev);
-       return 0;
-}
-
 /*
  * pcie_portdrv_probe - Probe PCI-Express port devices
  * @dev: PCI-Express port device being probed
@@ -73,8 +56,10 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev,
                "%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n", 
                __FUNCTION__, dev->device, dev->vendor);
        }
-       if (pcie_port_device_register(dev)) 
+       if (pcie_port_device_register(dev)) {
+               pci_disable_device(dev);
                return -ENOMEM;
+       }
 
        return 0;
 }
@@ -86,6 +71,23 @@ static void pcie_portdrv_remove (struct pci_dev *dev)
 }
 
 #ifdef CONFIG_PM
+static int pcie_portdrv_save_config(struct pci_dev *dev)
+{
+       return pci_save_state(dev);
+}
+
+static int pcie_portdrv_restore_config(struct pci_dev *dev)
+{
+       int retval;
+
+       pci_restore_state(dev);
+       retval = pci_enable_device(dev);
+       if (retval)
+               return retval;
+       pci_set_master(dev);
+       return 0;
+}
+
 static int pcie_portdrv_suspend (struct pci_dev *dev, pm_message_t state)
 {
        int ret = pcie_port_device_suspend(dev, state);
index e3c78c3..fb08bc9 100644 (file)
@@ -990,6 +990,11 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
                        case 0x8070: /* P4G8X Deluxe */
                                asus_hides_smbus = 1;
                        }
+               if (dev->device == PCI_DEVICE_ID_INTEL_E7501_MCH)
+                       switch (dev->subsystem_device) {
+                       case 0x80c9: /* PU-DLS */
+                               asus_hides_smbus = 1;
+                       }
                if (dev->device == PCI_DEVICE_ID_INTEL_82855GM_HB)
                        switch (dev->subsystem_device) {
                        case 0x1751: /* M2N notebook */
@@ -1058,6 +1063,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,     PCI_DEVICE_ID_INTEL_82845G_HB,  asu
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_82850_HB,   asus_hides_smbus_hostbridge );
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_82865_HB,   asus_hides_smbus_hostbridge );
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_7205_0,     asus_hides_smbus_hostbridge );
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_E7501_MCH,  asus_hides_smbus_hostbridge );
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_82855PM_HB, asus_hides_smbus_hostbridge );
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_82855GM_HB, asus_hides_smbus_hostbridge );
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_82915GM_HB, asus_hides_smbus_hostbridge );
@@ -1081,6 +1087,7 @@ static void __init asus_hides_smbus_lpc(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_82801DB_0,  asus_hides_smbus_lpc );
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_82801BA_0,  asus_hides_smbus_lpc );
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_82801CA_0,  asus_hides_smbus_lpc );
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_82801CA_12, asus_hides_smbus_lpc );
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc );
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_82801EB_0,  asus_hides_smbus_lpc );
index f8ae2b7..d529462 100644 (file)
@@ -41,7 +41,7 @@ pci_do_find_bus(struct pci_bus* bus, unsigned char busnr)
  * in the global list of PCI buses.  If the bus is found, a pointer to its
  * data structure is returned.  If no bus is found, %NULL is returned.
  */
-struct pci_bus * __devinit pci_find_bus(int domain, int busnr)
+struct pci_bus * pci_find_bus(int domain, int busnr)
 {
        struct pci_bus *bus = NULL;
        struct pci_bus *tmp_bus;
index 3163e3d..9d8b415 100644 (file)
@@ -265,8 +265,8 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at
                                pnp_printf(buffer," disabled\n");
                        else
                                pnp_printf(buffer," 0x%llx-0x%llx\n",
-                                               pnp_port_start(dev, i),
-                                               pnp_port_end(dev, i));
+                                       (unsigned long long)pnp_port_start(dev, i),
+                                       (unsigned long long)pnp_port_end(dev, i));
                }
        }
        for (i = 0; i < PNP_MAX_MEM; i++) {
@@ -276,8 +276,8 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at
                                pnp_printf(buffer," disabled\n");
                        else
                                pnp_printf(buffer," 0x%llx-0x%llx\n",
-                                               pnp_mem_start(dev, i),
-                                               pnp_mem_end(dev, i));
+                                       (unsigned long long)pnp_mem_start(dev, i),
+                                       (unsigned long long)pnp_mem_end(dev, i));
                }
        }
        for (i = 0; i < PNP_MAX_IRQ; i++) {
@@ -287,7 +287,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at
                                pnp_printf(buffer," disabled\n");
                        else
                                pnp_printf(buffer," %lld\n",
-                                               pnp_irq(dev, i));
+                                       (unsigned long long)pnp_irq(dev, i));
                }
        }
        for (i = 0; i < PNP_MAX_DMA; i++) {
@@ -297,7 +297,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at
                                pnp_printf(buffer," disabled\n");
                        else
                                pnp_printf(buffer," %lld\n",
-                                               pnp_dma(dev, i));
+                                       (unsigned long long)pnp_dma(dev, i));
                }
        }
        ret = (buffer->curr - buf);
index 77e7202..904c25f 100644 (file)
@@ -940,14 +940,8 @@ static void ahci_host_intr(struct ata_port *ap)
                return;
 
        /* ignore interim PIO setup fis interrupts */
-       if (ata_tag_valid(ap->active_tag)) {
-               struct ata_queued_cmd *qc =
-                       ata_qc_from_tag(ap, ap->active_tag);
-
-               if (qc && qc->tf.protocol == ATA_PROT_PIO &&
-                   (status & PORT_IRQ_PIOS_FIS))
-                       return;
-       }
+       if (ata_tag_valid(ap->active_tag) && (status & PORT_IRQ_PIOS_FIS)) 
+               return;
 
        if (ata_ratelimit())
                ata_port_printk(ap, KERN_INFO, "spurious interrupt "
index df198cf..3719fcb 100644 (file)
 #define NAME_BUFSIZE      80    /* size of product name, path buffers */
 #define DATA_BUFSIZE      63    /* size of URB data buffers */
 
+/*
+ * Duplicate event filtering time.
+ * Sequential, identical KIND_FILTERED inputs with less than
+ * FILTER_TIME milliseconds between them are considered as repeat
+ * events. The hardware generates 5 events for the first keypress
+ * and we have to take this into account for an accurate repeat
+ * behaviour.
+ */
+#define FILTER_TIME    60 /* msec */
+
 static unsigned long channel_mask;
-module_param(channel_mask, ulong, 0444);
+module_param(channel_mask, ulong, 0644);
 MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore");
 
 static int debug;
-module_param(debug, int, 0444);
+module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "Enable extra debug messages and information");
 
+static int repeat_filter = FILTER_TIME;
+module_param(repeat_filter, int, 0644);
+MODULE_PARM_DESC(repeat_filter, "Repeat filter time, default = 60 msec");
+
 #define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0)
 #undef err
 #define err(format, arg...) printk(KERN_ERR format , ## arg)
@@ -143,18 +157,6 @@ MODULE_DEVICE_TABLE(usb, ati_remote_table);
 static char init1[] = { 0x01, 0x00, 0x20, 0x14 };
 static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 };
 
-/* Acceleration curve for directional control pad */
-static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
-
-/* Duplicate event filtering time.
- * Sequential, identical KIND_FILTERED inputs with less than
- * FILTER_TIME jiffies between them are considered as repeat
- * events. The hardware generates 5 events for the first keypress
- * and we have to take this into account for an accurate repeat
- * behaviour.
- */
-#define FILTER_TIME 60 /* msec */
-
 struct ati_remote {
        struct input_dev *idev;
        struct usb_device *udev;
@@ -411,6 +413,43 @@ static int ati_remote_event_lookup(int rem, unsigned char d1, unsigned char d2)
        return -1;
 }
 
+/*
+ *     ati_remote_compute_accel
+ *
+ * Implements acceleration curve for directional control pad
+ * If elapsed time since last event is > 1/4 second, user "stopped",
+ * so reset acceleration. Otherwise, user is probably holding the control
+ * pad down, so we increase acceleration, ramping up over two seconds to
+ * a maximum speed.
+ */
+static int ati_remote_compute_accel(struct ati_remote *ati_remote)
+{
+       static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
+       unsigned long now = jiffies;
+       int acc;
+
+       if (time_after(now, ati_remote->old_jiffies + msecs_to_jiffies(250))) {
+               acc = 1;
+               ati_remote->acc_jiffies = now;
+       }
+       else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(125)))
+               acc = accel[0];
+       else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(250)))
+               acc = accel[1];
+       else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(500)))
+               acc = accel[2];
+       else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(1000)))
+               acc = accel[3];
+       else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(1500)))
+               acc = accel[4];
+       else if (time_before(now, ati_remote->acc_jiffies + msecs_to_jiffies(2000)))
+               acc = accel[5];
+       else
+               acc = accel[6];
+
+       return acc;
+}
+
 /*
  *     ati_remote_report_input
  */
@@ -464,9 +503,9 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
 
        if (ati_remote_tbl[index].kind == KIND_FILTERED) {
                /* Filter duplicate events which happen "too close" together. */
-               if ((ati_remote->old_data[0] == data[1]) &&
-                       (ati_remote->old_data[1] == data[2]) &&
-                       time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(FILTER_TIME))) {
+               if (ati_remote->old_data[0] == data[1] &&
+                   ati_remote->old_data[1] == data[2] &&
+                   time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(repeat_filter))) {
                        ati_remote->repeat_count++;
                } else {
                        ati_remote->repeat_count = 0;
@@ -476,75 +515,61 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
                ati_remote->old_data[1] = data[2];
                ati_remote->old_jiffies = jiffies;
 
-               if ((ati_remote->repeat_count > 0)
-                   && (ati_remote->repeat_count < 5))
+               if (ati_remote->repeat_count > 0 &&
+                   ati_remote->repeat_count < 5)
                        return;
 
 
                input_regs(dev, regs);
                input_event(dev, ati_remote_tbl[index].type,
                        ati_remote_tbl[index].code, 1);
+               input_sync(dev);
                input_event(dev, ati_remote_tbl[index].type,
                        ati_remote_tbl[index].code, 0);
                input_sync(dev);
 
-               return;
-       }
+       } else {
 
-       /*
-        * Other event kinds are from the directional control pad, and have an
-        * acceleration factor applied to them.  Without this acceleration, the
-        * control pad is mostly unusable.
-        *
-        * If elapsed time since last event is > 1/4 second, user "stopped",
-        * so reset acceleration. Otherwise, user is probably holding the control
-        * pad down, so we increase acceleration, ramping up over two seconds to
-        * a maximum speed.  The acceleration curve is #defined above.
-        */
-       if (time_after(jiffies, ati_remote->old_jiffies + (HZ >> 2))) {
-               acc = 1;
-               ati_remote->acc_jiffies = jiffies;
-       }
-       else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 3)))  acc = accel[0];
-       else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 2)))  acc = accel[1];
-       else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 1)))  acc = accel[2];
-       else if (time_before(jiffies, ati_remote->acc_jiffies + HZ))         acc = accel[3];
-       else if (time_before(jiffies, ati_remote->acc_jiffies + HZ+(HZ>>1))) acc = accel[4];
-       else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ << 1)))  acc = accel[5];
-       else acc = accel[6];
-
-       input_regs(dev, regs);
-       switch (ati_remote_tbl[index].kind) {
-       case KIND_ACCEL:
-               input_event(dev, ati_remote_tbl[index].type,
-                       ati_remote_tbl[index].code,
-                       ati_remote_tbl[index].value * acc);
-               break;
-       case KIND_LU:
-               input_report_rel(dev, REL_X, -acc);
-               input_report_rel(dev, REL_Y, -acc);
-               break;
-       case KIND_RU:
-               input_report_rel(dev, REL_X, acc);
-               input_report_rel(dev, REL_Y, -acc);
-               break;
-       case KIND_LD:
-               input_report_rel(dev, REL_X, -acc);
-               input_report_rel(dev, REL_Y, acc);
-               break;
-       case KIND_RD:
-               input_report_rel(dev, REL_X, acc);
-               input_report_rel(dev, REL_Y, acc);
-               break;
-       default:
-               dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n",
-                       ati_remote_tbl[index].kind);
-       }
-       input_sync(dev);
+               /*
+                * Other event kinds are from the directional control pad, and have an
+                * acceleration factor applied to them.  Without this acceleration, the
+                * control pad is mostly unusable.
+                */
+               acc = ati_remote_compute_accel(ati_remote);
+
+               input_regs(dev, regs);
+               switch (ati_remote_tbl[index].kind) {
+               case KIND_ACCEL:
+                       input_event(dev, ati_remote_tbl[index].type,
+                               ati_remote_tbl[index].code,
+                               ati_remote_tbl[index].value * acc);
+                       break;
+               case KIND_LU:
+                       input_report_rel(dev, REL_X, -acc);
+                       input_report_rel(dev, REL_Y, -acc);
+                       break;
+               case KIND_RU:
+                       input_report_rel(dev, REL_X, acc);
+                       input_report_rel(dev, REL_Y, -acc);
+                       break;
+               case KIND_LD:
+                       input_report_rel(dev, REL_X, -acc);
+                       input_report_rel(dev, REL_Y, acc);
+                       break;
+               case KIND_RD:
+                       input_report_rel(dev, REL_X, acc);
+                       input_report_rel(dev, REL_Y, acc);
+                       break;
+               default:
+                       dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n",
+                               ati_remote_tbl[index].kind);
+               }
+               input_sync(dev);
 
-       ati_remote->old_jiffies = jiffies;
-       ati_remote->old_data[0] = data[1];
-       ati_remote->old_data[1] = data[2];
+               ati_remote->old_jiffies = jiffies;
+               ati_remote->old_data[0] = data[1];
+               ati_remote->old_data[1] = data[2];
+       }
 }
 
 /*
index 028e1ad..7208839 100644 (file)
@@ -607,7 +607,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 
        }
 
-       if (usage->hat_min < usage->hat_max || usage->hat_dir) {
+       if (usage->type == EV_ABS &&
+           (usage->hat_min < usage->hat_max || usage->hat_dir)) {
                int i;
                for (i = usage->code; i < usage->code + 2 && i <= max; i++) {
                        input_set_abs_params(input, i, -1, 1, 0, 0);
index 70477f0..f6b839c 100644 (file)
@@ -49,7 +49,7 @@ struct hiddev {
        int open;
        wait_queue_head_t wait;
        struct hid_device *hid;
-       struct hiddev_list *list;
+       struct list_head list;
 };
 
 struct hiddev_list {
@@ -59,7 +59,7 @@ struct hiddev_list {
        unsigned flags;
        struct fasync_struct *fasync;
        struct hiddev *hiddev;
-       struct hiddev_list *next;
+       struct list_head node;
 };
 
 static struct hiddev *hiddev_table[HIDDEV_MINORS];
@@ -73,12 +73,15 @@ static struct hiddev *hiddev_table[HIDDEV_MINORS];
 static struct hid_report *
 hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo)
 {
-       unsigned flags = rinfo->report_id & ~HID_REPORT_ID_MASK;
+       unsigned int flags = rinfo->report_id & ~HID_REPORT_ID_MASK;
+       unsigned int rid = rinfo->report_id & HID_REPORT_ID_MASK;
        struct hid_report_enum *report_enum;
+       struct hid_report *report;
        struct list_head *list;
 
        if (rinfo->report_type < HID_REPORT_TYPE_MIN ||
-           rinfo->report_type > HID_REPORT_TYPE_MAX) return NULL;
+           rinfo->report_type > HID_REPORT_TYPE_MAX)
+               return NULL;
 
        report_enum = hid->report_enum +
                (rinfo->report_type - HID_REPORT_TYPE_MIN);
@@ -88,21 +91,25 @@ hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo)
                break;
 
        case HID_REPORT_ID_FIRST:
-               list = report_enum->report_list.next;
-               if (list == &report_enum->report_list)
+               if (list_empty(&report_enum->report_list))
                        return NULL;
-               rinfo->report_id = ((struct hid_report *) list)->id;
+
+               list = report_enum->report_list.next;
+               report = list_entry(list, struct hid_report, list);
+               rinfo->report_id = report->id;
                break;
 
        case HID_REPORT_ID_NEXT:
-               list = (struct list_head *)
-                       report_enum->report_id_hash[rinfo->report_id & HID_REPORT_ID_MASK];
-               if (list == NULL)
+               report = report_enum->report_id_hash[rid];
+               if (!report)
                        return NULL;
-               list = list->next;
+
+               list = report->list.next;
                if (list == &report_enum->report_list)
                        return NULL;
-               rinfo->report_id = ((struct hid_report *) list)->id;
+
+               report = list_entry(list, struct hid_report, list);
+               rinfo->report_id = report->id;
                break;
 
        default:
@@ -125,12 +132,13 @@ hiddev_lookup_usage(struct hid_device *hid, struct hiddev_usage_ref *uref)
        struct hid_field *field;
 
        if (uref->report_type < HID_REPORT_TYPE_MIN ||
-           uref->report_type > HID_REPORT_TYPE_MAX) return NULL;
+           uref->report_type > HID_REPORT_TYPE_MAX)
+               return NULL;
 
        report_enum = hid->report_enum +
                (uref->report_type - HID_REPORT_TYPE_MIN);
 
-       list_for_each_entry(report, &report_enum->report_list, list)
+       list_for_each_entry(report, &report_enum->report_list, list) {
                for (i = 0; i < report->maxfield; i++) {
                        field = report->field[i];
                        for (j = 0; j < field->maxusage; j++) {
@@ -142,6 +150,7 @@ hiddev_lookup_usage(struct hid_device *hid, struct hiddev_usage_ref *uref)
                                }
                        }
                }
+       }
 
        return NULL;
 }
@@ -150,9 +159,9 @@ static void hiddev_send_event(struct hid_device *hid,
                              struct hiddev_usage_ref *uref)
 {
        struct hiddev *hiddev = hid->hiddev;
-       struct hiddev_list *list = hiddev->list;
+       struct hiddev_list *list;
 
-       while (list) {
+       list_for_each_entry(list, &hiddev->list, node) {
                if (uref->field_index != HID_FIELD_INDEX_NONE ||
                    (list->flags & HIDDEV_FLAG_REPORT) != 0) {
                        list->buffer[list->head] = *uref;
@@ -160,8 +169,6 @@ static void hiddev_send_event(struct hid_device *hid,
                                (HIDDEV_BUFFER_SIZE - 1);
                        kill_fasync(&list->fasync, SIGIO, POLL_IN);
                }
-
-               list = list->next;
        }
 
        wake_up_interruptible(&hiddev->wait);
@@ -180,7 +187,7 @@ void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
        uref.report_type =
          (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
          ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
-          ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));
+          ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE : 0));
        uref.report_id = field->report->id;
        uref.field_index = field->index;
        uref.usage_index = (usage - field->usage);
@@ -200,7 +207,7 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report)
        uref.report_type =
          (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
          ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
-          ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));
+          ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE : 0));
        uref.report_id = report->id;
        uref.field_index = HID_FIELD_INDEX_NONE;
 
@@ -213,7 +220,9 @@ static int hiddev_fasync(int fd, struct file *file, int on)
 {
        int retval;
        struct hiddev_list *list = file->private_data;
+
        retval = fasync_helper(fd, file, on, &list->fasync);
+
        return retval < 0 ? retval : 0;
 }
 
@@ -224,14 +233,9 @@ static int hiddev_fasync(int fd, struct file *file, int on)
 static int hiddev_release(struct inode * inode, struct file * file)
 {
        struct hiddev_list *list = file->private_data;
-       struct hiddev_list **listptr;
 
-       listptr = &list->hiddev->list;
        hiddev_fasync(-1, file, 0);
-
-       while (*listptr && (*listptr != list))
-               listptr = &((*listptr)->next);
-       *listptr = (*listptr)->next;
+       list_del(&list->node);
 
        if (!--list->hiddev->open) {
                if (list->hiddev->exist)
@@ -248,7 +252,8 @@ static int hiddev_release(struct inode * inode, struct file * file)
 /*
  * open file op
  */
-static int hiddev_open(struct inode * inode, struct file * file) {
+static int hiddev_open(struct inode *inode, struct file *file)
+{
        struct hiddev_list *list;
 
        int i = iminor(inode) - HIDDEV_MINOR_BASE;
@@ -260,9 +265,7 @@ static int hiddev_open(struct inode * inode, struct file * file) {
                return -ENOMEM;
 
        list->hiddev = hiddev_table[i];
-       list->next = hiddev_table[i]->list;
-       hiddev_table[i]->list = list;
-
+       list_add_tail(&list->node, &hiddev_table[i]->list);
        file->private_data = list;
 
        if (!list->hiddev->open++)
@@ -362,6 +365,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
 static unsigned int hiddev_poll(struct file *file, poll_table *wait)
 {
        struct hiddev_list *list = file->private_data;
+
        poll_wait(file, &list->hiddev->wait, wait);
        if (list->head != list->tail)
                return POLLIN | POLLRDNORM;
@@ -382,7 +386,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
        struct hiddev_collection_info cinfo;
        struct hiddev_report_info rinfo;
        struct hiddev_field_info finfo;
-       struct hiddev_usage_ref_multi *uref_multi=NULL;
+       struct hiddev_usage_ref_multi *uref_multi = NULL;
        struct hiddev_usage_ref *uref;
        struct hiddev_devinfo dinfo;
        struct hid_report *report;
@@ -764,15 +768,15 @@ int hiddev_connect(struct hid_device *hid)
        }
 
        init_waitqueue_head(&hiddev->wait);
-
-       hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;
-
+       INIT_LIST_HEAD(&hiddev->list);
        hiddev->hid = hid;
        hiddev->exist = 1;
 
        hid->minor = hid->intf->minor;
        hid->hiddev = hiddev;
 
+       hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;
+
        return 0;
 }
 
index 43e3f56..a223cf4 100644 (file)
@@ -168,16 +168,15 @@ void jfs_dirty_inode(struct inode *inode)
        set_cflag(COMMIT_Dirty, inode);
 }
 
-static int
-jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks,
-                       struct buffer_head *bh_result, int create)
+int jfs_get_block(struct inode *ip, sector_t lblock,
+                 struct buffer_head *bh_result, int create)
 {
        s64 lblock64 = lblock;
        int rc = 0;
        xad_t xad;
        s64 xaddr;
        int xflag;
-       s32 xlen = max_blocks;
+       s32 xlen = bh_result->b_size >> ip->i_blkbits;
 
        /*
         * Take appropriate lock on inode
@@ -188,7 +187,7 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks,
                IREAD_LOCK(ip);
 
        if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) &&
-           (!xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, 0)) &&
+           (!xtLookup(ip, lblock64, xlen, &xflag, &xaddr, &xlen, 0)) &&
            xaddr) {
                if (xflag & XAD_NOTRECORDED) {
                        if (!create)
@@ -255,13 +254,6 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks,
        return rc;
 }
 
-static int jfs_get_block(struct inode *ip, sector_t lblock,
-                        struct buffer_head *bh_result, int create)
-{
-       return jfs_get_blocks(ip, lblock, bh_result->b_size >> ip->i_blkbits,
-                       bh_result, create);
-}
-
 static int jfs_writepage(struct page *page, struct writeback_control *wbc)
 {
        return nobh_writepage(page, jfs_get_block, wbc);
index b5c7da6..1fc48df 100644 (file)
@@ -32,6 +32,7 @@ extern void jfs_truncate_nolock(struct inode *, loff_t);
 extern void jfs_free_zero_link(struct inode *);
 extern struct dentry *jfs_get_parent(struct dentry *dentry);
 extern void jfs_set_inode_flags(struct inode *);
+extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
 
 extern const struct address_space_operations jfs_aops;
 extern struct inode_operations jfs_dir_inode_operations;
index 4f6cfeb..143bcd1 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/moduleparam.h>
 #include <linux/kthread.h>
 #include <linux/posix_acl.h>
+#include <linux/buffer_head.h>
 #include <asm/uaccess.h>
 #include <linux/seq_file.h>
 
@@ -298,7 +299,7 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
                        break;
                }
 
-#if defined(CONFIG_QUOTA)
+#ifdef CONFIG_QUOTA
                case Opt_quota:
                case Opt_usrquota:
                        *flag |= JFS_USRQUOTA;
@@ -597,7 +598,7 @@ static int jfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
        if (sbi->flag & JFS_NOINTEGRITY)
                seq_puts(seq, ",nointegrity");
 
-#if defined(CONFIG_QUOTA)
+#ifdef CONFIG_QUOTA
        if (sbi->flag & JFS_USRQUOTA)
                seq_puts(seq, ",usrquota");
 
@@ -608,6 +609,113 @@ static int jfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
        return 0;
 }
 
+#ifdef CONFIG_QUOTA
+
+/* Read data from quotafile - avoid pagecache and such because we cannot afford
+ * acquiring the locks... As quota files are never truncated and quota code
+ * itself serializes the operations (and noone else should touch the files)
+ * we don't have to be afraid of races */
+static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data,
+                             size_t len, loff_t off)
+{
+       struct inode *inode = sb_dqopt(sb)->files[type];
+       sector_t blk = off >> sb->s_blocksize_bits;
+       int err = 0;
+       int offset = off & (sb->s_blocksize - 1);
+       int tocopy;
+       size_t toread;
+       struct buffer_head tmp_bh;
+       struct buffer_head *bh;
+       loff_t i_size = i_size_read(inode);
+
+       if (off > i_size)
+               return 0;
+       if (off+len > i_size)
+               len = i_size-off;
+       toread = len;
+       while (toread > 0) {
+               tocopy = sb->s_blocksize - offset < toread ?
+                               sb->s_blocksize - offset : toread;
+
+               tmp_bh.b_state = 0;
+               tmp_bh.b_size = 1 << inode->i_blkbits;
+               err = jfs_get_block(inode, blk, &tmp_bh, 0);
+               if (err)
+                       return err;
+               if (!buffer_mapped(&tmp_bh))    /* A hole? */
+                       memset(data, 0, tocopy);
+               else {
+                       bh = sb_bread(sb, tmp_bh.b_blocknr);
+                       if (!bh)
+                               return -EIO;
+                       memcpy(data, bh->b_data+offset, tocopy);
+                       brelse(bh);
+               }
+               offset = 0;
+               toread -= tocopy;
+               data += tocopy;
+               blk++;
+       }
+       return len;
+}
+
+/* Write to quotafile */
+static ssize_t jfs_quota_write(struct super_block *sb, int type,
+                              const char *data, size_t len, loff_t off)
+{
+       struct inode *inode = sb_dqopt(sb)->files[type];
+       sector_t blk = off >> sb->s_blocksize_bits;
+       int err = 0;
+       int offset = off & (sb->s_blocksize - 1);
+       int tocopy;
+       size_t towrite = len;
+       struct buffer_head tmp_bh;
+       struct buffer_head *bh;
+
+       mutex_lock(&inode->i_mutex);
+       while (towrite > 0) {
+               tocopy = sb->s_blocksize - offset < towrite ?
+                               sb->s_blocksize - offset : towrite;
+
+               tmp_bh.b_state = 0;
+               tmp_bh.b_size = 1 << inode->i_blkbits;
+               err = jfs_get_block(inode, blk, &tmp_bh, 1);
+               if (err)
+                       goto out;
+               if (offset || tocopy != sb->s_blocksize)
+                       bh = sb_bread(sb, tmp_bh.b_blocknr);
+               else
+                       bh = sb_getblk(sb, tmp_bh.b_blocknr);
+               if (!bh) {
+                       err = -EIO;
+                       goto out;
+               }
+               lock_buffer(bh);
+               memcpy(bh->b_data+offset, data, tocopy);
+               flush_dcache_page(bh->b_page);
+               set_buffer_uptodate(bh);
+               mark_buffer_dirty(bh);
+               unlock_buffer(bh);
+               brelse(bh);
+               offset = 0;
+               towrite -= tocopy;
+               data += tocopy;
+               blk++;
+       }
+out:
+       if (len == towrite)
+               return err;
+       if (inode->i_size < off+len-towrite)
+               i_size_write(inode, off+len-towrite);
+       inode->i_version++;
+       inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+       mark_inode_dirty(inode);
+       mutex_unlock(&inode->i_mutex);
+       return len - towrite;
+}
+
+#endif
+
 static struct super_operations jfs_super_operations = {
        .alloc_inode    = jfs_alloc_inode,
        .destroy_inode  = jfs_destroy_inode,
@@ -621,7 +729,11 @@ static struct super_operations jfs_super_operations = {
        .unlockfs       = jfs_unlockfs,
        .statfs         = jfs_statfs,
        .remount_fs     = jfs_remount,
-       .show_options   = jfs_show_options
+       .show_options   = jfs_show_options,
+#ifdef CONFIG_QUOTA
+       .quota_read     = jfs_quota_read,
+       .quota_write    = jfs_quota_write,
+#endif
 };
 
 static struct export_operations jfs_export_operations = {
index baf5ae5..c9d4197 100644 (file)
@@ -638,9 +638,6 @@ static void nlmsvc_grant_callback(struct rpc_task *task, void *data)
        if (task->tk_status < 0) {
                /* RPC error: Re-insert for retransmission */
                timeout = 10 * HZ;
-       } else if (block->b_done) {
-               /* Block already removed, kill it for real */
-               timeout = 0;
        } else {
                /* Call was successful, now wait for client callback */
                timeout = 60 * HZ;
@@ -709,13 +706,10 @@ nlmsvc_retry_blocked(void)
                        break;
                if (time_after(block->b_when,jiffies))
                        break;
-               dprintk("nlmsvc_retry_blocked(%p, when=%ld, done=%d)\n",
-                       block, block->b_when, block->b_done);
+               dprintk("nlmsvc_retry_blocked(%p, when=%ld)\n",
+                       block, block->b_when);
                kref_get(&block->b_count);
-               if (block->b_done)
-                       nlmsvc_unlink_block(block);
-               else
-                       nlmsvc_grant_blocked(block);
+               nlmsvc_grant_blocked(block);
                nlmsvc_release_block(block);
        }
 
index e01070d..55a1312 100644 (file)
@@ -159,7 +159,7 @@ char * getname(const char __user * filename)
 #ifdef CONFIG_AUDITSYSCALL
 void putname(const char *name)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                audit_putname(name);
        else
                __putname(name);
@@ -1125,7 +1125,7 @@ static int fastcall do_path_lookup(int dfd, const char *name,
        retval = link_path_walk(name, nd);
 out:
        if (likely(retval == 0)) {
-               if (unlikely(current->audit_context && nd && nd->dentry &&
+               if (unlikely(!audit_dummy_context() && nd && nd->dentry &&
                                nd->dentry->d_inode))
                audit_inode(name, nd->dentry->d_inode);
        }
@@ -1357,7 +1357,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
                return -ENOENT;
 
        BUG_ON(victim->d_parent->d_inode != dir);
-       audit_inode_child(victim->d_name.name, victim->d_inode, dir->i_ino);
+       audit_inode_child(victim->d_name.name, victim->d_inode, dir);
 
        error = permission(dir,MAY_WRITE | MAY_EXEC, NULL);
        if (error)
@@ -1659,6 +1659,7 @@ do_last:
         * It already exists.
         */
        mutex_unlock(&dir->d_inode->i_mutex);
+       audit_inode_update(path.dentry->d_inode);
 
        error = -EEXIST;
        if (flag & O_EXCL)
@@ -1669,6 +1670,7 @@ do_last:
                if (flag & O_NOFOLLOW)
                        goto exit_dput;
        }
+
        error = -ENOENT;
        if (!path.dentry->d_inode)
                goto exit_dput;
index 19b98ca..86b3169 100644 (file)
@@ -51,7 +51,7 @@ char *nfs_path(const char *base, const struct dentry *dentry,
                namelen = dentry->d_name.len;
                buflen -= namelen + 1;
                if (buflen < 0)
-                       goto Elong;
+                       goto Elong_unlock;
                end -= namelen;
                memcpy(end, dentry->d_name.name, namelen);
                *--end = '/';
@@ -68,6 +68,8 @@ char *nfs_path(const char *base, const struct dentry *dentry,
        end -= namelen;
        memcpy(end, base, namelen);
        return end;
+Elong_unlock:
+       spin_unlock(&dcache_lock);
 Elong:
        return ERR_PTR(-ENAMETOOLONG);
 }
index 52bf634..65c0c5b 100644 (file)
@@ -63,7 +63,7 @@ struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount)
        return p;
 }
 
-void nfs_readdata_free(struct nfs_read_data *p)
+static void nfs_readdata_free(struct nfs_read_data *p)
 {
        if (p && (p->pagevec != &p->page_array[0]))
                kfree(p->pagevec);
index 86bac6a..5077499 100644 (file)
@@ -137,7 +137,7 @@ struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount)
        return p;
 }
 
-void nfs_writedata_free(struct nfs_write_data *p)
+static void nfs_writedata_free(struct nfs_write_data *p)
 {
        if (p && (p->pagevec != &p->page_array[0]))
                kfree(p->pagevec);
index 894bc4d..6a33a07 100644 (file)
@@ -56,6 +56,11 @@ extern void efi_memmap_init(unsigned long *, unsigned long *);
   extern struct page *vmem_map;
   extern int find_largest_hole (u64 start, u64 end, void *arg);
   extern int create_mem_map_page_table (u64 start, u64 end, void *arg);
+  extern int vmemmap_find_next_valid_pfn(int, int);
+#else
+static inline int vmemmap_find_next_valid_pfn(int node, int i)
+{
+       return i + 1;
+}
 #endif
-
 #endif /* meminit_h */
index 37e52a2..20a8d61 100644 (file)
@@ -1433,7 +1433,12 @@ typedef union  pal_version_u {
 } pal_version_u_t;
 
 
-/* Return PAL version information */
+/*
+ * Return PAL version information.  While the documentation states that
+ * PAL_VERSION can be called in either physical or virtual mode, some
+ * implementations only allow physical calls.  We don't call it very often,
+ * so the overhead isn't worth eliminating.
+ */
 static inline s64
 ia64_pal_version (pal_version_u_t *pal_min_version, pal_version_u_t *pal_cur_version)
 {
index 8406f1e..b72af59 100644 (file)
@@ -1124,8 +1124,8 @@ xpc_notify_IRQ_send_local(struct xpc_channel *ch, u8 ipi_flag,
 #define XPC_GET_IPI_FLAGS(_amo, _c)    ((u8) (((_amo) >> ((_c) * 8)) & 0xff))
 #define XPC_SET_IPI_FLAGS(_amo, _c, _f)        (_amo) |= ((u64) (_f) << ((_c) * 8))
 
-#define        XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & 0x0f0f0f0f0f0f0f0f)
-#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo)       ((_amo) & 0x1010101010101010)
+#define        XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & __IA64_UL_CONST(0x0f0f0f0f0f0f0f0f))
+#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo)       ((_amo) & __IA64_UL_CONST(0x1010101010101010))
 
 
 static inline void
index fc9677b..384fbf7 100644 (file)
@@ -24,7 +24,7 @@
  * 0xa000000000000000+2*PERCPU_PAGE_SIZE
  * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
  */
-#define KERNEL_START            (GATE_ADDR+0x100000000)
+#define KERNEL_START            (GATE_ADDR+__IA64_UL_CONST(0x100000000))
 #define PERCPU_ADDR            (-PERCPU_PAGE_SIZE)
 
 #ifndef __ASSEMBLY__
index b27d7de..64f9f9e 100644 (file)
@@ -327,21 +327,31 @@ extern void __audit_getname(const char *name);
 extern void audit_putname(const char *name);
 extern void __audit_inode(const char *name, const struct inode *inode);
 extern void __audit_inode_child(const char *dname, const struct inode *inode,
-                               unsigned long pino);
+                               const struct inode *parent);
+extern void __audit_inode_update(const struct inode *inode);
+static inline int audit_dummy_context(void)
+{
+       void *p = current->audit_context;
+       return !p || *(int *)p;
+}
 static inline void audit_getname(const char *name)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                __audit_getname(name);
 }
 static inline void audit_inode(const char *name, const struct inode *inode) {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                __audit_inode(name, inode);
 }
 static inline void audit_inode_child(const char *dname, 
-                                    const struct inode *inode, 
-                                    unsigned long pino) {
-       if (unlikely(current->audit_context))
-               __audit_inode_child(dname, inode, pino);
+                                    const struct inode *inode,
+                                    const struct inode *parent) {
+       if (unlikely(!audit_dummy_context()))
+               __audit_inode_child(dname, inode, parent);
+}
+static inline void audit_inode_update(const struct inode *inode) {
+       if (unlikely(!audit_dummy_context()))
+               __audit_inode_update(inode);
 }
 
                                /* Private API (for audit.c only) */
@@ -365,57 +375,61 @@ extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
 
 static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_ipc_obj(ipcp);
        return 0;
 }
 static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_ipc_set_perm(qbytes, uid, gid, mode);
        return 0;
 }
 static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_mq_open(oflag, mode, u_attr);
        return 0;
 }
 static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout);
        return 0;
 }
 static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout);
        return 0;
 }
 static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_mq_notify(mqdes, u_notification);
        return 0;
 }
 static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
 {
-       if (unlikely(current->audit_context))
+       if (unlikely(!audit_dummy_context()))
                return __audit_mq_getsetattr(mqdes, mqstat);
        return 0;
 }
+extern int audit_n_rules;
 #else
 #define audit_alloc(t) ({ 0; })
 #define audit_free(t) do { ; } while (0)
 #define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
 #define audit_syscall_exit(f,r) do { ; } while (0)
+#define audit_dummy_context() 1
 #define audit_getname(n) do { ; } while (0)
 #define audit_putname(n) do { ; } while (0)
 #define __audit_inode(n,i) do { ; } while (0)
 #define __audit_inode_child(d,i,p) do { ; } while (0)
+#define __audit_inode_update(i) do { ; } while (0)
 #define audit_inode(n,i) do { ; } while (0)
 #define audit_inode_child(d,i,p) do { ; } while (0)
+#define audit_inode_update(i) do { ; } while (0)
 #define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
 #define audit_get_loginuid(c) ({ -1; })
 #define audit_ipc_obj(i) ({ 0; })
@@ -430,6 +444,7 @@ static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
 #define audit_mq_timedreceive(d,l,p,t) ({ 0; })
 #define audit_mq_notify(d,n) ({ 0; })
 #define audit_mq_getsetattr(d,s) ({ 0; })
+#define audit_n_rules 0
 #endif
 
 #ifdef CONFIG_AUDIT
index cc5dec7..d4f219f 100644 (file)
@@ -67,7 +67,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
        if (source) {
                inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL);
        }
-       audit_inode_child(new_name, source, new_dir->i_ino);
+       audit_inode_child(new_name, source, new_dir);
 }
 
 /*
@@ -98,7 +98,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
        inode_dir_notify(inode, DN_CREATE);
        inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name,
                                  dentry->d_inode);
-       audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino);
+       audit_inode_child(dentry->d_name.name, dentry->d_inode, inode);
 }
 
 /*
@@ -109,7 +109,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
        inode_dir_notify(inode, DN_CREATE);
        inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, 
                                  dentry->d_name.name, dentry->d_inode);
-       audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino);
+       audit_inode_child(dentry->d_name.name, dentry->d_inode, inode);
 }
 
 /*
index 56f1e0e..b3253ab 100644 (file)
@@ -893,7 +893,6 @@ struct input_dev {
 
        int (*open)(struct input_dev *dev);
        void (*close)(struct input_dev *dev);
-       int (*accept)(struct input_dev *dev, struct file *file);
        int (*flush)(struct input_dev *dev, struct file *file);
        int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);
        int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect);
@@ -961,6 +960,26 @@ struct input_dev {
 
 struct input_handle;
 
+/**
+ * struct input_handler - implements one of interfaces for input devices
+ * @private: driver-specific data
+ * @event: event handler
+ * @connect: called when attaching a handler to an input device
+ * @disconnect: disconnects a handler from input device
+ * @start: starts handler for given handle. This function is called by
+ *     input core right after connect() method and also when a process
+ *     that "grabbed" a device releases it
+ * @fops: file operations this driver implements
+ * @minor: beginning of range of 32 minors for devices this driver
+ *     can provide
+ * @name: name of the handler, to be shown in /proc/bus/input/handlers
+ * @id_table: pointer to a table of input_device_ids this driver can
+ *     handle
+ * @blacklist: prointer to a table of input_device_ids this driver should
+ *     ignore even if they match @id_table
+ * @h_list: list of input handles associated with the handler
+ * @node: for placing the driver onto input_handler_list
+ */
 struct input_handler {
 
        void *private;
@@ -968,6 +987,7 @@ struct input_handler {
        void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
        struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
        void (*disconnect)(struct input_handle *handle);
+       void (*start)(struct input_handle *handle);
 
        const struct file_operations *fops;
        int minor;
@@ -1030,10 +1050,10 @@ void input_release_device(struct input_handle *);
 int input_open_device(struct input_handle *);
 void input_close_device(struct input_handle *);
 
-int input_accept_process(struct input_handle *handle, struct file *file);
 int input_flush_device(struct input_handle* handle, struct file* file);
 
 void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
+void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value);
 
 static inline void input_report_key(struct input_dev *dev, unsigned int code, int value)
 {
index 0503b2e..2d22932 100644 (file)
@@ -46,8 +46,6 @@ enum kobject_action {
        KOBJ_UMOUNT     = (__force kobject_action_t) 0x05,      /* umount event for block devices (broken) */
        KOBJ_OFFLINE    = (__force kobject_action_t) 0x06,      /* device offline */
        KOBJ_ONLINE     = (__force kobject_action_t) 0x07,      /* device online */
-       KOBJ_UNDOCK     = (__force kobject_action_t) 0x08,      /* undocking */
-       KOBJ_DOCK       = (__force kobject_action_t) 0x09,      /* dock */
 };
 
 struct kobject {
index aa4fe90..0d92c46 100644 (file)
@@ -123,7 +123,6 @@ struct nlm_block {
        unsigned int            b_id;           /* block id */
        unsigned char           b_queued;       /* re-queued */
        unsigned char           b_granted;      /* VFS granted lock */
-       unsigned char           b_done;         /* callback complete */
        struct nlm_file *       b_file;         /* file in question */
 };
 
index 55ea853..2474345 100644 (file)
@@ -476,10 +476,9 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page)
 }
 
 /*
- * Allocate and free nfs_write_data structures
+ * Allocate nfs_write_data structures
  */
 extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount);
-extern void nfs_writedata_free(struct nfs_write_data *p);
 
 /*
  * linux/fs/nfs/read.c
@@ -491,10 +490,9 @@ extern int  nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
 extern void nfs_readdata_release(void *data);
 
 /*
- * Allocate and free nfs_read_data structures
+ * Allocate nfs_read_data structures
  */
 extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount);
-extern void nfs_readdata_free(struct nfs_read_data *p);
 
 /*
  * linux/fs/nfs3proc.c
index c09396d..4eae06b 100644 (file)
 #define PCI_DEVICE_ID_INTEL_82820_UP_HB        0x2501
 #define PCI_DEVICE_ID_INTEL_82850_HB   0x2530
 #define PCI_DEVICE_ID_INTEL_82860_HB   0x2531
+#define PCI_DEVICE_ID_INTEL_E7501_MCH  0x254c
 #define PCI_DEVICE_ID_INTEL_82845G_HB  0x2560
 #define PCI_DEVICE_ID_INTEL_82845G_IG  0x2562
 #define PCI_DEVICE_ID_INTEL_82865_HB   0x2570
index e8bbe81..840e47a 100644 (file)
@@ -229,7 +229,7 @@ int                 xprt_reserve_xprt(struct rpc_task *task);
 int                    xprt_reserve_xprt_cong(struct rpc_task *task);
 int                    xprt_prepare_transmit(struct rpc_task *task);
 void                   xprt_transmit(struct rpc_task *task);
-void                   xprt_abort_transmit(struct rpc_task *task);
+void                   xprt_end_transmit(struct rpc_task *task);
 int                    xprt_adjust_timeout(struct rpc_rqst *req);
 void                   xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
 void                   xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
index d417ca1..0a36091 100644 (file)
@@ -690,9 +690,7 @@ static const struct inotify_operations audit_inotify_ops = {
 /* Initialize audit support at boot time. */
 static int __init audit_init(void)
 {
-#ifdef CONFIG_AUDITSYSCALL
        int i;
-#endif
 
        printk(KERN_INFO "audit: initializing netlink socket (%s)\n",
               audit_default ? "enabled" : "disabled");
@@ -717,10 +715,10 @@ static int __init audit_init(void)
        audit_ih = inotify_init(&audit_inotify_ops);
        if (IS_ERR(audit_ih))
                audit_panic("cannot initialize inotify handle");
+#endif
 
        for (i = 0; i < AUDIT_INODE_BUCKETS; i++)
                INIT_LIST_HEAD(&audit_inode_hash[i]);
-#endif
 
        return 0;
 }
index 5b4e162..6a9a5c5 100644 (file)
@@ -442,6 +442,7 @@ static struct audit_entry *audit_rule_to_entry(struct audit_rule *rule)
                case AUDIT_EQUAL:
                        break;
                default:
+                       err = -EINVAL;
                        goto exit_free;
                }
        }
@@ -579,6 +580,7 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
                case AUDIT_EQUAL:
                        break;
                default:
+                       err = -EINVAL;
                        goto exit_free;
                }
        }
@@ -1134,6 +1136,14 @@ static inline int audit_add_rule(struct audit_entry *entry,
        struct audit_watch *watch = entry->rule.watch;
        struct nameidata *ndp, *ndw;
        int h, err, putnd_needed = 0;
+#ifdef CONFIG_AUDITSYSCALL
+       int dont_count = 0;
+
+       /* If either of these, don't count towards total */
+       if (entry->rule.listnr == AUDIT_FILTER_USER ||
+               entry->rule.listnr == AUDIT_FILTER_TYPE)
+               dont_count = 1;
+#endif
 
        if (inode_f) {
                h = audit_hash_ino(inode_f->val);
@@ -1174,6 +1184,10 @@ static inline int audit_add_rule(struct audit_entry *entry,
        } else {
                list_add_tail_rcu(&entry->list, list);
        }
+#ifdef CONFIG_AUDITSYSCALL
+       if (!dont_count)
+               audit_n_rules++;
+#endif
        mutex_unlock(&audit_filter_mutex);
 
        if (putnd_needed)
@@ -1198,6 +1212,14 @@ static inline int audit_del_rule(struct audit_entry *entry,
        struct audit_watch *watch, *tmp_watch = entry->rule.watch;
        LIST_HEAD(inotify_list);
        int h, ret = 0;
+#ifdef CONFIG_AUDITSYSCALL
+       int dont_count = 0;
+
+       /* If either of these, don't count towards total */
+       if (entry->rule.listnr == AUDIT_FILTER_USER ||
+               entry->rule.listnr == AUDIT_FILTER_TYPE)
+               dont_count = 1;
+#endif
 
        if (inode_f) {
                h = audit_hash_ino(inode_f->val);
@@ -1235,6 +1257,10 @@ static inline int audit_del_rule(struct audit_entry *entry,
        list_del_rcu(&e->list);
        call_rcu(&e->rcu, audit_free_rule_rcu);
 
+#ifdef CONFIG_AUDITSYSCALL
+       if (!dont_count)
+               audit_n_rules--;
+#endif
        mutex_unlock(&audit_filter_mutex);
 
        if (!list_empty(&inotify_list))
index ae40ac8..efc1b74 100644 (file)
@@ -85,6 +85,9 @@ extern int audit_enabled;
 /* Indicates that audit should log the full pathname. */
 #define AUDIT_NAME_FULL -1
 
+/* number of audit rules */
+int audit_n_rules;
+
 /* When fs/namei.c:getname() is called, we store the pointer in name and
  * we don't let putname() free it (instead we free all of the saved
  * pointers at syscall exit time).
@@ -174,6 +177,7 @@ struct audit_aux_data_path {
 
 /* The per-task audit context. */
 struct audit_context {
+       int                 dummy;      /* must be the first element */
        int                 in_syscall; /* 1 if task is in a syscall */
        enum audit_state    state;
        unsigned int        serial;     /* serial number for record */
@@ -514,7 +518,7 @@ static inline struct audit_context *audit_get_context(struct task_struct *tsk,
        context->return_valid = return_valid;
        context->return_code  = return_code;
 
-       if (context->in_syscall && !context->auditable) {
+       if (context->in_syscall && !context->dummy && !context->auditable) {
                enum audit_state state;
 
                state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_EXIT]);
@@ -530,17 +534,7 @@ static inline struct audit_context *audit_get_context(struct task_struct *tsk,
        }
 
 get_context:
-       context->pid = tsk->pid;
-       context->ppid = sys_getppid();  /* sic.  tsk == current in all cases */
-       context->uid = tsk->uid;
-       context->gid = tsk->gid;
-       context->euid = tsk->euid;
-       context->suid = tsk->suid;
-       context->fsuid = tsk->fsuid;
-       context->egid = tsk->egid;
-       context->sgid = tsk->sgid;
-       context->fsgid = tsk->fsgid;
-       context->personality = tsk->personality;
+
        tsk->audit_context = NULL;
        return context;
 }
@@ -749,6 +743,17 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
        const char *tty;
 
        /* tsk == current */
+       context->pid = tsk->pid;
+       context->ppid = sys_getppid();  /* sic.  tsk == current in all cases */
+       context->uid = tsk->uid;
+       context->gid = tsk->gid;
+       context->euid = tsk->euid;
+       context->suid = tsk->suid;
+       context->fsuid = tsk->fsuid;
+       context->egid = tsk->egid;
+       context->sgid = tsk->sgid;
+       context->fsgid = tsk->fsgid;
+       context->personality = tsk->personality;
 
        ab = audit_log_start(context, GFP_KERNEL, AUDIT_SYSCALL);
        if (!ab)
@@ -1066,7 +1071,8 @@ void audit_syscall_entry(int arch, int major,
        context->argv[3]    = a4;
 
        state = context->state;
-       if (state == AUDIT_SETUP_CONTEXT || state == AUDIT_BUILD_CONTEXT)
+       context->dummy = !audit_n_rules;
+       if (!context->dummy && (state == AUDIT_SETUP_CONTEXT || state == AUDIT_BUILD_CONTEXT))
                state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_ENTRY]);
        if (likely(state == AUDIT_DISABLED))
                return;
@@ -1199,14 +1205,18 @@ void audit_putname(const char *name)
 #endif
 }
 
-static void audit_inode_context(int idx, const struct inode *inode)
+/* Copy inode data into an audit_names. */
+static void audit_copy_inode(struct audit_names *name, const struct inode *inode)
 {
-       struct audit_context *context = current->audit_context;
-
-       selinux_get_inode_sid(inode, &context->names[idx].osid);
+       name->ino   = inode->i_ino;
+       name->dev   = inode->i_sb->s_dev;
+       name->mode  = inode->i_mode;
+       name->uid   = inode->i_uid;
+       name->gid   = inode->i_gid;
+       name->rdev  = inode->i_rdev;
+       selinux_get_inode_sid(inode, &name->osid);
 }
 
-
 /**
  * audit_inode - store the inode and device from a lookup
  * @name: name being audited
@@ -1240,20 +1250,14 @@ void __audit_inode(const char *name, const struct inode *inode)
                ++context->ino_count;
 #endif
        }
-       context->names[idx].ino   = inode->i_ino;
-       context->names[idx].dev   = inode->i_sb->s_dev;
-       context->names[idx].mode  = inode->i_mode;
-       context->names[idx].uid   = inode->i_uid;
-       context->names[idx].gid   = inode->i_gid;
-       context->names[idx].rdev  = inode->i_rdev;
-       audit_inode_context(idx, inode);
+       audit_copy_inode(&context->names[idx], inode);
 }
 
 /**
  * audit_inode_child - collect inode info for created/removed objects
  * @dname: inode's dentry name
  * @inode: inode being audited
- * @pino: inode number of dentry parent
+ * @parent: inode of dentry parent
  *
  * For syscalls that create or remove filesystem objects, audit_inode
  * can only collect information for the filesystem object's parent.
@@ -1264,7 +1268,7 @@ void __audit_inode(const char *name, const struct inode *inode)
  * unsuccessful attempts.
  */
 void __audit_inode_child(const char *dname, const struct inode *inode,
-                        unsigned long pino)
+                        const struct inode *parent)
 {
        int idx;
        struct audit_context *context = current->audit_context;
@@ -1278,7 +1282,7 @@ void __audit_inode_child(const char *dname, const struct inode *inode,
        if (!dname)
                goto update_context;
        for (idx = 0; idx < context->name_count; idx++)
-               if (context->names[idx].ino == pino) {
+               if (context->names[idx].ino == parent->i_ino) {
                        const char *name = context->names[idx].name;
 
                        if (!name)
@@ -1302,16 +1306,47 @@ update_context:
        context->names[idx].name_len = AUDIT_NAME_FULL;
        context->names[idx].name_put = 0;       /* don't call __putname() */
 
-       if (inode) {
-               context->names[idx].ino   = inode->i_ino;
-               context->names[idx].dev   = inode->i_sb->s_dev;
-               context->names[idx].mode  = inode->i_mode;
-               context->names[idx].uid   = inode->i_uid;
-               context->names[idx].gid   = inode->i_gid;
-               context->names[idx].rdev  = inode->i_rdev;
-               audit_inode_context(idx, inode);
-       } else
-               context->names[idx].ino   = (unsigned long)-1;
+       if (!inode)
+               context->names[idx].ino = (unsigned long)-1;
+       else
+               audit_copy_inode(&context->names[idx], inode);
+
+       /* A parent was not found in audit_names, so copy the inode data for the
+        * provided parent. */
+       if (!found_name) {
+               idx = context->name_count++;
+#if AUDIT_DEBUG
+               context->ino_count++;
+#endif
+               audit_copy_inode(&context->names[idx], parent);
+       }
+}
+
+/**
+ * audit_inode_update - update inode info for last collected name
+ * @inode: inode being audited
+ *
+ * When open() is called on an existing object with the O_CREAT flag, the inode
+ * data audit initially collects is incorrect.  This additional hook ensures
+ * audit has the inode data for the actual object to be opened.
+ */
+void __audit_inode_update(const struct inode *inode)
+{
+       struct audit_context *context = current->audit_context;
+       int idx;
+
+       if (!context->in_syscall || !inode)
+               return;
+
+       if (context->name_count == 0) {
+               context->name_count++;
+#if AUDIT_DEBUG
+               context->ino_count++;
+#endif
+       }
+       idx = context->name_count - 1;
+
+       audit_copy_inode(&context->names[idx], inode);
 }
 
 /**
@@ -1642,7 +1677,7 @@ int audit_bprm(struct linux_binprm *bprm)
        unsigned long p, next;
        void *to;
 
-       if (likely(!audit_enabled || !context))
+       if (likely(!audit_enabled || !context || context->dummy))
                return 0;
 
        ax = kmalloc(sizeof(*ax) + PAGE_SIZE * MAX_ARG_PAGES - bprm->p,
@@ -1680,7 +1715,7 @@ int audit_socketcall(int nargs, unsigned long *args)
        struct audit_aux_data_socketcall *ax;
        struct audit_context *context = current->audit_context;
 
-       if (likely(!context))
+       if (likely(!context || context->dummy))
                return 0;
 
        ax = kmalloc(sizeof(*ax) + nargs * sizeof(unsigned long), GFP_KERNEL);
@@ -1708,7 +1743,7 @@ int audit_sockaddr(int len, void *a)
        struct audit_aux_data_sockaddr *ax;
        struct audit_context *context = current->audit_context;
 
-       if (likely(!context))
+       if (likely(!context || context->dummy))
                return 0;
 
        ax = kmalloc(sizeof(*ax) + len, GFP_KERNEL);
index 2b1530f..7f20e7b 100644 (file)
@@ -50,10 +50,6 @@ static char *action_to_string(enum kobject_action action)
                return "offline";
        case KOBJ_ONLINE:
                return "online";
-       case KOBJ_DOCK:
-               return "dock";
-       case KOBJ_UNDOCK:
-               return "undock";
        default:
                return NULL;
        }
index 4ba271f..d6409e7 100644 (file)
@@ -921,26 +921,43 @@ call_transmit(struct rpc_task *task)
        task->tk_status = xprt_prepare_transmit(task);
        if (task->tk_status != 0)
                return;
+       task->tk_action = call_transmit_status;
        /* Encode here so that rpcsec_gss can use correct sequence number. */
        if (rpc_task_need_encode(task)) {
-               task->tk_rqstp->rq_bytes_sent = 0;
+               BUG_ON(task->tk_rqstp->rq_bytes_sent != 0);
                call_encode(task);
                /* Did the encode result in an error condition? */
                if (task->tk_status != 0)
-                       goto out_nosend;
+                       return;
        }
-       task->tk_action = call_transmit_status;
        xprt_transmit(task);
        if (task->tk_status < 0)
                return;
-       if (!task->tk_msg.rpc_proc->p_decode) {
-               task->tk_action = rpc_exit_task;
-               rpc_wake_up_task(task);
-       }
-       return;
-out_nosend:
-       /* release socket write lock before attempting to handle error */
-       xprt_abort_transmit(task);
+       /*
+        * On success, ensure that we call xprt_end_transmit() before sleeping
+        * in order to allow access to the socket to other RPC requests.
+        */
+       call_transmit_status(task);
+       if (task->tk_msg.rpc_proc->p_decode != NULL)
+               return;
+       task->tk_action = rpc_exit_task;
+       rpc_wake_up_task(task);
+}
+
+/*
+ * 5a. Handle cleanup after a transmission
+ */
+static void
+call_transmit_status(struct rpc_task *task)
+{
+       task->tk_action = call_status;
+       /*
+        * Special case: if we've been waiting on the socket's write_space()
+        * callback, then don't call xprt_end_transmit().
+        */
+       if (task->tk_status == -EAGAIN)
+               return;
+       xprt_end_transmit(task);
        rpc_task_force_reencode(task);
 }
 
@@ -992,18 +1009,7 @@ call_status(struct rpc_task *task)
 }
 
 /*
- * 6a. Handle transmission errors.
- */
-static void
-call_transmit_status(struct rpc_task *task)
-{
-       if (task->tk_status != -EAGAIN)
-               rpc_task_force_reencode(task);
-       call_status(task);
-}
-
-/*
- * 6b. Handle RPC timeout
+ * 6a. Handle RPC timeout
  *     We do not release the request slot, so we keep using the
  *     same XID for all retransmits.
  */
index dc6cb93..a3bd2db 100644 (file)
@@ -667,10 +667,11 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client)
                        RPCAUTH_info, RPCAUTH_EOF);
        if (error)
                goto err_depopulate;
+       dget(dentry);
 out:
        mutex_unlock(&dir->i_mutex);
        rpc_release_path(&nd);
-       return dget(dentry);
+       return dentry;
 err_depopulate:
        rpc_depopulate(dentry);
        __rpc_rmdir(dir, dentry);
@@ -731,10 +732,11 @@ rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags)
        rpci->flags = flags;
        rpci->ops = ops;
        inode_dir_notify(dir, DN_CREATE);
+       dget(dentry);
 out:
        mutex_unlock(&dir->i_mutex);
        rpc_release_path(&nd);
-       return dget(dentry);
+       return dentry;
 err_dput:
        dput(dentry);
        dentry = ERR_PTR(-ENOMEM);
index 313b68d..e8c2bc4 100644 (file)
@@ -707,12 +707,9 @@ out_unlock:
        return err;
 }
 
-void
-xprt_abort_transmit(struct rpc_task *task)
+void xprt_end_transmit(struct rpc_task *task)
 {
-       struct rpc_xprt *xprt = task->tk_xprt;
-
-       xprt_release_write(xprt, task);
+       xprt_release_write(task->tk_xprt, task);
 }
 
 /**
@@ -761,8 +758,6 @@ void xprt_transmit(struct rpc_task *task)
                        task->tk_status = -ENOTCONN;
                else if (!req->rq_received)
                        rpc_sleep_on(&xprt->pending, task, NULL, xprt_timer);
-
-               xprt->ops->release_xprt(xprt, task);
                spin_unlock_bh(&xprt->transport_lock);
                return;
        }
@@ -772,18 +767,8 @@ void xprt_transmit(struct rpc_task *task)
         *       schedq, and being picked up by a parallel run of rpciod().
         */
        task->tk_status = status;
-
-       switch (status) {
-       case -ECONNREFUSED:
+       if (status == -ECONNREFUSED)
                rpc_sleep_on(&xprt->sending, task, NULL, NULL);
-       case -EAGAIN:
-       case -ENOTCONN:
-               return;
-       default:
-               break;
-       }
-       xprt_release_write(xprt, task);
-       return;
 }
 
 static inline void do_xprt_reserve(struct rpc_task *task)
index ee678ed..441bd53 100644 (file)
@@ -413,6 +413,33 @@ static int xs_tcp_send_request(struct rpc_task *task)
        return status;
 }
 
+/**
+ * xs_tcp_release_xprt - clean up after a tcp transmission
+ * @xprt: transport
+ * @task: rpc task
+ *
+ * This cleans up if an error causes us to abort the transmission of a request.
+ * In this case, the socket may need to be reset in order to avoid confusing
+ * the server.
+ */
+static void xs_tcp_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task)
+{
+       struct rpc_rqst *req;
+
+       if (task != xprt->snd_task)
+               return;
+       if (task == NULL)
+               goto out_release;
+       req = task->tk_rqstp;
+       if (req->rq_bytes_sent == 0)
+               goto out_release;
+       if (req->rq_bytes_sent == req->rq_snd_buf.len)
+               goto out_release;
+       set_bit(XPRT_CLOSE_WAIT, &task->tk_xprt->state);
+out_release:
+       xprt_release_xprt(xprt, task);
+}
+
 /**
  * xs_close - close a socket
  * @xprt: transport
@@ -1250,7 +1277,7 @@ static struct rpc_xprt_ops xs_udp_ops = {
 
 static struct rpc_xprt_ops xs_tcp_ops = {
        .reserve_xprt           = xprt_reserve_xprt,
-       .release_xprt           = xprt_release_xprt,
+       .release_xprt           = xs_tcp_release_xprt,
        .set_port               = xs_set_port,
        .connect                = xs_connect,
        .buf_alloc              = rpc_malloc,