lockdep: fix debug_show_all_locks()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=856848737bd944c1db3ce0a66bbf67e56bd6f77d Commit: 856848737bd944c1db3ce0a66bbf67e56bd6f77d Parent: 41a2d6cfa3f77ec469e7e5f06b4d7ffd031f9c0e Author: Ingo Molnar <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 15:46:09 2007 +0100 Committer: Ingo Molnar <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 15:46:09 2007 +0100 lockdep: fix debug_show_all_locks() fix the oops that can be seen in: http://bugzilla.kernel.org/attachment.cgi?id=13828&action=view it is not safe to print the locks of running tasks. (even with this fix we have a small race - but this is a debug function after all.) Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]> Signed-off-by: Peter Zijlstra <[EMAIL PROTECTED]> --- kernel/lockdep.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/kernel/lockdep.c b/kernel/lockdep.c index ed38bbf..7e2ca7c 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c @@ -3173,6 +3173,13 @@ retry: printk(" locked it.\n"); do_each_thread(g, p) { + /* +* It's not reliable to print a task's held locks +* if it's not sleeping (or if it's not the current +* task): +*/ + if (p->state == TASK_RUNNING && p != current) + continue; if (p->lockdep_depth) lockdep_print_held_locks(p); if (!unlock) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
lockdep: in_range() fix
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=54561783ee99d73a086f3abbda3e44f87f6bf65b Commit: 54561783ee99d73a086f3abbda3e44f87f6bf65b Parent: 856848737bd944c1db3ce0a66bbf67e56bd6f77d Author: Oleg Nesterov <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 15:46:09 2007 +0100 Committer: Ingo Molnar <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 15:46:09 2007 +0100 lockdep: in_range() fix Torsten Kaiser wrote: | static inline int in_range(const void *start, const void *addr, const void *end) | { | return addr >= start && addr <= end; | } | This will return true, if addr is in the range of start (including) | to end (including). | | But debug_check_no_locks_freed() seems does: | const void *mem_to = mem_from + mem_len | -> mem_to is the last byte of the freed range, that fits in_range | lock_from = (void *)hlock->instance; | -> first byte of the lock | lock_to = (void *)(hlock->instance + 1); | -> first byte of the next lock, not last byte of the lock that is being checked! | | The test is: | if (!in_range(mem_from, lock_from, mem_to) && | !in_range(mem_from, lock_to, mem_to)) | continue; | So it tests, if the first byte of the lock is in the range that is freed ->OK | And if the first byte of the *next* lock is in the range that is freed | -> Not OK. We can also simplify in_range checks, we need only 2 comparisons, not 4. If the lock is not in memory range, it should be either at the left of range or at the right. Signed-off-by: Oleg Nesterov <[EMAIL PROTECTED]> Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]> Signed-off-by: Peter Zijlstra <[EMAIL PROTECTED]> --- kernel/lockdep.c | 22 ++ 1 files changed, 10 insertions(+), 12 deletions(-) diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 7e2ca7c..0f38962 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c @@ -3054,11 +3054,6 @@ void __init lockdep_info(void) #endif } -static inline int in_range(const void *start, const void *addr, const void *end) -{ - return addr >= start && addr <= end; -} - static void print_freed_lock_bug(struct task_struct *curr, const void *mem_from, const void *mem_to, struct held_lock *hlock) @@ -3080,6 +3075,13 @@ print_freed_lock_bug(struct task_struct *curr, const void *mem_from, dump_stack(); } +static inline int not_in_range(const void* mem_from, unsigned long mem_len, + const void* lock_from, unsigned long lock_len) +{ + return lock_from + lock_len <= mem_from || + mem_from + mem_len <= lock_from; +} + /* * Called when kernel memory is freed (or unmapped), or if a lock * is destroyed or reinitialized - this code checks whether there is @@ -3087,7 +3089,6 @@ print_freed_lock_bug(struct task_struct *curr, const void *mem_from, */ void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len) { - const void *mem_to = mem_from + mem_len, *lock_from, *lock_to; struct task_struct *curr = current; struct held_lock *hlock; unsigned long flags; @@ -3100,14 +3101,11 @@ void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len) for (i = 0; i < curr->lockdep_depth; i++) { hlock = curr->held_locks + i; - lock_from = (void *)hlock->instance; - lock_to = (void *)(hlock->instance + 1); - - if (!in_range(mem_from, lock_from, mem_to) && - !in_range(mem_from, lock_to, mem_to)) + if (not_in_range(mem_from, mem_len, hlock->instance, + sizeof(*hlock->instance))) continue; - print_freed_lock_bug(curr, mem_from, mem_to, hlock); + print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock); break; } local_irq_restore(flags); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
futex: correctly return -EFAULT not -EINVAL
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cde898fa80a45bb23eab2a060fc79d0913081409 Commit: cde898fa80a45bb23eab2a060fc79d0913081409 Parent: 54561783ee99d73a086f3abbda3e44f87f6bf65b Author: Thomas Gleixner <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 15:46:09 2007 +0100 Committer: Ingo Molnar <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 15:46:09 2007 +0100 futex: correctly return -EFAULT not -EINVAL return -EFAULT not -EINVAL. Found by review. Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]> Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]> --- kernel/futex.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/futex.c b/kernel/futex.c index e8fbdd7..172a1ae 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -658,7 +658,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this) if (curval == -EFAULT) ret = -EFAULT; - if (curval != uval) + else if (curval != uval) ret = -EINVAL; if (ret) { spin_unlock(&pi_state->pi_mutex.wait_lock); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
sched: style cleanups
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=41a2d6cfa3f77ec469e7e5f06b4d7ffd031f9c0e Commit: 41a2d6cfa3f77ec469e7e5f06b4d7ffd031f9c0e Parent: ce6bd420f43b28038a2c6e8fbb86ad24014727b6 Author: Ingo Molnar <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 15:46:09 2007 +0100 Committer: Ingo Molnar <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 15:46:09 2007 +0100 sched: style cleanups style cleanup of various changes that were done recently. no code changed: textdata bss dec hex filename 236802542 28 26250668a sched.o.before 236802542 28 26250668a sched.o.after Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]> --- kernel/sched.c | 132 +--- 1 files changed, 68 insertions(+), 64 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index b062856..67d9d17 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -209,9 +209,8 @@ static inline struct task_group *task_group(struct task_struct *p) tg = container_of(task_subsys_state(p, cpu_cgroup_subsys_id), struct task_group, css); #else - tg = &init_task_group; + tg = &init_task_group; #endif - return tg; } @@ -249,15 +248,16 @@ struct cfs_rq { #ifdef CONFIG_FAIR_GROUP_SCHED struct rq *rq; /* cpu runqueue to which this cfs_rq is attached */ - /* leaf cfs_rqs are those that hold tasks (lowest schedulable entity in + /* +* leaf cfs_rqs are those that hold tasks (lowest schedulable entity in * a hierarchy). Non-leaf lrqs hold other higher schedulable entities * (like users, containers etc.) * * leaf_cfs_rq_list ties together list of leaf cfs_rq's in a cpu. This * list is used during load balance. */ - struct list_head leaf_cfs_rq_list; /* Better name : task_cfs_rq_list? */ - struct task_group *tg;/* group that "owns" this runqueue */ + struct list_head leaf_cfs_rq_list; + struct task_group *tg; /* group that "owns" this runqueue */ #endif }; @@ -300,7 +300,7 @@ struct rq { /* list of leaf cfs_rq on this cpu: */ struct list_head leaf_cfs_rq_list; #endif - struct rt_rq rt; + struct rt_rq rt; /* * This is part of a global counter where only the total sum @@ -457,8 +457,8 @@ enum { SCHED_FEAT_NEW_FAIR_SLEEPERS= 1, SCHED_FEAT_WAKEUP_PREEMPT = 2, SCHED_FEAT_START_DEBIT = 4, - SCHED_FEAT_TREE_AVG = 8, - SCHED_FEAT_APPROX_AVG = 16, + SCHED_FEAT_TREE_AVG = 8, + SCHED_FEAT_APPROX_AVG = 16, }; const_debug unsigned int sysctl_sched_features = @@ -591,7 +591,7 @@ static inline struct rq *__task_rq_lock(struct task_struct *p) /* * task_rq_lock - lock the runqueue a given task resides on and disable - * interrupts. Note the ordering: we can safely lookup the task_rq without + * interrupts. Note the ordering: we can safely lookup the task_rq without * explicitly disabling preemption. */ static struct rq *task_rq_lock(struct task_struct *p, unsigned long *flags) @@ -779,7 +779,7 @@ static inline void update_load_sub(struct load_weight *lw, unsigned long dec) * To aid in avoiding the subversion of "niceness" due to uneven distribution * of tasks with abnormal "nice" values across CPUs the contribution that * each task makes to its run queue's load is weighted according to its - * scheduling class and "nice" value. For SCHED_NORMAL tasks this is just a + * scheduling class and "nice" value. For SCHED_NORMAL tasks this is just a * scaled version of the new time slice allocation that they receive on time * slice expiry etc. */ @@ -1854,7 +1854,7 @@ prepare_task_switch(struct rq *rq, struct task_struct *prev, * and do any other architecture-specific cleanup actions. * * Note that we may have delayed dropping an mm in context_switch(). If - * so, we finish that here outside of the runqueue lock. (Doing it + * so, we finish that here outside of the runqueue lock. (Doing it * with the lock held can cause deadlocks; see schedule() for * details.) */ @@ -2136,7 +2136,7 @@ static void double_lock_balance(struct rq *this_rq, struct rq *busiest) /* * If dest_cpu is allowed for this process, migrate the task to it. * This is accomplished by forcing the cpu_allowed mask to only - * allow dest_cpu, which will force the cpu onto dest_cpu. Then + * allow dest_cpu, which will force the cpu onto dest_cpu. Then * the cpu_allowed mask is restored. */ static void sched_migrate_task(struct task_struct *p, int dest_cpu) @@ -2581,7 +2581,7 @@ group_next: * tasks around. Thus we look for the minimum possible imbalance. * Negative imbalances (*we* are more loaded than anyone else) will
VM/Security: add security hook to do_brk
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5a211a5deabcafdc764817d5b4510c767d317ddc Commit: 5a211a5deabcafdc764817d5b4510c767d317ddc Parent: 7cd94146cd504016315608e297219f9fb7b1413b Author: Eric Paris <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 11:06:55 2007 -0500 Committer: James Morris <[EMAIL PROTECTED]> CommitDate: Thu Dec 6 00:25:30 2007 +1100 VM/Security: add security hook to do_brk Given a specifically crafted binary do_brk() can be used to get low pages available in userspace virtually memory and can thus be used to circumvent the mmap_min_addr low memory protection. Add security checks in do_brk(). Signed-off-by: Eric Paris <[EMAIL PROTECTED]> Acked-by: Alan Cox <[EMAIL PROTECTED]> Signed-off-by: James Morris <[EMAIL PROTECTED]> --- mm/mmap.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index f4cfc6a..15678aa 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1941,6 +1941,10 @@ unsigned long do_brk(unsigned long addr, unsigned long len) if (is_hugepage_only_range(mm, addr, len)) return -EINVAL; + error = security_file_mmap(0, 0, 0, 0, addr, 1); + if (error) + return error; + flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; error = arch_mmap_check(addr, len, flags); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Security: round mmap hint address above mmap_min_addr
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7cd94146cd504016315608e297219f9fb7b1413b Commit: 7cd94146cd504016315608e297219f9fb7b1413b Parent: 8869477a49c3e99def1fcdadd6bbc407fea14b45 Author: Eric Paris <[EMAIL PROTECTED]> AuthorDate: Mon Nov 26 18:47:40 2007 -0500 Committer: James Morris <[EMAIL PROTECTED]> CommitDate: Thu Dec 6 00:25:10 2007 +1100 Security: round mmap hint address above mmap_min_addr If mmap_min_addr is set and a process attempts to mmap (not fixed) with a non-null hint address less than mmap_min_addr the mapping will fail the security checks. Since this is just a hint address this patch will round such a hint address above mmap_min_addr. gcj was found to try to be very frugal with vm usage and give hint addresses in the 8k-32k range. Without this patch all such programs failed and with the patch they happily get a higher address. This patch is wrappad in CONFIG_SECURITY since mmap_min_addr doesn't exist without it and there would be no security check possible no matter what. So we should not bother compiling in this rounding if it is just a waste of time. Signed-off-by: Eric Paris <[EMAIL PROTECTED]> Signed-off-by: James Morris <[EMAIL PROTECTED]> --- include/linux/mm.h | 16 mm/mmap.c |3 +++ mm/nommu.c |3 +++ 3 files changed, 22 insertions(+), 0 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 520238c..1b7b95c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -12,6 +12,7 @@ #include #include #include +#include struct mempolicy; struct anon_vma; @@ -513,6 +514,21 @@ static inline void set_page_links(struct page *page, enum zone_type zone, } /* + * If a hint addr is less than mmap_min_addr change hint to be as + * low as possible but still greater than mmap_min_addr + */ +static inline unsigned long round_hint_to_min(unsigned long hint) +{ +#ifdef CONFIG_SECURITY + hint &= PAGE_MASK; + if (((void *)hint != NULL) && + (hint < mmap_min_addr)) + return PAGE_ALIGN(mmap_min_addr); +#endif + return hint; +} + +/* * Some inline functions in vmstat.h depend on page_zone() */ #include diff --git a/mm/mmap.c b/mm/mmap.c index 938313c..f4cfc6a 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -912,6 +912,9 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, if (!len) return -EINVAL; + if (!(flags & MAP_FIXED)) + addr = round_hint_to_min(addr); + error = arch_mmap_check(addr, len, flags); if (error) return error; diff --git a/mm/nommu.c b/mm/nommu.c index 35622c5..b989cb9 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -829,6 +829,9 @@ unsigned long do_mmap_pgoff(struct file *file, void *result; int ret; + if (!(flags & MAP_FIXED)) + addr = round_hint_to_min(addr); + /* decide whether we should attempt the mapping, and if so what sort of * mapping */ ret = validate_mmap_request(file, addr, len, prot, flags, pgoff, - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
security: protect from stack expantion into low vm addresses
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8869477a49c3e99def1fcdadd6bbc407fea14b45 Commit: 8869477a49c3e99def1fcdadd6bbc407fea14b45 Parent: ab5a91a8364c3d6fc617abc47cc81d162c01d90a Author: Eric Paris <[EMAIL PROTECTED]> AuthorDate: Mon Nov 26 18:47:26 2007 -0500 Committer: James Morris <[EMAIL PROTECTED]> CommitDate: Thu Dec 6 00:24:48 2007 +1100 security: protect from stack expantion into low vm addresses Add security checks to make sure we are not attempting to expand the stack into memory protected by mmap_min_addr Signed-off-by: Eric Paris <[EMAIL PROTECTED]> Signed-off-by: James Morris <[EMAIL PROTECTED]> --- mm/mmap.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index facc1a7..938313c 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1615,6 +1615,12 @@ static inline int expand_downwards(struct vm_area_struct *vma, */ if (unlikely(anon_vma_prepare(vma))) return -ENOMEM; + + address &= PAGE_MASK; + error = security_file_mmap(0, 0, 0, 0, address, 1); + if (error) + return error; + anon_vma_lock(vma); /* @@ -1622,8 +1628,6 @@ static inline int expand_downwards(struct vm_area_struct *vma, * is required to hold the mmap_sem in read mode. We need the * anon_vma lock to serialize against concurrent expand_stacks. */ - address &= PAGE_MASK; - error = 0; /* Somebody else might have raced and expanded it already */ if (address < vma->vm_start) { - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[TCP] FRTO: Use of existing funcs make code more obvious & robust
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3e6f049e0c4cf0606207c1a210abf50b436e9adf Commit: 3e6f049e0c4cf0606207c1a210abf50b436e9adf Parent: 92b05e13f16a41405c4f6c953c47b6c4bcf82d30 Author: Ilpo J�rvinen <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 02:20:21 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:29 2007 -0800 [TCP] FRTO: Use of existing funcs make code more obvious & robust Though there's little need for everything that tcp_may_send_now does (actually, even the state had to be adjusted to pass some checks FRTO does not want to occur), it's more robust to let it make the decision if sending is allowed. State adjustments needed: - Make sure snd_cwnd limit is not hit in there - Disable nagle (if necessary) through the frto_counter == 2 The result of check for frto_counter in argument to call for tcp_enter_frto_loss can just be open coded, therefore there isn't need to store the previous frto_counter past tcp_may_send_now. In addition, returns can then be combined. Signed-off-by: Ilpo J�rvinen <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- net/ipv4/tcp_input.c | 14 +- 1 files changed, 5 insertions(+), 9 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 0f0c1c9..094f8fa 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -3003,17 +3003,13 @@ static int tcp_process_frto(struct sock *sk, int flag) } if (tp->frto_counter == 1) { - /* Sending of the next skb must be allowed or no F-RTO */ - if (!tcp_send_head(sk) || - after(TCP_SKB_CB(tcp_send_head(sk))->end_seq, -tp->snd_una + tp->snd_wnd)) { - tcp_enter_frto_loss(sk, (tp->frto_counter == 1 ? 2 : 3), - flag); - return 1; - } - + /* tcp_may_send_now needs to see updated state */ tp->snd_cwnd = tcp_packets_in_flight(tp) + 2; tp->frto_counter = 2; + + if (!tcp_may_send_now(sk)) + tcp_enter_frto_loss(sk, 2, flag); + return 1; } else { switch (sysctl_tcp_frto_response) { - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[ROSE]: Trivial compilation CONFIG_INET=n case
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=78f150bf94f5430fe8c34edeafe8d01706f38148 Commit: 78f150bf94f5430fe8c34edeafe8d01706f38148 Parent: 4ac63ad6c52e9cdefbcb54ec4575ab12b78b49d9 Author: Pavel Emelyanov <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 02:18:15 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:28 2007 -0800 [ROSE]: Trivial compilation CONFIG_INET=n case The rose_rebuild_header() consists only of some variables in case INET=n, and gcc will warn us about it. Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- net/rose/rose_dev.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c index 1b6741f..12cfcf0 100644 --- a/net/rose/rose_dev.c +++ b/net/rose/rose_dev.c @@ -55,13 +55,13 @@ static int rose_header(struct sk_buff *skb, struct net_device *dev, static int rose_rebuild_header(struct sk_buff *skb) { +#ifdef CONFIG_INET struct net_device *dev = skb->dev; struct net_device_stats *stats = netdev_priv(dev); unsigned char *bp = (unsigned char *)skb->data; struct sk_buff *skbn; unsigned int len; -#ifdef CONFIG_INET if (arp_find(bp + 7, skb)) { return 1; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[IPVS]: Fix sched registration race when checking for name collision.
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4ac63ad6c52e9cdefbcb54ec4575ab12b78b49d9 Commit: 4ac63ad6c52e9cdefbcb54ec4575ab12b78b49d9 Parent: a014bc8f0f0a3a0cac4fef656f101cdfb77b71eb Author: Pavel Emelyanov <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 00:45:06 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:27 2007 -0800 [IPVS]: Fix sched registration race when checking for name collision. The register_ip_vs_scheduler() checks for the scheduler with the same name under the read-locked __ip_vs_sched_lock, then drops, takes it for writing and puts the scheduler in list. This is racy, since we can have a race window between the lock being re-locked for writing. The fix is to search the scheduler with the given name right under the write-locked __ip_vs_sched_lock. Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]> Acked-by: Simon Horman <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- net/ipv4/ipvs/ip_vs_sched.c | 27 ++- 1 files changed, 14 insertions(+), 13 deletions(-) diff --git a/net/ipv4/ipvs/ip_vs_sched.c b/net/ipv4/ipvs/ip_vs_sched.c index 1602304..4322358 100644 --- a/net/ipv4/ipvs/ip_vs_sched.c +++ b/net/ipv4/ipvs/ip_vs_sched.c @@ -183,19 +183,6 @@ int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler) /* increase the module use count */ ip_vs_use_count_inc(); - /* -* Make sure that the scheduler with this name doesn't exist -* in the scheduler list. -*/ - sched = ip_vs_sched_getbyname(scheduler->name); - if (sched) { - ip_vs_scheduler_put(sched); - ip_vs_use_count_dec(); - IP_VS_ERR("register_ip_vs_scheduler(): [%s] scheduler " - "already existed in the system\n", scheduler->name); - return -EINVAL; - } - write_lock_bh(&__ip_vs_sched_lock); if (scheduler->n_list.next != &scheduler->n_list) { @@ -207,6 +194,20 @@ int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler) } /* +* Make sure that the scheduler with this name doesn't exist +* in the scheduler list. +*/ + list_for_each_entry(sched, &ip_vs_schedulers, n_list) { + if (strcmp(scheduler->name, sched->name) == 0) { + write_unlock_bh(&__ip_vs_sched_lock); + ip_vs_use_count_dec(); + IP_VS_ERR("register_ip_vs_scheduler(): [%s] scheduler " + "already existed in the system\n", + scheduler->name); + return -EINVAL; + } + } + /* * Add it into the d-linked scheduler list */ list_add(&scheduler->n_list, &ip_vs_schedulers); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SPARC64]: check for possible NULL pointer dereference
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=75c6d1410caa6fea861ef3802e8b186f7685f235 Commit: 75c6d1410caa6fea861ef3802e8b186f7685f235 Parent: 794b26e0600e3aab399f9d0f225f9e0b8782edbb Author: Cyrill Gorcunov <[EMAIL PROTECTED]> AuthorDate: Tue Nov 20 17:32:19 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:59 2007 -0800 [SPARC64]: check for possible NULL pointer dereference This patch adds checking for possible NULL pointer dereference if of_find_property() failed. Signed-off-by: Cyrill Gorcunov <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- arch/sparc64/kernel/pci_sun4v.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c index 8c4875b..e587a37 100644 --- a/arch/sparc64/kernel/pci_sun4v.c +++ b/arch/sparc64/kernel/pci_sun4v.c @@ -1022,6 +1022,10 @@ void __init sun4v_pci_init(struct device_node *dp, char *model_name) } prop = of_find_property(dp, "reg", NULL); + if (!prop) { + prom_printf("SUN4V_PCI: Could not find config registers\n"); + prom_halt(); + } regs = prop->value; devhandle = (regs->phys_addr >> 32UL) & 0x0fff; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
remove nonsense force-casts from ocfs2
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=97bd7919e2c1445dabbcc2686795dbb52316b923 Commit: 97bd7919e2c1445dabbcc2686795dbb52316b923 Parent: 7e46aa5c8cb1347853de9ec86f3fa440f9dc9d77 Author: Al Viro <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 08:46:47 2007 + Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:25:20 2007 -0800 remove nonsense force-casts from ocfs2 endianness annotations in networking code had been in place for quite a while; in particular, sin_port and s_addr are annotated as big-endian. Code in ocfs2 had __force casts added apparently to shut the sparse warnings up; of course, these days they only serve to *produce* warnings for no reason whatsoever... Signed-off-by: Al Viro <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- fs/ocfs2/cluster/tcp.c | 20 ++-- 1 files changed, 6 insertions(+), 14 deletions(-) diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index d84bd15..ee50c96 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c @@ -72,14 +72,6 @@ #include "tcp_internal.h" -/* - * The linux network stack isn't sparse endian clean.. It has macros like - * ntohs() which perform the endian checks and structs like sockaddr_in - * which aren't annotated. So __force is found here to get the build - * clean. When they emerge from the dark ages and annotate the code - * we can remove these. - */ - #define SC_NODEF_FMT "node %s (num %u) at %u.%u.%u.%u:%u" #define SC_NODEF_ARGS(sc) sc->sc_node->nd_name, sc->sc_node->nd_num, \ NIPQUAD(sc->sc_node->nd_ipv4_address),\ @@ -1500,7 +1492,7 @@ static void o2net_start_connect(struct work_struct *work) myaddr.sin_family = AF_INET; myaddr.sin_addr.s_addr = mynode->nd_ipv4_address; - myaddr.sin_port = (__force u16)htons(0); /* any port */ + myaddr.sin_port = htons(0); /* any port */ ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr, sizeof(myaddr)); @@ -1701,11 +1693,11 @@ static int o2net_accept_one(struct socket *sock) if (ret < 0) goto out; - node = o2nm_get_node_by_ip((__force __be32)sin.sin_addr.s_addr); + node = o2nm_get_node_by_ip(sin.sin_addr.s_addr); if (node == NULL) { mlog(ML_NOTICE, "attempt to connect from unknown node at " "%u.%u.%u.%u:%d\n", NIPQUAD(sin.sin_addr.s_addr), -ntohs((__force __be16)sin.sin_port)); +ntohs(sin.sin_port)); ret = -EINVAL; goto out; } @@ -1714,7 +1706,7 @@ static int o2net_accept_one(struct socket *sock) mlog(ML_NOTICE, "unexpected connect attempted from a lower " "numbered node '%s' at " "%u.%u.%u.%u:%d with num %u\n", node->nd_name, NIPQUAD(sin.sin_addr.s_addr), -ntohs((__force __be16)sin.sin_port), node->nd_num); +ntohs(sin.sin_port), node->nd_num); ret = -EINVAL; goto out; } @@ -1725,7 +1717,7 @@ static int o2net_accept_one(struct socket *sock) mlog(ML_CONN, "attempt to connect from node '%s' at " "%u.%u.%u.%u:%d but it isn't heartbeating\n", node->nd_name, NIPQUAD(sin.sin_addr.s_addr), -ntohs((__force __be16)sin.sin_port)); +ntohs(sin.sin_port)); ret = -EINVAL; goto out; } @@ -1742,7 +1734,7 @@ static int o2net_accept_one(struct socket *sock) mlog(ML_NOTICE, "attempt to connect from node '%s' at " "%u.%u.%u.%u:%d but it already has an open connection\n", node->nd_name, NIPQUAD(sin.sin_addr.s_addr), -ntohs((__force __be16)sin.sin_port)); +ntohs(sin.sin_port)); goto out; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
regression: bfs endianness bug
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7e46aa5c8cb1347853de9ec86f3fa440f9dc9d77 Commit: 7e46aa5c8cb1347853de9ec86f3fa440f9dc9d77 Parent: 3c50b3683a8efbf3b4b314209d86aed1a0c44d5b Author: Al Viro <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 08:32:52 2007 + Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:25:20 2007 -0800 regression: bfs endianness bug BFS_FILEBLOCKS() expects struct bfs_inode * (on-disk data, with little- endian fields), not struct bfs_inode_info * (in-core stuff, with host- endian ones). It's a macro and fields with the right names are present in bfs_inode_info, so it compiles, but on big-endian host it gives bogus results. Introduced in commit f433dc56344cb72cc3de5ba0819021cec3aef807 ("Fixes to the BFS filesystem driver"). Signed-off-by: Al Viro <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- fs/bfs/inode.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 294c41b..a64a71d 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c @@ -178,7 +178,8 @@ static void bfs_delete_inode(struct inode *inode) brelse(bh); if (bi->i_dsk_ino) { - info->si_freeb += BFS_FILEBLOCKS(bi); + if (bi->i_sblock) + info->si_freeb += bi->i_eblock + 1 - bi->i_sblock; info->si_freei++; clear_bit(ino, info->si_imap); dump_imap("delete_inode", s); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
fcrypt endianness misannotations
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3c50b3683a8efbf3b4b314209d86aed1a0c44d5b Commit: 3c50b3683a8efbf3b4b314209d86aed1a0c44d5b Parent: 79901a9738d75faba0f08547ff17d676af2f5be3 Author: Al Viro <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 08:38:56 2007 + Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:25:20 2007 -0800 fcrypt endianness misannotations Signed-off-by: Al Viro <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- crypto/fcrypt.c | 88 +++--- 1 files changed, 44 insertions(+), 44 deletions(-) diff --git a/crypto/fcrypt.c b/crypto/fcrypt.c index d161949..a32cb68 100644 --- a/crypto/fcrypt.c +++ b/crypto/fcrypt.c @@ -51,7 +51,7 @@ #define ROUNDS 16 struct fcrypt_ctx { - u32 sched[ROUNDS]; + __be32 sched[ROUNDS]; }; /* Rotate right two 32 bit numbers as a 56 bit number */ @@ -73,8 +73,8 @@ do { \ * /afs/transarc.com/public/afsps/afs.rel31b.export-src/rxkad/sboxes.h */ #undef Z -#define Z(x) __constant_be32_to_cpu(x << 3) -static const u32 sbox0[256] = { +#define Z(x) __constant_cpu_to_be32(x << 3) +static const __be32 sbox0[256] = { Z(0xea), Z(0x7f), Z(0xb2), Z(0x64), Z(0x9d), Z(0xb0), Z(0xd9), Z(0x11), Z(0xcd), Z(0x86), Z(0x86), Z(0x91), Z(0x0a), Z(0xb2), Z(0x93), Z(0x06), Z(0x0e), Z(0x06), Z(0xd2), Z(0x65), Z(0x73), Z(0xc5), Z(0x28), Z(0x60), @@ -110,8 +110,8 @@ static const u32 sbox0[256] = { }; #undef Z -#define Z(x) __constant_be32_to_cpu((x << 27) | (x >> 5)) -static const u32 sbox1[256] = { +#define Z(x) __constant_cpu_to_be32((x << 27) | (x >> 5)) +static const __be32 sbox1[256] = { Z(0x77), Z(0x14), Z(0xa6), Z(0xfe), Z(0xb2), Z(0x5e), Z(0x8c), Z(0x3e), Z(0x67), Z(0x6c), Z(0xa1), Z(0x0d), Z(0xc2), Z(0xa2), Z(0xc1), Z(0x85), Z(0x6c), Z(0x7b), Z(0x67), Z(0xc6), Z(0x23), Z(0xe3), Z(0xf2), Z(0x89), @@ -147,8 +147,8 @@ static const u32 sbox1[256] = { }; #undef Z -#define Z(x) __constant_be32_to_cpu(x << 11) -static const u32 sbox2[256] = { +#define Z(x) __constant_cpu_to_be32(x << 11) +static const __be32 sbox2[256] = { Z(0xf0), Z(0x37), Z(0x24), Z(0x53), Z(0x2a), Z(0x03), Z(0x83), Z(0x86), Z(0xd1), Z(0xec), Z(0x50), Z(0xf0), Z(0x42), Z(0x78), Z(0x2f), Z(0x6d), Z(0xbf), Z(0x80), Z(0x87), Z(0x27), Z(0x95), Z(0xe2), Z(0xc5), Z(0x5d), @@ -184,8 +184,8 @@ static const u32 sbox2[256] = { }; #undef Z -#define Z(x) __constant_be32_to_cpu(x << 19) -static const u32 sbox3[256] = { +#define Z(x) __constant_cpu_to_be32(x << 19) +static const __be32 sbox3[256] = { Z(0xa9), Z(0x2a), Z(0x48), Z(0x51), Z(0x84), Z(0x7e), Z(0x49), Z(0xe2), Z(0xb5), Z(0xb7), Z(0x42), Z(0x33), Z(0x7d), Z(0x5d), Z(0xa6), Z(0x12), Z(0x44), Z(0x48), Z(0x6d), Z(0x28), Z(0xaa), Z(0x20), Z(0x6d), Z(0x57), @@ -225,7 +225,7 @@ static const u32 sbox3[256] = { */ #define F_ENCRYPT(R, L, sched) \ do { \ - union lc4 { u32 l; u8 c[4]; } u;\ + union lc4 { __be32 l; u8 c[4]; } u; \ u.l = sched ^ R;\ L ^= sbox0[u.c[0]] ^ sbox1[u.c[1]] ^ sbox2[u.c[2]] ^ sbox3[u.c[3]]; \ } while(0) @@ -237,7 +237,7 @@ static void fcrypt_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { const struct fcrypt_ctx *ctx = crypto_tfm_ctx(tfm); struct { - u32 l, r; + __be32 l, r; } X; memcpy(&X, src, sizeof(X)); @@ -269,7 +269,7 @@ static void fcrypt_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { const struct fcrypt_ctx *ctx = crypto_tfm_ctx(tfm); struct { - u32 l, r; + __be32 l, r; } X; memcpy(&X, src, sizeof(X)); @@ -328,22 +328,22 @@ static int fcrypt_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key k |= (*key) >> 1; /* Use lower 32 bits for schedule, rotate by 11 each round (16 times) */ - ctx->sched[0x0] = be32_to_cpu(k); ror56_64(k, 11); - ctx->sched[0x1] = be32_to_cpu(k); ror56_64(k, 11); - ctx->sched[0x2] = be32_to_cpu(k); ror56_64(k, 11); - ctx->sched[0x3] = be32_to_cpu(k); ror56_64(k, 11); - ctx->sched[0x4] = be32_to_cpu(k); ror56_64(k, 11); - ctx->sched[0x5] = be32_to_cpu(k); ror56_64(k, 11); - ctx->sched[0x6] = be32_to_cpu(k); ror56_64(k, 11); - ctx->sched[0x7] = be32_to_cpu(k); ror56_64(k, 11); - ctx->sched[0x8] = be32_to_cpu(k); ror56_64(k, 11); - ctx->sched[0x9] = be32_to_cpu(k); ror56_64(k, 11); - ctx->sched[0xa] = be32_to_cpu(k); ror56_64(k, 11); - ctx->sched[0xb] = be32_to_cpu(k); ror56_64(k, 11); -
SLUB's ksize() fails for size > 2048
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=294a80a8ed004b383ab214837e1c05ca4098a717 Commit: 294a80a8ed004b383ab214837e1c05ca4098a717 Parent: 5a622f2d0f86b316b07b55a4866ecb5518dd1cf7 Author: Vegard Nossum <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:30 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 SLUB's ksize() fails for size > 2048 I can't pass memory allocated by kmalloc() to ksize() if it is allocated by SLUB allocator and size is larger than (I guess) PAGE_SIZE / 2. The error of ksize() seems to be that it does not check if the allocation was made by SLUB or the page allocator. Reviewed-by: Pekka Enberg <[EMAIL PROTECTED]> Tested-by: Tetsuo Handa <[EMAIL PROTECTED]> Cc: Christoph Lameter <[EMAIL PROTECTED]>, Matt Mackall <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- mm/slub.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 9acb413..b9f37cb 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2558,8 +2558,12 @@ size_t ksize(const void *object) if (unlikely(object == ZERO_SIZE_PTR)) return 0; - page = get_object_page(object); + page = virt_to_head_page(object); BUG_ON(!page); + + if (unlikely(!PageSlab(page))) + return PAGE_SIZE << compound_order(page); + s = page->slab; BUG_ON(!s); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Blackfin SPI driver: move hard coded pin_req to board file
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=003d922618150eaab53936f57ba8a61f2b601486 Commit: 003d922618150eaab53936f57ba8a61f2b601486 Parent: f452126c2e4b8bbfd8e41ebdf1e734e3bf18f8e9 Author: Bryan Wu <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:22 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 Blackfin SPI driver: move hard coded pin_req to board file Remove some sort of bloaty code, try to get these pin_req arrays built at compile-time - move this static things to the blackfin board file - add pin_req array to struct bfin5xx_spi_master - tested on BF537/BF548 with SPI flash Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Cc: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 28 +++- include/asm-blackfin/bfin5xx_spi.h |1 + 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 6a02bd3..d6e9812 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -80,6 +80,9 @@ struct driver_data { /* Regs base of SPI controller */ void __iomem *regs_base; + /* Pin request list */ + u16 *pin_req; + /* BFIN hookup */ struct bfin5xx_spi_master *master_info; @@ -1255,25 +1258,6 @@ static inline int destroy_queue(struct driver_data *drv_data) return 0; } -static int setup_pin_mux(int action, int bus_num) -{ - - u16 pin_req[3][4] = { - {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, - {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0}, - {P_SPI2_SCK, P_SPI2_MISO, P_SPI2_MOSI, 0}, - }; - - if (action) { - if (peripheral_request_list(pin_req[bus_num], DRV_NAME)) - return -EFAULT; - } else { - peripheral_free_list(pin_req[bus_num]); - } - - return 0; -} - static int __init bfin5xx_spi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1296,6 +1280,7 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) drv_data->master = master; drv_data->master_info = platform_info; drv_data->pdev = pdev; + drv_data->pin_req = platform_info->pin_req; master->bus_num = pdev->id; master->num_chipselect = platform_info->num_chipselect; @@ -1346,7 +1331,8 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) goto out_error_queue_alloc; } - if (setup_pin_mux(1, master->bus_num)) { + status = peripheral_request_list(drv_data->pin_req, DRV_NAME); + if (status != 0) { dev_err(&pdev->dev, ": Requesting Peripherals failed\n"); goto out_error; } @@ -1394,7 +1380,7 @@ static int __devexit bfin5xx_spi_remove(struct platform_device *pdev) /* Disconnect from the SPI framework */ spi_unregister_master(drv_data->master); - setup_pin_mux(0, drv_data->master->bus_num); + peripheral_free_list(drv_data->pin_req); /* Prevent double remove */ platform_set_drvdata(pdev, NULL); diff --git a/include/asm-blackfin/bfin5xx_spi.h b/include/asm-blackfin/bfin5xx_spi.h index d4485b3..1a0b57f 100644 --- a/include/asm-blackfin/bfin5xx_spi.h +++ b/include/asm-blackfin/bfin5xx_spi.h @@ -152,6 +152,7 @@ struct bfin5xx_spi_master { u16 num_chipselect; u8 enable_dma; + u16 pin_req[4]; }; /* spi_board_info.controller_data for SPI slave devices, - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Blackfin SPI driver: use void __iomem * for regs_base
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f452126c2e4b8bbfd8e41ebdf1e734e3bf18f8e9 Commit: f452126c2e4b8bbfd8e41ebdf1e734e3bf18f8e9 Parent: d8c05008b0e464c94967ed2f20d1d661fca6790e Author: Bryan Wu <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:22 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 Blackfin SPI driver: use void __iomem * for regs_base Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Cc: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c |9 - 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 0e33b5a..6a02bd3 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -78,7 +78,7 @@ struct driver_data { struct spi_master *master; /* Regs base of SPI controller */ - u32 regs_base; + void __iomem *regs_base; /* BFIN hookup */ struct bfin5xx_spi_master *master_info; @@ -1311,9 +1311,8 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) goto out_error_get_res; } - drv_data->regs_base = (u32) ioremap(res->start, - (res->end - res->start + 1)); - if (!drv_data->regs_base) { + drv_data->regs_base = ioremap(res->start, (res->end - res->start + 1)); + if (drv_data->regs_base == NULL) { dev_err(dev, "Cannot map IO\n"); status = -ENXIO; goto out_error_ioremap; @@ -1352,7 +1351,7 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) goto out_error; } - dev_info(dev, "%s, Version %s, [EMAIL PROTECTED], dma [EMAIL PROTECTED]", + dev_info(dev, "%s, Version %s, [EMAIL PROTECTED], dma [EMAIL PROTECTED]", DRV_DESC, DRV_VERSION, drv_data->regs_base, drv_data->dma_channel); return status; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Blackfin SPI driver: use cpu_relax() to replace continue in while busywait
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d8c05008b0e464c94967ed2f20d1d661fca6790e Commit: d8c05008b0e464c94967ed2f20d1d661fca6790e Parent: 07612e5f224613020c0ba17ce28e8eac052ef8ce Author: Bryan Wu <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:21 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 Blackfin SPI driver: use cpu_relax() to replace continue in while busywait Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Cc: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 78 ++-- 1 files changed, 39 insertions(+), 39 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index a85bcb3..0e33b5a 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -186,7 +186,7 @@ static int flush(struct driver_data *drv_data) /* wait for stop and clear stat */ while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && limit--) - continue; + cpu_relax(); write_STAT(drv_data, BIT_STAT_CLR); @@ -262,7 +262,7 @@ static void null_writer(struct driver_data *drv_data) while (drv_data->tx < drv_data->tx_end) { write_TDBR(drv_data, 0); while ((read_STAT(drv_data) & BIT_STAT_TXS)) - continue; + cpu_relax(); drv_data->tx += n_bytes; } } @@ -274,7 +274,7 @@ static void null_reader(struct driver_data *drv_data) while (drv_data->rx < drv_data->rx_end) { while (!(read_STAT(drv_data) & BIT_STAT_RXS)) - continue; + cpu_relax(); dummy_read(drv_data); drv_data->rx += n_bytes; } @@ -287,12 +287,12 @@ static void u8_writer(struct driver_data *drv_data) /* poll for SPI completion before start */ while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) - continue; + cpu_relax(); while (drv_data->tx < drv_data->tx_end) { write_TDBR(drv_data, (*(u8 *) (drv_data->tx))); while (read_STAT(drv_data) & BIT_STAT_TXS) - continue; + cpu_relax(); ++drv_data->tx; } } @@ -303,14 +303,14 @@ static void u8_cs_chg_writer(struct driver_data *drv_data) /* poll for SPI completion before start */ while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) - continue; + cpu_relax(); while (drv_data->tx < drv_data->tx_end) { cs_active(drv_data, chip); write_TDBR(drv_data, (*(u8 *) (drv_data->tx))); while (read_STAT(drv_data) & BIT_STAT_TXS) - continue; + cpu_relax(); cs_deactive(drv_data, chip); @@ -325,7 +325,7 @@ static void u8_reader(struct driver_data *drv_data) /* poll for SPI completion before start */ while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) - continue; + cpu_relax(); /* clear TDBR buffer before read(else it will be shifted out) */ write_TDBR(drv_data, 0x); @@ -334,13 +334,13 @@ static void u8_reader(struct driver_data *drv_data) while (drv_data->rx < drv_data->rx_end - 1) { while (!(read_STAT(drv_data) & BIT_STAT_RXS)) - continue; + cpu_relax(); *(u8 *) (drv_data->rx) = read_RDBR(drv_data); ++drv_data->rx; } while (!(read_STAT(drv_data) & BIT_STAT_RXS)) - continue; + cpu_relax(); *(u8 *) (drv_data->rx) = read_SHAW(drv_data); ++drv_data->rx; } @@ -351,7 +351,7 @@ static void u8_cs_chg_reader(struct driver_data *drv_data) /* poll for SPI completion before start */ while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) - continue; + cpu_relax(); /* clear TDBR buffer before read(else it will be shifted out) */ write_TDBR(drv_data, 0x); @@ -363,7 +363,7 @@ static void u8_cs_chg_reader(struct driver_data *drv_data) cs_deactive(drv_data, chip); while (!(read_STAT(drv_data) & BIT_STAT_RXS)) - continue; + cpu_relax(); cs_active(drv_data, chip); *(u8 *) (drv_data->rx) = read_RDBR(drv_data); ++drv_data->rx; @@ -371,7 +371,7 @@ static void u8_cs_chg_reader(struct driver_data *drv_data) cs_deactive(drv_data, chip); while (!(read_STAT(drv_data) & BIT_STAT_RXS)) - continue; + cpu_relax(); *(u8 *) (drv_data->rx)
spi: spi_bfin uses portmux for additional busses
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7c4ef09449ca382da2e39b93ca9d03e3dbd5c17c Commit: 7c4ef09449ca382da2e39b93ca9d03e3dbd5c17c Parent: a32c691d7cf5c37af753255ef4843b18a31935b9 Author: Sonic Zhang <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:16 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:19 2007 -0800 spi: spi_bfin uses portmux for additional busses Use portmux mechanism to support SPI busses 1 and 2, instead of just the original bus 0. Signed-off-by: Sonic Zhang <[EMAIL PROTECTED]> Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 51 +++- 1 files changed, 31 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index a8311a8..045d3ec 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -209,17 +209,26 @@ static void cs_deactive(struct chip_data *chip) write_FLAG(flag); } -#define MAX_SPI0_SSEL 7 +#define MAX_SPI_SSEL 7 /* stop controller and re-config current chip*/ static int restore_state(struct driver_data *drv_data) { struct chip_data *chip = drv_data->cur_chip; int ret = 0; - u16 ssel[MAX_SPI0_SSEL] = {P_SPI0_SSEL1, P_SPI0_SSEL2, P_SPI0_SSEL3, - P_SPI0_SSEL4, P_SPI0_SSEL5, - P_SPI0_SSEL6, P_SPI0_SSEL7,}; - + u16 ssel[3][MAX_SPI_SSEL] = { + {P_SPI0_SSEL1, P_SPI0_SSEL2, P_SPI0_SSEL3, + P_SPI0_SSEL4, P_SPI0_SSEL5, + P_SPI0_SSEL6, P_SPI0_SSEL7}, + + {P_SPI1_SSEL1, P_SPI1_SSEL2, P_SPI1_SSEL3, + P_SPI1_SSEL4, P_SPI1_SSEL5, + P_SPI1_SSEL6, P_SPI1_SSEL7}, + + {P_SPI2_SSEL1, P_SPI2_SSEL2, P_SPI2_SSEL3, + P_SPI2_SSEL4, P_SPI2_SSEL5, + P_SPI2_SSEL6, P_SPI2_SSEL7}, + }; /* Clear status and disable clock */ write_STAT(BIT_STAT_CLR); bfin_spi_disable(drv_data); @@ -234,9 +243,9 @@ static int restore_state(struct driver_data *drv_data) int i = chip->chip_select_num; dev_dbg(&drv_data->pdev->dev, "chip select number is %d\n", i); - - if ((i > 0) && (i <= MAX_SPI0_SSEL)) - ret = peripheral_request(ssel[i-1], DRV_NAME); + if ((i > 0) && (i <= MAX_SPI_SSEL)) + ret = peripheral_request( + ssel[drv_data->master->bus_num][i-1], DRV_NAME); chip->chip_select_requested = 1; } @@ -329,7 +338,6 @@ static void u8_reader(struct driver_data *drv_data) write_TDBR(0x); dummy_read(); - while (drv_data->rx < drv_data->rx_end - 1) { while (!(read_STAT() & BIT_STAT_RXS)) continue; @@ -640,7 +648,6 @@ static void pump_transfers(unsigned long data) message = drv_data->cur_msg; transfer = drv_data->cur_transfer; chip = drv_data->cur_chip; - /* * if msg is error or done, report it back using complete() callback */ @@ -1206,16 +1213,20 @@ static inline int destroy_queue(struct driver_data *drv_data) return 0; } -static int setup_pin_mux(int action) +static int setup_pin_mux(int action, int bus_num) { - u16 pin_req[] = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}; + u16 pin_req[3][4] = { + {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, + {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0}, + {P_SPI2_SCK, P_SPI2_MISO, P_SPI2_MOSI, 0}, + }; if (action) { - if (peripheral_request_list(pin_req, DRV_NAME)) + if (peripheral_request_list(pin_req[bus_num], DRV_NAME)) return -EFAULT; } else { - peripheral_free_list(pin_req); + peripheral_free_list(pin_req[bus_num]); } return 0; @@ -1239,11 +1250,6 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) return -ENOMEM; } - if (setup_pin_mux(1)) { - dev_err(&pdev->dev, ": Requesting Peripherals failed\n"); - goto out_error; - } - drv_data = spi_master_get_devdata(master); drv_data->master = master; drv_data->master_info = platform_info; @@ -1298,6 +1304,11 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) goto out_error_queue_alloc; } + if (setup_pin_mux(1, master->bus_num)) { + dev_err(&pdev->dev, ": Requesting Peripherals failed\n"); + goto out_error; + } +
spi: spi_bfin, don't bypass spi framework
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2ed355165ff4ec834a75770f2a15dc87f5e06088 Commit: 2ed355165ff4ec834a75770f2a15dc87f5e06088 Parent: fad91c890909aabab0d9858d50f3c8394ee16b21 Author: Mike Frysinger <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:14 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:19 2007 -0800 spi: spi_bfin, don't bypass spi framework Prevent people from setting bits in ctl_reg that the SPI framework already handles, hopefully we can one day drop ctl_reg completely Signed-off-by: Mike Frysinger <[EMAIL PROTECTED]> Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index c2d51cf..8e4ea89 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -998,6 +998,18 @@ static int setup(struct spi_device *spi) /* chip_info isn't always needed */ if (chip_info) { + /* Make sure people stop trying to set fields via ctl_reg +* when they should actually be using common SPI framework. +* Currently we let through: WOM EMISO PSSE GM SZ TIMOD. +* Not sure if a user actually needs/uses any of these, +* but let's assume (for now) they do. +*/ + if (chip_info->ctl_reg & (SPE|MSTR|CPOL|CPHA|LSBF|SIZE)) { + dev_err(&spi->dev, "do not set bits in ctl_reg " + "that the SPI framework manages\n"); + return -EINVAL; + } + chip->enable_dma = chip_info->enable_dma != 0 && drv_data->master_info->enable_dma; chip->ctl_reg = chip_info->ctl_reg; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
spi: spi_bfin handles spi_transfer.cs_change
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fad91c890909aabab0d9858d50f3c8394ee16b21 Commit: fad91c890909aabab0d9858d50f3c8394ee16b21 Parent: 5fec5b5a4ec0d6d8b41c56e3cc7de41063cd4736 Author: Bryan Wu <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:14 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:19 2007 -0800 spi: spi_bfin handles spi_transfer.cs_change Respect per-transfer cs_change field (protocol tweaking support) by adding and using cs_active/cs_deactive functions. Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 76 - 1 files changed, 54 insertions(+), 22 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 803c5b2..c2d51cf 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -115,6 +115,7 @@ struct driver_data { size_t rx_map_len; size_t tx_map_len; u8 n_bytes; + int cs_change; void (*write) (struct driver_data *); void (*read) (struct driver_data *); void (*duplex) (struct driver_data *); @@ -179,6 +180,26 @@ static int flush(struct driver_data *drv_data) return limit; } +/* Chip select operation functions for cs_change flag */ +static void cs_active(struct chip_data *chip) +{ + u16 flag = read_FLAG(); + + flag |= chip->flag; + flag &= ~(chip->flag << 8); + + write_FLAG(flag); +} + +static void cs_deactive(struct chip_data *chip) +{ + u16 flag = read_FLAG(); + + flag |= (chip->flag << 8); + + write_FLAG(flag); +} + #define MAX_SPI0_SSEL 7 /* stop controller and re-config current chip*/ @@ -198,7 +219,7 @@ static int restore_state(struct driver_data *drv_data) /* Load the registers */ write_CTRL(chip->ctl_reg); write_BAUD(chip->baud); - write_FLAG(chip->flag); + cs_active(chip); if (!chip->chip_select_requested) { int i = chip->chip_select_num; @@ -273,20 +294,20 @@ static void u8_cs_chg_writer(struct driver_data *drv_data) struct chip_data *chip = drv_data->cur_chip; while (drv_data->tx < drv_data->tx_end) { - write_FLAG(chip->flag); + cs_active(chip); write_TDBR(*(u8 *) (drv_data->tx)); while (read_STAT() & BIT_STAT_TXS) continue; while (!(read_STAT() & BIT_STAT_SPIF)) continue; - write_FLAG(0xFF00 | chip->flag); + cs_deactive(chip); if (chip->cs_chg_udelay) udelay(chip->cs_chg_udelay); ++drv_data->tx; } - write_FLAG(0xFF00); + cs_deactive(chip); } @@ -318,7 +339,7 @@ static void u8_cs_chg_reader(struct driver_data *drv_data) struct chip_data *chip = drv_data->cur_chip; while (drv_data->rx < drv_data->rx_end) { - write_FLAG(chip->flag); + cs_active(chip); read_RDBR();/* kick off */ while (!(read_STAT() & BIT_STAT_RXS)) @@ -326,13 +347,13 @@ static void u8_cs_chg_reader(struct driver_data *drv_data) while (!(read_STAT() & BIT_STAT_SPIF)) continue; *(u8 *) (drv_data->rx) = read_SHAW(); - write_FLAG(0xFF00 | chip->flag); + cs_deactive(chip); if (chip->cs_chg_udelay) udelay(chip->cs_chg_udelay); ++drv_data->rx; } - write_FLAG(0xFF00); + cs_deactive(chip); } @@ -356,7 +377,7 @@ static void u8_cs_chg_duplex(struct driver_data *drv_data) struct chip_data *chip = drv_data->cur_chip; while (drv_data->rx < drv_data->rx_end) { - write_FLAG(chip->flag); + cs_active(chip); write_TDBR(*(u8 *) (drv_data->tx)); @@ -365,15 +386,14 @@ static void u8_cs_chg_duplex(struct driver_data *drv_data) while (!(read_STAT() & BIT_STAT_RXS)) continue; *(u8 *) (drv_data->rx) = read_RDBR(); - write_FLAG(0xFF00 | chip->flag); + cs_deactive(chip); if (chip->cs_chg_udelay) udelay(chip->cs_chg_udelay); ++drv_data->rx; ++drv_data->tx; } - write_FLAG(0xFF00); - + cs_deactive(chip); } static void u16_writer(struct driver_data *drv_data) @@ -398,20 +418,20 @@ static void u16_cs_chg_writer(struct driver_data *drv_data) struct chip_data *chip = drv_data->cur_chip; while (drv_data->tx < drv_data->tx_en
spi: simplify spi_sync() calling convention
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9b938b749065d6a94172ac24d9748bd66a03da4c Commit: 9b938b749065d6a94172ac24d9748bd66a03da4c Parent: 3f86f14c0fc9fdb0984e64209df2f47895a07151 Author: Marc Pignat <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:10 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:18 2007 -0800 spi: simplify spi_sync() calling convention Simplify spi_sync calling convention, eliminating the need to check both the return value AND the message->status. In consequence, this corrects misbehaviours of spi_read and spi_write (which only checked the former) and their callers. Signed-off-by: Marc Pignat <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi.c | 13 + 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 6ca07c9..93e9de4 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -541,10 +541,7 @@ static void spi_complete(void *arg) * Also, the caller is guaranteeing that the memory associated with the * message will not be freed before this call returns. * - * The return value is a negative error code if the message could not be - * submitted, else zero. When the value is zero, then message->status is - * also defined; it's the completion code for the transfer, either zero - * or a negative error code from the controller driver. + * It returns zero on success, else a negative error code. */ int spi_sync(struct spi_device *spi, struct spi_message *message) { @@ -554,8 +551,10 @@ int spi_sync(struct spi_device *spi, struct spi_message *message) message->complete = spi_complete; message->context = &done; status = spi_async(spi, message); - if (status == 0) + if (status == 0) { wait_for_completion(&done); + status = message->status; + } message->context = NULL; return status; } @@ -628,10 +627,8 @@ int spi_write_then_read(struct spi_device *spi, /* do the i/o */ status = spi_sync(spi, &message); - if (status == 0) { + if (status == 0) memcpy(rxbuf, x[1].rx_buf, n_rx); - status = message.status; - } if (x[0].tx_buf == buf) mutex_unlock(&lock); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
ufs: fix nexstep dir block size
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0c664f974269bb4c3d38ba900c91a9a5d4cee5b1 Commit: 0c664f974269bb4c3d38ba900c91a9a5d4cee5b1 Parent: 372a302e9a892229206aafca0352584a745bc5f3 Author: Evgeniy Dushistov <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:06 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:18 2007 -0800 ufs: fix nexstep dir block size This patch fixes regression, introduced since 2.6.16. NextStep variant of UFS as OpenStep uses directory block size equals to 1024. Without this change, ufs_check_page fails in many cases. [EMAIL PROTECTED]: coding-style fixes] Signed-off-by: Evgeniy Dushistov <[EMAIL PROTECTED]> Cc: Dave Bailey <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- fs/ufs/dir.c |2 +- fs/ufs/super.c |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 30f8c2b..aaf2878 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c @@ -179,7 +179,7 @@ bad_entry: goto fail; Eend: p = (struct ufs_dir_entry *)(kaddr + offs); - ufs_error (sb, "ext2_check_page", + ufs_error(sb, __FUNCTION__, "entry in directory #%lu spans the page boundary" "offset=%lu", dir->i_ino, (page->indexs_fmask = ~(1024 - 1); uspi->s_fshift = 10; uspi->s_sbsize = super_block_size = 2048; uspi->s_sbbase = 0; + uspi->s_dirblksize = 1024; flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; if (!(sb->s_flags & MS_RDONLY)) { if (!silent) @@ -771,13 +771,13 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) break; case UFS_MOUNT_UFSTYPE_NEXTSTEP_CD: - /*TODO: check may be we need set special dir block size?*/ UFSD("ufstype=nextstep-cd\n"); uspi->s_fsize = block_size = 2048; uspi->s_fmask = ~(2048 - 1); uspi->s_fshift = 11; uspi->s_sbsize = super_block_size = 2048; uspi->s_sbbase = 0; + uspi->s_dirblksize = 1024; flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_OLD | UFS_CG_OLD; if (!(sb->s_flags & MS_RDONLY)) { if (!silent) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RTC: assure proper memory ordering with respect to RTC_DEV_BUSY flag
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=372a302e9a892229206aafca0352584a745bc5f3 Commit: 372a302e9a892229206aafca0352584a745bc5f3 Parent: 5cd17569fd0eeca510735e63a6061291e3971bf6 Author: Jiri Kosina <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:05 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:18 2007 -0800 RTC: assure proper memory ordering with respect to RTC_DEV_BUSY flag We must make sure that the RTC_DEV_BUSY flag has proper lock semantics, i.e. that the RTC_DEV_BUSY stores clearing the flag don't get reordered before the preceeding stores and loads and vice versa. Spotted by Nick Piggin. Signed-off-by: Jiri Kosina <[EMAIL PROTECTED]> Cc: Nick Piggin <[EMAIL PROTECTED]> Cc: David Brownell <[EMAIL PROTECTED]> Acked-by: Alessandro Zummo <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/rtc/interface.c |4 ++-- drivers/rtc/rtc-dev.c |6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index a4f56e9..f1e00ff 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -293,7 +293,7 @@ int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task) return -EINVAL; /* Cannot register while the char dev is in use */ - if (test_and_set_bit(RTC_DEV_BUSY, &rtc->flags)) + if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) return -EBUSY; spin_lock_irq(&rtc->irq_task_lock); @@ -303,7 +303,7 @@ int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task) } spin_unlock_irq(&rtc->irq_task_lock); - clear_bit(RTC_DEV_BUSY, &rtc->flags); + clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); return retval; } diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index ae1bf17..025c60a 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c @@ -26,7 +26,7 @@ static int rtc_dev_open(struct inode *inode, struct file *file) struct rtc_device, char_dev); const struct rtc_class_ops *ops = rtc->ops; - if (test_and_set_bit(RTC_DEV_BUSY, &rtc->flags)) + if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) return -EBUSY; file->private_data = rtc; @@ -41,7 +41,7 @@ static int rtc_dev_open(struct inode *inode, struct file *file) } /* something has gone wrong */ - clear_bit(RTC_DEV_BUSY, &rtc->flags); + clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); return err; } @@ -402,7 +402,7 @@ static int rtc_dev_release(struct inode *inode, struct file *file) if (rtc->ops->release) rtc->ops->release(rtc->dev.parent); - clear_bit(RTC_DEV_BUSY, &rtc->flags); + clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); return 0; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
fix clone(CLONE_NEWPID)
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5cd17569fd0eeca510735e63a6061291e3971bf6 Commit: 5cd17569fd0eeca510735e63a6061291e3971bf6 Parent: e00ba3dae077f54cfd2af42e939a618caa7a3bca Author: Eric W. Biederman <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:04 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:18 2007 -0800 fix clone(CLONE_NEWPID) Currently we are complicating the code in copy_process, the clone ABI, and if we fix the bugs sys_setsid itself, with an unnecessary open coded version of sys_setsid. So just simplify everything and don't special case the session and pgrp of the initial process in a pid namespace. Having this special case actually presents to user space the classic linux startup conditions with session == pgrp == 0 for /sbin/init. We already handle sending signals to processes in a child pid namespace. We need to handle sending signals to processes in a parent pid namespace for cases like SIGCHILD and SIGIO. This makes nothing extra visible inside a pid namespace. So this extra special case appears to have no redeeming merits. Further removing this special case increases the flexibility of how we can use pid namespaces, by not requiring the initial process in a pid namespace to be a daemon. Signed-off-by: Eric W. Biederman <[EMAIL PROTECTED]> Cc: Oleg Nesterov <[EMAIL PROTECTED]> Cc: Pavel Emelyanov <[EMAIL PROTECTED]> Cc: Sukadev Bhattiprolu <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- kernel/fork.c | 21 ++--- 1 files changed, 6 insertions(+), 15 deletions(-) diff --git a/kernel/fork.c b/kernel/fork.c index 8ca1a14..8dd8ff2 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1292,23 +1292,14 @@ static struct task_struct *copy_process(unsigned long clone_flags, __ptrace_link(p, current->parent); if (thread_group_leader(p)) { - if (clone_flags & CLONE_NEWPID) { + if (clone_flags & CLONE_NEWPID) p->nsproxy->pid_ns->child_reaper = p; - p->signal->tty = NULL; - set_task_pgrp(p, p->pid); - set_task_session(p, p->pid); - attach_pid(p, PIDTYPE_PGID, pid); - attach_pid(p, PIDTYPE_SID, pid); - } else { - p->signal->tty = current->signal->tty; - set_task_pgrp(p, task_pgrp_nr(current)); - set_task_session(p, task_session_nr(current)); - attach_pid(p, PIDTYPE_PGID, - task_pgrp(current)); - attach_pid(p, PIDTYPE_SID, - task_session(current)); - } + p->signal->tty = current->signal->tty; + set_task_pgrp(p, task_pgrp_nr(current)); + set_task_session(p, task_session_nr(current)); + attach_pid(p, PIDTYPE_PGID, task_pgrp(current)); + attach_pid(p, PIDTYPE_SID, task_session(current)); list_add_tail_rcu(&p->tasks, &init_task.tasks); __get_cpu_var(process_counts)++; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Security: allow capable check to permit mmap or low vm space
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ab5a91a8364c3d6fc617abc47cc81d162c01d90a Commit: ab5a91a8364c3d6fc617abc47cc81d162c01d90a Parent: d313f948309ab22797316e789a7ff8fa358176b6 Author: Eric Paris <[EMAIL PROTECTED]> AuthorDate: Mon Nov 26 18:47:46 2007 -0500 Committer: James Morris <[EMAIL PROTECTED]> CommitDate: Thu Dec 6 00:24:30 2007 +1100 Security: allow capable check to permit mmap or low vm space On a kernel with CONFIG_SECURITY but without an LSM which implements security_file_mmap it is impossible for an application to mmap addresses lower than mmap_min_addr. Based on a suggestion from a developer in the openwall community this patch adds a check for CAP_SYS_RAWIO. It is assumed that any process with this capability can harm the system a lot more easily than writing some stuff on the zero page and then trying to get the kernel to trip over itself. It also means that programs like X on i686 which use vm86 emulation can work even with mmap_min_addr set. Signed-off-by: Eric Paris <[EMAIL PROTECTED]> Signed-off-by: James Morris <[EMAIL PROTECTED]> --- security/dummy.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/security/dummy.c b/security/dummy.c index 6d895ad..3ccfbbe 100644 --- a/security/dummy.c +++ b/security/dummy.c @@ -426,7 +426,7 @@ static int dummy_file_mmap (struct file *file, unsigned long reqprot, unsigned long addr, unsigned long addr_only) { - if (addr < mmap_min_addr) + if ((addr < mmap_min_addr) && !capable(CAP_SYS_RAWIO)) return -EACCES; return 0; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
SELinux: detect dead booleans
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d313f948309ab22797316e789a7ff8fa358176b6 Commit: d313f948309ab22797316e789a7ff8fa358176b6 Parent: 0955dc03aedfb6a5565445b3f2176255b784cc6a Author: Stephen Smalley <[EMAIL PROTECTED]> AuthorDate: Mon Nov 26 11:12:53 2007 -0500 Committer: James Morris <[EMAIL PROTECTED]> CommitDate: Thu Dec 6 00:24:09 2007 +1100 SELinux: detect dead booleans Instead of using f_op to detect dead booleans, check the inode index against the number of booleans and check the dentry name against the boolean name for that index on reads and writes. This prevents incorrect use of a boolean file opened prior to a policy reload while allowing valid use of it as long as it still corresponds to the same boolean in the policy. Signed-off-by: Stephen Smalley <[EMAIL PROTECTED]> Signed-off-by: James Morris <[EMAIL PROTECTED]> --- security/selinux/selinuxfs.c | 43 + 1 files changed, 30 insertions(+), 13 deletions(-) diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index ac6fe99..2fa483f 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -65,6 +65,7 @@ static DEFINE_MUTEX(sel_mutex); /* global data for booleans */ static struct dentry *bool_dir = NULL; static int bool_num = 0; +static char **bool_pending_names; static int *bool_pending_values = NULL; /* global data for classes */ @@ -832,11 +833,16 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf, ssize_t length; ssize_t ret; int cur_enforcing; - struct inode *inode; + struct inode *inode = filep->f_path.dentry->d_inode; + unsigned index = inode->i_ino & SEL_INO_MASK; + const char *name = filep->f_path.dentry->d_name.name; mutex_lock(&sel_mutex); - ret = -EFAULT; + if (index >= bool_num || strcmp(name, bool_pending_names[index])) { + ret = -EINVAL; + goto out; + } if (count > PAGE_SIZE) { ret = -EINVAL; @@ -847,15 +853,13 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf, goto out; } - inode = filep->f_path.dentry->d_inode; - cur_enforcing = security_get_bool_value(inode->i_ino&SEL_INO_MASK); + cur_enforcing = security_get_bool_value(index); if (cur_enforcing < 0) { ret = cur_enforcing; goto out; } - length = scnprintf(page, PAGE_SIZE, "%d %d", cur_enforcing, - bool_pending_values[inode->i_ino&SEL_INO_MASK]); + bool_pending_values[index]); ret = simple_read_from_buffer(buf, count, ppos, page, length); out: mutex_unlock(&sel_mutex); @@ -868,9 +872,11 @@ static ssize_t sel_write_bool(struct file *filep, const char __user *buf, size_t count, loff_t *ppos) { char *page = NULL; - ssize_t length = -EFAULT; + ssize_t length; int new_value; - struct inode *inode; + struct inode *inode = filep->f_path.dentry->d_inode; + unsigned index = inode->i_ino & SEL_INO_MASK; + const char *name = filep->f_path.dentry->d_name.name; mutex_lock(&sel_mutex); @@ -878,12 +884,19 @@ static ssize_t sel_write_bool(struct file *filep, const char __user *buf, if (length) goto out; + if (index >= bool_num || strcmp(name, bool_pending_names[index])) { + length = -EINVAL; + goto out; + } + if (count >= PAGE_SIZE) { length = -ENOMEM; goto out; } + if (*ppos != 0) { /* No partial writes. */ + length = -EINVAL; goto out; } page = (char*)get_zeroed_page(GFP_KERNEL); @@ -892,6 +905,7 @@ static ssize_t sel_write_bool(struct file *filep, const char __user *buf, goto out; } + length = -EFAULT; if (copy_from_user(page, buf, count)) goto out; @@ -902,8 +916,7 @@ static ssize_t sel_write_bool(struct file *filep, const char __user *buf, if (new_value) new_value = 1; - inode = filep->f_path.dentry->d_inode; - bool_pending_values[inode->i_ino&SEL_INO_MASK] = new_value; + bool_pending_values[index] = new_value; length = count; out: @@ -923,7 +936,7 @@ static ssize_t sel_commit_bools_write(struct file *filep, size_t count, loff_t *ppos) { char *page = NULL; - ssize_t length = -EFAULT; + ssize_t length; int new_value; mutex_lock(&sel_mutex); @@ -946,6 +959,7 @@ static ssize_t sel_commit_bools_write(struct file *filep, goto out; } + length = -EFAULT; if
SELinux: do not clear f_op when removing entries
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0955dc03aedfb6a5565445b3f2176255b784cc6a Commit: 0955dc03aedfb6a5565445b3f2176255b784cc6a Parent: e3c0ac04f980750a368f7cd5f1b8d1d2cdc1f735 Author: Stephen Smalley <[EMAIL PROTECTED]> AuthorDate: Wed Nov 21 09:01:36 2007 -0500 Committer: James Morris <[EMAIL PROTECTED]> CommitDate: Thu Dec 6 00:23:46 2007 +1100 SELinux: do not clear f_op when removing entries Do not clear f_op when removing entries since it isn't safe to do. Signed-off-by: Stephen Smalley <[EMAIL PROTECTED]> Signed-off-by: James Morris <[EMAIL PROTECTED]> --- security/selinux/selinuxfs.c | 28 +--- 1 files changed, 1 insertions(+), 27 deletions(-) diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index f5f3e6d..ac6fe99 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -838,10 +838,6 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf, ret = -EFAULT; - /* check to see if this file has been deleted */ - if (!filep->f_op) - goto out; - if (count > PAGE_SIZE) { ret = -EINVAL; goto out; @@ -882,10 +878,6 @@ static ssize_t sel_write_bool(struct file *filep, const char __user *buf, if (length) goto out; - /* check to see if this file has been deleted */ - if (!filep->f_op) - goto out; - if (count >= PAGE_SIZE) { length = -ENOMEM; goto out; @@ -940,10 +932,6 @@ static ssize_t sel_commit_bools_write(struct file *filep, if (length) goto out; - /* check to see if this file has been deleted */ - if (!filep->f_op) - goto out; - if (count >= PAGE_SIZE) { length = -ENOMEM; goto out; @@ -982,11 +970,9 @@ static const struct file_operations sel_commit_bools_ops = { .write = sel_commit_bools_write, }; -/* partial revoke() from fs/proc/generic.c proc_kill_inodes */ static void sel_remove_entries(struct dentry *de) { - struct list_head *p, *node; - struct super_block *sb = de->d_sb; + struct list_head *node; spin_lock(&dcache_lock); node = de->d_subdirs.next; @@ -1006,18 +992,6 @@ static void sel_remove_entries(struct dentry *de) } spin_unlock(&dcache_lock); - - file_list_lock(); - list_for_each(p, &sb->s_files) { - struct file * filp = list_entry(p, struct file, f_u.fu_list); - struct dentry * dentry = filp->f_path.dentry; - - if (dentry->d_parent != de) { - continue; - } - filp->f_op = NULL; - } - file_list_unlock(); } #define BOOL_DIR_NAME "booleans" - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[LRO]: fix lro_gen_skb() alignment
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=621544eb8c3beaa859c75850f816dd9b056a00a3 Commit: 621544eb8c3beaa859c75850f816dd9b056a00a3 Parent: 4e67d876ce07471e02be571038d5435a825f0215 Author: Andrew Gallatin <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 02:31:42 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:32 2007 -0800 [LRO]: fix lro_gen_skb() alignment Add a field to the lro_mgr struct so that drivers can specify how much padding is required to align layer 3 headers when a packet is copied into a freshly allocated skb by inet_lro.c:lro_gen_skb(). Without padding, skbs generated by LRO will cause alignment warnings on architectures which require strict alignment (seen on sparc64). Myri10GE is updated to use this field. Signed-off-by: Andrew Gallatin <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- drivers/net/myri10ge/myri10ge.c |1 + include/linux/inet_lro.h|3 +++ net/ipv4/inet_lro.c |3 ++- 3 files changed, 6 insertions(+), 1 deletions(-) diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 0f306dd..8def865 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c @@ -1979,6 +1979,7 @@ static int myri10ge_open(struct net_device *dev) lro_mgr->lro_arr = mgp->rx_done.lro_desc; lro_mgr->get_frag_header = myri10ge_get_frag_header; lro_mgr->max_aggr = myri10ge_lro_max_pkts; + lro_mgr->frag_align_pad = 2; if (lro_mgr->max_aggr > MAX_SKB_FRAGS) lro_mgr->max_aggr = MAX_SKB_FRAGS; diff --git a/include/linux/inet_lro.h b/include/linux/inet_lro.h index 1246d46..80335b7 100644 --- a/include/linux/inet_lro.h +++ b/include/linux/inet_lro.h @@ -91,6 +91,9 @@ struct net_lro_mgr { int max_desc; /* Max number of LRO descriptors */ int max_aggr; /* Max number of LRO packets to be aggregated */ + int frag_align_pad; /* Padding required to properly align layer 3 +* headers in generated skb when using frags */ + struct net_lro_desc *lro_arr; /* Array of LRO descriptors */ /* diff --git a/net/ipv4/inet_lro.c b/net/ipv4/inet_lro.c index ac3b1d3..9a96c27 100644 --- a/net/ipv4/inet_lro.c +++ b/net/ipv4/inet_lro.c @@ -401,10 +401,11 @@ static struct sk_buff *lro_gen_skb(struct net_lro_mgr *lro_mgr, int data_len = len; int hdr_len = min(len, hlen); - skb = netdev_alloc_skb(lro_mgr->dev, hlen); + skb = netdev_alloc_skb(lro_mgr->dev, hlen + lro_mgr->frag_align_pad); if (!skb) return NULL; + skb_reserve(skb, lro_mgr->frag_align_pad); skb->len = len; skb->data_len = len - hdr_len; skb->truesize += true_size; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[IPVS]: Don't leak sysctl tables if the scheduler registration fails.
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a014bc8f0f0a3a0cac4fef656f101cdfb77b71eb Commit: a014bc8f0f0a3a0cac4fef656f101cdfb77b71eb Parent: e3c0ac04f980750a368f7cd5f1b8d1d2cdc1f735 Author: Pavel Emelyanov <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 00:43:24 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:26 2007 -0800 [IPVS]: Don't leak sysctl tables if the scheduler registration fails. In case we load lblc or lblcr module we can leak some sysctl tables if the call to register_ip_vs_scheduler() fails. I've looked at the register_ip_vs_scheduler() code and saw, that the only reason to fail is the name collision, so I think that with some 3rd party schedulers this becomes a relevant issue. No? Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]> Acked-by: Simon Horman <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- net/ipv4/ipvs/ip_vs_lblc.c |7 ++- net/ipv4/ipvs/ip_vs_lblcr.c |7 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c index b843a11..ad89644 100644 --- a/net/ipv4/ipvs/ip_vs_lblc.c +++ b/net/ipv4/ipvs/ip_vs_lblc.c @@ -580,9 +580,14 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler = static int __init ip_vs_lblc_init(void) { + int ret; + INIT_LIST_HEAD(&ip_vs_lblc_scheduler.n_list); sysctl_header = register_sysctl_table(lblc_root_table); - return register_ip_vs_scheduler(&ip_vs_lblc_scheduler); + ret = register_ip_vs_scheduler(&ip_vs_lblc_scheduler); + if (ret) + unregister_sysctl_table(sysctl_header); + return ret; } diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c index e5b323a..2a5ed85 100644 --- a/net/ipv4/ipvs/ip_vs_lblcr.c +++ b/net/ipv4/ipvs/ip_vs_lblcr.c @@ -769,9 +769,14 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler = static int __init ip_vs_lblcr_init(void) { + int ret; + INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list); sysctl_header = register_sysctl_table(lblcr_root_table); - return register_ip_vs_scheduler(&ip_vs_lblcr_scheduler); + ret = register_ip_vs_scheduler(&ip_vs_lblcr_scheduler); + if (ret) + unregister_sysctl_table(sysctl_header); + return ret; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SPARC64]: Update defconfig.
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9cb1200a286799db897e81bc2b2c1730cfdc9c08 Commit: 9cb1200a286799db897e81bc2b2c1730cfdc9c08 Parent: b127aa8bafb3b5b555ab0e7d6f87cb8a541a3d46 Author: David S. Miller <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 00:38:22 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:38:01 2007 -0800 [SPARC64]: Update defconfig. Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- arch/sparc64/defconfig |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index 22734ac..f62d9f6 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.24-rc1 -# Wed Oct 31 15:36:47 2007 +# Linux kernel version: 2.6.24-rc4 +# Tue Dec 4 00:37:59 2007 # CONFIG_SPARC=y CONFIG_SPARC64=y @@ -47,6 +47,7 @@ CONFIG_POSIX_MQUEUE=y # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_TASKSTATS is not set # CONFIG_USER_NS is not set +# CONFIG_PID_NS is not set # CONFIG_AUDIT is not set # CONFIG_IKCONFIG is not set CONFIG_LOG_BUF_SHIFT=18 @@ -154,6 +155,7 @@ CONFIG_PCI_DOMAINS=y CONFIG_PCI_SYSCALL=y CONFIG_ARCH_SUPPORTS_MSI=y CONFIG_PCI_MSI=y +# CONFIG_PCI_LEGACY is not set # CONFIG_PCI_DEBUG is not set CONFIG_SUN_OPENPROMFS=m CONFIG_SPARC32_COMPAT=y @@ -359,7 +361,6 @@ CONFIG_IDE_GENERIC=y CONFIG_BLK_DEV_IDEPCI=y # CONFIG_IDEPCI_SHARE_IRQ is not set CONFIG_IDEPCI_PCIBUS_ORDER=y -# CONFIG_BLK_DEV_OFFBOARD is not set # CONFIG_BLK_DEV_GENERIC is not set # CONFIG_BLK_DEV_OPTI621 is not set CONFIG_BLK_DEV_IDEDMA_PCI=y @@ -584,7 +585,6 @@ CONFIG_NIU=m # CONFIG_USB_KAWETH is not set # CONFIG_USB_PEGASUS is not set # CONFIG_USB_RTL8150 is not set -# CONFIG_USB_USBNET_MII is not set # CONFIG_USB_USBNET is not set # CONFIG_WAN is not set # CONFIG_FDDI is not set @@ -780,6 +780,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_ADT7470 is not set # CONFIG_SENSORS_ATXP1 is not set # CONFIG_SENSORS_DS1621 is not set +# CONFIG_SENSORS_I5K_AMB is not set # CONFIG_SENSORS_F71805F is not set # CONFIG_SENSORS_F71882FG is not set # CONFIG_SENSORS_F75375S is not set - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SPARC]: Add missing of_node_put
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b127aa8bafb3b5b555ab0e7d6f87cb8a541a3d46 Commit: b127aa8bafb3b5b555ab0e7d6f87cb8a541a3d46 Parent: 75c6d1410caa6fea861ef3802e8b186f7685f235 Author: Julia Lawall <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 00:33:07 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:38:00 2007 -0800 [SPARC]: Add missing of_node_put There should be an of_node_put when breaking out of a loop that iterates using for_each_node_by_type. Signed-off-by: Julia Lawall <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- arch/sparc/kernel/devices.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c index af90a5f..b240b88 100644 --- a/arch/sparc/kernel/devices.c +++ b/arch/sparc/kernel/devices.c @@ -62,8 +62,10 @@ static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg, int err = check_cpu_node(dp->node, &cur_inst, compare, compare_arg, prom_node, mid); - if (!err) + if (!err) { + of_node_put(dp); return 0; + } } return -ENODEV; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
no need to mess with KBUILD_CFLAGS on uml-i386 anymore
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=79901a9738d75faba0f08547ff17d676af2f5be3 Commit: 79901a9738d75faba0f08547ff17d676af2f5be3 Parent: 9b5e6857b3f3acc8ab434e565b7ec87bf9f9b53c Author: Al Viro <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 08:36:15 2007 + Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:25:20 2007 -0800 no need to mess with KBUILD_CFLAGS on uml-i386 anymore Now that X86_32 is provided on Kconfig level for uml-i386, there's no need to play with it explicitly on Makefile level anymore. Signed-off-by: Al Viro <[EMAIL PROTECTED]> Acked-by: Jeff Dike <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- arch/um/Makefile-i386 |5 - 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386 index 6729011..561e373 100644 --- a/arch/um/Makefile-i386 +++ b/arch/um/Makefile-i386 @@ -22,11 +22,6 @@ export LDFLAGS HOSTCFLAGS HOSTLDFLAGS UML_OBJCOPYFLAGS endif endif -KBUILD_CFLAGS += -DCONFIG_X86_32 -KBUILD_AFLAGS += -DCONFIG_X86_32 -CONFIG_X86_32 := y -export CONFIG_X86_32 - # First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y. include $(srctree)/arch/x86/Makefile_32.cpu - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
regression: cifs endianness bug
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9b5e6857b3f3acc8ab434e565b7ec87bf9f9b53c Commit: 9b5e6857b3f3acc8ab434e565b7ec87bf9f9b53c Parent: ecaf18c15aac8bb9bed7b7aa0e382fe252e275d5 Author: Al Viro <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 08:24:38 2007 + Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:25:19 2007 -0800 regression: cifs endianness bug access_flags_to_mode() gets on-the-wire data (little-endian) and treats it as host-endian. Introduced in commit e01b64001359034d04c695388870936ed3d1b56b ("[CIFS] enable get mode from ACL when cifsacl mount option specified") Signed-off-by: Al Viro <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- fs/cifs/cifsacl.c | 33 + 1 files changed, 17 insertions(+), 16 deletions(-) diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index f02fdef..c312adc 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c @@ -134,9 +134,10 @@ int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid) pmode is the existing mode (we only want to overwrite part of this bits to set can be: S_IRWXU, S_IRWXG or S_IRWXO ie 00700 or 00070 or 7 */ -static void access_flags_to_mode(__u32 ace_flags, int type, umode_t *pmode, +static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode, umode_t *pbits_to_set) { + __u32 flags = le32_to_cpu(ace_flags); /* the order of ACEs is important. The canonical order is to begin with DENY entries followed by ALLOW, otherwise an allow entry could be encountered first, making the subsequent deny entry like "dead code" @@ -146,17 +147,17 @@ static void access_flags_to_mode(__u32 ace_flags, int type, umode_t *pmode, /* For deny ACEs we change the mask so that subsequent allow access control entries do not turn on the bits we are denying */ if (type == ACCESS_DENIED) { - if (ace_flags & GENERIC_ALL) { + if (flags & GENERIC_ALL) { *pbits_to_set &= ~S_IRWXUGO; } - if ((ace_flags & GENERIC_WRITE) || - ((ace_flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) + if ((flags & GENERIC_WRITE) || + ((flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) *pbits_to_set &= ~S_IWUGO; - if ((ace_flags & GENERIC_READ) || - ((ace_flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS)) + if ((flags & GENERIC_READ) || + ((flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS)) *pbits_to_set &= ~S_IRUGO; - if ((ace_flags & GENERIC_EXECUTE) || - ((ace_flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) + if ((flags & GENERIC_EXECUTE) || + ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) *pbits_to_set &= ~S_IXUGO; return; } else if (type != ACCESS_ALLOWED) { @@ -165,25 +166,25 @@ static void access_flags_to_mode(__u32 ace_flags, int type, umode_t *pmode, } /* else ACCESS_ALLOWED type */ - if (ace_flags & GENERIC_ALL) { + if (flags & GENERIC_ALL) { *pmode |= (S_IRWXUGO & (*pbits_to_set)); #ifdef CONFIG_CIFS_DEBUG2 cFYI(1, ("all perms")); #endif return; } - if ((ace_flags & GENERIC_WRITE) || - ((ace_flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) + if ((flags & GENERIC_WRITE) || + ((flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) *pmode |= (S_IWUGO & (*pbits_to_set)); - if ((ace_flags & GENERIC_READ) || - ((ace_flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS)) + if ((flags & GENERIC_READ) || + ((flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS)) *pmode |= (S_IRUGO & (*pbits_to_set)); - if ((ace_flags & GENERIC_EXECUTE) || - ((ace_flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) + if ((flags & GENERIC_EXECUTE) || + ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) *pmode |= (S_IXUGO & (*pbits_to_set)); #ifdef CONFIG_CIFS_DEBUG2 - cFYI(1, ("access flags 0x%x mode now 0x%x", ace_flags, *pmode)); + cFYI(1, ("access flags 0x%x mode now 0x%x", flags, *pmode)); #endif return; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
VM/Security: add security hook to do_brk
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ecaf18c15aac8bb9bed7b7aa0e382fe252e275d5 Commit: ecaf18c15aac8bb9bed7b7aa0e382fe252e275d5 Parent: 294a80a8ed004b383ab214837e1c05ca4098a717 Author: Eric Paris <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:31 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:21 2007 -0800 VM/Security: add security hook to do_brk Given a specifically crafted binary do_brk() can be used to get low pages available in userspace virtual memory and can thus be used to circumvent the mmap_min_addr low memory protection. Add security checks in do_brk(). Signed-off-by: Eric Paris <[EMAIL PROTECTED]> Acked-by: Alan Cox <[EMAIL PROTECTED]> Cc: Stephen Smalley <[EMAIL PROTECTED]> Cc: James Morris <[EMAIL PROTECTED]> Cc: Chris Wright <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- mm/mmap.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index facc1a7..acfc13f 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1934,6 +1934,10 @@ unsigned long do_brk(unsigned long addr, unsigned long len) if (is_hugepage_only_range(mm, addr, len)) return -EINVAL; + error = security_file_mmap(0, 0, 0, 0, addr, 1); + if (error) + return error; + flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; error = arch_mmap_check(addr, len, flags); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
spi: spi_bfin: resequence DMA start/stop
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=07612e5f224613020c0ba17ce28e8eac052ef8ce Commit: 07612e5f224613020c0ba17ce28e8eac052ef8ce Parent: 62310e51ac10c5e50998240e49a84d2e28377a48 Author: Sonic Zhang <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:21 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 spi: spi_bfin: resequence DMA start/stop Set correct baud for spi mmc and enable SPI only after DMA is started. Signed-off-by: Sonic Zhang <[EMAIL PROTECTED]> Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 30 +++--- 1 files changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 4dc7e67..a85bcb3 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -231,13 +231,13 @@ static int restore_state(struct driver_data *drv_data) dev_dbg(&drv_data->pdev->dev, "restoring spi ctl state\n"); /* Load the registers */ - cs_deactive(drv_data, chip); write_BAUD(drv_data, chip->baud); chip->ctl_reg &= (~BIT_CTL_TIMOD); chip->ctl_reg |= (chip->width << 8); write_CTRL(drv_data, chip->ctl_reg); bfin_spi_enable(drv_data); + cs_active(drv_data, chip); if (ret) dev_dbg(&drv_data->pdev->dev, @@ -767,6 +767,7 @@ static void pump_transfers(unsigned long data) disable_dma(drv_data->dma_channel); clear_dma_irqstat(drv_data->dma_channel); + bfin_spi_disable(drv_data); /* config dma channel */ dev_dbg(&drv_data->pdev->dev, "doing dma transfer\n"); @@ -789,9 +790,6 @@ static void pump_transfers(unsigned long data) dev_dbg(&drv_data->pdev->dev, "doing autobuffer DMA out.\n"); - /* set SPI transfer mode */ - write_CTRL(drv_data, (cr | CFG_SPI_DMAWRITE)); - /* no irq in autobuffer mode */ dma_config = (DMAFLOW_AUTO | RESTART | dma_width | DI_EN); @@ -800,7 +798,13 @@ static void pump_transfers(unsigned long data) (unsigned long)drv_data->tx); enable_dma(drv_data->dma_channel); - /* just return here, there can only be one transfer in this mode */ + /* start SPI transfer */ + write_CTRL(drv_data, + (cr | CFG_SPI_DMAWRITE | BIT_CTL_ENABLE)); + + /* just return here, there can only be one transfer +* in this mode +*/ message->status = 0; giveback(drv_data); return; @@ -811,9 +815,6 @@ static void pump_transfers(unsigned long data) /* set transfer mode, and enable SPI */ dev_dbg(&drv_data->pdev->dev, "doing DMA in.\n"); - /* set SPI transfer mode */ - write_CTRL(drv_data, (cr | CFG_SPI_DMAREAD)); - /* clear tx reg soformer data is not shifted out */ write_TDBR(drv_data, 0x); @@ -827,12 +828,13 @@ static void pump_transfers(unsigned long data) (unsigned long)drv_data->rx); enable_dma(drv_data->dma_channel); + /* start SPI transfer */ + write_CTRL(drv_data, + (cr | CFG_SPI_DMAREAD | BIT_CTL_ENABLE)); + } else if (drv_data->tx != NULL) { dev_dbg(&drv_data->pdev->dev, "doing DMA out.\n"); - /* set SPI transfer mode */ - write_CTRL(drv_data, (cr | CFG_SPI_DMAWRITE)); - /* start dma */ dma_enable_irq(drv_data->dma_channel); dma_config = (RESTART | dma_width | DI_EN); @@ -840,6 +842,10 @@ static void pump_transfers(unsigned long data) set_dma_start_addr(drv_data->dma_channel, (unsigned long)drv_data->tx); enable_dma(drv_data->dma_channel); + + /* start SPI transfer */ + write_CTRL(drv_data, + (cr | CFG_SPI_DMAWRITE | BIT_CTL_ENABLE)); } } else { /* IO mode write then read */ @@ -1142,6 +1148,8 @@ static int setup(struct spi_device *spi)
spi: spi_bfin: update handling of delay-after-deselect
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=62310e51ac10c5e50998240e49a84d2e28377a48 Commit: 62310e51ac10c5e50998240e49a84d2e28377a48 Parent: c3061abb9e95920407288cba143dc1af0babf099 Author: Bryan Wu <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:20 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 spi: spi_bfin: update handling of delay-after-deselect Move cs_chg_udelay handling (specific to this driver) to cs_deactive(), fixing a bug when some SPI LCD driver needs delay after cs_deactive. Fix bug reported by Cameron Barfield <[EMAIL PROTECTED]> https://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&forum_id=39&_forum_action=ForumMessageBrowse&thread_id=23630&feedback=Message%20replied. Cc: Cameron Barfield <[EMAIL PROTECTED]> Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 24 +--- include/asm-blackfin/bfin5xx_spi.h |2 +- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 25b0efc..4dc7e67 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -132,7 +132,7 @@ struct chip_data { u8 enable_dma; u8 bits_per_word; /* 8 or 16 */ u8 cs_change_per_word; - u8 cs_chg_udelay; + u16 cs_chg_udelay; /* Some devices require > 255usec delay */ void (*write) (struct driver_data *); void (*read) (struct driver_data *); void (*duplex) (struct driver_data *); @@ -211,6 +211,10 @@ static void cs_deactive(struct driver_data *drv_data, struct chip_data *chip) flag |= (chip->flag << 8); write_FLAG(drv_data, flag); + + /* Move delay here for consistency */ + if (chip->cs_chg_udelay) + udelay(chip->cs_chg_udelay); } #define MAX_SPI_SSEL 7 @@ -307,10 +311,9 @@ static void u8_cs_chg_writer(struct driver_data *drv_data) write_TDBR(drv_data, (*(u8 *) (drv_data->tx))); while (read_STAT(drv_data) & BIT_STAT_TXS) continue; + cs_deactive(drv_data, chip); - if (chip->cs_chg_udelay) - udelay(chip->cs_chg_udelay); ++drv_data->tx; } } @@ -359,9 +362,6 @@ static void u8_cs_chg_reader(struct driver_data *drv_data) while (drv_data->rx < drv_data->rx_end - 1) { cs_deactive(drv_data, chip); - if (chip->cs_chg_udelay) - udelay(chip->cs_chg_udelay); - while (!(read_STAT(drv_data) & BIT_STAT_RXS)) continue; cs_active(drv_data, chip); @@ -412,10 +412,9 @@ static void u8_cs_chg_duplex(struct driver_data *drv_data) while (!(read_STAT(drv_data) & BIT_STAT_RXS)) continue; *(u8 *) (drv_data->rx) = read_RDBR(drv_data); + cs_deactive(drv_data, chip); - if (chip->cs_chg_udelay) - udelay(chip->cs_chg_udelay); ++drv_data->rx; ++drv_data->tx; } @@ -452,10 +451,9 @@ static void u16_cs_chg_writer(struct driver_data *drv_data) write_TDBR(drv_data, (*(u16 *) (drv_data->tx))); while ((read_STAT(drv_data) & BIT_STAT_TXS)) continue; + cs_deactive(drv_data, chip); - if (chip->cs_chg_udelay) - udelay(chip->cs_chg_udelay); drv_data->tx += 2; } } @@ -504,9 +502,6 @@ static void u16_cs_chg_reader(struct driver_data *drv_data) while (drv_data->rx < drv_data->rx_end - 2) { cs_deactive(drv_data, chip); - if (chip->cs_chg_udelay) - udelay(chip->cs_chg_udelay); - while (!(read_STAT(drv_data) & BIT_STAT_RXS)) continue; cs_active(drv_data, chip); @@ -557,10 +552,9 @@ static void u16_cs_chg_duplex(struct driver_data *drv_data) while (!(read_STAT(drv_data) & BIT_STAT_RXS)) continue; *(u16 *) (drv_data->rx) = read_RDBR(drv_data); + cs_deactive(drv_data, chip); - if (chip->cs_chg_udelay) - udelay(chip->cs_chg_udelay); drv_data->rx += 2; drv_data->tx += 2; } diff --git a/include/asm-blackfin/bfin5xx_spi.h b/include/asm-blackfin/bfin5xx_spi.h index f617d87..d4485b3 100644 --- a/include/asm-blackfin/bfin5xx_spi.h +++ b/include/asm-blackfin/bfin5xx_spi.h @@ -162,7 +162,7 @@ struct bfi
spi: spi_bfin: bugfix for 8..16 bit word sizes
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c3061abb9e95920407288cba143dc1af0babf099 Commit: c3061abb9e95920407288cba143dc1af0babf099 Parent: bb90eb00b6c28c8be5a69c6b58d5a6924f6f2ad7 Author: Bryan Wu <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:19 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 spi: spi_bfin: bugfix for 8..16 bit word sizes Fix bug in u16_cs_chg_reader to read data_len-2 bytes data firstly, then read out the last 2 bytes data Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index c4c4905..25b0efc 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -501,7 +501,7 @@ static void u16_cs_chg_reader(struct driver_data *drv_data) cs_active(drv_data, chip); dummy_read(drv_data); - while (drv_data->rx < drv_data->rx_end) { + while (drv_data->rx < drv_data->rx_end - 2) { cs_deactive(drv_data, chip); if (chip->cs_chg_udelay) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
spi: spi_bfin cleanups, error handling
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5fec5b5a4ec0d6d8b41c56e3cc7de41063cd4736 Commit: 5fec5b5a4ec0d6d8b41c56e3cc7de41063cd4736 Parent: cc2f81a695640dd1c0cf12b35ee303460fa6d0bc Author: Bryan Wu <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:13 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:19 2007 -0800 spi: spi_bfin cleanups, error handling Cleanup and error handling - add error handling in SPI bus driver with selecting clients - use proper defines to access Blackfin MMRs - remove useless SSYNCs - cleaner use of portmux calls Signed-off-by: Michael Hennerich <[EMAIL PROTECTED]> Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 111 +++-- 1 files changed, 47 insertions(+), 64 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 759a6fc..803c5b2 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -59,10 +59,9 @@ MODULE_LICENSE("GPL"); #define DEFINE_SPI_REG(reg, off) \ static inline u16 read_##reg(void) \ -{ return *(volatile unsigned short*)(SPI0_REGBASE + off); } \ + { return bfin_read16(SPI0_REGBASE + off); } \ static inline void write_##reg(u16 v) \ -{*(volatile unsigned short*)(SPI0_REGBASE + off) = v;\ - SSYNC();} + {bfin_write16(SPI0_REGBASE + off, v); } DEFINE_SPI_REG(CTRL, 0x00) DEFINE_SPI_REG(FLAG, 0x04) @@ -145,7 +144,6 @@ static void bfin_spi_enable(struct driver_data *drv_data) cr = read_CTRL(); write_CTRL(cr | BIT_CTL_ENABLE); - SSYNC(); } static void bfin_spi_disable(struct driver_data *drv_data) @@ -154,7 +152,6 @@ static void bfin_spi_disable(struct driver_data *drv_data) cr = read_CTRL(); write_CTRL(cr & (~BIT_CTL_ENABLE)); - SSYNC(); } /* Caculate the SPI_BAUD register value based on input HZ */ @@ -182,52 +179,44 @@ static int flush(struct driver_data *drv_data) return limit; } +#define MAX_SPI0_SSEL 7 + /* stop controller and re-config current chip*/ -static void restore_state(struct driver_data *drv_data) +static int restore_state(struct driver_data *drv_data) { struct chip_data *chip = drv_data->cur_chip; + int ret = 0; + u16 ssel[MAX_SPI0_SSEL] = {P_SPI0_SSEL1, P_SPI0_SSEL2, P_SPI0_SSEL3, + P_SPI0_SSEL4, P_SPI0_SSEL5, + P_SPI0_SSEL6, P_SPI0_SSEL7,}; /* Clear status and disable clock */ write_STAT(BIT_STAT_CLR); bfin_spi_disable(drv_data); dev_dbg(&drv_data->pdev->dev, "restoring spi ctl state\n"); + /* Load the registers */ + write_CTRL(chip->ctl_reg); + write_BAUD(chip->baud); + write_FLAG(chip->flag); + if (!chip->chip_select_requested) { + int i = chip->chip_select_num; - dev_dbg(&drv_data->pdev->dev, - "chip select number is %d\n", chip->chip_select_num); - - switch (chip->chip_select_num) { - case 1: - peripheral_request(P_SPI0_SSEL1, DRV_NAME); - break; - case 2: - peripheral_request(P_SPI0_SSEL2, DRV_NAME); - break; - case 3: - peripheral_request(P_SPI0_SSEL3, DRV_NAME); - break; - case 4: - peripheral_request(P_SPI0_SSEL4, DRV_NAME); - break; - case 5: - peripheral_request(P_SPI0_SSEL5, DRV_NAME); - break; - case 6: - peripheral_request(P_SPI0_SSEL6, DRV_NAME); - break; - case 7: - peripheral_request(P_SPI0_SSEL7, DRV_NAME); - break; - } + dev_dbg(&drv_data->pdev->dev, "chip select number is %d\n", i); + + if ((i > 0) && (i <= MAX_SPI0_SSEL)) + ret = peripheral_request(ssel[i-1], DRV_NAME); chip->chip_select_requested = 1; } - /* Load the registers */ - write_CTRL(chip->ctl_reg); - write_BAUD(chip->baud); - write_FLAG(chip->flag); + if (ret) + dev_dbg(&drv_data->pdev->dev, + ": request chip select number %d failed\n", + chip->chip_select_num); + + return ret; } /* used to kick off transfer in rx mode */ @@ -285,7 +274,6 @@ static void u8_cs_chg_writer(struct driver_data *drv_data) while (drv_data->tx < d
spi: bfin spi uses portmux calls
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cc2f81a695640dd1c0cf12b35ee303460fa6d0bc Commit: cc2f81a695640dd1c0cf12b35ee303460fa6d0bc Parent: 131b17d42de6194fa960132c1f62c29923c4f20c Author: Michael Hennerich <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:13 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:19 2007 -0800 spi: bfin spi uses portmux calls Use new Blackfin portmux interface, add error handling. Signed-off-by: Michael Hennerich <[EMAIL PROTECTED]> Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 28 ++-- include/asm-blackfin/mach-bf533/portmux.h |2 +- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 805f03b..759a6fc 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -1167,6 +1167,21 @@ static inline int destroy_queue(struct driver_data *drv_data) return 0; } +static int setup_pin_mux(int action) +{ + + u16 pin_req[] = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}; + + if (action) { + if (peripheral_request_list(pin_req, DRV_NAME)) + return -EFAULT; + } else { + peripheral_free_list(pin_req); + } + + return 0; +} + static int __init bfin5xx_spi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1184,12 +1199,9 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) return -ENOMEM; } - if (peripheral_request(P_SPI0_SCK, DRV_NAME) || -peripheral_request(P_SPI0_MISO, DRV_NAME) || -peripheral_request(P_SPI0_MOSI, DRV_NAME)) { - + if (setup_pin_mux(1)) { dev_err(&pdev->dev, ": Requesting Peripherals failed\n"); - goto out_error_queue_alloc; + goto out_error; } drv_data = spi_master_get_devdata(master); @@ -1225,9 +1237,11 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "controller probe successfully\n"); return status; - out_error_queue_alloc: +out_error_queue_alloc: destroy_queue(drv_data); +out_error: spi_master_put(master); + return status; } @@ -1257,6 +1271,8 @@ static int __devexit bfin5xx_spi_remove(struct platform_device *pdev) /* Disconnect from the SPI framework */ spi_unregister_master(drv_data->master); + setup_pin_mux(0); + /* Prevent double remove */ platform_set_drvdata(pdev, NULL); diff --git a/include/asm-blackfin/mach-bf533/portmux.h b/include/asm-blackfin/mach-bf533/portmux.h index b88d7a0..137f488 100644 --- a/include/asm-blackfin/mach-bf533/portmux.h +++ b/include/asm-blackfin/mach-bf533/portmux.h @@ -42,7 +42,7 @@ #define P_SPORT0_DRPRI (P_DONTCARE) #define P_SPI0_MOSI(P_DONTCARE) -#define P_SPI0_MIS0(P_DONTCARE) +#define P_SPI0_MISO(P_DONTCARE) #define P_SPI0_SCK (P_DONTCARE) #define P_SPI0_SSEL7 (P_DEFINED | P_IDENT(GPIO_PF7)) #define P_SPI0_SSEL6 (P_DEFINED | P_IDENT(GPIO_PF6)) - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
spi: initial BF54x SPI support
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=131b17d42de6194fa960132c1f62c29923c4f20c Commit: 131b17d42de6194fa960132c1f62c29923c4f20c Parent: c24b2602af88db4489c6c3fb4b2a8e47fb15769b Author: Bryan Wu <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:12 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:19 2007 -0800 spi: initial BF54x SPI support Initial BF54x SPI support - support BF54x SPI0 - clean up some code (whitespace etc) - will support multiports in the future - start using portmux calls Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 139 +++ include/asm-blackfin/mach-bf548/defBF54x_base.h | 17 +++ 2 files changed, 86 insertions(+), 70 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 2ef11bb..805f03b 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -1,17 +1,20 @@ /* - * File: drivers/spi/bfin5xx_spi.c - * Based on: N/A - * Author: Luke Yang (Analog Devices Inc.) + * File: drivers/spi/bfin5xx_spi.c + * Maintainer: + * Bryan Wu <[EMAIL PROTECTED]> + * Original Author: + * Luke Yang (Analog Devices Inc.) * - * Created: March. 10th 2006 - * Description: SPI controller driver for Blackfin 5xx - * Bugs: Enter bugs at http://blackfin.uclinux.org/ + * Created:March. 10th 2006 + * Description:SPI controller driver for Blackfin BF5xx + * Bugs: Enter bugs at http://blackfin.uclinux.org/ * * Modified: * March 10, 2006 bfin5xx_spi.c Created. (Luke Yang) * August 7, 2006 added full duplex mode (Axel Weiss & Luke Yang) + * July 17, 2007 add support for BF54x SPI0 controller (Bryan Wu) * - * Copyright 2004-2006 Analog Devices Inc. + * Copyright 2004-2007 Analog Devices Inc. * * This program is free software ; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,27 +34,27 @@ #include #include +#include #include +#include #include +#include #include #include #include #include #include #include -#include -#include -#include -#include #include - +#include #include -MODULE_AUTHOR("Luke Yang"); -MODULE_DESCRIPTION("Blackfin 5xx SPI Contoller"); +MODULE_AUTHOR("Bryan Wu, Luke Yang"); +MODULE_DESCRIPTION("Blackfin BF5xx SPI Contoller Driver"); MODULE_LICENSE("GPL"); +#define DRV_NAME "bfin-spi-master" #define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0) #define DEFINE_SPI_REG(reg, off) \ @@ -124,6 +127,7 @@ struct chip_data { u16 flag; u8 chip_select_num; + u8 chip_select_requested; u8 n_bytes; u8 width; /* 0 or 1 */ u8 enable_dma; @@ -188,53 +192,37 @@ static void restore_state(struct driver_data *drv_data) bfin_spi_disable(drv_data); dev_dbg(&drv_data->pdev->dev, "restoring spi ctl state\n"); -#if defined(CONFIG_BF534) || defined(CONFIG_BF536) || defined(CONFIG_BF537) - dev_dbg(&drv_data->pdev->dev, - "chip select number is %d\n", chip->chip_select_num); - - switch (chip->chip_select_num) { - case 1: - bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3c00); - SSYNC(); - break; + if (!chip->chip_select_requested) { - case 2: - case 3: - bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PJSE_SPI); - SSYNC(); - bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3800); - SSYNC(); - break; - - case 4: - bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PFS4E_SPI); - SSYNC(); - bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3840); - SSYNC(); - break; - - case 5: - bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PFS5E_SPI); - SSYNC(); - bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3820); - SSYNC(); - break; + dev_dbg(&drv_data->pdev->dev, + "chip select number is %d\n", chip->chip_select_num); - case 6: - bfin_write_PORT_MUX(bfin_read_PORT_MUX() | PFS6E_SPI); - SSYNC(); - bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3810); - SSYNC(); - break; + switch (chip->chip_select_num) { + case 1: + peripheral_request(P_SPI0_SSEL1, DRV_NAME); + break; + case 2: + peripheral_request(P_SPI0_SSEL2,
spi: use simplified spi_sync() calling convention
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c24b2602af88db4489c6c3fb4b2a8e47fb15769b Commit: c24b2602af88db4489c6c3fb4b2a8e47fb15769b Parent: 9b938b749065d6a94172ac24d9748bd66a03da4c Author: Marc Pignat <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:11 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:19 2007 -0800 spi: use simplified spi_sync() calling convention Given the patch which simplifies the spi_sync calling convention, this one updates the callers of that routine which tried using it according to the previous specification. (Most didn't.) Signed-off-by: Marc Pignat <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/input/touchscreen/ads7846.c | 13 ++--- drivers/mmc/host/mmc_spi.c | 10 -- drivers/rtc/rtc-max6902.c | 12 +++- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index f59aecf..fd9c5d5 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -267,13 +267,12 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) ts->irq_disabled = 0; enable_irq(spi->irq); - if (req->msg.status) - status = req->msg.status; - - /* on-wire is a must-ignore bit, a BE12 value, then padding */ - sample = be16_to_cpu(req->sample); - sample = sample >> 3; - sample &= 0x0fff; + if (status == 0) { + /* on-wire is a must-ignore bit, a BE12 value, then padding */ + sample = be16_to_cpu(req->sample); + sample = sample >> 3; + sample &= 0x0fff; + } kfree(req); return status ? status : sample; diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index a646921..365024b 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c @@ -176,8 +176,6 @@ mmc_spi_readbytes(struct mmc_spi_host *host, unsigned len) DMA_FROM_DEVICE); status = spi_sync(host->spi, &host->readback); - if (status == 0) - status = host->readback.status; if (host->dma_dev) dma_sync_single_for_cpu(host->dma_dev, @@ -480,8 +478,6 @@ mmc_spi_command_send(struct mmc_spi_host *host, DMA_BIDIRECTIONAL); } status = spi_sync(host->spi, &host->m); - if (status == 0) - status = host->m.status; if (host->dma_dev) dma_sync_single_for_cpu(host->dma_dev, @@ -624,8 +620,6 @@ mmc_spi_writeblock(struct mmc_spi_host *host, struct spi_transfer *t) DMA_BIDIRECTIONAL); status = spi_sync(spi, &host->m); - if (status == 0) - status = host->m.status; if (status != 0) { dev_dbg(&spi->dev, "write error (%d)\n", status); @@ -726,8 +720,6 @@ mmc_spi_readblock(struct mmc_spi_host *host, struct spi_transfer *t) } status = spi_sync(spi, &host->m); - if (status == 0) - status = host->m.status; if (host->dma_dev) { dma_sync_single_for_cpu(host->dma_dev, @@ -905,8 +897,6 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd, DMA_BIDIRECTIONAL); tmp = spi_sync(spi, &host->m); - if (tmp == 0) - tmp = host->m.status; if (host->dma_dev) dma_sync_single_for_cpu(host->dma_dev, diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c index 3e183cf..1f956dc 100644 --- a/drivers/rtc/rtc-max6902.c +++ b/drivers/rtc/rtc-max6902.c @@ -89,13 +89,9 @@ static int max6902_get_reg(struct device *dev, unsigned char address, /* do the i/o */ status = spi_sync(spi, &message); - if (status == 0) - status = message.status; - else - return status; - - *data = chip->rx_buf[1]; + if (status == 0) + *data = chip->rx_buf[1]; return status; } @@ -125,9 +121,7 @@ static int max6902_get_datetime(struct device *dev, struct rtc_time *dt) /* do the i/o */ status = spi_sync(spi, &message); - if (status == 0) - status = message.status; - else + if (status) return status; /* The chip sends data in this order: - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/major
aio: only account I/O wait time in read_events if there are active requests
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e00ba3dae077f54cfd2af42e939a618caa7a3bca Commit: e00ba3dae077f54cfd2af42e939a618caa7a3bca Parent: e3c0ac04f980750a368f7cd5f1b8d1d2cdc1f735 Author: Jeff Moyer <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:02 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:18 2007 -0800 aio: only account I/O wait time in read_events if there are active requests On 2.6.24, top started showing 100% iowait on one CPU when a UML instance was running (but completely idle). The UML code sits in io_getevents waiting for an event to be submitted and completed. Fix this by checking ctx->reqs_active before scheduling to determine whether or not we are waiting for I/O. Signed-off-by: Jeff Moyer <[EMAIL PROTECTED]> Cc: Zach Brown <[EMAIL PROTECTED]> Cc: Miklos Szeredi <[EMAIL PROTECTED]> Cc: Jeff Dike <[EMAIL PROTECTED]> Cc: "Rafael J. Wysocki" <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- fs/aio.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index f12db41..9dec7d2 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1161,7 +1161,12 @@ retry: ret = 0; if (to.timed_out) /* Only check after read evt */ break; - io_schedule(); + /* Try to only show up in io wait if there are ops +* in flight */ + if (ctx->reqs_active) + io_schedule(); + else + schedule(); if (signal_pending(tsk)) { ret = -EINTR; break; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
futex: fix for futex_wait signal stack corruption
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ce6bd420f43b28038a2c6e8fbb86ad24014727b6 Commit: ce6bd420f43b28038a2c6e8fbb86ad24014727b6 Parent: e3c0ac04f980750a368f7cd5f1b8d1d2cdc1f735 Author: Steven Rostedt <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 15:46:09 2007 +0100 Committer: Ingo Molnar <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 15:46:09 2007 +0100 futex: fix for futex_wait signal stack corruption David Holmes found a bug in the -rt tree with respect to pthread_cond_timedwait. After trying his test program on the latest git from mainline, I found the bug was there too. The bug he was seeing that his test program showed, was that if one were to do a "Ctrl-Z" on a process that was in the pthread_cond_timedwait, and then did a "bg" on that process, it would return with a "-ETIMEDOUT" but early. That is, the timer would go off early. Looking into this, I found the source of the problem. And it is a rather nasty bug at that. Here's the relevant code from kernel/futex.c: (not in order in the file) [...] smlinkage long sys_futex(u32 __user *uaddr, int op, u32 val, struct timespec __user *utime, u32 __user *uaddr2, u32 val3) { struct timespec ts; ktime_t t, *tp = NULL; u32 val2 = 0; int cmd = op & FUTEX_CMD_MASK; if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI)) { if (copy_from_user(&ts, utime, sizeof(ts)) != 0) return -EFAULT; if (!timespec_valid(&ts)) return -EINVAL; t = timespec_to_ktime(ts); if (cmd == FUTEX_WAIT) t = ktime_add(ktime_get(), t); tp = &t; } [...] return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); } [...] long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, u32 __user *uaddr2, u32 val2, u32 val3) { int ret; int cmd = op & FUTEX_CMD_MASK; struct rw_semaphore *fshared = NULL; if (!(op & FUTEX_PRIVATE_FLAG)) fshared = ¤t->mm->mmap_sem; switch (cmd) { case FUTEX_WAIT: ret = futex_wait(uaddr, fshared, val, timeout); [...] static int futex_wait(u32 __user *uaddr, struct rw_semaphore *fshared, u32 val, ktime_t *abs_time) { [...] struct restart_block *restart; restart = ¤t_thread_info()->restart_block; restart->fn = futex_wait_restart; restart->arg0 = (unsigned long)uaddr; restart->arg1 = (unsigned long)val; restart->arg2 = (unsigned long)abs_time; restart->arg3 = 0; if (fshared) restart->arg3 |= ARG3_SHARED; return -ERESTART_RESTARTBLOCK; [...] static long futex_wait_restart(struct restart_block *restart) { u32 __user *uaddr = (u32 __user *)restart->arg0; u32 val = (u32)restart->arg1; ktime_t *abs_time = (ktime_t *)restart->arg2; struct rw_semaphore *fshared = NULL; restart->fn = do_no_restart_syscall; if (restart->arg3 & ARG3_SHARED) fshared = ¤t->mm->mmap_sem; return (long)futex_wait(uaddr, fshared, val, abs_time); } So when the futex_wait is interrupt by a signal we break out of the hrtimer code and set up or return from signal. This code does not return back to userspace, so we set up a RESTARTBLOCK. The bug here is that we save the "abs_time" which is a pointer to the stack variable "ktime_t t" from sys_futex. This returns and unwinds the stack before we get to call our signal. On return from the signal we go to futex_wait_restart, where we update all the parameters for futex_wait and call it. But here we have a problem where abs_time is no longer valid. I verified this with print statements, and sure enough, what abs_time was set to ends up being garbage when we get to futex_wait_restart. The solution I did to solve this (with input from Linus Torvalds) was to add unions to the restart_block to allow system calls to use the restart with specific parameters. This way the futex code now saves the time in a 64bit value in the restart block instead of storing it on the stack. Note: I'm a bit nervious to add "linux/types.h" and use u32 and u64 in thread_info.h, when there's a #ifdef __KERNEL__ just below that. Not sure what that is there for. If this
[TCP]: NAGLE_PUSH seems to be a wrong way around
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4e67d876ce07471e02be571038d5435a825f0215 Commit: 4e67d876ce07471e02be571038d5435a825f0215 Parent: 52d3408150858a301a84bcbfe2f323d90d71d2ce Author: Ilpo J�rvinen <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 02:25:32 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:31 2007 -0800 [TCP]: NAGLE_PUSH seems to be a wrong way around The comment in tcp_nagle_test suggests that. This bug is very very old, even 2.4.0 seems to have it. Signed-off-by: Ilpo J�rvinen <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- net/ipv4/tcp_output.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index e5130a7..f4c1eef 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1162,8 +1162,7 @@ int tcp_may_send_now(struct sock *sk) return (skb && tcp_snd_test(sk, skb, tcp_current_mss(sk, 1), (tcp_skb_is_last(sk, skb) ? - TCP_NAGLE_PUSH : - tp->nonagle))); + tp->nonagle : TCP_NAGLE_PUSH))); } /* Trim TSO SKB to LEN bytes, put the remaining data into a new packet - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[TCP]: Move prior_in_flight collect to more robust place
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=52d3408150858a301a84bcbfe2f323d90d71d2ce Commit: 52d3408150858a301a84bcbfe2f323d90d71d2ce Parent: 3e6f049e0c4cf0606207c1a210abf50b436e9adf Author: Ilpo J�rvinen <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 02:21:35 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:30 2007 -0800 [TCP]: Move prior_in_flight collect to more robust place The previous location is after sacktag processing, which affects counters tcp_packets_in_flight depends on. This may manifest as wrong behavior if new SACK blocks are present and all is clear for call to tcp_cong_avoid, which in the case of tcp_reno_cong_avoid bails out early because it thinks that TCP is not limited by cwnd. Signed-off-by: Ilpo J�rvinen <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- net/ipv4/tcp_input.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 094f8fa..b9e429d 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -3065,6 +3065,7 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag) } prior_fackets = tp->fackets_out; + prior_in_flight = tcp_packets_in_flight(tp); if (!(flag&FLAG_SLOWPATH) && after(ack, prior_snd_una)) { /* Window is constant, pure forward advance. @@ -3104,8 +3105,6 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag) if (!prior_packets) goto no_queue; - prior_in_flight = tcp_packets_in_flight(tp); - /* See if we can take anything off of the retransmit queue. */ flag |= tcp_clean_rtx_queue(sk, &seq_rtt, prior_fackets); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SPARC]: Add missing "space"
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=794b26e0600e3aab399f9d0f225f9e0b8782edbb Commit: 794b26e0600e3aab399f9d0f225f9e0b8782edbb Parent: 519c4d2debebc82b201b80fdc48643e19233eb97 Author: Joe Perches <[EMAIL PROTECTED]> AuthorDate: Mon Nov 19 23:45:16 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:58 2007 -0800 [SPARC]: Add missing "space" Signed-off-by: Joe Perches <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- arch/sparc/kernel/pcic.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index f2d432e..4cd5d78 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c @@ -329,7 +329,7 @@ int __init pcic_probe(void) pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr"; if ((pcic->pcic_config_space_addr = ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == 0) { - prom_printf("PCIC: Error, cannot map" + prom_printf("PCIC: Error, cannot map " "PCI Configuration Space Address.\n"); prom_halt(); } @@ -341,7 +341,7 @@ int __init pcic_probe(void) pcic->pcic_res_cfg_data.name = "pcic_cfg_data"; if ((pcic->pcic_config_space_data = ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == 0) { - prom_printf("PCIC: Error, cannot map" + prom_printf("PCIC: Error, cannot map " "PCI Configuration Space Data.\n"); prom_halt(); } @@ -518,8 +518,8 @@ static void pcic_map_pci_device(struct linux_pcic *pcic, * board in a PCI slot. We must remap it * under 64K but it is not done yet. XXX */ - printk("PCIC: Skipping I/O space at 0x%lx," - "this will Oops if a driver attaches;" + printk("PCIC: Skipping I/O space at 0x%lx, " + "this will Oops if a driver attaches " "device '%s' at %02x:%02x)\n", address, namebuf, dev->bus->number, dev->devfn); } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
proc: fix proc_dir_entry refcounting
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5a622f2d0f86b316b07b55a4866ecb5518dd1cf7 Commit: 5a622f2d0f86b316b07b55a4866ecb5518dd1cf7 Parent: d4beaf4ab5f89496f2bcf67db62ad95d99bfeff6 Author: Alexey Dobriyan <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:28 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 proc: fix proc_dir_entry refcounting Creating PDEs with refcount 0 and "deleted" flag has problems (see below). Switch to usual scheme: * PDE is created with refcount 1 * every de_get does +1 * every de_put() and remove_proc_entry() do -1 * once refcount reaches 0, PDE is freed. This elegantly fixes at least two following races (both observed) without introducing new locks, without abusing old locks, without spreading lock_kernel(): 1) PDE leak remove_proc_entry de_put - -- [refcnt = 1] if (atomic_read(&de->count) == 0) if (atomic_dec_and_test(&de->count)) if (de->deleted) /* also not taken! */ free_proc_entry(de); else de->deleted = 1; [refcount=0, deleted=1] 2) use after free remove_proc_entry de_put - -- [refcnt = 1] if (atomic_dec_and_test(&de->count)) if (atomic_read(&de->count) == 0) free_proc_entry(de); /* boom! */ if (de->deleted) free_proc_entry(de); BUG: unable to handle kernel paging request at virtual address 6b6b6b6b printing eip: c10acdda *pdpt = 338f8001 *pde = Oops: [#1] PREEMPT SMP Modules linked in: af_packet ipv6 cpufreq_ondemand loop serio_raw psmouse k8temp hwmon sr_mod cdrom Pid: 23161, comm: cat Not tainted (2.6.24-rc2-8c0863403f109a43d7000b4646da4818220d501f #4) EIP: 0060:[] EFLAGS: 00210097 CPU: 1 EIP is at strnlen+0x6/0x18 EAX: 6b6b6b6b EBX: 6b6b6b6b ECX: 6b6b6b6b EDX: fffe ESI: c128fa3b EDI: f380bf34 EBP: ESP: f380be44 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 Process cat (pid: 23161, ti=f380b000 task=f38f2570 task.ti=f380b000) Stack: c10ac4f0 0278 c12ce000 f43cd2a8 0163 7da86067 0400 c128fa20 00896b18 f38325a8 c128fe20 c11f291e 0400 f75be300 c128fa20 f769c9a0 c10ac779 f380bf34 f7bfee70 c1018e6b f380bf34 Call Trace: [] vsnprintf+0x2ad/0x49b [] vscnprintf+0x14/0x1f [] vprintk+0xc5/0x2f9 [] handle_fasteoi_irq+0x0/0xab [] do_IRQ+0x9f/0xb7 [] preempt_schedule_irq+0x3f/0x5b [] need_resched+0x1f/0x21 [] printk+0x1b/0x1f [] de_put+0x3d/0x50 [] proc_delete_inode+0x38/0x41 [] proc_delete_inode+0x0/0x41 [] generic_delete_inode+0x5e/0xc6 [] iput+0x60/0x62 [] d_kill+0x2d/0x46 [] dput+0xdc/0xe4 [] __fput+0xb0/0xcd [] filp_close+0x48/0x4f [] sys_close+0x67/0xa5 [] sysenter_past_esp+0x5f/0x85 === Code: c9 74 0c f2 ae 74 05 bf 01 00 00 00 4f 89 fa 5f 89 d0 c3 85 c9 57 89 c7 89 d0 74 05 f2 ae 75 01 4f 89 f8 5f c3 89 c1 89 c8 eb 06 <80> 38 00 74 07 40 4a 83 fa ff 75 f4 29 c8 c3 90 90 90 57 83 c9 EIP: [] strnlen+0x6/0x18 SS:ESP 0068:f380be44 Also, remove broken usage of ->deleted from reiserfs: if sget() succeeds, module is already pinned and remove_proc_entry() can't happen => nobody can mark PDE deleted. Dummy proc root in netns code is not marked with refcount 1. AFAICS, we never get it, it's just for proper /proc/net removal. I double checked CLONE_NETNS continues to work. Patch survives many hours of modprobe/rmmod/cat loops without new bugs which can be attributed to refcounting. Signed-off-by: Alexey Dobriyan <[EMAIL PROTECTED]> Cc: "Eric W. Biederman" <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- fs/proc/generic.c |9 ++--- fs/proc/inode.c |9 ++--- fs/proc/root.c |1 + fs/reiserfs/procfs.c|6 -- include/linux/proc_fs.h |1 - 5 files changed, 5 insertions(+), 21 deletions(-) diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 5fccfe2..8d49838 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -595,6 +595,7 @@ static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent,
mm: fix XIP file writes
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=369b8f5a70402d9fe77006cd0044c8a3fcd08430 Commit: 369b8f5a70402d9fe77006cd0044c8a3fcd08430 Parent: 4670df831cb479ba57dd0fa0b8a9eb88cc7129be Author: Nick Piggin <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:25 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 mm: fix XIP file writes Writing to XIP files at a non-page-aligned offset results in data corruption because the writes were always sent to the start of the page. Signed-off-by: Nick Piggin <[EMAIL PROTECTED]> Cc: Christian Borntraeger <[EMAIL PROTECTED]> Acked-by: Carsten Otte <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- mm/filemap_xip.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c index 32132f3..e233fff 100644 --- a/mm/filemap_xip.c +++ b/mm/filemap_xip.c @@ -314,7 +314,7 @@ __xip_file_write(struct file *filp, const char __user *buf, fault_in_pages_readable(buf, bytes); kaddr = kmap_atomic(page, KM_USER0); copied = bytes - - __copy_from_user_inatomic_nocache(kaddr, buf, bytes); + __copy_from_user_inatomic_nocache(kaddr + offset, buf, bytes); kunmap_atomic(kaddr, KM_USER0); flush_dcache_page(page); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
gpio_cs5535: disable AUX on output
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4670df831cb479ba57dd0fa0b8a9eb88cc7129be Commit: 4670df831cb479ba57dd0fa0b8a9eb88cc7129be Parent: f1dad166e88a5ddca0acf8f11dea0e2bd92d8bf3 Author: Ben Gardner <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:24 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 gpio_cs5535: disable AUX on output The AMD CS5535/CS5536 GPIO has two alternate output modes: AUX-1 and AUX-2. When either AUX is enabled, the cs5535_gpio driver cannot control the output. Some BIOS code for the Geode processor enables AUX-1 for GPIO-1, which configures it as the PC BEEP output. This patch will disable AUX-1 and AUX-2 when the user enables output. Signed-of-by: Ben Gardner <[EMAIL PROTECTED]> Cc: Richard Knutsson <[EMAIL PROTECTED]> Cc: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/char/cs5535_gpio.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/char/cs5535_gpio.c b/drivers/char/cs5535_gpio.c index fe6d240..c2d23ca 100644 --- a/drivers/char/cs5535_gpio.c +++ b/drivers/char/cs5535_gpio.c @@ -104,6 +104,11 @@ static ssize_t cs5535_gpio_write(struct file *file, const char __user *data, for (j = 0; j < ARRAY_SIZE(rm); j++) { if (c == rm[j].on) { outl(m1, base + rm[j].wr_offset); + /* If enabling output, turn off AUX 1 and AUX 2 */ + if (c == 'O') { + outl(m0, base + 0x10); + outl(m0, base + 0x14); + } break; } else if (c == rm[j].off) { outl(m0, base + rm[j].wr_offset); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
spi: spi_bfin: relocate spin/waits
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3f479a65b3f49ee4f058a965e6e33d97ee467b68 Commit: 3f479a65b3f49ee4f058a965e6e33d97ee467b68 Parent: cc487e732089360727e60f9fdbe3ff6cc4ca3155 Author: Sonic Zhang <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:18 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:19 2007 -0800 spi: spi_bfin: relocate spin/waits Move spin/waits to more correct locations in bfin SPI driver. Signed-off-by: Sonic Zhang <[EMAIL PROTECTED]> Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 84 - 1 files changed, 52 insertions(+), 32 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index c99a2af..c7cfd95 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -276,22 +276,26 @@ static void u8_writer(struct driver_data *drv_data) dev_dbg(&drv_data->pdev->dev, "cr8-s is 0x%x\n", read_STAT()); + /* poll for SPI completion before start */ + while (!(read_STAT() & BIT_STAT_SPIF)) + continue; + while (drv_data->tx < drv_data->tx_end) { write_TDBR(*(u8 *) (drv_data->tx)); while (read_STAT() & BIT_STAT_TXS) continue; ++drv_data->tx; } - - /* poll for SPI completion before returning */ - while (!(read_STAT() & BIT_STAT_SPIF)) - continue; } static void u8_cs_chg_writer(struct driver_data *drv_data) { struct chip_data *chip = drv_data->cur_chip; + /* poll for SPI completion before start */ + while (!(read_STAT() & BIT_STAT_SPIF)) + continue; + while (drv_data->tx < drv_data->tx_end) { cs_active(chip); @@ -304,10 +308,6 @@ static void u8_cs_chg_writer(struct driver_data *drv_data) udelay(chip->cs_chg_udelay); ++drv_data->tx; } - - /* poll for SPI completion before returning */ - while (!(read_STAT() & BIT_STAT_SPIF)) - continue; } static void u8_reader(struct driver_data *drv_data) @@ -315,6 +315,10 @@ static void u8_reader(struct driver_data *drv_data) dev_dbg(&drv_data->pdev->dev, "cr-8 is 0x%x\n", read_STAT()); + /* poll for SPI completion before start */ + while (!(read_STAT() & BIT_STAT_SPIF)) + continue; + /* clear TDBR buffer before read(else it will be shifted out) */ write_TDBR(0x); @@ -337,6 +341,10 @@ static void u8_cs_chg_reader(struct driver_data *drv_data) { struct chip_data *chip = drv_data->cur_chip; + /* poll for SPI completion before start */ + while (!(read_STAT() & BIT_STAT_SPIF)) + continue; + /* clear TDBR buffer before read(else it will be shifted out) */ write_TDBR(0x); @@ -365,6 +373,10 @@ static void u8_cs_chg_reader(struct driver_data *drv_data) static void u8_duplex(struct driver_data *drv_data) { + /* poll for SPI completion before start */ + while (!(read_STAT() & BIT_STAT_SPIF)) + continue; + /* in duplex mode, clk is triggered by writing of TDBR */ while (drv_data->rx < drv_data->rx_end) { write_TDBR(*(u8 *) (drv_data->tx)); @@ -376,16 +388,16 @@ static void u8_duplex(struct driver_data *drv_data) ++drv_data->rx; ++drv_data->tx; } - - /* poll for SPI completion before returning */ - while (!(read_STAT() & BIT_STAT_SPIF)) - continue; } static void u8_cs_chg_duplex(struct driver_data *drv_data) { struct chip_data *chip = drv_data->cur_chip; + /* poll for SPI completion before start */ + while (!(read_STAT() & BIT_STAT_SPIF)) + continue; + while (drv_data->rx < drv_data->rx_end) { cs_active(chip); @@ -402,10 +414,6 @@ static void u8_cs_chg_duplex(struct driver_data *drv_data) ++drv_data->rx; ++drv_data->tx; } - - /* poll for SPI completion before returning */ - while (!(read_STAT() & BIT_STAT_SPIF)) - continue; } static void u16_writer(struct driver_data *drv_data) @@ -413,22 +421,26 @@ static void u16_writer(struct driver_data *drv_data) dev_dbg(&drv_data->pdev->dev, "cr16 is 0x%x\n", read_STAT()); + /* poll for SPI completion before start */ + while (!(read_STAT() & BIT_STAT_SPIF)) + continue; + while (drv_data->tx < drv_data->tx_end) { write_TDBR(*(u16 *) (drv_data->tx)); while ((read_
SPI: use mutex not semaphore
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=068f4070868c801c7d7aa1ae1193c1c854193545 Commit: 068f4070868c801c7d7aa1ae1193c1c854193545 Parent: f8fcc93319faa09272185af100fb24e71b02ab03 Author: David Brownell <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:09 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:18 2007 -0800 SPI: use mutex not semaphore Make spi_write_then_read() use a mutex not a binary semaphore. Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index b31f443..6ca07c9 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -589,7 +589,7 @@ int spi_write_then_read(struct spi_device *spi, const u8 *txbuf, unsigned n_tx, u8 *rxbuf, unsigned n_rx) { - static DECLARE_MUTEX(lock); + static DEFINE_MUTEX(lock); int status; struct spi_message message; @@ -615,7 +615,7 @@ int spi_write_then_read(struct spi_device *spi, } /* ... unless someone else is using the pre-allocated buffer */ - if (down_trylock(&lock)) { + if (!mutex_trylock(&lock)) { local_buf = kmalloc(SPI_BUFSIZ, GFP_KERNEL); if (!local_buf) return -ENOMEM; @@ -634,7 +634,7 @@ int spi_write_then_read(struct spi_device *spi, } if (x[0].tx_buf == buf) - up(&lock); + mutex_unlock(&lock); else kfree(local_buf); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Add EXPORT_SYMBOL(ksize);
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f8fcc93319faa09272185af100fb24e71b02ab03 Commit: f8fcc93319faa09272185af100fb24e71b02ab03 Parent: 4b01a0b1613beeb01e12c78feb69e98f0da0a69a Author: Tetsuo Handa <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:08 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:18 2007 -0800 Add EXPORT_SYMBOL(ksize); mm/slub.c exports ksize(), but mm/slob.c and mm/slab.c don't. It's used by binfmt_flat, which can be built as a module. Signed-off-by: Tetsuo Handa <[EMAIL PROTECTED]> Cc: Christoph Lameter <[EMAIL PROTECTED]> Cc: Matt Mackall <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- mm/slab.c |1 + mm/slob.c |1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index 202465a..2e338a5 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -4475,3 +4475,4 @@ size_t ksize(const void *objp) return obj_size(virt_to_cache(objp)); } +EXPORT_SYMBOL(ksize); diff --git a/mm/slob.c b/mm/slob.c index 08a9bd9..ee2ef8a 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -495,6 +495,7 @@ size_t ksize(const void *block) else return sp->page.private; } +EXPORT_SYMBOL(ksize); struct kmem_cache { unsigned int size, align; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
mm/backing-dev.c: fix percpu_counter_destroy call bug in bdi_init
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4b01a0b1613beeb01e12c78feb69e98f0da0a69a Commit: 4b01a0b1613beeb01e12c78feb69e98f0da0a69a Parent: 0c664f974269bb4c3d38ba900c91a9a5d4cee5b1 Author: Denis Cheng <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:07 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:18 2007 -0800 mm/backing-dev.c: fix percpu_counter_destroy call bug in bdi_init this call should use the array index j, not i. But with this approach, just one int i is enough, int j is not needed. Signed-off-by: Denis Cheng <[EMAIL PROTECTED]> Cc: Peter Zijlstra <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- mm/backing-dev.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/backing-dev.c b/mm/backing-dev.c index b0ceb29..e8644b1 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -7,7 +7,7 @@ int bdi_init(struct backing_dev_info *bdi) { - int i, j; + int i; int err; for (i = 0; i < NR_BDI_STAT_ITEMS; i++) { @@ -21,7 +21,7 @@ int bdi_init(struct backing_dev_info *bdi) if (err) { err: - for (j = 0; j < i; j++) + while (i--) percpu_counter_destroy(&bdi->bdi_stat[i]); } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[IRDA]: Move ircomm_tty_line_info() under #ifdef CONFIG_PROC_FS
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=92b05e13f16a41405c4f6c953c47b6c4bcf82d30 Commit: 92b05e13f16a41405c4f6c953c47b6c4bcf82d30 Parent: 78f150bf94f5430fe8c34edeafe8d01706f38148 Author: Pavel Emelyanov <[EMAIL PROTECTED]> AuthorDate: Wed Dec 5 02:18:48 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:28 2007 -0800 [IRDA]: Move ircomm_tty_line_info() under #ifdef CONFIG_PROC_FS The function in question is called only from ircomm_tty_read_proc, which is under this option. Move this helper to the same place. Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- net/irda/ircomm/ircomm_tty.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 1120b15..be627e1 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c @@ -1245,6 +1245,7 @@ static void ircomm_tty_flow_indication(void *instance, void *sap, self->flow = cmd; } +#ifdef CONFIG_PROC_FS static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf) { int ret=0; @@ -1354,7 +1355,6 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf) * * */ -#ifdef CONFIG_PROC_FS static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *unused) { - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SPARC64]: Add missing "space"
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=519c4d2debebc82b201b80fdc48643e19233eb97 Commit: 519c4d2debebc82b201b80fdc48643e19233eb97 Parent: 55c45a3ad8e5f9488426332b7baca0261ec2f816 Author: Joe Perches <[EMAIL PROTECTED]> AuthorDate: Mon Nov 19 23:43:00 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:58 2007 -0800 [SPARC64]: Add missing "space" Signed-off-by: Joe Perches <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- arch/sparc64/kernel/smp.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index 7cd8d94..894b506 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c @@ -236,8 +236,9 @@ void smp_synchronize_tick_client(void) t[i].rt, t[i].master, t[i].diff, t[i].lat); #endif - printk(KERN_INFO "CPU %d: synchronized TICK with master CPU (last diff %ld cycles," - "maxerr %lu cycles)\n", smp_processor_id(), delta, rt); + printk(KERN_INFO "CPU %d: synchronized TICK with master CPU " + "(last diff %ld cycles, maxerr %lu cycles)\n", + smp_processor_id(), delta, rt); } static void smp_start_sync_tick_client(int cpu); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SPARC64]: Add missing pci_dev_put
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=55c45a3ad8e5f9488426332b7baca0261ec2f816 Commit: 55c45a3ad8e5f9488426332b7baca0261ec2f816 Parent: 874a5f87f53f80b798140b07fcf81f8d3718b3cc Author: Julia Lawall <[EMAIL PROTECTED]> AuthorDate: Mon Nov 19 22:50:01 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:57 2007 -0800 [SPARC64]: Add missing pci_dev_put There should be a pci_dev_put when breaking out of a loop that iterates over calls to pci_get_device and similar functions. Signed-off-by: Julia Lawall <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- arch/sparc64/kernel/isa.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/sparc64/kernel/isa.c b/arch/sparc64/kernel/isa.c index 0f19dce..b5f7b35 100644 --- a/arch/sparc64/kernel/isa.c +++ b/arch/sparc64/kernel/isa.c @@ -155,6 +155,7 @@ void __init isa_init(void) isa_br = kzalloc(sizeof(*isa_br), GFP_KERNEL); if (!isa_br) { printk(KERN_DEBUG "isa: cannot allocate sparc_isa_bridge"); + pci_dev_put(pdev); return; } @@ -168,6 +169,7 @@ void __init isa_init(void) printk(KERN_DEBUG "isa: device registration error for %s!\n", dp->path_component_name); kfree(isa_br); + pci_dev_put(pdev); return; } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SYSCTL_CHECK]: Fix typo in KERN_SPARC_SCONS_PWROFF entry string.
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=874a5f87f53f80b798140b07fcf81f8d3718b3cc Commit: 874a5f87f53f80b798140b07fcf81f8d3718b3cc Parent: 6fab2600f9eae779ac49416e651a7f160004c9ae Author: David S. Miller <[EMAIL PROTECTED]> AuthorDate: Mon Nov 19 21:35:42 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:56 2007 -0800 [SYSCTL_CHECK]: Fix typo in KERN_SPARC_SCONS_PWROFF entry string. Based upon a report by Mikael Pettersson. Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- kernel/sysctl_check.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/sysctl_check.c b/kernel/sysctl_check.c index 6972f26..bed939f 100644 --- a/kernel/sysctl_check.c +++ b/kernel/sysctl_check.c @@ -96,7 +96,7 @@ static struct trans_ctl_table trans_kern_table[] = { { KERN_PTY, "pty", trans_pty_table }, { KERN_NGROUPS_MAX, "ngroups_max" }, - { KERN_SPARC_SCONS_PWROFF, "scons_poweroff" }, + { KERN_SPARC_SCONS_PWROFF, "scons-poweroff" }, { KERN_HZ_TIMER,"hz_timer" }, { KERN_UNKNOWN_NMI_PANIC, "unknown_nmi_panic" }, { KERN_BOOTLOADER_TYPE, "bootloader_type" }, - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[SPARC64]: Missing mdesc_release() in ldc_init().
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6fab2600f9eae779ac49416e651a7f160004c9ae Commit: 6fab2600f9eae779ac49416e651a7f160004c9ae Parent: e3c0ac04f980750a368f7cd5f1b8d1d2cdc1f735 Author: David S. Miller <[EMAIL PROTECTED]> AuthorDate: Wed Nov 14 20:17:24 2007 -0800 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 05:37:55 2007 -0800 [SPARC64]: Missing mdesc_release() in ldc_init(). Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- arch/sparc64/kernel/ldc.c | 15 ++- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/sparc64/kernel/ldc.c b/arch/sparc64/kernel/ldc.c index 217478a..63969f6 100644 --- a/arch/sparc64/kernel/ldc.c +++ b/arch/sparc64/kernel/ldc.c @@ -2338,6 +2338,7 @@ static int __init ldc_init(void) unsigned long major, minor; struct mdesc_handle *hp; const u64 *v; + int err; u64 mp; hp = mdesc_grab(); @@ -2345,29 +2346,33 @@ static int __init ldc_init(void) return -ENODEV; mp = mdesc_node_by_name(hp, MDESC_NODE_NULL, "platform"); + err = -ENODEV; if (mp == MDESC_NODE_NULL) - return -ENODEV; + goto out; v = mdesc_get_property(hp, mp, "domaining-enabled", NULL); if (!v) - return -ENODEV; + goto out; major = 1; minor = 0; if (sun4v_hvapi_register(HV_GRP_LDOM, major, &minor)) { printk(KERN_INFO PFX "Could not register LDOM hvapi.\n"); - return -ENODEV; + goto out; } printk(KERN_INFO "%s", version); if (!*v) { printk(KERN_INFO PFX "Domaining disabled.\n"); - return -ENODEV; + goto out; } ldom_domaining_enabled = 1; + err = 0; - return 0; +out: + mdesc_release(hp); + return err; } core_initcall(ldc_init); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
jbd: Fix assertion failure in fs/jbd/checkpoint.c
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d4beaf4ab5f89496f2bcf67db62ad95d99bfeff6 Commit: d4beaf4ab5f89496f2bcf67db62ad95d99bfeff6 Parent: 369b8f5a70402d9fe77006cd0044c8a3fcd08430 Author: Jan Kara <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:27 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 jbd: Fix assertion failure in fs/jbd/checkpoint.c Before we start committing a transaction, we call __journal_clean_checkpoint_list() to cleanup transaction's written-back buffers. If this call happens to remove all of them (and there were already some buffers), __journal_remove_checkpoint() will decide to free the transaction because it isn't (yet) a committing transaction and soon we fail some assertion - the transaction really isn't ready to be freed :). We change the check in __journal_remove_checkpoint() to free only a transaction in T_FINISHED state. The locking there is subtle though (as everywhere in JBD ;(). We use j_list_lock to protect the check and a subsequent call to __journal_drop_transaction() and do the same in the end of journal_commit_transaction() which is the only place where a transaction can get to T_FINISHED state. Probably I'm too paranoid here and such locking is not really necessary - checkpoint lists are processed only from log_do_checkpoint() where a transaction must be already committed to be processed or from __journal_clean_checkpoint_list() where kjournald itself calls it and thus transaction cannot change state either. Better be safe if something changes in future... Signed-off-by: Jan Kara <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- fs/jbd/checkpoint.c | 12 ++-- fs/jbd/commit.c |8 include/linux/jbd.h |2 ++ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c index 47552d4..0f69c41 100644 --- a/fs/jbd/checkpoint.c +++ b/fs/jbd/checkpoint.c @@ -602,15 +602,15 @@ int __journal_remove_checkpoint(struct journal_head *jh) /* * There is one special case to worry about: if we have just pulled the -* buffer off a committing transaction's forget list, then even if the -* checkpoint list is empty, the transaction obviously cannot be -* dropped! +* buffer off a running or committing transaction's checkpoing list, +* then even if the checkpoint list is empty, the transaction obviously +* cannot be dropped! * -* The locking here around j_committing_transaction is a bit sleazy. +* The locking here around t_state is a bit sleazy. * See the comment at the end of journal_commit_transaction(). */ - if (transaction == journal->j_committing_transaction) { - JBUFFER_TRACE(jh, "belongs to committing transaction"); + if (transaction->t_state != T_FINISHED) { + JBUFFER_TRACE(jh, "belongs to running/committing transaction"); goto out; } diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index 8f1f2aa..610264b 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c @@ -858,10 +858,10 @@ restart_loop: } spin_unlock(&journal->j_list_lock); /* -* This is a bit sleazy. We borrow j_list_lock to protect -* journal->j_committing_transaction in __journal_remove_checkpoint. -* Really, __journal_remove_checkpoint should be using j_state_lock but -* it's a bit hassle to hold that across __journal_remove_checkpoint +* This is a bit sleazy. We use j_list_lock to protect transition +* of a transaction into T_FINISHED state and calling +* __journal_drop_transaction(). Otherwise we could race with +* other checkpointing code processing the transaction... */ spin_lock(&journal->j_state_lock); spin_lock(&journal->j_list_lock); diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 16e7ed8..d9ecd13 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h @@ -439,6 +439,8 @@ struct transaction_s /* * Transaction's current state * [no locking - only kjournald alters this] +* [j_list_lock] guards transition of a transaction into T_FINISHED +* state and subsequent call of __journal_drop_transaction() * FIXME: needs barriers * KLUDGE: [use j_state_lock] */ - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
spi: spi_bfin, rearrange portmux calls
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=12e17c4267a5b2a5ba77bd53a62388be641534b8 Commit: 12e17c4267a5b2a5ba77bd53a62388be641534b8 Parent: 7c4ef09449ca382da2e39b93ca9d03e3dbd5c17c Author: Sonic Zhang <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:16 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:19 2007 -0800 spi: spi_bfin, rearrange portmux calls Move pin muxing to setup and cleanup methods. Signed-off-by: Sonic Zhang <[EMAIL PROTECTED]> Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 53 +++- 1 files changed, 28 insertions(+), 25 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 045d3ec..4496ed1 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -136,7 +136,6 @@ struct chip_data { u16 flag; u8 chip_select_num; - u8 chip_select_requested; u8 n_bytes; u8 width; /* 0 or 1 */ u8 enable_dma; @@ -216,19 +215,7 @@ static int restore_state(struct driver_data *drv_data) { struct chip_data *chip = drv_data->cur_chip; int ret = 0; - u16 ssel[3][MAX_SPI_SSEL] = { - {P_SPI0_SSEL1, P_SPI0_SSEL2, P_SPI0_SSEL3, - P_SPI0_SSEL4, P_SPI0_SSEL5, - P_SPI0_SSEL6, P_SPI0_SSEL7}, - - {P_SPI1_SSEL1, P_SPI1_SSEL2, P_SPI1_SSEL3, - P_SPI1_SSEL4, P_SPI1_SSEL5, - P_SPI1_SSEL6, P_SPI1_SSEL7}, - - {P_SPI2_SSEL1, P_SPI2_SSEL2, P_SPI2_SSEL3, - P_SPI2_SSEL4, P_SPI2_SSEL5, - P_SPI2_SSEL6, P_SPI2_SSEL7}, - }; + /* Clear status and disable clock */ write_STAT(BIT_STAT_CLR); bfin_spi_disable(drv_data); @@ -239,17 +226,6 @@ static int restore_state(struct driver_data *drv_data) write_BAUD(chip->baud); cs_active(chip); - if (!chip->chip_select_requested) { - int i = chip->chip_select_num; - - dev_dbg(&drv_data->pdev->dev, "chip select number is %d\n", i); - if ((i > 0) && (i <= MAX_SPI_SSEL)) - ret = peripheral_request( - ssel[drv_data->master->bus_num][i-1], DRV_NAME); - - chip->chip_select_requested = 1; - } - if (ret) dev_dbg(&drv_data->pdev->dev, ": request chip select number %d failed\n", @@ -983,6 +959,22 @@ static int transfer(struct spi_device *spi, struct spi_message *msg) return 0; } +#define MAX_SPI_SSEL 7 + +static u16 ssel[3][MAX_SPI_SSEL] = { + {P_SPI0_SSEL1, P_SPI0_SSEL2, P_SPI0_SSEL3, + P_SPI0_SSEL4, P_SPI0_SSEL5, + P_SPI0_SSEL6, P_SPI0_SSEL7}, + + {P_SPI1_SSEL1, P_SPI1_SSEL2, P_SPI1_SSEL3, + P_SPI1_SSEL4, P_SPI1_SSEL5, + P_SPI1_SSEL6, P_SPI1_SSEL7}, + + {P_SPI2_SSEL1, P_SPI2_SSEL2, P_SPI2_SSEL3, + P_SPI2_SSEL4, P_SPI2_SSEL5, + P_SPI2_SSEL6, P_SPI2_SSEL7}, +}; + /* first setup for new devices */ static int setup(struct spi_device *spi) { @@ -1113,6 +1105,12 @@ static int setup(struct spi_device *spi) spi_set_ctldata(spi, chip); + dev_dbg(&spi->dev, "chip select number is %d\n", chip->chip_select_num); + if ((chip->chip_select_num > 0) + && (chip->chip_select_num <= spi->master->num_chipselect)) + peripheral_request(ssel[spi->master->bus_num] + [chip->chip_select_num-1], DRV_NAME); + return 0; } @@ -1124,6 +1122,11 @@ static void cleanup(struct spi_device *spi) { struct chip_data *chip = spi_get_ctldata(spi); + if ((chip->chip_select_num > 0) + && (chip->chip_select_num <= spi->master->num_chipselect)) + peripheral_free(ssel[spi->master->bus_num] + [chip->chip_select_num-1]); + kfree(chip); } - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
spi: spi_bfin uses platform device resources
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a32c691d7cf5c37af753255ef4843b18a31935b9 Commit: a32c691d7cf5c37af753255ef4843b18a31935b9 Parent: 2ed355165ff4ec834a75770f2a15dc87f5e06088 Author: Bryan Wu <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:15 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:19 2007 -0800 spi: spi_bfin uses platform device resources Update spi driver to support multi-ports by using platform resources; tested on STAMP537+SPI_MMC, other boards need more testing. Plus other minor updates. Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 124 ++--- 1 files changed, 83 insertions(+), 41 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 8e4ea89..a8311a8 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -13,6 +13,8 @@ * March 10, 2006 bfin5xx_spi.c Created. (Luke Yang) * August 7, 2006 added full duplex mode (Axel Weiss & Luke Yang) * July 17, 2007 add support for BF54x SPI0 controller (Bryan Wu) + * July 30, 2007 add platfrom_resource interface to support multi-port + * SPI controller (Bryan Wu) * * Copyright 2004-2007 Analog Devices Inc. * @@ -50,18 +52,25 @@ #include #include -MODULE_AUTHOR("Bryan Wu, Luke Yang"); -MODULE_DESCRIPTION("Blackfin BF5xx SPI Contoller Driver"); +#define DRV_NAME "bfin-spi" +#define DRV_AUTHOR "Bryan Wu, Luke Yang" +#define DRV_DESC "Blackfin BF5xx on-chip SPI Contoller Driver" +#define DRV_VERSION"1.0" + +MODULE_AUTHOR(DRV_AUTHOR); +MODULE_DESCRIPTION(DRV_DESC); MODULE_LICENSE("GPL"); -#define DRV_NAME "bfin-spi-master" #define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0) +static u32 spi_dma_ch; +static u32 spi_regs_base; + #define DEFINE_SPI_REG(reg, off) \ static inline u16 read_##reg(void) \ - { return bfin_read16(SPI0_REGBASE + off); } \ + { return bfin_read16(spi_regs_base + off); } \ static inline void write_##reg(u16 v) \ - {bfin_write16(SPI0_REGBASE + off, v); } + {bfin_write16(spi_regs_base + off, v); } DEFINE_SPI_REG(CTRL, 0x00) DEFINE_SPI_REG(FLAG, 0x04) @@ -573,10 +582,10 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id) struct chip_data *chip = drv_data->cur_chip; dev_dbg(&drv_data->pdev->dev, "in dma_irq_handler\n"); - clear_dma_irqstat(CH_SPI); + clear_dma_irqstat(spi_dma_ch); /* Wait for DMA to complete */ - while (get_dma_curr_irqstat(CH_SPI) & DMA_RUN) + while (get_dma_curr_irqstat(spi_dma_ch) & DMA_RUN) continue; /* @@ -586,12 +595,12 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id) * register until it goes low for 2 successive reads */ if (drv_data->tx != NULL) { - while ((bfin_read_SPI_STAT() & TXS) || - (bfin_read_SPI_STAT() & TXS)) + while ((read_STAT() & TXS) || + (read_STAT() & TXS)) continue; } - while (!(bfin_read_SPI_STAT() & SPIF)) + while (!(read_STAT() & SPIF)) continue; bfin_spi_disable(drv_data); @@ -610,8 +619,8 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id) /* free the irq handler before next transfer */ dev_dbg(&drv_data->pdev->dev, "disable dma channel irq%d\n", - CH_SPI); - dma_disable_irq(CH_SPI); + spi_dma_ch); + dma_disable_irq(spi_dma_ch); return IRQ_HANDLED; } @@ -726,19 +735,19 @@ static void pump_transfers(unsigned long data) if (drv_data->cur_chip->enable_dma && drv_data->len > 6) { write_STAT(BIT_STAT_CLR); - disable_dma(CH_SPI); - clear_dma_irqstat(CH_SPI); + disable_dma(spi_dma_ch); + clear_dma_irqstat(spi_dma_ch); bfin_spi_disable(drv_data); /* config dma channel */ dev_dbg(&drv_data->pdev->dev, "doing dma transfer\n"); if (width == CFG_SPI_WORDSIZE16) { - set_dma_x_count(CH_SPI, drv_data->len); - set_dma_x_modify(CH_SPI, 2); + set_dma_x_count(spi_dma_ch, drv_data->len); + set_dma_x_modify(spi_dma_ch, 2); dma_width = WDSIZE_16; } else { - set_dma_x_count(CH_SPI, drv_data->len); - set_dma_x_modify(CH_SPI, 1); + set_dma_x_count(spi_dma_ch, drv_data->len); + set_dm
spi: at25 driver is for EEPROM not FLASH
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3f86f14c0fc9fdb0984e64209df2f47895a07151 Commit: 3f86f14c0fc9fdb0984e64209df2f47895a07151 Parent: 068f4070868c801c7d7aa1ae1193c1c854193545 Author: David Brownell <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:10 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:18 2007 -0800 spi: at25 driver is for EEPROM not FLASH Add comment to at25 driver that it's for EEPROM chips, not FLASH chips ... the AT25 series has both types of chip, and sometimes they're even pin-compatible. The command sets are different, as is the treatment of erasure. (FLASH needs explicit erasure, but with EEPROM it's implicit.) Note that all vendors seem to have this same confusion in their *25* series SPI memory parts. Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/at25.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/spi/at25.c b/drivers/spi/at25.c index e007833..290dbe9 100644 --- a/drivers/spi/at25.c +++ b/drivers/spi/at25.c @@ -21,6 +21,13 @@ #include +/* + * NOTE: this is an *EEPROM* driver. The vagaries of product naming + * mean that some AT25 products are EEPROMs, and others are FLASH. + * Handle FLASH chips with the drivers/mtd/devices/m25p80.c driver, + * not this one! + */ + struct at25_data { struct spi_device *spi; struct mutexlock; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Avoid potential NULL dereference in unregister_sysctl_table
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f1dad166e88a5ddca0acf8f11dea0e2bd92d8bf3 Commit: f1dad166e88a5ddca0acf8f11dea0e2bd92d8bf3 Parent: 092e1fdaf35126475aef0dc70f4a2ce4f2f43052 Author: Pavel Emelyanov <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:24 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 Avoid potential NULL dereference in unregister_sysctl_table register_sysctl_table() can return NULL sometimes, e.g. when kmalloc() returns NULL or when sysctl check fails. I've also noticed, that many (most?) code in the kernel doesn't check for the return value from register_sysctl_table() and later simply calls the unregister_sysctl_table() with potentially NULL argument. This is unlikely on a common kernel configuration, but in case we're dealing with modules and/or fault-injection support, there's a slight possibility of an OOPS. Changing all the users to check for return code from the registering does not look like a good solution - there are too many code doing this and failure in sysctl tables registration is not a good reason to abort module loading (in most of the cases). So I think, that we can just have this check in unregister_sysctl_table just to avoid accidental OOPS-es (actually, the unregister_sysctl_table() did exactly this, before the start_unregistering() appeared). Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]> Cc: "Eric W. Biederman" <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- kernel/sysctl.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 0deed82..8ac5171 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1588,6 +1588,10 @@ struct ctl_table_header *register_sysctl_table(struct ctl_table * table) void unregister_sysctl_table(struct ctl_table_header * header) { might_sleep(); + + if (header == NULL) + return; + spin_lock(&sysctl_lock); start_unregistering(header); spin_unlock(&sysctl_lock); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
spi: spi_bfin: handle multiple spi_masters
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bb90eb00b6c28c8be5a69c6b58d5a6924f6f2ad7 Commit: bb90eb00b6c28c8be5a69c6b58d5a6924f6f2ad7 Parent: 3f479a65b3f49ee4f058a965e6e33d97ee467b68 Author: Bryan Wu <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:18 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:19 2007 -0800 spi: spi_bfin: handle multiple spi_masters Move global SPI regs_base and dma_ch to struct driver_data. Test on BF54x SPI Flash with 2 spi_master devices enabled. Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 371 +++-- 1 files changed, 189 insertions(+), 182 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index c7cfd95..c4c4905 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -61,31 +61,14 @@ MODULE_AUTHOR(DRV_AUTHOR); MODULE_DESCRIPTION(DRV_DESC); MODULE_LICENSE("GPL"); -#define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0) +#define IS_DMA_ALIGNED(x) (((u32)(x)&0x07) == 0) -static u32 spi_dma_ch; -static u32 spi_regs_base; - -#define DEFINE_SPI_REG(reg, off) \ -static inline u16 read_##reg(void) \ - { return bfin_read16(spi_regs_base + off); } \ -static inline void write_##reg(u16 v) \ - {bfin_write16(spi_regs_base + off, v); } - -DEFINE_SPI_REG(CTRL, 0x00) -DEFINE_SPI_REG(FLAG, 0x04) -DEFINE_SPI_REG(STAT, 0x08) -DEFINE_SPI_REG(TDBR, 0x0C) -DEFINE_SPI_REG(RDBR, 0x10) -DEFINE_SPI_REG(BAUD, 0x14) -DEFINE_SPI_REG(SHAW, 0x18) -#define START_STATE ((void*)0) -#define RUNNING_STATE ((void*)1) -#define DONE_STATE ((void*)2) -#define ERROR_STATE ((void*)-1) -#define QUEUE_RUNNING 0 -#define QUEUE_STOPPED 1 -int dma_requested; +#define START_STATE((void *)0) +#define RUNNING_STATE ((void *)1) +#define DONE_STATE ((void *)2) +#define ERROR_STATE((void *)-1) +#define QUEUE_RUNNING 0 +#define QUEUE_STOPPED 1 struct driver_data { /* Driver model hookup */ @@ -94,6 +77,9 @@ struct driver_data { /* SPI framework hookup */ struct spi_master *master; + /* Regs base of SPI controller */ + u32 regs_base; + /* BFIN hookup */ struct bfin5xx_spi_master *master_info; @@ -118,9 +104,14 @@ struct driver_data { void *tx_end; void *rx; void *rx_end; + + /* DMA stuffs */ + int dma_channel; int dma_mapped; + int dma_requested; dma_addr_t rx_dma; dma_addr_t tx_dma; + size_t rx_map_len; size_t tx_map_len; u8 n_bytes; @@ -147,20 +138,34 @@ struct chip_data { void (*duplex) (struct driver_data *); }; +#define DEFINE_SPI_REG(reg, off) \ +static inline u16 read_##reg(struct driver_data *drv_data) \ + { return bfin_read16(drv_data->regs_base + off); } \ +static inline void write_##reg(struct driver_data *drv_data, u16 v) \ + { bfin_write16(drv_data->regs_base + off, v); } + +DEFINE_SPI_REG(CTRL, 0x00) +DEFINE_SPI_REG(FLAG, 0x04) +DEFINE_SPI_REG(STAT, 0x08) +DEFINE_SPI_REG(TDBR, 0x0C) +DEFINE_SPI_REG(RDBR, 0x10) +DEFINE_SPI_REG(BAUD, 0x14) +DEFINE_SPI_REG(SHAW, 0x18) + static void bfin_spi_enable(struct driver_data *drv_data) { u16 cr; - cr = read_CTRL(); - write_CTRL(cr | BIT_CTL_ENABLE); + cr = read_CTRL(drv_data); + write_CTRL(drv_data, (cr | BIT_CTL_ENABLE)); } static void bfin_spi_disable(struct driver_data *drv_data) { u16 cr; - cr = read_CTRL(); - write_CTRL(cr & (~BIT_CTL_ENABLE)); + cr = read_CTRL(drv_data); + write_CTRL(drv_data, (cr & (~BIT_CTL_ENABLE))); } /* Caculate the SPI_BAUD register value based on input HZ */ @@ -180,32 +185,32 @@ static int flush(struct driver_data *drv_data) unsigned long limit = loops_per_jiffy << 1; /* wait for stop and clear stat */ - while (!(read_STAT() & BIT_STAT_SPIF) && limit--) + while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && limit--) continue; - write_STAT(BIT_STAT_CLR); + write_STAT(drv_data, BIT_STAT_CLR); return limit; } /* Chip select operation functions for cs_change flag */ -static void cs_active(struct chip_data *chip) +static void cs_active(struct driver_data *drv_data, struct chip_data *chip) { - u16 flag = read_FLAG(); + u16 flag = read_FLAG(drv_data); flag |= chip->flag; flag &= ~(chip->flag << 8); - write_FLAG(flag); + write_FLAG(drv_data, flag); } -static void cs_deactive(struct chip_data *chip) +static void cs_deactive(struct driver_data *drv_data, struct chip_data *chip) { - u16 flag = read_FLAG(); + u16 flag = read_FLAG(drv_data); flag |= (chip-
spi: spi_bfin: change handling of communication parameters
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cc487e732089360727e60f9fdbe3ff6cc4ca3155 Commit: cc487e732089360727e60f9fdbe3ff6cc4ca3155 Parent: 12e17c4267a5b2a5ba77bd53a62388be641534b8 Author: Sonic Zhang <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:17 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:19 2007 -0800 spi: spi_bfin: change handling of communication parameters Fix SPI driver to work with SPI flash ST M25P16 on bf548 Currently the SPI driver enables the SPI controller and sets the SPI baud register for each SPI transfer. But they should never be changed within a SPI message session, in which several SPI transfers are pumped. This patch moves SPI setting to the begining of a message session, and never disables SPI controller until an error occurs. Signed-off-by: Sonic Zhang <[EMAIL PROTECTED]> Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 162 - 1 files changed, 87 insertions(+), 75 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 4496ed1..c99a2af 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -222,9 +222,13 @@ static int restore_state(struct driver_data *drv_data) dev_dbg(&drv_data->pdev->dev, "restoring spi ctl state\n"); /* Load the registers */ - write_CTRL(chip->ctl_reg); + cs_deactive(chip); write_BAUD(chip->baud); - cs_active(chip); + chip->ctl_reg &= (~BIT_CTL_TIMOD); + chip->ctl_reg |= (chip->width << 8); + write_CTRL(chip->ctl_reg); + + bfin_spi_enable(drv_data); if (ret) dev_dbg(&drv_data->pdev->dev, @@ -271,6 +275,7 @@ static void u8_writer(struct driver_data *drv_data) { dev_dbg(&drv_data->pdev->dev, "cr8-s is 0x%x\n", read_STAT()); + while (drv_data->tx < drv_data->tx_end) { write_TDBR(*(u8 *) (drv_data->tx)); while (read_STAT() & BIT_STAT_TXS) @@ -293,16 +298,16 @@ static void u8_cs_chg_writer(struct driver_data *drv_data) write_TDBR(*(u8 *) (drv_data->tx)); while (read_STAT() & BIT_STAT_TXS) continue; - while (!(read_STAT() & BIT_STAT_SPIF)) - continue; cs_deactive(chip); if (chip->cs_chg_udelay) udelay(chip->cs_chg_udelay); ++drv_data->tx; } - cs_deactive(chip); + /* poll for SPI completion before returning */ + while (!(read_STAT() & BIT_STAT_SPIF)) + continue; } static void u8_reader(struct driver_data *drv_data) @@ -314,6 +319,7 @@ static void u8_reader(struct driver_data *drv_data) write_TDBR(0x); dummy_read(); + while (drv_data->rx < drv_data->rx_end - 1) { while (!(read_STAT() & BIT_STAT_RXS)) continue; @@ -331,23 +337,30 @@ static void u8_cs_chg_reader(struct driver_data *drv_data) { struct chip_data *chip = drv_data->cur_chip; - while (drv_data->rx < drv_data->rx_end) { - cs_active(chip); + /* clear TDBR buffer before read(else it will be shifted out) */ + write_TDBR(0x); - read_RDBR();/* kick off */ - while (!(read_STAT() & BIT_STAT_RXS)) - continue; - while (!(read_STAT() & BIT_STAT_SPIF)) - continue; - *(u8 *) (drv_data->rx) = read_SHAW(); + cs_active(chip); + dummy_read(); + + while (drv_data->rx < drv_data->rx_end - 1) { cs_deactive(chip); if (chip->cs_chg_udelay) udelay(chip->cs_chg_udelay); + + while (!(read_STAT() & BIT_STAT_RXS)) + continue; + cs_active(chip); + *(u8 *) (drv_data->rx) = read_RDBR(); ++drv_data->rx; } cs_deactive(chip); + while (!(read_STAT() & BIT_STAT_RXS)) + continue; + *(u8 *) (drv_data->rx) = read_SHAW(); + ++drv_data->rx; } static void u8_duplex(struct driver_data *drv_data) @@ -355,7 +368,7 @@ static void u8_duplex(struct driver_data *drv_data) /* in duplex mode, clk is triggered by writing of TDBR */ while (drv_data->rx < drv_data->rx_end) { write_TDBR(*(u8 *) (drv_data->tx)); - while (!(read_STAT() & BIT_STAT_SPIF)) + while (read_STAT() & BIT_STAT_TXS) continue; while (!(read_STAT() & BIT_STAT_RXS))
Blackfin SPI driver: reconfigure speed_hz and bits_per_word in each spi transfer
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=092e1fdaf35126475aef0dc70f4a2ce4f2f43052 Commit: 092e1fdaf35126475aef0dc70f4a2ce4f2f43052 Parent: 003d922618150eaab53936f57ba8a61f2b601486 Author: Bryan Wu <[EMAIL PROTECTED]> AuthorDate: Tue Dec 4 23:45:23 2007 -0800 Committer: Linus Torvalds <[EMAIL PROTECTED]> CommitDate: Wed Dec 5 09:21:20 2007 -0800 Blackfin SPI driver: reconfigure speed_hz and bits_per_word in each spi transfer - reconfigure SPI baud from speed_hz of each spi transfer - according to spi_transfer.bits_per_word to reprogram register and setup correct SPI operation handlers Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Cc: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]> --- drivers/spi/spi_bfin5xx.c | 52 ++-- 1 files changed, 45 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index d6e9812..22697b8 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -234,10 +234,8 @@ static int restore_state(struct driver_data *drv_data) dev_dbg(&drv_data->pdev->dev, "restoring spi ctl state\n"); /* Load the registers */ - write_BAUD(drv_data, chip->baud); - chip->ctl_reg &= (~BIT_CTL_TIMOD); - chip->ctl_reg |= (chip->width << 8); write_CTRL(drv_data, chip->ctl_reg); + write_BAUD(drv_data, chip->baud); bfin_spi_enable(drv_data); cs_active(drv_data, chip); @@ -679,6 +677,7 @@ static void pump_transfers(unsigned long data) message = drv_data->cur_msg; transfer = drv_data->cur_transfer; chip = drv_data->cur_chip; + /* * if msg is error or done, report it back using complete() callback */ @@ -736,15 +735,48 @@ static void pump_transfers(unsigned long data) drv_data->len_in_bytes = transfer->len; drv_data->cs_change = transfer->cs_change; - width = chip->width; + /* Bits per word setup */ + switch (transfer->bits_per_word) { + case 8: + drv_data->n_bytes = 1; + width = CFG_SPI_WORDSIZE8; + drv_data->read = chip->cs_change_per_word ? + u8_cs_chg_reader : u8_reader; + drv_data->write = chip->cs_change_per_word ? + u8_cs_chg_writer : u8_writer; + drv_data->duplex = chip->cs_change_per_word ? + u8_cs_chg_duplex : u8_duplex; + break; + + case 16: + drv_data->n_bytes = 2; + width = CFG_SPI_WORDSIZE16; + drv_data->read = chip->cs_change_per_word ? + u16_cs_chg_reader : u16_reader; + drv_data->write = chip->cs_change_per_word ? + u16_cs_chg_writer : u16_writer; + drv_data->duplex = chip->cs_change_per_word ? + u16_cs_chg_duplex : u16_duplex; + break; + + default: + /* No change, the same as default setting */ + drv_data->n_bytes = chip->n_bytes; + width = chip->width; + drv_data->write = drv_data->tx ? chip->write : null_writer; + drv_data->read = drv_data->rx ? chip->read : null_reader; + drv_data->duplex = chip->duplex ? chip->duplex : null_writer; + break; + } + cr = (read_CTRL(drv_data) & (~BIT_CTL_TIMOD)); + cr |= (width << 8); + write_CTRL(drv_data, cr); + if (width == CFG_SPI_WORDSIZE16) { drv_data->len = (transfer->len) >> 1; } else { drv_data->len = transfer->len; } - drv_data->write = drv_data->tx ? chip->write : null_writer; - drv_data->read = drv_data->rx ? chip->read : null_reader; - drv_data->duplex = chip->duplex ? chip->duplex : null_writer; dev_dbg(&drv_data->pdev->dev, "transfer: ", "drv_data->write is %p, chip->write is %p, null_wr is %p\n", drv_data->write, chip->write, null_writer); @@ -753,6 +785,12 @@ static void pump_transfers(unsigned long data) message->state = RUNNING_STATE; dma_config = 0; + /* Speed setup (surely valid because already checked) */ + if (transfer->speed_hz) + write_BAUD(drv_data, hz_to_spi_baud(transfer->speed_hz)); + else + write_BAUD(drv_data, chip->baud); + write_STAT(drv_data, BIT_STAT_CLR); cr = (read_CTRL(drv_data) & (~BIT_CTL_TIMOD)); cs_active(drv_data, chip); - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html