From bd07ed2b4d7071716c09895e19849e8b04991656 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 23 Nov 2005 21:45:43 +1100 Subject: [PATCH 01/43] I think that if a PCI bus is a root bus, attached to a host bridge not a PCI->PCI bridge, then bus->self is allowed to be NULL. Certainly that's the case on my Pegasos, and it makes the MGA DRM driver oops... Signed-off-by: David Woodhouse Signed-off-by: Dave Airlie --- drivers/char/drm/mga_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c index 0cc7c305a7f6..1713451a5cc6 100644 --- a/drivers/char/drm/mga_drv.c +++ b/drivers/char/drm/mga_drv.c @@ -161,7 +161,7 @@ static int mga_driver_device_is_agp(drm_device_t * dev) * device. */ - if ((pdev->device == 0x0525) + if ((pdev->device == 0x0525) && pdev->bus->self && (pdev->bus->self->vendor == 0x3388) && (pdev->bus->self->device == 0x0021)) { return 0; From c41f47121d8bf44b886ef2039779dab8c1e3a25f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 23 Nov 2005 22:09:13 +1100 Subject: [PATCH 02/43] drm: add __GFP_COMP to the drm_alloc_pages The DRM only uses drm_alloc_pages for non-SG PCI cards using DRM. Signed-off-by: Hugh Dickins Signed-off-by: Dave Airlie --- drivers/char/drm/drm_memory.c | 2 +- drivers/char/drm/drm_memory_debug.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/drm/drm_memory.c b/drivers/char/drm/drm_memory.c index 2c74155aa84f..abef2acf99f5 100644 --- a/drivers/char/drm/drm_memory.c +++ b/drivers/char/drm/drm_memory.c @@ -95,7 +95,7 @@ unsigned long drm_alloc_pages(int order, int area) unsigned long addr; unsigned int sz; - address = __get_free_pages(GFP_KERNEL, order); + address = __get_free_pages(GFP_KERNEL|__GFP_COMP, order); if (!address) return 0; diff --git a/drivers/char/drm/drm_memory_debug.h b/drivers/char/drm/drm_memory_debug.h index 4542353195bd..b370aca718d2 100644 --- a/drivers/char/drm/drm_memory_debug.h +++ b/drivers/char/drm/drm_memory_debug.h @@ -221,7 +221,7 @@ unsigned long DRM(alloc_pages) (int order, int area) { } spin_unlock(&DRM(mem_lock)); - address = __get_free_pages(GFP_KERNEL, order); + address = __get_free_pages(GFP_KERNEL|__GFP_COMP, order); if (!address) { spin_lock(&DRM(mem_lock)); ++DRM(mem_stats)[area].fail_count; From 7655f493b74f3048c02458bc32cd0b144f7b394f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 23 Nov 2005 22:12:59 +1100 Subject: [PATCH 03/43] drm: move is_pci to the end of the structure We memset the structure across opens except for the flags. The correct fix is more intrusive but this should fix a problem with bad iounmaps seen on AGP radeons acting like PCI ones. Signed-off-by: Dave Airlie --- drivers/char/drm/radeon_drv.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h index 120ee5a8ebcc..7bda7e33d2bd 100644 --- a/drivers/char/drm/radeon_drv.h +++ b/drivers/char/drm/radeon_drv.h @@ -214,8 +214,6 @@ typedef struct drm_radeon_private { int microcode_version; - int is_pci; - struct { u32 boxes; int freelist_timeouts; @@ -275,6 +273,7 @@ typedef struct drm_radeon_private { /* starting from here on, data is preserved accross an open */ uint32_t flags; /* see radeon_chip_flags */ + int is_pci; } drm_radeon_private_t; typedef struct drm_radeon_buf_priv { From 2d0ebb36038c0626cde662a3b06da9787cfb68c3 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 23 Nov 2005 08:44:05 -0800 Subject: [PATCH 04/43] Revert "[NET]: Shut up warnings in net/core/flow.c" This reverts commit af2b4079ab154bd12e8c12b02db5f31b31babe63 Changing the #define to an inline function breaks on non-SMP builds, since wuite a few places in the kernel do not implement the ipi handler when compiling for UP. Signed-off-by: Linus Torvalds --- include/linux/smp.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/include/linux/smp.h b/include/linux/smp.h index b6069c8e1f04..9dfa3ee769ae 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -94,13 +94,7 @@ void smp_prepare_boot_cpu(void); */ #define raw_smp_processor_id() 0 #define hard_smp_processor_id() 0 - -static inline int smp_call_function(void (*func) (void *info), void *info, - int retry, int wait) -{ - return 0; -} - +#define smp_call_function(func,info,retry,wait) ({ 0; }) #define on_each_cpu(func,info,retry,wait) ({ func(info); 0; }) static inline void smp_send_reschedule(int cpu) { } #define num_booting_cpus() 1 From c2b5a251b9feca727661f1a3278cafb1de4c80f3 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Thu, 3 Nov 2005 07:51:18 -0700 Subject: [PATCH 05/43] [PATCH] Check the irq number is within bounds Most of the functions already check. Do the ones that didn't. Signed-off-by: Matthew Wilcox Signed-off-by: Linus Torvalds --- kernel/irq/manage.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 3bd7226d15fa..81c49a4d679e 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -36,6 +36,9 @@ void synchronize_irq(unsigned int irq) { struct irq_desc *desc = irq_desc + irq; + if (irq >= NR_IRQS) + return; + while (desc->status & IRQ_INPROGRESS) cpu_relax(); } @@ -60,6 +63,9 @@ void disable_irq_nosync(unsigned int irq) irq_desc_t *desc = irq_desc + irq; unsigned long flags; + if (irq >= NR_IRQS) + return; + spin_lock_irqsave(&desc->lock, flags); if (!desc->depth++) { desc->status |= IRQ_DISABLED; @@ -86,6 +92,9 @@ void disable_irq(unsigned int irq) { irq_desc_t *desc = irq_desc + irq; + if (irq >= NR_IRQS) + return; + disable_irq_nosync(irq); if (desc->action) synchronize_irq(irq); @@ -108,6 +117,9 @@ void enable_irq(unsigned int irq) irq_desc_t *desc = irq_desc + irq; unsigned long flags; + if (irq >= NR_IRQS) + return; + spin_lock_irqsave(&desc->lock, flags); switch (desc->depth) { case 0: @@ -163,6 +175,9 @@ int setup_irq(unsigned int irq, struct irqaction * new) unsigned long flags; int shared = 0; + if (irq >= NR_IRQS) + return -EINVAL; + if (desc->handler == &no_irq_type) return -ENOSYS; /* From 3238c448c6e26d7c26d2e9b070ef149d066cb6c2 Mon Sep 17 00:00:00 2001 From: Adam Brooks Date: Wed, 23 Nov 2005 22:45:27 +0000 Subject: [PATCH 06/43] [ARM] 3173/1: Fix to allow 2.6.15-rc2 to compile for IOP3xx boards Patch from Adam Brooks Fixes an issue in 2.6.15-rc2 that prevented compilation of kernels for IOP3xx boards. Signed-off-by: Adam Brooks Signed-off-by: Russell King --- include/asm-arm/arch-iop3xx/timex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-arm/arch-iop3xx/timex.h b/include/asm-arm/arch-iop3xx/timex.h index d4187fe9a85a..472badb451c4 100644 --- a/include/asm-arm/arch-iop3xx/timex.h +++ b/include/asm-arm/arch-iop3xx/timex.h @@ -4,7 +4,7 @@ * IOP3xx architecture timex specifications */ #include - +#include #if defined(CONFIG_ARCH_IQ80321) || defined(CONFIG_ARCH_IQ31244) From c101e77301877086e6f977fcfb140d1cbbe23fd5 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 23 Nov 2005 13:37:36 -0800 Subject: [PATCH 07/43] [PATCH] revert floppy-fix-read-only-handling This fix causes problems on the very first floppy access - we haven't yet talked to the FDC so we don't know which state the write-protect tab is in. Revert for now. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/block/floppy.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 13b8a9bed66e..f7e765a1d313 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3714,12 +3714,6 @@ static int floppy_open(struct inode *inode, struct file *filp) USETF(FD_VERIFY); } - /* set underlying gendisk policy to reflect real ro/rw status */ - if (UTESTF(FD_DISK_WRITABLE)) - inode->i_bdev->bd_disk->policy = 0; - else - inode->i_bdev->bd_disk->policy = 1; - if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_flags & O_EXCL))) goto out2; From 7b6ac9dffe6f4dd8776908b234ac1410ed15f112 Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Wed, 23 Nov 2005 13:37:37 -0800 Subject: [PATCH 08/43] [PATCH] mm: update split ptlock Kconfig Closer attention to the arithmetic shows that neither ppc64 nor sparc really uses one page for multiple page tables: how on earth could they, while pte_alloc_one returns just a struct page pointer, with no offset? Well, arm26 manages it by returning a pte_t pointer cast to a struct page pointer, harumph, then compensating in its pmd_populate. But arm26 is never SMP, so it's not a problem for split ptlock either. And the PA-RISC situation has been recently improved: CONFIG_PA20 works without the 16-byte alignment which inflated its spinlock_t. But the current union of spinlock_t with private does make the 7xxx struct page significantly larger, even without debug, so disable its split ptlock. Signed-off-by: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/Kconfig | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/Kconfig b/mm/Kconfig index ae9ce6b73e8a..21eb51d4da8f 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -125,12 +125,10 @@ comment "Memory hotplug is currently incompatible with Software Suspend" # space can be handled with less contention: split it at this NR_CPUS. # Default to 4 for wider testing, though 8 might be more appropriate. # ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock. -# PA-RISC's debug spinlock_t is too large for the 32-bit struct page. -# ARM26 and SPARC32 and PPC64 may use one page for multiple page tables. +# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes. # config SPLIT_PTLOCK_CPUS int default "4096" if ARM && !CPU_CACHE_VIPT - default "4096" if PARISC && DEBUG_SPINLOCK && !64BIT - default "4096" if ARM26 || SPARC32 || PPC64 + default "4096" if PARISC && !PA20 default "4" From cc3327e7dfc16a9a3e164075234c869867a59e45 Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Wed, 23 Nov 2005 13:37:38 -0800 Subject: [PATCH 09/43] [PATCH] mm: unbloat get_futex_key The follow_page changes in get_futex_key have left it with two almost identical blocks, when handling the rare case of a futex in a nonlinear vma. get_user_pages will itself do that follow_page, and its additional find_extend_vma is hardly any overhead since the vma is already cached. Let's just delete the follow_page block and let get_user_pages do it. Signed-off-by: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/futex.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/kernel/futex.c b/kernel/futex.c index aca8d10704f6..5872e3507f35 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -201,21 +201,6 @@ static int get_futex_key(unsigned long uaddr, union futex_key *key) * from swap. But that's a lot of code to duplicate here * for a rare case, so we simply fetch the page. */ - - /* - * Do a quick atomic lookup first - this is the fastpath. - */ - page = follow_page(mm, uaddr, FOLL_TOUCH|FOLL_GET); - if (likely(page != NULL)) { - key->shared.pgoff = - page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT); - put_page(page); - return 0; - } - - /* - * Do it the general way. - */ err = get_user_pages(current, mm, uaddr, 1, 0, 0, &page, NULL); if (err >= 0) { key->shared.pgoff = From 01edcd891c3e9f4bb992ff2ceb69836bf76f8ddf Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Wed, 23 Nov 2005 13:37:39 -0800 Subject: [PATCH 10/43] [PATCH] mm: powerpc ptlock comments Update comments (only) on page_table_lock and mmap_sem in arch/powerpc. Removed the comment on page_table_lock from hash_huge_page: since it's no longer taking page_table_lock itself, it's irrelevant whether others are; but how it is safe (even against huge file truncation?) I can't say. Signed-off-by: Hugh Dickins Cc: Paul Mackerras Cc: Benjamin Herrenschmidt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/powerpc/mm/hugetlbpage.c | 4 +--- arch/powerpc/mm/mem.c | 2 +- arch/powerpc/mm/tlb_32.c | 6 ++++++ arch/powerpc/mm/tlb_64.c | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 426c269e552e..9250f14be8ef 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -754,9 +754,7 @@ repeat: } /* - * No need to use ldarx/stdcx here because all who - * might be updating the pte will hold the - * page_table_lock + * No need to use ldarx/stdcx here */ *ptep = __pte(new_pte & ~_PAGE_BUSY); diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 4bd7b0a70996..ed6ed2e30dac 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c @@ -495,7 +495,7 @@ EXPORT_SYMBOL(flush_icache_user_range); * We use it to preload an HPTE into the hash table corresponding to * the updated linux PTE. * - * This must always be called with the mm->page_table_lock held + * This must always be called with the pte lock held. */ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) diff --git a/arch/powerpc/mm/tlb_32.c b/arch/powerpc/mm/tlb_32.c index 6c3dc3c44c86..ad580f3742e5 100644 --- a/arch/powerpc/mm/tlb_32.c +++ b/arch/powerpc/mm/tlb_32.c @@ -149,6 +149,12 @@ void flush_tlb_mm(struct mm_struct *mm) return; } + /* + * It is safe to go down the mm's list of vmas when called + * from dup_mmap, holding mmap_sem. It would also be safe from + * unmap_region or exit_mmap, but not from vmtruncate on SMP - + * but it seems dup_mmap is the only SMP case which gets here. + */ for (mp = mm->mmap; mp != NULL; mp = mp->vm_next) flush_range(mp->vm_mm, mp->vm_start, mp->vm_end); FINISH_FLUSH; diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c index 53e31b834ace..859d29a0cac5 100644 --- a/arch/powerpc/mm/tlb_64.c +++ b/arch/powerpc/mm/tlb_64.c @@ -95,7 +95,7 @@ static void pte_free_submit(struct pte_freelist_batch *batch) void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf) { - /* This is safe as we are holding page_table_lock */ + /* This is safe since tlb_gather_mmu has disabled preemption */ cpumask_t local_cpumask = cpumask_of_cpu(smp_processor_id()); struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur); @@ -206,7 +206,7 @@ void __flush_tlb_pending(struct ppc64_tlb_batch *batch) void pte_free_finish(void) { - /* This is safe as we are holding page_table_lock */ + /* This is safe since tlb_gather_mmu has disabled preemption */ struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur); if (*batchp == NULL) From 7ce774b4808c019c2f143ff5dea1a1b094ff01e1 Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Wed, 23 Nov 2005 13:37:39 -0800 Subject: [PATCH 11/43] [PATCH] mm: powerpc init_mm without ptlock Restore an earlier mod which went missing in the powerpc reshuffle: the 4xx mmu_mapin_ram does not need to take init_mm.page_table_lock. Signed-off-by: Hugh Dickins Cc: Paul Mackerras Cc: Benjamin Herrenschmidt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/powerpc/mm/4xx_mmu.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/powerpc/mm/4xx_mmu.c b/arch/powerpc/mm/4xx_mmu.c index b7bcbc232f39..4d006aa1a0d1 100644 --- a/arch/powerpc/mm/4xx_mmu.c +++ b/arch/powerpc/mm/4xx_mmu.c @@ -110,13 +110,11 @@ unsigned long __init mmu_mapin_ram(void) pmd_t *pmdp; unsigned long val = p | _PMD_SIZE_16M | _PAGE_HWEXEC | _PAGE_HWWRITE; - spin_lock(&init_mm.page_table_lock); pmdp = pmd_offset(pgd_offset_k(v), v); pmd_val(*pmdp++) = val; pmd_val(*pmdp++) = val; pmd_val(*pmdp++) = val; pmd_val(*pmdp++) = val; - spin_unlock(&init_mm.page_table_lock); v += LARGE_PAGE_SIZE_16M; p += LARGE_PAGE_SIZE_16M; @@ -127,10 +125,8 @@ unsigned long __init mmu_mapin_ram(void) pmd_t *pmdp; unsigned long val = p | _PMD_SIZE_4M | _PAGE_HWEXEC | _PAGE_HWWRITE; - spin_lock(&init_mm.page_table_lock); pmdp = pmd_offset(pgd_offset_k(v), v); pmd_val(*pmdp) = val; - spin_unlock(&init_mm.page_table_lock); v += LARGE_PAGE_SIZE_4M; p += LARGE_PAGE_SIZE_4M; From 7c72aaf29621d29ed19fd68c44edb45321645049 Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Wed, 23 Nov 2005 13:37:40 -0800 Subject: [PATCH 12/43] [PATCH] mm: fill arch atomic64 gaps alpha, sparc64, x86_64 are each missing some primitives from their atomic64 support: fill in the gaps I've noticed by extrapolating asm, follow the groupings in each file. But powerpc and parisc still lack atomic64. Signed-off-by: Hugh Dickins Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: "David S. Miller" Cc: Andi Kleen Cc: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-alpha/atomic.h | 7 +++-- include/asm-sparc64/atomic.h | 1 + include/asm-x86_64/atomic.h | 51 +++++++++++++++++++++++++++--------- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/include/asm-alpha/atomic.h b/include/asm-alpha/atomic.h index 36505bb4e8cb..6183eab006d4 100644 --- a/include/asm-alpha/atomic.h +++ b/include/asm-alpha/atomic.h @@ -118,8 +118,6 @@ static __inline__ long atomic_add_return(int i, atomic_t * v) return result; } -#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) - static __inline__ long atomic64_add_return(long i, atomic64_t * v) { long temp, result; @@ -189,6 +187,9 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v) }) #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) +#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) +#define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0) + #define atomic_dec_return(v) atomic_sub_return(1,(v)) #define atomic64_dec_return(v) atomic64_sub_return(1,(v)) @@ -199,6 +200,8 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v) #define atomic64_sub_and_test(i,v) (atomic64_sub_return((i), (v)) == 0) #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) +#define atomic64_inc_and_test(v) (atomic64_add_return(1, (v)) == 0) + #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) #define atomic64_dec_and_test(v) (atomic64_sub_return(1, (v)) == 0) diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h index 8198c3d0d007..3789fe315992 100644 --- a/include/asm-sparc64/atomic.h +++ b/include/asm-sparc64/atomic.h @@ -54,6 +54,7 @@ extern int atomic64_sub_ret(int, atomic64_t *); * other cases. */ #define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) +#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0) #define atomic_sub_and_test(i, v) (atomic_sub_ret(i, v) == 0) #define atomic64_sub_and_test(i, v) (atomic64_sub_ret(i, v) == 0) diff --git a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h index 0866ef67f198..50db9f39274f 100644 --- a/include/asm-x86_64/atomic.h +++ b/include/asm-x86_64/atomic.h @@ -160,8 +160,8 @@ static __inline__ int atomic_inc_and_test(atomic_t *v) /** * atomic_add_negative - add and test if negative - * @v: pointer of type atomic_t * @i: integer value to add + * @v: pointer of type atomic_t * * Atomically adds @i to @v and returns true * if the result is negative, or false when @@ -178,6 +178,31 @@ static __inline__ int atomic_add_negative(int i, atomic_t *v) return c; } +/** + * atomic_add_return - add and return + * @i: integer value to add + * @v: pointer of type atomic_t + * + * Atomically adds @i to @v and returns @i + @v + */ +static __inline__ int atomic_add_return(int i, atomic_t *v) +{ + int __i = i; + __asm__ __volatile__( + LOCK "xaddl %0, %1;" + :"=r"(i) + :"m"(v->counter), "0"(i)); + return i + __i; +} + +static __inline__ int atomic_sub_return(int i, atomic_t *v) +{ + return atomic_add_return(-i,v); +} + +#define atomic_inc_return(v) (atomic_add_return(1,v)) +#define atomic_dec_return(v) (atomic_sub_return(1,v)) + /* An 64bit atomic type */ typedef struct { volatile long counter; } atomic64_t; @@ -320,14 +345,14 @@ static __inline__ int atomic64_inc_and_test(atomic64_t *v) /** * atomic64_add_negative - add and test if negative - * @v: pointer to atomic64_t * @i: integer value to add + * @v: pointer to type atomic64_t * * Atomically adds @i to @v and returns true * if the result is negative, or false when * result is greater than or equal to zero. */ -static __inline__ long atomic64_add_negative(long i, atomic64_t *v) +static __inline__ int atomic64_add_negative(long i, atomic64_t *v) { unsigned char c; @@ -339,27 +364,30 @@ static __inline__ long atomic64_add_negative(long i, atomic64_t *v) } /** - * atomic_add_return - add and return - * @v: pointer of type atomic_t + * atomic64_add_return - add and return * @i: integer value to add + * @v: pointer to type atomic64_t * * Atomically adds @i to @v and returns @i + @v */ -static __inline__ int atomic_add_return(int i, atomic_t *v) +static __inline__ long atomic64_add_return(long i, atomic64_t *v) { - int __i = i; + long __i = i; __asm__ __volatile__( - LOCK "xaddl %0, %1;" + LOCK "xaddq %0, %1;" :"=r"(i) :"m"(v->counter), "0"(i)); return i + __i; } -static __inline__ int atomic_sub_return(int i, atomic_t *v) +static __inline__ long atomic64_sub_return(long i, atomic64_t *v) { - return atomic_add_return(-i,v); + return atomic64_add_return(-i,v); } +#define atomic64_inc_return(v) (atomic64_add_return(1,v)) +#define atomic64_dec_return(v) (atomic64_sub_return(1,v)) + #define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new)) /** @@ -381,9 +409,6 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v) }) #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) -#define atomic_inc_return(v) (atomic_add_return(1,v)) -#define atomic_dec_return(v) (atomic_sub_return(1,v)) - /* These are x86-specific, used by some header files */ #define atomic_clear_mask(mask, addr) \ __asm__ __volatile__(LOCK "andl %0,%1" \ From 8bf1101bd52573e0573e374d56d2feecdbb5e444 Mon Sep 17 00:00:00 2001 From: Jim Keniston Date: Wed, 23 Nov 2005 13:37:42 -0800 Subject: [PATCH 13/43] [PATCH] kprobes: Fix return probes on sys_execve Fix a bug in kprobes that can cause an Oops or even a crash when a return probe is installed on one of the following functions: sys_execve, do_execve, load_*_binary, flush_old_exec, or flush_thread. The fix is to remove the call to kprobe_flush_task() in flush_thread(). This fix has been tested on all architectures for which the return-probes feature has been implemented (i386, x86_64, ppc64, ia64). Please apply. BACKGROUND Up to now, we have called kprobe_flush_task() under two situations: when a task exits, and when it execs. Flushing kretprobe_instances on exit is correct because (a) do_exit() doesn't return, and (b) one or more return-probed functions may be active when a task calls do_exit(). Neither is the case for sys_execve() and its callees. Initially, the mistaken call to kprobe_flush_task() on exec was harmless because we put the "real" return address of each active probed function back in the stack, just to be safe, when we recycled its kretprobe_instance. When support for ppc64 and ia64 was added, this safety measure couldn't be employed, and was eventually dropped even for i386 and x86_64. sys_execve() and its callees were informally blacklisted for return probes until this fix was developed. Acked-by: Prasanna S Panchamukhi Signed-off-by: Jim Keniston Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/i386/kernel/process.c | 7 ------- arch/ia64/kernel/process.c | 7 ------- arch/powerpc/kernel/process.c | 1 - arch/x86_64/kernel/process.c | 7 ------- 4 files changed, 22 deletions(-) diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 1cb261f225d5..df6c2bcde067 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -393,13 +393,6 @@ void flush_thread(void) { struct task_struct *tsk = current; - /* - * Remove function-return probe instances associated with this task - * and put them back on the free list. Do not insert an exit probe for - * this function, it will be disabled by kprobe_flush_task if you do. - */ - kprobe_flush_task(tsk); - memset(tsk->thread.debugreg, 0, sizeof(unsigned long)*8); memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array)); /* diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 4305d2ba76f6..2e33665d9c18 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -718,13 +718,6 @@ kernel_thread_helper (int (*fn)(void *), void *arg) void flush_thread (void) { - /* - * Remove function-return probe instances associated with this task - * and put them back on the free list. Do not insert an exit probe for - * this function, it will be disabled by kprobe_flush_task if you do. - */ - kprobe_flush_task(current); - /* drop floating-point and debug-register state if it exists: */ current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID); ia64_drop_fpu(current); diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index de69fb37c731..a5a7542a8ff3 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -457,7 +457,6 @@ void flush_thread(void) if (t->flags & _TIF_ABI_PENDING) t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT); #endif - kprobe_flush_task(current); #ifndef CONFIG_SMP if (last_task_used_math == current) diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index 5afd63e8cef7..7519fc520eb3 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c @@ -351,13 +351,6 @@ void flush_thread(void) struct task_struct *tsk = current; struct thread_info *t = current_thread_info(); - /* - * Remove function-return probe instances associated with this task - * and put them back on the free list. Do not insert an exit probe for - * this function, it will be disabled by kprobe_flush_task if you do. - */ - kprobe_flush_task(tsk); - if (t->flags & _TIF_ABI_PENDING) t->flags ^= (_TIF_ABI_PENDING | _TIF_IA32); From 962b564cf1ec8041e8890a3c3847e3a630a08f42 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Wed, 23 Nov 2005 13:37:43 -0800 Subject: [PATCH 14/43] [PATCH] fix do_wait() vs exec() race When non-leader thread does exec, de_thread adds old leader to the init's ->children list in EXIT_ZOMBIE state and drops tasklist_lock. This means that release_task(leader) in de_thread() is racy vs do_wait() from init task. I think de_thread() should set old leader's state to EXIT_DEAD instead. Signed-off-by: Oleg Nesterov Cc: george anzinger Cc: Roland Dreier Cc: Ingo Molnar Cc: Linus Torvalds Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/exec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index c466fec5de20..1f8a9fd2c9ed 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -668,7 +668,7 @@ static inline int de_thread(struct task_struct *tsk) if (!thread_group_leader(current)) { struct task_struct *parent; struct dentry *proc_dentry1, *proc_dentry2; - unsigned long exit_state, ptrace; + unsigned long ptrace; /* * Wait for the thread group leader to be a zombie. @@ -726,15 +726,15 @@ static inline int de_thread(struct task_struct *tsk) list_del(¤t->tasks); list_add_tail(¤t->tasks, &init_task.tasks); current->exit_signal = SIGCHLD; - exit_state = leader->exit_state; + + BUG_ON(leader->exit_state != EXIT_ZOMBIE); + leader->exit_state = EXIT_DEAD; write_unlock_irq(&tasklist_lock); spin_unlock(&leader->proc_lock); spin_unlock(¤t->proc_lock); proc_pid_flush(proc_dentry1); proc_pid_flush(proc_dentry2); - - BUG_ON(exit_state != EXIT_ZOMBIE); } /* From e9b15b54d3646108bbd3e054158b402025d3e704 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Wed, 23 Nov 2005 13:37:44 -0800 Subject: [PATCH 15/43] [PATCH] Fix crash in unregister_console() If unregister_console() is inadvertently called while no consoles are registered, it will crash trying to dereference NULL pointer. It is necessary to fix that because register_console() provides no indication that it actually registered the console passed in. In fact, it may well decide not to register it based on various things... (akpm: It'd be better to make register_console() return something and fix the callers. All 106 of them...) Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/printk.c b/kernel/printk.c index ac8a08f36207..5287be83e3e7 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -956,7 +956,7 @@ int unregister_console(struct console *console) if (console_drivers == console) { console_drivers=console->next; res = 0; - } else { + } else if (console_drivers) { for (a=console_drivers->next, b=console_drivers ; a; b=a, a=b->next) { if (a == console) { From 5e391dc9e3fec68922137ae317bf680a74656c1b Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 23 Nov 2005 13:37:45 -0800 Subject: [PATCH 16/43] [PATCH] powerpc: fix for hugepage areas straddling 4GB boundary Commit 7d24f0b8a53261709938ffabe3e00f88f6498df9 fixed bugs in the ppc64 SLB miss handler with respect to hugepage handling, and in the process tweaked the semantics of the hugepage address masks in mm_context_t. Unfortunately, it left out a couple of necessary changes to go with that change. First, the in_hugepage_area() macro was not updated to match, second prepare_hugepage_range() was not updated to correctly handle hugepages regions which straddled the 4GB point. The latter appears only to cause process-hangs when attempting to map such a region, but the former can cause oopses if a get_user_pages() is triggered at the wrong point. This patch addresses both bugs. Signed-off-by: David Gibson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/powerpc/mm/hugetlbpage.c | 6 +++--- include/asm-powerpc/page_64.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 9250f14be8ef..f867bba893ca 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -287,15 +287,15 @@ static int open_high_hpage_areas(struct mm_struct *mm, u16 newareas) int prepare_hugepage_range(unsigned long addr, unsigned long len) { - int err; + int err = 0; if ( (addr+len) < addr ) return -EINVAL; - if ((addr + len) < 0x100000000UL) + if (addr < 0x100000000UL) err = open_low_hpage_areas(current->mm, LOW_ESID_MASK(addr, len)); - else + if ((addr + len) >= 0x100000000UL) err = open_high_hpage_areas(current->mm, HTLB_AREA_MASK(addr, len)); if (err) { diff --git a/include/asm-powerpc/page_64.h b/include/asm-powerpc/page_64.h index 1e6e7846824f..58a3dd9a79ec 100644 --- a/include/asm-powerpc/page_64.h +++ b/include/asm-powerpc/page_64.h @@ -135,9 +135,9 @@ extern unsigned int HPAGE_SHIFT; #define in_hugepage_area(context, addr) \ (cpu_has_feature(CPU_FTR_16M_PAGE) && \ - ( ((1 << GET_HTLB_AREA(addr)) & (context).high_htlb_areas) || \ - ( ((addr) < 0x100000000L) && \ - ((1 << GET_ESID(addr)) & (context).low_htlb_areas) ) ) ) + ( ( (addr) >= 0x100000000UL) \ + ? ((1 << GET_HTLB_AREA(addr)) & (context).high_htlb_areas) \ + : ((1 << GET_ESID(addr)) & (context).low_htlb_areas) ) ) #else /* !CONFIG_HUGETLB_PAGE */ From 02b7068221eed702a37527fa2da4d63a27b3126a Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 23 Nov 2005 13:37:47 -0800 Subject: [PATCH 17/43] [PATCH] jffs2 debug gcc-2.9x fix Work around gcc-2.95.x macro expansion bug. Cc: David Woodhouse Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/jffs2/debug.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/jffs2/debug.h b/fs/jffs2/debug.h index f193d43a8a59..162af6dfe292 100644 --- a/fs/jffs2/debug.h +++ b/fs/jffs2/debug.h @@ -82,28 +82,28 @@ do { \ printk(JFFS2_ERR_MSG_PREFIX \ " (%d) %s: " fmt, current->pid, \ - __FUNCTION__, ##__VA_ARGS__); \ + __FUNCTION__ , ##__VA_ARGS__); \ } while(0) #define JFFS2_WARNING(fmt, ...) \ do { \ printk(JFFS2_WARN_MSG_PREFIX \ " (%d) %s: " fmt, current->pid, \ - __FUNCTION__, ##__VA_ARGS__); \ + __FUNCTION__ , ##__VA_ARGS__); \ } while(0) #define JFFS2_NOTICE(fmt, ...) \ do { \ printk(JFFS2_NOTICE_MSG_PREFIX \ " (%d) %s: " fmt, current->pid, \ - __FUNCTION__, ##__VA_ARGS__); \ + __FUNCTION__ , ##__VA_ARGS__); \ } while(0) #define JFFS2_DEBUG(fmt, ...) \ do { \ printk(JFFS2_DBG_MSG_PREFIX \ " (%d) %s: " fmt, current->pid, \ - __FUNCTION__, ##__VA_ARGS__); \ + __FUNCTION__ , ##__VA_ARGS__); \ } while(0) /* From 479ef592f3664dd629417098c8599261c0f689ab Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Wed, 23 Nov 2005 13:37:47 -0800 Subject: [PATCH 18/43] [PATCH] 32bit integer overflow in invalidate_inode_pages2() Fix a 32 bit integer overflow in invalidate_inode_pages2_range. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/truncate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/truncate.c b/mm/truncate.c index 29c18f68dc35..9173ab500604 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -282,8 +282,8 @@ int invalidate_inode_pages2_range(struct address_space *mapping, * Zap the rest of the file in one hit. */ unmap_mapping_range(mapping, - page_index << PAGE_CACHE_SHIFT, - (end - page_index + 1) + (loff_t)page_index< Date: Wed, 23 Nov 2005 19:03:46 -0800 Subject: [PATCH 19/43] [NETFILTER]: ip_conntrack_netlink.c needs linux/interrupt.h net/ipv4/netfilter/ip_conntrack_netlink.c: In function 'ctnetlink_dump_table': net/ipv4/netfilter/ip_conntrack_netlink.c:409: warning: implicit declaration of function 'local_bh_disable' net/ipv4/netfilter/ip_conntrack_netlink.c:427: warning: implicit declaration of function 'local_bh_enable' Signed-off-by: Benoit Boissinot Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- net/ipv4/netfilter/ip_conntrack_netlink.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c index 6c18a2b6d5ce..3fce91bcc0ba 100644 --- a/net/ipv4/netfilter/ip_conntrack_netlink.c +++ b/net/ipv4/netfilter/ip_conntrack_netlink.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include From 133747e8d1e912863edfb3869e36b97b9939d4fc Mon Sep 17 00:00:00 2001 From: Olaf Rempel Date: Wed, 23 Nov 2005 19:04:08 -0800 Subject: [PATCH 20/43] [BRIDGE]: recompute features when adding a new device We must recompute bridge features everytime the list of underlying devices changes, or we might end up with features that are not supported by all devices (eg. NETIF_F_TSO) This patch adds the missing recompute when adding a device to the bridge. Signed-off-by: Olaf Rempel Signed-off-by: David S. Miller --- net/bridge/br_if.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index defcf6a8607c..975abe254b7a 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -366,6 +366,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) spin_lock_bh(&br->lock); br_stp_recalculate_bridge_id(br); + br_features_recompute(br); if ((br->dev->flags & IFF_UP) && (dev->flags & IFF_UP) && netif_carrier_ok(dev)) br_stp_enable_port(p); From 2b08c8d0468866f86da97f836c6ac14338cb81a9 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Wed, 23 Nov 2005 15:43:50 -0800 Subject: [PATCH 21/43] [PATCH] Small fixes to driver core This patch (as603) makes a few small fixes to the driver core: Change spin_lock_irq for a klist lock to spin_lock; Fix reference count leaks; Minor spelling and formatting changes. Signed-off-by: Alan Stern Acked-by Patrick Mochel Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/base/bus.c | 21 +++++++++------------ drivers/base/dd.c | 8 +++----- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 03204bfd17af..fa601b085eba 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -133,7 +133,7 @@ static struct kobj_type ktype_bus = { decl_subsys(bus, &ktype_bus, NULL); -/* Manually detach a device from it's associated driver. */ +/* Manually detach a device from its associated driver. */ static int driver_helper(struct device *dev, void *data) { const char *name = data; @@ -151,14 +151,13 @@ static ssize_t driver_unbind(struct device_driver *drv, int err = -ENODEV; dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); - if ((dev) && - (dev->driver == drv)) { + if (dev && dev->driver == drv) { device_release_driver(dev); err = count; } - if (err) - return err; - return count; + put_device(dev); + put_bus(bus); + return err; } static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); @@ -175,16 +174,14 @@ static ssize_t driver_bind(struct device_driver *drv, int err = -ENODEV; dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); - if ((dev) && - (dev->driver == NULL)) { + if (dev && dev->driver == NULL) { down(&dev->sem); err = driver_probe_device(drv, dev); up(&dev->sem); - put_device(dev); } - if (err) - return err; - return count; + put_device(dev); + put_bus(bus); + return err; } static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 3565e9795301..3b419c9a1e7e 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -62,7 +62,6 @@ void device_bind_driver(struct device * dev) * because we don't know the format of the ID structures, nor what * is to be considered a match and what is not. * - * * This function returns 1 if a match is found, an error if one * occurs (that is not -ENODEV or -ENXIO), and 0 otherwise. * @@ -158,7 +157,6 @@ static int __driver_attach(struct device * dev, void * data) driver_probe_device(drv, dev); up(&dev->sem); - return 0; } @@ -225,15 +223,15 @@ void driver_detach(struct device_driver * drv) struct device * dev; for (;;) { - spin_lock_irq(&drv->klist_devices.k_lock); + spin_lock(&drv->klist_devices.k_lock); if (list_empty(&drv->klist_devices.k_list)) { - spin_unlock_irq(&drv->klist_devices.k_lock); + spin_unlock(&drv->klist_devices.k_lock); break; } dev = list_entry(drv->klist_devices.k_list.prev, struct device, knode_driver.n_node); get_device(dev); - spin_unlock_irq(&drv->klist_devices.k_lock); + spin_unlock(&drv->klist_devices.k_lock); down(&dev->sem); if (dev->driver == drv) From 2c560ace1531870715fdfdae36fa9d75f4e63ae1 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Wed, 23 Nov 2005 15:43:57 -0800 Subject: [PATCH 22/43] [PATCH] MTD git tree location added to MAINTAINERS Here's the MTD one. More later as I find them. Signed-off-by: Josh Boyer Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index c5cf7d7e58b2..1e84be387420 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1695,6 +1695,7 @@ P: David Woodhouse M: dwmw2@infradead.org W: http://www.linux-mtd.infradead.org/ L: linux-mtd@lists.infradead.org +T: git kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6.git S: Maintained MICROTEK X6 SCANNER From 50306fb5398f0aac65047c966a4341adee37f512 Mon Sep 17 00:00:00 2001 From: Jody McIntyre Date: Wed, 23 Nov 2005 15:44:03 -0800 Subject: [PATCH 23/43] [PATCH] Clarify T: field in MAINTAINERS Pavel Machek points out that for git repos, what we include is not actually a URL. It is undesirable to use a URL since git repos can be accessed in many different ways. Signed-off-by: Jody McIntyre Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 1e84be387420..6238c63c2be8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -58,7 +58,7 @@ P: Person M: Mail patches to L: Mailing list that is relevant to this area W: Web-page with status/info -T: SCM tree type and URL. Type is one of: git, hg, quilt. +T: SCM tree type and location. Type is one of: git, hg, quilt. S: Status, one of the following: Supported: Someone is actually paid to look after this. From 1adc123079207bf9ba5bcf3dbf52bcdb22f82c7c Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Wed, 23 Nov 2005 15:44:15 -0800 Subject: [PATCH 24/43] [PATCH] Add more SCM trees to MAINTAINERS Greg requested a patch to update MAINTAINERS with more SCM entries. The patch below is what I've found so far. Signed-off-by: Josh Boyer Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- MAINTAINERS | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6238c63c2be8..a74a0c726134 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -227,6 +227,7 @@ AGPGART DRIVER P: Dave Jones M: davej@codemonkey.org.uk W: http://www.codemonkey.org.uk/projects/agp/ +T: git kernel.org:/pub/scm/linux/kernel/git/davej/agpgart.git S: Maintained AHA152X SCSI DRIVER @@ -384,6 +385,7 @@ P: David Woodhouse M: dwmw2@infradead.org L: linux-audit@redhat.com W: http://people.redhat.com/sgrubb/audit/ +T: git kernel.org:/pub/scm/linux/kernel/git/dwmw2/audit-2.6.git S: Maintained AX.25 NETWORK LAYER @@ -432,6 +434,7 @@ L: bluez-devel@lists.sf.net W: http://bluez.sf.net W: http://www.bluez.org W: http://www.holtmann.org/linux/bluetooth/ +T: git kernel.org:/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6.git S: Maintained BLUETOOTH RFCOMM LAYER @@ -547,6 +550,7 @@ P: Steve French M: sfrench@samba.org L: samba-technical@lists.samba.org W: http://us1.samba.org/samba/Linux_CIFS_client.html +T: git kernel.org:/pub/scm/linux/kernel/git/sfrench/cifs-2.6.git S: Supported CIRRUS LOGIC GENERIC FBDEV DRIVER @@ -608,6 +612,7 @@ P: Dave Jones M: davej@codemonkey.org.uk L: cpufreq@lists.linux.org.uk W: http://www.codemonkey.org.uk/projects/cpufreq/ +T: git kernel.org/pub/scm/linux/kernel/davej/cpufreq.git S: Maintained CPUID/MSR DRIVER @@ -641,6 +646,7 @@ M: herbert@gondor.apana.org.au P: David S. Miller M: davem@davemloft.net L: linux-crypto@vger.kernel.org +T: git kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6.git S: Maintained CYBERPRO FB DRIVER @@ -1185,6 +1191,7 @@ P: Bartlomiej Zolnierkiewicz M: B.Zolnierkiewicz@elka.pw.edu.pl L: linux-kernel@vger.kernel.org L: linux-ide@vger.kernel.org +T: git kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6.git S: Maintained IDE/ATAPI CDROM DRIVER @@ -1279,6 +1286,7 @@ P: Vojtech Pavlik M: vojtech@suse.cz L: linux-input@atrey.karlin.mff.cuni.cz L: linux-joystick@atrey.karlin.mff.cuni.cz +T: git kernel.org:/pub/scm/linux/kernel/git/dtor/input.git S: Maintained INOTIFY @@ -1392,6 +1400,7 @@ P: Kai Germaschewski M: kai.germaschewski@gmx.de L: isdn4linux@listserv.isdn4linux.de W: http://www.isdn4linux.de +T: git kernel.org:/pub/scm/linux/kernel/kkeil/isdn-2.6.git S: Maintained ISDN SUBSYSTEM (Eicon active card driver) @@ -1420,6 +1429,7 @@ P: Dave Kleikamp M: shaggy@austin.ibm.com L: jfs-discussion@lists.sourceforge.net W: http://jfs.sourceforge.net/ +T: git kernel.org:/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git S: Supported KCONFIG @@ -1534,6 +1544,7 @@ P: Paul Mackerras M: paulus@samba.org W: http://www.penguinppc.org/ L: linuxppc-dev@ozlabs.org +T: git kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc.git S: Supported LINUX FOR POWER MACINTOSH @@ -1601,6 +1612,7 @@ P: Chris Wright M: chrisw@osdl.org L: linux-security-module@wirex.com W: http://lsm.immunix.org +T: git kernel.org:/pub/scm/linux/kernel/git/chrisw/lsm-2.6.git S: Supported LM83 HARDWARE MONITOR DRIVER @@ -1816,6 +1828,7 @@ M: yoshfuji@linux-ipv6.org P: Patrick McHardy M: kaber@coreworks.de L: netdev@vger.kernel.org +T: git kernel.org:/pub/scm/linux/kernel/davem/net-2.6.git S: Maintained IPVS @@ -1867,6 +1880,7 @@ M: aia21@cantab.net L: linux-ntfs-dev@lists.sourceforge.net L: linux-kernel@vger.kernel.org W: http://linux-ntfs.sf.net/ +T: git kernel.org:/pub/scm/linux/kernel/git/aia21/ntfs-2.6.git S: Maintained NVIDIA (RIVA) FRAMEBUFFER DRIVER @@ -2390,6 +2404,7 @@ P: Anton Blanchard M: anton@samba.org L: sparclinux@vger.kernel.org L: ultralinux@vger.kernel.org +T: git kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6.git S: Maintained SHARP LH SUPPORT (LH7952X & LH7A40X) @@ -2528,6 +2543,7 @@ P: Adrian Bunk M: trivial@kernel.org L: linux-kernel@vger.kernel.org W: http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/ +T: git kernel.org:/pub/scm/linux/kernel/git/bunk/trivial.git S: Maintained TMS380 TOKEN-RING NETWORK DRIVER @@ -2861,6 +2877,7 @@ P: Latchesar Ionkov M: lucho@ionkov.net L: v9fs-developer@lists.sourceforge.net W: http://v9fs.sf.net +T: git kernel.org:/pub/scm/linux/kernel/ericvh/v9fs-devel.git S: Maintained VIDEO FOR LINUX From 2723ab91cb4019def10bdb01b0fecb85e6ac7884 Mon Sep 17 00:00:00 2001 From: Yuan Mu Date: Wed, 23 Nov 2005 15:44:21 -0800 Subject: [PATCH 25/43] [PATCH] hwmon: Fix missing boundary check when setting W83627THF in0 limits Add SENSORS_LIMIT in store VCore limit functions. This fixes a potential u8 overflow on out-of-range user input. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/hwmon/w83627hf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 4e9a04e1f08e..bbb3dcde146b 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c @@ -456,7 +456,9 @@ static ssize_t store_regs_in_min0(struct device *dev, struct device_attribute *a (w83627thf == data->type || w83637hf == data->type)) /* use VRM9 calculation */ - data->in_min[0] = (u8)(((val * 100) - 70000 + 244) / 488); + data->in_min[0] = + SENSORS_LIMIT(((val * 100) - 70000 + 244) / 488, 0, + 255); else /* use VRM8 (standard) calculation */ data->in_min[0] = IN_TO_REG(val); @@ -481,7 +483,9 @@ static ssize_t store_regs_in_max0(struct device *dev, struct device_attribute *a (w83627thf == data->type || w83637hf == data->type)) /* use VRM9 calculation */ - data->in_max[0] = (u8)(((val * 100) - 70000 + 244) / 488); + data->in_max[0] = + SENSORS_LIMIT(((val * 100) - 70000 + 244) / 488, 0, + 255); else /* use VRM8 (standard) calculation */ data->in_max[0] = IN_TO_REG(val); From d0d3cd6965d8e957764663cbb5aaa5ff486a2616 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 23 Nov 2005 15:44:26 -0800 Subject: [PATCH 26/43] [PATCH] hwmon: Fix lm78 VID conversion Fix the lm78 VID reading, which I accidentally broke while making this driver use the common vid_from_reg function rather than reimplementing its own in 2.6.14-rc1. I'm not proud of it, trust me. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/hwmon/lm78.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index bde0cda9477e..78cdd506439f 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c @@ -451,7 +451,7 @@ static DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_3_div, NULL); static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) { struct lm78_data *data = lm78_update_device(dev); - return sprintf(buf, "%d\n", vid_from_reg(82, data->vid)); + return sprintf(buf, "%d\n", vid_from_reg(data->vid, 82)); } static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); From 07eab46db7f78b2ed49bc9e41eda80695f93886f Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 23 Nov 2005 15:44:31 -0800 Subject: [PATCH 27/43] [PATCH] hwmon: Fix missing it87 fan div init Fix a bug where setting the low fan speed limits will not work if no data was ever read through the sysfs interface and the fan clock dividers have not been explicitely set yet either. The reason is that data->fan_div[nr] may currently be used before it is initialized from the chip register values. The fix is to explicitely initialize data->fan_div[nr] before using it. Bug reported, and fix tested, by Nicolas Mailhot. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/hwmon/it87.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 6c41e25e670b..a61f5d00f10a 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -522,8 +522,15 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, struct i2c_client *client = to_i2c_client(dev); struct it87_data *data = i2c_get_clientdata(client); int val = simple_strtol(buf, NULL, 10); + u8 reg = it87_read_value(client, IT87_REG_FAN_DIV); down(&data->update_lock); + switch (nr) { + case 0: data->fan_div[nr] = reg & 0x07; break; + case 1: data->fan_div[nr] = (reg >> 3) & 0x07; break; + case 2: data->fan_div[nr] = (reg & 0x40) ? 3 : 1; break; + } + data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]); up(&data->update_lock); From 657a19ebb74128ec52f20b7e34705bdeadc59400 Mon Sep 17 00:00:00 2001 From: Eugeniy Meshcheryakov Date: Wed, 23 Nov 2005 15:44:35 -0800 Subject: [PATCH 28/43] [PATCH] hwmon: hdaps missing an axis Trivial patch to report both hdaps axises to the joystick device, not just the X axis. Signed-off-by: Robert Love Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/hwmon/hdaps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c index c81bd4bce1b8..23a9e1ea8e32 100644 --- a/drivers/hwmon/hdaps.c +++ b/drivers/hwmon/hdaps.c @@ -570,7 +570,7 @@ static int __init hdaps_init(void) hdaps_idev->evbit[0] = BIT(EV_ABS); input_set_abs_params(hdaps_idev, ABS_X, -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); - input_set_abs_params(hdaps_idev, ABS_X, + input_set_abs_params(hdaps_idev, ABS_Y, -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); input_register_device(hdaps_idev); From dcb890749bbe63af96163c499e9c86b441fb6c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=E4kia?= Date: Wed, 23 Nov 2005 15:44:49 -0800 Subject: [PATCH 29/43] [PATCH] PCI: trivial printk updates in common.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified common.c so it's using the appropriate KERN_* in printk() calls. Signed-off-by: Daniel Marjamäkia Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- arch/i386/pci/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c index c96bea14b98f..f6bc48da4d2a 100644 --- a/arch/i386/pci/common.c +++ b/arch/i386/pci/common.c @@ -132,7 +132,7 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum) } } - printk("PCI: Probing PCI hardware (bus %02x)\n", busnum); + printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum); return pci_scan_bus_parented(NULL, busnum, &pci_root_ops, NULL); } @@ -144,7 +144,7 @@ static int __init pcibios_init(void) struct cpuinfo_x86 *c = &boot_cpu_data; if (!raw_pci_ops) { - printk("PCI: System does not support PCI\n"); + printk(KERN_WARNING "PCI: System does not support PCI\n"); return 0; } From 5a49f2036ad14092c11d09f186da86fd5ae49a05 Mon Sep 17 00:00:00 2001 From: Rajesh Shah Date: Wed, 23 Nov 2005 15:44:54 -0800 Subject: [PATCH 30/43] [PATCH] PCI Express Hotplug: clear sticky power-fault bit Per the PCI Express spec, the power-fault-detected bit in the slot status register can be set anytime hardware detects a power fault, regardless of whether the slot has a device populated in it or not. This bit is sticky and must be explicitly cleared. This patch is needed to allow hot-add after such a power fault has been detected. Signed-off-by: Rajesh Shah Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/pci/hotplug/pciehp.h | 1 - drivers/pci/hotplug/pciehp_ctrl.c | 15 ++------------- drivers/pci/hotplug/pciehp_hpc.c | 10 +++++++++- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index c42b68d3aa24..6a61b9f286e1 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h @@ -59,7 +59,6 @@ struct slot { struct slot *next; u8 bus; u8 device; - u16 status; u32 number; u8 state; struct timer_list task_event; diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 5e582eca21d8..83c4b865718a 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c @@ -207,7 +207,6 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) * power fault Cleared */ info("Power fault cleared on Slot(%d)\n", ctrl->first_slot + hp_slot); - p_slot->status = 0x00; taskInfo->event_type = INT_POWER_FAULT_CLEAR; } else { /* @@ -215,8 +214,6 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) */ info("Power fault on Slot(%d)\n", ctrl->first_slot + hp_slot); taskInfo->event_type = INT_POWER_FAULT; - /* set power fault status for this board */ - p_slot->status = 0xFF; info("power fault bit %x set\n", hp_slot); } if (rc) @@ -317,13 +314,10 @@ static int board_added(struct slot *p_slot) return rc; } - dbg("%s: slot status = %x\n", __FUNCTION__, p_slot->status); - /* Check for a power fault */ - if (p_slot->status == 0xFF) { - /* power fault occurred, but it was benign */ + if (p_slot->hpc_ops->query_power_fault(p_slot)) { + dbg("%s: power fault detected\n", __FUNCTION__); rc = POWER_FAILURE; - p_slot->status = 0; goto err_exit; } @@ -334,8 +328,6 @@ static int board_added(struct slot *p_slot) goto err_exit; } - p_slot->status = 0; - /* * Some PCI Express root ports require fixup after hot-plug operation. */ @@ -382,9 +374,6 @@ static int remove_board(struct slot *p_slot) dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); - /* Change status to shutdown */ - p_slot->status = 0x01; - /* Wait for exclusive access to hardware */ down(&ctrl->crit_sect); diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 2387e75da0fe..0b8b26beb163 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -750,7 +750,7 @@ static int hpc_power_on_slot(struct slot * slot) { struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; u16 slot_cmd; - u16 slot_ctrl; + u16 slot_ctrl, slot_status; int retval = 0; @@ -767,6 +767,14 @@ static int hpc_power_on_slot(struct slot * slot) return -1; } + /* Clear sticky power-fault bit from previous power failures */ + hp_register_read_word(php_ctlr->pci_dev, + SLOT_STATUS(slot->ctrl->cap_base), slot_status); + slot_status &= PWR_FAULT_DETECTED; + if (slot_status) + hp_register_write_word(php_ctlr->pci_dev, + SLOT_STATUS(slot->ctrl->cap_base), slot_status); + retval = hp_register_read_word(php_ctlr->pci_dev, SLOT_CTRL(slot->ctrl->cap_base), slot_ctrl); if (retval) { From ed6d14f9760857c745206c978b80352fc09cfd19 Mon Sep 17 00:00:00 2001 From: Rajesh Shah Date: Wed, 23 Nov 2005 15:44:59 -0800 Subject: [PATCH 31/43] [PATCH] PCI: remove bogus resource collision error When attempting to hotadd a PCI card with a bridge on it, I saw the kernel reporting resource collision errors even when there were really no collisions. The problem is that the code doesn't skip over "invalid" resources with their resource type flag not set. Others have reported similar problems at boot time and for non-bridge PCI card hotplug too, where the code flags a resource collision for disabled ROMs. This patch fixes both problems. Signed-off-by: Rajesh Shah Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- arch/i386/pci/i386.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/i386/pci/i386.c b/arch/i386/pci/i386.c index 6d6338500c3c..ed2c8c899bd3 100644 --- a/arch/i386/pci/i386.c +++ b/arch/i386/pci/i386.c @@ -221,6 +221,11 @@ int pcibios_enable_resources(struct pci_dev *dev, int mask) continue; r = &dev->resource[idx]; + if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM))) + continue; + if ((idx == PCI_ROM_RESOURCE) && + (!(r->flags & IORESOURCE_ROM_ENABLE))) + continue; if (!r->start && r->end) { printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev)); return -EINVAL; @@ -230,8 +235,6 @@ int pcibios_enable_resources(struct pci_dev *dev, int mask) if (r->flags & IORESOURCE_MEM) cmd |= PCI_COMMAND_MEMORY; } - if (dev->resource[PCI_ROM_RESOURCE].start) - cmd |= PCI_COMMAND_MEMORY; if (cmd != old_cmd) { printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd); pci_write_config_word(dev, PCI_COMMAND, cmd); From f366633fc31db1668b4c261e94816d7304ae9810 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 23 Nov 2005 15:45:04 -0800 Subject: [PATCH 32/43] [PATCH] PCI: kernel-doc fix for pci-acpi.c Fix kernel-doc warning in pci/pci-acpi.c. Signed-off-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/pci/pci-acpi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index a9b00cc2d885..6917c6cb0912 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -178,6 +178,7 @@ EXPORT_SYMBOL(pci_osc_support_set); /** * pci_osc_control_set - commit requested control to Firmware + * @handle: acpi_handle for the target ACPI object * @flags: driver's requested control bits * * Attempt to take control from Firmware on requested control bits. From cac1a293469a868fab1ecc2dc1b6441728f7e0e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=E4ki?= Date: Wed, 23 Nov 2005 15:45:09 -0800 Subject: [PATCH 33/43] [PATCH] PCI: direct.c: DBG MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DBG() call where updated with the appropriate KERN_* symbol. Signed-off-by: Daniel Marjamäki Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- arch/i386/pci/direct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/i386/pci/direct.c b/arch/i386/pci/direct.c index 30b7e9b4f6a2..94331d6be7a3 100644 --- a/arch/i386/pci/direct.c +++ b/arch/i386/pci/direct.c @@ -201,7 +201,7 @@ static int __init pci_sanity_check(struct pci_raw_ops *o) return 1; } - DBG("PCI: Sanity check failed\n"); + DBG(KERN_WARNING "PCI: Sanity check failed\n"); return 0; } From 0b67ba63605a0107f4f3f6d928cdea1e8953fb63 Mon Sep 17 00:00:00 2001 From: Damian Wrobel Date: Wed, 23 Nov 2005 15:45:17 -0800 Subject: [PATCH 34/43] [PATCH] USB: SN9C10x driver - bad page state fix This patch solves the following problem I've already discovered on the latest 2.6.15-rc1-git1 kernel: Nov 13 07:37:28 wrobel kernel: Bad page state at free_hot_cold_page (in process 'motion', page c164e020) Nov 13 07:37:28 wrobel kernel: flags:0x40000400 mapping:00000000 mapcount:0 count:0 Nov 13 07:37:28 wrobel kernel: Backtrace: Nov 13 07:37:28 wrobel kernel: [] bad_page+0x85/0xbe Nov 13 07:37:28 wrobel kernel: [] free_hot_cold_page+0x54/0x129 Nov 13 07:37:28 wrobel kernel: [] __vunmap+0xa9/0xfe Nov 13 07:37:28 wrobel kernel: [] vmalloc_to_page+0x34/0x55 Nov 13 07:37:28 wrobel kernel: [] vfree+0x27/0x35 Nov 13 07:37:28 wrobel kernel: [] sn9c102_release_buffers+0x30/0x3f [sn9c102] Nov 13 07:37:28 wrobel kernel: [] sn9c102_release+0x37/0xeb [sn9c102] Nov 13 07:37:28 wrobel kernel: [] __fput+0xa9/0x1aa Nov 13 07:37:28 wrobel kernel: [] filp_close+0x49/0x6d Nov 13 07:37:30 wrobel kernel: [] sys_close+0x74/0x95 Nov 13 07:37:30 wrobel kernel: [] syscall_call+0x7/0xb Nov 13 07:37:31 wrobel kernel: Trying to fix it up, but a reboot is needed Signed-off-by: Damian Wrobel Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/media/sn9c102_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/media/sn9c102_core.c b/drivers/usb/media/sn9c102_core.c index cf8cfbabefde..b2e66e3b90aa 100644 --- a/drivers/usb/media/sn9c102_core.c +++ b/drivers/usb/media/sn9c102_core.c @@ -199,7 +199,7 @@ static void sn9c102_release_buffers(struct sn9c102_device* cam) { if (cam->nbuffers) { rvfree(cam->frame[0].bufmem, - cam->nbuffers * cam->frame[0].buf.length); + cam->nbuffers * PAGE_ALIGN(cam->frame[0].buf.length)); cam->nbuffers = 0; } } From b4723ae3cc66fd067a8e661b5c05d5bd41be29b5 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 23 Nov 2005 15:45:23 -0800 Subject: [PATCH 35/43] [PATCH] USB: ftdi_sio: new IDs for KOBIL devices This patch adds two new devices to the ftdi_sio driver's device ID table. The device IDs were supplied by Stefan Nies of KOBIL Systems for two of their devices using the FTDI chip. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio.h | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 61204bf7cd78..06e04b442ff1 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -475,6 +475,8 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) }, + { USB_DEVICE(KOBIL_VID, KOBIL_CONV_B1_PID) }, + { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, { }, /* Optional parameter entry */ { } /* Terminating entry */ }; diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index ddb63df31ce6..773ea3eca086 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h @@ -127,6 +127,13 @@ #define SEALEVEL_2803_7_PID 0X2873 /* SeaLINK+8 (2803) Port 7 */ #define SEALEVEL_2803_8_PID 0X2883 /* SeaLINK+8 (2803) Port 8 */ +/* + * The following are the values for two KOBIL chipcard terminals. + */ +#define KOBIL_VID 0x0d46 /* KOBIL Vendor ID */ +#define KOBIL_CONV_B1_PID 0x2020 /* KOBIL Konverter for B1 */ +#define KOBIL_CONV_KAAN_PID 0x2021 /* KOBIL_Konverter for KAAN */ + /* * DSS-20 Sync Station for Sony Ericsson P800 */ From f03c17fc9abe8582d6ad830290b3093fdf1eea61 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Wed, 23 Nov 2005 15:45:28 -0800 Subject: [PATCH 36/43] [PATCH] USB: EHCI updates This fixes some bugs in EHCI suspend/resume that joined us over the past few releases (as usbcore, PCI, pmcore, and other components evolved): - Removes suspend and resume recursion from the EHCI driver, getting rid of the USB_SUSPEND special casing. - Updates the wakeup mechanism to work again; there's a newish usbcore call it needs to use. - Provide simpler tests for "do we need to restart from scratch", to address another case where PCI Vaux was lost. (In this case it was restoring a swsusp snapshot, but there could be others.) Un-exports a symbol that was temporarily exported. A notable change from previous version is that this doesn't move the spinlock init, so there's still a resume/reinit path bug. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/core/hub.c | 1 - drivers/usb/host/ehci-hcd.c | 3 +- drivers/usb/host/ehci-hub.c | 7 ++++ drivers/usb/host/ehci-pci.c | 71 ++++++++++++++++++------------------- 4 files changed, 43 insertions(+), 39 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 840727948d84..f78bd124d290 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1669,7 +1669,6 @@ int usb_suspend_device(struct usb_device *udev) return 0; #endif } -EXPORT_SYMBOL_GPL(usb_suspend_device); /* * If the USB "suspend" state is in use (rather than "global suspend"), diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index af3c05eb86fc..f15144e96e14 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -636,9 +636,8 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs) * stop that signaling. */ ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); - mod_timer (&hcd->rh_timer, - ehci->reset_done [i] + 1); ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); + usb_hcd_resume_root_hub(hcd); } } diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 88cb4ada686e..82caf336e9b6 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -94,6 +94,13 @@ static int ehci_bus_resume (struct usb_hcd *hcd) msleep(5); spin_lock_irq (&ehci->lock); + /* Ideally and we've got a real resume here, and no port's power + * was lost. (For PCI, that means Vaux was maintained.) But we + * could instead be restoring a swsusp snapshot -- so that BIOS was + * the last user of the controller, not reset/pm hardware keeping + * state we gave to it. + */ + /* re-init operational registers in case we lost power */ if (readl (&ehci->regs->intr_enable) == 0) { /* at least some APM implementations will try to deliver diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index dfd9bd0b1828..0f2be91e5e0e 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c @@ -235,10 +235,11 @@ static void ehci_pci_stop (struct usb_hcd *hcd) /* suspend/resume, section 4.3 */ -/* These routines rely on the bus (pci, platform, etc) +/* These routines rely on the PCI bus glue * to handle powerdown and wakeup, and currently also on * transceivers that don't need any software attention to set up * the right sort of wakeup. + * Also they depend on separate root hub suspend/resume. */ static int ehci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) @@ -246,17 +247,9 @@ static int ehci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) struct ehci_hcd *ehci = hcd_to_ehci (hcd); if (time_before (jiffies, ehci->next_statechange)) - msleep (100); + msleep (10); -#ifdef CONFIG_USB_SUSPEND - (void) usb_suspend_device (hcd->self.root_hub); -#else - usb_lock_device (hcd->self.root_hub); - (void) ehci_bus_suspend (hcd); - usb_unlock_device (hcd->self.root_hub); -#endif - - // save (PCI) FLADJ in case of Vaux power loss + // could save FLADJ in case of Vaux power loss // ... we'd only use it to handle clock skew return 0; @@ -269,13 +262,18 @@ static int ehci_pci_resume (struct usb_hcd *hcd) struct usb_device *root = hcd->self.root_hub; int retval = -EINVAL; - // maybe restore (PCI) FLADJ + // maybe restore FLADJ if (time_before (jiffies, ehci->next_statechange)) msleep (100); + /* If CF is clear, we lost PCI Vaux power and need to restart. */ + if (readl (&ehci->regs->configured_flag) != cpu_to_le32(FLAG_CF)) + goto restart; + /* If any port is suspended (or owned by the companion), * we know we can/must resume the HC (and mustn't reset it). + * We just defer that to the root hub code. */ for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) { u32 status; @@ -283,42 +281,43 @@ static int ehci_pci_resume (struct usb_hcd *hcd) status = readl (&ehci->regs->port_status [port]); if (!(status & PORT_POWER)) continue; - if (status & (PORT_SUSPEND | PORT_OWNER)) { - down (&hcd->self.root_hub->serialize); - retval = ehci_bus_resume (hcd); - up (&hcd->self.root_hub->serialize); - break; + if (status & (PORT_SUSPEND | PORT_RESUME | PORT_OWNER)) { + usb_hcd_resume_root_hub(hcd); + return 0; } + } + +restart: + ehci_dbg(ehci, "lost power, restarting\n"); + for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) { + port--; if (!root->children [port]) continue; - dbg_port (ehci, __FUNCTION__, port + 1, status); usb_set_device_state (root->children[port], USB_STATE_NOTATTACHED); } /* Else reset, to cope with power loss or flush-to-storage - * style "resume" having activated BIOS during reboot. + * style "resume" having let BIOS kick in during reboot. */ - if (port == 0) { - (void) ehci_halt (ehci); - (void) ehci_reset (ehci); - (void) ehci_pci_reset (hcd); + (void) ehci_halt (ehci); + (void) ehci_reset (ehci); + (void) ehci_pci_reset (hcd); - /* emptying the schedule aborts any urbs */ - spin_lock_irq (&ehci->lock); - if (ehci->reclaim) - ehci->reclaim_ready = 1; - ehci_work (ehci, NULL); - spin_unlock_irq (&ehci->lock); + /* emptying the schedule aborts any urbs */ + spin_lock_irq (&ehci->lock); + if (ehci->reclaim) + ehci->reclaim_ready = 1; + ehci_work (ehci, NULL); + spin_unlock_irq (&ehci->lock); - /* restart; khubd will disconnect devices */ - retval = ehci_run (hcd); + /* restart; khubd will disconnect devices */ + retval = ehci_run (hcd); - /* here we "know" root ports should always stay powered; - * but some controllers may lose all power. - */ - ehci_port_power (ehci, 1); - } + /* here we "know" root ports should always stay powered; + * but some controllers may lose all power. + */ + ehci_port_power (ehci, 1); return retval; } From abcc94480634f6fe9fc29b821261e8162c87ddd2 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Wed, 23 Nov 2005 15:45:32 -0800 Subject: [PATCH 37/43] [PATCH] USB: EHCI updates mostly whitespace cleanups This cleans up the recent updates to EHCI PCI support: - Gets rid of checks for "is this a PCI device", they're no longer needed since this is now all PCI-only code. - Reduce log spamming: MWI is only interesting in the atypical case that it can actually be used. - Whitespace cleanup, as appropriate for a new file with no other pending patches. So other than that minor logging change, no functional updates. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/host/ehci-pci.c | 260 +++++++++++++++++------------------- 1 file changed, 125 insertions(+), 135 deletions(-) diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 0f2be91e5e0e..b654e3f800b4 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c @@ -27,7 +27,7 @@ /* EHCI 0.96 (and later) section 5.1 says how to kick BIOS/SMM/... * off the controller (maybe it can boot from highspeed USB disks). */ -static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap) +static int bios_handoff(struct ehci_hcd *ehci, int where, u32 cap) { struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller); @@ -48,7 +48,7 @@ static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap) where, cap); // some BIOS versions seem buggy... // return 1; - ehci_warn (ehci, "continuing after BIOS bug...\n"); + ehci_warn(ehci, "continuing after BIOS bug...\n"); /* disable all SMIs, and clear "BIOS owns" flag */ pci_write_config_dword(pdev, where + 4, 0); pci_write_config_byte(pdev, where + 2, 0); @@ -59,95 +59,93 @@ static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap) } /* called by khubd or root hub init threads */ -static int ehci_pci_reset (struct usb_hcd *hcd) +static int ehci_pci_reset(struct usb_hcd *hcd) { - struct ehci_hcd *ehci = hcd_to_ehci (hcd); + struct ehci_hcd *ehci = hcd_to_ehci(hcd); + struct pci_dev *pdev = to_pci_dev(hcd->self.controller); u32 temp; unsigned count = 256/4; spin_lock_init (&ehci->lock); ehci->caps = hcd->regs; - ehci->regs = hcd->regs + HC_LENGTH (readl (&ehci->caps->hc_capbase)); - dbg_hcs_params (ehci, "reset"); - dbg_hcc_params (ehci, "reset"); + ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase)); + dbg_hcs_params(ehci, "reset"); + dbg_hcc_params(ehci, "reset"); /* cache this readonly data; minimize chip reads */ - ehci->hcs_params = readl (&ehci->caps->hcs_params); + ehci->hcs_params = readl(&ehci->caps->hcs_params); - if (hcd->self.controller->bus == &pci_bus_type) { - struct pci_dev *pdev = to_pci_dev(hcd->self.controller); + /* NOTE: only the parts below this line are PCI-specific */ - switch (pdev->vendor) { - case PCI_VENDOR_ID_TDI: - if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { - ehci->is_tdi_rh_tt = 1; - tdi_reset (ehci); - } - break; - case PCI_VENDOR_ID_AMD: - /* AMD8111 EHCI doesn't work, according to AMD errata */ - if (pdev->device == 0x7463) { - ehci_info (ehci, "ignoring AMD8111 (errata)\n"); - return -EIO; - } - break; - case PCI_VENDOR_ID_NVIDIA: - /* NVidia reports that certain chips don't handle - * QH, ITD, or SITD addresses above 2GB. (But TD, - * data buffer, and periodic schedule are normal.) - */ - switch (pdev->device) { - case 0x003c: /* MCP04 */ - case 0x005b: /* CK804 */ - case 0x00d8: /* CK8 */ - case 0x00e8: /* CK8S */ - if (pci_set_consistent_dma_mask(pdev, - DMA_31BIT_MASK) < 0) - ehci_warn (ehci, "can't enable NVidia " - "workaround for >2GB RAM\n"); - break; - } + switch (pdev->vendor) { + case PCI_VENDOR_ID_TDI: + if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { + ehci->is_tdi_rh_tt = 1; + tdi_reset(ehci); + } + break; + case PCI_VENDOR_ID_AMD: + /* AMD8111 EHCI doesn't work, according to AMD errata */ + if (pdev->device == 0x7463) { + ehci_info(ehci, "ignoring AMD8111 (errata)\n"); + return -EIO; + } + break; + case PCI_VENDOR_ID_NVIDIA: + /* NVidia reports that certain chips don't handle + * QH, ITD, or SITD addresses above 2GB. (But TD, + * data buffer, and periodic schedule are normal.) + */ + switch (pdev->device) { + case 0x003c: /* MCP04 */ + case 0x005b: /* CK804 */ + case 0x00d8: /* CK8 */ + case 0x00e8: /* CK8S */ + if (pci_set_consistent_dma_mask(pdev, + DMA_31BIT_MASK) < 0) + ehci_warn(ehci, "can't enable NVidia " + "workaround for >2GB RAM\n"); break; } + break; + } - /* optional debug port, normally in the first BAR */ - temp = pci_find_capability (pdev, 0x0a); - if (temp) { - pci_read_config_dword(pdev, temp, &temp); - temp >>= 16; - if ((temp & (3 << 13)) == (1 << 13)) { - temp &= 0x1fff; - ehci->debug = hcd->regs + temp; - temp = readl (&ehci->debug->control); - ehci_info (ehci, "debug port %d%s\n", - HCS_DEBUG_PORT(ehci->hcs_params), - (temp & DBGP_ENABLED) - ? " IN USE" - : ""); - if (!(temp & DBGP_ENABLED)) - ehci->debug = NULL; - } + /* optional debug port, normally in the first BAR */ + temp = pci_find_capability(pdev, 0x0a); + if (temp) { + pci_read_config_dword(pdev, temp, &temp); + temp >>= 16; + if ((temp & (3 << 13)) == (1 << 13)) { + temp &= 0x1fff; + ehci->debug = hcd->regs + temp; + temp = readl(&ehci->debug->control); + ehci_info(ehci, "debug port %d%s\n", + HCS_DEBUG_PORT(ehci->hcs_params), + (temp & DBGP_ENABLED) + ? " IN USE" + : ""); + if (!(temp & DBGP_ENABLED)) + ehci->debug = NULL; } + } - temp = HCC_EXT_CAPS (readl (&ehci->caps->hcc_params)); - } else - temp = 0; + temp = HCC_EXT_CAPS(readl(&ehci->caps->hcc_params)); /* EHCI 0.96 and later may have "extended capabilities" */ while (temp && count--) { u32 cap; - pci_read_config_dword (to_pci_dev(hcd->self.controller), + pci_read_config_dword(to_pci_dev(hcd->self.controller), temp, &cap); - ehci_dbg (ehci, "capability %04x at %02x\n", cap, temp); + ehci_dbg(ehci, "capability %04x at %02x\n", cap, temp); switch (cap & 0xff) { case 1: /* BIOS/SMM/... handoff */ - if (bios_handoff (ehci, temp, cap) != 0) + if (bios_handoff(ehci, temp, cap) != 0) return -EOPNOTSUPP; break; case 0: /* illegal reserved capability */ - ehci_warn (ehci, "illegal capability!\n"); + ehci_warn(ehci, "illegal capability!\n"); cap = 0; /* FALLTHROUGH */ default: /* unknown */ @@ -156,77 +154,69 @@ static int ehci_pci_reset (struct usb_hcd *hcd) temp = (cap >> 8) & 0xff; } if (!count) { - ehci_err (ehci, "bogus capabilities ... PCI problems!\n"); + ehci_err(ehci, "bogus capabilities ... PCI problems!\n"); return -EIO; } if (ehci_is_TDI(ehci)) - ehci_reset (ehci); + ehci_reset(ehci); - ehci_port_power (ehci, 0); + ehci_port_power(ehci, 0); /* at least the Genesys GL880S needs fixup here */ temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params); temp &= 0x0f; if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) { - ehci_dbg (ehci, "bogus port configuration: " + ehci_dbg(ehci, "bogus port configuration: " "cc=%d x pcc=%d < ports=%d\n", HCS_N_CC(ehci->hcs_params), HCS_N_PCC(ehci->hcs_params), HCS_N_PORTS(ehci->hcs_params)); - if (hcd->self.controller->bus == &pci_bus_type) { - struct pci_dev *pdev; - - pdev = to_pci_dev(hcd->self.controller); - switch (pdev->vendor) { - case 0x17a0: /* GENESYS */ - /* GL880S: should be PORTS=2 */ - temp |= (ehci->hcs_params & ~0xf); - ehci->hcs_params = temp; - break; - case PCI_VENDOR_ID_NVIDIA: - /* NF4: should be PCC=10 */ - break; - } + switch (pdev->vendor) { + case 0x17a0: /* GENESYS */ + /* GL880S: should be PORTS=2 */ + temp |= (ehci->hcs_params & ~0xf); + ehci->hcs_params = temp; + break; + case PCI_VENDOR_ID_NVIDIA: + /* NF4: should be PCC=10 */ + break; } } /* force HC to halt state */ - return ehci_halt (ehci); + return ehci_halt(ehci); } -static int ehci_pci_start (struct usb_hcd *hcd) +static int ehci_pci_start(struct usb_hcd *hcd) { - struct ehci_hcd *ehci = hcd_to_ehci (hcd); - int result = 0; + struct ehci_hcd *ehci = hcd_to_ehci(hcd); + int result = 0; + struct pci_dev *pdev; + u16 port_wake; - if (hcd->self.controller->bus == &pci_bus_type) { - struct pci_dev *pdev; - u16 port_wake; + pdev = to_pci_dev(hcd->self.controller); - pdev = to_pci_dev(hcd->self.controller); + /* Serial Bus Release Number is at PCI 0x60 offset */ + pci_read_config_byte(pdev, 0x60, &ehci->sbrn); - /* Serial Bus Release Number is at PCI 0x60 offset */ - pci_read_config_byte(pdev, 0x60, &ehci->sbrn); + /* port wake capability, reported by boot firmware */ + pci_read_config_word(pdev, 0x62, &port_wake); + hcd->can_wakeup = (port_wake & 1) != 0; - /* port wake capability, reported by boot firmware */ - pci_read_config_word(pdev, 0x62, &port_wake); - hcd->can_wakeup = (port_wake & 1) != 0; + /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ + result = pci_set_mwi(pdev); + if (!result) + ehci_dbg(ehci, "MWI active\n"); - /* help hc dma work well with cachelines */ - result = pci_set_mwi(pdev); - if (result) - ehci_dbg(ehci, "unable to enable MWI - not fatal.\n"); - } - - return ehci_run (hcd); + return ehci_run(hcd); } /* always called by thread; normally rmmod */ -static void ehci_pci_stop (struct usb_hcd *hcd) +static void ehci_pci_stop(struct usb_hcd *hcd) { - ehci_stop (hcd); + ehci_stop(hcd); } /*-------------------------------------------------------------------------*/ @@ -242,12 +232,12 @@ static void ehci_pci_stop (struct usb_hcd *hcd) * Also they depend on separate root hub suspend/resume. */ -static int ehci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) +static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message) { - struct ehci_hcd *ehci = hcd_to_ehci (hcd); + struct ehci_hcd *ehci = hcd_to_ehci(hcd); - if (time_before (jiffies, ehci->next_statechange)) - msleep (10); + if (time_before(jiffies, ehci->next_statechange)) + msleep(10); // could save FLADJ in case of Vaux power loss // ... we'd only use it to handle clock skew @@ -255,30 +245,30 @@ static int ehci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) return 0; } -static int ehci_pci_resume (struct usb_hcd *hcd) +static int ehci_pci_resume(struct usb_hcd *hcd) { - struct ehci_hcd *ehci = hcd_to_ehci (hcd); + struct ehci_hcd *ehci = hcd_to_ehci(hcd); unsigned port; struct usb_device *root = hcd->self.root_hub; int retval = -EINVAL; // maybe restore FLADJ - if (time_before (jiffies, ehci->next_statechange)) - msleep (100); + if (time_before(jiffies, ehci->next_statechange)) + msleep(100); /* If CF is clear, we lost PCI Vaux power and need to restart. */ - if (readl (&ehci->regs->configured_flag) != cpu_to_le32(FLAG_CF)) + if (readl(&ehci->regs->configured_flag) != cpu_to_le32(FLAG_CF)) goto restart; /* If any port is suspended (or owned by the companion), * we know we can/must resume the HC (and mustn't reset it). * We just defer that to the root hub code. */ - for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) { + for (port = HCS_N_PORTS(ehci->hcs_params); port > 0; ) { u32 status; port--; - status = readl (&ehci->regs->port_status [port]); + status = readl(&ehci->regs->port_status [port]); if (!(status & PORT_POWER)) continue; if (status & (PORT_SUSPEND | PORT_RESUME | PORT_OWNER)) { @@ -289,35 +279,35 @@ static int ehci_pci_resume (struct usb_hcd *hcd) restart: ehci_dbg(ehci, "lost power, restarting\n"); - for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) { + for (port = HCS_N_PORTS(ehci->hcs_params); port > 0; ) { port--; if (!root->children [port]) continue; - usb_set_device_state (root->children[port], + usb_set_device_state(root->children[port], USB_STATE_NOTATTACHED); } /* Else reset, to cope with power loss or flush-to-storage * style "resume" having let BIOS kick in during reboot. */ - (void) ehci_halt (ehci); - (void) ehci_reset (ehci); - (void) ehci_pci_reset (hcd); + (void) ehci_halt(ehci); + (void) ehci_reset(ehci); + (void) ehci_pci_reset(hcd); /* emptying the schedule aborts any urbs */ - spin_lock_irq (&ehci->lock); + spin_lock_irq(&ehci->lock); if (ehci->reclaim) ehci->reclaim_ready = 1; - ehci_work (ehci, NULL); - spin_unlock_irq (&ehci->lock); + ehci_work(ehci, NULL); + spin_unlock_irq(&ehci->lock); /* restart; khubd will disconnect devices */ - retval = ehci_run (hcd); + retval = ehci_run(hcd); /* here we "know" root ports should always stay powered; * but some controllers may lose all power. */ - ehci_port_power (ehci, 1); + ehci_port_power(ehci, 1); return retval; } @@ -376,7 +366,7 @@ static const struct pci_device_id pci_ids [] = { { }, { /* end: all zeroes */ } }; -MODULE_DEVICE_TABLE (pci, pci_ids); +MODULE_DEVICE_TABLE(pci, pci_ids); /* pci driver glue; this is a "new style" PCI driver module */ static struct pci_driver ehci_pci_driver = { @@ -392,22 +382,22 @@ static struct pci_driver ehci_pci_driver = { #endif }; -static int __init ehci_hcd_pci_init (void) +static int __init ehci_hcd_pci_init(void) { if (usb_disabled()) return -ENODEV; - pr_debug ("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", + pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", hcd_name, - sizeof (struct ehci_qh), sizeof (struct ehci_qtd), - sizeof (struct ehci_itd), sizeof (struct ehci_sitd)); + sizeof(struct ehci_qh), sizeof(struct ehci_qtd), + sizeof(struct ehci_itd), sizeof(struct ehci_sitd)); - return pci_register_driver (&ehci_pci_driver); + return pci_register_driver(&ehci_pci_driver); } -module_init (ehci_hcd_pci_init); +module_init(ehci_hcd_pci_init); -static void __exit ehci_hcd_pci_cleanup (void) +static void __exit ehci_hcd_pci_cleanup(void) { - pci_unregister_driver (&ehci_pci_driver); + pci_unregister_driver(&ehci_pci_driver); } -module_exit (ehci_hcd_pci_cleanup); +module_exit(ehci_hcd_pci_cleanup); From 188075211cc75a31190de4a19a084e3d83ee1c89 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Wed, 23 Nov 2005 15:45:37 -0800 Subject: [PATCH 38/43] [PATCH] USB: EHCI updates split init/reinit logic for resume Moving the PCI-specific parts of the EHCI driver into their own file created a few issues ... notably on resume paths which (like swsusp) require re-initializing the controller. This patch: - Splits the EHCI startup code into run-once HCD setup code and separate "init the hardware" reinit code. (That reinit code is a superset of the "early usb handoff" code.) - Then it makes the PCI init code run both, and the resume code only run the reinit code. - It also removes needless pci wrappers around EHCI start/stop methods. - Removes a byteswap issue that would be seen on big-endian hardware. The HCD glue still doesn't actually provide a good way to do all this run-one init stuff in one place though. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/host/ehci-hcd.c | 155 +++++++++++++++++---------------- drivers/usb/host/ehci-pci.c | 166 +++++++++++++++++------------------- 2 files changed, 161 insertions(+), 160 deletions(-) diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index f15144e96e14..29f52a44b928 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -411,50 +411,39 @@ static void ehci_stop (struct usb_hcd *hcd) dbg_status (ehci, "ehci_stop completed", readl (&ehci->regs->status)); } -static int ehci_run (struct usb_hcd *hcd) +/* one-time init, only for memory state */ +static int ehci_init(struct usb_hcd *hcd) { - struct ehci_hcd *ehci = hcd_to_ehci (hcd); + struct ehci_hcd *ehci = hcd_to_ehci(hcd); u32 temp; int retval; u32 hcc_params; - int first; - /* skip some things on restart paths */ - first = (ehci->watchdog.data == 0); - if (first) { - init_timer (&ehci->watchdog); - ehci->watchdog.function = ehci_watchdog; - ehci->watchdog.data = (unsigned long) ehci; - } + spin_lock_init(&ehci->lock); + + init_timer(&ehci->watchdog); + ehci->watchdog.function = ehci_watchdog; + ehci->watchdog.data = (unsigned long) ehci; /* * hw default: 1K periodic list heads, one per frame. * periodic_size can shrink by USBCMD update if hcc_params allows. */ ehci->periodic_size = DEFAULT_I_TDPS; - if (first && (retval = ehci_mem_init (ehci, GFP_KERNEL)) < 0) + if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) return retval; /* controllers may cache some of the periodic schedule ... */ - hcc_params = readl (&ehci->caps->hcc_params); - if (HCC_ISOC_CACHE (hcc_params)) // full frame cache + hcc_params = readl(&ehci->caps->hcc_params); + if (HCC_ISOC_CACHE(hcc_params)) // full frame cache ehci->i_thresh = 8; else // N microframes cached - ehci->i_thresh = 2 + HCC_ISOC_THRES (hcc_params); + ehci->i_thresh = 2 + HCC_ISOC_THRES(hcc_params); ehci->reclaim = NULL; ehci->reclaim_ready = 0; ehci->next_uframe = -1; - /* controller state: unknown --> reset */ - - /* EHCI spec section 4.1 */ - if ((retval = ehci_reset (ehci)) != 0) { - ehci_mem_cleanup (ehci); - return retval; - } - writel (ehci->periodic_dma, &ehci->regs->frame_list); - /* * dedicate a qh for the async ring head, since we couldn't unlink * a 'real' qh without stopping the async schedule [4.8]. use it @@ -462,37 +451,13 @@ static int ehci_run (struct usb_hcd *hcd) * its dummy is used in hw_alt_next of many tds, to prevent the qh * from automatically advancing to the next td after short reads. */ - if (first) { - ehci->async->qh_next.qh = NULL; - ehci->async->hw_next = QH_NEXT (ehci->async->qh_dma); - ehci->async->hw_info1 = cpu_to_le32 (QH_HEAD); - ehci->async->hw_token = cpu_to_le32 (QTD_STS_HALT); - ehci->async->hw_qtd_next = EHCI_LIST_END; - ehci->async->qh_state = QH_STATE_LINKED; - ehci->async->hw_alt_next = QTD_NEXT (ehci->async->dummy->qtd_dma); - } - writel ((u32)ehci->async->qh_dma, &ehci->regs->async_next); - - /* - * hcc_params controls whether ehci->regs->segment must (!!!) - * be used; it constrains QH/ITD/SITD and QTD locations. - * pci_pool consistent memory always uses segment zero. - * streaming mappings for I/O buffers, like pci_map_single(), - * can return segments above 4GB, if the device allows. - * - * NOTE: the dma mask is visible through dma_supported(), so - * drivers can pass this info along ... like NETIF_F_HIGHDMA, - * Scsi_Host.highmem_io, and so forth. It's readonly to all - * host side drivers though. - */ - if (HCC_64BIT_ADDR (hcc_params)) { - writel (0, &ehci->regs->segment); -#if 0 -// this is deeply broken on almost all architectures - if (!dma_set_mask (hcd->self.controller, DMA_64BIT_MASK)) - ehci_info (ehci, "enabled 64bit DMA\n"); -#endif - } + ehci->async->qh_next.qh = NULL; + ehci->async->hw_next = QH_NEXT(ehci->async->qh_dma); + ehci->async->hw_info1 = cpu_to_le32(QH_HEAD); + ehci->async->hw_token = cpu_to_le32(QTD_STS_HALT); + ehci->async->hw_qtd_next = EHCI_LIST_END; + ehci->async->qh_state = QH_STATE_LINKED; + ehci->async->hw_alt_next = QTD_NEXT(ehci->async->dummy->qtd_dma); /* clear interrupt enables, set irq latency */ if (log2_irq_thresh < 0 || log2_irq_thresh > 6) @@ -507,13 +472,13 @@ static int ehci_run (struct usb_hcd *hcd) * make problems: throughput reduction (!), data errors... */ if (park) { - park = min (park, (unsigned) 3); + park = min(park, (unsigned) 3); temp |= CMD_PARK; temp |= park << 8; } - ehci_info (ehci, "park %d\n", park); + ehci_dbg(ehci, "park %d\n", park); } - if (HCC_PGM_FRAMELISTLEN (hcc_params)) { + if (HCC_PGM_FRAMELISTLEN(hcc_params)) { /* periodic schedule size can be smaller than default */ temp &= ~(3 << 2); temp |= (EHCI_TUNE_FLS << 2); @@ -521,16 +486,63 @@ static int ehci_run (struct usb_hcd *hcd) case 0: ehci->periodic_size = 1024; break; case 1: ehci->periodic_size = 512; break; case 2: ehci->periodic_size = 256; break; - default: BUG (); + default: BUG(); } } + ehci->command = temp; + + ehci->reboot_notifier.notifier_call = ehci_reboot; + register_reboot_notifier(&ehci->reboot_notifier); + + return 0; +} + +/* start HC running; it's halted, ehci_init() has been run (once) */ +static int ehci_run (struct usb_hcd *hcd) +{ + struct ehci_hcd *ehci = hcd_to_ehci (hcd); + int retval; + u32 temp; + u32 hcc_params; + + /* EHCI spec section 4.1 */ + if ((retval = ehci_reset(ehci)) != 0) { + unregister_reboot_notifier(&ehci->reboot_notifier); + ehci_mem_cleanup(ehci); + return retval; + } + writel(ehci->periodic_dma, &ehci->regs->frame_list); + writel((u32)ehci->async->qh_dma, &ehci->regs->async_next); + + /* + * hcc_params controls whether ehci->regs->segment must (!!!) + * be used; it constrains QH/ITD/SITD and QTD locations. + * pci_pool consistent memory always uses segment zero. + * streaming mappings for I/O buffers, like pci_map_single(), + * can return segments above 4GB, if the device allows. + * + * NOTE: the dma mask is visible through dma_supported(), so + * drivers can pass this info along ... like NETIF_F_HIGHDMA, + * Scsi_Host.highmem_io, and so forth. It's readonly to all + * host side drivers though. + */ + hcc_params = readl(&ehci->caps->hcc_params); + if (HCC_64BIT_ADDR(hcc_params)) { + writel(0, &ehci->regs->segment); +#if 0 +// this is deeply broken on almost all architectures + if (!dma_set_mask(hcd->self.controller, DMA_64BIT_MASK)) + ehci_info(ehci, "enabled 64bit DMA\n"); +#endif + } + + // Philips, Intel, and maybe others need CMD_RUN before the // root hub will detect new devices (why?); NEC doesn't - temp |= CMD_RUN; - writel (temp, &ehci->regs->command); - dbg_cmd (ehci, "init", temp); - - /* set async sleep time = 10 us ... ? */ + ehci->command &= ~(CMD_LRESET|CMD_IAAD|CMD_PSE|CMD_ASE|CMD_RESET); + ehci->command |= CMD_RUN; + writel (ehci->command, &ehci->regs->command); + dbg_cmd (ehci, "init", ehci->command); /* * Start, enabling full USB 2.0 functionality ... usb 1.1 devices @@ -538,26 +550,23 @@ static int ehci_run (struct usb_hcd *hcd) * involved with the root hub. (Except where one is integrated, * and there's no companion controller unless maybe for USB OTG.) */ - if (first) { - ehci->reboot_notifier.notifier_call = ehci_reboot; - register_reboot_notifier (&ehci->reboot_notifier); - } - hcd->state = HC_STATE_RUNNING; writel (FLAG_CF, &ehci->regs->configured_flag); - readl (&ehci->regs->command); /* unblock posted write */ + readl (&ehci->regs->command); /* unblock posted writes */ temp = HC_VERSION(readl (&ehci->caps->hc_capbase)); ehci_info (ehci, - "USB %x.%x %s, EHCI %x.%02x, driver %s\n", + "USB %x.%x started, EHCI %x.%02x, driver %s\n", ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), - first ? "initialized" : "restarted", temp >> 8, temp & 0xff, DRIVER_VERSION); writel (INTR_MASK, &ehci->regs->intr_enable); /* Turn On Interrupts */ - if (first) - create_debug_files (ehci); + /* GRR this is run-once init(), being done every time the HC starts. + * So long as they're part of class devices, we can't do it init() + * since the class device isn't created that early. + */ + create_debug_files(ehci); return 0; } diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index b654e3f800b4..441c26064b44 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c @@ -58,15 +58,76 @@ static int bios_handoff(struct ehci_hcd *ehci, int where, u32 cap) return 0; } -/* called by khubd or root hub init threads */ +/* called after powerup, by probe or system-pm "wakeup" */ +static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) +{ + u32 temp; + int retval; + unsigned count = 256/4; + + /* optional debug port, normally in the first BAR */ + temp = pci_find_capability(pdev, 0x0a); + if (temp) { + pci_read_config_dword(pdev, temp, &temp); + temp >>= 16; + if ((temp & (3 << 13)) == (1 << 13)) { + temp &= 0x1fff; + ehci->debug = ehci_to_hcd(ehci)->regs + temp; + temp = readl(&ehci->debug->control); + ehci_info(ehci, "debug port %d%s\n", + HCS_DEBUG_PORT(ehci->hcs_params), + (temp & DBGP_ENABLED) + ? " IN USE" + : ""); + if (!(temp & DBGP_ENABLED)) + ehci->debug = NULL; + } + } + + temp = HCC_EXT_CAPS(readl(&ehci->caps->hcc_params)); + + /* EHCI 0.96 and later may have "extended capabilities" */ + while (temp && count--) { + u32 cap; + + pci_read_config_dword(pdev, temp, &cap); + ehci_dbg(ehci, "capability %04x at %02x\n", cap, temp); + switch (cap & 0xff) { + case 1: /* BIOS/SMM/... handoff */ + if (bios_handoff(ehci, temp, cap) != 0) + return -EOPNOTSUPP; + break; + case 0: /* illegal reserved capability */ + ehci_dbg(ehci, "illegal capability!\n"); + cap = 0; + /* FALLTHROUGH */ + default: /* unknown */ + break; + } + temp = (cap >> 8) & 0xff; + } + if (!count) { + ehci_err(ehci, "bogus capabilities ... PCI problems!\n"); + return -EIO; + } + + /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ + retval = pci_set_mwi(pdev); + if (!retval) + ehci_dbg(ehci, "MWI active\n"); + + ehci_port_power(ehci, 0); + + return 0; +} + +/* called by khubd or root hub (re)init threads; leaves HC in halt state */ static int ehci_pci_reset(struct usb_hcd *hcd) { struct ehci_hcd *ehci = hcd_to_ehci(hcd); struct pci_dev *pdev = to_pci_dev(hcd->self.controller); u32 temp; - unsigned count = 256/4; - - spin_lock_init (&ehci->lock); + int retval; ehci->caps = hcd->regs; ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase)); @@ -76,6 +137,10 @@ static int ehci_pci_reset(struct usb_hcd *hcd) /* cache this readonly data; minimize chip reads */ ehci->hcs_params = readl(&ehci->caps->hcs_params); + retval = ehci_halt(ehci); + if (retval) + return retval; + /* NOTE: only the parts below this line are PCI-specific */ switch (pdev->vendor) { @@ -111,57 +176,9 @@ static int ehci_pci_reset(struct usb_hcd *hcd) break; } - /* optional debug port, normally in the first BAR */ - temp = pci_find_capability(pdev, 0x0a); - if (temp) { - pci_read_config_dword(pdev, temp, &temp); - temp >>= 16; - if ((temp & (3 << 13)) == (1 << 13)) { - temp &= 0x1fff; - ehci->debug = hcd->regs + temp; - temp = readl(&ehci->debug->control); - ehci_info(ehci, "debug port %d%s\n", - HCS_DEBUG_PORT(ehci->hcs_params), - (temp & DBGP_ENABLED) - ? " IN USE" - : ""); - if (!(temp & DBGP_ENABLED)) - ehci->debug = NULL; - } - } - - temp = HCC_EXT_CAPS(readl(&ehci->caps->hcc_params)); - - /* EHCI 0.96 and later may have "extended capabilities" */ - while (temp && count--) { - u32 cap; - - pci_read_config_dword(to_pci_dev(hcd->self.controller), - temp, &cap); - ehci_dbg(ehci, "capability %04x at %02x\n", cap, temp); - switch (cap & 0xff) { - case 1: /* BIOS/SMM/... handoff */ - if (bios_handoff(ehci, temp, cap) != 0) - return -EOPNOTSUPP; - break; - case 0: /* illegal reserved capability */ - ehci_warn(ehci, "illegal capability!\n"); - cap = 0; - /* FALLTHROUGH */ - default: /* unknown */ - break; - } - temp = (cap >> 8) & 0xff; - } - if (!count) { - ehci_err(ehci, "bogus capabilities ... PCI problems!\n"); - return -EIO; - } if (ehci_is_TDI(ehci)) ehci_reset(ehci); - ehci_port_power(ehci, 0); - /* at least the Genesys GL880S needs fixup here */ temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params); temp &= 0x0f; @@ -184,39 +201,15 @@ static int ehci_pci_reset(struct usb_hcd *hcd) } } - /* force HC to halt state */ - return ehci_halt(ehci); -} - -static int ehci_pci_start(struct usb_hcd *hcd) -{ - struct ehci_hcd *ehci = hcd_to_ehci(hcd); - int result = 0; - struct pci_dev *pdev; - u16 port_wake; - - pdev = to_pci_dev(hcd->self.controller); - /* Serial Bus Release Number is at PCI 0x60 offset */ pci_read_config_byte(pdev, 0x60, &ehci->sbrn); - /* port wake capability, reported by boot firmware */ - pci_read_config_word(pdev, 0x62, &port_wake); - hcd->can_wakeup = (port_wake & 1) != 0; + /* REVISIT: per-port wake capability (PCI 0x62) currently unused */ - /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ - result = pci_set_mwi(pdev); - if (!result) - ehci_dbg(ehci, "MWI active\n"); + retval = ehci_pci_reinit(ehci, pdev); - return ehci_run(hcd); -} - -/* always called by thread; normally rmmod */ - -static void ehci_pci_stop(struct usb_hcd *hcd) -{ - ehci_stop(hcd); + /* finish init */ + return ehci_init(hcd); } /*-------------------------------------------------------------------------*/ @@ -250,6 +243,7 @@ static int ehci_pci_resume(struct usb_hcd *hcd) struct ehci_hcd *ehci = hcd_to_ehci(hcd); unsigned port; struct usb_device *root = hcd->self.root_hub; + struct pci_dev *pdev = to_pci_dev(hcd->self.controller); int retval = -EINVAL; // maybe restore FLADJ @@ -258,7 +252,7 @@ static int ehci_pci_resume(struct usb_hcd *hcd) msleep(100); /* If CF is clear, we lost PCI Vaux power and need to restart. */ - if (readl(&ehci->regs->configured_flag) != cpu_to_le32(FLAG_CF)) + if (readl(&ehci->regs->configured_flag) != FLAG_CF) goto restart; /* If any port is suspended (or owned by the companion), @@ -292,7 +286,7 @@ restart: */ (void) ehci_halt(ehci); (void) ehci_reset(ehci); - (void) ehci_pci_reset(hcd); + (void) ehci_pci_reinit(ehci, pdev); /* emptying the schedule aborts any urbs */ spin_lock_irq(&ehci->lock); @@ -304,9 +298,7 @@ restart: /* restart; khubd will disconnect devices */ retval = ehci_run(hcd); - /* here we "know" root ports should always stay powered; - * but some controllers may lose all power. - */ + /* here we "know" root ports should always stay powered */ ehci_port_power(ehci, 1); return retval; @@ -328,12 +320,12 @@ static const struct hc_driver ehci_pci_hc_driver = { * basic lifecycle operations */ .reset = ehci_pci_reset, - .start = ehci_pci_start, + .start = ehci_run, #ifdef CONFIG_PM .suspend = ehci_pci_suspend, .resume = ehci_pci_resume, #endif - .stop = ehci_pci_stop, + .stop = ehci_stop, /* * managing i/o requests and associated device resources From 21b1861fb2ba5b25b32c63bc540bbc7ca1d186f8 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Wed, 23 Nov 2005 15:45:42 -0800 Subject: [PATCH 39/43] [PATCH] USB: ohci, move ppc asic tweaks nearer pci This should fix a suspend/resume issues that appear with OHCI on some PPC hardware. The PCI layer should doesn't have the hooks needed for such ASIC-specific hooks (in this case, software clock gating), so this moves the code to do that into hcd-pci.c ... where it can be done after the relevant PCI PM state transition (to/from D3). Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/core/hcd-pci.c | 38 +++++++++++++++++++++++++++++++++++-- drivers/usb/host/ohci-pci.c | 36 ----------------------------------- 2 files changed, 36 insertions(+), 38 deletions(-) diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 7feb829362d6..5131d88e8c5b 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -20,9 +20,17 @@ #include #include #include +#include + #include #include -#include + +#ifdef CONFIG_PPC_PMAC +#include +#include +#include +#include +#endif #include "usb.h" #include "hcd.h" @@ -277,8 +285,22 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) } done: - if (retval == 0) + if (retval == 0) { dev->dev.power.power_state = PMSG_SUSPEND; + +#ifdef CONFIG_PPC_PMAC + /* Disable ASIC clocks for USB */ + if (_machine == _MACH_Pmac) { + struct device_node *of_node; + + of_node = pci_device_to_OF_node (dev); + if (of_node) + pmac_call_feature(PMAC_FTR_USB_ENABLE, + of_node, 0, 0); + } +#endif + } + return retval; } EXPORT_SYMBOL (usb_hcd_pci_suspend); @@ -301,6 +323,18 @@ int usb_hcd_pci_resume (struct pci_dev *dev) return 0; } +#ifdef CONFIG_PPC_PMAC + /* Reenable ASIC clocks for USB */ + if (_machine == _MACH_Pmac) { + struct device_node *of_node; + + of_node = pci_device_to_OF_node (dev); + if (of_node) + pmac_call_feature (PMAC_FTR_USB_ENABLE, + of_node, 0, 1); + } +#endif + /* NOTE: chip docs cover clean "real suspend" cases (what Linux * calls "standby", "suspend to RAM", and so on). There are also * dirty cases when swsusp fakes a suspend in "shutdown" mode. diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index a59e536441e1..5f22e6590cd1 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c @@ -14,15 +14,6 @@ * This file is licenced under the GPL. */ -#include - -#ifdef CONFIG_PPC_PMAC -#include -#include -#include -#include -#endif - #ifndef CONFIG_PCI #error "This file is PCI bus glue. CONFIG_PCI must be defined." #endif @@ -115,39 +106,12 @@ ohci_pci_start (struct usb_hcd *hcd) static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) { /* root hub was already suspended */ - - /* FIXME these PMAC things get called in the wrong places. ASIC - * clocks should be turned off AFTER entering D3, and on BEFORE - * trying to enter D0. Evidently the PCI layer doesn't currently - * provide the right sort of platform hooks for this ... - */ -#ifdef CONFIG_PPC_PMAC - if (_machine == _MACH_Pmac) { - struct device_node *of_node; - - /* Disable USB PAD & cell clock */ - of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller)); - if (of_node) - pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0); - } -#endif /* CONFIG_PPC_PMAC */ return 0; } static int ohci_pci_resume (struct usb_hcd *hcd) { -#ifdef CONFIG_PPC_PMAC - if (_machine == _MACH_Pmac) { - struct device_node *of_node; - - /* Re-enable USB PAD & cell clock */ - of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller)); - if (of_node) - pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1); - } -#endif /* CONFIG_PPC_PMAC */ - usb_hcd_resume_root_hub(hcd); return 0; } From 63dc3ff3e019287e8cb4647808de1d93acddd006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=E4rdeman?= Date: Wed, 23 Nov 2005 15:45:49 -0800 Subject: [PATCH 40/43] [PATCH] USB: fix USB key generates ioctl_internal_command errors issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Wed, Nov 16, 2005 at 06:34:24PM -0800, Pete Zaitcev wrote: >On Wed, 16 Nov 2005 23:52:32 +0100, David Härdeman wrote: >> usb-storage: waiting for device to settle before scanning >> Vendor: I0MEGA Model: UMni1GB*IOM2K4 Rev: 1.01 >> Type: Direct-Access ANSI SCSI revision: 02 >> SCSI device sda: 2048000 512-byte hdwr sectors (1049 MB) >> sda: Write Protect is off >> sda: Mode Sense: 00 00 00 00 >> sda: assuming drive cache: write through >> ioctl_internal_command: <8 0 0 0> return code = 8000002 >> : Current: sense key=0x0 >> ASC=0x0 ASCQ=0x0 >> SCSI device sda: 2048000 512-byte hdwr sectors (1049 MB) > >I think it's harmless. I saw things like that, and initially I plugged >them with workarounds like this: Thanks for the pointer, and yes, it is harmless, but it floods the console with the messages which hides other (potentially important) messages...following your example I've made a patch which fixes the problem. Signed-off-by: David Härdeman Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/storage/unusual_devs.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 0a9858f69a9b..f5f47a34b168 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -1118,6 +1118,15 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_GO_SLOW ), +/* + * David Härdeman + * The key makes the SCSI stack print confusing (but harmless) messages + */ +UNUSUAL_DEV( 0x4146, 0xba01, 0x0100, 0x0100, + "Iomega", + "Micro Mini 1GB", + US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ), + #ifdef CONFIG_USB_STORAGE_SDDR55 UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999, "Sandisk", From 8dd396ec7bf706fe85d8c6792b478ee6f09e8de6 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 23 Nov 2005 15:45:53 -0800 Subject: [PATCH 41/43] [PATCH] USB: kernel-doc for linux/usb.h Fix kernel-doc warning in linux/usb.h. Signed-off-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- include/linux/usb.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/usb.h b/include/linux/usb.h index 856d232c7562..d81b050e5955 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -47,6 +47,7 @@ struct usb_driver; * @urb_list: urbs queued to this endpoint; maintained by usbcore * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) * with one or more transfer descriptors (TDs) per urb + * @kobj: kobject for sysfs info * @extra: descriptors following this endpoint in the configuration * @extralen: how many bytes of "extra" are valid * From 569cfaadb0ea21bfcedac85dbc5147b4a9ed42d2 Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Wed, 23 Nov 2005 15:45:58 -0800 Subject: [PATCH 42/43] [PATCH] usb serial: remove redundant include remove redundant include Signed-off-by: Nicolas Kaiser Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/serial/ipw.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index a02fada85362..7744b8148bc5 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include "usb-serial.h" From 6d9885a8ce45cd9b7d36517ee823a480eaf95c02 Mon Sep 17 00:00:00 2001 From: Jasper Spaans Date: Thu, 24 Nov 2005 16:53:36 +0100 Subject: [PATCH 43/43] [PATCH] fbcon: fix obvious bug in fbcon logo rotation code This code fixes a tiny problem with the recent fbcon rotation changes: fb_prepare_logo doesn't check the return value of fb_find_logo and that causes a crash for my while booting. Obvious & working & tested fix is here. Signed-off-by: Jasper Spaans Acked-by: Antonino Daplas Signed-off-by: Linus Torvalds --- drivers/video/fbmem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 9f180096c896..6240aedb4154 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -452,13 +452,17 @@ int fb_prepare_logo(struct fb_info *info, int rotate) /* Return if no suitable logo was found */ fb_logo.logo = fb_find_logo(depth); + + if (!fb_logo.logo) { + return 0; + } if (rotate == FB_ROTATE_UR || rotate == FB_ROTATE_UD) yres = info->var.yres; else yres = info->var.xres; - if (fb_logo.logo && fb_logo.logo->height > yres) { + if (fb_logo.logo->height > yres) { fb_logo.logo = NULL; return 0; }