Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 3 Jan 2008 20:02:00 +0000 (12:02 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 3 Jan 2008 20:02:00 +0000 (12:02 -0800)
* 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6:
  hwmon: (w83627ehf) Be more careful when changing VID input level

147 files changed:
Documentation/nfsroot.txt
MAINTAINERS
arch/powerpc/platforms/cell/Kconfig
arch/powerpc/platforms/cell/Makefile
arch/powerpc/platforms/cell/spu_notify.c [new file with mode: 0644]
arch/powerpc/platforms/cell/spu_syscalls.c
arch/powerpc/platforms/cell/spufs/context.c
arch/powerpc/platforms/cell/spufs/sched.c
arch/powerpc/platforms/cell/spufs/syscalls.c
arch/powerpc/platforms/ps3/os-area.c
arch/sparc/kernel/ptrace.c
arch/sparc64/kernel/pci.c
arch/sparc64/kernel/pci_schizo.c
arch/um/drivers/harddog_user.c
arch/x86/kernel/head_32.S
arch/x86/kernel/smpboot_64.c
drivers/atm/firestream.c
drivers/char/tty_ioctl.c
drivers/crypto/padlock-aes.c
drivers/ide/ide-cd.c
drivers/ide/ide-cd.h
drivers/ide/pci/cmd64x.c
drivers/ide/pci/cs5535.c
drivers/leds/led-class.c
drivers/leds/led-core.c
drivers/leds/led-triggers.c
drivers/leds/leds-locomo.c
drivers/leds/leds.h
drivers/media/video/cx23885/Kconfig
drivers/media/video/ivtv/ivtv-i2c.c
drivers/net/dl2k.c
drivers/net/dl2k.h
drivers/net/fec_mpc52xx.c
drivers/net/macb.c
drivers/net/pcmcia/3c574_cs.c
drivers/net/pcmcia/3c589_cs.c
drivers/net/r8169.c
drivers/net/rrunner.c
drivers/net/rrunner.h
drivers/net/tg3.c
drivers/net/tokenring/3c359.c
drivers/net/tokenring/3c359.h
drivers/net/tun.c
drivers/net/typhoon.c
drivers/net/typhoon.h
drivers/net/usb/asix.c
drivers/net/veth.c
drivers/net/wan/cycx_x25.c
drivers/net/wireless/Kconfig
drivers/net/wireless/ipw2200.c
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/iwlwifi/iwl4965-base.c
drivers/net/wireless/rtl8187_dev.c
drivers/net/yellowfin.c
drivers/pci/probe.c
drivers/pcmcia/pxa2xx_lubbock.c
drivers/ps3/ps3-vuart.c
drivers/scsi/scsi.c
drivers/scsi/scsi_error.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_priv.h
drivers/scsi/scsi_sysfs.c
drivers/scsi/sd.c
drivers/scsi/sr.c
drivers/serial/suncore.c
drivers/usb/gadget/fsl_usb2_udc.c
drivers/usb/serial/cp2101.c
drivers/usb/serial/sierra.c
fs/dquot.c
fs/ecryptfs/crypto.c
fs/ecryptfs/main.c
fs/ecryptfs/messaging.c
fs/nfs/nfs4proc.c
fs/nfs/nfs4renewd.c
fs/nfs/super.c
fs/proc/base.c
fs/proc/internal.h
fs/proc/proc_misc.c
fs/proc/task_mmu.c
fs/proc/task_nommu.c
include/asm-generic/tlb.h
include/asm-powerpc/spu.h
include/asm-sparc64/dma-mapping.h
include/asm-sparc64/pci.h
include/asm-x86/byteorder.h
include/asm-x86/msr.h
include/linux/Kbuild
include/linux/ptrace.h
include/linux/quicklist.h
include/linux/slab.h
include/linux/slab_def.h
include/linux/tc_act/Kbuild
include/linux/veth.h [new file with mode: 0644]
include/net/ax25.h
include/net/ip6_tunnel.h
include/net/irda/discovery.h
include/net/netfilter/nf_conntrack.h
include/net/sctp/structs.h
include/net/veth.h [deleted file]
include/scsi/scsi_cmnd.h
include/scsi/scsi_driver.h
include/scsi/sd.h
init/Kconfig
kernel/params.c
kernel/printk.c
kernel/ptrace.c
kernel/sched_debug.c
lib/proportions.c
mm/slab.c
mm/slub.c
net/ax25/ax25_in.c
net/bluetooth/hci_conn.c
net/bluetooth/hci_sysfs.c
net/compat.c
net/core/dev.c
net/core/scm.c
net/dccp/ackvec.h
net/dccp/ccids/ccid3.c
net/ipv4/arp.c
net/ipv4/fib_frontend.c
net/ipv4/ip_gre.c
net/ipv4/ipconfig.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
net/ipv4/netfilter/nf_nat_sip.c
net/ipv4/tcp_input.c
net/ipv6/ndisc.c
net/irda/ircomm/ircomm_param.c
net/irda/irlan/irlan_eth.c
net/irda/irlap_frame.c
net/irda/parameters.c
net/irda/wrapper.c
net/key/af_key.c
net/mac80211/ieee80211.c
net/mac80211/ieee80211_rate.c
net/mac80211/ieee80211_sta.c
net/mac80211/rx.c
net/mac80211/sta_info.c
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_conntrack_sip.c
net/netlabel/netlabel_mgmt.c
net/netrom/nr_dev.c
net/sched/sch_hfsc.c
net/sctp/sm_make_chunk.c
net/sunrpc/auth_gss/auth_gss.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c
scripts/kconfig/conf.c

index 9b956a9..c86dd38 100644 (file)
@@ -97,10 +97,6 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
   autoconfiguration will take place.  The most common way to use this
   is "ip=dhcp".
 
-  Note that "ip=off" is not the same thing as "ip=::::::off", because in
-  the latter autoconfiguration will take place if any of DHCP, BOOTP or RARP
-  are compiled in the kernel.
-
   <client-ip>  IP address of the client.
 
                Default:  Determined using autoconfiguration.
@@ -150,6 +146,7 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
 
                   off or none: don't use autoconfiguration
                  on or any:   use any protocol available in the kernel
+                              (default)
                  dhcp:        use DHCP
                  bootp:       use BOOTP
                  rarp:        use RARP
index 3c7db62..79c711e 100644 (file)
@@ -1870,8 +1870,10 @@ T:       quilt kernel.org/pub/linux/kernel/people/bart/pata-2.6/
 S:     Maintained
 
 IDE/ATAPI CDROM DRIVER
+P:     Borislav Petkov
+M:     bbpetkov@yahoo.de
 L:     linux-ide@vger.kernel.org
-S:     Unmaintained
+S:     Maintained
 
 IDE/ATAPI FLOPPY DRIVERS
 P:     Paul Bristow
@@ -2029,7 +2031,7 @@ P:        James Ketrenos
 M:     jketreno@linux.intel.com
 L:     linux-wireless@vger.kernel.org
 L:     ipw2100-devel@lists.sourceforge.net
-L:     http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel
+W:     http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel
 W:     http://ipw2100.sourceforge.net
 S:     Supported
 
@@ -2040,7 +2042,7 @@ P:        James Ketrenos
 M:     jketreno@linux.intel.com
 L:     linux-wireless@vger.kernel.org
 L:     ipw2100-devel@lists.sourceforge.net
-L:     http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel
+W:     http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel
 W:     http://ipw2200.sourceforge.net
 S:     Supported
 
@@ -2597,7 +2599,7 @@ S:        Maintained
 MSI LAPTOP SUPPORT
 P:     Lennart Poettering
 M:     mzxreary@0pointer.de
-L:     https://tango.0pointer.de/mailman/listinfo/s270-linux
+W:     https://tango.0pointer.de/mailman/listinfo/s270-linux
 W:     http://0pointer.de/lennart/tchibo.html
 S:     Maintained
 
@@ -4054,6 +4056,14 @@ L:       user-mode-linux-user@lists.sourceforge.net
 W:     http://user-mode-linux.sourceforge.net
 S:     Maintained
 
+USERSPACE I/O (UIO)
+P:     Hans J. Koch
+M:     hjk@linutronix.de
+P:     Greg Kroah-Hartman
+M:     gregkh@suse.de
+L:     linux-kernel@vger.kernel.org
+S:     Maintained
+
 FAT/VFAT/MSDOS FILESYSTEM:
 P:     OGAWA Hirofumi
 M:     hirofumi@mail.parknet.co.jp
index e1e2f6a..3a963b4 100644 (file)
@@ -88,3 +88,8 @@ config CBE_CPUFREQ_PMI
          but also at lower core voltage.
 
 endmenu
+
+config OPROFILE_CELL
+       def_bool y
+       depends on PPC_CELL_NATIVE && (OPROFILE = m || OPROFILE = y)
+
index 61d12f1..39d695c 100644 (file)
@@ -19,6 +19,7 @@ spu-manage-$(CONFIG_PPC_CELLEB)               += spu_manage.o
 spu-manage-$(CONFIG_PPC_CELL_NATIVE)   += spu_manage.o
 
 obj-$(CONFIG_SPU_BASE)                 += spu_callbacks.o spu_base.o \
+                                          spu_notify.o \
                                           spu_syscalls.o \
                                           $(spu-priv1-y) \
                                           $(spu-manage-y) \
diff --git a/arch/powerpc/platforms/cell/spu_notify.c b/arch/powerpc/platforms/cell/spu_notify.c
new file mode 100644 (file)
index 0000000..34d1569
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Move OProfile dependencies from spufs module to the kernel so it
+ * can run on non-cell PPC.
+ *
+ * Copyright (C) IBM 2005
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#undef DEBUG
+
+#include <linux/module.h>
+#include <asm/spu.h>
+#include "spufs/spufs.h"
+
+static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier);
+
+void spu_switch_notify(struct spu *spu, struct spu_context *ctx)
+{
+       blocking_notifier_call_chain(&spu_switch_notifier,
+                                    ctx ? ctx->object_id : 0, spu);
+}
+EXPORT_SYMBOL_GPL(spu_switch_notify);
+
+int spu_switch_event_register(struct notifier_block *n)
+{
+       int ret;
+       ret = blocking_notifier_chain_register(&spu_switch_notifier, n);
+       if (!ret)
+               notify_spus_active();
+       return ret;
+}
+EXPORT_SYMBOL_GPL(spu_switch_event_register);
+
+int spu_switch_event_unregister(struct notifier_block *n)
+{
+       return blocking_notifier_chain_unregister(&spu_switch_notifier, n);
+}
+EXPORT_SYMBOL_GPL(spu_switch_event_unregister);
+
+void spu_set_profile_private_kref(struct spu_context *ctx,
+                                 struct kref *prof_info_kref,
+                                 void (* prof_info_release) (struct kref *kref))
+{
+       ctx->prof_priv_kref = prof_info_kref;
+       ctx->prof_priv_release = prof_info_release;
+}
+EXPORT_SYMBOL_GPL(spu_set_profile_private_kref);
+
+void *spu_get_profile_private_kref(struct spu_context *ctx)
+{
+       return ctx->prof_priv_kref;
+}
+EXPORT_SYMBOL_GPL(spu_get_profile_private_kref);
+
index a9438b7..75530d9 100644 (file)
@@ -145,6 +145,20 @@ int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset)
        return ret;
 }
 
+void notify_spus_active(void)
+{
+       struct spufs_calls *calls;
+
+       calls = spufs_calls_get();
+       if (!calls)
+               return;
+
+       calls->notify_spus_active();
+       spufs_calls_put(calls);
+
+       return;
+}
+
 int register_spu_syscalls(struct spufs_calls *calls)
 {
        if (spufs_calls)
index 9cb081c..adf0a03 100644 (file)
@@ -190,19 +190,3 @@ void spu_release_saved(struct spu_context *ctx)
        spu_release(ctx);
 }
 
-void spu_set_profile_private_kref(struct spu_context *ctx,
-                                 struct kref *prof_info_kref,
-                                 void ( * prof_info_release) (struct kref *kref))
-{
-       ctx->prof_priv_kref = prof_info_kref;
-       ctx->prof_priv_release = prof_info_release;
-}
-EXPORT_SYMBOL_GPL(spu_set_profile_private_kref);
-
-void *spu_get_profile_private_kref(struct spu_context *ctx)
-{
-       return ctx->prof_priv_kref;
-}
-EXPORT_SYMBOL_GPL(spu_get_profile_private_kref);
-
-
index 4d257b3..9ad53e6 100644 (file)
@@ -166,15 +166,7 @@ static int node_allowed(struct spu_context *ctx, int node)
        return rval;
 }
 
-static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier);
-
-void spu_switch_notify(struct spu *spu, struct spu_context *ctx)
-{
-       blocking_notifier_call_chain(&spu_switch_notifier,
-                           ctx ? ctx->object_id : 0, spu);
-}
-
-static void notify_spus_active(void)
+void do_notify_spus_active(void)
 {
        int node;
 
@@ -201,22 +193,6 @@ static void notify_spus_active(void)
        }
 }
 
-int spu_switch_event_register(struct notifier_block * n)
-{
-       int ret;
-       ret = blocking_notifier_chain_register(&spu_switch_notifier, n);
-       if (!ret)
-               notify_spus_active();
-       return ret;
-}
-EXPORT_SYMBOL_GPL(spu_switch_event_register);
-
-int spu_switch_event_unregister(struct notifier_block * n)
-{
-       return blocking_notifier_chain_unregister(&spu_switch_notifier, n);
-}
-EXPORT_SYMBOL_GPL(spu_switch_event_unregister);
-
 /**
  * spu_bind_context - bind spu context to physical spu
  * @spu:       physical spu to bind to
index 2c34f71..4304044 100644 (file)
@@ -86,5 +86,6 @@ struct spufs_calls spufs_calls = {
        .spu_run = do_spu_run,
        .coredump_extra_notes_size = spufs_coredump_extra_notes_size,
        .coredump_extra_notes_write = spufs_coredump_extra_notes_write,
+       .notify_spus_active = do_notify_spus_active,
        .owner = THIS_MODULE,
 };
index 766685a..b9ea09d 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/workqueue.h>
 #include <linux/fs.h>
 #include <linux/syscalls.h>
+#include <linux/ctype.h>
 
 #include <asm/lmb.h>
 
@@ -37,6 +38,8 @@ enum os_area_ldr_format {
        HEADER_LDR_FORMAT_GZIP = 1,
 };
 
+#define OS_AREA_HEADER_MAGIC_NUM "cell_ext_os_area"
+
 /**
  * struct os_area_header - os area header segment.
  * @magic_num: Always 'cell_ext_os_area'.
@@ -114,13 +117,11 @@ struct os_area_params {
        u8 _reserved_5[8];
 };
 
-enum {
-       OS_AREA_DB_MAGIC_NUM = 0x2d64622dU,
-};
+#define OS_AREA_DB_MAGIC_NUM "-db-"
 
 /**
  * struct os_area_db - Shared flash memory database.
- * @magic_num: Always '-db-' = 0x2d64622d.
+ * @magic_num: Always '-db-'.
  * @version: os_area_db format version number.
  * @index_64: byte offset of the database id index for 64 bit variables.
  * @count_64: number of usable 64 bit index entries
@@ -135,7 +136,7 @@ enum {
  */
 
 struct os_area_db {
-       u32 magic_num;
+       u8 magic_num[4];
        u16 version;
        u16 _reserved_1;
        u16 index_64;
@@ -265,12 +266,26 @@ static void __init os_area_get_property(struct device_node *node,
                        prop->name);
 }
 
+static void dump_field(char *s, const u8 *field, int size_of_field)
+{
+#if defined(DEBUG)
+       int i;
+
+       for (i = 0; i < size_of_field; i++)
+               s[i] = isprint(field[i]) ? field[i] : '.';
+       s[i] = 0;
+#endif
+}
+
 #define dump_header(_a) _dump_header(_a, __func__, __LINE__)
 static void _dump_header(const struct os_area_header *h, const char *func,
        int line)
 {
+       char str[sizeof(h->magic_num) + 1];
+
+       dump_field(str, h->magic_num, sizeof(h->magic_num));
        pr_debug("%s:%d: h.magic_num:       '%s'\n", func, line,
-               h->magic_num);
+               str);
        pr_debug("%s:%d: h.hdr_version:     %u\n", func, line,
                h->hdr_version);
        pr_debug("%s:%d: h.db_area_offset:  %u\n", func, line,
@@ -311,7 +326,8 @@ static void _dump_params(const struct os_area_params *p, const char *func,
 
 static int verify_header(const struct os_area_header *header)
 {
-       if (memcmp(header->magic_num, "cell_ext_os_area", 16)) {
+       if (memcmp(header->magic_num, OS_AREA_HEADER_MAGIC_NUM,
+               sizeof(header->magic_num))) {
                pr_debug("%s:%d magic_num failed\n", __func__, __LINE__);
                return -1;
        }
@@ -331,7 +347,8 @@ static int verify_header(const struct os_area_header *header)
 
 static int db_verify(const struct os_area_db *db)
 {
-       if (db->magic_num != OS_AREA_DB_MAGIC_NUM) {
+       if (memcmp(db->magic_num, OS_AREA_DB_MAGIC_NUM,
+               sizeof(db->magic_num))) {
                pr_debug("%s:%d magic_num failed\n", __func__, __LINE__);
                return -1;
        }
@@ -484,8 +501,11 @@ static int db_get_rtc_diff(const struct os_area_db *db, int64_t *rtc_diff)
 static void _dump_db(const struct os_area_db *db, const char *func,
        int line)
 {
+       char str[sizeof(db->magic_num) + 1];
+
+       dump_field(str, db->magic_num, sizeof(db->magic_num));
        pr_debug("%s:%d: db.magic_num:      '%s'\n", func, line,
-               (const char*)&db->magic_num);
+               str);
        pr_debug("%s:%d: db.version:         %u\n", func, line,
                db->version);
        pr_debug("%s:%d: db.index_64:        %u\n", func, line,
@@ -516,7 +536,7 @@ static void os_area_db_init(struct os_area_db *db)
 
        memset(db, 0, sizeof(struct os_area_db));
 
-       db->magic_num = OS_AREA_DB_MAGIC_NUM;
+       memcpy(db->magic_num, OS_AREA_DB_MAGIC_NUM, sizeof(db->magic_num));
        db->version = 1;
        db->index_64 = HEADER_SIZE;
        db->count_64 = VALUES_64_COUNT;
index fe562db..7452269 100644 (file)
@@ -5,7 +5,7 @@
  * Based upon code written by Ross Biro, Linus Torvalds, Bob Manson,
  * and David Mosberger.
  *
- * Added Linux support -miguel (weird, eh?, the orignal code was meant
+ * Added Linux support -miguel (weird, eh?, the original code was meant
  * to emulate SunOS).
  */
 
index 63b3ebc..a61c38f 100644 (file)
@@ -1275,4 +1275,20 @@ int pci_dma_supported(struct pci_dev *pdev, u64 device_mask)
        return (device_mask & dma_addr_mask) == dma_addr_mask;
 }
 
+void pci_resource_to_user(const struct pci_dev *pdev, int bar,
+                         const struct resource *rp, resource_size_t *start,
+                         resource_size_t *end)
+{
+       struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller;
+       unsigned long offset;
+
+       if (rp->flags & IORESOURCE_IO)
+               offset = pbm->io_space.start;
+       else
+               offset = pbm->mem_space.start;
+
+       *start = rp->start - offset;
+       *end = rp->end - offset;
+}
+
 #endif /* !(CONFIG_PCI) */
index 9546ba9..e752e75 100644 (file)
@@ -850,7 +850,7 @@ static int pbm_routes_this_ino(struct pci_pbm_info *pbm, u32 ino)
 /* How the Tomatillo IRQs are routed around is pure guesswork here.
  *
  * All the Tomatillo devices I see in prtconf dumps seem to have only
- * a single PCI bus unit attached to it.  It would seem they are seperate
+ * a single PCI bus unit attached to it.  It would seem they are separate
  * devices because their PortID (ie. JBUS ID) values are all different
  * and thus the registers are mapped to totally different locations.
  *
index b56f8e0..448ba59 100644 (file)
@@ -79,14 +79,14 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
        n = read(in_fds[0], &c, sizeof(c));
        if (n == 0) {
                printk("harddog_open - EOF on watchdog pipe\n");
-               helper_wait(pid);
+               helper_wait(pid, 1, NULL);
                err = -EIO;
                goto out_close_out;
        }
        else if (n < 0) {
                printk("harddog_open - read of watchdog pipe failed, "
                       "err = %d\n", errno);
-               helper_wait(pid);
+               helper_wait(pid, 1, NULL);
                err = n;
                goto out_close_out;
        }
index ac0637a..fbad51f 100644 (file)
@@ -196,7 +196,7 @@ default_entry:
        /* Do an early initialization of the fixmap area */
        movl $(swapper_pg_dir - __PAGE_OFFSET), %edx
        movl $(swapper_pg_pmd - __PAGE_OFFSET), %eax
-       addl $0x007, %eax                       /* 0x007 = PRESENT+RW+USER */
+       addl $0x67, %eax                        /* 0x67 == _PAGE_TABLE */
        movl %eax, 4092(%edx)
 
        xorl %ebx,%ebx                          /* This is the boot CPU (BSP) */
index 5948895..500670c 100644 (file)
@@ -141,8 +141,8 @@ static void __cpuinit smp_store_cpu_info(int id)
        struct cpuinfo_x86 *c = &cpu_data(id);
 
        *c = boot_cpu_data;
-       identify_cpu(c);
        c->cpu_index = id;
+       identify_cpu(c);
        print_cpu_info(c);
 }
 
index f8f7139..c662d68 100644 (file)
@@ -171,8 +171,8 @@ static char *res_strings[] = {
        "packet purged", 
        "packet ageing timeout", 
        "channel ageing timeout", 
-       "calculated lenght error", 
-       "programmed lenght limit error", 
+       "calculated length error", 
+       "programmed length limit error", 
        "aal5 crc32 error", 
        "oam transp or transpc crc10 error", 
        "reserved 25", 
index 1bdd2bf..e02d592 100644 (file)
@@ -62,7 +62,7 @@ void tty_wait_until_sent(struct tty_struct * tty, long timeout)
        if (!timeout)
                timeout = MAX_SCHEDULE_TIMEOUT;
        if (wait_event_interruptible_timeout(tty->write_wait,
-                       !tty->driver->chars_in_buffer(tty), timeout))
+                       !tty->driver->chars_in_buffer(tty), timeout) < 0)
                return;
        if (tty->driver->wait_until_sent)
                tty->driver->wait_until_sent(tty, timeout);
index abbcff0..a337b69 100644 (file)
@@ -419,13 +419,58 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
 /* ====== Encryption/decryption routines ====== */
 
 /* These are the real call to PadLock. */
+static inline void padlock_xcrypt(const u8 *input, u8 *output, void *key,
+                                 void *control_word)
+{
+       asm volatile (".byte 0xf3,0x0f,0xa7,0xc8"       /* rep xcryptecb */
+                     : "+S"(input), "+D"(output)
+                     : "d"(control_word), "b"(key), "c"(1));
+}
+
+static void aes_crypt_copy(const u8 *in, u8 *out, u32 *key, struct cword *cword)
+{
+       u8 tmp[AES_BLOCK_SIZE * 2]
+               __attribute__ ((__aligned__(PADLOCK_ALIGNMENT)));
+
+       memcpy(tmp, in, AES_BLOCK_SIZE);
+       padlock_xcrypt(tmp, out, key, cword);
+}
+
+static inline void aes_crypt(const u8 *in, u8 *out, u32 *key,
+                            struct cword *cword)
+{
+       asm volatile ("pushfl; popfl");
+
+       /* padlock_xcrypt requires at least two blocks of data. */
+       if (unlikely(!(((unsigned long)in ^ (PAGE_SIZE - AES_BLOCK_SIZE)) &
+                      (PAGE_SIZE - 1)))) {
+               aes_crypt_copy(in, out, key, cword);
+               return;
+       }
+
+       padlock_xcrypt(in, out, key, cword);
+}
+
 static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key,
                                      void *control_word, u32 count)
 {
+       if (count == 1) {
+               aes_crypt(input, output, key, control_word);
+               return;
+       }
+
        asm volatile ("pushfl; popfl");         /* enforce key reload. */
-       asm volatile (".byte 0xf3,0x0f,0xa7,0xc8"       /* rep xcryptecb */
+       asm volatile ("test $1, %%cl;"
+                     "je 1f;"
+                     "lea -1(%%ecx), %%eax;"
+                     "mov $1, %%ecx;"
+                     ".byte 0xf3,0x0f,0xa7,0xc8;"      /* rep xcryptecb */
+                     "mov %%eax, %%ecx;"
+                     "1:"
+                     ".byte 0xf3,0x0f,0xa7,0xc8"       /* rep xcryptecb */
                      : "+S"(input), "+D"(output)
-                     : "d"(control_word), "b"(key), "c"(count));
+                     : "d"(control_word), "b"(key), "c"(count)
+                     : "ax");
 }
 
 static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
@@ -443,13 +488,13 @@ static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
 static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
 {
        struct aes_ctx *ctx = aes_ctx(tfm);
-       padlock_xcrypt_ecb(in, out, ctx->E, &ctx->cword.encrypt, 1);
+       aes_crypt(in, out, ctx->E, &ctx->cword.encrypt);
 }
 
 static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
 {
        struct aes_ctx *ctx = aes_ctx(tfm);
-       padlock_xcrypt_ecb(in, out, ctx->D, &ctx->cword.decrypt, 1);
+       aes_crypt(in, out, ctx->D, &ctx->cword.decrypt);
 }
 
 static struct crypto_alg aes_alg = {
index 92ac658..c7d77f0 100644 (file)
@@ -1068,8 +1068,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
                return 0;
        else if (ireason == 0) {
                /* Whoops... The drive is expecting to receive data from us! */
-               printk(KERN_ERR "%s: read_intr: Drive wants to transfer data the "
-                                               "wrong way!\n", drive->name);
+               printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
+                               drive->name, __FUNCTION__);
 
                /* Throw some data at the drive so it doesn't hang
                   and quit this request. */
@@ -1086,8 +1086,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
                return 0;
        } else {
                /* Drive wants a command packet, or invalid ireason... */
-               printk(KERN_ERR "%s: read_intr: bad interrupt reason %x\n", drive->name,
-                                                               ireason);
+               printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n",
+                               drive->name, __FUNCTION__, ireason);
        }
 
        cdrom_end_request(drive, 0);
@@ -1112,8 +1112,11 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
         */
        if (dma) {
                info->dma = 0;
-               if ((dma_error = HWIF(drive)->ide_dma_end(drive)))
+               dma_error = HWIF(drive)->ide_dma_end(drive);
+               if (dma_error) {
+                       printk(KERN_ERR "%s: DMA read error\n", drive->name);
                        ide_dma_off(drive);
+               }
        }
 
        if (cdrom_decode_status(drive, 0, &stat))
@@ -1443,7 +1446,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
                return ide_stopped;
 
        /* Read the interrupt reason and the transfer length. */
-       ireason = HWIF(drive)->INB(IDE_IREASON_REG);
+       ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3;
        lowcyl  = HWIF(drive)->INB(IDE_BCOUNTL_REG);
        highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG);
 
@@ -1484,7 +1487,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
        if (thislen > len) thislen = len;
 
        /* The drive wants to be written to. */
-       if ((ireason & 3) == 0) {
+       if (ireason == 0) {
                if (!rq->data) {
                        blk_dump_rq_flags(rq, "cdrom_pc_intr, write");
                        goto confused;
@@ -1506,9 +1509,9 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
        }
 
        /* Same drill for reading. */
-       else if ((ireason & 3) == 2) {
+       else if (ireason == 2) {
                if (!rq->data) {
-                       blk_dump_rq_flags(rq, "cdrom_pc_intr, write");
+                       blk_dump_rq_flags(rq, "cdrom_pc_intr, read");
                        goto confused;
                }
                /* Transfer the data. */
@@ -1632,8 +1635,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
                return 0;
        else if (ireason == 2) {
                /* Whoops... The drive wants to send data. */
-               printk(KERN_ERR "%s: write_intr: wrong transfer direction!\n",
-                                                       drive->name);
+               printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
+                               drive->name, __FUNCTION__);
 
                while (len > 0) {
                        int dum = 0;
@@ -1642,8 +1645,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
                }
        } else {
                /* Drive wants a command packet, or invalid ireason... */
-               printk(KERN_ERR "%s: write_intr: bad interrupt reason %x\n",
-                                                       drive->name, ireason);
+               printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n",
+                               drive->name, __FUNCTION__, ireason);
        }
 
        cdrom_end_request(drive, 0);
@@ -1805,8 +1808,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
        /* Check for errors. */
        if (dma) {
                info->dma = 0;
-               if ((dma_error = HWIF(drive)->ide_dma_end(drive))) {
-                       printk(KERN_ERR "ide-cd: write dma error\n");
+               dma_error = HWIF(drive)->ide_dma_end(drive);
+               if (dma_error) {
+                       printk(KERN_ERR "%s: DMA write error\n", drive->name);
                        ide_dma_off(drive);
                }
        }
@@ -1826,7 +1830,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
        }
 
        /* Read the interrupt reason and the transfer length. */
-       ireason = HWIF(drive)->INB(IDE_IREASON_REG);
+       ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3;
        lowcyl  = HWIF(drive)->INB(IDE_BCOUNTL_REG);
        highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG);
 
@@ -1839,8 +1843,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
                 */
                uptodate = 1;
                if (rq->current_nr_sectors > 0) {
-                       printk(KERN_ERR "%s: write_intr: data underrun (%d blocks)\n",
-                       drive->name, rq->current_nr_sectors);
+                       printk(KERN_ERR "%s: %s: data underrun (%d blocks)\n",
+                                       drive->name, __FUNCTION__,
+                                       rq->current_nr_sectors);
                        uptodate = 0;
                }
                cdrom_end_request(drive, uptodate);
@@ -1860,7 +1865,8 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
                int this_transfer;
 
                if (!rq->current_nr_sectors) {
-                       printk(KERN_ERR "ide-cd: write_intr: oops\n");
+                       printk(KERN_ERR "%s: %s: confused, missing data\n",
+                                       drive->name, __FUNCTION__);
                        break;
                }
 
@@ -2688,14 +2694,14 @@ void ide_cdrom_update_speed (ide_drive_t *drive, struct atapi_capabilities_page
        if (!drive->id->model[0] &&
            !strncmp(drive->id->fw_rev, "241N", 4)) {
                CDROM_STATE_FLAGS(drive)->current_speed  =
-                       (((unsigned int)cap->curspeed) + (176/2)) / 176;
+                       (le16_to_cpu(cap->curspeed) + (176/2)) / 176;
                CDROM_CONFIG_FLAGS(drive)->max_speed =
-                       (((unsigned int)cap->maxspeed) + (176/2)) / 176;
+                       (le16_to_cpu(cap->maxspeed) + (176/2)) / 176;
        } else {
                CDROM_STATE_FLAGS(drive)->current_speed  =
-                       (ntohs(cap->curspeed) + (176/2)) / 176;
+                       (be16_to_cpu(cap->curspeed) + (176/2)) / 176;
                CDROM_CONFIG_FLAGS(drive)->max_speed =
-                       (ntohs(cap->maxspeed) + (176/2)) / 176;
+                       (be16_to_cpu(cap->maxspeed) + (176/2)) / 176;
        }
 }
 
@@ -2909,6 +2915,9 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots)
        if (!CDROM_CONFIG_FLAGS(drive)->ram)
                devinfo->mask |= CDC_RAM;
 
+       if (CDROM_CONFIG_FLAGS(drive)->no_speed_select)
+               devinfo->mask |= CDC_SELECT_SPEED;
+
        devinfo->disk = info->disk;
        return register_cdrom(devinfo);
 }
@@ -3161,7 +3170,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
                CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1;
        /* the 3231 model does not support the SET_CD_SPEED command */
        else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231"))
-               cdi->mask |= CDC_SELECT_SPEED;
+               CDROM_CONFIG_FLAGS(drive)->no_speed_select = 1;
 
 #if ! STANDARD_ATAPI
        /* by default Sanyo 3 CD changer support is turned off and
@@ -3504,15 +3513,8 @@ static int ide_cd_probe(ide_drive_t *drive)
        g->driverfs_dev = &drive->gendev;
        g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE;
        if (ide_cdrom_setup(drive)) {
-               struct cdrom_device_info *devinfo = &info->devinfo;
                ide_proc_unregister_driver(drive, &ide_cdrom_driver);
-               kfree(info->buffer);
-               kfree(info->toc);
-               kfree(info->changer_info);
-               if (devinfo->handle == drive && unregister_cdrom(devinfo))
-                       printk (KERN_ERR "%s: ide_cdrom_cleanup failed to unregister device from the cdrom driver.\n", drive->name);
-               kfree(info);
-               drive->driver_data = NULL;
+               ide_cd_release(&info->kref);
                goto failed;
        }
 
index 228b29c..1b302fe 100644 (file)
@@ -91,7 +91,8 @@ struct ide_cd_config_flags {
        __u8 close_tray         : 1; /* can close the tray */
        __u8 writing            : 1; /* pseudo write in progress */
        __u8 mo_drive           : 1; /* drive is an MO device */
-       __u8 reserved           : 2;
+       __u8 no_speed_select    : 1; /* SET_CD_SPEED command is unsupported. */
+       __u8 reserved           : 1;
        byte max_speed;              /* Max speed of the drive */
 };
 #define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags))
