From 24003ed55364da056d5f06fb0857e3b932e26913 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 19 Jan 2006 12:26:57 +0000 Subject: [PATCH] --- yaml --- r: 19091 b: refs/heads/master c: f43aaba191bfbe20a1f55ec05f43813ce381cd53 h: refs/heads/master i: 19089: 7bc9059e859b3eb8159cc8884624287c72a61fd5 19087: f28c3a631774351e5de34ffc9f38edb1485cc01a v: v3 --- [refs] | 2 +- trunk/arch/ia64/ia32/sys_ia32.c | 28 ++-- trunk/arch/ia64/kernel/perfmon.c | 11 +- trunk/arch/ia64/kernel/uncached.c | 1 - trunk/arch/ia64/sn/include/xtalk/hubdev.h | 9 -- trunk/arch/ia64/sn/kernel/io_init.c | 54 +------ trunk/arch/ia64/sn/kernel/mca.c | 7 +- trunk/arch/ia64/sn/kernel/xp_main.c | 17 +- trunk/arch/ia64/sn/kernel/xpc_channel.c | 34 ++-- trunk/arch/ia64/sn/kernel/xpc_main.c | 17 +- trunk/arch/ia64/sn/pci/pcibr/pcibr_provider.c | 12 +- .../arch/powerpc/platforms/powermac/feature.c | 6 +- trunk/arch/ppc/syslib/mv64x60.c | 4 +- trunk/arch/sparc/kernel/entry.S | 58 ++++++- trunk/arch/sparc/kernel/rtrap.S | 9 +- trunk/arch/sparc/kernel/signal.c | 117 ++++++++++---- trunk/arch/sparc/kernel/sparc_ksyms.c | 2 + trunk/arch/sparc/kernel/systbls.S | 10 +- trunk/arch/sparc/math-emu/math.c | 10 ++ trunk/arch/sparc64/kernel/entry.S | 25 ++- trunk/arch/sparc64/kernel/rtrap.S | 33 ++-- trunk/arch/sparc64/kernel/signal.c | 151 +++++++++++++----- trunk/arch/sparc64/kernel/signal32.c | 122 +++++++++++--- trunk/arch/sparc64/kernel/sparc64_ksyms.c | 4 +- trunk/arch/sparc64/kernel/sys32.S | 1 + trunk/arch/sparc64/kernel/systbls.S | 23 +-- trunk/arch/sparc64/solaris/entry64.S | 2 - trunk/block/elevator.c | 45 ++++-- trunk/block/ll_rw_blk.c | 7 +- trunk/drivers/input/touchscreen/ads7846.c | 9 +- trunk/drivers/net/Kconfig | 28 +--- trunk/drivers/net/acenic.c | 4 - trunk/drivers/net/b44.c | 5 +- trunk/drivers/net/bonding/bond_main.c | 2 +- trunk/drivers/net/mv643xx_eth.c | 108 +++++++------ trunk/drivers/net/s2io.c | 2 +- trunk/drivers/net/sungem.c | 55 +++---- trunk/drivers/net/wireless/hostap/Kconfig | 2 +- trunk/drivers/net/wireless/ipw2100.c | 49 +++--- trunk/drivers/net/wireless/ipw2200.c | 7 +- trunk/drivers/net/wireless/orinoco_cs.c | 4 +- trunk/drivers/pci/msi.c | 6 +- trunk/drivers/scsi/libata-scsi.c | 27 +--- trunk/drivers/serial/imx.c | 4 +- trunk/drivers/serial/sn_console.c | 129 ++++++++------- trunk/fs/bio.c | 1 - trunk/fs/compat.c | 4 +- trunk/include/asm-ia64/semaphore.h | 8 +- trunk/include/asm-ia64/sn/xp.h | 3 +- trunk/include/asm-ia64/sn/xpc.h | 9 +- trunk/include/asm-ia64/topology.h | 4 - trunk/include/asm-sparc/oplib.h | 2 - trunk/include/asm-sparc/thread_info.h | 5 +- trunk/include/asm-sparc/unistd.h | 22 +-- trunk/include/asm-sparc64/spinlock.h | 24 +-- trunk/include/asm-sparc64/thread_info.h | 6 +- trunk/include/asm-sparc64/unistd.h | 23 +-- trunk/include/linux/blkdev.h | 6 +- trunk/include/linux/netfilter/x_tables.h | 16 +- trunk/include/net/ieee80211.h | 4 +- trunk/include/net/sctp/sctp.h | 2 - trunk/include/net/sctp/structs.h | 89 +++++------ trunk/include/scsi/scsi_host.h | 1 + trunk/kernel/rcutorture.c | 10 +- trunk/kernel/sched.c | 6 +- trunk/kernel/time.c | 2 +- trunk/kernel/user.c | 25 +-- trunk/net/core/dev.c | 5 +- trunk/net/core/filter.c | 6 +- trunk/net/core/skbuff.c | 8 +- trunk/net/ieee80211/ieee80211_rx.c | 26 +-- trunk/net/ieee80211/ieee80211_wx.c | 12 +- trunk/net/ipv4/igmp.c | 1 + trunk/net/ipv4/tcp_htcp.c | 1 + trunk/net/ipv6/mcast.c | 56 ++----- trunk/net/key/af_key.c | 2 - trunk/net/packet/af_packet.c | 16 +- trunk/net/sctp/input.c | 75 ++------- trunk/net/sctp/inqueue.c | 4 +- trunk/net/sctp/proc.c | 32 ++-- trunk/net/sctp/sm_make_chunk.c | 16 +- trunk/net/sctp/sm_sideeffect.c | 4 +- trunk/net/sctp/sm_statefuns.c | 10 +- trunk/net/sctp/socket.c | 8 +- trunk/net/sctp/sysctl.c | 7 +- trunk/net/sctp/transport.c | 2 +- trunk/security/seclvl.c | 4 +- 87 files changed, 903 insertions(+), 926 deletions(-) diff --git a/[refs] b/[refs] index 53164d92138e..5ca78e2fcf31 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: adac1665234dd966990af846eccd20b7f4923279 +refs/heads/master: f43aaba191bfbe20a1f55ec05f43813ce381cd53 diff --git a/trunk/arch/ia64/ia32/sys_ia32.c b/trunk/arch/ia64/ia32/sys_ia32.c index 70dba1f0e2ee..3945d378bd7e 100644 --- a/trunk/arch/ia64/ia32/sys_ia32.c +++ b/trunk/arch/ia64/ia32/sys_ia32.c @@ -52,9 +52,9 @@ #include #include #include -#include #include +#include #include #include #include @@ -86,7 +86,7 @@ * while doing so. */ /* XXX make per-mm: */ -static DEFINE_MUTEX(ia32_mmap_mutex); +static DECLARE_MUTEX(ia32_mmap_sem); asmlinkage long sys32_execve (char __user *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp, @@ -895,11 +895,11 @@ ia32_do_mmap (struct file *file, unsigned long addr, unsigned long len, int prot prot = get_prot32(prot); #if PAGE_SHIFT > IA32_PAGE_SHIFT - mutex_lock(&ia32_mmap_mutex); + down(&ia32_mmap_sem); { addr = emulate_mmap(file, addr, len, prot, flags, offset); } - mutex_unlock(&ia32_mmap_mutex); + up(&ia32_mmap_sem); #else down_write(¤t->mm->mmap_sem); { @@ -1000,9 +1000,11 @@ sys32_munmap (unsigned int start, unsigned int len) if (start >= end) return 0; - mutex_lock(&ia32_mmap_mutex); - ret = sys_munmap(start, end - start); - mutex_unlock(&ia32_mmap_mutex); + down(&ia32_mmap_sem); + { + ret = sys_munmap(start, end - start); + } + up(&ia32_mmap_sem); #endif return ret; } @@ -1054,7 +1056,7 @@ sys32_mprotect (unsigned int start, unsigned int len, int prot) if (retval < 0) return retval; - mutex_lock(&ia32_mmap_mutex); + down(&ia32_mmap_sem); { if (offset_in_page(start)) { /* start address is 4KB aligned but not page aligned. */ @@ -1078,7 +1080,7 @@ sys32_mprotect (unsigned int start, unsigned int len, int prot) retval = sys_mprotect(start, end - start, prot); } out: - mutex_unlock(&ia32_mmap_mutex); + up(&ia32_mmap_sem); return retval; #endif } @@ -1122,9 +1124,11 @@ sys32_mremap (unsigned int addr, unsigned int old_len, unsigned int new_len, old_len = PAGE_ALIGN(old_end) - addr; new_len = PAGE_ALIGN(new_end) - addr; - mutex_lock(&ia32_mmap_mutex); - ret = sys_mremap(addr, old_len, new_len, flags, new_addr); - mutex_unlock(&ia32_mmap_mutex); + down(&ia32_mmap_sem); + { + ret = sys_mremap(addr, old_len, new_len, flags, new_addr); + } + up(&ia32_mmap_sem); if ((ret >= 0) && (old_len < new_len)) { /* mremap expanded successfully */ diff --git a/trunk/arch/ia64/kernel/perfmon.c b/trunk/arch/ia64/kernel/perfmon.c index 9c5194b385da..2ea4b39efffa 100644 --- a/trunk/arch/ia64/kernel/perfmon.c +++ b/trunk/arch/ia64/kernel/perfmon.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -287,7 +286,7 @@ typedef struct pfm_context { unsigned long ctx_ovfl_regs[4]; /* which registers overflowed (notification) */ - struct completion ctx_restart_done; /* use for blocking notification mode */ + struct semaphore ctx_restart_sem; /* use for blocking notification mode */ unsigned long ctx_used_pmds[4]; /* bitmask of PMD used */ unsigned long ctx_all_pmds[4]; /* bitmask of all accessible PMDs */ @@ -1992,7 +1991,7 @@ pfm_close(struct inode *inode, struct file *filp) /* * force task to wake up from MASKED state */ - complete(&ctx->ctx_restart_done); + up(&ctx->ctx_restart_sem); DPRINT(("waking up ctx_state=%d\n", state)); @@ -2707,7 +2706,7 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg /* * init restart semaphore to locked */ - init_completion(&ctx->ctx_restart_done); + sema_init(&ctx->ctx_restart_sem, 0); /* * activation is used in SMP only @@ -3688,7 +3687,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs) */ if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) { DPRINT(("unblocking [%d] \n", task->pid)); - complete(&ctx->ctx_restart_done); + up(&ctx->ctx_restart_sem); } else { DPRINT(("[%d] armed exit trap\n", task->pid)); @@ -5090,7 +5089,7 @@ pfm_handle_work(void) * may go through without blocking on SMP systems * if restart has been received already by the time we call down() */ - ret = wait_for_completion_interruptible(&ctx->ctx_restart_done); + ret = down_interruptible(&ctx->ctx_restart_sem); DPRINT(("after block sleeping ret=%d\n", ret)); diff --git a/trunk/arch/ia64/kernel/uncached.c b/trunk/arch/ia64/kernel/uncached.c index fcd2bad0286f..b631cf86ed44 100644 --- a/trunk/arch/ia64/kernel/uncached.c +++ b/trunk/arch/ia64/kernel/uncached.c @@ -210,7 +210,6 @@ uncached_build_memmap(unsigned long start, unsigned long end, void *arg) dprintk(KERN_ERR "uncached_build_memmap(%lx %lx)\n", start, end); - touch_softlockup_watchdog(); memset((char *)start, 0, length); node = paddr_to_nid(start - __IA64_UNCACHED_OFFSET); diff --git a/trunk/arch/ia64/sn/include/xtalk/hubdev.h b/trunk/arch/ia64/sn/include/xtalk/hubdev.h index 8182583c762c..7c88e9a58516 100644 --- a/trunk/arch/ia64/sn/include/xtalk/hubdev.h +++ b/trunk/arch/ia64/sn/include/xtalk/hubdev.h @@ -51,15 +51,6 @@ struct sn_flush_device_kernel { struct sn_flush_device_common *common; }; -/* 01/16/06 This struct is the old PROM/kernel struct and needs to be included - * for older official PROMs to function on the new kernel base. This struct - * will be removed when the next official PROM release occurs. */ - -struct sn_flush_device_war { - struct sn_flush_device_common common; - u32 filler; /* older PROMs expect the default size of a spinlock_t */ -}; - /* * **widget_p - Used as an array[wid_num][device] of sn_flush_device_kernel. */ diff --git a/trunk/arch/ia64/sn/kernel/io_init.c b/trunk/arch/ia64/sn/kernel/io_init.c index 00700f7e6837..233d55115d33 100644 --- a/trunk/arch/ia64/sn/kernel/io_init.c +++ b/trunk/arch/ia64/sn/kernel/io_init.c @@ -165,45 +165,8 @@ sn_pcidev_info_get(struct pci_dev *dev) return NULL; } -/* Older PROM flush WAR - * - * 01/16/06 -- This war will be in place until a new official PROM is released. - * Additionally note that the struct sn_flush_device_war also has to be - * removed from arch/ia64/sn/include/xtalk/hubdev.h - */ -static u8 war_implemented = 0; - -static void sn_device_fixup_war(u64 nasid, u64 widget, int device, - struct sn_flush_device_common *common) -{ - struct sn_flush_device_war *war_list; - struct sn_flush_device_war *dev_entry; - struct ia64_sal_retval isrv = {0,0,0,0}; - - if (!war_implemented) { - printk(KERN_WARNING "PROM version < 4.50 -- implementing old " - "PROM flush WAR\n"); - war_implemented = 1; - } - - war_list = kzalloc(DEV_PER_WIDGET * sizeof(*war_list), GFP_KERNEL); - if (!war_list) - BUG(); - - SAL_CALL_NOLOCK(isrv, SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST, - nasid, widget, __pa(war_list), 0, 0, 0 ,0); - if (isrv.status) - panic("sn_device_fixup_war failed: %s\n", - ia64_sal_strerror(isrv.status)); - - dev_entry = war_list + device; - memcpy(common,dev_entry, sizeof(*common)); - - kfree(war_list); -} - /* - * sn_fixup_ionodes() - This routine initializes the HUB data strcuture for + * sn_fixup_ionodes() - This routine initializes the HUB data strcuture for * each node in the system. */ static void sn_fixup_ionodes(void) @@ -283,19 +246,8 @@ static void sn_fixup_ionodes(void) widget, device, (u64)(dev_entry->common)); - if (status) { - if (sn_sal_rev() < 0x0450) { - /* shortlived WAR for older - * PROM images - */ - sn_device_fixup_war(nasid, - widget, - device, - dev_entry->common); - } - else - BUG(); - } + if (status) + BUG(); spin_lock_init(&dev_entry->sfdl_flush_lock); } diff --git a/trunk/arch/ia64/sn/kernel/mca.c b/trunk/arch/ia64/sn/kernel/mca.c index 9ab684d1bb55..6546db6abdba 100644 --- a/trunk/arch/ia64/sn/kernel/mca.c +++ b/trunk/arch/ia64/sn/kernel/mca.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -28,7 +27,7 @@ void sn_init_cpei_timer(void); /* Printing oemdata from mca uses data that is not passed through SAL, it is * global. Only one user at a time. */ -static DEFINE_MUTEX(sn_oemdata_mutex); +static DECLARE_MUTEX(sn_oemdata_mutex); static u8 **sn_oemdata; static u64 *sn_oemdata_size, sn_oemdata_bufsize; @@ -90,7 +89,7 @@ static int sn_platform_plat_specific_err_print(const u8 * sect_header, u8 ** oemdata, u64 * oemdata_size) { - mutex_lock(&sn_oemdata_mutex); + down(&sn_oemdata_mutex); sn_oemdata = oemdata; sn_oemdata_size = oemdata_size; sn_oemdata_bufsize = 0; @@ -108,7 +107,7 @@ sn_platform_plat_specific_err_print(const u8 * sect_header, u8 ** oemdata, *sn_oemdata_size = 0; ia64_sn_plat_specific_err_print(print_hook, (char *)sect_header); } - mutex_unlock(&sn_oemdata_mutex); + up(&sn_oemdata_mutex); return 0; } diff --git a/trunk/arch/ia64/sn/kernel/xp_main.c b/trunk/arch/ia64/sn/kernel/xp_main.c index b7ea46645e12..3be52a34c80f 100644 --- a/trunk/arch/ia64/sn/kernel/xp_main.c +++ b/trunk/arch/ia64/sn/kernel/xp_main.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -137,13 +136,13 @@ xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size, registration = &xpc_registrations[ch_number]; - if (mutex_lock_interruptible(®istration->mutex) != 0) { + if (down_interruptible(®istration->sema) != 0) { return xpcInterrupted; } /* if XPC_CHANNEL_REGISTERED(ch_number) */ if (registration->func != NULL) { - mutex_unlock(®istration->mutex); + up(®istration->sema); return xpcAlreadyRegistered; } @@ -155,7 +154,7 @@ xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size, registration->key = key; registration->func = func; - mutex_unlock(®istration->mutex); + up(®istration->sema); xpc_interface.connect(ch_number); @@ -191,11 +190,11 @@ xpc_disconnect(int ch_number) * figured XPC's users will just turn around and call xpc_disconnect() * again anyways, so we might as well wait, if need be. */ - mutex_lock(®istration->mutex); + down(®istration->sema); /* if !XPC_CHANNEL_REGISTERED(ch_number) */ if (registration->func == NULL) { - mutex_unlock(®istration->mutex); + up(®istration->sema); return; } @@ -209,7 +208,7 @@ xpc_disconnect(int ch_number) xpc_interface.disconnect(ch_number); - mutex_unlock(®istration->mutex); + up(®istration->sema); return; } @@ -251,9 +250,9 @@ xp_init(void) xp_nofault_PIOR_target = SH1_IPI_ACCESS; } - /* initialize the connection registration mutex */ + /* initialize the connection registration semaphores */ for (ch_number = 0; ch_number < XPC_NCHANNELS; ch_number++) { - mutex_init(&xpc_registrations[ch_number].mutex); + sema_init(&xpc_registrations[ch_number].sema, 1); /* mutex */ } return 0; diff --git a/trunk/arch/ia64/sn/kernel/xpc_channel.c b/trunk/arch/ia64/sn/kernel/xpc_channel.c index 8d950c778bb6..0c0a68902409 100644 --- a/trunk/arch/ia64/sn/kernel/xpc_channel.c +++ b/trunk/arch/ia64/sn/kernel/xpc_channel.c @@ -22,8 +22,6 @@ #include #include #include -#include -#include #include #include #include @@ -58,8 +56,8 @@ xpc_initialize_channels(struct xpc_partition *part, partid_t partid) atomic_set(&ch->n_to_notify, 0); spin_lock_init(&ch->lock); - mutex_init(&ch->msg_to_pull_mutex); - init_completion(&ch->wdisconnect_wait); + sema_init(&ch->msg_to_pull_sema, 1); /* mutex */ + sema_init(&ch->wdisconnect_sema, 0); /* event wait */ atomic_set(&ch->n_on_msg_allocate_wq, 0); init_waitqueue_head(&ch->msg_allocate_wq); @@ -536,6 +534,7 @@ static enum xpc_retval xpc_allocate_msgqueues(struct xpc_channel *ch) { unsigned long irq_flags; + int i; enum xpc_retval ret; @@ -553,6 +552,11 @@ xpc_allocate_msgqueues(struct xpc_channel *ch) return ret; } + for (i = 0; i < ch->local_nentries; i++) { + /* use a semaphore as an event wait queue */ + sema_init(&ch->notify_queue[i].sema, 0); + } + spin_lock_irqsave(&ch->lock, irq_flags); ch->flags |= XPC_C_SETUP; spin_unlock_irqrestore(&ch->lock, irq_flags); @@ -795,8 +799,10 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags) } if (ch->flags & XPC_C_WDISCONNECT) { - /* we won't lose the CPU since we're holding ch->lock */ - complete(&ch->wdisconnect_wait); + spin_unlock_irqrestore(&ch->lock, *irq_flags); + up(&ch->wdisconnect_sema); + spin_lock_irqsave(&ch->lock, *irq_flags); + } else if (ch->delayed_IPI_flags) { if (part->act_state != XPC_P_DEACTIVATING) { /* time to take action on any delayed IPI flags */ @@ -1086,12 +1092,12 @@ xpc_connect_channel(struct xpc_channel *ch) struct xpc_registration *registration = &xpc_registrations[ch->number]; - if (mutex_trylock(®istration->mutex) == 0) { + if (down_trylock(®istration->sema) != 0) { return xpcRetry; } if (!XPC_CHANNEL_REGISTERED(ch->number)) { - mutex_unlock(®istration->mutex); + up(®istration->sema); return xpcUnregistered; } @@ -1102,7 +1108,7 @@ xpc_connect_channel(struct xpc_channel *ch) if (ch->flags & XPC_C_DISCONNECTING) { spin_unlock_irqrestore(&ch->lock, irq_flags); - mutex_unlock(®istration->mutex); + up(®istration->sema); return ch->reason; } @@ -1134,7 +1140,7 @@ xpc_connect_channel(struct xpc_channel *ch) * channel lock be locked and will unlock and relock * the channel lock as needed. */ - mutex_unlock(®istration->mutex); + up(®istration->sema); XPC_DISCONNECT_CHANNEL(ch, xpcUnequalMsgSizes, &irq_flags); spin_unlock_irqrestore(&ch->lock, irq_flags); @@ -1149,7 +1155,7 @@ xpc_connect_channel(struct xpc_channel *ch) atomic_inc(&xpc_partitions[ch->partid].nchannels_active); } - mutex_unlock(®istration->mutex); + up(®istration->sema); /* initiate the connection */ @@ -2083,7 +2089,7 @@ xpc_pull_remote_msg(struct xpc_channel *ch, s64 get) enum xpc_retval ret; - if (mutex_lock_interruptible(&ch->msg_to_pull_mutex) != 0) { + if (down_interruptible(&ch->msg_to_pull_sema) != 0) { /* we were interrupted by a signal */ return NULL; } @@ -2119,7 +2125,7 @@ xpc_pull_remote_msg(struct xpc_channel *ch, s64 get) XPC_DEACTIVATE_PARTITION(part, ret); - mutex_unlock(&ch->msg_to_pull_mutex); + up(&ch->msg_to_pull_sema); return NULL; } @@ -2128,7 +2134,7 @@ xpc_pull_remote_msg(struct xpc_channel *ch, s64 get) ch->next_msg_to_pull += nmsgs; } - mutex_unlock(&ch->msg_to_pull_mutex); + up(&ch->msg_to_pull_sema); /* return the message we were looking for */ msg_offset = (get % ch->remote_nentries) * ch->msg_size; diff --git a/trunk/arch/ia64/sn/kernel/xpc_main.c b/trunk/arch/ia64/sn/kernel/xpc_main.c index c75f8aeefc2b..8930586e0eb4 100644 --- a/trunk/arch/ia64/sn/kernel/xpc_main.c +++ b/trunk/arch/ia64/sn/kernel/xpc_main.c @@ -55,7 +55,6 @@ #include #include #include -#include #include #include #include @@ -178,10 +177,10 @@ static DECLARE_WAIT_QUEUE_HEAD(xpc_act_IRQ_wq); static unsigned long xpc_hb_check_timeout; /* notification that the xpc_hb_checker thread has exited */ -static DECLARE_COMPLETION(xpc_hb_checker_exited); +static DECLARE_MUTEX_LOCKED(xpc_hb_checker_exited); /* notification that the xpc_discovery thread has exited */ -static DECLARE_COMPLETION(xpc_discovery_exited); +static DECLARE_MUTEX_LOCKED(xpc_discovery_exited); static struct timer_list xpc_hb_timer; @@ -322,7 +321,7 @@ xpc_hb_checker(void *ignore) /* mark this thread as having exited */ - complete(&xpc_hb_checker_exited); + up(&xpc_hb_checker_exited); return 0; } @@ -342,7 +341,7 @@ xpc_initiate_discovery(void *ignore) dev_dbg(xpc_part, "discovery thread is exiting\n"); /* mark this thread as having exited */ - complete(&xpc_discovery_exited); + up(&xpc_discovery_exited); return 0; } @@ -894,7 +893,7 @@ xpc_disconnect_wait(int ch_number) continue; } - wait_for_completion(&ch->wdisconnect_wait); + (void) down(&ch->wdisconnect_sema); spin_lock_irqsave(&ch->lock, irq_flags); DBUG_ON(!(ch->flags & XPC_C_DISCONNECTED)); @@ -947,10 +946,10 @@ xpc_do_exit(enum xpc_retval reason) free_irq(SGI_XPC_ACTIVATE, NULL); /* wait for the discovery thread to exit */ - wait_for_completion(&xpc_discovery_exited); + down(&xpc_discovery_exited); /* wait for the heartbeat checker thread to exit */ - wait_for_completion(&xpc_hb_checker_exited); + down(&xpc_hb_checker_exited); /* sleep for a 1/3 of a second or so */ @@ -1368,7 +1367,7 @@ xpc_init(void) dev_err(xpc_part, "failed while forking discovery thread\n"); /* mark this new thread as a non-starter */ - complete(&xpc_discovery_exited); + up(&xpc_discovery_exited); xpc_do_exit(xpcUnloading); return -EBUSY; diff --git a/trunk/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/trunk/arch/ia64/sn/pci/pcibr/pcibr_provider.c index 2fac27049bf6..77a1262751d3 100644 --- a/trunk/arch/ia64/sn/pci/pcibr/pcibr_provider.c +++ b/trunk/arch/ia64/sn/pci/pcibr/pcibr_provider.c @@ -24,15 +24,13 @@ sal_pcibr_slot_enable(struct pcibus_info *soft, int device, void *resp) { struct ia64_sal_retval ret_stuff; u64 busnum; - u64 segment; ret_stuff.status = 0; ret_stuff.v0 = 0; - segment = soft->pbi_buscommon.bs_persist_segment; busnum = soft->pbi_buscommon.bs_persist_busnum; - SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_SLOT_ENABLE, segment, - busnum, (u64) device, (u64) resp, 0, 0, 0); + SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_SLOT_ENABLE, (u64) busnum, + (u64) device, (u64) resp, 0, 0, 0, 0); return (int)ret_stuff.v0; } @@ -43,16 +41,14 @@ sal_pcibr_slot_disable(struct pcibus_info *soft, int device, int action, { struct ia64_sal_retval ret_stuff; u64 busnum; - u64 segment; ret_stuff.status = 0; ret_stuff.v0 = 0; - segment = soft->pbi_buscommon.bs_persist_segment; busnum = soft->pbi_buscommon.bs_persist_busnum; SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_SLOT_DISABLE, - segment, busnum, (u64) device, (u64) action, - (u64) resp, 0, 0); + (u64) busnum, (u64) device, (u64) action, + (u64) resp, 0, 0, 0); return (int)ret_stuff.v0; } diff --git a/trunk/arch/powerpc/platforms/powermac/feature.c b/trunk/arch/powerpc/platforms/powermac/feature.c index 2296f3d46ca8..558dd0692092 100644 --- a/trunk/arch/powerpc/platforms/powermac/feature.c +++ b/trunk/arch/powerpc/platforms/powermac/feature.c @@ -910,18 +910,16 @@ core99_gmac_phy_reset(struct device_node *node, long param, long value) macio->type != macio_intrepid) return -ENODEV; - printk(KERN_DEBUG "Hard reset of PHY chip ...\n"); - LOCK(flags); MACIO_OUT8(KL_GPIO_ETH_PHY_RESET, KEYLARGO_GPIO_OUTPUT_ENABLE); (void)MACIO_IN8(KL_GPIO_ETH_PHY_RESET); UNLOCK(flags); - msleep(10); + mdelay(10); LOCK(flags); MACIO_OUT8(KL_GPIO_ETH_PHY_RESET, /*KEYLARGO_GPIO_OUTPUT_ENABLE | */ KEYLARGO_GPIO_OUTOUT_DATA); UNLOCK(flags); - msleep(10); + mdelay(10); return 0; } diff --git a/trunk/arch/ppc/syslib/mv64x60.c b/trunk/arch/ppc/syslib/mv64x60.c index 1f01b7e2376b..94ea346b7b4b 100644 --- a/trunk/arch/ppc/syslib/mv64x60.c +++ b/trunk/arch/ppc/syslib/mv64x60.c @@ -313,7 +313,7 @@ static struct platform_device mpsc1_device = { }; #endif -#if defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE) +#ifdef CONFIG_MV643XX_ETH static struct resource mv64x60_eth_shared_resources[] = { [0] = { .name = "ethernet shared base", @@ -456,7 +456,7 @@ static struct platform_device *mv64x60_pd_devs[] __initdata = { &mpsc0_device, &mpsc1_device, #endif -#if defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE) +#ifdef CONFIG_MV643XX_ETH &mv64x60_eth_shared_device, #endif #ifdef CONFIG_MV643XX_ETH_0 diff --git a/trunk/arch/sparc/kernel/entry.S b/trunk/arch/sparc/kernel/entry.S index 267ec8f6fb58..03ecb4e4614e 100644 --- a/trunk/arch/sparc/kernel/entry.S +++ b/trunk/arch/sparc/kernel/entry.S @@ -38,7 +38,7 @@ #define curptr g6 -#define NR_SYSCALLS 299 /* Each OS is different... */ +#define NR_SYSCALLS 284 /* Each OS is different... */ /* These are just handy. */ #define _SV save %sp, -STACKFRAME_SZ, %sp @@ -1276,6 +1276,62 @@ sys_sigstack: call do_sys_sigstack mov %l5, %o7 + .align 4 + .globl sys_sigpause +sys_sigpause: + /* Note: %o0 already has correct value... */ + call do_sigpause + add %sp, STACKFRAME_SZ, %o1 + + ld [%curptr + TI_FLAGS], %l5 + andcc %l5, _TIF_SYSCALL_TRACE, %g0 + be 1f + nop + + call syscall_trace + nop + +1: + /* We are returning to a signal handler. */ + RESTORE_ALL + + .align 4 + .globl sys_sigsuspend +sys_sigsuspend: + call do_sigsuspend + add %sp, STACKFRAME_SZ, %o0 + + ld [%curptr + TI_FLAGS], %l5 + andcc %l5, _TIF_SYSCALL_TRACE, %g0 + be 1f + nop + + call syscall_trace + nop + +1: + /* We are returning to a signal handler. */ + RESTORE_ALL + + .align 4 + .globl sys_rt_sigsuspend +sys_rt_sigsuspend: + /* Note: %o0, %o1 already have correct value... */ + call do_rt_sigsuspend + add %sp, STACKFRAME_SZ, %o2 + + ld [%curptr + TI_FLAGS], %l5 + andcc %l5, _TIF_SYSCALL_TRACE, %g0 + be 1f + nop + + call syscall_trace + nop + +1: + /* We are returning to a signal handler. */ + RESTORE_ALL + .align 4 .globl sys_sigreturn sys_sigreturn: diff --git a/trunk/arch/sparc/kernel/rtrap.S b/trunk/arch/sparc/kernel/rtrap.S index 77ca6fd81253..f7460d897e79 100644 --- a/trunk/arch/sparc/kernel/rtrap.S +++ b/trunk/arch/sparc/kernel/rtrap.S @@ -68,14 +68,15 @@ ret_trap_lockless_ipi: ld [%curptr + TI_FLAGS], %g2 signal_p: - andcc %g2, (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK), %g0 + andcc %g2, (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING), %g0 bz,a ret_trap_continue ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr - mov %l5, %o1 - mov %l6, %o2 + clr %o0 + mov %l5, %o2 + mov %l6, %o3 call do_signal - add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr + add %sp, STACKFRAME_SZ, %o1 ! pt_regs ptr /* Fall through. */ ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr diff --git a/trunk/arch/sparc/kernel/signal.c b/trunk/arch/sparc/kernel/signal.c index 0748d8147bbf..5f34d7dc2b89 100644 --- a/trunk/arch/sparc/kernel/signal.c +++ b/trunk/arch/sparc/kernel/signal.c @@ -35,6 +35,9 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr, void *fpqueue, unsigned long *fpqdepth); extern void fpload(unsigned long *fpregs, unsigned long *fsr); +asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, + unsigned long orig_o0, int restart_syscall); + /* Signal frames: the original one (compatible with SunOS): * * Set up a signal frame... Make the stack look the way SunOS @@ -92,30 +95,98 @@ struct rt_signal_frame { #define NF_ALIGNEDSZ (((sizeof(struct new_signal_frame) + 7) & (~7))) #define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame) + 7) & (~7))) -static int _sigpause_common(old_sigset_t set) +/* + * atomically swap in the new signal mask, and wait for a signal. + * This is really tricky on the Sparc, watch out... + */ +asmlinkage void _sigpause_common(old_sigset_t set, struct pt_regs *regs) { + sigset_t saveset; + set &= _BLOCKABLE; spin_lock_irq(¤t->sighand->siglock); - current->saved_sigmask = current->blocked; + saveset = current->blocked; siginitset(¤t->blocked, set); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); - current->state = TASK_INTERRUPTIBLE; - schedule(); - set_thread_flag(TIF_RESTORE_SIGMASK); + regs->pc = regs->npc; + regs->npc += 4; + + /* Condition codes and return value where set here for sigpause, + * and so got used by setup_frame, which again causes sigreturn() + * to return -EINTR. + */ + while (1) { + current->state = TASK_INTERRUPTIBLE; + schedule(); + /* + * Return -EINTR and set condition code here, + * so the interrupted system call actually returns + * these. + */ + regs->psr |= PSR_C; + regs->u_regs[UREG_I0] = EINTR; + if (do_signal(&saveset, regs, 0, 0)) + return; + } +} - return -ERESTARTNOHAND; +asmlinkage void do_sigpause(unsigned int set, struct pt_regs *regs) +{ + _sigpause_common(set, regs); } -asmlinkage int sys_sigpause(unsigned int set) +asmlinkage void do_sigsuspend (struct pt_regs *regs) { - return _sigpause_common(set); + _sigpause_common(regs->u_regs[UREG_I0], regs); } -asmlinkage int sys_sigsuspend(old_sigset_t set) +asmlinkage void do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, + struct pt_regs *regs) { - return _sigpause_common(set); + sigset_t oldset, set; + + /* XXX: Don't preclude handling different sized sigset_t's. */ + if (sigsetsize != sizeof(sigset_t)) { + regs->psr |= PSR_C; + regs->u_regs[UREG_I0] = EINVAL; + return; + } + + if (copy_from_user(&set, uset, sizeof(set))) { + regs->psr |= PSR_C; + regs->u_regs[UREG_I0] = EFAULT; + return; + } + + sigdelsetmask(&set, ~_BLOCKABLE); + spin_lock_irq(¤t->sighand->siglock); + oldset = current->blocked; + current->blocked = set; + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + + regs->pc = regs->npc; + regs->npc += 4; + + /* Condition codes and return value where set here for sigpause, + * and so got used by setup_frame, which again causes sigreturn() + * to return -EINTR. + */ + while (1) { + current->state = TASK_INTERRUPTIBLE; + schedule(); + /* + * Return -EINTR and set condition code here, + * so the interrupted system call actually returns + * these. + */ + regs->psr |= PSR_C; + regs->u_regs[UREG_I0] = EINTR; + if (do_signal(&oldset, regs, 0, 0)) + return; + } } static inline int @@ -996,13 +1067,13 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, * want to handle. Thus you cannot kill init even with a SIGKILL even by * mistake. */ -asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int restart_syscall) +asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, + unsigned long orig_i0, int restart_syscall) { siginfo_t info; struct sparc_deliver_cookie cookie; struct k_sigaction ka; int signr; - sigset_t *oldset; /* * XXX Disable svr4 signal handling until solaris emulation works. @@ -1018,9 +1089,7 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int rest cookie.restart_syscall = restart_syscall; cookie.orig_i0 = orig_i0; - if (test_thread_flag(TIF_RESTORE_SIGMASK)) - oldset = ¤t->saved_sigmask; - else + if (!oldset) oldset = ¤t->blocked; signr = get_signal_to_deliver(&info, &ka, regs, &cookie); @@ -1029,14 +1098,7 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int rest syscall_restart(cookie.orig_i0, regs, &ka.sa); handle_signal(signr, &ka, &info, oldset, regs, svr4_signal); - /* a signal was successfully delivered; the saved - * sigmask will have been stored in the signal frame, - * and will be restored by sigreturn, so we can simply - * clear the TIF_RESTORE_SIGMASK flag. - */ - if (test_thread_flag(TIF_RESTORE_SIGMASK)) - clear_thread_flag(TIF_RESTORE_SIGMASK); - return; + return 1; } if (cookie.restart_syscall && (regs->u_regs[UREG_I0] == ERESTARTNOHAND || @@ -1053,14 +1115,7 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int rest regs->pc -= 4; regs->npc -= 4; } - - /* if there's no signal to deliver, we just put the saved sigmask - * back - */ - if (test_thread_flag(TIF_RESTORE_SIGMASK)) { - clear_thread_flag(TIF_RESTORE_SIGMASK); - sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); - } + return 0; } asmlinkage int diff --git a/trunk/arch/sparc/kernel/sparc_ksyms.c b/trunk/arch/sparc/kernel/sparc_ksyms.c index 19b25399d7e4..0b0d492c953b 100644 --- a/trunk/arch/sparc/kernel/sparc_ksyms.c +++ b/trunk/arch/sparc/kernel/sparc_ksyms.c @@ -66,6 +66,7 @@ struct poll { extern int svr4_getcontext (svr4_ucontext_t *, struct pt_regs *); extern int svr4_setcontext (svr4_ucontext_t *, struct pt_regs *); +void _sigpause_common (unsigned int set, struct pt_regs *); extern void (*__copy_1page)(void *, const void *); extern void __memmove(void *, const void *, __kernel_size_t); extern void (*bzero_1page)(void *); @@ -226,6 +227,7 @@ EXPORT_SYMBOL(kunmap_atomic); /* Solaris/SunOS binary compatibility */ EXPORT_SYMBOL(svr4_setcontext); EXPORT_SYMBOL(svr4_getcontext); +EXPORT_SYMBOL(_sigpause_common); EXPORT_SYMBOL(dump_thread); diff --git a/trunk/arch/sparc/kernel/systbls.S b/trunk/arch/sparc/kernel/systbls.S index 6877ae4cd1d9..e457a40838fc 100644 --- a/trunk/arch/sparc/kernel/systbls.S +++ b/trunk/arch/sparc/kernel/systbls.S @@ -75,10 +75,7 @@ sys_call_table: /*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy /*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink /*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid -/*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat -/*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_newfstatat -/*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat -/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll +/*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl #ifdef CONFIG_SUNOS_EMUL /* Now the SunOS syscall table. */ @@ -184,11 +181,6 @@ sunos_sys_table: .long sunos_nosys, sunos_nosys, sunos_nosys .long sunos_nosys /*280*/ .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys .long sunos_nosys -/*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys - .long sunos_nosys, sunos_nosys, sunos_nosys #endif diff --git a/trunk/arch/sparc/math-emu/math.c b/trunk/arch/sparc/math-emu/math.c index 8613b3eb877c..be2c80932e26 100644 --- a/trunk/arch/sparc/math-emu/math.c +++ b/trunk/arch/sparc/math-emu/math.c @@ -323,6 +323,11 @@ static int do_one_mathemu(u32 insn, unsigned long *pfsr, unsigned long *fregs) case FMOVS: case FABSS: case FNEGS: TYPE(2,1,0,1,0,0,0); break; + default: +#ifdef DEBUG_MATHEMU + printk("unknown FPop1: %03lx\n",(insn>>5)&0x1ff); +#endif + break; } } else if ((insn & 0xc1f80000) == 0x81a80000) /* FPOP2 */ { switch ((insn >> 5) & 0x1ff) { @@ -332,6 +337,11 @@ static int do_one_mathemu(u32 insn, unsigned long *pfsr, unsigned long *fregs) case FCMPED: TYPE(3,0,0,2,1,2,1); break; case FCMPQ: TYPE(3,0,0,3,1,3,1); break; case FCMPEQ: TYPE(3,0,0,3,1,3,1); break; + default: +#ifdef DEBUG_MATHEMU + printk("unknown FPop2: %03lx\n",(insn>>5)&0x1ff); +#endif + break; } } diff --git a/trunk/arch/sparc64/kernel/entry.S b/trunk/arch/sparc64/kernel/entry.S index 12911e7463f2..710002991888 100644 --- a/trunk/arch/sparc64/kernel/entry.S +++ b/trunk/arch/sparc64/kernel/entry.S @@ -25,7 +25,7 @@ #define curptr g6 -#define NR_SYSCALLS 299 /* Each OS is different... */ +#define NR_SYSCALLS 284 /* Each OS is different... */ .text .align 32 @@ -1416,6 +1416,7 @@ execve_merge: add %sp, PTREGS_OFF, %o0 .globl sys_pipe, sys_sigpause, sys_nis_syscall + .globl sys_sigsuspend, sys_rt_sigsuspend .globl sys_rt_sigreturn .globl sys_ptrace .globl sys_sigaltstack @@ -1439,6 +1440,28 @@ sys32_sigaltstack: mov %i6, %o2 #endif .align 32 +sys_sigsuspend: add %sp, PTREGS_OFF, %o0 + call do_sigsuspend + add %o7, 1f-.-4, %o7 + nop +sys_rt_sigsuspend: /* NOTE: %o0,%o1 have a correct value already */ + add %sp, PTREGS_OFF, %o2 + call do_rt_sigsuspend + add %o7, 1f-.-4, %o7 + nop +#ifdef CONFIG_COMPAT + .globl sys32_rt_sigsuspend +sys32_rt_sigsuspend: /* NOTE: %o0,%o1 have a correct value already */ + srl %o0, 0, %o0 + add %sp, PTREGS_OFF, %o2 + call do_rt_sigsuspend32 + add %o7, 1f-.-4, %o7 +#endif + /* NOTE: %o0 has a correct value already */ +sys_sigpause: add %sp, PTREGS_OFF, %o1 + call do_sigpause + add %o7, 1f-.-4, %o7 + nop #ifdef CONFIG_COMPAT .globl sys32_sigreturn sys32_sigreturn: diff --git a/trunk/arch/sparc64/kernel/rtrap.S b/trunk/arch/sparc64/kernel/rtrap.S index b80eba0081ca..090dcca00d2a 100644 --- a/trunk/arch/sparc64/kernel/rtrap.S +++ b/trunk/arch/sparc64/kernel/rtrap.S @@ -53,13 +53,14 @@ __handle_user_windows: wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate ldx [%g6 + TI_FLAGS], %l0 -1: andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0 +1: andcc %l0, (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING), %g0 be,pt %xcc, __handle_user_windows_continue nop - mov %l5, %o1 - mov %l6, %o2 - add %sp, PTREGS_OFF, %o0 - mov %l0, %o3 + clr %o0 + mov %l5, %o2 + mov %l6, %o3 + add %sp, PTREGS_OFF, %o1 + mov %l0, %o4 call do_notify_resume wrpr %g0, RTRAP_PSTATE, %pstate @@ -95,14 +96,15 @@ __handle_perfctrs: wrpr %g0, RTRAP_PSTATE, %pstate wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate ldx [%g6 + TI_FLAGS], %l0 -1: andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0 +1: andcc %l0, (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING), %g0 be,pt %xcc, __handle_perfctrs_continue sethi %hi(TSTATE_PEF), %o0 - mov %l5, %o1 - mov %l6, %o2 - add %sp, PTREGS_OFF, %o0 - mov %l0, %o3 + clr %o0 + mov %l5, %o2 + mov %l6, %o3 + add %sp, PTREGS_OFF, %o1 + mov %l0, %o4 call do_notify_resume wrpr %g0, RTRAP_PSTATE, %pstate @@ -127,10 +129,11 @@ __handle_userfpu: ba,a,pt %xcc, __handle_userfpu_continue __handle_signal: - mov %l5, %o1 - mov %l6, %o2 - add %sp, PTREGS_OFF, %o0 - mov %l0, %o3 + clr %o0 + mov %l5, %o2 + mov %l6, %o3 + add %sp, PTREGS_OFF, %o1 + mov %l0, %o4 call do_notify_resume wrpr %g0, RTRAP_PSTATE, %pstate wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate @@ -197,7 +200,7 @@ __handle_preemption_continue: andcc %l1, %o0, %g0 andcc %l0, _TIF_NEED_RESCHED, %g0 bne,pn %xcc, __handle_preemption - andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0 + andcc %l0, (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING), %g0 bne,pn %xcc, __handle_signal __handle_signal_continue: ldub [%g6 + TI_WSAVED], %o2 diff --git a/trunk/arch/sparc64/kernel/signal.c b/trunk/arch/sparc64/kernel/signal.c index ca11a4c457d4..60f5dfabb1e1 100644 --- a/trunk/arch/sparc64/kernel/signal.c +++ b/trunk/arch/sparc64/kernel/signal.c @@ -36,6 +36,9 @@ #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) +static int do_signal(sigset_t *oldset, struct pt_regs * regs, + unsigned long orig_o0, int ret_from_syscall); + /* {set, get}context() needed for 64-bit SparcLinux userland. */ asmlinkage void sparc64_set_context(struct pt_regs *regs) { @@ -239,29 +242,114 @@ struct rt_signal_frame { /* Align macros */ #define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame) + 7) & (~7))) -static long _sigpause_common(old_sigset_t set) +/* + * atomically swap in the new signal mask, and wait for a signal. + * This is really tricky on the Sparc, watch out... + */ +asmlinkage void _sigpause_common(old_sigset_t set, struct pt_regs *regs) { + sigset_t saveset; + +#ifdef CONFIG_SPARC32_COMPAT + if (test_thread_flag(TIF_32BIT)) { + extern asmlinkage void _sigpause32_common(compat_old_sigset_t, + struct pt_regs *); + _sigpause32_common(set, regs); + return; + } +#endif set &= _BLOCKABLE; spin_lock_irq(¤t->sighand->siglock); - current->saved_sigmask = current->blocked; + saveset = current->blocked; siginitset(¤t->blocked, set); recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); + + if (test_thread_flag(TIF_32BIT)) { + regs->tpc = (regs->tnpc & 0xffffffff); + regs->tnpc = (regs->tnpc + 4) & 0xffffffff; + } else { + regs->tpc = regs->tnpc; + regs->tnpc += 4; + } - current->state = TASK_INTERRUPTIBLE; - schedule(); - set_thread_flag(TIF_RESTORE_SIGMASK); - return -ERESTARTNOHAND; + /* Condition codes and return value where set here for sigpause, + * and so got used by setup_frame, which again causes sigreturn() + * to return -EINTR. + */ + while (1) { + current->state = TASK_INTERRUPTIBLE; + schedule(); + /* + * Return -EINTR and set condition code here, + * so the interrupted system call actually returns + * these. + */ + regs->tstate |= (TSTATE_ICARRY|TSTATE_XCARRY); + regs->u_regs[UREG_I0] = EINTR; + if (do_signal(&saveset, regs, 0, 0)) + return; + } } -asmlinkage long sys_sigpause(unsigned int set) +asmlinkage void do_sigpause(unsigned int set, struct pt_regs *regs) { - return _sigpause_common(set); + _sigpause_common(set, regs); } -asmlinkage long sys_sigsuspend(old_sigset_t set) +asmlinkage void do_sigsuspend(struct pt_regs *regs) { - return _sigpause_common(set); + _sigpause_common(regs->u_regs[UREG_I0], regs); +} + +asmlinkage void do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, struct pt_regs *regs) +{ + sigset_t oldset, set; + + /* XXX: Don't preclude handling different sized sigset_t's. */ + if (sigsetsize != sizeof(sigset_t)) { + regs->tstate |= (TSTATE_ICARRY|TSTATE_XCARRY); + regs->u_regs[UREG_I0] = EINVAL; + return; + } + if (copy_from_user(&set, uset, sizeof(set))) { + regs->tstate |= (TSTATE_ICARRY|TSTATE_XCARRY); + regs->u_regs[UREG_I0] = EFAULT; + return; + } + + sigdelsetmask(&set, ~_BLOCKABLE); + spin_lock_irq(¤t->sighand->siglock); + oldset = current->blocked; + current->blocked = set; + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + + if (test_thread_flag(TIF_32BIT)) { + regs->tpc = (regs->tnpc & 0xffffffff); + regs->tnpc = (regs->tnpc + 4) & 0xffffffff; + } else { + regs->tpc = regs->tnpc; + regs->tnpc += 4; + } + + /* Condition codes and return value where set here for sigpause, + * and so got used by setup_frame, which again causes sigreturn() + * to return -EINTR. + */ + while (1) { + current->state = TASK_INTERRUPTIBLE; + schedule(); + /* + * Return -EINTR and set condition code here, + * so the interrupted system call actually returns + * these. + */ + regs->tstate |= (TSTATE_ICARRY|TSTATE_XCARRY); + regs->u_regs[UREG_I0] = EINTR; + if (do_signal(&oldset, regs, 0, 0)) + return; + } } static inline int @@ -519,29 +607,26 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, * want to handle. Thus you cannot kill init even with a SIGKILL even by * mistake. */ -static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int restart_syscall) +static int do_signal(sigset_t *oldset, struct pt_regs * regs, + unsigned long orig_i0, int restart_syscall) { siginfo_t info; struct signal_deliver_cookie cookie; struct k_sigaction ka; int signr; - sigset_t *oldset; cookie.restart_syscall = restart_syscall; cookie.orig_i0 = orig_i0; - if (test_thread_flag(TIF_RESTORE_SIGMASK)) - oldset = ¤t->saved_sigmask; - else + if (!oldset) oldset = ¤t->blocked; #ifdef CONFIG_SPARC32_COMPAT if (test_thread_flag(TIF_32BIT)) { - extern void do_signal32(sigset_t *, struct pt_regs *, - unsigned long, int); - do_signal32(oldset, regs, orig_i0, - cookie.restart_syscall); - return; + extern int do_signal32(sigset_t *, struct pt_regs *, + unsigned long, int); + return do_signal32(oldset, regs, orig_i0, + cookie.restart_syscall); } #endif @@ -550,15 +635,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int restart_s if (cookie.restart_syscall) syscall_restart(orig_i0, regs, &ka.sa); handle_signal(signr, &ka, &info, oldset, regs); - - /* a signal was successfully delivered; the saved - * sigmask will have been stored in the signal frame, - * and will be restored by sigreturn, so we can simply - * clear the TIF_RESTORE_SIGMASK flag. - */ - if (test_thread_flag(TIF_RESTORE_SIGMASK)) - clear_thread_flag(TIF_RESTORE_SIGMASK); - return; + return 1; } if (cookie.restart_syscall && (regs->u_regs[UREG_I0] == ERESTARTNOHAND || @@ -575,21 +652,15 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int restart_s regs->tpc -= 4; regs->tnpc -= 4; } - - /* if there's no signal to deliver, we just put the saved sigmask - * back - */ - if (test_thread_flag(TIF_RESTORE_SIGMASK)) { - clear_thread_flag(TIF_RESTORE_SIGMASK); - sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); - } + return 0; } -void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, int restart_syscall, +void do_notify_resume(sigset_t *oldset, struct pt_regs *regs, + unsigned long orig_i0, int restart_syscall, unsigned long thread_info_flags) { - if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) - do_signal(regs, orig_i0, restart_syscall); + if (thread_info_flags & _TIF_SIGPENDING) + do_signal(oldset, regs, orig_i0, restart_syscall); } void ptrace_signal_deliver(struct pt_regs *regs, void *cookie) diff --git a/trunk/arch/sparc64/kernel/signal32.c b/trunk/arch/sparc64/kernel/signal32.c index 708ba9b42cda..009a86e5ded4 100644 --- a/trunk/arch/sparc64/kernel/signal32.c +++ b/trunk/arch/sparc64/kernel/signal32.c @@ -32,6 +32,9 @@ #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) +int do_signal32(sigset_t *oldset, struct pt_regs *regs, + unsigned long orig_o0, int ret_from_syscall); + /* Signal frames: the original one (compatible with SunOS): * * Set up a signal frame... Make the stack look the way SunOS @@ -223,6 +226,102 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) return 0; } +/* + * atomically swap in the new signal mask, and wait for a signal. + * This is really tricky on the Sparc, watch out... + */ +asmlinkage void _sigpause32_common(compat_old_sigset_t set, struct pt_regs *regs) +{ + sigset_t saveset; + + set &= _BLOCKABLE; + spin_lock_irq(¤t->sighand->siglock); + saveset = current->blocked; + siginitset(¤t->blocked, set); + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + + regs->tpc = regs->tnpc; + regs->tnpc += 4; + if (test_thread_flag(TIF_32BIT)) { + regs->tpc &= 0xffffffff; + regs->tnpc &= 0xffffffff; + } + + /* Condition codes and return value where set here for sigpause, + * and so got used by setup_frame, which again causes sigreturn() + * to return -EINTR. + */ + while (1) { + current->state = TASK_INTERRUPTIBLE; + schedule(); + /* + * Return -EINTR and set condition code here, + * so the interrupted system call actually returns + * these. + */ + regs->tstate |= TSTATE_ICARRY; + regs->u_regs[UREG_I0] = EINTR; + if (do_signal32(&saveset, regs, 0, 0)) + return; + } +} + +asmlinkage void do_rt_sigsuspend32(u32 uset, size_t sigsetsize, struct pt_regs *regs) +{ + sigset_t oldset, set; + compat_sigset_t set32; + + /* XXX: Don't preclude handling different sized sigset_t's. */ + if (((compat_size_t)sigsetsize) != sizeof(sigset_t)) { + regs->tstate |= TSTATE_ICARRY; + regs->u_regs[UREG_I0] = EINVAL; + return; + } + if (copy_from_user(&set32, compat_ptr(uset), sizeof(set32))) { + regs->tstate |= TSTATE_ICARRY; + regs->u_regs[UREG_I0] = EFAULT; + return; + } + switch (_NSIG_WORDS) { + case 4: set.sig[3] = set32.sig[6] + (((long)set32.sig[7]) << 32); + case 3: set.sig[2] = set32.sig[4] + (((long)set32.sig[5]) << 32); + case 2: set.sig[1] = set32.sig[2] + (((long)set32.sig[3]) << 32); + case 1: set.sig[0] = set32.sig[0] + (((long)set32.sig[1]) << 32); + } + sigdelsetmask(&set, ~_BLOCKABLE); + spin_lock_irq(¤t->sighand->siglock); + oldset = current->blocked; + current->blocked = set; + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); + + regs->tpc = regs->tnpc; + regs->tnpc += 4; + if (test_thread_flag(TIF_32BIT)) { + regs->tpc &= 0xffffffff; + regs->tnpc &= 0xffffffff; + } + + /* Condition codes and return value where set here for sigpause, + * and so got used by setup_frame, which again causes sigreturn() + * to return -EINTR. + */ + while (1) { + current->state = TASK_INTERRUPTIBLE; + schedule(); + /* + * Return -EINTR and set condition code here, + * so the interrupted system call actually returns + * these. + */ + regs->tstate |= TSTATE_ICARRY; + regs->u_regs[UREG_I0] = EINTR; + if (do_signal32(&oldset, regs, 0, 0)) + return; + } +} + static int restore_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu) { unsigned long *fpregs = current_thread_info()->fpregs; @@ -1263,8 +1362,8 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs * want to handle. Thus you cannot kill init even with a SIGKILL even by * mistake. */ -void do_signal32(sigset_t *oldset, struct pt_regs * regs, - unsigned long orig_i0, int restart_syscall) +int do_signal32(sigset_t *oldset, struct pt_regs * regs, + unsigned long orig_i0, int restart_syscall) { siginfo_t info; struct signal_deliver_cookie cookie; @@ -1281,15 +1380,7 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs, syscall_restart32(orig_i0, regs, &ka.sa); handle_signal32(signr, &ka, &info, oldset, regs, svr4_signal); - - /* a signal was successfully delivered; the saved - * sigmask will have been stored in the signal frame, - * and will be restored by sigreturn, so we can simply - * clear the TIF_RESTORE_SIGMASK flag. - */ - if (test_thread_flag(TIF_RESTORE_SIGMASK)) - clear_thread_flag(TIF_RESTORE_SIGMASK); - return; + return 1; } if (cookie.restart_syscall && (regs->u_regs[UREG_I0] == ERESTARTNOHAND || @@ -1306,14 +1397,7 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs, regs->tpc -= 4; regs->tnpc -= 4; } - - /* if there's no signal to deliver, we just put the saved sigmask - * back - */ - if (test_thread_flag(TIF_RESTORE_SIGMASK)) { - clear_thread_flag(TIF_RESTORE_SIGMASK); - sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); - } + return 0; } struct sigstack32 { diff --git a/trunk/arch/sparc64/kernel/sparc64_ksyms.c b/trunk/arch/sparc64/kernel/sparc64_ksyms.c index 3c06bfb92a8c..d177d7e5c9d3 100644 --- a/trunk/arch/sparc64/kernel/sparc64_ksyms.c +++ b/trunk/arch/sparc64/kernel/sparc64_ksyms.c @@ -69,6 +69,7 @@ struct poll { extern void die_if_kernel(char *str, struct pt_regs *regs); extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); +void _sigpause_common (unsigned int set, struct pt_regs *); extern void *__bzero(void *, size_t); extern void *__memscan_zero(void *, size_t); extern void *__memscan_generic(void *, int, size_t); @@ -235,10 +236,9 @@ EXPORT_SYMBOL(pci_dma_supported); /* I/O device mmaping on Sparc64. */ EXPORT_SYMBOL(io_remap_pfn_range); -#ifdef CONFIG_COMPAT /* Solaris/SunOS binary compatibility */ +EXPORT_SYMBOL(_sigpause_common); EXPORT_SYMBOL(verify_compat_iovec); -#endif EXPORT_SYMBOL(dump_fpu); EXPORT_SYMBOL(pte_alloc_one_kernel); diff --git a/trunk/arch/sparc64/kernel/sys32.S b/trunk/arch/sparc64/kernel/sys32.S index 60b59375aa78..9cd272ac3ac1 100644 --- a/trunk/arch/sparc64/kernel/sys32.S +++ b/trunk/arch/sparc64/kernel/sys32.S @@ -84,6 +84,7 @@ SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5) SIGN2(sys32_bdflush, sys_bdflush, %o0, %o1) SIGN1(sys32_mlockall, sys_mlockall, %o0) SIGN1(sys32_nfsservctl, compat_sys_nfsservctl, %o0) +SIGN1(sys32_clock_settime, compat_sys_clock_settime, %o1) SIGN1(sys32_clock_nanosleep, compat_sys_clock_nanosleep, %o1) SIGN1(sys32_timer_settime, compat_sys_timer_settime, %o1) SIGN1(sys32_io_submit, compat_sys_io_submit, %o1) diff --git a/trunk/arch/sparc64/kernel/systbls.S b/trunk/arch/sparc64/kernel/systbls.S index 2881faf36635..98d24bc00044 100644 --- a/trunk/arch/sparc64/kernel/systbls.S +++ b/trunk/arch/sparc64/kernel/systbls.S @@ -41,7 +41,7 @@ sys_call_table32: /*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid .word sys_fsync, sys32_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall /*100*/ .word sys32_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending - .word compat_sys_rt_sigtimedwait, sys32_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid + .word compat_sys_rt_sigtimedwait, sys32_rt_sigqueueinfo, sys32_rt_sigsuspend, sys_setresuid, sys_getresuid /*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall .word sys32_getgroups, sys32_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd /*120*/ .word compat_sys_readv, compat_sys_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod @@ -71,15 +71,12 @@ sys_call_table32: /*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep /*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl - .word sys_ni_syscall, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep + .word sys_ni_syscall, sys32_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid -/*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat - .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_newfstatat -/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat - .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll +/*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl #endif /* CONFIG_COMPAT */ @@ -145,10 +142,7 @@ sys_call_table: .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy /*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid -/*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat - .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, compat_sys_newfstatat -/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat - .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll +/*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl #if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ defined(CONFIG_SOLARIS_EMUL_MODULE) @@ -245,20 +239,13 @@ sunos_sys_table: /*250*/ .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sunos_nosys - .word sunos_nosys -/*260*/ .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sunos_nosys - .word sunos_nosys -/*270*/ .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sunos_nosys - .word sunos_nosys -/*280*/ .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sunos_nosys - .word sunos_nosys -/*290*/ .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sunos_nosys + .word sunos_nosys #endif diff --git a/trunk/arch/sparc64/solaris/entry64.S b/trunk/arch/sparc64/solaris/entry64.S index eb314ed23cdb..4b6ae583c0a3 100644 --- a/trunk/arch/sparc64/solaris/entry64.S +++ b/trunk/arch/sparc64/solaris/entry64.S @@ -180,8 +180,6 @@ solaris_sigsuspend: nop call sys_sigsuspend stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] - b,pt %xcc, ret_from_solaris - nop .globl solaris_getpid solaris_getpid: diff --git a/trunk/block/elevator.c b/trunk/block/elevator.c index 96a61e029ce5..c9f424d5399c 100644 --- a/trunk/block/elevator.c +++ b/trunk/block/elevator.c @@ -139,16 +139,35 @@ static int elevator_attach(request_queue_t *q, struct elevator_type *e, static char chosen_elevator[16]; -static int __init elevator_setup(char *str) +static void elevator_setup_default(void) { + struct elevator_type *e; + + /* + * If default has not been set, use the compiled-in selection. + */ + if (!chosen_elevator[0]) + strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED); + /* * Be backwards-compatible with previous kernels, so users * won't get the wrong elevator. */ - if (!strcmp(str, "as")) + if (!strcmp(chosen_elevator, "as")) strcpy(chosen_elevator, "anticipatory"); + + /* + * If the given scheduler is not available, fall back to the default + */ + if ((e = elevator_find(chosen_elevator))) + elevator_put(e); else - strncpy(chosen_elevator, str, sizeof(chosen_elevator) - 1); + strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED); +} + +static int __init elevator_setup(char *str) +{ + strncpy(chosen_elevator, str, sizeof(chosen_elevator) - 1); return 0; } @@ -165,16 +184,14 @@ int elevator_init(request_queue_t *q, char *name) q->end_sector = 0; q->boundary_rq = NULL; - if (name && !(e = elevator_get(name))) - return -EINVAL; + elevator_setup_default(); - if (!e && *chosen_elevator && !(e = elevator_get(chosen_elevator))) - printk("I/O scheduler %s not found\n", chosen_elevator); + if (!name) + name = chosen_elevator; - if (!e && !(e = elevator_get(CONFIG_DEFAULT_IOSCHED))) { - printk("Default I/O scheduler not found, using no-op\n"); - e = elevator_get("noop"); - } + e = elevator_get(name); + if (!e) + return -EINVAL; eq = kmalloc(sizeof(struct elevator_queue), GFP_KERNEL); if (!eq) { @@ -652,10 +669,8 @@ int elv_register(struct elevator_type *e) spin_unlock_irq(&elv_list_lock); printk(KERN_INFO "io scheduler %s registered", e->elevator_name); - if (!strcmp(e->elevator_name, chosen_elevator) || - (!*chosen_elevator && - !strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED))) - printk(" (default)"); + if (!strcmp(e->elevator_name, chosen_elevator)) + printk(" (default)"); printk("\n"); return 0; } diff --git a/trunk/block/ll_rw_blk.c b/trunk/block/ll_rw_blk.c index d38b4afa37ef..8e27d0ab0d7c 100644 --- a/trunk/block/ll_rw_blk.c +++ b/trunk/block/ll_rw_blk.c @@ -304,7 +304,6 @@ static inline void rq_init(request_queue_t *q, struct request *rq) * blk_queue_ordered - does this queue support ordered writes * @q: the request queue * @ordered: one of QUEUE_ORDERED_* - * @prepare_flush_fn: rq setup helper for cache flush ordered writes * * Description: * For journalled file systems, doing ordered writes on a commit @@ -333,7 +332,6 @@ int blk_queue_ordered(request_queue_t *q, unsigned ordered, return -EINVAL; } - q->ordered = ordered; q->next_ordered = ordered; q->prepare_flush_fn = prepare_flush_fn; @@ -664,7 +662,7 @@ EXPORT_SYMBOL(blk_queue_bounce_limit); * Enables a low level driver to set an upper limit on the size of * received requests. **/ -void blk_queue_max_sectors(request_queue_t *q, unsigned int max_sectors) +void blk_queue_max_sectors(request_queue_t *q, unsigned short max_sectors) { if ((max_sectors << 9) < PAGE_CACHE_SIZE) { max_sectors = 1 << (PAGE_CACHE_SHIFT - 9); @@ -2634,7 +2632,6 @@ EXPORT_SYMBOL(blk_put_request); /** * blk_end_sync_rq - executes a completion event on a request * @rq: request to complete - * @error: end io status of the request */ void blk_end_sync_rq(struct request *rq, int error) { @@ -3156,7 +3153,7 @@ static int __end_that_request_first(struct request *req, int uptodate, if (blk_fs_request(req) && req->rq_disk) { const int rw = rq_data_dir(req); - disk_stat_add(req->rq_disk, sectors[rw], nr_bytes >> 9); + __disk_stat_add(req->rq_disk, sectors[rw], nr_bytes >> 9); } total_bytes = bio_nbytes = 0; diff --git a/trunk/drivers/input/touchscreen/ads7846.c b/trunk/drivers/input/touchscreen/ads7846.c index dd8c6a9ffc76..b45a45ca7cc9 100644 --- a/trunk/drivers/input/touchscreen/ads7846.c +++ b/trunk/drivers/input/touchscreen/ads7846.c @@ -29,9 +29,6 @@ #ifdef CONFIG_ARCH_OMAP #include #endif - -#else -#define set_irq_type(irq,type) do{}while(0) #endif @@ -509,14 +506,14 @@ static int __devinit ads7846_probe(struct spi_device *spi) ts->msg.complete = ads7846_rx; ts->msg.context = ts; - if (request_irq(spi->irq, ads7846_irq, SA_SAMPLE_RANDOM, - spi->dev.bus_id, ts)) { + if (request_irq(spi->irq, ads7846_irq, + SA_SAMPLE_RANDOM | SA_TRIGGER_FALLING, + spi->dev.bus_id, ts)) { dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); input_unregister_device(&ts->input); kfree(ts); return -EBUSY; } - set_irq_type(spi->irq, IRQT_FALLING); dev_info(&spi->dev, "touchscreen, irq %d\n", spi->irq); diff --git a/trunk/drivers/net/Kconfig b/trunk/drivers/net/Kconfig index 6a6a08441804..626508afe1b1 100644 --- a/trunk/drivers/net/Kconfig +++ b/trunk/drivers/net/Kconfig @@ -2034,28 +2034,13 @@ config SKGE It does not support the link failover and network management features that "portable" vendor supplied sk98lin driver does. - This driver supports adapters based on the original Yukon chipset: - Marvell 88E8001, Belkin F5D5005, CNet GigaCard, DLink DGE-530T, - Linksys EG1032/EG1064, 3Com 3C940/3C940B, SysKonnect SK-9871/9872. - - It does not support the newer Yukon2 chipset: a separate driver, - sky2, is provided for Yukon2-based adapters. - - To compile this driver as a module, choose M here: the module - will be called skge. This is recommended. config SKY2 tristate "SysKonnect Yukon2 support (EXPERIMENTAL)" depends on PCI && EXPERIMENTAL select CRC32 ---help--- - This driver supports Gigabit Ethernet adapters based on the the - Marvell Yukon 2 chipset: - Marvell 88E8021/88E8022/88E8035/88E8036/88E8038/88E8050/88E8052/ - 88E8053/88E8055/88E8061/88E8062, SysKonnect SK-9E21D/SK-9S21 - - This driver does not support the original Yukon chipset: a seperate - driver, skge, is provided for Yukon-based adapters. + This driver support the Marvell Yukon 2 Gigabit Ethernet adapter. To compile this driver as a module, choose M here: the module will be called sky2. This is recommended. @@ -2065,15 +2050,8 @@ config SK98LIN depends on PCI ---help--- Say Y here if you have a Marvell Yukon or SysKonnect SK-98xx/SK-95xx - compliant Gigabit Ethernet Adapter. - - This driver supports the original Yukon chipset. A cleaner driver is - also available (skge) which seems to work better than this one. - - This driver does not support the newer Yukon2 chipset. A seperate - driver, sky2, is provided to support Yukon2-based adapters. - - The following adapters are supported by this driver: + compliant Gigabit Ethernet Adapter. The following adapters are supported + by this driver: - 3Com 3C940 Gigabit LOM Ethernet Adapter - 3Com 3C941 Gigabit LOM Ethernet Adapter - Allied Telesyn AT-2970LX Gigabit Ethernet Adapter diff --git a/trunk/drivers/net/acenic.c b/trunk/drivers/net/acenic.c index b508812e97ac..b8953de5664a 100644 --- a/trunk/drivers/net/acenic.c +++ b/trunk/drivers/net/acenic.c @@ -1002,8 +1002,6 @@ static int __devinit ace_init(struct net_device *dev) mac1 = 0; for(i = 0; i < 4; i++) { - int tmp; - mac1 = mac1 << 8; tmp = read_eeprom_byte(dev, 0x8c+i); if (tmp < 0) { @@ -1014,8 +1012,6 @@ static int __devinit ace_init(struct net_device *dev) } mac2 = 0; for(i = 4; i < 8; i++) { - int tmp; - mac2 = mac2 << 8; tmp = read_eeprom_byte(dev, 0x8c+i); if (tmp < 0) { diff --git a/trunk/drivers/net/b44.c b/trunk/drivers/net/b44.c index c3267e4e1bb0..df9d6e80c4f2 100644 --- a/trunk/drivers/net/b44.c +++ b/trunk/drivers/net/b44.c @@ -1399,6 +1399,7 @@ static int b44_open(struct net_device *dev) b44_init_rings(bp); b44_init_hw(bp); + netif_carrier_off(dev); b44_check_phy(bp); err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev); @@ -1463,7 +1464,7 @@ static int b44_close(struct net_device *dev) #endif b44_halt(bp); b44_free_rings(bp); - netif_carrier_off(dev); + netif_carrier_off(bp->dev); spin_unlock_irq(&bp->lock); @@ -1999,8 +2000,6 @@ static int __devinit b44_init_one(struct pci_dev *pdev, dev->irq = pdev->irq; SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); - netif_carrier_off(dev); - err = b44_get_invariants(bp); if (err) { printk(KERN_ERR PFX "Problem fetching invariants of chip, " diff --git a/trunk/drivers/net/bonding/bond_main.c b/trunk/drivers/net/bonding/bond_main.c index 4ff006c37626..2582d98ef5c3 100644 --- a/trunk/drivers/net/bonding/bond_main.c +++ b/trunk/drivers/net/bonding/bond_main.c @@ -576,7 +576,7 @@ static int bond_update_speed_duplex(struct slave *slave) slave->duplex = DUPLEX_FULL; if (slave_dev->ethtool_ops) { - int res; + u32 res; if (!slave_dev->ethtool_ops->get_settings) { return -1; diff --git a/trunk/drivers/net/mv643xx_eth.c b/trunk/drivers/net/mv643xx_eth.c index 7ef4b0434a3f..40ae36b20c9d 100644 --- a/trunk/drivers/net/mv643xx_eth.c +++ b/trunk/drivers/net/mv643xx_eth.c @@ -444,7 +444,6 @@ static int mv643xx_eth_receive_queue(struct net_device *dev) netif_rx(skb); #endif } - dev->last_rx = jiffies; } return received_packets; @@ -462,7 +461,7 @@ static int mv643xx_eth_receive_queue(struct net_device *dev) */ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id, - struct pt_regs *regs) + struct pt_regs *regs) { struct net_device *dev = (struct net_device *)dev_id; struct mv643xx_private *mp = netdev_priv(dev); @@ -1048,15 +1047,16 @@ static int mv643xx_poll(struct net_device *dev, int *budget) static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb) { - unsigned int frag; - skb_frag_t *fragp; + unsigned int frag; + skb_frag_t *fragp; - for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { - fragp = &skb_shinfo(skb)->frags[frag]; - if (fragp->size <= 8 && fragp->page_offset & 0x7) - return 1; - } - return 0; + for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { + fragp = &skb_shinfo(skb)->frags[frag]; + if (fragp->size <= 8 && fragp->page_offset & 0x7) + return 1; + + } + return 0; } @@ -2137,26 +2137,26 @@ static void eth_port_set_multicast_list(struct net_device *dev) */ if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI)) { for (table_index = 0; table_index <= 0xFC; table_index += 4) { - /* Set all entries in DA filter special multicast - * table (Ex_dFSMT) - * Set for ETH_Q0 for now - * Bits - * 0 Accept=1, Drop=0 - * 3-1 Queue ETH_Q0=0 - * 7-4 Reserved = 0; - */ - mv_write(MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); - - /* Set all entries in DA filter other multicast - * table (Ex_dFOMT) - * Set for ETH_Q0 for now - * Bits - * 0 Accept=1, Drop=0 - * 3-1 Queue ETH_Q0=0 - * 7-4 Reserved = 0; - */ - mv_write(MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); - } + /* Set all entries in DA filter special multicast + * table (Ex_dFSMT) + * Set for ETH_Q0 for now + * Bits + * 0 Accept=1, Drop=0 + * 3-1 Queue ETH_Q0=0 + * 7-4 Reserved = 0; + */ + mv_write(MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); + + /* Set all entries in DA filter other multicast + * table (Ex_dFOMT) + * Set for ETH_Q0 for now + * Bits + * 0 Accept=1, Drop=0 + * 3-1 Queue ETH_Q0=0 + * 7-4 Reserved = 0; + */ + mv_write(MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); + } return; } @@ -2617,6 +2617,7 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, struct eth_tx_desc *current_descriptor; struct eth_tx_desc *first_descriptor; u32 command; + unsigned long flags; /* Do not process Tx ring in case of Tx ring resource error */ if (mp->tx_resource_err) @@ -2633,6 +2634,8 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, return ETH_ERROR; } + spin_lock_irqsave(&mp->lock, flags); + mp->tx_ring_skbs++; BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); @@ -2682,11 +2685,15 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, mp->tx_resource_err = 1; mp->tx_curr_desc_q = tx_first_desc; + spin_unlock_irqrestore(&mp->lock, flags); + return ETH_QUEUE_LAST_RESOURCE; } mp->tx_curr_desc_q = tx_next_desc; + spin_unlock_irqrestore(&mp->lock, flags); + return ETH_OK; } #else @@ -2697,11 +2704,14 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, int tx_desc_used; struct eth_tx_desc *current_descriptor; unsigned int command_status; + unsigned long flags; /* Do not process Tx ring in case of Tx ring resource error */ if (mp->tx_resource_err) return ETH_QUEUE_FULL; + spin_lock_irqsave(&mp->lock, flags); + mp->tx_ring_skbs++; BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); @@ -2732,9 +2742,12 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, /* Check for ring index overlap in the Tx desc ring */ if (tx_desc_curr == tx_desc_used) { mp->tx_resource_err = 1; + + spin_unlock_irqrestore(&mp->lock, flags); return ETH_QUEUE_LAST_RESOURCE; } + spin_unlock_irqrestore(&mp->lock, flags); return ETH_OK; } #endif @@ -2885,10 +2898,8 @@ static ETH_FUNC_RET_STATUS eth_port_receive(struct mv643xx_private *mp, p_pkt_info->return_info = mp->rx_skb[rx_curr_desc]; p_pkt_info->l4i_chk = p_rx_desc->buf_size; - /* - * Clean the return info field to indicate that the - * packet has been moved to the upper layers - */ + /* Clean the return info field to indicate that the packet has been */ + /* moved to the upper layers */ mp->rx_skb[rx_curr_desc] = NULL; /* Update current index in data structure */ @@ -2969,7 +2980,7 @@ struct mv643xx_stats { }; #define MV643XX_STAT(m) sizeof(((struct mv643xx_private *)0)->m), \ - offsetof(struct mv643xx_private, m) + offsetof(struct mv643xx_private, m) static const struct mv643xx_stats mv643xx_gstrings_stats[] = { { "rx_packets", MV643XX_STAT(stats.rx_packets) }, @@ -3120,8 +3131,9 @@ mv643xx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) return 0; } -static void mv643xx_get_drvinfo(struct net_device *netdev, - struct ethtool_drvinfo *drvinfo) +static void +mv643xx_get_drvinfo(struct net_device *netdev, + struct ethtool_drvinfo *drvinfo) { strncpy(drvinfo->driver, mv643xx_driver_name, 32); strncpy(drvinfo->version, mv643xx_driver_version, 32); @@ -3130,37 +3142,39 @@ static void mv643xx_get_drvinfo(struct net_device *netdev, drvinfo->n_stats = MV643XX_STATS_LEN; } -static int mv643xx_get_stats_count(struct net_device *netdev) +static int +mv643xx_get_stats_count(struct net_device *netdev) { return MV643XX_STATS_LEN; } -static void mv643xx_get_ethtool_stats(struct net_device *netdev, - struct ethtool_stats *stats, uint64_t *data) +static void +mv643xx_get_ethtool_stats(struct net_device *netdev, + struct ethtool_stats *stats, uint64_t *data) { struct mv643xx_private *mp = netdev->priv; int i; eth_update_mib_counters(mp); - for (i = 0; i < MV643XX_STATS_LEN; i++) { + for(i = 0; i < MV643XX_STATS_LEN; i++) { char *p = (char *)mp+mv643xx_gstrings_stats[i].stat_offset; - data[i] = (mv643xx_gstrings_stats[i].sizeof_stat == + data[i] = (mv643xx_gstrings_stats[i].sizeof_stat == sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; } } -static void mv643xx_get_strings(struct net_device *netdev, uint32_t stringset, - uint8_t *data) +static void +mv643xx_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) { int i; switch(stringset) { case ETH_SS_STATS: for (i=0; i < MV643XX_STATS_LEN; i++) { - memcpy(data + i * ETH_GSTRING_LEN, - mv643xx_gstrings_stats[i].stat_string, - ETH_GSTRING_LEN); + memcpy(data + i * ETH_GSTRING_LEN, + mv643xx_gstrings_stats[i].stat_string, + ETH_GSTRING_LEN); } break; } diff --git a/trunk/drivers/net/s2io.c b/trunk/drivers/net/s2io.c index 49b597cbc19a..89c46787676c 100644 --- a/trunk/drivers/net/s2io.c +++ b/trunk/drivers/net/s2io.c @@ -3586,7 +3586,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) txdp->Buffer_Pointer = (u64) pci_map_page (sp->pdev, frag->page, frag->page_offset, frag->size, PCI_DMA_TODEVICE); - txdp->Control_1 = TXD_BUFFER0_SIZE(frag->size); + txdp->Control_1 |= TXD_BUFFER0_SIZE(frag->size); if (skb_shinfo(skb)->ufo_size) txdp->Control_1 |= TXD_UFO_EN; } diff --git a/trunk/drivers/net/sungem.c b/trunk/drivers/net/sungem.c index 55f3b856236e..28ce47a02408 100644 --- a/trunk/drivers/net/sungem.c +++ b/trunk/drivers/net/sungem.c @@ -1653,40 +1653,36 @@ static void gem_init_rings(struct gem *gp) /* Init PHY interface and start link poll state machine */ static void gem_init_phy(struct gem *gp) { - u32 mif_cfg; + u32 mifcfg; /* Revert MIF CFG setting done on stop_phy */ - mif_cfg = readl(gp->regs + MIF_CFG); - mif_cfg &= ~(MIF_CFG_PSELECT|MIF_CFG_POLL|MIF_CFG_BBMODE|MIF_CFG_MDI1); - mif_cfg |= MIF_CFG_MDI0; - writel(mif_cfg, gp->regs + MIF_CFG); - writel(PCS_DMODE_MGM, gp->regs + PCS_DMODE); - writel(MAC_XIFCFG_OE, gp->regs + MAC_XIFCFG); + mifcfg = readl(gp->regs + MIF_CFG); + mifcfg &= ~MIF_CFG_BBMODE; + writel(mifcfg, gp->regs + MIF_CFG); if (gp->pdev->vendor == PCI_VENDOR_ID_APPLE) { int i; - u16 ctrl; + /* Those delay sucks, the HW seem to love them though, I'll + * serisouly consider breaking some locks here to be able + * to schedule instead + */ + for (i = 0; i < 3; i++) { #ifdef CONFIG_PPC_PMAC - pmac_call_feature(PMAC_FTR_GMAC_PHY_RESET, gp->of_node, 0, 0); + pmac_call_feature(PMAC_FTR_GMAC_PHY_RESET, gp->of_node, 0, 0); + msleep(20); #endif - - /* Some PHYs used by apple have problem getting back - * to us, we do an additional reset here - */ - phy_write(gp, MII_BMCR, BMCR_RESET); - for (i = 0; i < 50; i++) { - if ((phy_read(gp, MII_BMCR) & BMCR_RESET) == 0) + /* Some PHYs used by apple have problem getting back to us, + * we do an additional reset here + */ + phy_write(gp, MII_BMCR, BMCR_RESET); + msleep(20); + if (phy_read(gp, MII_BMCR) != 0xffff) break; - msleep(10); + if (i == 2) + printk(KERN_WARNING "%s: GMAC PHY not responding !\n", + gp->dev->name); } - if (i == 50) - printk(KERN_WARNING "%s: GMAC PHY not responding !\n", - gp->dev->name); - /* Make sure isolate is off */ - ctrl = phy_read(gp, MII_BMCR); - if (ctrl & BMCR_ISOLATE) - phy_write(gp, MII_BMCR, ctrl & ~BMCR_ISOLATE); } if (gp->pdev->vendor == PCI_VENDOR_ID_SUN && @@ -2123,7 +2119,7 @@ static void gem_reinit_chip(struct gem *gp) /* Must be invoked with no lock held. */ static void gem_stop_phy(struct gem *gp, int wol) { - u32 mif_cfg; + u32 mifcfg; unsigned long flags; /* Let the chip settle down a bit, it seems that helps @@ -2134,9 +2130,9 @@ static void gem_stop_phy(struct gem *gp, int wol) /* Make sure we aren't polling PHY status change. We * don't currently use that feature though */ - mif_cfg = readl(gp->regs + MIF_CFG); - mif_cfg &= ~MIF_CFG_POLL; - writel(mif_cfg, gp->regs + MIF_CFG); + mifcfg = readl(gp->regs + MIF_CFG); + mifcfg &= ~MIF_CFG_POLL; + writel(mifcfg, gp->regs + MIF_CFG); if (wol && gp->has_wol) { unsigned char *e = &gp->dev->dev_addr[0]; @@ -2186,8 +2182,7 @@ static void gem_stop_phy(struct gem *gp, int wol) /* According to Apple, we must set the MDIO pins to this begnign * state or we may 1) eat more current, 2) damage some PHYs */ - mif_cfg = 0; - writel(mif_cfg | MIF_CFG_BBMODE, gp->regs + MIF_CFG); + writel(mifcfg | MIF_CFG_BBMODE, gp->regs + MIF_CFG); writel(0, gp->regs + MIF_BBCLK); writel(0, gp->regs + MIF_BBDATA); writel(0, gp->regs + MIF_BBOENAB); diff --git a/trunk/drivers/net/wireless/hostap/Kconfig b/trunk/drivers/net/wireless/hostap/Kconfig index 308f773ad566..c8f6286dd35f 100644 --- a/trunk/drivers/net/wireless/hostap/Kconfig +++ b/trunk/drivers/net/wireless/hostap/Kconfig @@ -75,7 +75,7 @@ config HOSTAP_PCI config HOSTAP_CS tristate "Host AP driver for Prism2/2.5/3 PC Cards" - depends on PCMCIA && HOSTAP + depends on PCMCIA!=n && HOSTAP ---help--- Host AP driver's version for Prism2/2.5/3 PC Cards. diff --git a/trunk/drivers/net/wireless/ipw2100.c b/trunk/drivers/net/wireless/ipw2100.c index 6290c9f7e939..8bf02763b5c7 100644 --- a/trunk/drivers/net/wireless/ipw2100.c +++ b/trunk/drivers/net/wireless/ipw2100.c @@ -2201,17 +2201,6 @@ static int ipw2100_alloc_skb(struct ipw2100_priv *priv, #define SEARCH_SNAPSHOT 1 #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) -static void ipw2100_snapshot_free(struct ipw2100_priv *priv) -{ - int i; - if (!priv->snapshot[0]) - return; - for (i = 0; i < 0x30; i++) - kfree(priv->snapshot[i]); - priv->snapshot[0] = NULL; -} - -#ifdef CONFIG_IPW2100_DEBUG_C3 static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) { int i; @@ -2232,6 +2221,16 @@ static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) return 1; } +static void ipw2100_snapshot_free(struct ipw2100_priv *priv) +{ + int i; + if (!priv->snapshot[0]) + return; + for (i = 0; i < 0x30; i++) + kfree(priv->snapshot[i]); + priv->snapshot[0] = NULL; +} + static u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, size_t len, int mode) { @@ -2270,7 +2269,6 @@ static u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, return ret; } -#endif /* * @@ -7114,17 +7112,11 @@ static int ipw2100_wx_set_txpow(struct net_device *dev, { struct ipw2100_priv *priv = ieee80211_priv(dev); int err = 0, value; - - if (ipw_radio_kill_sw(priv, wrqu->txpower.disabled)) - return -EINPROGRESS; if (priv->ieee->iw_mode != IW_MODE_ADHOC) - return 0; - - if ((wrqu->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) return -EINVAL; - if (wrqu->txpower.fixed == 0) + if (wrqu->txpower.disabled == 1 || wrqu->txpower.fixed == 0) value = IPW_TX_POWER_DEFAULT; else { if (wrqu->txpower.value < IPW_TX_POWER_MIN_DBM || @@ -7159,19 +7151,24 @@ static int ipw2100_wx_get_txpow(struct net_device *dev, struct ipw2100_priv *priv = ieee80211_priv(dev); - wrqu->txpower.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; + if (priv->ieee->iw_mode != IW_MODE_ADHOC) { + wrqu->power.disabled = 1; + return 0; + } if (priv->tx_power == IPW_TX_POWER_DEFAULT) { - wrqu->txpower.fixed = 0; - wrqu->txpower.value = IPW_TX_POWER_MAX_DBM; + wrqu->power.fixed = 0; + wrqu->power.value = IPW_TX_POWER_MAX_DBM; + wrqu->power.disabled = 1; } else { - wrqu->txpower.fixed = 1; - wrqu->txpower.value = priv->tx_power; + wrqu->power.disabled = 0; + wrqu->power.fixed = 1; + wrqu->power.value = priv->tx_power; } - wrqu->txpower.flags = IW_TXPOW_DBM; + wrqu->power.flags = IW_TXPOW_DBM; - IPW_DEBUG_WX("GET TX Power -> %d \n", wrqu->txpower.value); + IPW_DEBUG_WX("GET TX Power -> %d \n", wrqu->power.value); return 0; } diff --git a/trunk/drivers/net/wireless/ipw2200.c b/trunk/drivers/net/wireless/ipw2200.c index 916b24c544e2..4c28e332ecc3 100644 --- a/trunk/drivers/net/wireless/ipw2200.c +++ b/trunk/drivers/net/wireless/ipw2200.c @@ -8012,10 +8012,6 @@ static int ipw_sw_reset(struct ipw_priv *priv, int init) else IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); - priv->config &= ~CFG_STATIC_ESSID; - priv->essid_len = 0; - memset(priv->essid, 0, IW_ESSID_MAX_SIZE); - if (disable) { priv->status |= STATUS_RF_KILL_SW; IPW_DEBUG_INFO("Radio disabled.\n"); @@ -11039,6 +11035,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) net_dev->set_multicast_list = ipw_net_set_multicast_list; net_dev->set_mac_address = ipw_net_set_mac_address; priv->wireless_data.spy_data = &priv->ieee->spy_data; + priv->wireless_data.ieee80211 = priv->ieee; net_dev->wireless_data = &priv->wireless_data; net_dev->wireless_handlers = &ipw_wx_handler_def; net_dev->ethtool_ops = &ipw_ethtool_ops; @@ -11124,8 +11121,8 @@ static void ipw_pci_remove(struct pci_dev *pdev) /* Free MAC hash list for ADHOC */ for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) { list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) { - list_del(p); kfree(list_entry(p, struct ipw_ibss_seq, list)); + list_del(p); } } diff --git a/trunk/drivers/net/wireless/orinoco_cs.c b/trunk/drivers/net/wireless/orinoco_cs.c index 3c128b692bce..b664708481cc 100644 --- a/trunk/drivers/net/wireless/orinoco_cs.c +++ b/trunk/drivers/net/wireless/orinoco_cs.c @@ -261,13 +261,13 @@ orinoco_cs_config(dev_link_t *link) /* Note that the CIS values need to be rescaled */ if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { if (conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { - DEBUG(2, "orinoco_cs_config: Vcc mismatch (conf.Vcc = %d, cfg CIS = %d)\n", conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); + DEBUG(2, "orinoco_cs_config: Vcc mismatch (conf.Vcc = %d, CIS = %d)\n", conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); if (!ignore_cis_vcc) goto next_entry; } } else if (dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { if (conf.Vcc != dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) { - DEBUG(2, "orinoco_cs_config: Vcc mismatch (conf.Vcc = %d, dflt CIS = %d)\n", conf.Vcc, dflt.vcc.param[CISTPL_POWER_VNOM] / 10000); + DEBUG(2, "orinoco_cs_config: Vcc mismatch (conf.Vcc = %d, CIS = %d)\n", conf.Vcc, dflt.vcc.param[CISTPL_POWER_VNOM] / 10000); if(!ignore_cis_vcc) goto next_entry; } diff --git a/trunk/drivers/pci/msi.c b/trunk/drivers/pci/msi.c index 8e1ba0b7a8e4..202b7507a357 100644 --- a/trunk/drivers/pci/msi.c +++ b/trunk/drivers/pci/msi.c @@ -416,9 +416,7 @@ static void attach_msi_entry(struct msi_desc *entry, int vector) static void irq_handler_init(int cap_id, int pos, int mask) { - unsigned long flags; - - spin_lock_irqsave(&irq_desc[pos].lock, flags); + spin_lock(&irq_desc[pos].lock); if (cap_id == PCI_CAP_ID_MSIX) irq_desc[pos].handler = &msix_irq_type; else { @@ -427,7 +425,7 @@ static void irq_handler_init(int cap_id, int pos, int mask) else irq_desc[pos].handler = &msi_irq_w_maskbit_type; } - spin_unlock_irqrestore(&irq_desc[pos].lock, flags); + spin_unlock(&irq_desc[pos].lock); } static void enable_msi_mode(struct pci_dev *dev, int pos, int type) diff --git a/trunk/drivers/scsi/libata-scsi.c b/trunk/drivers/scsi/libata-scsi.c index 07b1e7cc61df..cfbceb504718 100644 --- a/trunk/drivers/scsi/libata-scsi.c +++ b/trunk/drivers/scsi/libata-scsi.c @@ -1700,31 +1700,6 @@ static unsigned int ata_msense_rw_recovery(u8 **ptr_io, const u8 *last) return sizeof(def_rw_recovery_mpage); } -/* - * We can turn this into a real blacklist if it's needed, for now just - * blacklist any Maxtor BANC1G10 revision firmware - */ -static int ata_dev_supports_fua(u16 *id) -{ - unsigned char model[41], fw[9]; - - if (!ata_id_has_fua(id)) - return 0; - - model[40] = '\0'; - fw[8] = '\0'; - - ata_dev_id_string(id, model, ATA_ID_PROD_OFS, sizeof(model) - 1); - ata_dev_id_string(id, fw, ATA_ID_FW_REV_OFS, sizeof(fw) - 1); - - if (strncmp(model, "Maxtor", 6)) - return 1; - if (strncmp(fw, "BANC1G10", 8)) - return 1; - - return 0; /* blacklisted */ -} - /** * ata_scsiop_mode_sense - Simulate MODE SENSE 6, 10 commands * @args: device IDENTIFY data / SCSI command of interest. @@ -1822,7 +1797,7 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, return 0; dpofua = 0; - if (ata_dev_supports_fua(args->id) && dev->flags & ATA_DFLAG_LBA48 && + if (ata_id_has_fua(args->id) && dev->flags & ATA_DFLAG_LBA48 && (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count)) dpofua = 1 << 4; diff --git a/trunk/drivers/serial/imx.c b/trunk/drivers/serial/imx.c index 587cc6a95114..fa3bbd6c751f 100644 --- a/trunk/drivers/serial/imx.c +++ b/trunk/drivers/serial/imx.c @@ -402,10 +402,10 @@ static int imx_startup(struct uart_port *port) DRIVER_NAME, sport); if (retval) goto error_out2; - retval = request_irq(sport->rtsirq, imx_rtsint, 0, + retval = request_irq(sport->rtsirq, imx_rtsint, + SA_TRIGGER_FALLING | SA_TRIGGER_RISING, DRIVER_NAME, sport); if (retval) goto error_out3; - set_irq_type(sport->rtsirq, IRQT_BOTHEDGE); /* * Finally, clear and enable interrupts diff --git a/trunk/drivers/serial/sn_console.c b/trunk/drivers/serial/sn_console.c index 43e67d6c29d4..5468e5a767e2 100644 --- a/trunk/drivers/serial/sn_console.c +++ b/trunk/drivers/serial/sn_console.c @@ -6,7 +6,7 @@ * driver for that. * * - * Copyright (c) 2004-2006 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License @@ -829,8 +829,8 @@ static int __init sn_sal_module_init(void) misc.name = DEVICE_NAME_DYNAMIC; retval = misc_register(&misc); if (retval != 0) { - printk(KERN_WARNING "Failed to register console " - "device using misc_register.\n"); + printk + ("Failed to register console device using misc_register.\n"); return -ENODEV; } sal_console_uart.major = MISC_MAJOR; @@ -942,75 +942,88 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count) { unsigned long flags = 0; struct sn_cons_port *port = &sal_console_port; +#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT) static int stole_lock = 0; +#endif BUG_ON(!port->sc_is_asynch); /* We can't look at the xmit buffer if we're not registered with serial core * yet. So only do the fancy recovery after registering */ - if (!port->sc_port.info) { - /* Not yet registered with serial core - simple case */ - puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count); - return; - } + if (port->sc_port.info) { - /* somebody really wants this output, might be an - * oops, kdb, panic, etc. make sure they get it. */ - if (spin_is_locked(&port->sc_port.lock)) { - int lhead = port->sc_port.info->xmit.head; - int ltail = port->sc_port.info->xmit.tail; - int counter, got_lock = 0; - - /* - * We attempt to determine if someone has died with the - * lock. We wait ~20 secs after the head and tail ptrs - * stop moving and assume the lock holder is not functional - * and plow ahead. If the lock is freed within the time out - * period we re-get the lock and go ahead normally. We also - * remember if we have plowed ahead so that we don't have - * to wait out the time out period again - the asumption - * is that we will time out again. - */ + /* somebody really wants this output, might be an + * oops, kdb, panic, etc. make sure they get it. */ +#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT) + if (spin_is_locked(&port->sc_port.lock)) { + int lhead = port->sc_port.info->xmit.head; + int ltail = port->sc_port.info->xmit.tail; + int counter, got_lock = 0; - for (counter = 0; counter < 150; mdelay(125), counter++) { - if (!spin_is_locked(&port->sc_port.lock) - || stole_lock) { - if (!stole_lock) { - spin_lock_irqsave(&port->sc_port.lock, - flags); - got_lock = 1; + /* + * We attempt to determine if someone has died with the + * lock. We wait ~20 secs after the head and tail ptrs + * stop moving and assume the lock holder is not functional + * and plow ahead. If the lock is freed within the time out + * period we re-get the lock and go ahead normally. We also + * remember if we have plowed ahead so that we don't have + * to wait out the time out period again - the asumption + * is that we will time out again. + */ + + for (counter = 0; counter < 150; mdelay(125), counter++) { + if (!spin_is_locked(&port->sc_port.lock) + || stole_lock) { + if (!stole_lock) { + spin_lock_irqsave(&port-> + sc_port.lock, + flags); + got_lock = 1; + } + break; + } else { + /* still locked */ + if ((lhead != + port->sc_port.info->xmit.head) + || (ltail != + port->sc_port.info->xmit. + tail)) { + lhead = + port->sc_port.info->xmit. + head; + ltail = + port->sc_port.info->xmit. + tail; + counter = 0; + } } - break; + } + /* flush anything in the serial core xmit buffer, raw */ + sn_transmit_chars(port, 1); + if (got_lock) { + spin_unlock_irqrestore(&port->sc_port.lock, + flags); + stole_lock = 0; } else { - /* still locked */ - if ((lhead != port->sc_port.info->xmit.head) - || (ltail != - port->sc_port.info->xmit.tail)) { - lhead = - port->sc_port.info->xmit.head; - ltail = - port->sc_port.info->xmit.tail; - counter = 0; - } + /* fell thru */ + stole_lock = 1; } - } - /* flush anything in the serial core xmit buffer, raw */ - sn_transmit_chars(port, 1); - if (got_lock) { - spin_unlock_irqrestore(&port->sc_port.lock, flags); - stole_lock = 0; + puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count); } else { - /* fell thru */ - stole_lock = 1; - } - puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count); - } else { - stole_lock = 0; - spin_lock_irqsave(&port->sc_port.lock, flags); - sn_transmit_chars(port, 1); - spin_unlock_irqrestore(&port->sc_port.lock, flags); + stole_lock = 0; +#endif + spin_lock_irqsave(&port->sc_port.lock, flags); + sn_transmit_chars(port, 1); + spin_unlock_irqrestore(&port->sc_port.lock, flags); + puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count); +#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT) + } +#endif + } + else { + /* Not yet registered with serial core - simple case */ puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count); } } diff --git a/trunk/fs/bio.c b/trunk/fs/bio.c index 1f3bb501c262..bbc442b8c867 100644 --- a/trunk/fs/bio.c +++ b/trunk/fs/bio.c @@ -411,7 +411,6 @@ static int __bio_add_page(request_queue_t *q, struct bio *bio, struct page /** * bio_add_pc_page - attempt to add page to bio - * @q: the target queue * @bio: destination bio * @page: page to add * @len: vec entry length diff --git a/trunk/fs/compat.c b/trunk/fs/compat.c index ff0bafcff720..18b21b4c9e3a 100644 --- a/trunk/fs/compat.c +++ b/trunk/fs/compat.c @@ -1743,7 +1743,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, if ((u64)tv.tv_sec >= (u64)MAX_INT64_SECONDS) timeout = -1; /* infinite */ else { - timeout = ROUND_UP(tv.tv_usec, 1000000/HZ); + timeout = ROUND_UP(tv.tv_sec, 1000000/HZ); timeout += tv.tv_sec * HZ; } } @@ -1884,7 +1884,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, /* We assume that ts.tv_sec is always lower than the number of seconds that can be expressed in an s64. Otherwise the compiler bitches at us */ - timeout = ROUND_UP(ts.tv_nsec, 1000000000/HZ); + timeout = ROUND_UP(ts.tv_sec, 1000000000/HZ); timeout += ts.tv_sec * HZ; } diff --git a/trunk/include/asm-ia64/semaphore.h b/trunk/include/asm-ia64/semaphore.h index f483eeb95dd1..bb8906285fab 100644 --- a/trunk/include/asm-ia64/semaphore.h +++ b/trunk/include/asm-ia64/semaphore.h @@ -61,7 +61,7 @@ static inline void down (struct semaphore *sem) { might_sleep(); - if (ia64_fetchadd(-1, &sem->count.counter, acq) < 1) + if (atomic_dec_return(&sem->count) < 0) __down(sem); } @@ -75,7 +75,7 @@ down_interruptible (struct semaphore * sem) int ret = 0; might_sleep(); - if (ia64_fetchadd(-1, &sem->count.counter, acq) < 1) + if (atomic_dec_return(&sem->count) < 0) ret = __down_interruptible(sem); return ret; } @@ -85,7 +85,7 @@ down_trylock (struct semaphore *sem) { int ret = 0; - if (ia64_fetchadd(-1, &sem->count.counter, acq) < 1) + if (atomic_dec_return(&sem->count) < 0) ret = __down_trylock(sem); return ret; } @@ -93,7 +93,7 @@ down_trylock (struct semaphore *sem) static inline void up (struct semaphore * sem) { - if (ia64_fetchadd(1, &sem->count.counter, rel) <= -1) + if (atomic_inc_return(&sem->count) <= 0) __up(sem); } diff --git a/trunk/include/asm-ia64/sn/xp.h b/trunk/include/asm-ia64/sn/xp.h index 9bd2f9bf329b..203945ae034e 100644 --- a/trunk/include/asm-ia64/sn/xp.h +++ b/trunk/include/asm-ia64/sn/xp.h @@ -18,7 +18,6 @@ #include #include -#include #include #include @@ -360,7 +359,7 @@ typedef void (*xpc_notify_func)(enum xpc_retval reason, partid_t partid, * the channel. */ struct xpc_registration { - struct mutex mutex; + struct semaphore sema; xpc_channel_func func; /* function to call */ void *key; /* pointer to user's key */ u16 nentries; /* #of msg entries in local msg queue */ diff --git a/trunk/include/asm-ia64/sn/xpc.h b/trunk/include/asm-ia64/sn/xpc.h index 0c36928ffd8b..87e9cd588510 100644 --- a/trunk/include/asm-ia64/sn/xpc.h +++ b/trunk/include/asm-ia64/sn/xpc.h @@ -19,8 +19,6 @@ #include #include #include -#include -#include #include #include #include @@ -337,7 +335,8 @@ struct xpc_openclose_args { * and consumed by the intended recipient. */ struct xpc_notify { - volatile u8 type; /* type of notification */ + struct semaphore sema; /* notify semaphore */ + volatile u8 type; /* type of notification */ /* the following two fields are only used if type == XPC_N_CALL */ xpc_notify_func func; /* user's notify function */ @@ -466,8 +465,8 @@ struct xpc_channel { xpc_channel_func func; /* user's channel function */ void *key; /* pointer to user's key */ - struct mutex msg_to_pull_mutex; /* next msg to pull serialization */ - struct completion wdisconnect_wait; /* wait for channel disconnect */ + struct semaphore msg_to_pull_sema; /* next msg to pull serialization */ + struct semaphore wdisconnect_sema; /* wait for channel disconnect */ struct xpc_openclose_args *local_openclose_args; /* args passed on */ /* opening or closing of channel */ diff --git a/trunk/include/asm-ia64/topology.h b/trunk/include/asm-ia64/topology.h index 412ef8e493a8..d8aae4da3978 100644 --- a/trunk/include/asm-ia64/topology.h +++ b/trunk/include/asm-ia64/topology.h @@ -18,10 +18,6 @@ #include #ifdef CONFIG_NUMA - -/* Nodes w/o CPUs are preferred for memory allocations, see build_zonelists */ -#define PENALTY_FOR_NODE_WITH_CPUS 255 - /* * Returns the number of the node containing CPU 'cpu' */ diff --git a/trunk/include/asm-sparc/oplib.h b/trunk/include/asm-sparc/oplib.h index d0d76b30eb4c..95944556d8b6 100644 --- a/trunk/include/asm-sparc/oplib.h +++ b/trunk/include/asm-sparc/oplib.h @@ -164,7 +164,6 @@ enum prom_input_device { PROMDEV_IKBD, /* input from keyboard */ PROMDEV_ITTYA, /* input from ttya */ PROMDEV_ITTYB, /* input from ttyb */ - PROMDEV_IRSC, /* input from rsc */ PROMDEV_I_UNK, }; @@ -176,7 +175,6 @@ enum prom_output_device { PROMDEV_OSCREEN, /* to screen */ PROMDEV_OTTYA, /* to ttya */ PROMDEV_OTTYB, /* to ttyb */ - PROMDEV_ORSC, /* to rsc */ PROMDEV_O_UNK, }; diff --git a/trunk/include/asm-sparc/thread_info.h b/trunk/include/asm-sparc/thread_info.h index 91b9f5888c85..65f060b040ab 100644 --- a/trunk/include/asm-sparc/thread_info.h +++ b/trunk/include/asm-sparc/thread_info.h @@ -128,10 +128,9 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *) * thread information flag bit numbers */ #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ -/* flag bit 1 is available */ +#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ #define TIF_SIGPENDING 2 /* signal pending */ #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ -#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ #define TIF_USEDFPU 8 /* FPU was used by this task * this quantum (SMP) */ #define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling @@ -140,9 +139,9 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *) /* as above, but as bit values */ #define _TIF_SYSCALL_TRACE (1<lock & 0x80000000UL)) #define __raw_write_can_lock(rw) (!(rw)->lock) diff --git a/trunk/include/asm-sparc64/thread_info.h b/trunk/include/asm-sparc64/thread_info.h index ac9d068aab4f..c94d8b3991bd 100644 --- a/trunk/include/asm-sparc64/thread_info.h +++ b/trunk/include/asm-sparc64/thread_info.h @@ -221,7 +221,7 @@ register struct thread_info *current_thread_info_reg asm("g6"); * nop */ #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ -#define TIF_RESTORE_SIGMASK 1 /* restore signal mask in do_signal() */ +#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ #define TIF_SIGPENDING 2 /* signal pending */ #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ #define TIF_PERFCTR 4 /* performance counters active */ @@ -241,6 +241,7 @@ register struct thread_info *current_thread_info_reg asm("g6"); #define TIF_POLLING_NRFLAG 14 #define _TIF_SYSCALL_TRACE (1<rtort_free, &rcu_torture_freelist); - spin_unlock_bh(&rcu_torture_lock); + spin_unlock(&rcu_torture_lock); } static void diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index ec7fd9cee306..3ee2ae45125f 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -5141,7 +5141,7 @@ static void init_sched_build_groups(struct sched_group groups[], cpumask_t span, #define SEARCH_SCOPE 2 #define MIN_CACHE_SIZE (64*1024U) #define DEFAULT_CACHE_SIZE (5*1024*1024U) -#define ITERATIONS 1 +#define ITERATIONS 2 #define SIZE_THRESH 130 #define COST_THRESH 130 @@ -5480,9 +5480,9 @@ static unsigned long long measure_migration_cost(int cpu1, int cpu2) break; } /* - * Increase the cachesize in 10% steps: + * Increase the cachesize in 5% steps: */ - size = size * 10 / 9; + size = size * 20 / 19; } if (migration_debug) diff --git a/trunk/kernel/time.c b/trunk/kernel/time.c index 1f23e683d6aa..7477b1d2079e 100644 --- a/trunk/kernel/time.c +++ b/trunk/kernel/time.c @@ -155,7 +155,7 @@ int do_sys_settimeofday(struct timespec *tv, struct timezone *tz) static int firsttime = 1; int error = 0; - if (tv && !timespec_valid(tv)) + if (!timespec_valid(tv)) return -EINVAL; error = security_settime(tv, tz); diff --git a/trunk/kernel/user.c b/trunk/kernel/user.c index d1ae2349347e..89e562feb1b1 100644 --- a/trunk/kernel/user.c +++ b/trunk/kernel/user.c @@ -13,7 +13,6 @@ #include #include #include -#include /* * UID task count cache, to get fast user lookup in "alloc_uid" @@ -28,12 +27,6 @@ static kmem_cache_t *uid_cachep; static struct list_head uidhash_table[UIDHASH_SZ]; - -/* - * The uidhash_lock is mostly taken from process context, but it is - * occasionally also taken from softirq/tasklet context, when - * task-structs get RCU-freed. Hence all locking must be softirq-safe. - */ static DEFINE_SPINLOCK(uidhash_lock); struct user_struct root_user = { @@ -90,15 +83,14 @@ struct user_struct *find_user(uid_t uid) { struct user_struct *ret; - spin_lock_bh(&uidhash_lock); + spin_lock(&uidhash_lock); ret = uid_hash_find(uid, uidhashentry(uid)); - spin_unlock_bh(&uidhash_lock); + spin_unlock(&uidhash_lock); return ret; } void free_uid(struct user_struct *up) { - local_bh_disable(); if (up && atomic_dec_and_lock(&up->__count, &uidhash_lock)) { uid_hash_remove(up); key_put(up->uid_keyring); @@ -106,7 +98,6 @@ void free_uid(struct user_struct *up) kmem_cache_free(uid_cachep, up); spin_unlock(&uidhash_lock); } - local_bh_enable(); } struct user_struct * alloc_uid(uid_t uid) @@ -114,9 +105,9 @@ struct user_struct * alloc_uid(uid_t uid) struct list_head *hashent = uidhashentry(uid); struct user_struct *up; - spin_lock_bh(&uidhash_lock); + spin_lock(&uidhash_lock); up = uid_hash_find(uid, hashent); - spin_unlock_bh(&uidhash_lock); + spin_unlock(&uidhash_lock); if (!up) { struct user_struct *new; @@ -146,7 +137,7 @@ struct user_struct * alloc_uid(uid_t uid) * Before adding this, check whether we raced * on adding the same user already.. */ - spin_lock_bh(&uidhash_lock); + spin_lock(&uidhash_lock); up = uid_hash_find(uid, hashent); if (up) { key_put(new->uid_keyring); @@ -156,7 +147,7 @@ struct user_struct * alloc_uid(uid_t uid) uid_hash_insert(new, hashent); up = new; } - spin_unlock_bh(&uidhash_lock); + spin_unlock(&uidhash_lock); } return up; @@ -192,9 +183,9 @@ static int __init uid_cache_init(void) INIT_LIST_HEAD(uidhash_table + n); /* Insert the root user immediately (init already runs as root) */ - spin_lock_bh(&uidhash_lock); + spin_lock(&uidhash_lock); uid_hash_insert(&root_user, uidhashentry(0)); - spin_unlock_bh(&uidhash_lock); + spin_unlock(&uidhash_lock); return 0; } diff --git a/trunk/net/core/dev.c b/trunk/net/core/dev.c index ffb82073056e..fd070a098f20 100644 --- a/trunk/net/core/dev.c +++ b/trunk/net/core/dev.c @@ -2543,14 +2543,13 @@ int dev_ioctl(unsigned int cmd, void __user *arg) case SIOCBONDENSLAVE: case SIOCBONDRELEASE: case SIOCBONDSETHWADDR: + case SIOCBONDSLAVEINFOQUERY: + case SIOCBONDINFOQUERY: case SIOCBONDCHANGEACTIVE: case SIOCBRADDIF: case SIOCBRDELIF: if (!capable(CAP_NET_ADMIN)) return -EPERM; - /* fall through */ - case SIOCBONDSLAVEINFOQUERY: - case SIOCBONDINFOQUERY: dev_load(ifr.ifr_name); rtnl_lock(); ret = dev_ifsioc(&ifr, cmd); diff --git a/trunk/net/core/filter.c b/trunk/net/core/filter.c index 93fbd01d2259..9540946a48f3 100644 --- a/trunk/net/core/filter.c +++ b/trunk/net/core/filter.c @@ -64,7 +64,7 @@ static inline void *load_pointer(struct sk_buff *skb, int k, } /** - * sk_run_filter - run a filter on a socket + * sk_run_filter - run a filter on a socket * @skb: buffer to run the filter on * @filter: filter to apply * @flen: length of filter @@ -78,8 +78,8 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int { struct sock_filter *fentry; /* We walk down these */ void *ptr; - u32 A = 0; /* Accumulator */ - u32 X = 0; /* Index Register */ + u32 A = 0; /* Accumulator */ + u32 X = 0; /* Index Register */ u32 mem[BPF_MEMWORDS]; /* Scratch Memory Store */ u32 tmp; int k; diff --git a/trunk/net/core/skbuff.c b/trunk/net/core/skbuff.c index 6766f118f070..d0732e9c8560 100644 --- a/trunk/net/core/skbuff.c +++ b/trunk/net/core/skbuff.c @@ -135,15 +135,13 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here) struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, int fclone) { - kmem_cache_t *cache; struct skb_shared_info *shinfo; struct sk_buff *skb; u8 *data; - cache = fclone ? skbuff_fclone_cache : skbuff_head_cache; - /* Get the HEAD */ - skb = kmem_cache_alloc(cache, gfp_mask & ~__GFP_DMA); + skb = kmem_cache_alloc(fclone ? skbuff_fclone_cache : skbuff_head_cache, + gfp_mask & ~__GFP_DMA); if (!skb) goto out; @@ -182,7 +180,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, out: return skb; nodata: - kmem_cache_free(cache, skb); + kmem_cache_free(skbuff_head_cache, skb); skb = NULL; goto out; } diff --git a/trunk/net/ieee80211/ieee80211_rx.c b/trunk/net/ieee80211/ieee80211_rx.c index 960aa78cdb97..7a121802faa9 100644 --- a/trunk/net/ieee80211/ieee80211_rx.c +++ b/trunk/net/ieee80211/ieee80211_rx.c @@ -350,7 +350,6 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, u8 src[ETH_ALEN]; struct ieee80211_crypt_data *crypt = NULL; int keyidx = 0; - int can_be_decrypted = 0; hdr = (struct ieee80211_hdr_4addr *)skb->data; stats = &ieee->stats; @@ -411,23 +410,12 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, return 1; } - can_be_decrypted = (is_multicast_ether_addr(hdr->addr1) || - is_broadcast_ether_addr(hdr->addr2)) ? - ieee->host_mc_decrypt : ieee->host_decrypt; - - if (can_be_decrypted) { + if (is_multicast_ether_addr(hdr->addr1) + ? ieee->host_mc_decrypt : ieee->host_decrypt) { int idx = 0; - if (skb->len >= hdrlen + 3) { - /* Top two-bits of byte 3 are the key index */ + if (skb->len >= hdrlen + 3) idx = skb->data[hdrlen + 3] >> 6; - } - - /* ieee->crypt[] is WEP_KEY (4) in length. Given that idx - * is only allowed 2-bits of storage, no value of idx can - * be provided via above code that would result in idx - * being out of range */ crypt = ieee->crypt[idx]; - #ifdef NOT_YET sta = NULL; @@ -565,7 +553,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, /* skb: hdr + (possibly fragmented, possibly encrypted) payload */ - if ((fc & IEEE80211_FCTL_PROTECTED) && can_be_decrypted && + if (ieee->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) goto rx_dropped; @@ -629,7 +617,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, /* skb: hdr + (possible reassembled) full MSDU payload; possibly still * encrypted/authenticated */ - if ((fc & IEEE80211_FCTL_PROTECTED) && can_be_decrypted && + if (ieee->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) goto rx_dropped; @@ -1451,7 +1439,7 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee, break; case IEEE80211_STYPE_PROBE_REQ: - IEEE80211_DEBUG_MGMT("received auth (%d)\n", + IEEE80211_DEBUG_MGMT("recieved auth (%d)\n", WLAN_FC_GET_STYPE(le16_to_cpu (header->frame_ctl))); @@ -1485,7 +1473,7 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee, break; case IEEE80211_STYPE_AUTH: - IEEE80211_DEBUG_MGMT("received auth (%d)\n", + IEEE80211_DEBUG_MGMT("recieved auth (%d)\n", WLAN_FC_GET_STYPE(le16_to_cpu (header->frame_ctl))); diff --git a/trunk/net/ieee80211/ieee80211_wx.c b/trunk/net/ieee80211/ieee80211_wx.c index f87c6b89f845..23e1630f50b7 100644 --- a/trunk/net/ieee80211/ieee80211_wx.c +++ b/trunk/net/ieee80211/ieee80211_wx.c @@ -232,18 +232,15 @@ static char *ipw2100_translate_scan(struct ieee80211_device *ieee, return start; } -#define SCAN_ITEM_SIZE 128 - int ieee80211_wx_get_scan(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { struct ieee80211_network *network; unsigned long flags; - int err = 0; char *ev = extra; - char *stop = ev + wrqu->data.length; + char *stop = ev + IW_SCAN_MAX_DATA; int i = 0; IEEE80211_DEBUG_WX("Getting scan\n"); @@ -252,11 +249,6 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee, list_for_each_entry(network, &ieee->network_list, list) { i++; - if (stop - ev < SCAN_ITEM_SIZE) { - err = -E2BIG; - break; - } - if (ieee->scan_age == 0 || time_after(network->last_scanned + ieee->scan_age, jiffies)) ev = ipw2100_translate_scan(ieee, ev, stop, network); @@ -278,7 +270,7 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee, IEEE80211_DEBUG_WX("exit: %d networks returned.\n", i); - return err; + return 0; } int ieee80211_wx_set_encode(struct ieee80211_device *ieee, diff --git a/trunk/net/ipv4/igmp.c b/trunk/net/ipv4/igmp.c index f70ba622c856..d8ce7133cd8f 100644 --- a/trunk/net/ipv4/igmp.c +++ b/trunk/net/ipv4/igmp.c @@ -970,6 +970,7 @@ int igmp_rcv(struct sk_buff *skb) case IGMP_MTRACE_RESP: break; default: + NETDEBUG(KERN_DEBUG "New IGMP type=%d, why we do not know about it?\n", ih->type); } drop: diff --git a/trunk/net/ipv4/tcp_htcp.c b/trunk/net/ipv4/tcp_htcp.c index 128de4d7c0b7..3284cfb993e6 100644 --- a/trunk/net/ipv4/tcp_htcp.c +++ b/trunk/net/ipv4/tcp_htcp.c @@ -230,6 +230,7 @@ static void htcp_cong_avoid(struct sock *sk, u32 ack, u32 rtt, if (tp->snd_cwnd < tp->snd_cwnd_clamp) tp->snd_cwnd++; tp->snd_cwnd_cnt = 0; + ca->ccount++; } } } diff --git a/trunk/net/ipv6/mcast.c b/trunk/net/ipv6/mcast.c index 4420948a1bfe..6c05c7978bef 100644 --- a/trunk/net/ipv6/mcast.c +++ b/trunk/net/ipv6/mcast.c @@ -1252,7 +1252,8 @@ int igmp6_event_query(struct sk_buff *skb) } } else { for (ma = idev->mc_list; ma; ma=ma->next) { - if (!ipv6_addr_equal(group, &ma->mca_addr)) + if (group_type != IPV6_ADDR_ANY && + !ipv6_addr_equal(group, &ma->mca_addr)) continue; spin_lock_bh(&ma->mca_lock); if (ma->mca_flags & MAF_TIMER_RUNNING) { @@ -1267,10 +1268,11 @@ int igmp6_event_query(struct sk_buff *skb) ma->mca_flags &= ~MAF_GSQUERY; } if (!(ma->mca_flags & MAF_GSQUERY) || - mld_marksources(ma, ntohs(mlh2->nsrcs), mlh2->srcs)) + mld_marksources(ma, ntohs(mlh2->nsrcs), mlh2->srcs)) igmp6_group_queried(ma, max_delay); spin_unlock_bh(&ma->mca_lock); - break; + if (group_type != IPV6_ADDR_ANY) + break; } } read_unlock_bh(&idev->lock); @@ -1349,7 +1351,7 @@ static int is_in(struct ifmcaddr6 *pmc, struct ip6_sf_list *psf, int type, * in all filters */ if (psf->sf_count[MCAST_INCLUDE]) - return type == MLD2_MODE_IS_INCLUDE; + return 0; return pmc->mca_sfcount[MCAST_EXCLUDE] == psf->sf_count[MCAST_EXCLUDE]; } @@ -1964,7 +1966,7 @@ static void sf_markstate(struct ifmcaddr6 *pmc) static int sf_setstate(struct ifmcaddr6 *pmc) { - struct ip6_sf_list *psf, *dpsf; + struct ip6_sf_list *psf; int mca_xcount = pmc->mca_sfcount[MCAST_EXCLUDE]; int qrv = pmc->idev->mc_qrv; int new_in, rv; @@ -1976,48 +1978,8 @@ static int sf_setstate(struct ifmcaddr6 *pmc) !psf->sf_count[MCAST_INCLUDE]; } else new_in = psf->sf_count[MCAST_INCLUDE] != 0; - if (new_in) { - if (!psf->sf_oldin) { - struct ip6_sf_list *prev = 0; - - for (dpsf=pmc->mca_tomb; dpsf; - dpsf=dpsf->sf_next) { - if (ipv6_addr_equal(&dpsf->sf_addr, - &psf->sf_addr)) - break; - prev = dpsf; - } - if (dpsf) { - if (prev) - prev->sf_next = dpsf->sf_next; - else - pmc->mca_tomb = dpsf->sf_next; - kfree(dpsf); - } - psf->sf_crcount = qrv; - rv++; - } - } else if (psf->sf_oldin) { - psf->sf_crcount = 0; - /* - * add or update "delete" records if an active filter - * is now inactive - */ - for (dpsf=pmc->mca_tomb; dpsf; dpsf=dpsf->sf_next) - if (ipv6_addr_equal(&dpsf->sf_addr, - &psf->sf_addr)) - break; - if (!dpsf) { - dpsf = (struct ip6_sf_list *) - kmalloc(sizeof(*dpsf), GFP_ATOMIC); - if (!dpsf) - continue; - *dpsf = *psf; - /* pmc->mca_lock held by callers */ - dpsf->sf_next = pmc->mca_tomb; - pmc->mca_tomb = dpsf; - } - dpsf->sf_crcount = qrv; + if (new_in != psf->sf_oldin) { + psf->sf_crcount = qrv; rv++; } } diff --git a/trunk/net/key/af_key.c b/trunk/net/key/af_key.c index ae86d237a456..43f1ce74187d 100644 --- a/trunk/net/key/af_key.c +++ b/trunk/net/key/af_key.c @@ -1620,7 +1620,6 @@ static int key_notify_sa_flush(struct km_event *c) return -ENOBUFS; hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); hdr->sadb_msg_satype = pfkey_proto2satype(c->data.proto); - hdr->sadb_msg_type = SADB_FLUSH; hdr->sadb_msg_seq = c->seq; hdr->sadb_msg_pid = c->pid; hdr->sadb_msg_version = PF_KEY_V2; @@ -2386,7 +2385,6 @@ static int key_notify_policy_flush(struct km_event *c) if (!skb_out) return -ENOBUFS; hdr = (struct sadb_msg *) skb_put(skb_out, sizeof(struct sadb_msg)); - hdr->sadb_msg_type = SADB_X_SPDFLUSH; hdr->sadb_msg_seq = c->seq; hdr->sadb_msg_pid = c->pid; hdr->sadb_msg_version = PF_KEY_V2; diff --git a/trunk/net/packet/af_packet.c b/trunk/net/packet/af_packet.c index 9db7dbdb16e6..ee93abc71cb8 100644 --- a/trunk/net/packet/af_packet.c +++ b/trunk/net/packet/af_packet.c @@ -365,7 +365,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, */ err = -EMSGSIZE; - if (len > dev->mtu + dev->hard_header_len) + if(len>dev->mtu+dev->hard_header_len) goto out_unlock; err = -ENOBUFS; @@ -935,7 +935,7 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int add * Check legality */ - if (addr_len != sizeof(struct sockaddr)) + if(addr_len!=sizeof(struct sockaddr)) return -EINVAL; strlcpy(name,uaddr->sa_data,sizeof(name)); @@ -1092,7 +1092,7 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock, * retries. */ - if (skb == NULL) + if(skb==NULL) goto out; /* @@ -1392,8 +1392,8 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, if (level != SOL_PACKET) return -ENOPROTOOPT; - if (get_user(len, optlen)) - return -EFAULT; + if (get_user(len,optlen)) + return -EFAULT; if (len < 0) return -EINVAL; @@ -1419,9 +1419,9 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, return -ENOPROTOOPT; } - if (put_user(len, optlen)) - return -EFAULT; - return 0; + if (put_user(len, optlen)) + return -EFAULT; + return 0; } diff --git a/trunk/net/sctp/input.c b/trunk/net/sctp/input.c index cb78b50868ee..4aa6fc60357c 100644 --- a/trunk/net/sctp/input.c +++ b/trunk/net/sctp/input.c @@ -257,26 +257,20 @@ int sctp_rcv(struct sk_buff *skb) */ sctp_bh_lock_sock(sk); - /* It is possible that the association could have moved to a different - * socket if it is peeled off. If so, update the sk. - */ - if (sk != rcvr->sk) { - sctp_bh_lock_sock(rcvr->sk); - sctp_bh_unlock_sock(sk); - sk = rcvr->sk; - } - if (sock_owned_by_user(sk)) sk_add_backlog(sk, skb); else sctp_backlog_rcv(sk, skb); - /* Release the sock and the sock ref we took in the lookup calls. - * The asoc/ep ref will be released in sctp_backlog_rcv. + /* Release the sock and any reference counts we took in the + * lookup calls. */ sctp_bh_unlock_sock(sk); + if (asoc) + sctp_association_put(asoc); + else + sctp_endpoint_put(ep); sock_put(sk); - return ret; discard_it: @@ -302,48 +296,10 @@ int sctp_rcv(struct sk_buff *skb) int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb) { struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk; - struct sctp_inq *inqueue = NULL; - struct sctp_ep_common *rcvr = NULL; - - rcvr = chunk->rcvr; - - BUG_TRAP(rcvr->sk == sk); - - if (rcvr->dead) { - sctp_chunk_free(chunk); - } else { - inqueue = &chunk->rcvr->inqueue; - sctp_inq_push(inqueue, chunk); - } - - /* Release the asoc/ep ref we took in the lookup calls in sctp_rcv. */ - if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type) - sctp_association_put(sctp_assoc(rcvr)); - else - sctp_endpoint_put(sctp_ep(rcvr)); - - return 0; -} - -void sctp_backlog_migrate(struct sctp_association *assoc, - struct sock *oldsk, struct sock *newsk) -{ - struct sk_buff *skb; - struct sctp_chunk *chunk; + struct sctp_inq *inqueue = &chunk->rcvr->inqueue; - skb = oldsk->sk_backlog.head; - oldsk->sk_backlog.head = oldsk->sk_backlog.tail = NULL; - while (skb != NULL) { - struct sk_buff *next = skb->next; - - chunk = SCTP_INPUT_CB(skb)->chunk; - skb->next = NULL; - if (&assoc->base == chunk->rcvr) - sk_add_backlog(newsk, skb); - else - sk_add_backlog(oldsk, skb); - skb = next; - } + sctp_inq_push(inqueue, chunk); + return 0; } /* Handle icmp frag needed error. */ @@ -588,16 +544,10 @@ int sctp_rcv_ootb(struct sk_buff *skb) sctp_errhdr_t *err; ch = (sctp_chunkhdr_t *) skb->data; + ch_end = ((__u8 *) ch) + WORD_ROUND(ntohs(ch->length)); /* Scan through all the chunks in the packet. */ - do { - /* Break out if chunk length is less then minimal. */ - if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t)) - break; - - ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length)); - if (ch_end > skb->tail) - break; + while (ch_end > (__u8 *)ch && ch_end < skb->tail) { /* RFC 8.4, 2) If the OOTB packet contains an ABORT chunk, the * receiver MUST silently discard the OOTB packet and take no @@ -628,7 +578,8 @@ int sctp_rcv_ootb(struct sk_buff *skb) } ch = (sctp_chunkhdr_t *) ch_end; - } while (ch_end < skb->tail); + ch_end = ((__u8 *) ch) + WORD_ROUND(ntohs(ch->length)); + } return 0; diff --git a/trunk/net/sctp/inqueue.c b/trunk/net/sctp/inqueue.c index 297b8951463e..2d33922c044b 100644 --- a/trunk/net/sctp/inqueue.c +++ b/trunk/net/sctp/inqueue.c @@ -73,10 +73,8 @@ void sctp_inq_free(struct sctp_inq *queue) /* If there is a packet which is currently being worked on, * free it as well. */ - if (queue->in_progress) { + if (queue->in_progress) sctp_chunk_free(queue->in_progress); - queue->in_progress = NULL; - } if (queue->malloced) { /* Dump the master memory segment. */ diff --git a/trunk/net/sctp/proc.c b/trunk/net/sctp/proc.c index d47a52c303a8..6e4dc28874d7 100644 --- a/trunk/net/sctp/proc.c +++ b/trunk/net/sctp/proc.c @@ -176,7 +176,7 @@ static void sctp_seq_dump_remote_addrs(struct seq_file *seq, struct sctp_associa static void * sctp_eps_seq_start(struct seq_file *seq, loff_t *pos) { - if (*pos >= sctp_ep_hashsize) + if (*pos > sctp_ep_hashsize) return NULL; if (*pos < 0) @@ -185,6 +185,8 @@ static void * sctp_eps_seq_start(struct seq_file *seq, loff_t *pos) if (*pos == 0) seq_printf(seq, " ENDPT SOCK STY SST HBKT LPORT UID INODE LADDRS\n"); + ++*pos; + return (void *)pos; } @@ -196,9 +198,11 @@ static void sctp_eps_seq_stop(struct seq_file *seq, void *v) static void * sctp_eps_seq_next(struct seq_file *seq, void *v, loff_t *pos) { - if (++*pos >= sctp_ep_hashsize) + if (*pos > sctp_ep_hashsize) return NULL; + ++*pos; + return pos; } @@ -210,19 +214,19 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v) struct sctp_ep_common *epb; struct sctp_endpoint *ep; struct sock *sk; - int hash = *(loff_t *)v; + int hash = *(int *)v; - if (hash >= sctp_ep_hashsize) + if (hash > sctp_ep_hashsize) return -ENOMEM; - head = &sctp_ep_hashtable[hash]; + head = &sctp_ep_hashtable[hash-1]; sctp_local_bh_disable(); read_lock(&head->lock); for (epb = head->chain; epb; epb = epb->next) { ep = sctp_ep(epb); sk = epb->sk; seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk, - sctp_sk(sk)->type, sk->sk_state, hash, + sctp_sk(sk)->type, sk->sk_state, hash-1, epb->bind_addr.port, sock_i_uid(sk), sock_i_ino(sk)); @@ -279,7 +283,7 @@ void sctp_eps_proc_exit(void) static void * sctp_assocs_seq_start(struct seq_file *seq, loff_t *pos) { - if (*pos >= sctp_assoc_hashsize) + if (*pos > sctp_assoc_hashsize) return NULL; if (*pos < 0) @@ -289,6 +293,8 @@ static void * sctp_assocs_seq_start(struct seq_file *seq, loff_t *pos) seq_printf(seq, " ASSOC SOCK STY SST ST HBKT ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT " "RPORT LADDRS <-> RADDRS\n"); + ++*pos; + return (void *)pos; } @@ -300,9 +306,11 @@ static void sctp_assocs_seq_stop(struct seq_file *seq, void *v) static void * sctp_assocs_seq_next(struct seq_file *seq, void *v, loff_t *pos) { - if (++*pos >= sctp_assoc_hashsize) + if (*pos > sctp_assoc_hashsize) return NULL; + ++*pos; + return pos; } @@ -313,12 +321,12 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) struct sctp_ep_common *epb; struct sctp_association *assoc; struct sock *sk; - int hash = *(loff_t *)v; + int hash = *(int *)v; - if (hash >= sctp_assoc_hashsize) + if (hash > sctp_assoc_hashsize) return -ENOMEM; - head = &sctp_assoc_hashtable[hash]; + head = &sctp_assoc_hashtable[hash-1]; sctp_local_bh_disable(); read_lock(&head->lock); for (epb = head->chain; epb; epb = epb->next) { @@ -327,7 +335,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) seq_printf(seq, "%8p %8p %-3d %-3d %-2d %-4d %4d %8d %8d %7d %5lu %-5d %5d ", assoc, sk, sctp_sk(sk)->type, sk->sk_state, - assoc->state, hash, assoc->assoc_id, + assoc->state, hash-1, assoc->assoc_id, (sk->sk_rcvbuf - assoc->rwnd), assoc->sndbuf_used, sock_i_uid(sk), sock_i_ino(sk), diff --git a/trunk/net/sctp/sm_make_chunk.c b/trunk/net/sctp/sm_make_chunk.c index 5e0de3c0eead..556c495c6922 100644 --- a/trunk/net/sctp/sm_make_chunk.c +++ b/trunk/net/sctp/sm_make_chunk.c @@ -1275,12 +1275,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep, unsigned int keylen; char *key; - /* Header size is static data prior to the actual cookie, including - * any padding. - */ - headersize = sizeof(sctp_paramhdr_t) + - (sizeof(struct sctp_signed_cookie) - - sizeof(struct sctp_cookie)); + headersize = sizeof(sctp_paramhdr_t) + SCTP_SECRET_SIZE; bodysize = sizeof(struct sctp_cookie) + ntohs(init_chunk->chunk_hdr->length) + addrs_len; @@ -1359,7 +1354,7 @@ struct sctp_association *sctp_unpack_cookie( struct sctp_signed_cookie *cookie; struct sctp_cookie *bear_cookie; int headersize, bodysize, fixed_size; - __u8 *digest = ep->digest; + __u8 digest[SCTP_SIGNATURE_SIZE]; struct scatterlist sg; unsigned int keylen, len; char *key; @@ -1367,12 +1362,7 @@ struct sctp_association *sctp_unpack_cookie( struct sk_buff *skb = chunk->skb; struct timeval tv; - /* Header size is static data prior to the actual cookie, including - * any padding. - */ - headersize = sizeof(sctp_chunkhdr_t) + - (sizeof(struct sctp_signed_cookie) - - sizeof(struct sctp_cookie)); + headersize = sizeof(sctp_chunkhdr_t) + SCTP_SECRET_SIZE; bodysize = ntohs(chunk->chunk_hdr->length) - headersize; fixed_size = headersize + sizeof(struct sctp_cookie); diff --git a/trunk/net/sctp/sm_sideeffect.c b/trunk/net/sctp/sm_sideeffect.c index 8d1dc24bab4c..b8b38aba92b3 100644 --- a/trunk/net/sctp/sm_sideeffect.c +++ b/trunk/net/sctp/sm_sideeffect.c @@ -1300,7 +1300,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, "T1 INIT Timeout adjustment" " init_err_counter: %d" " cycle: %d" - " timeout: %ld\n", + " timeout: %d\n", asoc->init_err_counter, asoc->init_cycle, asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT]); @@ -1328,7 +1328,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, SCTP_DEBUG_PRINTK( "T1 COOKIE Timeout adjustment" " init_err_counter: %d" - " timeout: %ld\n", + " timeout: %d\n", asoc->init_err_counter, asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE]); diff --git a/trunk/net/sctp/sm_statefuns.c b/trunk/net/sctp/sm_statefuns.c index 2b9a832b29a7..477d7f80dba6 100644 --- a/trunk/net/sctp/sm_statefuns.c +++ b/trunk/net/sctp/sm_statefuns.c @@ -884,7 +884,7 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep, { struct sctp_transport *transport = (struct sctp_transport *) arg; - if (asoc->overall_error_count >= asoc->max_retrans) { + if (asoc->overall_error_count > asoc->max_retrans) { /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_U32(SCTP_ERROR_NO_ERROR)); @@ -2122,7 +2122,7 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(const struct sctp_endpoint *ep, struct sctp_bind_addr *bp; int attempts = asoc->init_err_counter + 1; - if (attempts > asoc->max_init_attempts) { + if (attempts >= asoc->max_init_attempts) { sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED, SCTP_U32(SCTP_ERROR_STALE_COOKIE)); return SCTP_DISPOSITION_DELETE_TCB; @@ -3090,8 +3090,6 @@ sctp_disposition_t sctp_sf_ootb(const struct sctp_endpoint *ep, break; ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length)); - if (ch_end > skb->tail) - break; if (SCTP_CID_SHUTDOWN_ACK == ch->type) ootb_shut_ack = 1; @@ -4640,7 +4638,7 @@ sctp_disposition_t sctp_sf_t1_init_timer_expire(const struct sctp_endpoint *ep, SCTP_DEBUG_PRINTK("Timer T1 expired (INIT).\n"); - if (attempts <= asoc->max_init_attempts) { + if (attempts < asoc->max_init_attempts) { bp = (struct sctp_bind_addr *) &asoc->base.bind_addr; repl = sctp_make_init(asoc, bp, GFP_ATOMIC, 0); if (!repl) @@ -4697,7 +4695,7 @@ sctp_disposition_t sctp_sf_t1_cookie_timer_expire(const struct sctp_endpoint *ep SCTP_DEBUG_PRINTK("Timer T1 expired (COOKIE-ECHO).\n"); - if (attempts <= asoc->max_init_attempts) { + if (attempts < asoc->max_init_attempts) { repl = sctp_make_cookie_echo(asoc, NULL); if (!repl) return SCTP_DISPOSITION_NOMEM; diff --git a/trunk/net/sctp/socket.c b/trunk/net/sctp/socket.c index 0ea947eb6813..c98ee375ba5e 100644 --- a/trunk/net/sctp/socket.c +++ b/trunk/net/sctp/socket.c @@ -2995,7 +2995,7 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk) sp->hbinterval = jiffies_to_msecs(sctp_hb_interval); sp->pathmaxrxt = sctp_max_retrans_path; sp->pathmtu = 0; // allow default discovery - sp->sackdelay = jiffies_to_msecs(sctp_sack_timeout); + sp->sackdelay = sctp_sack_timeout; sp->param_flags = SPP_HB_ENABLE | SPP_PMTUD_ENABLE | SPP_SACKDELAY_ENABLE; @@ -5426,7 +5426,7 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p) return err; do_error: - if (asoc->init_err_counter + 1 > asoc->max_init_attempts) + if (asoc->init_err_counter + 1 >= asoc->max_init_attempts) err = -ETIMEDOUT; else err = -ECONNREFUSED; @@ -5602,12 +5602,8 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, */ newsp->type = type; - spin_lock_bh(&oldsk->sk_lock.slock); - /* Migrate the backlog from oldsk to newsk. */ - sctp_backlog_migrate(assoc, oldsk, newsk); /* Migrate the association to the new socket. */ sctp_assoc_migrate(assoc, newsk); - spin_unlock_bh(&oldsk->sk_lock.slock); /* If the association on the newsk is already closed before accept() * is called, set RCV_SHUTDOWN flag. diff --git a/trunk/net/sctp/sysctl.c b/trunk/net/sctp/sysctl.c index dc6f3ff32358..fcd7096c953d 100644 --- a/trunk/net/sctp/sysctl.c +++ b/trunk/net/sctp/sysctl.c @@ -159,9 +159,12 @@ static ctl_table sctp_table[] = { .ctl_name = NET_SCTP_PRESERVE_ENABLE, .procname = "cookie_preserve_enable", .data = &sctp_cookie_preserve_enable, - .maxlen = sizeof(int), + .maxlen = sizeof(long), .mode = 0644, - .proc_handler = &proc_dointvec + .proc_handler = &proc_doulongvec_ms_jiffies_minmax, + .strategy = &sctp_sysctl_jiffies_ms, + .extra1 = &rto_timer_min, + .extra2 = &rto_timer_max }, { .ctl_name = NET_SCTP_RTO_ALPHA, diff --git a/trunk/net/sctp/transport.c b/trunk/net/sctp/transport.c index 160f62ad1cc5..68d73e2dd155 100644 --- a/trunk/net/sctp/transport.c +++ b/trunk/net/sctp/transport.c @@ -350,7 +350,7 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt) tp->rto_pending = 0; SCTP_DEBUG_PRINTK("%s: transport: %p, rtt: %d, srtt: %d " - "rttvar: %d, rto: %ld\n", __FUNCTION__, + "rttvar: %d, rto: %d\n", __FUNCTION__, tp, rtt, tp->srtt, tp->rttvar, tp->rto); } diff --git a/trunk/security/seclvl.c b/trunk/security/seclvl.c index 8529ea6f7aa8..1caac0164643 100644 --- a/trunk/security/seclvl.c +++ b/trunk/security/seclvl.c @@ -368,8 +368,8 @@ static int seclvl_capable(struct task_struct *tsk, int cap) */ static int seclvl_settime(struct timespec *tv, struct timezone *tz) { - if (tv && seclvl > 1) { - struct timespec now; + struct timespec now; + if (seclvl > 1) { now = current_kernel_time(); if (tv->tv_sec < now.tv_sec || (tv->tv_sec == now.tv_sec && tv->tv_nsec < now.tv_nsec)) {