index 51fca44..bc55333 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/pci/cmd64x.c              Version 1.51    Nov 8, 2007
+ * linux/drivers/ide/pci/cmd64x.c              Version 1.52    Dec 24, 2007
  *
  * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines.
  *           Due to massive hardware bugs, UltraDMA is only supported
@@ -564,6 +564,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
                .init_chipset   = init_chipset_cmd64x,
                .init_hwif      = init_hwif_cmd64x,
                .enablebits     = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
+               .chipset        = ide_cmd646,
                .host_flags     = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO5,
                .mwdma_mask     = ATA_MWDMA2,
@@ -573,7 +574,6 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
                .init_chipset   = init_chipset_cmd64x,
                .init_hwif      = init_hwif_cmd64x,
                .enablebits     = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
-               .chipset        = ide_cmd646,
                .host_flags     = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO5,
                .mwdma_mask     = ATA_MWDMA2,
index 9094916..ddcbeba 100644 (file)
@@ -49,7 +49,7 @@
 #define ATAC_BM0_PRD           0x04
 #define CS5535_CABLE_DETECT    0x48
 
-/* Format I PIO settings. We seperate out cmd and data for safer timings */
+/* Format I PIO settings. We separate out cmd and data for safer timings */
 
 static unsigned int cs5535_pio_cmd_timings[5] =
 { 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 };
index ba8b04b..64c66b3 100644 (file)
@@ -106,9 +106,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
                goto err_out;
 
        /* add to the list of leds */
-       write_lock(&leds_list_lock);
+       down_write(&leds_list_lock);
        list_add_tail(&led_cdev->node, &leds_list);
-       write_unlock(&leds_list_lock);
+       up_write(&leds_list_lock);
 
 #ifdef CONFIG_LEDS_TRIGGERS
        init_rwsem(&led_cdev->trigger_lock);
@@ -155,9 +155,9 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
 
        device_unregister(led_cdev->dev);
 
-       write_lock(&leds_list_lock);
+       down_write(&leds_list_lock);
        list_del(&led_cdev->node);
-       write_unlock(&leds_list_lock);
+       up_write(&leds_list_lock);
 }
 EXPORT_SYMBOL_GPL(led_classdev_unregister);
 
index 9b015f9..5d1ca10 100644 (file)
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/module.h>
-#include <linux/spinlock.h>
+#include <linux/rwsem.h>
 #include <linux/leds.h>
 #include "leds.h"
 
-DEFINE_RWLOCK(leds_list_lock);
+DECLARE_RWSEM(leds_list_lock);
 LIST_HEAD(leds_list);
 
 EXPORT_SYMBOL_GPL(leds_list);
index 0bdb786..13c9026 100644 (file)
@@ -169,7 +169,7 @@ int led_trigger_register(struct led_trigger *trigger)
        up_write(&triggers_list_lock);
 
        /* Register with any LEDs that have this as a default trigger */
-       read_lock(&leds_list_lock);
+       down_read(&leds_list_lock);
        list_for_each_entry(led_cdev, &leds_list, node) {
                down_write(&led_cdev->trigger_lock);
                if (!led_cdev->trigger && led_cdev->default_trigger &&
@@ -177,7 +177,7 @@ int led_trigger_register(struct led_trigger *trigger)
                        led_trigger_set(led_cdev, trigger);
                up_write(&led_cdev->trigger_lock);
        }
-       read_unlock(&leds_list_lock);
+       up_read(&leds_list_lock);
 
        return 0;
 }
@@ -212,14 +212,14 @@ void led_trigger_unregister(struct led_trigger *trigger)
        up_write(&triggers_list_lock);
 
        /* Remove anyone actively using this trigger */
-       read_lock(&leds_list_lock);
+       down_read(&leds_list_lock);
        list_for_each_entry(led_cdev, &leds_list, node) {
                down_write(&led_cdev->trigger_lock);
                if (led_cdev->trigger == trigger)
                        led_trigger_set(led_cdev, NULL);
                up_write(&led_cdev->trigger_lock);
        }
-       read_unlock(&leds_list_lock);
+       up_read(&leds_list_lock);
 }
 
 void led_trigger_unregister_simple(struct led_trigger *trigger)
index bfac499..2207335 100644 (file)
@@ -19,7 +19,7 @@
 static void locomoled_brightness_set(struct led_classdev *led_cdev,
                                enum led_brightness value, int offset)
 {
-       struct locomo_dev *locomo_dev = LOCOMO_DEV(led_cdev->dev);
+       struct locomo_dev *locomo_dev = LOCOMO_DEV(led_cdev->dev->parent);
        unsigned long flags;
 
        local_irq_save(flags);
index f2f3884..12b6fe9 100644 (file)
@@ -14,6 +14,7 @@
 #define __LEDS_H_INCLUDED
 
 #include <linux/device.h>
+#include <linux/rwsem.h>
 #include <linux/leds.h>
 
 static inline void led_set_brightness(struct led_classdev *led_cdev,
@@ -26,7 +27,7 @@ static inline void led_set_brightness(struct led_classdev *led_cdev,
                led_cdev->brightness_set(led_cdev, value);
 }
 
-extern rwlock_t leds_list_lock;
+extern struct rw_semaphore leds_list_lock;
 extern struct list_head leds_list;
 
 #ifdef CONFIG_LEDS_TRIGGERS
index d8b1ccb..081ee6e 100644 (file)
@@ -10,6 +10,7 @@ config VIDEO_CX23885
        select VIDEOBUF_DVB
        select DVB_TUNER_MT2131 if !DVB_FE_CUSTOMISE
        select DVB_S5H1409 if !DVB_FE_CUSTOMISE
+       select DVB_LGDT330X if !DVB_FE_CUSTOMISE
        select DVB_PLL if !DVB_FE_CUSTOMISE
        ---help---
          This is a video4linux driver for Conexant 23885 based
index 77b27dc..44678fe 100644 (file)
@@ -718,6 +718,9 @@ int init_ivtv_i2c(struct ivtv *itv)
                       sizeof(struct i2c_adapter));
                memcpy(&itv->i2c_algo, &ivtv_i2c_algo_template,
                       sizeof(struct i2c_algo_bit_data));
+               /* The mspx4xx chips need a longer delay for some reason */
+               if (itv->hw_flags & IVTV_HW_MSP34XX)
+                       itv->i2c_algo.udelay = 10;
                itv->i2c_algo.data = itv;
                itv->i2c_adap.algo_data = &itv->i2c_algo;
        }
index 5066beb..47cce9c 100644 (file)
@@ -332,7 +332,7 @@ parse_eeprom (struct net_device *dev)
 #endif
        /* Read eeprom */
        for (i = 0; i < 128; i++) {
-               ((u16 *) sromdata)[i] = le16_to_cpu (read_eeprom (ioaddr, i));
+               ((__le16 *) sromdata)[i] = cpu_to_le16(read_eeprom (ioaddr, i));
        }
 #ifdef MEM_MAPPING
        ioaddr = dev->base_addr;
@@ -516,7 +516,7 @@ rio_timer (unsigned long data)
                                          PCI_DMA_FROMDEVICE));
                        }
                        np->rx_ring[entry].fraginfo |=
-                           cpu_to_le64 (np->rx_buf_sz) << 48;
+                           cpu_to_le64((u64)np->rx_buf_sz << 48);
                        np->rx_ring[entry].status = 0;
                } /* end for */
        } /* end if */
@@ -584,11 +584,11 @@ alloc_list (struct net_device *dev)
                    cpu_to_le64 ( pci_map_single (
                                  np->pdev, skb->data, np->rx_buf_sz,
                                  PCI_DMA_FROMDEVICE));
-               np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48;
+               np->rx_ring[i].fraginfo |= cpu_to_le64((u64)np->rx_buf_sz << 48);
        }
 
        /* Set RFDListPtr */
-       writel (cpu_to_le32 (np->rx_ring_dma), dev->base_addr + RFDListPtr0);
+       writel (np->rx_ring_dma, dev->base_addr + RFDListPtr0);
        writel (0, dev->base_addr + RFDListPtr1);
 
        return;
@@ -620,15 +620,14 @@ start_xmit (struct sk_buff *skb, struct net_device *dev)
        }
 #endif
        if (np->vlan) {
-               tfc_vlan_tag =
-                   cpu_to_le64 (VLANTagInsert) |
-                   (cpu_to_le64 (np->vlan) << 32) |
-                   (cpu_to_le64 (skb->priority) << 45);
+               tfc_vlan_tag = VLANTagInsert |
+                   ((u64)np->vlan << 32) |
+                   ((u64)skb->priority << 45);
        }
        txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data,
                                                        skb->len,
                                                        PCI_DMA_TODEVICE));
-       txdesc->fraginfo |= cpu_to_le64 (skb->len) << 48;
+       txdesc->fraginfo |= cpu_to_le64((u64)skb->len << 48);
 
        /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode
         * Work around: Always use 1 descriptor in 10Mbps mode */
@@ -708,6 +707,11 @@ rio_interrupt (int irq, void *dev_instance)
        return IRQ_RETVAL(handled);
 }
 
+static inline dma_addr_t desc_to_dma(struct netdev_desc *desc)
+{
+       return le64_to_cpu(desc->fraginfo) & DMA_48BIT_MASK;
+}
+
 static void
 rio_free_tx (struct net_device *dev, int irq)
 {
@@ -725,11 +729,11 @@ rio_free_tx (struct net_device *dev, int irq)
        while (entry != np->cur_tx) {
                struct sk_buff *skb;
 
-               if (!(np->tx_ring[entry].status & TFDDone))
+               if (!(np->tx_ring[entry].status & cpu_to_le64(TFDDone)))
                        break;
                skb = np->tx_skbuff[entry];
                pci_unmap_single (np->pdev,
-                                 np->tx_ring[entry].fraginfo & DMA_48BIT_MASK,
+                                 desc_to_dma(&np->tx_ring[entry]),
                                  skb->len, PCI_DMA_TODEVICE);
                if (irq)
                        dev_kfree_skb_irq (skb);
@@ -831,13 +835,14 @@ receive_packet (struct net_device *dev)
                int pkt_len;
                u64 frame_status;
 
-               if (!(desc->status & RFDDone) ||
-                   !(desc->status & FrameStart) || !(desc->status & FrameEnd))
+               if (!(desc->status & cpu_to_le64(RFDDone)) ||
+                   !(desc->status & cpu_to_le64(FrameStart)) ||
+                   !(desc->status & cpu_to_le64(FrameEnd)))
                        break;
 
                /* Chip omits the CRC. */
-               pkt_len = le64_to_cpu (desc->status & 0xffff);
-               frame_status = le64_to_cpu (desc->status);
+               frame_status = le64_to_cpu(desc->status);
+               pkt_len = frame_status & 0xffff;
                if (--cnt < 0)
                        break;
                /* Update rx error statistics, drop packet. */
@@ -857,15 +862,14 @@ receive_packet (struct net_device *dev)
                        /* Small skbuffs for short packets */
                        if (pkt_len > copy_thresh) {
                                pci_unmap_single (np->pdev,
-                                                 desc->fraginfo & DMA_48BIT_MASK,
+                                                 desc_to_dma(desc),
                                                  np->rx_buf_sz,
                                                  PCI_DMA_FROMDEVICE);
                                skb_put (skb = np->rx_skbuff[entry], pkt_len);
                                np->rx_skbuff[entry] = NULL;
                        } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) {
                                pci_dma_sync_single_for_cpu(np->pdev,
-                                                           desc->fraginfo &
-                                                               DMA_48BIT_MASK,
+                                                           desc_to_dma(desc),
                                                            np->rx_buf_sz,
                                                            PCI_DMA_FROMDEVICE);
                                /* 16 byte align the IP header */
@@ -875,8 +879,7 @@ receive_packet (struct net_device *dev)
                                                  pkt_len);
                                skb_put (skb, pkt_len);
                                pci_dma_sync_single_for_device(np->pdev,
-                                                              desc->fraginfo &
-                                                                DMA_48BIT_MASK,
+                                                              desc_to_dma(desc),
                                                               np->rx_buf_sz,
                                                               PCI_DMA_FROMDEVICE);
                        }
@@ -919,7 +922,7 @@ receive_packet (struct net_device *dev)
                                          PCI_DMA_FROMDEVICE));
                }
                np->rx_ring[entry].fraginfo |=
-                   cpu_to_le64 (np->rx_buf_sz) << 48;
+                   cpu_to_le64((u64)np->rx_buf_sz << 48);
                np->rx_ring[entry].status = 0;
                entry = (entry + 1) % RX_RING_SIZE;
        }
@@ -1121,7 +1124,7 @@ set_multicast (struct net_device *dev)
 
        hash_table[0] = hash_table[1] = 0;
        /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */
-       hash_table[1] |= cpu_to_le32(0x02000000);
+       hash_table[1] |= 0x02000000;
        if (dev->flags & IFF_PROMISC) {
                /* Receive all frames promiscuously. */
                rx_mode = ReceiveAllFrames;
@@ -1762,7 +1765,7 @@ rio_close (struct net_device *dev)
                skb = np->rx_skbuff[i];
                if (skb) {
                        pci_unmap_single(np->pdev,
-                                        np->rx_ring[i].fraginfo & DMA_48BIT_MASK,
+                                        desc_to_dma(&np->rx_ring[i]),
                                         skb->len, PCI_DMA_FROMDEVICE);
                        dev_kfree_skb (skb);
                        np->rx_skbuff[i] = NULL;
@@ -1772,7 +1775,7 @@ rio_close (struct net_device *dev)
                skb = np->tx_skbuff[i];
                if (skb) {
                        pci_unmap_single(np->pdev,
-                                        np->tx_ring[i].fraginfo & DMA_48BIT_MASK,
+                                        desc_to_dma(&np->tx_ring[i]),
                                         skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb (skb);
                        np->tx_skbuff[i] = NULL;
index 5b80177..014b77c 100644 (file)
@@ -633,9 +633,9 @@ struct mii_data {
 
 /* The Rx and Tx buffer descriptors. */
 struct netdev_desc {
-       u64 next_desc;
-       u64 status;
-       u64 fraginfo;
+       __le64 next_desc;
+       __le64 status;
+       __le64 fraginfo;
 };
 
 #define PRIV_ALIGN     15      /* Required alignment mask */
index 79f7ead..f91ee70 100644 (file)
@@ -568,8 +568,9 @@ static void mpc52xx_fec_reset_stats(struct net_device *dev)
        struct mpc52xx_fec __iomem *fec = priv->fec;
 
        out_be32(&fec->mib_control, FEC_MIB_DISABLE);
-       memset_io(&fec->rmon_t_drop, 0, (__force u32)&fec->reserved10 -
-                       (__force u32)&fec->rmon_t_drop);
+       memset_io(&fec->rmon_t_drop, 0,
+                  offsetof(struct mpc52xx_fec, reserved10) -
+                  offsetof(struct mpc52xx_fec, rmon_t_drop));
        out_be32(&fec->mib_control, 0);
 
        memset(&dev->stats, 0, sizeof(dev->stats));
index 047ea7b..e10528e 100644 (file)
@@ -307,8 +307,31 @@ static void macb_tx(struct macb *bp)
                (unsigned long)status);
 
        if (status & MACB_BIT(UND)) {
+               int i;
                printk(KERN_ERR "%s: TX underrun, resetting buffers\n",
-                      bp->dev->name);
+                       bp->dev->name);
+
+               head = bp->tx_head;
+
+               /*Mark all the buffer as used to avoid sending a lost buffer*/
+               for (i = 0; i < TX_RING_SIZE; i++)
+                       bp->tx_ring[i].ctrl = MACB_BIT(TX_USED);
+
+               /* free transmit buffer in upper layer*/
+               for (tail = bp->tx_tail; tail != head; tail = NEXT_TX(tail)) {
+                       struct ring_info *rp = &bp->tx_skb[tail];
+                       struct sk_buff *skb = rp->skb;
+
+                       BUG_ON(skb == NULL);
+
+                       rmb();
+
+                       dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len,
+                                                        DMA_TO_DEVICE);
+                       rp->skb = NULL;
+                       dev_kfree_skb_irq(skb);
+               }
+
                bp->tx_head = bp->tx_tail = 0;
        }
 
index ad134a6..2881777 100644 (file)
@@ -337,15 +337,15 @@ static int tc574_config(struct pcmcia_device *link)
        struct net_device *dev = link->priv;
        struct el3_private *lp = netdev_priv(dev);
        tuple_t tuple;
-       unsigned short buf[32];
+       __le16 buf[32];
        int last_fn, last_ret, i, j;
        kio_addr_t ioaddr;
-       u16 *phys_addr;
+       __be16 *phys_addr;
        char *cardname;
        union wn3_config config;
        DECLARE_MAC_BUF(mac);
 
-       phys_addr = (u16 *)dev->dev_addr;
+       phys_addr = (__be16 *)dev->dev_addr;
 
        DEBUG(0, "3c574_config(0x%p)\n", link);
 
@@ -378,12 +378,12 @@ static int tc574_config(struct pcmcia_device *link)
        if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
                pcmcia_get_tuple_data(link, &tuple);
                for (i = 0; i < 3; i++)
-                       phys_addr[i] = htons(buf[i]);
+                       phys_addr[i] = htons(le16_to_cpu(buf[i]));
        } else {
                EL3WINDOW(0);
                for (i = 0; i < 3; i++)
                        phys_addr[i] = htons(read_eeprom(ioaddr, i + 10));
-               if (phys_addr[0] == 0x6060) {
+               if (phys_addr[0] == htons(0x6060)) {
                        printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx"
                                   "-0x%03lx\n", dev->base_addr, dev->base_addr+15);
                        goto failed;
index a98fe07..e862d14 100644 (file)
@@ -251,7 +251,8 @@ static int tc589_config(struct pcmcia_device *link)
     struct net_device *dev = link->priv;
     struct el3_private *lp = netdev_priv(dev);
     tuple_t tuple;
-    u16 buf[32], *phys_addr;
+    __le16 buf[32];
+    __be16 *phys_addr;
     int last_fn, last_ret, i, j, multi = 0, fifo;
     kio_addr_t ioaddr;
     char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
@@ -259,7 +260,7 @@ static int tc589_config(struct pcmcia_device *link)
     
     DEBUG(0, "3c589_config(0x%p)\n", link);
 
-    phys_addr = (u16 *)dev->dev_addr;
+    phys_addr = (__be16 *)dev->dev_addr;
     tuple.Attributes = 0;
     tuple.TupleData = (cisdata_t *)buf;
     tuple.TupleDataMax = sizeof(buf);
@@ -298,11 +299,11 @@ static int tc589_config(struct pcmcia_device *link)
     if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
        pcmcia_get_tuple_data(link, &tuple);
        for (i = 0; i < 3; i++)
-           phys_addr[i] = htons(buf[i]);
+           phys_addr[i] = htons(le16_to_cpu(buf[i]));
     } else {
        for (i = 0; i < 3; i++)
            phys_addr[i] = htons(read_eeprom(ioaddr, i));
-       if (phys_addr[0] == 0x6060) {
+       if (phys_addr[0] == htons(0x6060)) {
            printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx"
                   "-0x%03lx\n", dev->base_addr, dev->base_addr+15);
            goto failed;
index 1f647b9..5863190 100644 (file)
@@ -2211,7 +2211,7 @@ out:
 
 static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
 {
-       desc->addr = 0x0badbadbadbadbadull;
+       desc->addr = cpu_to_le64(0x0badbadbadbadbadull);
        desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask);
 }
 
@@ -2835,7 +2835,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
                }
 
                /* Work around for AMD plateform. */
-               if ((desc->opts2 & 0xfffe000) &&
+               if ((desc->opts2 & cpu_to_le32(0xfffe000)) &&
                    (tp->mac_version == RTL_GIGA_MAC_VER_05)) {
                        desc->opts2 = 0;
                        cur_rx++;
index 73a7e65..55a590a 100644 (file)
@@ -294,7 +294,6 @@ static int rr_reset(struct net_device *dev)
 {
        struct rr_private *rrpriv;
        struct rr_regs __iomem *regs;
-       struct eeprom *hw = NULL;
        u32 start_pc;
        int i;
 
@@ -381,7 +380,8 @@ static int rr_reset(struct net_device *dev)
        writel(RBURST_64|WBURST_64, &regs->PciState);
        wmb();
 
-       start_pc = rr_read_eeprom_word(rrpriv, &hw->rncd_info.FwStart);
+       start_pc = rr_read_eeprom_word(rrpriv,
+                       offsetof(struct eeprom, rncd_info.FwStart));
 
 #if (DEBUG > 1)
        printk("%s: Executing firmware at address 0x%06x\n",
@@ -438,12 +438,12 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
  * it to our CPU byte-order.
  */
 static u32 rr_read_eeprom_word(struct rr_private *rrpriv,
-                           void * offset)
+                           size_t offset)
 {
-       u32 word;
+       __be32 word;
 
-       if ((rr_read_eeprom(rrpriv, (unsigned long)offset,
-                           (char *)&word, 4) == 4))
+       if ((rr_read_eeprom(rrpriv, offset,
+                           (unsigned char *)&word, 4) == 4))
                return be32_to_cpu(word);
        return 0;
 }
@@ -510,7 +510,6 @@ static int __devinit rr_init(struct net_device *dev)
 {
        struct rr_private *rrpriv;
        struct rr_regs __iomem *regs;
-       struct eeprom *hw = NULL;
        u32 sram_size, rev;
        DECLARE_MAC_BUF(mac);
 
@@ -545,14 +544,14 @@ static int __devinit rr_init(struct net_device *dev)
         * other method I've seen.  -VAL
         */
 
-       *(u16 *)(dev->dev_addr) =
-         htons(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA));
-       *(u32 *)(dev->dev_addr+2) =
-         htonl(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA[4]));
+       *(__be16 *)(dev->dev_addr) =
+         htons(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA)));
+       *(__be32 *)(dev->dev_addr+2) =
+         htonl(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA[4])));
 
        printk("  MAC: %s\n", print_mac(mac, dev->dev_addr));
 
-       sram_size = rr_read_eeprom_word(rrpriv, (void *)8);
+       sram_size = rr_read_eeprom_word(rrpriv, 8);
        printk("  SRAM size 0x%06x\n", sram_size);
 
        return 0;
@@ -1477,11 +1476,10 @@ static int rr_load_firmware(struct net_device *dev)
 {
        struct rr_private *rrpriv;
        struct rr_regs __iomem *regs;
-       unsigned long eptr, segptr;
+       size_t eptr, segptr;
        int i, j;
        u32 localctrl, sptr, len, tmp;
        u32 p2len, p2size, nr_seg, revision, io, sram_size;
-       struct eeprom *hw = NULL;
 
        rrpriv = netdev_priv(dev);
        regs = rrpriv->regs;
@@ -1509,7 +1507,7 @@ static int rr_load_firmware(struct net_device *dev)
         */
        io = readl(&regs->ExtIo);
        writel(0, &regs->ExtIo);
-       sram_size = rr_read_eeprom_word(rrpriv, (void *)8);
+       sram_size = rr_read_eeprom_word(rrpriv, 8);
 
        for (i = 200; i < sram_size / 4; i++){
                writel(i * 4, &regs->WinBase);
@@ -1520,13 +1518,13 @@ static int rr_load_firmware(struct net_device *dev)
        writel(io, &regs->ExtIo);
        mb();
 
-       eptr = (unsigned long)rr_read_eeprom_word(rrpriv,
-                                              &hw->rncd_info.AddrRunCodeSegs);
+       eptr = rr_read_eeprom_word(rrpriv,
+                      offsetof(struct eeprom, rncd_info.AddrRunCodeSegs));
        eptr = ((eptr & 0x1fffff) >> 3);
 
-       p2len = rr_read_eeprom_word(rrpriv, (void *)(0x83*4));
+       p2len = rr_read_eeprom_word(rrpriv, 0x83*4);
        p2len = (p2len << 2);
-       p2size = rr_read_eeprom_word(rrpriv, (void *)(0x84*4));
+       p2size = rr_read_eeprom_word(rrpriv, 0x84*4);
        p2size = ((p2size & 0x1fffff) >> 3);
 
        if ((eptr < p2size) || (eptr > (p2size + p2len))){
@@ -1534,7 +1532,8 @@ static int rr_load_firmware(struct net_device *dev)
                goto out;
        }
 
-       revision = rr_read_eeprom_word(rrpriv, &hw->manf.HeaderFmt);
+       revision = rr_read_eeprom_word(rrpriv,
+                       offsetof(struct eeprom, manf.HeaderFmt));
 
        if (revision != 1){
                printk("%s: invalid firmware format (%i)\n",
@@ -1542,18 +1541,18 @@ static int rr_load_firmware(struct net_device *dev)
                goto out;
        }
 
-       nr_seg = rr_read_eeprom_word(rrpriv, (void *)eptr);
+       nr_seg = rr_read_eeprom_word(rrpriv, eptr);
        eptr +=4;
 #if (DEBUG > 1)
        printk("%s: nr_seg %i\n", dev->name, nr_seg);
 #endif
 
        for (i = 0; i < nr_seg; i++){
-               sptr = rr_read_eeprom_word(rrpriv, (void *)eptr);
+               sptr = rr_read_eeprom_word(rrpriv, eptr);
                eptr += 4;
-               len = rr_read_eeprom_word(rrpriv, (void *)eptr);
+               len = rr_read_eeprom_word(rrpriv, eptr);
                eptr += 4;
-               segptr = (unsigned long)rr_read_eeprom_word(rrpriv, (void *)eptr);
+               segptr = rr_read_eeprom_word(rrpriv, eptr);
                segptr = ((segptr & 0x1fffff) >> 3);
                eptr += 4;
 #if (DEBUG > 1)
@@ -1561,7 +1560,7 @@ static int rr_load_firmware(struct net_device *dev)
                       dev->name, i, sptr, len, segptr);
 #endif
                for (j = 0; j < len; j++){
-                       tmp = rr_read_eeprom_word(rrpriv, (void *)segptr);
+                       tmp = rr_read_eeprom_word(rrpriv, segptr);
                        writel(sptr, &regs->WinBase);
                        mb();
                        writel(tmp, &regs->WinData);
index 6a79825..6173f11 100644 (file)
@@ -838,7 +838,7 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
                                   unsigned long offset,
                                   unsigned char *buf,
                                   unsigned long length);
-static u32 rr_read_eeprom_word(struct rr_private *rrpriv, void * offset);
+static u32 rr_read_eeprom_word(struct rr_private *rrpriv, size_t offset);
 static int rr_load_firmware(struct net_device *dev);
 static inline void rr_raz_tx(struct rr_private *, struct net_device *);
 static inline void rr_raz_rx(struct rr_private *, struct net_device *);
index 4942f7d..22eb7c8 100644 (file)
@@ -8189,6 +8189,7 @@ static int tg3_get_eeprom_len(struct net_device *dev)
 }
 
 static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val);
+static int tg3_nvram_read_le(struct tg3 *tp, u32 offset, __le32 *val);
 static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val);
 
 static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data)
@@ -8196,7 +8197,8 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
        struct tg3 *tp = netdev_priv(dev);
        int ret;
        u8  *pd;
-       u32 i, offset, len, val, b_offset, b_count;
+       u32 i, offset, len, b_offset, b_count;
+       __le32 val;
 
        if (tp->link_config.phy_is_low_power)
                return -EAGAIN;
@@ -8215,10 +8217,9 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
                        /* i.e. offset=1 len=2 */
                        b_count = len;
                }
-               ret = tg3_nvram_read(tp, offset-b_offset, &val);
+               ret = tg3_nvram_read_le(tp, offset-b_offset, &val);
                if (ret)
                        return ret;
-               val = cpu_to_le32(val);
                memcpy(data, ((char*)&val) + b_offset, b_count);
                len -= b_count;
                offset += b_count;
@@ -8228,12 +8229,11 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
        /* read bytes upto the last 4 byte boundary */
        pd = &data[eeprom->len];
        for (i = 0; i < (len - (len & 3)); i += 4) {
-               ret = tg3_nvram_read(tp, offset + i, &val);
+               ret = tg3_nvram_read_le(tp, offset + i, &val);
                if (ret) {
                        eeprom->len += i;
                        return ret;
                }
-               val = cpu_to_le32(val);
                memcpy(pd + i, &val, 4);
        }
        eeprom->len += i;
@@ -8243,11 +8243,10 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
                pd = &data[eeprom->len];
                b_count = len & 3;
                b_offset = offset + len - b_count;
-               ret = tg3_nvram_read(tp, b_offset, &val);
+               ret = tg3_nvram_read_le(tp, b_offset, &val);
                if (ret)
                        return ret;
-               val = cpu_to_le32(val);
-               memcpy(pd, ((char*)&val), b_count);
+               memcpy(pd, &val, b_count);
                eeprom->len += b_count;
        }
        return 0;
@@ -8259,8 +8258,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
 {
        struct tg3 *tp = netdev_priv(dev);
        int ret;
-       u32 offset, len, b_offset, odd_len, start, end;
+       u32 offset, len, b_offset, odd_len;
        u8 *buf;
+       __le32 start, end;
 
        if (tp->link_config.phy_is_low_power)
                return -EAGAIN;
@@ -8273,10 +8273,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
 
        if ((b_offset = (offset & 3))) {
                /* adjustments to start on required 4 byte boundary */
-               ret = tg3_nvram_read(tp, offset-b_offset, &start);
+               ret = tg3_nvram_read_le(tp, offset-b_offset, &start);
                if (ret)
                        return ret;
-               start = cpu_to_le32(start);
                len += b_offset;
                offset &= ~3;
                if (len < 4)
@@ -8288,10 +8287,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
                /* adjustments to end on required 4 byte boundary */
                odd_len = 1;
                len = (len + 3) & ~3;
-               ret = tg3_nvram_read(tp, offset+len-4, &end);
+               ret = tg3_nvram_read_le(tp, offset+len-4, &end);
                if (ret)
                        return ret;
-               end = cpu_to_le32(end);
        }
 
        buf = data;
@@ -8734,7 +8732,8 @@ static void tg3_get_ethtool_stats (struct net_device *dev,
 
 static int tg3_test_nvram(struct tg3 *tp)
 {
-       u32 *buf, csum, magic;
+       u32 csum, magic;
+       __le32 *buf;
        int i, j, k, err = 0, size;
 
        if (tg3_nvram_read_swab(tp, 0, &magic) != 0)
@@ -8771,21 +8770,19 @@ static int tg3_test_nvram(struct tg3 *tp)
 
        err = -EIO;
        for (i = 0, j = 0; i < size; i += 4, j++) {
-               u32 val;
-
-               if ((err = tg3_nvram_read(tp, i, &val)) != 0)
+               if ((err = tg3_nvram_read_le(tp, i, &buf[j])) != 0)
                        break;
-               buf[j] = cpu_to_le32(val);
        }
        if (i < size)
                goto out;
 
        /* Selfboot format */
-       if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_FW_MSK) ==
+       magic = swab32(le32_to_cpu(buf[0]));
+       if ((magic & TG3_EEPROM_MAGIC_FW_MSK) ==
            TG3_EEPROM_MAGIC_FW) {
                u8 *buf8 = (u8 *) buf, csum8 = 0;
 
-               if ((cpu_to_be32(buf[0]) & TG3_EEPROM_SB_REVISION_MASK) ==
+               if ((magic & TG3_EEPROM_SB_REVISION_MASK) ==
                    TG3_EEPROM_SB_REVISION_2) {
                        /* For rev 2, the csum doesn't include the MBA. */
                        for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++)
@@ -8806,7 +8803,7 @@ static int tg3_test_nvram(struct tg3 *tp)
                goto out;
        }
 
-       if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_HW_MSK) ==
+       if ((magic & TG3_EEPROM_MAGIC_HW_MSK) ==
            TG3_EEPROM_MAGIC_HW) {
                u8 data[NVRAM_SELFBOOT_DATA_SIZE];
                u8 parity[NVRAM_SELFBOOT_DATA_SIZE];
@@ -8852,12 +8849,12 @@ static int tg3_test_nvram(struct tg3 *tp)
 
        /* Bootstrap checksum at offset 0x10 */
        csum = calc_crc((unsigned char *) buf, 0x10);
-       if(csum != cpu_to_le32(buf[0x10/4]))
+       if(csum != le32_to_cpu(buf[0x10/4]))
                goto out;
 
        /* Manufacturing block starts at offset 0x74, checksum at 0xfc */
        csum = calc_crc((unsigned char *) &buf[0x74/4], 0x88);
-       if (csum != cpu_to_le32(buf[0xfc/4]))
+       if (csum != le32_to_cpu(buf[0xfc/4]))
                 goto out;
 
        err = 0;
@@ -10171,6 +10168,15 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
        return ret;
 }
 
+static int tg3_nvram_read_le(struct tg3 *tp, u32 offset, __le32 *val)
+{
+       u32 v;
+       int res = tg3_nvram_read(tp, offset, &v);
+       if (!res)
+               *val = cpu_to_le32(v);
+       return res;
+}
+
 static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val)
 {
        int err;
@@ -10188,13 +10194,14 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp,
        u32 val;
 
        for (i = 0; i < len; i += 4) {
-               u32 addr, data;
+               u32 addr;
+               __le32 data;
 
                addr = offset + i;
 
                memcpy(&data, buf + i, 4);
 
-               tw32(GRC_EEPROM_DATA, cpu_to_le32(data));
+               tw32(GRC_EEPROM_DATA, le32_to_cpu(data));
 
                val = tr32(GRC_EEPROM_ADDR);
                tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE);
@@ -10244,8 +10251,8 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
                phy_addr = offset & ~pagemask;
 
                for (j = 0; j < pagesize; j += 4) {
-                       if ((ret = tg3_nvram_read(tp, phy_addr + j,
-                                               (u32 *) (tmp + j))))
+                       if ((ret = tg3_nvram_read_le(tp, phy_addr + j,
+                                               (__le32 *) (tmp + j))))
                                break;
                }
                if (ret)
@@ -10289,10 +10296,11 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
                        break;
 
                for (j = 0; j < pagesize; j += 4) {
-                       u32 data;
+                       __be32 data;
 
-                       data = *((u32 *) (tmp + j));
-                       tw32(NVRAM_WRDATA, cpu_to_be32(data));
+                       data = *((__be32 *) (tmp + j));
+                       /* swab32(le32_to_cpu(data)), actually */
+                       tw32(NVRAM_WRDATA, be32_to_cpu(data));
 
                        tw32(NVRAM_ADDR, phy_addr + j);
 
@@ -10326,10 +10334,11 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len,
        int i, ret = 0;
 
        for (i = 0; i < len; i += 4, offset += 4) {
-               u32 data, page_off, phy_addr, nvram_cmd;
+               u32 page_off, phy_addr, nvram_cmd;
+               __be32 data;
 
                memcpy(&data, buf + i, 4);
-               tw32(NVRAM_WRDATA, cpu_to_be32(data));
+               tw32(NVRAM_WRDATA, be32_to_cpu(data));
 
                page_off = offset % tp->nvram_pagesize;
 
@@ -10831,6 +10840,7 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
                vpd_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_VPD);
                for (i = 0; i < 256; i += 4) {
                        u32 tmp, j = 0;
+                       __le32 v;
                        u16 tmp16;
 
                        pci_write_config_word(tp->pdev, vpd_cap + PCI_VPD_ADDR,
@@ -10847,8 +10857,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
 
                        pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA,
                                              &tmp);
-                       tmp = cpu_to_le32(tmp);
-                       memcpy(&vpd_data[i], &tmp, 4);
+                       v = cpu_to_le32(tmp);
+                       memcpy(&vpd_data[i], &v, 4);
                }
        }
 
@@ -10941,11 +10951,11 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
 
        offset = offset + ver_offset - start;
        for (i = 0; i < 16; i += 4) {
-               if (tg3_nvram_read(tp, offset + i, &val))
+               __le32 v;
+               if (tg3_nvram_read_le(tp, offset + i, &v))
                        return;
 
-               val = le32_to_cpu(val);
-               memcpy(tp->fw_ver + i, &val, 4);
+               memcpy(tp->fw_ver + i, &v, 4);
        }
 
        if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) ||
@@ -10983,19 +10993,19 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
        tp->fw_ver[bcnt++] = ' ';
 
        for (i = 0; i < 4; i++) {
-               if (tg3_nvram_read(tp, offset, &val))
+               __le32 v;
+               if (tg3_nvram_read_le(tp, offset, &v))
                        return;
 
-               val = le32_to_cpu(val);
-               offset += sizeof(val);
+               offset += sizeof(v);
 
-               if (bcnt > TG3_VER_SIZE - sizeof(val)) {
-                       memcpy(&tp->fw_ver[bcnt], &val, TG3_VER_SIZE - bcnt);
+               if (bcnt > TG3_VER_SIZE - sizeof(v)) {
+                       memcpy(&tp->fw_ver[bcnt], &v, TG3_VER_SIZE - bcnt);
                        break;
                }
 
-               memcpy(&tp->fw_ver[bcnt], &val, sizeof(val));
-               bcnt += sizeof(val);
+               memcpy(&tp->fw_ver[bcnt], &v, sizeof(v));
+               bcnt += sizeof(v);
        }
 
        tp->fw_ver[TG3_VER_SIZE - 1] = 0;
index 5d31519..44a06f8 100644 (file)
@@ -570,7 +570,7 @@ static int xl_open(struct net_device *dev)
        struct xl_private *xl_priv=netdev_priv(dev);
        u8 __iomem *xl_mmio = xl_priv->xl_mmio ; 
        u8 i ; 
-       u16 hwaddr[3] ; /* Should be u8[6] but we get word return values */
+       __le16 hwaddr[3] ; /* Should be u8[6] but we get word return values */
        int open_err ;
 
        u16 switchsettings, switchsettings_eeprom  ;
@@ -580,15 +580,12 @@ static int xl_open(struct net_device *dev)
        }
 
        /* 
-        * Read the information from the EEPROM that we need. I know we
-        * should use ntohs, but the word gets stored reversed in the 16
-        * bit field anyway and it all works its self out when we memcpy
-        * it into dev->dev_addr. 
+        * Read the information from the EEPROM that we need.
         */
        
-       hwaddr[0] = xl_ee_read(dev,0x10) ; 
-       hwaddr[1] = xl_ee_read(dev,0x11) ; 
-       hwaddr[2] = xl_ee_read(dev,0x12) ; 
+       hwaddr[0] = cpu_to_le16(xl_ee_read(dev,0x10));
+       hwaddr[1] = cpu_to_le16(xl_ee_read(dev,0x11));
+       hwaddr[2] = cpu_to_le16(xl_ee_read(dev,0x12));
 
        /* Ring speed */
 
@@ -665,8 +662,8 @@ static int xl_open(struct net_device *dev)
                        break ; 
 
                skb->dev = dev ; 
-               xl_priv->xl_rx_ring[i].upfragaddr = pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; 
-               xl_priv->xl_rx_ring[i].upfraglen = xl_priv->pkt_buf_sz | RXUPLASTFRAG;
+               xl_priv->xl_rx_ring[i].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE));
+               xl_priv->xl_rx_ring[i].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG;
                xl_priv->rx_ring_skb[i] = skb ;         
        }
 
@@ -680,7 +677,7 @@ static int xl_open(struct net_device *dev)
        xl_priv->rx_ring_tail = 0 ; 
        xl_priv->rx_ring_dma_addr = pci_map_single(xl_priv->pdev,xl_priv->xl_rx_ring, sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE, PCI_DMA_TODEVICE) ; 
        for (i=0;i<(xl_priv->rx_ring_no-1);i++) { 
-               xl_priv->xl_rx_ring[i].upnextptr = xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * (i+1)) ; 
+               xl_priv->xl_rx_ring[i].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * (i+1)));
        } 
        xl_priv->xl_rx_ring[i].upnextptr = 0 ; 
 
@@ -698,7 +695,7 @@ static int xl_open(struct net_device *dev)
         * Setup the first dummy DPD entry for polling to start working.
         */
 
-       xl_priv->xl_tx_ring[0].framestartheader = TXDPDEMPTY ; 
+       xl_priv->xl_tx_ring[0].framestartheader = TXDPDEMPTY;
        xl_priv->xl_tx_ring[0].buffer = 0 ; 
        xl_priv->xl_tx_ring[0].buffer_length = 0 ; 
        xl_priv->xl_tx_ring[0].dnnextptr = 0 ; 
@@ -811,17 +808,17 @@ static int xl_open_hw(struct net_device *dev)
                return open_err ; 
        } else { 
                writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 8, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-               xl_priv->asb = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 
+               xl_priv->asb = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
                printk(KERN_INFO "%s: Adapter Opened Details: ",dev->name) ; 
                printk("ASB: %04x",xl_priv->asb ) ; 
                writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 10, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-               printk(", SRB: %04x",ntohs(readw(xl_mmio + MMIO_MACDATA)) ) ; 
+               printk(", SRB: %04x",swab16(readw(xl_mmio + MMIO_MACDATA)) ) ;
  
                writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 12, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-               xl_priv->arb = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 
+               xl_priv->arb = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
                printk(", ARB: %04x \n",xl_priv->arb ) ; 
                writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 14, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-               vsoff = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 
+               vsoff = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
 
                /* 
                 * Interesting, sending the individual characters directly to printk was causing klogd to use
@@ -873,16 +870,15 @@ static int xl_open_hw(struct net_device *dev)
 static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on bloat in xl_rx */ 
 {
        struct xl_private *xl_priv=netdev_priv(dev);
-       int prev_ring_loc ; 
-
-       prev_ring_loc = (xl_priv->rx_ring_tail + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1);
-       xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * xl_priv->rx_ring_tail) ; 
-       xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus = 0 ; 
-       xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upnextptr = 0 ;      
-       xl_priv->rx_ring_tail++ ; 
-       xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1) ; 
-
-       return ; 
+       int n = xl_priv->rx_ring_tail;
+       int prev_ring_loc;
+
+       prev_ring_loc = (n + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1);
+       xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * n));
+       xl_priv->xl_rx_ring[n].framestatus = 0;
+       xl_priv->xl_rx_ring[n].upnextptr = 0;
+       xl_priv->rx_ring_tail++;
+       xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1);
 }
 
 static void xl_rx(struct net_device *dev)
@@ -914,7 +910,7 @@ static void xl_rx(struct net_device *dev)
                                temp_ring_loc &= (XL_RX_RING_SIZE-1) ; 
                        }
 
-                       frame_length = xl_priv->xl_rx_ring[temp_ring_loc].framestatus & 0x7FFF ; 
+                       frame_length = le32_to_cpu(xl_priv->xl_rx_ring[temp_ring_loc].framestatus) & 0x7FFF;
 
                        skb = dev_alloc_skb(frame_length) ;
  
@@ -931,29 +927,29 @@ static void xl_rx(struct net_device *dev)
                        }
        
                        while (xl_priv->rx_ring_tail != temp_ring_loc) { 
-                               copy_len = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen & 0x7FFF ; 
+                               copy_len = le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen) & 0x7FFF;
                                frame_length -= copy_len ;  
-                               pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ;
+                               pci_dma_sync_single_for_cpu(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
                                skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail],
                                                          skb_put(skb, copy_len),
                                                          copy_len);
-                               pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ;
+                               pci_dma_sync_single_for_device(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
                                adv_rx_ring(dev) ; 
                        } 
 
                        /* Now we have found the last fragment */
-                       pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ;
+                       pci_dma_sync_single_for_cpu(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
                        skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail],
                                      skb_put(skb,copy_len), frame_length);
 /*                     memcpy(skb_put(skb,frame_length), bus_to_virt(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), frame_length) ; */
-                       pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ;
+                       pci_dma_sync_single_for_device(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
                        adv_rx_ring(dev) ; 
                        skb->protocol = tr_type_trans(skb,dev) ; 
                        netif_rx(skb) ; 
 
                } else { /* Single Descriptor Used, simply swap buffers over, fast path  */
 
-                       frame_length = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus & 0x7FFF ; 
+                       frame_length = le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus) & 0x7FFF;
                        
                        skb = dev_alloc_skb(xl_priv->pkt_buf_sz) ; 
 
@@ -966,13 +962,13 @@ static void xl_rx(struct net_device *dev)
                        }
 
                        skb2 = xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] ; 
-                       pci_unmap_single(xl_priv->pdev, xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr, xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; 
+                       pci_unmap_single(xl_priv->pdev, le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ;
                        skb_put(skb2, frame_length) ; 
                        skb2->protocol = tr_type_trans(skb2,dev) ; 
 
                        xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] = skb ;     
-                       xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; 
-                       xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = xl_priv->pkt_buf_sz | RXUPLASTFRAG ; 
+                       xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE));
+                       xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG;
                        adv_rx_ring(dev) ; 
                        xl_priv->xl_stats.rx_packets++ ; 
                        xl_priv->xl_stats.rx_bytes += frame_length ;    
@@ -1022,7 +1018,7 @@ static void xl_freemem(struct net_device *dev)
 
        for (i=0;i<XL_RX_RING_SIZE;i++) {
                dev_kfree_skb_irq(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail]) ; 
-               pci_unmap_single(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; 
+               pci_unmap_single(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE);
                xl_priv->rx_ring_tail++ ; 
                xl_priv->rx_ring_tail &= XL_RX_RING_SIZE-1; 
        } 
@@ -1181,9 +1177,9 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev)
 
                txd = &(xl_priv->xl_tx_ring[tx_head]) ; 
                txd->dnnextptr = 0 ; 
-               txd->framestartheader = skb->len | TXDNINDICATE ; 
-               txd->buffer = pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE) ; 
-               txd->buffer_length = skb->len | TXDNFRAGLAST  ; 
+               txd->framestartheader = cpu_to_le32(skb->len) | TXDNINDICATE;
+               txd->buffer = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE));
+               txd->buffer_length = cpu_to_le32(skb->len) | TXDNFRAGLAST;
                xl_priv->tx_ring_skb[tx_head] = skb ; 
                xl_priv->xl_stats.tx_packets++ ; 
                xl_priv->xl_stats.tx_bytes += skb->len ;
@@ -1199,7 +1195,7 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev)
                xl_priv->tx_ring_head &= (XL_TX_RING_SIZE - 1) ;
                xl_priv->free_ring_entries-- ; 
 
-               xl_priv->xl_tx_ring[tx_prev].dnnextptr = xl_priv->tx_ring_dma_addr + (sizeof (struct xl_tx_desc) * tx_head) ; 
+               xl_priv->xl_tx_ring[tx_prev].dnnextptr = cpu_to_le32(xl_priv->tx_ring_dma_addr + (sizeof (struct xl_tx_desc) * tx_head));
 
                /* Sneaky, by doing a read on DnListPtr we can force the card to poll on the DnNextPtr */
                /* readl(xl_mmio + MMIO_DNLISTPTR) ; */
@@ -1237,9 +1233,9 @@ static void xl_dn_comp(struct net_device *dev)
 
        while (xl_priv->xl_tx_ring[xl_priv->tx_ring_tail].framestartheader & TXDNCOMPLETE ) { 
                txd = &(xl_priv->xl_tx_ring[xl_priv->tx_ring_tail]) ;
-               pci_unmap_single(xl_priv->pdev,txd->buffer, xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]->len, PCI_DMA_TODEVICE) ; 
+               pci_unmap_single(xl_priv->pdev, le32_to_cpu(txd->buffer), xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]->len, PCI_DMA_TODEVICE);
                txd->framestartheader = 0 ; 
-               txd->buffer = 0xdeadbeef  ; 
+               txd->buffer = cpu_to_le32(0xdeadbeef);
                txd->buffer_length  = 0 ;  
                dev_kfree_skb_irq(xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]) ;
                xl_priv->tx_ring_tail++ ; 
@@ -1507,9 +1503,9 @@ static void xl_arb_cmd(struct net_device *dev)
        if (arb_cmd == RING_STATUS_CHANGE) { /* Ring.Status.Change */
                writel( ( (MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ;
                 
-               printk(KERN_INFO "%s: Ring Status Change: New Status = %04x\n", dev->name, ntohs(readw(xl_mmio + MMIO_MACDATA) )) ; 
+               printk(KERN_INFO "%s: Ring Status Change: New Status = %04x\n", dev->name, swab16(readw(xl_mmio + MMIO_MACDATA) )) ;
 
-               lan_status = ntohs(readw(xl_mmio + MMIO_MACDATA));
+               lan_status = swab16(readw(xl_mmio + MMIO_MACDATA));
        
                /* Acknowledge interrupt, this tells nic we are done with the arb */
                writel(ACK_INTERRUPT | ARBCACK | LATCH_ACK, xl_mmio + MMIO_COMMAND) ; 
@@ -1573,7 +1569,7 @@ static void xl_arb_cmd(struct net_device *dev)
                printk(KERN_INFO "Received.Data \n") ; 
 #endif                 
                writel( ((MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ;
-               xl_priv->mac_buffer = ntohs(readw(xl_mmio + MMIO_MACDATA)) ;
+               xl_priv->mac_buffer = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
                
                /* Now we are going to be really basic here and not do anything
                 * with the data at all. The tech docs do not give me enough
@@ -1634,7 +1630,7 @@ static void xl_asb_cmd(struct net_device *dev)
        writeb(0x81, xl_mmio + MMIO_MACDATA) ; 
 
        writel(MEM_WORD_WRITE | 0xd0000 | xl_priv->asb | 6, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 
-       writew(ntohs(xl_priv->mac_buffer), xl_mmio + MMIO_MACDATA) ; 
+       writew(swab16(xl_priv->mac_buffer), xl_mmio + MMIO_MACDATA) ;
 
        xl_wait_misr_flags(dev) ;       
 
index 05c8603..b880cba 100644 (file)
 #define HOSTERRINT (1<<1)
 
 /* Receive descriptor bits */
-#define RXOVERRUN (1<<19)
-#define RXFC (1<<21)
-#define RXAR (1<<22)
-#define RXUPDCOMPLETE (1<<23)
-#define RXUPDFULL (1<<24)
-#define RXUPLASTFRAG (1<<31)
+#define RXOVERRUN cpu_to_le32(1<<19)
+#define RXFC cpu_to_le32(1<<21)
+#define RXAR cpu_to_le32(1<<22)
+#define RXUPDCOMPLETE cpu_to_le32(1<<23)
+#define RXUPDFULL cpu_to_le32(1<<24)
+#define RXUPLASTFRAG cpu_to_le32(1<<31)
 
 /* Transmit descriptor bits */
-#define TXDNCOMPLETE (1<<16)
-#define TXTXINDICATE (1<<27)
-#define TXDPDEMPTY (1<<29)
-#define TXDNINDICATE (1<<31)
-#define TXDNFRAGLAST (1<<31)
+#define TXDNCOMPLETE cpu_to_le32(1<<16)
+#define TXTXINDICATE cpu_to_le32(1<<27)
+#define TXDPDEMPTY cpu_to_le32(1<<29)
+#define TXDNINDICATE cpu_to_le32(1<<31)
+#define TXDNFRAGLAST cpu_to_le32(1<<31)
 
 /* Interrupts to Acknowledge */
 #define LATCH_ACK 1 
 /* 3c359 data structures */
 
 struct xl_tx_desc {
-       u32 dnnextptr ; 
-       u32 framestartheader ; 
-       u32 buffer ;
-       u32 buffer_length ;
+       __le32 dnnextptr;
+       __le32 framestartheader;
+       __le32 buffer;
+       __le32 buffer_length;
 };
 
 struct xl_rx_desc {
-       u32 upnextptr ; 
-       u32 framestatus ; 
-       u32 upfragaddr ; 
-       u32 upfraglen ; 
+       __le32 upnextptr;
+       __le32 framestatus;
+       __le32 upfragaddr;
+       __le32 upfraglen;
 };
 
 struct xl_private {
index 1f76446..f8b8c71 100644 (file)
@@ -610,7 +610,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
                        tun->flags &= ~TUN_PERSIST;
 
                DBG(KERN_INFO "%s: persist %s\n",
-                   tun->dev->name, arg ? "disabled" : "enabled");
+                   tun->dev->name, arg ? "enabled" : "disabled");
                break;
 
        case TUNSETOWNER:
index 94ac586..f50cb52 100644 (file)
@@ -813,8 +813,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
        first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID;
        first_txd->numDesc = 0;
        first_txd->len = 0;
-       first_txd->addr = (u64)((unsigned long) skb) & 0xffffffff;
-       first_txd->addrHi = (u64)((unsigned long) skb) >> 32;
+       first_txd->tx_addr = (u64)((unsigned long) skb);
        first_txd->processFlags = 0;
 
        if(skb->ip_summed == CHECKSUM_PARTIAL) {
@@ -850,8 +849,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
                                       PCI_DMA_TODEVICE);
                txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
                txd->len = cpu_to_le16(skb->len);
-               txd->addr = cpu_to_le32(skb_dma);
-               txd->addrHi = 0;
+               txd->frag.addr = cpu_to_le32(skb_dma);
+               txd->frag.addrHi = 0;
                first_txd->numDesc++;
        } else {
                int i, len;
@@ -861,8 +860,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
                                         PCI_DMA_TODEVICE);
                txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
                txd->len = cpu_to_le16(len);
-               txd->addr = cpu_to_le32(skb_dma);
-               txd->addrHi = 0;
+               txd->frag.addr = cpu_to_le32(skb_dma);
+               txd->frag.addrHi = 0;
                first_txd->numDesc++;
 
                for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
@@ -880,8 +879,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
                                         PCI_DMA_TODEVICE);
                        txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
                        txd->len = cpu_to_le16(len);
-                       txd->addr = cpu_to_le32(skb_dma);
-                       txd->addrHi = 0;
+                       txd->frag.addr = cpu_to_le32(skb_dma);
+                       txd->frag.addrHi = 0;
                        first_txd->numDesc++;
                }
        }
@@ -977,12 +976,12 @@ typhoon_do_get_stats(struct typhoon *tp)
         * ethtool_ops->get_{strings,stats}()
         */
        stats->tx_packets = le32_to_cpu(s->txPackets);
-       stats->tx_bytes = le32_to_cpu(s->txBytes);
+       stats->tx_bytes = le64_to_cpu(s->txBytes);
        stats->tx_errors = le32_to_cpu(s->txCarrierLost);
        stats->tx_carrier_errors = le32_to_cpu(s->txCarrierLost);
        stats->collisions = le32_to_cpu(s->txMultipleCollisions);
        stats->rx_packets = le32_to_cpu(s->rxPacketsGood);
-       stats->rx_bytes = le32_to_cpu(s->rxBytesGood);
+       stats->rx_bytes = le64_to_cpu(s->rxBytesGood);
        stats->rx_fifo_errors = le32_to_cpu(s->rxFifoOverruns);
        stats->rx_errors = le32_to_cpu(s->rxFifoOverruns) +
                        le32_to_cpu(s->BadSSD) + le32_to_cpu(s->rxCrcErrors);
@@ -1056,7 +1055,7 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
                if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) {
                        strcpy(info->fw_version, "Unknown runtime");
                } else {
-                       u32 sleep_ver = xp_resp[0].parm2;
+                       u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2);
                        snprintf(info->fw_version, 32, "%02x.%03x.%03x",
                                 sleep_ver >> 24, (sleep_ver >> 12) & 0xfff,
                                 sleep_ver & 0xfff);
@@ -1157,7 +1156,7 @@ typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        }
 
        INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_XCVR_SELECT);
-       xp_cmd.parm1 = cpu_to_le16(xcvr);
+       xp_cmd.parm1 = xcvr;
        err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL);
        if(err < 0)
                goto out;
@@ -1320,7 +1319,7 @@ typhoon_init_interface(struct typhoon *tp)
        tp->txLoRing.writeRegister = TYPHOON_REG_TX_LO_READY;
        tp->txHiRing.writeRegister = TYPHOON_REG_TX_HI_READY;
 
-       tp->txlo_dma_addr = iface->txLoAddr;
+       tp->txlo_dma_addr = le32_to_cpu(iface->txLoAddr);
        tp->card_state = Sleeping;
        smp_wmb();
 
@@ -1358,7 +1357,7 @@ typhoon_download_firmware(struct typhoon *tp)
        u8 *image_data;
        void *dpage;
        dma_addr_t dpage_dma;
-       unsigned int csum;
+       __sum16 csum;
        u32 irqEnabled;
        u32 irqMasked;
        u32 numSections;
@@ -1450,13 +1449,13 @@ typhoon_download_firmware(struct typhoon *tp)
                         * summing. Fortunately, due to the properties of
                         * the checksum, we can do this once, at the end.
                         */
-                       csum = csum_partial_copy_nocheck(image_data, dpage,
-                                                        len, 0);
-                       csum = csum_fold(csum);
-                       csum = le16_to_cpu(csum);
+                       csum = csum_fold(csum_partial_copy_nocheck(image_data,
+                                                                 dpage, len,
+                                                                 0));
 
                        iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH);
-                       iowrite32(csum, ioaddr + TYPHOON_REG_BOOT_CHECKSUM);
+                       iowrite32(le16_to_cpu((__force __le16)csum),
+                                       ioaddr + TYPHOON_REG_BOOT_CHECKSUM);
                        iowrite32(load_addr,
                                        ioaddr + TYPHOON_REG_BOOT_DEST_ADDR);
                        iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI);
@@ -1551,13 +1550,13 @@ typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing,
                if(type == TYPHOON_TX_DESC) {
                        /* This tx_desc describes a packet.
                         */
-                       unsigned long ptr = tx->addr | ((u64)tx->addrHi << 32);
+                       unsigned long ptr = tx->tx_addr;
                        struct sk_buff *skb = (struct sk_buff *) ptr;
                        dev_kfree_skb_irq(skb);
                } else if(type == TYPHOON_FRAG_DESC) {
                        /* This tx_desc describes a memory mapping. Free it.
                         */
-                       skb_dma = (dma_addr_t) le32_to_cpu(tx->addr);
+                       skb_dma = (dma_addr_t) le32_to_cpu(tx->frag.addr);
                        dma_len = le16_to_cpu(tx->len);
                        pci_unmap_single(tp->pdev, skb_dma, dma_len,
                                       PCI_DMA_TODEVICE);
@@ -1596,7 +1595,7 @@ typhoon_recycle_rx_skb(struct typhoon *tp, u32 idx)
        struct rx_free *r;
 
        if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) ==
-                               indexes->rxBuffCleared) {
+                               le32_to_cpu(indexes->rxBuffCleared)) {
                /* no room in ring, just drop the skb
                 */
                dev_kfree_skb_any(rxb->skb);
@@ -1627,7 +1626,7 @@ typhoon_alloc_rx_skb(struct typhoon *tp, u32 idx)
        rxb->skb = NULL;
 
        if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) ==
-                               indexes->rxBuffCleared)
+                               le32_to_cpu(indexes->rxBuffCleared))
                return -ENOMEM;
 
        skb = dev_alloc_skb(PKT_BUF_SZ);
index 19df208..dd7022c 100644 (file)
@@ -73,7 +73,7 @@ struct typhoon_indexes {
        volatile __le32 txLoCleared;
        volatile __le32 txHiCleared;
        volatile __le32 rxLoReady;
-       volatile __u32 rxBuffCleared;   /* AV: really? */
+       volatile __le32 rxBuffCleared;
        volatile __le32 cmdCleared;
        volatile __le32 respReady;
        volatile __le32 rxHiReady;
@@ -166,8 +166,13 @@ struct tx_desc {
 #define TYPHOON_DESC_VALID     0x80
        u8  numDesc;
        __le16 len;
-       u32 addr;
-       u32 addrHi;
+       union {
+               struct {
+                       __le32 addr;
+                       __le32 addrHi;
+               } frag;
+               u64 tx_addr;    /* opaque for hardware, for TX_DESC */
+       };
        __le32 processFlags;
 #define TYPHOON_TX_PF_NO_CRC           __constant_cpu_to_le32(0x00000001)
 #define TYPHOON_TX_PF_IP_CHKSUM                __constant_cpu_to_le32(0x00000002)
@@ -240,8 +245,8 @@ struct rx_desc {
        u8  flags;
        u8  numDesc;
        __le16 frameLen;
-       u32 addr;
-       u32 addrHi;
+       u32 addr;       /* opaque, comes from virtAddr */
+       u32 addrHi;     /* opaque, comes from virtAddrHi */
        __le32 rxStatus;
 #define TYPHOON_RX_ERR_INTERNAL                __constant_cpu_to_le32(0x00000000)
 #define TYPHOON_RX_ERR_FIFO_UNDERRUN   __constant_cpu_to_le32(0x00000001)
index 61daa09..1249f44 100644 (file)
@@ -172,45 +172,76 @@ struct asix_data {
 };
 
 struct ax88172_int_data {
-       u16 res1;
+       __le16 res1;
        u8 link;
-       u16 res2;
+       __le16 res2;
        u8 status;
-       u16 res3;
+       __le16 res3;
 } __attribute__ ((packed));
 
 static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
                            u16 size, void *data)
 {
+       void *buf;
+       int err = -ENOMEM;
+
        devdbg(dev,"asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d",
                cmd, value, index, size);
-       return usb_control_msg(
+
+       buf = kmalloc(size, GFP_KERNEL);
+       if (!buf)
+               goto out;
+
+       err = usb_control_msg(
                dev->udev,
                usb_rcvctrlpipe(dev->udev, 0),
                cmd,
                USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                value,
                index,
-               data,
+               buf,
                size,
                USB_CTRL_GET_TIMEOUT);
+       if (err >= 0 && err < size)
+               err = -EINVAL;
+       if (!err)
+               memcpy(data, buf, size);
+       kfree(buf);
+
+out:
+       return err;
 }
 
 static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
                             u16 size, void *data)
 {
+       void *buf = NULL;
+       int err = -ENOMEM;
+
        devdbg(dev,"asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d",
                cmd, value, index, size);
-       return usb_control_msg(
+
+       if (data) {
+               buf = kmalloc(size, GFP_KERNEL);
+               if (!buf)
+                       goto out;
+               memcpy(buf, data, size);
+       }
+
+       err = usb_control_msg(
                dev->udev,
                usb_sndctrlpipe(dev->udev, 0),
                cmd,
                USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                value,
                index,
-               data,
+               buf,
                size,
                USB_CTRL_SET_TIMEOUT);
+       kfree(buf);
+
+out:
+       return err;
 }
 
 static void asix_async_cmd_callback(struct urb *urb)
@@ -402,25 +433,19 @@ static inline int asix_set_hw_mii(struct usbnet *dev)
 
 static inline int asix_get_phy_addr(struct usbnet *dev)
 {
-       int ret = 0;
-       void *buf;
+       u8 buf[2];
+       int ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf);
 
        devdbg(dev, "asix_get_phy_addr()");
 
-       buf = kmalloc(2, GFP_KERNEL);
-       if (!buf)
-               goto out1;
-
-       if ((ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID,
-                                   0, 0, 2, buf)) < 2) {
+       if (ret < 0) {
                deverr(dev, "Error reading PHYID register: %02x", ret);
-               goto out2;
+               goto out;
        }
-       devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((u16 *)buf));
-       ret = *((u8 *)buf + 1);
-out2:
-       kfree(buf);
-out1:
+       devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((__le16 *)buf));
+       ret = buf[1];
+
+out:
        return ret;
 }
 
@@ -437,22 +462,15 @@ static int asix_sw_reset(struct usbnet *dev, u8 flags)
 
 static u16 asix_read_rx_ctl(struct usbnet *dev)
 {
-       u16 ret = 0;
-       void *buf;
-
-       buf = kmalloc(2, GFP_KERNEL);
-       if (!buf)
-               goto out1;
+       __le16 v;
+       int ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL, 0, 0, 2, &v);
 
-       if ((ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL,
-                                   0, 0, 2, buf)) < 2) {
+       if (ret < 0) {
                deverr(dev, "Error reading RX_CTL register: %02x", ret);
-               goto out2;
+               goto out;
        }
-       ret = le16_to_cpu(*((u16 *)buf));
-out2:
-       kfree(buf);
-out1:
+       ret = le16_to_cpu(v);
+out:
        return ret;
 }
 
@@ -471,22 +489,15 @@ static int asix_write_rx_ctl(struct usbnet *dev, u16 mode)
 
 static u16 asix_read_medium_status(struct usbnet *dev)
 {
-       u16 ret = 0;
-       void *buf;
+       __le16 v;
+       int ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS, 0, 0, 2, &v);
 
-       buf = kmalloc(2, GFP_KERNEL);
-       if (!buf)
-               goto out1;
-
-       if ((ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS,
-                                   0, 0, 2, buf)) < 2) {
+       if (ret < 0) {
                deverr(dev, "Error reading Medium Status register: %02x", ret);
-               goto out2;
+               goto out;
        }
-       ret = le16_to_cpu(*((u16 *)buf));
-out2:
-       kfree(buf);
-out1:
+       ret = le16_to_cpu(v);
+out:
        return ret;
 }
 
@@ -568,31 +579,30 @@ static void asix_set_multicast(struct net_device *net)
 static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc)
 {
        struct usbnet *dev = netdev_priv(netdev);
-       u16 res;
+       __le16 res;
 
        mutex_lock(&dev->phy_mutex);
        asix_set_sw_mii(dev);
        asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
-                               (__u16)loc, 2, (u16 *)&res);
+                               (__u16)loc, 2, &res);
        asix_set_hw_mii(dev);
        mutex_unlock(&dev->phy_mutex);
 
-       devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res & 0xffff));
+       devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res));
 
-       return le16_to_cpu(res & 0xffff);
+       return le16_to_cpu(res);
 }
 
 static void
 asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val)
 {
        struct usbnet *dev = netdev_priv(netdev);
-       u16 res = cpu_to_le16(val);
+       __le16 res = cpu_to_le16(val);
 
        devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val);
        mutex_lock(&dev->phy_mutex);
        asix_set_sw_mii(dev);
-       asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id,
-                               (__u16)loc, 2, (u16 *)&res);
+       asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, &res);
        asix_set_hw_mii(dev);
        mutex_unlock(&dev->phy_mutex);
 }
@@ -644,7 +654,6 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
 {
        struct usbnet *dev = netdev_priv(net);
        u8 opt = 0;
-       u8 buf[1];
 
        if (wolinfo->wolopts & WAKE_PHY)
                opt |= AX_MONITOR_LINK;
@@ -654,7 +663,7 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
                opt |= AX_MONITOR_MODE;
 
        if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE,
-                             opt, 0, 0, &buf) < 0)
+                             opt, 0, 0, NULL) < 0)
                return -EINVAL;
 
        return 0;
@@ -672,7 +681,7 @@ static int asix_get_eeprom(struct net_device *net,
                              struct ethtool_eeprom *eeprom, u8 *data)
 {
        struct usbnet *dev = netdev_priv(net);
-       u16 *ebuf = (u16 *)data;
+       __le16 *ebuf = (__le16 *)data;
        int i;
 
        /* Crude hack to ensure that we don't overwrite memory
@@ -801,7 +810,7 @@ static int ax88172_link_reset(struct usbnet *dev)
 static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
 {
        int ret = 0;
-       void *buf;
+       u8 buf[ETH_ALEN];
        int i;
        unsigned long gpio_bits = dev->driver_info->data;
        struct asix_data *data = (struct asix_data *)&dev->data;
@@ -810,30 +819,23 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
 
        usbnet_get_endpoints(dev,intf);
 
-       buf = kmalloc(ETH_ALEN, GFP_KERNEL);
-       if(!buf) {
-               ret = -ENOMEM;
-               goto out1;
-       }
-
        /* Toggle the GPIOs in a manufacturer/model specific way */
        for (i = 2; i >= 0; i--) {
                if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS,
                                        (gpio_bits >> (i * 8)) & 0xff, 0, 0,
-                                       buf)) < 0)
-                       goto out2;
+                                       NULL)) < 0)
+                       goto out;
                msleep(5);
        }
 
        if ((ret = asix_write_rx_ctl(dev, 0x80)) < 0)
-               goto out2;
+               goto out;
 
        /* Get the MAC address */
-       memset(buf, 0, ETH_ALEN);
        if ((ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID,
-                               0, 0, 6, buf)) < 0) {
+                               0, 0, ETH_ALEN, buf)) < 0) {
                dbg("read AX_CMD_READ_NODE_ID failed: %d", ret);
-               goto out2;
+               goto out;
        }
        memcpy(dev->net->dev_addr, buf, ETH_ALEN);
 
@@ -855,9 +857,8 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
        mii_nway_restart(&dev->mii);
 
        return 0;
-out2:
-       kfree(buf);
-out1:
+
+out:
        return ret;
 }
 
@@ -900,66 +901,58 @@ static int ax88772_link_reset(struct usbnet *dev)
 static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
 {
        int ret, embd_phy;
-       void *buf;
        u16 rx_ctl;
        struct asix_data *data = (struct asix_data *)&dev->data;
+       u8 buf[ETH_ALEN];
        u32 phyid;
 
        data->eeprom_len = AX88772_EEPROM_LEN;
 
        usbnet_get_endpoints(dev,intf);
 
-       buf = kmalloc(6, GFP_KERNEL);
-       if(!buf) {
-               dbg ("Cannot allocate memory for buffer");
-               ret = -ENOMEM;
-               goto out1;
-       }
-
        if ((ret = asix_write_gpio(dev,
                        AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0)
-               goto out2;
+               goto out;
 
        /* 0x10 is the phy id of the embedded 10/100 ethernet phy */
        embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0);
        if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT,
-                               embd_phy, 0, 0, buf)) < 0) {
+                               embd_phy, 0, 0, NULL)) < 0) {
                dbg("Select PHY #1 failed: %d", ret);
-               goto out2;
+               goto out;
        }
 
        if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0)
-               goto out2;
+               goto out;
 
        msleep(150);
        if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0)
-               goto out2;
+               goto out;
 
        msleep(150);
        if (embd_phy) {
                if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0)
-                       goto out2;
+                       goto out;
        }
        else {
                if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0)
-                       goto out2;
+                       goto out;
        }
 
        msleep(150);
        rx_ctl = asix_read_rx_ctl(dev);
        dbg("RX_CTL is 0x%04x after software reset", rx_ctl);
        if ((ret = asix_write_rx_ctl(dev, 0x0000)) < 0)
-               goto out2;
+               goto out;
 
        rx_ctl = asix_read_rx_ctl(dev);
        dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl);
 
        /* Get the MAC address */
-       memset(buf, 0, ETH_ALEN);
        if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID,
                                0, 0, ETH_ALEN, buf)) < 0) {
                dbg("Failed to read MAC address: %d", ret);
-               goto out2;
+               goto out;
        }
        memcpy(dev->net->dev_addr, buf, ETH_ALEN);
 
@@ -976,12 +969,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
        dbg("PHYID=0x%08x", phyid);
 
        if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0)
-               goto out2;
+               goto out;
 
        msleep(150);
 
        if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0)
-               goto out2;
+               goto out;
 
        msleep(150);
 
@@ -994,18 +987,18 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
        mii_nway_restart(&dev->mii);
 
        if ((ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT)) < 0)
-               goto out2;
+               goto out;
 
        if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0,
                                AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT,
-                               AX88772_IPG2_DEFAULT, 0, buf)) < 0) {
+                               AX88772_IPG2_DEFAULT, 0, NULL)) < 0) {
                dbg("Write IPG,IPG1,IPG2 failed: %d", ret);
-               goto out2;
+               goto out;
        }
 
        /* Set RX_CTL to default values with 2k buffer, and enable cactus */
        if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0)
-               goto out2;
+               goto out;
 
        rx_ctl = asix_read_rx_ctl(dev);
        dbg("RX_CTL is 0x%04x after all initializations", rx_ctl);
@@ -1013,20 +1006,15 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
        rx_ctl = asix_read_medium_status(dev);
        dbg("Medium Status is 0x%04x after all initializations", rx_ctl);
 
-       kfree(buf);
-
        /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
        if (dev->driver_info->flags & FLAG_FRAMING_AX) {
                /* hard_mtu  is still the default - the device does not support
                   jumbo eth frames */
                dev->rx_urb_size = 2048;
        }
-
        return 0;
 
-out2:
-       kfree(buf);
-out1:
+out:
        return ret;
 }
 
@@ -1195,23 +1183,16 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
 {
        struct asix_data *data = (struct asix_data *)&dev->data;
        int ret;
-       void *buf;
-       u16 eeprom;
+       u8 buf[ETH_ALEN];
+       __le16 eeprom;
+       u8 status;
        int gpio0 = 0;
        u32 phyid;
 
        usbnet_get_endpoints(dev,intf);
 
-       buf = kmalloc(6, GFP_KERNEL);
-       if(!buf) {
-               dbg ("Cannot allocate memory for buffer");
-               ret = -ENOMEM;
-               goto out1;
-       }
-
-       eeprom = 0;
-       asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &eeprom);
-       dbg("GPIO Status: 0x%04x", eeprom);
+       asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status);
+       dbg("GPIO Status: 0x%04x", status);
 
        asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL);
        asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom);
@@ -1219,19 +1200,19 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
 
        dbg("EEPROM index 0x17 is 0x%04x", eeprom);
 
-       if (eeprom == 0xffff) {
+       if (eeprom == cpu_to_le16(0xffff)) {
                data->phymode = PHY_MODE_MARVELL;
                data->ledmode = 0;
                gpio0 = 1;
        } else {
-               data->phymode = eeprom & 7;
-               data->ledmode = eeprom >> 8;
-               gpio0 = (eeprom & 0x80) ? 0 : 1;
+               data->phymode = le16_to_cpu(eeprom) & 7;
+               data->ledmode = le16_to_cpu(eeprom) >> 8;
+               gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1;
        }
        dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode);
 
        asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40);
-       if ((eeprom >> 8) != 1) {
+       if ((le16_to_cpu(eeprom) >> 8) != 1) {
                asix_write_gpio(dev, 0x003c, 30);
                asix_write_gpio(dev, 0x001c, 300);
                asix_write_gpio(dev, 0x003c, 30);
@@ -1250,11 +1231,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
        asix_write_rx_ctl(dev, 0);
 
        /* Get the MAC address */
-       memset(buf, 0, ETH_ALEN);
        if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID,
                                0, 0, ETH_ALEN, buf)) < 0) {
                dbg("Failed to read MAC address: %d", ret);
-               goto out2;
+               goto out;
        }
        memcpy(dev->net->dev_addr, buf, ETH_ALEN);
 
@@ -1289,12 +1269,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
        mii_nway_restart(&dev->mii);
 
        if ((ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT)) < 0)
-               goto out2;
+               goto out;
 
        if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0)
-               goto out2;
-
-       kfree(buf);
+               goto out;
 
        /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
        if (dev->driver_info->flags & FLAG_FRAMING_AX) {
@@ -1302,12 +1280,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
                   jumbo eth frames */
                dev->rx_urb_size = 2048;
        }
-
        return 0;
 
-out2:
-       kfree(buf);
-out1:
+out:
        return ret;
 }
 
index fdd1e03..43af9e9 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <net/dst.h>
 #include <net/xfrm.h>
-#include <net/veth.h>
+#include <linux/veth.h>
 
 #define DRV_NAME       "veth"
 #define DRV_VERSION    "1.0"
index 8a1778c..d3b28b0 100644 (file)
@@ -503,7 +503,7 @@ static int cycx_netdevice_init(struct net_device *dev)
        dev->addr_len           = 0;            /* hardware address length */
 
        if (!chan->svc)
-               *(u16*)dev->dev_addr = htons(chan->lcn);
+               *(__be16*)dev->dev_addr = htons(chan->lcn);
 
        /* Initialize hardware parameters (just for reference) */
        dev->irq                = wandev->irq;
@@ -565,7 +565,7 @@ static int cycx_netdevice_hard_header(struct sk_buff *skb,
                                      const void *daddr, const void *saddr,
                                      unsigned len)
 {
-       skb->protocol = type;
+       skb->protocol = htons(type);
 
        return dev->hard_header_len;
 }
@@ -600,15 +600,15 @@ static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb,
        struct cycx_device *card = chan->card;
 
        if (!chan->svc)
-               chan->protocol = skb->protocol;
+               chan->protocol = ntohs(skb->protocol);
 
        if (card->wandev.state != WAN_CONNECTED)
                ++chan->ifstats.tx_dropped;
        else if (chan->svc && chan->protocol &&
-                chan->protocol != skb->protocol) {
+                chan->protocol != ntohs(skb->protocol)) {
                printk(KERN_INFO
                       "%s: unsupported Ethertype 0x%04X on interface %s!\n",
-                      card->devname, skb->protocol, dev->name);
+                      card->devname, ntohs(skb->protocol), dev->name);
                ++chan->ifstats.tx_errors;
        } else if (chan->protocol == ETH_P_IP) {
                switch (chan->state) {
@@ -1401,7 +1401,7 @@ static void cycx_x25_set_chan_state(struct net_device *dev, u8 state)
                switch (state) {
                case WAN_CONNECTED:
                        string_state = "connected!";
-                       *(u16*)dev->dev_addr = htons(chan->lcn);
+                       *(__be16*)dev->dev_addr = htons(chan->lcn);
                        netif_wake_queue(dev);
                        reset_timer(dev);
 
index 5583719..c98fc62 100644 (file)
@@ -587,15 +587,66 @@ config ADM8211
 config P54_COMMON
        tristate "Softmac Prism54 support"
        depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL
+       ---help---
+         This is common code for isl38xx based cards.
+         This module does nothing by itself - the USB/PCI frontends
+         also need to be enabled in order to support any devices.
+
+         These devices require softmac firmware which can be found at
+         http://prism54.org/
+
+         If you choose to build a module, it'll be called p54common.
 
 config P54_USB
        tristate "Prism54 USB support"
        depends on P54_COMMON && USB
        select CRC32
+       ---help---
+         This driver is for USB isl38xx based wireless cards.
+         These are USB based adapters found in devices such as:
+
+         3COM 3CRWE254G72
+         SMC 2862W-G
+         Accton 802.11g WN4501 USB
+         Siemens Gigaset USB
+         Netgear WG121
+         Netgear WG111
+         Medion 40900, Roper Europe
+         Shuttle PN15, Airvast WM168g, IOGear GWU513
+         Linksys WUSB54G
+         Linksys WUSB54G Portable
+         DLink DWL-G120 Spinnaker
+         DLink DWL-G122
+         Belkin F5D7050 ver 1000
+         Cohiba Proto board
+         SMC 2862W-G version 2
+         U.S. Robotics U5 802.11g Adapter
+         FUJITSU E-5400 USB D1700
+         Sagem XG703A
+         DLink DWL-G120 Cohiba
+         Spinnaker Proto board
+         Linksys WUSB54AG
+         Inventel UR054G
+         Spinnaker DUT
+
+         These devices require softmac firmware which can be found at
+         http://prism54.org/
+
+         If you choose to build a module, it'll be called p54usb.
 
 config P54_PCI
        tristate "Prism54 PCI support"
        depends on P54_COMMON && PCI
+       ---help---
+         This driver is for PCI isl38xx based wireless cards.
+         This driver supports most devices that are supported by the
+         fullmac prism54 driver plus many devices which are not
+         supported by the fullmac driver/firmware.
+
+         This driver requires softmac firmware which can be found at
+         http://prism54.org/
+
+         If you choose to build a module, it'll be called p54pci.
 
 source "drivers/net/wireless/iwlwifi/Kconfig"
 source "drivers/net/wireless/hostap/Kconfig"
index da51f47..88062c1 100644 (file)
@@ -1233,9 +1233,19 @@ static ssize_t show_event_log(struct device *d,
 {
        struct ipw_priv *priv = dev_get_drvdata(d);
        u32 log_len = ipw_get_event_log_len(priv);
-       struct ipw_event log[log_len];
+       u32 log_size;
+       struct ipw_event *log;
        u32 len = 0, i;
 
+       /* not using min() because of its strict type checking */
+       log_size = PAGE_SIZE / sizeof(*log) > log_len ?
+                       sizeof(*log) * log_len : PAGE_SIZE;
+       log = kzalloc(log_size, GFP_KERNEL);
+       if (!log) {
+               IPW_ERROR("Unable to allocate memory for log\n");
+               return 0;
+       }
+       log_len = log_size / sizeof(*log);
        ipw_capture_event_log(priv, log_len, log);
 
        len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len);
@@ -1244,6 +1254,7 @@ static ssize_t show_event_log(struct device *d,
                                "\n%08X%08X%08X",
                                log[i].time, log[i].event, log[i].data);
        len += snprintf(buf + len, PAGE_SIZE - len, "\n");
+       kfree(log);
        return len;
 }
 
index 3d1da07..1a6b0e0 100644 (file)
@@ -6246,8 +6246,6 @@ static void __iwl_down(struct iwl_priv *priv)
        /* Unblock any waiting calls */
        wake_up_interruptible_all(&priv->wait_command_queue);
 
-       iwl_cancel_deferred_work(priv);
-
        /* Wipe out the EXIT_PENDING status bit if we are not actually
         * exiting the module */
        if (!exit_pending)
@@ -6322,6 +6320,8 @@ static void iwl_down(struct iwl_priv *priv)
        mutex_lock(&priv->mutex);
        __iwl_down(priv);
        mutex_unlock(&priv->mutex);
+
+       iwl_cancel_deferred_work(priv);
 }
 
 #define MAX_HW_RESTARTS 5
@@ -8580,10 +8580,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
 
        IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
 
-       mutex_lock(&priv->mutex);
        set_bit(STATUS_EXIT_PENDING, &priv->status);
-       __iwl_down(priv);
-       mutex_unlock(&priv->mutex);
+
+       iwl_down(priv);
 
        /* Free MAC hash list for ADHOC */
        for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
@@ -8642,12 +8641,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct iwl_priv *priv = pci_get_drvdata(pdev);
 
-       mutex_lock(&priv->mutex);
-
        set_bit(STATUS_IN_SUSPEND, &priv->status);
 
        /* Take down the device; powers it off, etc. */
-       __iwl_down(priv);
+       iwl_down(priv);
 
        if (priv->mac80211_registered)
                ieee80211_stop_queues(priv->hw);
@@ -8656,8 +8653,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        pci_disable_device(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
 
-       mutex_unlock(&priv->mutex);
-
        return 0;
 }
 
@@ -8715,8 +8710,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
 
        printk(KERN_INFO "Coming out of suspend...\n");
 
-       mutex_lock(&priv->mutex);
-
        pci_set_power_state(pdev, PCI_D0);
        err = pci_enable_device(pdev);
        pci_restore_state(pdev);
@@ -8730,7 +8723,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
        pci_write_config_byte(pdev, 0x41, 0x00);
 
        iwl_resume(priv);
-       mutex_unlock(&priv->mutex);
 
        return 0;
 }
index b54fe5e..6cd57c2 100644 (file)
@@ -6601,8 +6601,6 @@ static void __iwl_down(struct iwl_priv *priv)
        /* Unblock any waiting calls */
        wake_up_interruptible_all(&priv->wait_command_queue);
 
-       iwl_cancel_deferred_work(priv);
-
        /* Wipe out the EXIT_PENDING status bit if we are not actually
         * exiting the module */
        if (!exit_pending)
@@ -6677,6 +6675,8 @@ static void iwl_down(struct iwl_priv *priv)
        mutex_lock(&priv->mutex);
        __iwl_down(priv);
        mutex_unlock(&priv->mutex);
+
+       iwl_cancel_deferred_work(priv);
 }
 
 #define MAX_HW_RESTARTS 5
@@ -9174,10 +9174,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
 
        IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
 
-       mutex_lock(&priv->mutex);
        set_bit(STATUS_EXIT_PENDING, &priv->status);
-       __iwl_down(priv);
-       mutex_unlock(&priv->mutex);
+
+       iwl_down(priv);
 
        /* Free MAC hash list for ADHOC */
        for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
@@ -9236,12 +9235,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct iwl_priv *priv = pci_get_drvdata(pdev);
 
-       mutex_lock(&priv->mutex);
-
        set_bit(STATUS_IN_SUSPEND, &priv->status);
 
        /* Take down the device; powers it off, etc. */
-       __iwl_down(priv);
+       iwl_down(priv);
 
        if (priv->mac80211_registered)
                ieee80211_stop_queues(priv->hw);
@@ -9250,8 +9247,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        pci_disable_device(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
 
-       mutex_unlock(&priv->mutex);
-
        return 0;
 }
 
@@ -9309,8 +9304,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
 
        printk(KERN_INFO "Coming out of suspend...\n");
 
-       mutex_lock(&priv->mutex);
-
        pci_set_power_state(pdev, PCI_D0);
        err = pci_enable_device(pdev);
        pci_restore_state(pdev);
@@ -9324,7 +9317,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
        pci_write_config_byte(pdev, 0x41, 0x00);
 
        iwl_resume(priv);
-       mutex_unlock(&priv->mutex);
 
        return 0;
 }
index e454ae8..bd1ab3b 100644 (file)
@@ -38,6 +38,8 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
        {USB_DEVICE(0x0846, 0x6a00)},
        /* HP */
        {USB_DEVICE(0x03f0, 0xca02)},
+       /* Sitecom */
+       {USB_DEVICE(0x0df6, 0x000d)},
        {}
 };
 
index 87f002a..fe6ff3e 100644 (file)
@@ -265,10 +265,10 @@ enum yellowfin_offsets {
 /* The Yellowfin Rx and Tx buffer descriptors.
    Elements are written as 32 bit for endian portability. */
 struct yellowfin_desc {
-       u32 dbdma_cmd;
-       u32 addr;
-       u32 branch_addr;
-       u32 result_status;
+       __le32 dbdma_cmd;
+       __le32 addr;
+       __le32 branch_addr;
+       __le32 result_status;
 };
 
 struct tx_status_words {
@@ -922,7 +922,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
                        dev->stats.tx_packets++;
                        dev->stats.tx_bytes += skb->len;
                        /* Free the original skb. */
-                       pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr,
+                       pci_unmap_single(yp->pci_dev, le32_to_cpu(yp->tx_ring[entry].addr),
                                skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb_irq(skb);
                        yp->tx_skbuff[entry] = NULL;
@@ -1056,13 +1056,13 @@ static int yellowfin_rx(struct net_device *dev)
 
                if(!desc->result_status)
                        break;
-               pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr,
+               pci_dma_sync_single_for_cpu(yp->pci_dev, le32_to_cpu(desc->addr),
                        yp->rx_buf_sz, PCI_DMA_FROMDEVICE);
                desc_status = le32_to_cpu(desc->result_status) >> 16;
                buf_addr = rx_skb->data;
                data_size = (le32_to_cpu(desc->dbdma_cmd) -
                        le32_to_cpu(desc->result_status)) & 0xffff;
-               frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2])));
+               frame_status = le16_to_cpu(get_unaligned((__le16*)&(buf_addr[data_size - 2])));
                if (yellowfin_debug > 4)
                        printk(KERN_DEBUG "  yellowfin_rx() status was %4.4x.\n",
                                   frame_status);
@@ -1123,7 +1123,7 @@ static int yellowfin_rx(struct net_device *dev)
                        if (pkt_len > rx_copybreak) {
                                skb_put(skb = rx_skb, pkt_len);
                                pci_unmap_single(yp->pci_dev,
-                                       yp->rx_ring[entry].addr,
+                                       le32_to_cpu(yp->rx_ring[entry].addr),
                                        yp->rx_buf_sz,
                                        PCI_DMA_FROMDEVICE);
                                yp->rx_skbuff[entry] = NULL;
@@ -1134,9 +1134,10 @@ static int yellowfin_rx(struct net_device *dev)
                                skb_reserve(skb, 2);    /* 16 byte align the IP header */
                                skb_copy_to_linear_data(skb, rx_skb->data, pkt_len);
                                skb_put(skb, pkt_len);
-                               pci_dma_sync_single_for_device(yp->pci_dev, desc->addr,
-                                                                                          yp->rx_buf_sz,
-                                                                                          PCI_DMA_FROMDEVICE);
+                               pci_dma_sync_single_for_device(yp->pci_dev,
+                                                               le32_to_cpu(desc->addr),
+                                                               yp->rx_buf_sz,
+                                                               PCI_DMA_FROMDEVICE);
                        }
                        skb->protocol = eth_type_trans(skb, dev);
                        netif_rx(skb);
@@ -1252,7 +1253,7 @@ static int yellowfin_close(struct net_device *dev)
        /* Free all the skbuffs in the Rx queue. */
        for (i = 0; i < RX_RING_SIZE; i++) {
                yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP);
-               yp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */
+               yp->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
                if (yp->rx_skbuff[i]) {
                        dev_kfree_skb(yp->rx_skbuff[i]);
                }
index 2f75d69..c5ca313 100644 (file)
@@ -455,22 +455,6 @@ struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int
        return child;
 }
 
-static void pci_enable_crs(struct pci_dev *dev)
-{
-       u16 cap, rpctl;
-       int rpcap = pci_find_capability(dev, PCI_CAP_ID_EXP);
-       if (!rpcap)
-               return;
-
-       pci_read_config_word(dev, rpcap + PCI_CAP_FLAGS, &cap);
-       if (((cap & PCI_EXP_FLAGS_TYPE) >> 4) != PCI_EXP_TYPE_ROOT_PORT)
-               return;
-
-       pci_read_config_word(dev, rpcap + PCI_EXP_RTCTL, &rpctl);
-       rpctl |= PCI_EXP_RTCTL_CRSSVE;
-       pci_write_config_word(dev, rpcap + PCI_EXP_RTCTL, rpctl);
-}
-
 static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max)
 {
        struct pci_bus *parent = child->parent;
@@ -517,8 +501,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
        pci_write_config_word(dev, PCI_BRIDGE_CONTROL,
                              bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT);
 
-       pci_enable_crs(dev);
-
        if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus) {
                unsigned int cmax, busnr;
                /*
index 1510d6c..4a05802 100644 (file)
@@ -213,7 +213,7 @@ static struct pcmcia_low_level lubbock_pcmcia_ops = {
 
 #include "pxa2xx_base.h"
 
-int __init pcmcia_lubbock_init(struct sa1111_dev *sadev)
+int pcmcia_lubbock_init(struct sa1111_dev *sadev)
 {
        int ret = -ENODEV;
 
index 9dea585..bb8d5b1 100644 (file)
@@ -1074,7 +1074,6 @@ static int ps3_vuart_probe(struct ps3_system_bus_device *dev)
        if (result) {
                dev_dbg(&dev->core, "%s:%d: drv->probe failed\n",
                        __func__, __LINE__);
-               down(&vuart_bus_priv.probe_mutex);
                goto fail_probe;
        }
 
index 0fb1709..7ceb820 100644 (file)
@@ -59,7 +59,6 @@
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_dbg.h>
 #include <scsi/scsi_device.h>
-#include <scsi/scsi_driver.h>
 #include <scsi/scsi_eh.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_tcq.h>
@@ -368,8 +367,9 @@ void scsi_log_send(struct scsi_cmnd *cmd)
                        scsi_print_command(cmd);
                        if (level > 3) {
                                printk(KERN_INFO "buffer = 0x%p, bufflen = %d,"
-                                      " queuecommand 0x%p\n",
+                                      " done = 0x%p, queuecommand 0x%p\n",
                                        scsi_sglist(cmd), scsi_bufflen(cmd),
+                                       cmd->done,
                                        cmd->device->host->hostt->queuecommand);
 
                        }
@@ -654,12 +654,6 @@ void __scsi_done(struct scsi_cmnd *cmd)
        blk_complete_request(rq);
 }
 
-/* Move this to a header if it becomes more generally useful */
-static struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
-{
-       return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
-}
-
 /*
  * Function:    scsi_finish_command
  *
@@ -671,8 +665,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
 {
        struct scsi_device *sdev = cmd->device;
        struct Scsi_Host *shost = sdev->host;
-       struct scsi_driver *drv;
-       unsigned int good_bytes;
 
        scsi_device_unbusy(sdev);
 
@@ -698,13 +690,7 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
                                "Notifying upper driver of completion "
                                "(result %x)\n", cmd->result));
 
-       good_bytes = cmd->request_bufflen;
-        if (cmd->request->cmd_type != REQ_TYPE_BLOCK_PC) {
-               drv = scsi_cmd_to_driver(cmd);
-               if (drv->done)
-                       good_bytes = drv->done(cmd);
-       }
-       scsi_io_completion(cmd, good_bytes);
+       cmd->done(cmd);
 }
 EXPORT_SYMBOL(scsi_finish_command);
 
index ebaca4c..70700b9 100644 (file)
@@ -1699,6 +1699,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
        memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd));
     
        scmd->scsi_done         = scsi_reset_provider_done_command;
+       scmd->done                      = NULL;
        scmd->request_buffer            = NULL;
        scmd->request_bufflen           = 0;
 
index 0e81e4c..60f77c4 100644 (file)
@@ -1092,6 +1092,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
        }
        scsi_end_request(cmd, 0, this_count, !result);
 }
+EXPORT_SYMBOL(scsi_io_completion);
 
 /*
  * Function:    scsi_init_io()
@@ -1170,6 +1171,18 @@ static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev,
        return cmd;
 }
 
+static void scsi_blk_pc_done(struct scsi_cmnd *cmd)
+{
+       BUG_ON(!blk_pc_request(cmd->request));
+       /*
+        * This will complete the whole command with uptodate=1 so
+        * as far as the block layer is concerned the command completed
+        * successfully. Since this is a REQ_BLOCK_PC command the
+        * caller should check the request's errors value
+        */
+       scsi_io_completion(cmd, cmd->request_bufflen);
+}
+
 int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req)
 {
        struct scsi_cmnd *cmd;
@@ -1219,6 +1232,7 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req)
        cmd->transfersize = req->data_len;
        cmd->allowed = req->retries;
        cmd->timeout_per_command = req->timeout;
+       cmd->done = scsi_blk_pc_done;
        return BLKPREP_OK;
 }
 EXPORT_SYMBOL(scsi_setup_blk_pc_cmnd);
@@ -1332,7 +1346,7 @@ int scsi_prep_return(struct request_queue *q, struct request *req, int ret)
 }
 EXPORT_SYMBOL(scsi_prep_return);
 
-static int scsi_prep_fn(struct request_queue *q, struct request *req)
+int scsi_prep_fn(struct request_queue *q, struct request *req)
 {
        struct scsi_device *sdev = q->queuedata;
        int ret = BLKPREP_KILL;
index eff0059..1de52b6 100644 (file)
@@ -68,12 +68,14 @@ extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
 extern void scsi_device_unbusy(struct scsi_device *sdev);
 extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
 extern void scsi_next_command(struct scsi_cmnd *cmd);
-extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
 extern void scsi_run_host_queues(struct Scsi_Host *shost);
 extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
 extern void scsi_free_queue(struct request_queue *q);
 extern int scsi_init_queue(void);
 extern void scsi_exit_queue(void);
+struct request_queue;
+struct request;
+extern int scsi_prep_fn(struct request_queue *, struct request *);
 
 /* scsi_proc.c */
 #ifdef CONFIG_SCSI_PROC_FS
index f374fdc..00b3866 100644 (file)
@@ -373,12 +373,29 @@ static int scsi_bus_resume(struct device * dev)
        return err;
 }
 
+static int scsi_bus_remove(struct device *dev)
+{
+       struct device_driver *drv = dev->driver;
+       struct scsi_device *sdev = to_scsi_device(dev);
+       int err = 0;
+
+       /* reset the prep_fn back to the default since the
+        * driver may have altered it and it's being removed */
+       blk_queue_prep_rq(sdev->request_queue, scsi_prep_fn);
+
+       if (drv && drv->remove)
+               err = drv->remove(dev);
+
+       return 0;
+}
+
 struct bus_type scsi_bus_type = {
         .name          = "scsi",
         .match         = scsi_bus_match,
        .uevent         = scsi_bus_uevent,
        .suspend        = scsi_bus_suspend,
        .resume         = scsi_bus_resume,
+       .remove         = scsi_bus_remove,
 };
 
 int scsi_sysfs_register(void)
index a69b155..cb85296 100644 (file)
@@ -86,19 +86,6 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_DISK);
 MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD);
 MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC);
 
-static int  sd_revalidate_disk(struct gendisk *);
-static int  sd_probe(struct device *);
-static int  sd_remove(struct device *);
-static void sd_shutdown(struct device *);
-static int sd_suspend(struct device *, pm_message_t state);
-static int sd_resume(struct device *);
-static void sd_rescan(struct device *);
-static int sd_done(struct scsi_cmnd *);
-static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
-static void scsi_disk_release(struct class_device *cdev);
-static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
-static void sd_print_result(struct scsi_disk *, int);
-
 static DEFINE_IDR(sd_index_idr);
 static DEFINE_SPINLOCK(sd_index_lock);
 
@@ -253,7 +240,6 @@ static struct scsi_driver sd_template = {
                .shutdown       = sd_shutdown,
        },
        .rescan                 = sd_rescan,
-       .done                   = sd_done,
 };
 
 /*
@@ -522,6 +508,12 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
        SCpnt->allowed = SD_MAX_RETRIES;
        SCpnt->timeout_per_command = timeout;
 
+       /*
+        * This is the completion routine we use.  This is matched in terms
+        * of capability to this function.
+        */
+       SCpnt->done = sd_rw_intr;
+
        /*
         * This indicates that the command is ready from our end to be
         * queued.
@@ -895,13 +887,13 @@ static struct block_device_operations sd_fops = {
 };
 
 /**
- *     sd_done - bottom half handler: called when the lower level
+ *     sd_rw_intr - bottom half handler: called when the lower level
  *     driver has completed (successfully or otherwise) a scsi command.
  *     @SCpnt: mid-level's per command structure.
  *
  *     Note: potentially run from within an ISR. Must not block.
  **/
-static int sd_done(struct scsi_cmnd *SCpnt)
+static void sd_rw_intr(struct scsi_cmnd * SCpnt)
 {
        int result = SCpnt->result;
        unsigned int xfer_size = SCpnt->request_bufflen;
@@ -922,7 +914,7 @@ static int sd_done(struct scsi_cmnd *SCpnt)
        SCSI_LOG_HLCOMPLETE(1, scsi_print_result(SCpnt));
        if (sense_valid) {
                SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt,
-                                                  "sd_done: sb[respc,sk,asc,"
+                                                  "sd_rw_intr: sb[respc,sk,asc,"
                                                   "ascq]=%x,%x,%x,%x\n",
                                                   sshdr.response_code,
                                                   sshdr.sense_key, sshdr.asc,
@@ -994,7 +986,7 @@ static int sd_done(struct scsi_cmnd *SCpnt)
                break;
        }
  out:
-       return good_bytes;
+       scsi_io_completion(SCpnt, good_bytes);
 }
 
 static int media_not_present(struct scsi_disk *sdkp,
index c619990..a0c4e13 100644 (file)
@@ -78,7 +78,6 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_WORM);
 
 static int sr_probe(struct device *);
 static int sr_remove(struct device *);
-static int sr_done(struct scsi_cmnd *);
 
 static struct scsi_driver sr_template = {
        .owner                  = THIS_MODULE,
@@ -87,7 +86,6 @@ static struct scsi_driver sr_template = {
                .probe          = sr_probe,
                .remove         = sr_remove,
        },
-       .done                   = sr_done,
 };
 
 static unsigned long sr_index_bits[SR_DISKS / BITS_PER_LONG];
@@ -210,12 +208,12 @@ static int sr_media_change(struct cdrom_device_info *cdi, int slot)
 }
  
 /*
- * sr_done is the interrupt routine for the device driver.
+ * rw_intr is the interrupt routine for the device driver.
  *
- * It will be notified on the end of a SCSI read / write, and will take one
+ * It will be notified on the end of a SCSI read / write, and will take on
  * of several actions based on success or failure.
  */
-static int sr_done(struct scsi_cmnd *SCpnt)
+static void rw_intr(struct scsi_cmnd * SCpnt)
 {
        int result = SCpnt->result;
        int this_count = SCpnt->request_bufflen;
@@ -288,7 +286,12 @@ static int sr_done(struct scsi_cmnd *SCpnt)
                }
        }
 
-       return good_bytes;
+       /*
+        * This calls the generic completion function, now that we know
+        * how many actual sectors finished, and how many sectors we need
+        * to say have failed.
+        */
+       scsi_io_completion(SCpnt, good_bytes);
 }
 
 static int sr_prep_fn(struct request_queue *q, struct request *rq)
@@ -424,6 +427,12 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq)
        SCpnt->allowed = MAX_RETRIES;
        SCpnt->timeout_per_command = timeout;
 
+       /*
+        * This is the completion routine we use.  This is matched in terms
+        * of capability to this function.
+        */
+       SCpnt->done = rw_intr;
+
        /*
         * This indicates that the command is ready from our end to be
         * queued.
index 707c5b0..a2d4a19 100644 (file)
@@ -52,7 +52,7 @@ void sunserial_unregister_minors(struct uart_driver *drv, int count)
 }
 EXPORT_SYMBOL(sunserial_unregister_minors);
 
-int __init sunserial_console_match(struct console *con, struct device_node *dp,
+int sunserial_console_match(struct console *con, struct device_node *dp,
                            struct uart_driver *drv, int line)
 {
        int off;
index 9bb7f64..038e7d7 100644 (file)
@@ -1318,7 +1318,7 @@ static void setup_received_irq(struct fsl_udc *udc,
                                | USB_TYPE_STANDARD)) {
                        /* Note: The driver has not include OTG support yet.
                         * This will be set when OTG support is added */
-                       if (!gadget_is_otg(udc->gadget))
+                       if (!gadget_is_otg(&udc->gadget))
                                break;
                        else if (setup->bRequest == USB_DEVICE_B_HNP_ENABLE)
                                udc->gadget.b_hnp_enable = 1;
index da16b51..2283358 100644 (file)
@@ -55,6 +55,7 @@ static int debug;
 static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */
        { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */
+       { USB_DEVICE(0x0FCF, 0x1004) }, /* Dynastream ANT2USB */
        { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */
        { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */
        { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */
index e5c2740..c295d04 100644 (file)
@@ -109,6 +109,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
        { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
        { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */
+       { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */
        { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
        { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/
        { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/
@@ -146,6 +147,7 @@ static struct usb_device_id id_table_3port [] = {
        { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
        { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
        { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */
+       { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */
        { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
        { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/
        { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/
index 686ab63..cee7c6f 100644 (file)
@@ -827,6 +827,18 @@ static inline void dquot_decr_space(struct dquot *dquot, qsize_t number)
        clear_bit(DQ_BLKS_B, &dquot->dq_flags);
 }
 
+static int warning_issued(struct dquot *dquot, const int warntype)
+{
+       int flag = (warntype == QUOTA_NL_BHARDWARN ||
+               warntype == QUOTA_NL_BSOFTLONGWARN) ? DQ_BLKS_B :
+               ((warntype == QUOTA_NL_IHARDWARN ||
+               warntype == QUOTA_NL_ISOFTLONGWARN) ? DQ_INODES_B : 0);
+
+       if (!flag)
+               return 0;
+       return test_and_set_bit(flag, &dquot->dq_flags);
+}
+
 #ifdef CONFIG_PRINT_QUOTA_WARNING
 static int flag_print_warnings = 1;
 
@@ -845,16 +857,12 @@ static inline int need_print_warning(struct dquot *dquot)
 }
 
 /* Print warning to user which exceeded quota */
-static void print_warning(struct dquot *dquot, const char warntype)
+static void print_warning(struct dquot *dquot, const int warntype)
 {
        char *msg = NULL;
        struct tty_struct *tty;
-       int flag = (warntype == QUOTA_NL_BHARDWARN ||
-               warntype == QUOTA_NL_BSOFTLONGWARN) ? DQ_BLKS_B :
-               ((warntype == QUOTA_NL_IHARDWARN ||
-               warntype == QUOTA_NL_ISOFTLONGWARN) ? DQ_INODES_B : 0);
 
-       if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags)))
+       if (!need_print_warning(dquot))
                return;
 
        mutex_lock(&tty_mutex);
@@ -895,9 +903,6 @@ out_lock:
 
 #ifdef CONFIG_QUOTA_NETLINK_INTERFACE
 
-/* Size of quota netlink message - actually an upperbound for buffer size */
-#define QUOTA_NL_MSG_SIZE 32
-
 /* Netlink family structure for quota */
 static struct genl_family quota_genl_family = {
        .id = GENL_ID_GENERATE,
@@ -914,11 +919,13 @@ static void send_warning(const struct dquot *dquot, const char warntype)
        struct sk_buff *skb;
        void *msg_head;
        int ret;
+       int msg_size = 4 * nla_total_size(sizeof(u32)) +
+                      2 * nla_total_size(sizeof(u64));
 
        /* We have to allocate using GFP_NOFS as we are called from a
         * filesystem performing write and thus further recursion into
         * the fs to free some data could cause deadlocks. */
-       skb = genlmsg_new(QUOTA_NL_MSG_SIZE, GFP_NOFS);
+       skb = genlmsg_new(msg_size, GFP_NOFS);
        if (!skb) {
                printk(KERN_ERR
                  "VFS: Not enough memory to send quota warning.\n");
@@ -959,7 +966,7 @@ static void send_warning(const struct dquot *dquot, const char warntype)
                        "VFS: Failed to send notification message: %d\n", ret);
        return;
 attr_err_out:
-       printk(KERN_ERR "VFS: Failed to compose quota message: %d\n", ret);
+       printk(KERN_ERR "VFS: Not enough space to compose quota message!\n");
 err_out:
        kfree_skb(skb);
 }
@@ -970,7 +977,8 @@ static inline void flush_warnings(struct dquot * const *dquots, char *warntype)
        int i;
 
        for (i = 0; i < MAXQUOTAS; i++)
-               if (dquots[i] != NODQUOT && warntype[i] != QUOTA_NL_NOWARN) {
+               if (dquots[i] != NODQUOT && warntype[i] != QUOTA_NL_NOWARN &&
+                   !warning_issued(dquots[i], warntype[i])) {
 #ifdef CONFIG_PRINT_QUOTA_WARNING
                        print_warning(dquots[i], warntype[i]);
 #endif
index bbed2fd..f8ef0af 100644 (file)
@@ -799,7 +799,7 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat)
        rc = ecryptfs_crypto_api_algify_cipher_name(&full_alg_name,
                                                    crypt_stat->cipher, "cbc");
        if (rc)
-               goto out;
+               goto out_unlock;
        crypt_stat->tfm = crypto_alloc_blkcipher(full_alg_name, 0,
                                                 CRYPTO_ALG_ASYNC);
        kfree(full_alg_name);
@@ -808,12 +808,12 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat)
                ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): "
                                "Error initializing cipher [%s]\n",
                                crypt_stat->cipher);
-               mutex_unlock(&crypt_stat->cs_tfm_mutex);
-               goto out;
+               goto out_unlock;
        }
        crypto_blkcipher_set_flags(crypt_stat->tfm, CRYPTO_TFM_REQ_WEAK_KEY);
-       mutex_unlock(&crypt_stat->cs_tfm_mutex);
        rc = 0;
+out_unlock:
+       mutex_unlock(&crypt_stat->cs_tfm_mutex);
 out:
        return rc;
 }
@@ -1847,6 +1847,7 @@ ecryptfs_add_new_key_tfm(struct ecryptfs_key_tfm **key_tfm, char *cipher_name,
        mutex_init(&tmp_tfm->key_tfm_mutex);
        strncpy(tmp_tfm->cipher_name, cipher_name,
                ECRYPTFS_MAX_CIPHER_NAME_SIZE);
+       tmp_tfm->cipher_name[ECRYPTFS_MAX_CIPHER_NAME_SIZE] = '\0';
        tmp_tfm->key_size = key_size;
        rc = ecryptfs_process_key_cipher(&tmp_tfm->key_tfm,
                                         tmp_tfm->cipher_name,
index a277754..e5580bc 100644 (file)
@@ -138,11 +138,14 @@ int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry)
                inode_info->lower_file = dentry_open(lower_dentry,
                                                     lower_mnt,
                                                     (O_RDWR | O_LARGEFILE));
-               if (IS_ERR(inode_info->lower_file))
+               if (IS_ERR(inode_info->lower_file)) {
+                       dget(lower_dentry);
+                       mntget(lower_mnt);
                        inode_info->lower_file = dentry_open(lower_dentry,
                                                             lower_mnt,
                                                             (O_RDONLY
                                                              | O_LARGEFILE));
+               }
                if (IS_ERR(inode_info->lower_file)) {
                        printk(KERN_ERR "Error opening lower persistent file "
                               "for lower_dentry [0x%p] and lower_mnt [0x%p]\n",
index a96d341..9cc2aec 100644 (file)
@@ -427,6 +427,7 @@ int ecryptfs_init_messaging(unsigned int transport)
        if (!ecryptfs_daemon_id_hash) {
                rc = -ENOMEM;
                ecryptfs_printk(KERN_ERR, "Failed to allocate memory\n");
+               mutex_unlock(&ecryptfs_daemon_id_hash_mux);
                goto out;
        }
        for (i = 0; i < ecryptfs_hash_buckets; i++)
index f03d9d5..9e2e1c7 100644 (file)
@@ -741,10 +741,10 @@ static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata)
        if (data->rpc_status == 0) {
                memcpy(data->o_res.stateid.data, data->c_res.stateid.data,
                                sizeof(data->o_res.stateid.data));
+               nfs_confirm_seqid(&data->owner->so_seqid, 0);
                renew_lease(data->o_res.server, data->timestamp);
                data->rpc_done = 1;
        }
-       nfs_confirm_seqid(&data->owner->so_seqid, data->rpc_status);
        nfs_increment_open_seqid(data->rpc_status, data->c_arg.seqid);
 }
 
@@ -759,7 +759,6 @@ static void nfs4_open_confirm_release(void *calldata)
        /* In case of error, no cleanup! */
        if (!data->rpc_done)
                goto out_free;
-       nfs_confirm_seqid(&data->owner->so_seqid, 0);
        state = nfs4_opendata_to_nfs4_state(data);
        if (!IS_ERR(state))
                nfs4_close_state(&data->path, state, data->o_arg.open_flags);
@@ -886,7 +885,6 @@ static void nfs4_open_release(void *calldata)
        /* In case we need an open_confirm, no cleanup! */
        if (data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM)
                goto out_free;
-       nfs_confirm_seqid(&data->owner->so_seqid, 0);
        state = nfs4_opendata_to_nfs4_state(data);
        if (!IS_ERR(state))
                nfs4_close_state(&data->path, state, data->o_arg.open_flags);
@@ -3333,6 +3331,12 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
 
        p->arg.fh = NFS_FH(inode);
        p->arg.fl = &p->fl;
+       if (!(lsp->ls_seqid.flags & NFS_SEQID_CONFIRMED)) {
+               p->arg.open_seqid = nfs_alloc_seqid(&lsp->ls_state->owner->so_seqid);
+               if (p->arg.open_seqid == NULL)
+                       goto out_free;
+
+       }
        p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid);
        if (p->arg.lock_seqid == NULL)
                goto out_free;
@@ -3345,6 +3349,8 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
        memcpy(&p->fl, fl, sizeof(p->fl));
        return p;
 out_free:
+       if (p->arg.open_seqid != NULL)
+               nfs_free_seqid(p->arg.open_seqid);
        kfree(p);
        return NULL;
 }
@@ -3361,23 +3367,23 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
                .rpc_cred = sp->so_cred,
        };
 
-       if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
-               return;
        dprintk("%s: begin!\n", __FUNCTION__);
        /* Do we need to do an open_to_lock_owner? */
        if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) {
-               data->arg.open_seqid = nfs_alloc_seqid(&sp->so_seqid);
-               if (data->arg.open_seqid == NULL) {
-                       data->rpc_status = -ENOMEM;
-                       task->tk_action = NULL;
-                       goto out;
-               }
+               if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0)
+                       return;
                data->arg.open_stateid = &state->stateid;
                data->arg.new_lock_owner = 1;
+               /* Retest in case we raced... */
+               if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED))
+                       goto do_rpc;
        }
+       if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
+               return;
+       data->arg.new_lock_owner = 0;
+do_rpc:        
        data->timestamp = jiffies;
        rpc_call_setup(task, &msg, 0);
-out:
        dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status);
 }
 
@@ -3413,8 +3419,6 @@ static void nfs4_lock_release(void *calldata)
        struct nfs4_lockdata *data = calldata;
 
        dprintk("%s: begin!\n", __FUNCTION__);
-       if (data->arg.open_seqid != NULL)
-               nfs_free_seqid(data->arg.open_seqid);
        if (data->cancelled != 0) {
                struct rpc_task *task;
                task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp,
@@ -3424,6 +3428,8 @@ static void nfs4_lock_release(void *calldata)
                dprintk("%s: cancelling lock!\n", __FUNCTION__);
        } else
                nfs_free_seqid(data->arg.lock_seqid);
+       if (data->arg.open_seqid != NULL)
+               nfs_free_seqid(data->arg.open_seqid);
        nfs4_put_lock_state(data->lsp);
        put_nfs_open_context(data->ctx);
        kfree(data);
index 3ea352d..5e2e4af 100644 (file)
@@ -133,9 +133,7 @@ nfs4_renewd_prepare_shutdown(struct nfs_server *server)
 void
 nfs4_kill_renewd(struct nfs_client *clp)
 {
-       down_read(&clp->cl_sem);
        cancel_delayed_work_sync(&clp->cl_renewd);
-       up_read(&clp->cl_sem);
 }
 
 /*
index ea92920..0b0c72a 100644 (file)
@@ -1475,7 +1475,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
                error = PTR_ERR(mntroot);
                goto error_splat_super;
        }
-       if (mntroot->d_inode->i_op != server->nfs_client->rpc_ops->dir_inode_ops) {
+       if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
                dput(mntroot);
                error = -ESTALE;
                goto error_splat_super;
@@ -1826,6 +1826,11 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
                error = PTR_ERR(mntroot);
                goto error_splat_super;
        }
+       if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
+               dput(mntroot);
+               error = -ESTALE;
+               goto error_splat_super;
+       }
 
        s->s_flags |= MS_ACTIVE;
        mnt->mnt_sb = s;
@@ -1900,6 +1905,11 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
                error = PTR_ERR(mntroot);
                goto error_splat_super;
        }
+       if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
+               dput(mntroot);
+               error = -ESTALE;
+               goto error_splat_super;
+       }
 
        s->s_flags |= MS_ACTIVE;
        mnt->mnt_sb = s;
index 02a63ac..7411bfb 100644 (file)
@@ -202,6 +202,26 @@ static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vf
         (task->state == TASK_STOPPED || task->state == TASK_TRACED) && \
         security_ptrace(current,task) == 0))
 
+struct mm_struct *mm_for_maps(struct task_struct *task)
+{
+       struct mm_struct *mm = get_task_mm(task);
+       if (!mm)
+               return NULL;
+       down_read(&mm->mmap_sem);
+       task_lock(task);
+       if (task->mm != mm)
+               goto out;
+       if (task->mm != current->mm && __ptrace_may_attach(task) < 0)
+               goto out;
+       task_unlock(task);
+       return mm;
+out:
+       task_unlock(task);
+       up_read(&mm->mmap_sem);
+       mmput(mm);
+       return NULL;
+}
+
 static int proc_pid_cmdline(struct task_struct *task, char * buffer)
 {
        int res = 0;
index 1820eb2..05b3e90 100644 (file)
@@ -27,6 +27,8 @@ struct vmalloc_info {
        unsigned long   largest_chunk;
 };
 
+extern struct mm_struct *mm_for_maps(struct task_struct *);
+
 #ifdef CONFIG_MMU
 #define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
 extern void get_vmalloc_info(struct vmalloc_info *vmi);
index e0d064e..3462bfd 100644 (file)
@@ -410,7 +410,7 @@ static const struct file_operations proc_modules_operations = {
 };
 #endif
 
-#ifdef CONFIG_SLAB
+#ifdef CONFIG_SLABINFO
 static int slabinfo_open(struct inode *inode, struct file *file)
 {
        return seq_open(file, &slabinfo_op);
@@ -728,7 +728,7 @@ void __init proc_misc_init(void)
 #endif
        create_seq_entry("stat", 0, &proc_stat_operations);
        create_seq_entry("interrupts", 0, &proc_interrupts_operations);
-#ifdef CONFIG_SLAB
+#ifdef CONFIG_SLABINFO
        create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
 #ifdef CONFIG_DEBUG_SLAB_LEAK
        create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations);
index c24d81a..8043a3e 100644 (file)
@@ -397,12 +397,11 @@ static void *m_start(struct seq_file *m, loff_t *pos)
        if (!priv->task)
                return NULL;
 
-       mm = get_task_mm(priv->task);
+       mm = mm_for_maps(priv->task);
        if (!mm)
                return NULL;
 
        priv->tail_vma = tail_vma = get_gate_vma(priv->task);
-       down_read(&mm->mmap_sem);
 
        /* Start with last addr hint */
        if (last_addr && (vma = find_vma(mm, last_addr))) {
index d8b8c71..1932c2c 100644 (file)
@@ -165,15 +165,13 @@ static void *m_start(struct seq_file *m, loff_t *pos)
        if (!priv->task)
                return NULL;
 
-       mm = get_task_mm(priv->task);
+       mm = mm_for_maps(priv->task);
        if (!mm) {
                put_task_struct(priv->task);
                priv->task = NULL;
                return NULL;
        }
 
-       down_read(&mm->mmap_sem);
-
        /* start from the Nth VMA */
        for (vml = mm->context.vmlist; vml; vml = vml->next)
                if (n-- == 0)
index 799307e..75f2bfa 100644 (file)
@@ -86,9 +86,6 @@ tlb_flush_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
 static inline void
 tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
 {
-#ifdef CONFIG_QUICKLIST
-       tlb->need_flush += &__get_cpu_var(quicklist)[0].nr_pages != 0;
-#endif
        tlb_flush_mmu(tlb, start, end);
 
        /* keep the page table cache within bounds */
index b1accce..34b7807 100644 (file)
@@ -246,6 +246,7 @@ struct spufs_calls {
                                                __u32 __user *ustatus);
        int (*coredump_extra_notes_size)(void);
        int (*coredump_extra_notes_write)(struct file *file, loff_t *foffset);
+       void (*notify_spus_active)(void);
        struct module *owner;
 };
 
@@ -298,6 +299,9 @@ struct notifier_block;
 int spu_switch_event_register(struct notifier_block * n);
 int spu_switch_event_unregister(struct notifier_block * n);
 
+extern void notify_spus_active(void);
+extern void do_notify_spus_active(void);
+
 /*
  * This defines the Local Store, Problem Area and Privlege Area of an SPU.
  */
index 1fc6554..38cbec7 100644 (file)
@@ -25,15 +25,9 @@ struct dma_ops {
        void (*sync_single_for_cpu)(struct device *dev,
                                    dma_addr_t dma_handle, size_t size,
                                    enum dma_data_direction direction);
-       void (*sync_single_for_device)(struct device *dev,
-                                      dma_addr_t dma_handle, size_t size,
-                                      enum dma_data_direction direction);
        void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg,
                                int nelems,
                                enum dma_data_direction direction);
-       void (*sync_sg_for_device)(struct device *dev, struct scatterlist *sg,
-                                  int nelems,
-                                  enum dma_data_direction direction);
 };
 extern const struct dma_ops *dma_ops;
 
@@ -105,7 +99,7 @@ static inline void dma_sync_single_for_device(struct device *dev,
                                              size_t size,
                                              enum dma_data_direction direction)
 {
-       dma_ops->sync_single_for_device(dev, dma_handle, size, direction);
+       /* No flushing needed to sync cpu writes to the device.  */
 }
 
 static inline void dma_sync_single_range_for_cpu(struct device *dev,
@@ -123,7 +117,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
                                                    size_t size,
                                                    enum dma_data_direction direction)
 {
-       dma_sync_single_for_device(dev, dma_handle+offset, size, direction);
+       /* No flushing needed to sync cpu writes to the device.  */
 }
 
 
@@ -138,7 +132,7 @@ static inline void dma_sync_sg_for_device(struct device *dev,
                                          struct scatterlist *sg, int nelems,
                                          enum dma_data_direction direction)
 {
-       dma_ops->sync_sg_for_device(dev, sg, nelems, direction);
+       /* No flushing needed to sync cpu writes to the device.  */
 }
 
 static inline int dma_mapping_error(dma_addr_t dma_addr)
index 1393e57..f59f257 100644 (file)
@@ -200,6 +200,10 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 struct device_node;
 extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev);
 
+#define HAVE_ARCH_PCI_RESOURCE_TO_USER
+extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
+                                const struct resource *rsrc,
+                                resource_size_t *start, resource_size_t *end);
 #endif /* __KERNEL__ */
 
 #endif /* __SPARC64_PCI_H */
index 1f2d6d5..fe2f2e5 100644 (file)
@@ -30,13 +30,13 @@ static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val)
        } v;
        v.u = val;
 #ifdef CONFIG_X86_BSWAP
-       asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
+       __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
            : "=r" (v.s.a), "=r" (v.s.b)
            : "0" (v.s.a), "1" (v.s.b));
 #else
        v.s.a = ___arch__swab32(v.s.a);
        v.s.b = ___arch__swab32(v.s.b);
-       asm("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b));
+       __asm__("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b));
 #endif
        return v.u;
 }
index ba4b314..664a2fa 100644 (file)
@@ -191,38 +191,6 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
 
 #define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32)
 
-/* wrmsr with exception handling */
-#define wrmsr_safe(msr,a,b) ({ int ret__;                      \
-       asm volatile("2: wrmsr ; xorl %0,%0\n"                  \
-                    "1:\n\t"                                   \
-                    ".section .fixup,\"ax\"\n\t"               \
-                    "3:  movl %4,%0 ; jmp 1b\n\t"              \
-                    ".previous\n\t"                            \
-                    ".section __ex_table,\"a\"\n"              \
-                    "   .align 8\n\t"                          \
-                    "   .quad  2b,3b\n\t"                      \
-                    ".previous"                                \
-                    : "=a" (ret__)                             \
-                    : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT)); \
-       ret__; })
-
-#define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32))
-
-#define rdmsr_safe(msr,a,b) \
-       ({ int ret__;                                           \
-         asm volatile ("1:       rdmsr\n"                      \
-                       "2:\n"                                  \
-                       ".section .fixup,\"ax\"\n"              \
-                       "3:       movl %4,%0\n"                 \
-                       " jmp 2b\n"                             \
-                       ".previous\n"                           \
-                       ".section __ex_table,\"a\"\n"           \
-                       " .align 8\n"                           \
-                       " .quad 1b,3b\n"                                \
-                       ".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b)) \
-                       :"c"(msr), "i"(-EIO), "0"(0));                  \
-         ret__; })
-
 #define rdtsc(low,high) \
      __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
 
@@ -230,17 +198,17 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
      __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")
 
 #define rdtscp(low,high,aux) \
-     asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux))
+     __asm__ __volatile__ (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux))
 
 #define rdtscll(val) do { \
      unsigned int __a,__d; \
-     asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \
+     __asm__ __volatile__("rdtsc" : "=a" (__a), "=d" (__d)); \
      (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \
 } while(0)
 
 #define rdtscpll(val, aux) do { \
      unsigned long __a, __d; \
-     asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \
+     __asm__ __volatile__ (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \
      (val) = (__d << 32) | __a; \
 } while (0)
 
@@ -253,6 +221,7 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
                          : "=a" (low), "=d" (high) \
                          : "c" (counter))
 
+
 static inline void cpuid(int op, unsigned int *eax, unsigned int *ebx,
                         unsigned int *ecx, unsigned int *edx)
 {
@@ -320,6 +289,40 @@ static inline unsigned int cpuid_edx(unsigned int op)
        return edx;
 }
 
+#ifdef __KERNEL__
+
+/* wrmsr with exception handling */
+#define wrmsr_safe(msr,a,b) ({ int ret__;                      \
+       asm volatile("2: wrmsr ; xorl %0,%0\n"                  \
+                    "1:\n\t"                                   \
+                    ".section .fixup,\"ax\"\n\t"               \
+                    "3:  movl %4,%0 ; jmp 1b\n\t"              \
+                    ".previous\n\t"                            \
+                    ".section __ex_table,\"a\"\n"              \
+                    "   .align 8\n\t"                          \
+                    "   .quad  2b,3b\n\t"                      \
+                    ".previous"                                \
+                    : "=a" (ret__)                             \
+                    : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT)); \
+       ret__; })
+
+#define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32))
+
+#define rdmsr_safe(msr,a,b) \
+       ({ int ret__;                                           \
+         asm volatile ("1:       rdmsr\n"                      \
+                       "2:\n"                                  \
+                       ".section .fixup,\"ax\"\n"              \
+                       "3:       movl %4,%0\n"                 \
+                       " jmp 2b\n"                             \
+                       ".previous\n"                           \
+                       ".section __ex_table,\"a\"\n"           \
+                       " .align 8\n"                           \
+                       " .quad 1b,3b\n"                                \
+                       ".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b)) \
+                       :"c"(msr), "i"(-EIO), "0"(0));                  \
+         ret__; })
+
 #ifdef CONFIG_SMP
 void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
 void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
@@ -343,6 +346,7 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
        return wrmsr_safe(msr_no, l, h);
 }
 #endif  /* CONFIG_SMP */
+#endif  /* __KERNEL__ */
 #endif  /* __ASSEMBLY__ */
 
 #endif  /* !__i386__ */
index 9abf5a8..f30fa92 100644 (file)
@@ -153,6 +153,7 @@ header-y += toshiba.h
 header-y += ultrasound.h
 header-y += un.h
 header-y += utime.h
+header-y += veth.h
 header-y += video_decoder.h
 header-y += video_encoder.h
 header-y += videotext.h
index ae8146a..3ea5750 100644 (file)
@@ -97,6 +97,7 @@ extern void __ptrace_link(struct task_struct *child,
 extern void __ptrace_unlink(struct task_struct *child);
 extern void ptrace_untrace(struct task_struct *child);
 extern int ptrace_may_attach(struct task_struct *task);
+extern int __ptrace_may_attach(struct task_struct *task);
 
 static inline void ptrace_link(struct task_struct *child,
                               struct task_struct *new_parent)
index 9371c61..39b6671 100644 (file)
@@ -56,14 +56,6 @@ static inline void __quicklist_free(int nr, void (*dtor)(void *), void *p,
        struct page *page)
 {
        struct quicklist *q;
-       int nid = page_to_nid(page);
-
-       if (unlikely(nid != numa_node_id())) {
-               if (dtor)
-                       dtor(p);
-               __free_page(page);
-               return;
-       }
 
        q = &get_cpu_var(quicklist)[nr];
        *(void **)p = q->page;
index f3a8eec..f62caaa 100644 (file)
@@ -271,5 +271,10 @@ static inline void *kzalloc(size_t size, gfp_t flags)
        return kmalloc(size, flags | __GFP_ZERO);
 }
 
+#ifdef CONFIG_SLABINFO
+extern const struct seq_operations slabinfo_op;
+ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* _LINUX_SLAB_H */
index 32bdc2f..fcc4809 100644 (file)
@@ -95,7 +95,4 @@ found:
 
 #endif /* CONFIG_NUMA */
 
-extern const struct seq_operations slabinfo_op;
-ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
-
 #endif /* _LINUX_SLAB_DEF_H */
index 78dfbac..6dac0d7 100644 (file)
@@ -2,3 +2,4 @@ header-y += tc_gact.h
 header-y += tc_ipt.h
 header-y += tc_mirred.h
 header-y += tc_pedit.h
+header-y += tc_nat.h
diff --git a/include/linux/veth.h b/include/linux/veth.h
new file mode 100644 (file)
index 0000000..3354c1e
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __NET_VETH_H_
+#define __NET_VETH_H_
+
+enum {
+       VETH_INFO_UNSPEC,
+       VETH_INFO_PEER,
+
+       __VETH_INFO_MAX
+#define VETH_INFO_MAX  (__VETH_INFO_MAX - 1)
+};
+
+#endif
index 4e3cd93..32a57e1 100644 (file)
@@ -35,7 +35,7 @@
 #define AX25_P_ATALK                   0xca    /* Appletalk                  */
 #define AX25_P_ATALK_ARP               0xcb    /* Appletalk ARP              */
 #define AX25_P_IP                      0xcc    /* ARPA Internet Protocol     */
-#define AX25_P_ARP                     0xcd    /* ARPA Adress Resolution     */
+#define AX25_P_ARP                     0xcd    /* ARPA Address Resolution    */
 #define AX25_P_FLEXNET                 0xce    /* FlexNet                    */
 #define AX25_P_NETROM                  0xcf    /* NET/ROM                    */
 #define AX25_P_TEXT                    0xF0    /* No layer 3 protocol impl.  */
index 29c9da7..c17fa1f 100644 (file)
@@ -23,7 +23,7 @@ struct ip6_tnl {
        struct net_device *dev; /* virtual device associated with tunnel */
        struct net_device_stats stat;   /* statistics for tunnel device */
        int recursion;          /* depth of hard_start_xmit recursion */
-       struct ip6_tnl_parm parms;      /* tunnel configuration paramters */
+       struct ip6_tnl_parm parms;      /* tunnel configuration parameters */
        struct flowi fl;        /* flowi template for xmit */
        struct dst_entry *dst_cache;    /* cached dst */
        u32 dst_cookie;
index eb0f9de..e4efad1 100644 (file)
@@ -80,7 +80,7 @@ typedef struct discovery_t {
        irda_queue_t    q;              /* Must be first! */
 
        discinfo_t      data;           /* Basic discovery information */
-       int             name_len;       /* Lenght of nickname */
+       int             name_len;       /* Length of nickname */
 
        LAP_REASON      condition;      /* More info about the discovery */
        int             gen_addr_bit;   /* Need to generate a new device
index 90fb66d..4ac5ab1 100644 (file)
@@ -249,6 +249,7 @@ static inline int nf_ct_is_untracked(const struct sk_buff *skb)
        return (skb->nfct == &nf_conntrack_untracked.ct_general);
 }
 
+extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
 extern unsigned int nf_conntrack_htable_size;
 extern int nf_conntrack_checksum;
 extern atomic_t nf_conntrack_count;
index 002a00a..bb96574 100644 (file)
@@ -301,7 +301,7 @@ struct sctp_sock {
        /* The default SACK delay timeout for new associations. */
        __u32 sackdelay;
 
-       /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+       /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
        __u32 param_flags;
 
        struct sctp_initmsg initmsg;
@@ -955,7 +955,7 @@ struct sctp_transport {
        /* PMTU       : The current known path MTU.  */
        __u32 pathmtu;
 
-       /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+       /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
        __u32 param_flags;
 
        /* The number of times INIT has been sent on this transport. */
@@ -1638,7 +1638,7 @@ struct sctp_association {
         */
        __u32 pathmtu;
 
-       /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
+       /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
        __u32 param_flags;
 
        /* SACK delay timeout */
diff --git a/include/net/veth.h b/include/net/veth.h
deleted file mode 100644 (file)
index 3354c1e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __NET_VETH_H_
-#define __NET_VETH_H_
-
-enum {
-       VETH_INFO_UNSPEC,
-       VETH_INFO_PEER,
-
-       __VETH_INFO_MAX
-#define VETH_INFO_MAX  (__VETH_INFO_MAX - 1)
-};
-
-#endif
index 3f47e52..7613c29 100644 (file)
@@ -34,6 +34,7 @@ struct scsi_cmnd {
        struct list_head list;  /* scsi_cmnd participates in queue lists */
        struct list_head eh_entry; /* entry for the host eh_cmd_q */
        int eh_eflags;          /* Used by error handlr */
+       void (*done) (struct scsi_cmnd *);      /* Mid-level done function */
 
        /*
         * A SCSI Command is assigned a nonzero serial_number before passed
@@ -121,6 +122,7 @@ extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t);
 extern void scsi_put_command(struct scsi_cmnd *);
 extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *,
                               struct device *);
+extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
 extern void scsi_finish_command(struct scsi_cmnd *cmd);
 extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd);
 
index 1f5ca7f..56a3047 100644 (file)
@@ -15,7 +15,6 @@ struct scsi_driver {
        struct device_driver    gendrv;
 
        void (*rescan)(struct device *);
-       int (*done)(struct scsi_cmnd *);
 };
 #define to_scsi_driver(drv) \
        container_of((drv), struct scsi_driver, gendrv)
index f751331..aa1e716 100644 (file)
@@ -47,6 +47,19 @@ struct scsi_disk {
 };
 #define to_scsi_disk(obj) container_of(obj,struct scsi_disk,cdev)
 
+static int  sd_revalidate_disk(struct gendisk *disk);
+static void sd_rw_intr(struct scsi_cmnd * SCpnt);
+static int  sd_probe(struct device *);
+static int  sd_remove(struct device *);
+static void sd_shutdown(struct device *dev);
+static int sd_suspend(struct device *dev, pm_message_t state);
+static int sd_resume(struct device *dev);
+static void sd_rescan(struct device *);
+static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
+static void scsi_disk_release(struct class_device *cdev);
+static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
+static void sd_print_result(struct scsi_disk *, int);
+
 #define sd_printk(prefix, sdsk, fmt, a...)                             \
         (sdsk)->disk ?                                                 \
        sdev_printk(prefix, (sdsk)->device, "[%s] " fmt,                \
index 404bbf3..b9d11a8 100644 (file)
@@ -658,6 +658,12 @@ endchoice
 
 endmenu                # General setup
 
+config SLABINFO
+       bool
+       depends on PROC_FS
+       depends on SLAB || SLUB
+       default y
+
 config RT_MUTEXES
        boolean
        select PLIST
index 2a4c514..7686417 100644 (file)
@@ -697,8 +697,18 @@ static struct kset_uevent_ops module_uevent_ops = {
 decl_subsys(module, &module_ktype, &module_uevent_ops);
 int module_sysfs_initialized;
 
+static void module_release(struct kobject *kobj)
+{
+       /*
+        * Stupid empty release function to allow the memory for the kobject to
+        * be properly cleaned up.  This will not need to be present for 2.6.25
+        * with the upcoming kobject core rework.
+        */
+}
+
 static struct kobj_type module_ktype = {
        .sysfs_ops =    &module_sysfs_ops,
+       .release =      module_release,
 };
 
 /*
index a30fe33..89011bf 100644 (file)
@@ -817,7 +817,7 @@ __setup("console=", console_setup);
  * commonly to provide a default console (ie from PROM variables) when
  * the user has not supplied one.
  */
-int __init add_preferred_console(char *name, int idx, char *options)
+int add_preferred_console(char *name, int idx, char *options)
 {
        struct console_cmdline *c;
        int i;
index 7c76f2f..c25db86 100644 (file)
@@ -120,7 +120,7 @@ int ptrace_check_attach(struct task_struct *child, int kill)
        return ret;
 }
 
-static int may_attach(struct task_struct *task)
+int __ptrace_may_attach(struct task_struct *task)
 {
        /* May we inspect the given task?
         * This check is used both for attaching with ptrace
@@ -154,7 +154,7 @@ int ptrace_may_attach(struct task_struct *task)
 {
        int err;
        task_lock(task);
-       err = may_attach(task);
+       err = __ptrace_may_attach(task);
        task_unlock(task);
        return !err;
 }
@@ -196,7 +196,7 @@ repeat:
        /* the same process cannot be attached many times */
        if (task->ptrace & PT_PTRACED)
                goto bad;
-       retval = may_attach(task);
+       retval = __ptrace_may_attach(task);
        if (retval)
                goto bad;
 
index d30467b..80fbbfc 100644 (file)
@@ -31,9 +31,9 @@
 /*
  * Ease the printing of nsec fields:
  */
-static long long nsec_high(long long nsec)
+static long long nsec_high(unsigned long long nsec)
 {
-       if (nsec < 0) {
+       if ((long long)nsec < 0) {
                nsec = -nsec;
                do_div(nsec, 1000000);
                return -nsec;
@@ -43,9 +43,9 @@ static long long nsec_high(long long nsec)
        return nsec;
 }
 
-static unsigned long nsec_low(long long nsec)
+static unsigned long nsec_low(unsigned long long nsec)
 {
-       if (nsec < 0)
+       if ((long long)nsec < 0)
                nsec = -nsec;
 
        return do_div(nsec, 1000000);
index 332d8c5..9508d9a 100644 (file)
@@ -190,6 +190,8 @@ prop_adjust_shift(int *pl_shift, unsigned long *pl_period, int new_shift)
  * PERCPU
  */
 
+#define PROP_BATCH (8*(1+ilog2(nr_cpu_ids)))
+
 int prop_local_init_percpu(struct prop_local_percpu *pl)
 {
        spin_lock_init(&pl->lock);
@@ -230,31 +232,24 @@ void prop_norm_percpu(struct prop_global *pg, struct prop_local_percpu *pl)
 
        spin_lock_irqsave(&pl->lock, flags);
        prop_adjust_shift(&pl->shift, &pl->period, pg->shift);
+
        /*
         * For each missed period, we half the local counter.
         * basically:
         *   pl->events >> (global_period - pl->period);
-        *
-        * but since the distributed nature of percpu counters make division
-        * rather hard, use a regular subtraction loop. This is safe, because
-        * the events will only every be incremented, hence the subtraction
-        * can never result in a negative number.
         */
-       while (pl->period != global_period) {
-               unsigned long val = percpu_counter_read(&pl->events);
-               unsigned long half = (val + 1) >> 1;
-
-               /*
-                * Half of zero won't be much less, break out.
-                * This limits the loop to shift iterations, even
-                * if we missed a million.
-                */
-               if (!val)
-                       break;
-
-               percpu_counter_add(&pl->events, -half);
-               pl->period += period;
-       }
+       period = (global_period - pl->period) >> (pg->shift - 1);
+       if (period < BITS_PER_LONG) {
+               s64 val = percpu_counter_read(&pl->events);
+
+               if (val < (nr_cpu_ids * PROP_BATCH))
+                       val = percpu_counter_sum(&pl->events);
+
+               __percpu_counter_add(&pl->events, -val + (val >> period),
+                                       PROP_BATCH);
+       } else
+               percpu_counter_set(&pl->events, 0);
+
        pl->period = global_period;
        spin_unlock_irqrestore(&pl->lock, flags);
 }
@@ -267,7 +262,7 @@ void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl)
        struct prop_global *pg = prop_get_global(pd);
 
        prop_norm_percpu(pg, pl);
-       percpu_counter_add(&pl->events, 1);
+       __percpu_counter_add(&pl->events, 1, PROP_BATCH);
        percpu_counter_add(&pg->events, 1);
        prop_put_global(pd, pg);
 }
index 2e338a5..aebb9f6 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4105,7 +4105,7 @@ out:
        schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_CPUC));
 }
 
-#ifdef CONFIG_PROC_FS
+#ifdef CONFIG_SLABINFO
 
 static void print_slabinfo_header(struct seq_file *m)
 {
index b9f37cb..474945e 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -172,7 +172,7 @@ static inline void ClearSlabDebug(struct page *page)
  * Mininum number of partial slabs. These will be left on the partial
  * lists even if they are empty. kmem_cache_shrink may reclaim them.
  */
-#define MIN_PARTIAL 2
+#define MIN_PARTIAL 5
 
 /*
  * Maximum number of desirable partial slabs.
@@ -1613,7 +1613,7 @@ checks_ok:
         * then add it.
         */
        if (unlikely(!prior))
-               add_partial(get_node(s, page_to_nid(page)), page);
+               add_partial_tail(get_node(s, page_to_nid(page)), page);
 
 out_unlock:
        slab_unlock(page);
@@ -3076,6 +3076,19 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
        return slab_alloc(s, gfpflags, node, caller);
 }
 
+static unsigned long count_partial(struct kmem_cache_node *n)
+{
+       unsigned long flags;
+       unsigned long x = 0;
+       struct page *page;
+
+       spin_lock_irqsave(&n->list_lock, flags);
+       list_for_each_entry(page, &n->partial, lru)
+               x += page->inuse;
+       spin_unlock_irqrestore(&n->list_lock, flags);
+       return x;
+}
+
 #if defined(CONFIG_SYSFS) && defined(CONFIG_SLUB_DEBUG)
 static int validate_slab(struct kmem_cache *s, struct page *page,
                                                unsigned long *map)
@@ -3458,19 +3471,6 @@ static int list_locations(struct kmem_cache *s, char *buf,
        return n;
 }
 
-static unsigned long count_partial(struct kmem_cache_node *n)
-{
-       unsigned long flags;
-       unsigned long x = 0;
-       struct page *page;
-
-       spin_lock_irqsave(&n->list_lock, flags);
-       list_for_each_entry(page, &n->partial, lru)
-               x += page->inuse;
-       spin_unlock_irqrestore(&n->list_lock, flags);
-       return x;
-}
-
 enum slab_stat_type {
        SL_FULL,
        SL_PARTIAL,
@@ -4123,3 +4123,89 @@ static int __init slab_sysfs_init(void)
 
 __initcall(slab_sysfs_init);
 #endif
+
+/*
+ * The /proc/slabinfo ABI
+ */
+#ifdef CONFIG_SLABINFO
+
+ssize_t slabinfo_write(struct file *file, const char __user * buffer,
+                       size_t count, loff_t *ppos)
+{
+       return -EINVAL;
+}
+
+
+static void print_slabinfo_header(struct seq_file *m)
+{
+       seq_puts(m, "slabinfo - version: 2.1\n");
+       seq_puts(m, "# name            <active_objs> <num_objs> <objsize> "
+                "<objperslab> <pagesperslab>");
+       seq_puts(m, " : tunables <limit> <batchcount> <sharedfactor>");
+       seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
+       seq_putc(m, '\n');
+}
+
+static void *s_start(struct seq_file *m, loff_t *pos)
+{
+       loff_t n = *pos;
+
+       down_read(&slub_lock);
+       if (!n)
+               print_slabinfo_header(m);
+
+       return seq_list_start(&slab_caches, *pos);
+}
+
+static void *s_next(struct seq_file *m, void *p, loff_t *pos)
+{
+       return seq_list_next(p, &slab_caches, pos);
+}
+
+static void s_stop(struct seq_file *m, void *p)
+{
+       up_read(&slub_lock);
+}
+
+static int s_show(struct seq_file *m, void *p)
+{
+       unsigned long nr_partials = 0;
+       unsigned long nr_slabs = 0;
+       unsigned long nr_inuse = 0;
+       unsigned long nr_objs;
+       struct kmem_cache *s;
+       int node;
+
+       s = list_entry(p, struct kmem_cache, list);
+
+       for_each_online_node(node) {
+               struct kmem_cache_node *n = get_node(s, node);
+
+               if (!n)
+                       continue;
+
+               nr_partials += n->nr_partial;
+               nr_slabs += atomic_long_read(&n->nr_slabs);
+               nr_inuse += count_partial(n);
+       }
+
+       nr_objs = nr_slabs * s->objects;
+       nr_inuse += (nr_slabs - nr_partials) * s->objects;
+
+       seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d", s->name, nr_inuse,
+                  nr_objs, s->size, s->objects, (1 << s->order));
+       seq_printf(m, " : tunables %4u %4u %4u", 0, 0, 0);
+       seq_printf(m, " : slabdata %6lu %6lu %6lu", nr_slabs, nr_slabs,
+                  0UL);
+       seq_putc(m, '\n');
+       return 0;
+}
+
+const struct seq_operations slabinfo_op = {
+       .start = s_start,
+       .next = s_next,
+       .stop = s_stop,
+       .show = s_show,
+};
+
+#endif /* CONFIG_SLABINFO */
index 3b7d172..d1be080 100644 (file)
@@ -124,7 +124,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
                }
 
                skb_pull(skb, 1);       /* Remove PID */
-               skb_reset_mac_header(skb);
+               skb->mac_header = skb->network_header;
                skb_reset_network_header(skb);
                skb->dev      = ax25->ax25_dev->dev;
                skb->pkt_type = PACKET_HOST;
index 9483320..34d1a3c 100644 (file)
@@ -259,22 +259,14 @@ int hci_conn_del(struct hci_conn *conn)
        }
 
        tasklet_disable(&hdev->tx_task);
-
-       hci_conn_del_sysfs(conn);
-
        hci_conn_hash_del(hdev, conn);
        if (hdev->notify)
                hdev->notify(hdev, HCI_NOTIFY_CONN_DEL);
-
        tasklet_enable(&hdev->tx_task);
-
        skb_queue_purge(&conn->data_q);
-
+       hci_conn_del_sysfs(conn);
        hci_dev_put(hdev);
 
-       /* will free via device release */
-       put_device(&conn->dev);
-
        return 0;
 }
 
index cef1e3e..cad5103 100644 (file)
@@ -320,6 +320,7 @@ static void del_conn(struct work_struct *work)
 {
        struct hci_conn *conn = container_of(work, struct hci_conn, work);
        device_del(&conn->dev);
+       put_device(&conn->dev);
 }
 
 void hci_conn_del_sysfs(struct hci_conn *conn)
index d74d821..377e560 100644 (file)
@@ -254,6 +254,8 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
        if (copy_to_user(CMSG_COMPAT_DATA(cm), data, cmlen - sizeof(struct compat_cmsghdr)))
                return -EFAULT;
        cmlen = CMSG_COMPAT_SPACE(len);
+       if (kmsg->msg_controllen < cmlen)
+               cmlen = kmsg->msg_controllen;
        kmsg->msg_control += cmlen;
        kmsg->msg_controllen -= cmlen;
        return 0;
index 26a3a3a..be9d301 100644 (file)
@@ -2819,7 +2819,7 @@ void dev_set_allmulti(struct net_device *dev, int inc)
 /*
  *     Upload unicast and multicast address lists to device and
  *     configure RX filtering. When the device doesn't support unicast
- *     filtering it is put in promiscous mode while unicast addresses
+ *     filtering it is put in promiscuous mode while unicast addresses
  *     are present.
  */
 void __dev_set_rx_mode(struct net_device *dev)
index 100ba6d..10f5c65 100644 (file)
@@ -196,6 +196,8 @@ int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data)
        if (copy_to_user(CMSG_DATA(cm), data, cmlen - sizeof(struct cmsghdr)))
                goto out;
        cmlen = CMSG_SPACE(len);
+       if (msg->msg_controllen < cmlen)
+               cmlen = msg->msg_controllen;
        msg->msg_control += cmlen;
        msg->msg_controllen -= cmlen;
        err = 0;
index 9ef0737..9671ecd 100644 (file)
@@ -71,7 +71,7 @@ struct dccp_ackvec {
  * @dccpavr_ack_ackno - sequence number being acknowledged
  * @dccpavr_ack_ptr - pointer into dccpav_buf where this record starts
  * @dccpavr_ack_nonce - dccpav_ack_nonce at the time this record was sent
- * @dccpavr_sent_len - lenght of the record in dccpav_buf
+ * @dccpavr_sent_len - length of the record in dccpav_buf
  */
 struct dccp_ackvec_record {
        struct list_head dccpavr_node;
index 19b3358..d133416 100644 (file)
@@ -239,7 +239,7 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
                               ccid3_tx_state_name(hctx->ccid3hctx_state),
                               (unsigned)(hctx->ccid3hctx_x >> 6));
                /* The value of R is still undefined and so we can not recompute
-                * the timout value. Keep initial value as per [RFC 4342, 5]. */
+                * the timeout value. Keep initial value as per [RFC 4342, 5]. */
                t_nfb = TFRC_INITIAL_TIMEOUT;
                ccid3_update_send_interval(hctx);
                break;
index b3f366a..08174a2 100644 (file)
@@ -706,7 +706,7 @@ static int arp_process(struct sk_buff *skb)
        struct arphdr *arp;
        unsigned char *arp_ptr;
        struct rtable *rt;
-       unsigned char *sha, *tha;
+       unsigned char *sha;
        __be32 sip, tip;
        u16 dev_type = dev->type;
        int addr_type;
@@ -771,7 +771,6 @@ static int arp_process(struct sk_buff *skb)
        arp_ptr += dev->addr_len;
        memcpy(&sip, arp_ptr, 4);
        arp_ptr += 4;
-       tha     = arp_ptr;
        arp_ptr += dev->addr_len;
        memcpy(&tip, arp_ptr, 4);
 /*
index 732d8f0..97abf93 100644 (file)
@@ -804,10 +804,13 @@ static void nl_fib_input(struct sk_buff *skb)
 
        nlh = nlmsg_hdr(skb);
        if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len ||
-           nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) {
-               kfree_skb(skb);
+           nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn)))
                return;
-       }
+
+       skb = skb_clone(skb, GFP_KERNEL);
+       if (skb == NULL)
+               return;
+       nlh = nlmsg_hdr(skb);
 
        frn = (struct fib_result_nl *) NLMSG_DATA(nlh);
        tb = fib_get_table(frn->tb_id_in);
index 02b02a8..4b93f32 100644 (file)
@@ -613,7 +613,7 @@ static int ipgre_rcv(struct sk_buff *skb)
                                offset += 4;
                }
 
-               skb_reset_mac_header(skb);
+               skb->mac_header = skb->network_header;
                __pskb_pull(skb, offset);
                skb_reset_network_header(skb);
                skb_postpull_rcsum(skb, skb_transport_header(skb), offset);
index 96400b0..56a6757 100644 (file)
@@ -1403,6 +1403,10 @@ static int __init ic_proto_name(char *name)
        if (!strcmp(name, "on") || !strcmp(name, "any")) {
                return 1;
        }
+       if (!strcmp(name, "off") || !strcmp(name, "none")) {
+               ic_enable = 0;
+               return 1;
+       }
 #ifdef CONFIG_IP_PNP_DHCP
        else if (!strcmp(name, "dhcp")) {
                ic_proto_enabled &= ~IC_RARP;
@@ -1436,12 +1440,7 @@ static int __init ip_auto_config_setup(char *addrs)
        int num = 0;
 
        ic_set_manually = 1;
-
-       ic_enable = (*addrs &&
-               (strcmp(addrs, "off") != 0) &&
-               (strcmp(addrs, "none") != 0));
-       if (!ic_enable)
-               return 1;
+       ic_enable = 1;
 
        if (ic_proto_name(addrs))
                return 1;
index 831e9b2..910dae7 100644 (file)
@@ -419,6 +419,9 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 __read_mostly = {
        .me              = THIS_MODULE,
 };
 
+module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint,
+                 &nf_conntrack_htable_size, 0600);
+
 MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET));
 MODULE_ALIAS("ip_conntrack");
 MODULE_LICENSE("GPL");
index 3ca9897..8996ccb 100644 (file)
@@ -165,7 +165,7 @@ static int mangle_content_len(struct sk_buff *skb,
 
        dataoff = ip_hdrlen(skb) + sizeof(struct udphdr);
 
-       /* Get actual SDP lenght */
+       /* Get actual SDP length */
        if (ct_sip_get_info(ct, dptr, skb->len - dataoff, &matchoff,
                            &matchlen, POS_SDP_HEADER) > 0) {
 
index 889c893..b39f0d8 100644 (file)
@@ -2651,6 +2651,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
        u32 cnt = 0;
        u32 reord = tp->packets_out;
        s32 seq_rtt = -1;
+       s32 ca_seq_rtt = -1;
        ktime_t last_ackt = net_invalid_timestamp();
 
        while ((skb = tcp_write_queue_head(sk)) && skb != tcp_send_head(sk)) {
@@ -2659,6 +2660,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
                u32 packets_acked;
                u8 sacked = scb->sacked;
 
+               /* Determine how many packets and what bytes were acked, tso and else */
                if (after(scb->end_seq, tp->snd_una)) {
                        if (tcp_skb_pcount(skb) == 1 ||
                            !after(tp->snd_una, scb->seq))
@@ -2686,15 +2688,16 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
                                if (sacked & TCPCB_SACKED_RETRANS)
                                        tp->retrans_out -= packets_acked;
                                flag |= FLAG_RETRANS_DATA_ACKED;
+                               ca_seq_rtt = -1;
                                seq_rtt = -1;
                                if ((flag & FLAG_DATA_ACKED) ||
                                    (packets_acked > 1))
                                        flag |= FLAG_NONHEAD_RETRANS_ACKED;
                        } else {
+                               ca_seq_rtt = now - scb->when;
+                               last_ackt = skb->tstamp;
                                if (seq_rtt < 0) {
-                                       seq_rtt = now - scb->when;
-                                       if (fully_acked)
-                                               last_ackt = skb->tstamp;
+                                       seq_rtt = ca_seq_rtt;
                                }
                                if (!(sacked & TCPCB_SACKED_ACKED))
                                        reord = min(cnt, reord);
@@ -2709,10 +2712,10 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
                            !before(end_seq, tp->snd_up))
                                tp->urg_mode = 0;
                } else {
+                       ca_seq_rtt = now - scb->when;
+                       last_ackt = skb->tstamp;
                        if (seq_rtt < 0) {
-                               seq_rtt = now - scb->when;
-                               if (fully_acked)
-                                       last_ackt = skb->tstamp;
+                               seq_rtt = ca_seq_rtt;
                        }
                        reord = min(cnt, reord);
                }
@@ -2772,8 +2775,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
                                                 net_invalid_timestamp()))
                                        rtt_us = ktime_us_delta(ktime_get_real(),
                                                                last_ackt);
-                               else if (seq_rtt > 0)
-                                       rtt_us = jiffies_to_usecs(seq_rtt);
+                               else if (ca_seq_rtt > 0)
+                                       rtt_us = jiffies_to_usecs(ca_seq_rtt);
                        }
 
                        ca_ops->pkts_acked(sk, pkts_acked, rtt_us);
index 67997a7..777ed73 100644 (file)
@@ -612,7 +612,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
         * optimistic addresses, but we may send the solicitation
         * if we don't include the sllao.  So here we check
         * if our address is optimistic, and if so, we
-        * supress the inclusion of the sllao.
+        * suppress the inclusion of the sllao.
         */
        if (send_sllao) {
                struct inet6_ifaddr *ifp = ipv6_get_ifaddr(saddr, dev, 1);
index e5e4792..598dcbe 100644 (file)
@@ -496,7 +496,7 @@ static int ircomm_param_poll(void *instance, irda_param_t *param, int get)
        IRDA_ASSERT(self != NULL, return -1;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 
-       /* Poll parameters are always of lenght 0 (just a signal) */
+       /* Poll parameters are always of length 0 (just a signal) */
        if (!get) {
                /* Respond with DTE line settings */
                ircomm_param_request(self, IRCOMM_DTE, TRUE);
index c682207..1ab91f7 100644 (file)
@@ -342,7 +342,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev)
 
        if (dev->flags & IFF_PROMISC) {
                /* Enable promiscuous mode */
-               IRDA_WARNING("Promiscous mode not implemented by IrLAN!\n");
+               IRDA_WARNING("Promiscuous mode not implemented by IrLAN!\n");
        }
        else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS) {
                /* Disable promiscuous mode, use normal mode. */
index 4f37645..7c132d6 100644 (file)
@@ -144,7 +144,7 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos)
        frame->control = SNRM_CMD | PF_BIT;
 
        /*
-        *  If we are establishing a connection then insert QoS paramerters
+        *  If we are establishing a connection then insert QoS parameters
         */
        if (qos) {
                skb_put(tx_skb, 9); /* 25 left */
index 7183e9e..722bbe0 100644 (file)
@@ -133,7 +133,7 @@ static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi,
        int err;
 
        p.pi = pi;             /* In case handler needs to know */
-       p.pl = type & PV_MASK; /* The integer type codes the lenght as well */
+       p.pl = type & PV_MASK; /* The integer type codes the length as well */
        p.pv.i = 0;            /* Clear value */
 
        /* Call handler for this parameter */
@@ -142,7 +142,7 @@ static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi,
                return err;
 
        /*
-        * If parameter lenght is still 0, then (1) this is an any length
+        * If parameter length is still 0, then (1) this is an any length
         * integer, and (2) the handler function does not care which length
         * we choose to use, so we pick the one the gives the fewest bytes.
         */
@@ -206,11 +206,11 @@ static int irda_extract_integer(void *self, __u8 *buf, int len, __u8 pi,
 {
        irda_param_t p;
        int n = 0;
-       int extract_len;        /* Real lenght we extract */
+       int extract_len;        /* Real length we extract */
        int err;
 
        p.pi = pi;     /* In case handler needs to know */
-       p.pl = buf[1]; /* Extract lenght of value */
+       p.pl = buf[1]; /* Extract length of value */
        p.pv.i = 0;    /* Clear value */
        extract_len = p.pl;     /* Default : extract all */
 
@@ -297,7 +297,7 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi,
        IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
 
        p.pi = pi;     /* In case handler needs to know */
-       p.pl = buf[1]; /* Extract lenght of value */
+       p.pl = buf[1]; /* Extract length of value */
 
        IRDA_DEBUG(2, "%s(), pi=%#x, pl=%d\n", __FUNCTION__,
                   p.pi, p.pl);
@@ -339,7 +339,7 @@ static int irda_extract_octseq(void *self, __u8 *buf, int len, __u8 pi,
        irda_param_t p;
 
        p.pi = pi;     /* In case handler needs to know */
-       p.pl = buf[1]; /* Extract lenght of value */
+       p.pl = buf[1]; /* Extract length of value */
 
        /* Check if buffer is long enough for parsing */
        if (len < (2+p.pl)) {
index e712867..c246983 100644 (file)
@@ -238,7 +238,7 @@ async_bump(struct net_device *dev,
        skb_reserve(newskb, 1);
 
        if(docopy) {
-               /* Copy data without CRC (lenght already checked) */
+               /* Copy data without CRC (length already checked) */
                skb_copy_to_linear_data(newskb, rx_buff->data,
                                        rx_buff->len - 2);
                /* Deliver this skb */
index 878039b..26d5e63 100644 (file)
@@ -2784,12 +2784,22 @@ static struct sadb_msg *pfkey_get_base_msg(struct sk_buff *skb, int *errp)
 
 static inline int aalg_tmpl_set(struct xfrm_tmpl *t, struct xfrm_algo_desc *d)
 {
-       return t->aalgos & (1 << d->desc.sadb_alg_id);
+       unsigned int id = d->desc.sadb_alg_id;
+
+       if (id >= sizeof(t->aalgos) * 8)
+               return 0;
+
+       return (t->aalgos >> id) & 1;
 }
 
 static inline int ealg_tmpl_set(struct xfrm_tmpl *t, struct xfrm_algo_desc *d)
 {
-       return t->ealgos & (1 << d->desc.sadb_alg_id);
+       unsigned int id = d->desc.sadb_alg_id;
+
+       if (id >= sizeof(t->ealgos) * 8)
+               return 0;
+
+       return (t->ealgos >> id) & 1;
 }
 
 static int count_ah_combs(struct xfrm_tmpl *t)
index 505af1f..6378850 100644 (file)
@@ -427,7 +427,6 @@ static const struct header_ops ieee80211_header_ops = {
 void ieee80211_if_setup(struct net_device *dev)
 {
        ether_setup(dev);
-       dev->header_ops = &ieee80211_header_ops;
        dev->hard_start_xmit = ieee80211_subif_start_xmit;
        dev->wireless_handlers = &ieee80211_iw_handler_def;
        dev->set_multicast_list = ieee80211_set_multicast_list;
index 3260a4a..c3f2783 100644 (file)
@@ -60,11 +60,11 @@ void ieee80211_rate_control_unregister(struct rate_control_ops *ops)
        list_for_each_entry(alg, &rate_ctrl_algs, list) {
                if (alg->ops == ops) {
                        list_del(&alg->list);
+                       kfree(alg);
                        break;
                }
        }
        mutex_unlock(&rate_ctrl_mutex);
-       kfree(alg);
 }
 EXPORT_SYMBOL(ieee80211_rate_control_unregister);
 
index 16afd24..bee8080 100644 (file)
@@ -808,12 +808,8 @@ static void ieee80211_associated(struct net_device *dev,
                sta_info_put(sta);
        }
        if (disassoc) {
-               union iwreq_data wrqu;
-               memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
-               wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-               wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
-               mod_timer(&ifsta->timer, jiffies +
-                                     IEEE80211_MONITORING_INTERVAL + 30 * HZ);
+               ifsta->state = IEEE80211_DISABLED;
+               ieee80211_set_associated(dev, ifsta, 0);
        } else {
                mod_timer(&ifsta->timer, jiffies +
                                      IEEE80211_MONITORING_INTERVAL);
index 00f908d..a7263fc 100644 (file)
@@ -1443,6 +1443,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
        struct ieee80211_sub_if_data *prev = NULL;
        struct sk_buff *skb_new;
        u8 *bssid;
+       int hdrlen;
 
        /*
         * key references and virtual interfaces are protected using RCU
@@ -1472,6 +1473,18 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
        rx.fc = le16_to_cpu(hdr->frame_control);
        type = rx.fc & IEEE80211_FCTL_FTYPE;
 
+       /*
+        * Drivers are required to align the payload data to a four-byte
+        * boundary, so the last two bits of the address where it starts
+        * may not be set. The header is required to be directly before
+        * the payload data, padding like atheros hardware adds which is
+        * inbetween the 802.11 header and the payload is not supported,
+        * the driver is required to move the 802.11 header further back
+        * in that case.
+        */
+       hdrlen = ieee80211_get_hdrlen(rx.fc);
+       WARN_ON_ONCE(((unsigned long)(skb->data + hdrlen)) & 3);
+
        if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT)
                local->dot11ReceivedFragmentCount++;
 
index e849155..cfd8ee9 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <linux/skbuff.h>
 #include <linux/if_arp.h>
+#include <linux/timer.h>
 
 #include <net/mac80211.h>
 #include "ieee80211_i.h"
@@ -306,7 +307,8 @@ static void sta_info_cleanup(unsigned long data)
        }
        read_unlock_bh(&local->sta_lock);
 
-       local->sta_cleanup.expires = jiffies + STA_INFO_CLEANUP_INTERVAL;
+       local->sta_cleanup.expires =
+               round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL);
        add_timer(&local->sta_cleanup);
 }
 
@@ -345,7 +347,8 @@ void sta_info_init(struct ieee80211_local *local)
        INIT_LIST_HEAD(&local->sta_list);
 
        init_timer(&local->sta_cleanup);
-       local->sta_cleanup.expires = jiffies + STA_INFO_CLEANUP_INTERVAL;
+       local->sta_cleanup.expires =
+               round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL);
        local->sta_cleanup.data = (unsigned long) local;
        local->sta_cleanup.function = sta_info_cleanup;
 
index 000c2fb..a4d5cde 100644 (file)
@@ -1016,7 +1016,7 @@ struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced)
 }
 EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
 
-int set_hashsize(const char *val, struct kernel_param *kp)
+int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
 {
        int i, bucket, hashsize, vmalloced;
        int old_vmalloced, old_size;
@@ -1063,8 +1063,9 @@ int set_hashsize(const char *val, struct kernel_param *kp)
        nf_ct_free_hashtable(old_hash, old_vmalloced, old_size);
        return 0;
 }
+EXPORT_SYMBOL_GPL(nf_conntrack_set_hashsize);
 
-module_param_call(hashsize, set_hashsize, param_get_uint,
+module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint,
                  &nf_conntrack_htable_size, 0600);
 
 int __init nf_conntrack_init(void)
index 8f8b5a4..515abff 100644 (file)
@@ -187,7 +187,7 @@ static const struct sip_header_nfo ct_sip_hdrs[] = {
        }
 };
 
-/* get line lenght until first CR or LF seen. */
+/* get line length until first CR or LF seen. */
 int ct_sip_lnlen(const char *line, const char *limit)
 {
        const char *k = line;
@@ -236,7 +236,7 @@ static int digits_len(struct nf_conn *ct, const char *dptr,
        return len;
 }
 
-/* get digits lenght, skiping blank spaces. */
+/* get digits length, skipping blank spaces. */
 static int skp_digits_len(struct nf_conn *ct, const char *dptr,
                          const char *limit, int *shift)
 {
index 5648337..9c41464 100644 (file)
@@ -71,7 +71,7 @@ static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {
 };
 
 /*
- * NetLabel Misc Managment Functions
+ * NetLabel Misc Management Functions
  */
 
 /**
index 8c68da5..6caf459 100644 (file)
@@ -56,7 +56,7 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
 
        /* Spoof incoming device */
        skb->dev      = dev;
-       skb_reset_mac_header(skb);
+       skb->mac_header = skb->network_header;
        skb_reset_network_header(skb);
        skb->pkt_type = PACKET_HOST;
 
index 55e7e45..a6ad491 100644 (file)
@@ -160,7 +160,7 @@ struct hfsc_class
        u64     cl_vtoff;               /* inter-period cumulative vt offset */
        u64     cl_cvtmax;              /* max child's vt in the last period */
        u64     cl_cvtoff;              /* cumulative cvtmax of all periods */
-       u64     cl_pcvtoff;             /* parent's cvtoff at initalization
+       u64     cl_pcvtoff;             /* parent's cvtoff at initialization
                                           time */
 
        struct internal_sc cl_rsc;      /* internal real-time service curve */
index f487629..ed7c9e3 100644 (file)
@@ -286,7 +286,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
 
        sctp_addto_chunk(retval, sizeof(ecap_param), &ecap_param);
 
-       /* Add the supported extensions paramter.  Be nice and add this
+       /* Add the supported extensions parameter.  Be nice and add this
         * fist before addiding the parameters for the extensions themselves
         */
        if (num_ext) {
@@ -2859,7 +2859,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
        chunk_len -= length;
 
        /* Skip the address parameter and store a pointer to the first
-        * asconf paramter.
+        * asconf parameter.
         */
        length = ntohs(addr_param->v4.param_hdr.length);
        asconf_param = (sctp_addip_param_t *)((void *)addr_param + length);
@@ -2868,7 +2868,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
        /* create an ASCONF_ACK chunk.
         * Based on the definitions of parameters, we know that the size of
         * ASCONF_ACK parameters are less than or equal to the twice of ASCONF
-        * paramters.
+        * parameters.
         */
        asconf_ack = sctp_make_asconf_ack(asoc, serial, chunk_len * 2);
        if (!asconf_ack)
@@ -3062,7 +3062,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,
        asconf_len -= length;
 
        /* Skip the address parameter in the last asconf sent and store a
-        * pointer to the first asconf paramter.
+        * pointer to the first asconf parameter.
         */
        length = ntohs(addr_param->v4.param_hdr.length);
        asconf_param = (sctp_addip_param_t *)((void *)addr_param + length);
index a6e57d1..1f2d85e 100644 (file)
@@ -625,7 +625,7 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
        err = -EINVAL;
        gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor);
        if (!gss_auth->mech) {
-               printk(KERN_WARNING "%s: Pseudoflavor %d not found!",
+               printk(KERN_WARNING "%s: Pseudoflavor %d not found!\n",
                                __FUNCTION__, flavor);
                goto err_free;
        }
index b91b166..26b846e 100644 (file)
@@ -2162,7 +2162,7 @@ xfrm_audit_policy_add(struct xfrm_policy *xp, int result, u32 auid, u32 sid)
 
        if (audit_enabled == 0)
                return;
-       audit_buf = xfrm_audit_start(sid, auid);
+       audit_buf = xfrm_audit_start(auid, sid);
        if (audit_buf == NULL)
                return;
        audit_log_format(audit_buf, " op=SPD-add res=%u", result);
@@ -2179,7 +2179,7 @@ xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, u32 auid, u32 sid)
 
        if (audit_enabled == 0)
                return;
-       audit_buf = xfrm_audit_start(sid, auid);
+       audit_buf = xfrm_audit_start(auid, sid);
        if (audit_buf == NULL)
                return;
        audit_log_format(audit_buf, " op=SPD-delete res=%u", result);
index 1af522b..ee1e697 100644 (file)
@@ -2033,7 +2033,7 @@ xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid)
 
        if (audit_enabled == 0)
                return;
-       audit_buf = xfrm_audit_start(sid, auid);
+       audit_buf = xfrm_audit_start(auid, sid);
        if (audit_buf == NULL)
                return;
        audit_log_format(audit_buf, " op=SAD-add res=%u",result);
@@ -2053,7 +2053,7 @@ xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid)
 
        if (audit_enabled == 0)
                return;
-       audit_buf = xfrm_audit_start(sid, auid);
+       audit_buf = xfrm_audit_start(auid, sid);
        if (audit_buf == NULL)
                return;
        audit_log_format(audit_buf, " op=SAD-delete res=%u",result);
index a38787a..8d6f174 100644 (file)
@@ -374,7 +374,8 @@ static int conf_choice(struct menu *menu)
                                continue;
                        break;
                case set_random:
-                       def = (random() % cnt) + 1;
+                       if (is_new)
+                               def = (random() % cnt) + 1;
                case set_default:
                case set_yes:
                case set_mod: