GitHub/exynos8895/android_kernel_samsung_universal8895.git
15 years agomm: fix lazy vmap purging (use-after-free error)
Vegard Nossum [Fri, 27 Feb 2009 22:03:04 +0000 (14:03 -0800)]
mm: fix lazy vmap purging (use-after-free error)

I just got this new warning from kmemcheck:

    WARNING: kmemcheck: Caught 32-bit read from freed memory (c7806a60)
    a06a80c7ecde70c1a04080c700000000a06709c1000000000000000000000000
     f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f
     ^

    Pid: 0, comm: swapper Not tainted (2.6.29-rc4 #230)
    EIP: 0060:[<c1096df7>] EFLAGS: 00000286 CPU: 0
    EIP is at __purge_vmap_area_lazy+0x117/0x140
    EAX: 00070f43 EBX: c7806a40 ECX: c1677080 EDX: 00027b66
    ESI: 00002001 EDI: c170df0c EBP: c170df00 ESP: c178830c
     DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
    CR0: 80050033 CR2: c7806b14 CR3: 01775000 CR4: 00000690
    DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
    DR6: 00004000 DR7: 00000000
     [<c1096f3e>] free_unmap_vmap_area_noflush+0x6e/0x70
     [<c1096f6a>] remove_vm_area+0x2a/0x70
     [<c1097025>] __vunmap+0x45/0xe0
     [<c10970de>] vunmap+0x1e/0x30
     [<c1008ba5>] text_poke+0x95/0x150
     [<c1008ca9>] alternatives_smp_unlock+0x49/0x60
     [<c171ef47>] alternative_instructions+0x11b/0x124
     [<c171f991>] check_bugs+0xbd/0xdc
     [<c17148c5>] start_kernel+0x2ed/0x360
     [<c171409e>] __init_begin+0x9e/0xa9
     [<ffffffff>] 0xffffffff

It happened here:

    $ addr2line -e vmlinux -i c1096df7
    mm/vmalloc.c:540

Code:

list_for_each_entry(va, &valist, purge_list)
__free_vmap_area(va);

It's this instruction:

    mov    0x20(%ebx),%edx

Which corresponds to a dereference of va->purge_list.next:

    (gdb) p ((struct vmap_area *) 0)->purge_list.next
    Cannot access memory at address 0x20

It seems that we should use "safe" list traversal here, as the element
is freed inside the loop. Please verify that this is the right fix.

Acked-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: <stable@kernel.org> [2.6.28.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agomm: vmap fix overflow
Nick Piggin [Fri, 27 Feb 2009 22:03:03 +0000 (14:03 -0800)]
mm: vmap fix overflow

The new vmap allocator can wrap the address and get confused in the case
of large allocations or VMALLOC_END near the end of address space.

Problem reported by Christoph Hellwig on a 32-bit XFS workload.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Reported-by: Christoph Hellwig <hch@lst.de>
Cc: <stable@kernel.org> [2.6.28.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoFix recursive lock in free_uid()/free_user_ns()
David Howells [Fri, 27 Feb 2009 22:03:03 +0000 (14:03 -0800)]
Fix recursive lock in free_uid()/free_user_ns()

free_uid() and free_user_ns() are corecursive when CONFIG_USER_SCHED=n,
but free_user_ns() is called from free_uid() by way of uid_hash_remove(),
which requires uidhash_lock to be held.  free_user_ns() then calls
free_uid() to complete the destruction.

Fix this by deferring the destruction of the user_namespace.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agow1: add missing Kconfig/Makefile entries for DS2431 slave driver
Herton Ronaldo Krzesinski [Fri, 27 Feb 2009 22:03:00 +0000 (14:03 -0800)]
w1: add missing Kconfig/Makefile entries for DS2431 slave driver

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoEXPORT_SYMBOL(d_obtain_alias) rather than EXPORT_SYMBOL_GPL
Benny Halevy [Fri, 27 Feb 2009 22:02:59 +0000 (14:02 -0800)]
EXPORT_SYMBOL(d_obtain_alias) rather than EXPORT_SYMBOL_GPL

Commit 4ea3ada2955e4519befa98ff55dd62d6dfbd1705 declares d_obtain_alias()
as EXPORT_SYMBOL_GPL where it's supposed to replace d_alloc_anon which was
previously declared as EXPORT_SYMBOL and thus available to any loadable
module.

This patch reverts that.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agow1_ds2433: clear the validcrc flag after a write
Ben Gardner [Fri, 27 Feb 2009 22:02:58 +0000 (14:02 -0800)]
w1_ds2433: clear the validcrc flag after a write

The w1_ds2433 driver does not read from the hardware if the CRC was valid
on the last read.  The validcrc flag should be cleared after a write so
that the new value can be read.

Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMerge git://git.infradead.org/mtd-2.6
Linus Torvalds [Thu, 26 Feb 2009 22:45:57 +0000 (14:45 -0800)]
Merge git://git.infradead.org/mtd-2.6

* git://git.infradead.org/mtd-2.6:
  [MTD] [MAPS] Remove MODULE_DEVICE_TABLE() from ck804rom driver.
  [JFFS2] fix mount crash caused by removed nodes
  [JFFS2] force the jffs2 GC daemon to behave a bit better
  [MTD] [MAPS] blackfin async requires complex mappings
  [MTD] [MAPS] blackfin: fix memory leak in error path
  [MTD] [MAPS] physmap: fix wrong free and del_mtd_{partition,device}
  [MTD] slram: Handle negative devlength correctly
  [MTD] map_rom has NULL erase pointer
  [MTD] [LPDDR] qinfo_probe depends on lpddr

15 years agoMerge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfashe...
Linus Torvalds [Thu, 26 Feb 2009 22:45:42 +0000 (14:45 -0800)]
Merge branch 'upstream-linus' of git://git./linux/kernel/git/mfasheh/ocfs2

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2:
  ocfs2: add IO error check in ocfs2_get_sector()
  ocfs2: set gap to seperate entry and value when xattr in bucket
  ocfs2: lock the metaecc process for xattr bucket
  ocfs2: Use the right access_* method in ctime update of xattr.
  ocfs2/dlm: Make dlm_assert_master_handler() kill itself instead of the asserter
  ocfs2/dlm: Use ast_lock to protect ast_list
  ocfs2: Cleanup the lockname print in dlmglue.c
  ocfs2/dlm: Retract fix for race between purge and migrate
  ocfs2: Access and dirty the buffer_head in mark_written.

15 years agoMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Linus Torvalds [Thu, 26 Feb 2009 22:45:25 +0000 (14:45 -0800)]
Merge branch 'merge' of git://git./linux/kernel/git/benh/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
  powerpc/44x: Fix address decoding setup of PCI 2.x cells

15 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes...
Linus Torvalds [Thu, 26 Feb 2009 22:43:42 +0000 (14:43 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/jbarnes/pci-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
  PCI: AMD 813x B2 devices do not need boot interrupt quirk
  PCI: Enable PCIe AER only after checking firmware support
  PCI: pciehp: Handle interrupts that happen during initialization.
  PCI: don't enable too many HT MSI mappings
  PCI: add some sysfs ABI docs
  PCI quirk: enable MSI on 8132

15 years agopowerpc/44x: Fix address decoding setup of PCI 2.x cells
Benjamin Herrenschmidt [Sun, 1 Feb 2009 14:24:18 +0000 (14:24 +0000)]
powerpc/44x: Fix address decoding setup of PCI 2.x cells

The PCI 2.x cells used on some 44x SoCs only let us configure the decode
for the low 32-bit of the incoming PLB addresses. The top 4 bits (this
is a 36-bit bus) are hard wired to different values depending on the
specific SoC in use. Our code used to work "by accident" until I added
support for the ISA memory holes and while at it added more validity
checking of the addresses.

This patch should bring it back to working condition. It still relies
on the device-tree being correct but that's somewhat a pre-requisite
for anything to work anyway.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Acked-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
15 years agoPCI: AMD 813x B2 devices do not need boot interrupt quirk
Stefan Assmann [Thu, 26 Feb 2009 18:46:48 +0000 (10:46 -0800)]
PCI: AMD 813x B2 devices do not need boot interrupt quirk

Turns out that the new AMD 813x devices do not need the
quirk_disable_amd_813x_boot_interrupt quirk to be run on them.  If it
is, no interrupts are seen on the PCI-X adapter.

From: Stefan Assmann <sassmann@novell.com>
Reported-by: Jamie Wellnitz <Jamie.Wellnitz@emulex.com>
Tested-by: Jamie Wellnitz <Jamie.Wellnitz@emulex.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jesse Barnes <jbarnes@hobbes.lan>
15 years ago[MTD] [MAPS] Remove MODULE_DEVICE_TABLE() from ck804rom driver.
David Woodhouse [Thu, 26 Feb 2009 19:51:33 +0000 (04:51 +0900)]
[MTD] [MAPS] Remove MODULE_DEVICE_TABLE() from ck804rom driver.

We really don't want the BIOS flash mapping hacks to get automatically
loaded.

No idea why it isn't using pci_register_driver() though -- that should
be fine... and is even _present_ but disabled by #if 0.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agoocfs2: add IO error check in ocfs2_get_sector()
wengang wang [Fri, 13 Feb 2009 02:11:47 +0000 (10:11 +0800)]
ocfs2: add IO error check in ocfs2_get_sector()

Check for IO error in ocfs2_get_sector().

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
15 years agoocfs2: set gap to seperate entry and value when xattr in bucket
Tiger Yang [Fri, 20 Feb 2009 03:11:50 +0000 (11:11 +0800)]
ocfs2: set gap to seperate entry and value when xattr in bucket

This patch set a gap (4 bytes) between xattr entry and
name/value when xattr in bucket. This gap use to seperate
entry and name/value when a bucket is full. It had already
been set when xattr in inode/block.

Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
15 years agoocfs2: lock the metaecc process for xattr bucket
Tao Ma [Wed, 25 Feb 2009 01:40:26 +0000 (17:40 -0800)]
ocfs2: lock the metaecc process for xattr bucket

For other metadata in ocfs2, metaecc is checked in ocfs2_read_blocks
with io_mutex held. While for xattr bucket, it is calculated by
the whole buckets. So we have to add a spin_lock to prevent multiple
processes calculating metaecc.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Tested-by: Tristan Ye <tristan.ye@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
15 years agoocfs2: Use the right access_* method in ctime update of xattr.
Tao Ma [Mon, 16 Feb 2009 20:39:28 +0000 (04:39 +0800)]
ocfs2: Use the right access_* method in ctime update of xattr.

In ctime updating of xattr, it use the wrong type of access for
inode, so use ocfs2_journal_access_di instead.

Reported-and-Tested-by: Tristan Ye <tristan.ye@oracle.com>
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
15 years agoocfs2/dlm: Make dlm_assert_master_handler() kill itself instead of the asserter
Sunil Mushran [Tue, 3 Feb 2009 20:37:16 +0000 (12:37 -0800)]
ocfs2/dlm: Make dlm_assert_master_handler() kill itself instead of the asserter

In dlm_assert_master_handler(), if we get an incorrect assert master from a node
that, we reply with EINVAL asking the asserter to die. The problem is that an
assert is sent after so many hoops, it is invariably the node that thinks the
asserter is wrong, is actually wrong. So instead of killing the asserter, this
patch kills the assertee.

This patch papers over a race that is still being addressed.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
15 years agoocfs2/dlm: Use ast_lock to protect ast_list
Sunil Mushran [Tue, 3 Feb 2009 20:37:15 +0000 (12:37 -0800)]
ocfs2/dlm: Use ast_lock to protect ast_list

The code was using dlm->spinlock instead of dlm->ast_lock to protect the
ast_list. This patch fixes the issue.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
15 years agoocfs2: Cleanup the lockname print in dlmglue.c
Sunil Mushran [Tue, 3 Feb 2009 20:37:14 +0000 (12:37 -0800)]
ocfs2: Cleanup the lockname print in dlmglue.c

The dentry lock has a different format than other locks. This patch fixes
ocfs2_log_dlm_error() macro to make it print the dentry lock correctly.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
15 years agoocfs2/dlm: Retract fix for race between purge and migrate
Sunil Mushran [Tue, 3 Feb 2009 20:37:13 +0000 (12:37 -0800)]
ocfs2/dlm: Retract fix for race between purge and migrate

Mainline commit d4f7e650e55af6b235871126f747da88600e8040 attempts to delay
the dlm_thread from sending the drop ref message if the lockres is being
migrated. The problem is that we make the dlm_thread wait for the migration
to complete. This causes a deadlock as dlm_thread also participates in the
lockres migration process.

A better fix for the original oss bugzilla#1012 is in testing.

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
15 years agoocfs2: Access and dirty the buffer_head in mark_written.
Tao Ma [Thu, 8 Jan 2009 23:32:48 +0000 (07:32 +0800)]
ocfs2: Access and dirty the buffer_head in mark_written.

In __ocfs2_mark_extent_written, when we meet with the situation
of c_split_covers_rec, the old solution just replace the extent
record and forget to access and dirty the buffer_head. This will
cause a problem when the unwritten extent is in an extent block.
So access and dirty it.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
Linus Torvalds [Thu, 26 Feb 2009 18:37:00 +0000 (10:37 -0800)]
Merge git://git./linux/kernel/git/mason/btrfs-unstable

* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
  Btrfs: try committing transaction before returning ENOSPC
  Btrfs: add better -ENOSPC handling

15 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
Linus Torvalds [Thu, 26 Feb 2009 18:36:35 +0000 (10:36 -0800)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  xen/blkfront: use blk_rq_map_sg to generate ring entries
  block: reduce stack footprint of blk_recount_segments()
  cciss: shorten 30s timeout on controller reset
  block: add documentation for register_blkdev()
  block: fix bogus gcc warning for uninitialized var usage

15 years agoMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Linus Torvalds [Thu, 26 Feb 2009 18:36:19 +0000 (10:36 -0800)]
Merge branch 'merge' of git://git./linux/kernel/git/benh/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
  powerpc: Fix 64bit __copy_tofrom_user() regression
  powerpc: Fix 64bit memcpy() regression
  powerpc: Fix load/store float double alignment handler

15 years agoMake ieee1394_init a fs-initcall
Linus Torvalds [Thu, 26 Feb 2009 18:32:31 +0000 (10:32 -0800)]
Make ieee1394_init a fs-initcall

It needs to happen before any firewire driver actually registers itself,
and that was previously handled by having the Makefile list the core
ieee1394 files before the drivers.

But now there are firewire drivers in drivers/media, and the Makefile
games aren't enough.  So just make ieee1394_init happen earlier in the
init sequence, the way all other bus layers already do.

Reported-and-tested-by: Ingo Molnar <mingo@elte.hu>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Henrik Kurelid <henrik@kurelid.se>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Ben Backx <ben@bbackx.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoxen/blkfront: use blk_rq_map_sg to generate ring entries
Jens Axboe [Tue, 24 Feb 2009 07:10:09 +0000 (08:10 +0100)]
xen/blkfront: use blk_rq_map_sg to generate ring entries

On occasion, the request will apparently have more segments than we
fit into the ring. Jens says:

> The second problem is that the block layer then appears to create one
> too many segments, but from the dump it has rq->nr_phys_segments ==
> BLKIF_MAX_SEGMENTS_PER_REQUEST. I suspect the latter is due to
> xen-blkfront not handling the merging on its own. It should check that
> the new page doesn't form part of the previous page. The
> rq_for_each_segment() iterates all single bits in the request, not dma
> segments. The "easiest" way to do this is to call blk_rq_map_sg() and
> then iterate the mapped sg list. That will give you what you are
> looking for.

> Here's a test patch, compiles but otherwise untested. I spent more
> time figuring out how to enable XEN than to code it up, so YMMV!
> Probably the sg list wants to be put inside the ring and only
> initialized on allocation, then you can get rid of the sg on stack and
> sg_init_table() loop call in the function. I'll leave that, and the
> testing, to you.

[Moved sg array into info structure, and initialize once. -J]

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
15 years agoblock: reduce stack footprint of blk_recount_segments()
Jens Axboe [Mon, 23 Feb 2009 08:03:10 +0000 (09:03 +0100)]
block: reduce stack footprint of blk_recount_segments()

blk_recalc_rq_segments() requires a request structure passed in, which
we don't have from blk_recount_segments(). So the latter allocates one on
the stack, using > 400 bytes of stack for that. This can cause us to spill
over one page of stack from ext4 at least:

 0)     4560     400   blk_recount_segments+0x43/0x62
 1)     4160      32   bio_phys_segments+0x1c/0x24
 2)     4128      32   blk_rq_bio_prep+0x2a/0xf9
 3)     4096      32   init_request_from_bio+0xf9/0xfe
 4)     4064     112   __make_request+0x33c/0x3f6
 5)     3952     144   generic_make_request+0x2d1/0x321
 6)     3808      64   submit_bio+0xb9/0xc3
 7)     3744      48   submit_bh+0xea/0x10e
 8)     3696     368   ext4_mb_init_cache+0x257/0xa6a [ext4]
 9)     3328     288   ext4_mb_regular_allocator+0x421/0xcd9 [ext4]
10)     3040     160   ext4_mb_new_blocks+0x211/0x4b4 [ext4]
11)     2880     336   ext4_ext_get_blocks+0xb61/0xd45 [ext4]
12)     2544      96   ext4_get_blocks_wrap+0xf2/0x200 [ext4]
13)     2448      80   ext4_da_get_block_write+0x6e/0x16b [ext4]
14)     2368     352   mpage_da_map_blocks+0x7e/0x4b3 [ext4]
15)     2016     352   ext4_da_writepages+0x2ce/0x43c [ext4]
16)     1664      32   do_writepages+0x2d/0x3c
17)     1632     144   __writeback_single_inode+0x162/0x2cd
18)     1488      96   generic_sync_sb_inodes+0x1e3/0x32b
19)     1392      16   sync_sb_inodes+0xe/0x10
20)     1376      48   writeback_inodes+0x69/0xb3
21)     1328     208   balance_dirty_pages_ratelimited_nr+0x187/0x2f9
22)     1120     224   generic_file_buffered_write+0x1d4/0x2c4
23)      896     176   __generic_file_aio_write_nolock+0x35f/0x393
24)      720      80   generic_file_aio_write+0x6c/0xc8
25)      640      80   ext4_file_write+0xa9/0x137 [ext4]
26)      560     320   do_sync_write+0xf0/0x137
27)      240      48   vfs_write+0xb3/0x13c
28)      192      64   sys_write+0x4c/0x74
29)      128     128   system_call_fastpath+0x16/0x1b

Split the segment counting out into a __blk_recalc_rq_segments() helper
to avoid allocating an onstack request just for checking the physical
segment count.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
15 years agocciss: shorten 30s timeout on controller reset
Jens Axboe [Mon, 23 Feb 2009 07:53:35 +0000 (08:53 +0100)]
cciss: shorten 30s timeout on controller reset

If reset_devices is set for kexec, then cciss will delay 30 seconds
since the old 5i controller _may_ need that long to recover. Replace
the long sleep with incremental sleep and tests to reduce the 30 seconds
to worst case for 5i, so that other controllers will proceed quickly.

Reviewed-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
15 years agoblock: add documentation for register_blkdev()
Márton Németh [Fri, 20 Feb 2009 07:12:51 +0000 (08:12 +0100)]
block: add documentation for register_blkdev()

Add documentation for register_blkdev() function and for the parameters.

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
15 years agoblock: fix bogus gcc warning for uninitialized var usage
Jens Axboe [Thu, 19 Feb 2009 07:50:26 +0000 (08:50 +0100)]
block: fix bogus gcc warning for uninitialized var usage

Newer gcc throw this warning:

        fs/bio.c: In function ?bio_alloc_bioset?:
        fs/bio.c:305: warning: ?p? may be used uninitialized in this function

since it cannot figure out that 'p' is only ever used if 'bs' is non-NULL.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
15 years agopowerpc: Fix 64bit __copy_tofrom_user() regression
Mark Nelson [Wed, 25 Feb 2009 13:46:24 +0000 (13:46 +0000)]
powerpc: Fix 64bit __copy_tofrom_user() regression

This fixes a regression introduced by commit
a4e22f02f5b6518c1484faea1f88d81802b9feac ("powerpc: Update 64bit
__copy_tofrom_user() using CPU_FTR_UNALIGNED_LD_STD").

The same bug that existed in the 64bit memcpy() also exists here so fix
it here too. The fix is the same as that applied to memcpy() with the
addition of fixes for the exception handling code required for
__copy_tofrom_user().

This stops us reading beyond the end of the source region we were told
to copy.

Signed-off-by: Mark Nelson <markn@au1.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
15 years agopowerpc: Fix 64bit memcpy() regression
Mark Nelson [Wed, 25 Feb 2009 13:26:48 +0000 (13:26 +0000)]
powerpc: Fix 64bit memcpy() regression

This fixes a regression introduced by commit
25d6e2d7c58ddc4a3b614fc5381591c0cfe66556 ("powerpc: Update 64bit memcpy()
using CPU_FTR_UNALIGNED_LD_STD").

This commit allowed CPUs that have the CPU_FTR_UNALIGNED_LD_STD CPU
feature bit present to do the memcpy() with unaligned load doubles. But,
along with this came a bug where our final load double would read bytes
beyond a page boundary and into the next (unmapped) page. This was caught
by enabling CONFIG_DEBUG_PAGEALLOC,

The fix was to read only the number of bytes that we need to store rather
than reading a full 8-byte doubleword and storing only a portion of that.

In order to minimise the amount of existing code touched we use the
original do_tail for the src_unaligned case.

Below is an example of the regression, as reported by Sachin Sant:

Unable to handle kernel paging request for data at address 0xc00000003f380000
Faulting instruction address: 0xc000000000039574
cpu 0x1: Vector: 300 (Data Access) at [c00000003baf3020]
    pc: c000000000039574: .memcpy+0x74/0x244
    lr: d00000000244916c: .ext3_xattr_get+0x288/0x2f4 [ext3]
    sp: c00000003baf32a0
   msr: 8000000000009032
   dar: c00000003f380000
 dsisr: 40000000
  current = 0xc00000003e54b010
  paca    = 0xc000000000a53680
    pid   = 1840, comm = readahead
enter ? for help
[link register   ] d00000000244916c .ext3_xattr_get+0x288/0x2f4 [ext3]
[c00000003baf32a0d000000002449104 .ext3_xattr_get+0x220/0x2f4 [ext3]
(unreliab
le)
[c00000003baf3390d00000000244a6e8 .ext3_xattr_security_get+0x40/0x5c [ext3]
[c00000003baf3400c000000000148154 .generic_getxattr+0x74/0x9c
[c00000003baf34a0c000000000333400 .inode_doinit_with_dentry+0x1c4/0x678
[c00000003baf3560c00000000032c6b0 .security_d_instantiate+0x50/0x68
[c00000003baf35e0c00000000013c818 .d_instantiate+0x78/0x9c
[c00000003baf3680c00000000013ced0 .d_splice_alias+0xf0/0x120
[c00000003baf3720d00000000243e05c .ext3_lookup+0xec/0x134 [ext3]
[c00000003baf37c0c000000000131e74 .do_lookup+0x110/0x260
[c00000003baf3880c000000000134ed0 .__link_path_walk+0xa98/0x1010
[c00000003baf3970c0000000001354a0 .path_walk+0x58/0xc4
[c00000003baf3a20c000000000135720 .do_path_lookup+0x138/0x1e4
[c00000003baf3ad0c00000000013645c .path_lookup_open+0x6c/0xc8
[c00000003baf3b70c000000000136780 .do_filp_open+0xcc/0x874
[c00000003baf3d10c0000000001251e0 .do_sys_open+0x80/0x140
[c00000003baf3dc0c00000000016aaec .compat_sys_open+0x24/0x38
[c00000003baf3e30c00000000000855c syscall_exit+0x0/0x40

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
15 years agopowerpc: Fix load/store float double alignment handler
Michael Neuling [Thu, 19 Feb 2009 18:52:20 +0000 (18:52 +0000)]
powerpc: Fix load/store float double alignment handler

When we introduced VSX, we changed the way FPRs are stored in the
thread_struct.  Unfortunately we missed the load/store float double
alignment handler code when updating how we access FPRs in the
thread_struct.

Below fixes this and merges the little/big endian case.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
15 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
Linus Torvalds [Wed, 25 Feb 2009 23:16:18 +0000 (15:16 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: emu10k1 - Fix digital/analog switch on audigy2 ZS
  ALSA: hda - Quirk for Acer Aspire 6530G
  ALSA: hda - add another MacBook Pro 3,1 SSID
  ALSA: fix excessive background noise introduced by OSS emulation rate shrink
  ALSA: aw2: do not grab every saa7146 based device
  ALSA: hda - Fix parse of init_verbs sysfs entry
  ALSA: pcxhr.h replace signed one-bit bitfields

15 years agoMerge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
Linus Torvalds [Wed, 25 Feb 2009 23:14:37 +0000 (15:14 -0800)]
Merge branch 'release' of git://git./linux/kernel/git/aegl/linux-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6:
  [IA64] Don't go beyond iosapic_intr_info's arraysize
  [IA64] Do not go beyond ARRAY_SIZE of unw.hash
  [IA64] enable setting DMAR on by default

15 years agoMerge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzi...
Linus Torvalds [Wed, 25 Feb 2009 23:12:48 +0000 (15:12 -0800)]
Merge branch 'upstream-linus' of git://git./linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
  [libata] pata_legacy: for VLB 32bit PIO don't try tricks with slop
  [libata] pata_amd: program FIFO
  sata_mv: fix SoC interrupt breakage
  pata_it821x: resume from hibernation fails with RAID volume

15 years ago[libata] pata_legacy: for VLB 32bit PIO don't try tricks with slop
Alan Cox [Wed, 11 Feb 2009 21:08:42 +0000 (13:08 -0800)]
[libata] pata_legacy: for VLB 32bit PIO don't try tricks with slop

These devices are generally used with ATA anyway and it seems that some
ATAPI will need us to issue the right number of words.  Therefore as we
can't switch mid burst on VLB devices we should only use 32bit I/O for
suitable block sizes.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years ago[libata] pata_amd: program FIFO
Alan Cox [Wed, 11 Feb 2009 21:08:41 +0000 (13:08 -0800)]
[libata] pata_amd: program FIFO

With 32bit PIO we can use the posted write buffers, but only for 32bit I/O
cycles.  This means we must disable the FIFO for ATAPI where a final 16bit
cycle may occur.

Rework the FIFO logic so that we disable the FIFO then selectively
re-enable it when we set the timings on AMD devices.  Also fix a case
where we scribbled on PCI config 0x41 of Nvidia chips when we shouldn't.

Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agosata_mv: fix SoC interrupt breakage
Mark Lord [Thu, 19 Feb 2009 15:38:04 +0000 (10:38 -0500)]
sata_mv: fix SoC interrupt breakage

For some reason, sata_mv doesn't clear interrupt status during init
when it's running on an SoC host adapter.  If the bootloader has
touched the SATA controller before starting Linux, Linux can end up
enabling the SATA interrupt with events pending, which will cause the
interrupt to be marked as spurious and then be disabled, which then
breaks all further accesses to the controller.

This patch makes the SoC path clear interrupt status on init like in
the non-SoC case.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agopata_it821x: resume from hibernation fails with RAID volume
Ondrej Zary [Wed, 11 Feb 2009 21:08:43 +0000 (13:08 -0800)]
pata_it821x: resume from hibernation fails with RAID volume

Hibernation didn't work for me since I started to use IT8212 controller.
I did some debugging (booting with no_console_suspend init=/bin/sh).

Found that resume fails (2.6.28) with "serial number mismatch 'some
garbage' != 'some other garbage'" and "revalidation failed" messages.
That's because the controller firmware fills different serial number in
the IDENTIFY every boot.

The patch below fixes the resume simply clearing the serial number.  The
proper fix would be probably to fill in the serial number of the RAID
volume instead.  I assume that there must be something like that stored on
the drives but I don't know where.

Fix resume on pata_it821x RAID volume by clearing the serial number in
IDENTIFY data, which is otherwise different on each boot.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
Linus Torvalds [Wed, 25 Feb 2009 20:22:06 +0000 (12:22 -0800)]
Merge git://git./linux/kernel/git/bart/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6:
  ide: fix refcounting in device drivers
  ide-cd: document capacity hack
  it821x: remove dead URL
  atiixp: fix missing parentheses
  amd74xx: device/vendor confusion
  ide: ide.c 'clear' fix, update "ide=nodma" documentation

15 years agoshmem: fix shared anonymous accounting
Hugh Dickins [Tue, 24 Feb 2009 20:51:52 +0000 (20:51 +0000)]
shmem: fix shared anonymous accounting

Each time I exit Firefox, /proc/meminfo's Committed_AS goes down almost
400 kB: OVERCOMMIT_NEVER would be allowing overcommits it should
prohibit.

Commit fc8744adc870a8d4366908221508bb113d8b72ee "Stop playing silly
games with the VM_ACCOUNT flag" changed shmem_file_setup() to set the
shmem file's VM_ACCOUNT flag according to VM_NORESERVE not being set in
the vma flags; but did so only _after_ the shmem_acct_size(flags, size)
call which is expected to pre-account a shared anonymous object.

It's all clearer if we switch shmem.c over to use VM_NORESERVE
throughout in place of !VM_ACCOUNT.

But I very nearly sent in a patch which mistakenly removed the
accounting from tmpfs files: shmem_get_inode()'s memset was good for not
setting VM_ACCOUNT, but now it needs to set VM_NORESERVE.

Rather than setting that by default, then perhaps clearing it again in
shmem_file_setup(), let's pass it as a flag to shmem_get_inode(): that
allows us to remove the #ifdef CONFIG_SHMEM from shmem_file_setup().

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years ago[IA64] Don't go beyond iosapic_intr_info's arraysize
Roel Kluin [Sat, 21 Feb 2009 22:40:27 +0000 (23:40 +0100)]
[IA64] Don't go beyond iosapic_intr_info's arraysize

vi arch/ia64/kernel/iosapic.c +142
static struct iosapic_intr_info {
...
} iosapic_intr_info[NR_IRQS];

But at line 510 we have:
for (i = 0; i <= NR_IRQS; i++) {

s/<=/</

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
15 years ago[IA64] Do not go beyond ARRAY_SIZE of unw.hash
Roel Kluin [Sun, 22 Feb 2009 01:33:28 +0000 (02:33 +0100)]
[IA64] Do not go beyond ARRAY_SIZE of unw.hash

static struct {

... :114
        unsigned short hash[UNW_HASH_SIZE];

... :2152
for (index = 0; index <= UNW_HASH_SIZE; ++index) {

This is a bug, isn't it?

s/<=/</

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
15 years ago[IA64] enable setting DMAR on by default
Kyle McMartin [Sat, 14 Feb 2009 09:11:29 +0000 (04:11 -0500)]
[IA64] enable setting DMAR on by default

The previous commit which introduced the DMAR_DEFAULT_ON setting in
drivers/pci/dmar.c neglected to add the ability for ia64 to enable
the IOMMU by default. Rectify that mistake, doh!

Signed-off-by: Kyle McMartin <kyle@redhat.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
15 years agoide: fix refcounting in device drivers
Bartlomiej Zolnierkiewicz [Wed, 25 Feb 2009 19:28:24 +0000 (20:28 +0100)]
ide: fix refcounting in device drivers

During host driver module removal del_gendisk() results in a final
put on drive->gendev and freeing the drive by drive_release_dev().

Convert device drivers from using struct kref to use struct device
so device driver's object holds reference on ->gendev and prevents
drive from prematurely going away.

Also fix ->remove methods to not erroneously drop reference on a
host driver by using only put_device() instead of ide*_put().

Reported-by: Stanislaw Gruszka <stf_xl@wp.pl>
Tested-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-cd: document capacity hack
Bartlomiej Zolnierkiewicz [Wed, 25 Feb 2009 19:28:23 +0000 (20:28 +0100)]
ide-cd: document capacity hack

Just copy the comment from drivers/scsi/sr.c::sr_done()
(from which the capacity hack has been originated).

Cc: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoit821x: remove dead URL
Bartlomiej Zolnierkiewicz [Wed, 25 Feb 2009 19:28:22 +0000 (20:28 +0100)]
it821x: remove dead URL

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoatiixp: fix missing parentheses
Roel Kluin [Wed, 25 Feb 2009 19:28:22 +0000 (20:28 +0100)]
atiixp: fix missing parentheses

Fix missing parentheses so PIO/DMA timings for master device on the
second channel are programmed correctly (IOW "8 0 24 16" offset values
should be used instead of the current "8 0 16 16").

[ The bug went unnoticed because after PIO/DMA timings get programmed
  incorrectly for the third device they are overwritten with timings
  for the fourth device and since BIOS should also program timings for
  the third device everything should work fine until suspend/resume
  cycle or user requested transfer mode changes. ]

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
[bart: update patch description]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoamd74xx: device/vendor confusion
Roel Kluin [Wed, 25 Feb 2009 19:28:22 +0000 (20:28 +0100)]
amd74xx: device/vendor confusion

Device and vendor ids were confused

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: ide.c 'clear' fix, update "ide=nodma" documentation
David Fries [Wed, 25 Feb 2009 19:28:21 +0000 (20:28 +0100)]
ide: ide.c 'clear' fix, update "ide=nodma" documentation

Documentation/kernel-parameters.txt
- ide=nodma is no longer valid.

drivers/ide/Kconfig
- The module is ide-core.ko not ide.

drivers/ide/ide.c
- It took me a while to figure out what the arguments %d.%d:%d to nodma
  module parameter ment, so I added a comment to each.
- Added a comment to each of the sscanf lines.
- There is a bug, if j is 0 it would previously clear all the other bits
  except the current device, changed in three different places.
  mask &= (1 << i) should be mask &= ~(1 << i).

Signed-off-by: David Fries <david@fries.net>
[bart: s/disk/device/ in ide.c, beautify patch description]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoMerge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
Linus Torvalds [Wed, 25 Feb 2009 17:49:30 +0000 (09:49 -0800)]
Merge branch 'drm-fixes' of git://git./linux/kernel/git/airlied/drm-2.6

* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm/i915: convert DRM_ERROR to DRM_DEBUG in phys object pwrite path
  drm/i915: make hw page ioremap use ioremap_wc
  drm: edid revision 0 is valid
  drm: Correct unbalanced drm_vblank_put() during mode setting.
  drm: disable encoders before re-routing them
  drm: Fix ordering of bit fields in EDID structure leading huge vsync values.
  drm: Fix shifts of EDID vsync offset/width fields.
  drm/i915: handle bogus VBT panel timing
  drm/i915: remove PLL debugging messages

15 years agoMerge branch 'for-linus' of git://neil.brown.name/md
Linus Torvalds [Wed, 25 Feb 2009 17:34:27 +0000 (09:34 -0800)]
Merge branch 'for-linus' of git://neil.brown.name/md

* 'for-linus' of git://neil.brown.name/md:
  md: avoid races when stopping resync.
  md/raid10:  Don't call bitmap_cond_end_sync when we are doing recovery.
  md/raid10:  Don't skip more than 1 bitmap-chunk at a time during recovery.

15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
Linus Torvalds [Wed, 25 Feb 2009 17:31:56 +0000 (09:31 -0800)]
Merge git://git./linux/kernel/git/davem/sparc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  sparc64: Fix crashes in jbusmc_print_dimm()

15 years agoMerge git://git.infradead.org/iommu-2.6
Linus Torvalds [Wed, 25 Feb 2009 17:31:21 +0000 (09:31 -0800)]
Merge git://git.infradead.org/iommu-2.6

* git://git.infradead.org/iommu-2.6:
  intel-iommu: fix endless "Unknown DMAR structure type" loop
  VT-d: handle Invalidation Queue Error to avoid system hang
  intel-iommu: fix build error with INTR_REMAP=y and DMAR=n

15 years agoFix iwlan DMA mapping direction
Fenghua Yu [Wed, 25 Feb 2009 05:06:26 +0000 (14:06 +0900)]
Fix iwlan DMA mapping direction

When iwlan runs on IOMMU, IOMMU generates a lot of PTE write faults
because PTE write bit is not set on some of PTE's.  This is because
iwlan driver calls DMA mapping with PCI_DMA_TODEVICE which is read only
in mapping PTE.  But iwlan device actually writes to the mapped page to
update its contents.  This issue is not exposed in swiotlb.  But VT-d
hardware can capture this fault and stop the fault transaction.

The following patch fixes the issue.

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Reviewed-by: Bhavesh Davda <bhavesh@vmware.com>
Tested-by: Chris Wright <chrisw@sous-sol.org>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMerge branch 'fix/misc' into for-linus
Takashi Iwai [Wed, 25 Feb 2009 08:52:42 +0000 (09:52 +0100)]
Merge branch 'fix/misc' into for-linus

15 years agoMerge branch 'fix/hda' into for-linus
Takashi Iwai [Wed, 25 Feb 2009 08:52:38 +0000 (09:52 +0100)]
Merge branch 'fix/hda' into for-linus

15 years agodrm/i915: convert DRM_ERROR to DRM_DEBUG in phys object pwrite path
Dave Airlie [Wed, 25 Feb 2009 04:52:30 +0000 (14:52 +1000)]
drm/i915: convert DRM_ERROR to DRM_DEBUG in phys object pwrite path

This snuck in when I wrote phys object support.

Signed-off-by: Dave Airlie <airlied@redhat.com>
15 years agodrm/i915: make hw page ioremap use ioremap_wc
Dave Airlie [Wed, 25 Feb 2009 04:49:21 +0000 (14:49 +1000)]
drm/i915: make hw page ioremap use ioremap_wc

However we still have another issue with ioremap_wc not falling back
properly or somehow doing something else stupid, this probably needs
to be tracked down.

Signed-off-by: Dave Airlie <airlied@redhat.com>
15 years agodrm: edid revision 0 is valid
Kyle McMartin [Wed, 25 Feb 2009 01:31:53 +0000 (20:31 -0500)]
drm: edid revision 0 is valid

edid->revision == 0 should be valid (at least, so the error message
indicates. :) and wikipedia seems to indicate that EDID 1.0 existed.

We can dump the entire check, since edid->revision is a u8, so
it can't ever be less than 0.

Marko reports in RH bz#476735 that his monitor claims to be
EDID 1.0, and therefore hits the check and is stuck at 800x600 because
of it.

Reported-by: Marko Ristola <marko.ristola@kolumbus.fi>
Signed-off-by: Kyle McMartin <kyle@redhat.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
15 years agodrm: Correct unbalanced drm_vblank_put() during mode setting.
Chris Wilson [Thu, 19 Feb 2009 14:48:22 +0000 (14:48 +0000)]
drm: Correct unbalanced drm_vblank_put() during mode setting.

The first time we install a mode, the vblank will be disabled for a pipe
and so drm_vblank_get() in drm_vblank_pre_modeset() will fail. As we
unconditionally call drm_vblank_put() afterwards, the vblank reference
counter becomes unbalanced.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
15 years agodrm: disable encoders before re-routing them
Jesse Barnes [Tue, 24 Feb 2009 00:09:34 +0000 (16:09 -0800)]
drm: disable encoders before re-routing them

In some cases we may receive a mode config that has a different
CRTC<->encoder map that the current configuration.  In that case, we
need to disable any re-routed encoders before setting the mode,
otherwise they may not pick up the new CRTC (if the output types are
incompatible for example).

Tested-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
15 years agodrm: Fix ordering of bit fields in EDID structure leading huge vsync values.
Jesse Barnes [Mon, 23 Feb 2009 23:36:41 +0000 (15:36 -0800)]
drm: Fix ordering of bit fields in EDID structure leading huge vsync values.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
15 years agodrm: Fix shifts of EDID vsync offset/width fields.
Linus Torvalds [Mon, 23 Feb 2009 16:44:33 +0000 (08:44 -0800)]
drm: Fix shifts of EDID vsync offset/width fields.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
15 years agodrm/i915: handle bogus VBT panel timing
Jesse Barnes [Mon, 23 Feb 2009 23:36:42 +0000 (15:36 -0800)]
drm/i915: handle bogus VBT panel timing

We've seen cases in the wild where the VBT sync data is wrong, so add
some code to fix it up in that case, taking care to make sure that the
total is greater than the sync end.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
15 years agodrm/i915: remove PLL debugging messages
Jesse Barnes [Mon, 23 Feb 2009 23:36:40 +0000 (15:36 -0800)]
drm/i915: remove PLL debugging messages

These are normal; we walk through different values looking for the right
one, so why flood the screen with messages?

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
15 years agomd: avoid races when stopping resync.
NeilBrown [Wed, 25 Feb 2009 02:18:47 +0000 (13:18 +1100)]
md: avoid races when stopping resync.

There has been a race in raid10 and raid1 for a long time
which has only recently started showing up due to a scheduler changed.

When a sync_read request finishes, as soon as reschedule_retry
is called, another thread can mark the resync request as having
completed, so md_do_sync can finish, ->stop can be called, and
->conf can be freed.  So using conf after reschedule_retry is not
safe.

Similarly, when finishing a sync_write, calling md_done_sync must be
the last thing we do, as it allows a chain of events which will free
conf and other data structures.

The first of these requires action in raid10.c
The second requires action in raid1.c and raid10.c

Cc: stable@kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd/raid10: Don't call bitmap_cond_end_sync when we are doing recovery.
NeilBrown [Wed, 25 Feb 2009 02:18:47 +0000 (13:18 +1100)]
md/raid10:  Don't call bitmap_cond_end_sync when we are doing recovery.

For raid1/4/5/6, resync (fixing inconsistencies between devices) is
very similar to recovery (rebuilding a failed device onto a spare).
The both walk through the device addresses in order.

For raid10 it can be quite different.  resync follows the 'array'
address, and makes sure all copies are the same.  Recover walks
through 'device' addresses and recreates each missing block.

The 'bitmap_cond_end_sync' function allows the write-intent-bitmap
(When present) to be updated to reflect a partially completed resync.
It makes assumptions which mean that it does not work correctly for
raid10 recovery at all.

In particularly, it can cause bitmap-directed recovery of a raid10 to
not recovery some of the blocks that need to be recovered.

So move the call to bitmap_cond_end_sync into the resync path, rather
than being in the common "resync or recovery" path.

Cc: stable@kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd/raid10: Don't skip more than 1 bitmap-chunk at a time during recovery.
NeilBrown [Wed, 25 Feb 2009 02:18:47 +0000 (13:18 +1100)]
md/raid10:  Don't skip more than 1 bitmap-chunk at a time during recovery.

When doing recovery on a raid10 with a write-intent bitmap, we only
need to recovery chunks that are flagged in the bitmap.

However if we choose to skip a chunk as it isn't flag, the code
currently skips the whole raid10-chunk, thus it might not recovery
some blocks that need recovering.

This patch fixes it.

In case that is confusing, it might help to understand that there
is a 'raid10 chunk size' which guides how data is distributed across
the devices, and a 'bitmap chunk size' which says how much data
corresponds to a single bit in the bitmap.

This bug only affects cases where the bitmap chunk size is smaller
than the raid10 chunk size.

Cc: stable@kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMerge branch 'proc-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/adobriyan...
Linus Torvalds [Tue, 24 Feb 2009 23:42:08 +0000 (15:42 -0800)]
Merge branch 'proc-linus' of git://git./linux/kernel/git/adobriyan/proc

* 'proc-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/adobriyan/proc:
  proc: fix PG_locked reporting in /proc/kpageflags

15 years agoMerge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
Linus Torvalds [Tue, 24 Feb 2009 23:40:19 +0000 (15:40 -0800)]
Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6

* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
  Add i2c_board_info for RiscPC PCF8583
  i2c: Make sure i2c_algo_bit_data.timeout is HZ-independent
  i2c-dev: Clarify the unit of ioctl I2C_TIMEOUT
  i2c: Timeouts reach -1
  i2c: Fix misplaced parentheses

15 years agoMerge branch 'firedtv-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee139...
Linus Torvalds [Tue, 24 Feb 2009 23:39:54 +0000 (15:39 -0800)]
Merge branch 'firedtv-merge' of git://git./linux/kernel/git/ieee1394/linux1394-2.6

* 'firedtv-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
  firedtv: dvb_frontend_info for FireDTV S2, fix "frequency limits undefined" error
  firedtv: massive refactoring
  firedtv: rename files, variables, functions from firesat to firedtv
  firedtv: Use DEFINE_SPINLOCK
  firedtv: fix registration - adapter number could only be zero
  firedtv: use length_field() of PMT as length
  firedtv: fix returned struct for ca_info
  firedtv: cleanups and minor fixes
  ieee1394: remove superfluous assertions
  ieee1394: inherit ud vendor_id from node vendor_id
  ieee1394: add hpsb_node_read() and hpsb_node_lock()
  ieee1394: use correct barrier types between accesses of nodeid and generation
  firesat: copyrights, rename to firedtv, API conversions, fix remote control input
  firesat: avc resend
  firesat: update isochronous interface, add CI support
  firesat: add DVB-S support for DVB-S2 devices
  firesat: fix DVB-S2 device recognition
  DVB: add firesat driver

15 years agoMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Linus Torvalds [Tue, 24 Feb 2009 23:39:34 +0000 (15:39 -0800)]
Merge branch 'for_linus' of git://git./linux/kernel/git/tytso/ext4

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  ext4: Fix deadlock in ext4_write_begin() and ext4_da_write_begin()
  ext4: Add fallback for find_group_flex

15 years agoAdd i2c_board_info for RiscPC PCF8583
Russell King [Tue, 24 Feb 2009 18:19:50 +0000 (19:19 +0100)]
Add i2c_board_info for RiscPC PCF8583

Add the necessary i2c_board_info structure to fix the lack of PCF8583
RTC on RiscPC.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
15 years agoi2c: Make sure i2c_algo_bit_data.timeout is HZ-independent
Jean Delvare [Tue, 24 Feb 2009 18:19:49 +0000 (19:19 +0100)]
i2c: Make sure i2c_algo_bit_data.timeout is HZ-independent

i2c_algo_bit_data.timeout is supposed to be in jiffies, so drivers
should use set this value in terms of HZ.

Ultimately I think this field should be discarded in favor of
i2c_adapter.timeout, but that's left for a future patch.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Lennert Buytenhek <kernel@wantstofly.org>
Acked-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
15 years agoi2c-dev: Clarify the unit of ioctl I2C_TIMEOUT
Jean Delvare [Tue, 24 Feb 2009 18:19:49 +0000 (19:19 +0100)]
i2c-dev: Clarify the unit of ioctl I2C_TIMEOUT

The unit in which user-space can set the bus timeout value is jiffies
for historical reasons (back when HZ was always 100.) This is however
not good because user-space doesn't know how long a jiffy lasts. The
timeout value should instead be set in a fixed time unit. Given the
original value of HZ, this unit should be 10 ms, for compatibility.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
15 years agoi2c: Timeouts reach -1
Roel Kluin [Tue, 24 Feb 2009 18:19:48 +0000 (19:19 +0100)]
i2c: Timeouts reach -1

With a postfix decrement these timeouts reach -1 rather than 0, but
after the loop it is tested whether they have become 0.

As pointed out by Jean Delvare, the condition we are waiting for should
also be tested before the timeout. With the current order, you could
exit with a timeout error while the job is actually done.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
15 years agoi2c: Fix misplaced parentheses
Roel Kluin [Tue, 24 Feb 2009 18:19:48 +0000 (19:19 +0100)]
i2c: Fix misplaced parentheses

Fix misplaced parentheses.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
15 years agoproc: fix PG_locked reporting in /proc/kpageflags
Helge Bahmann [Fri, 20 Feb 2009 13:24:12 +0000 (16:24 +0300)]
proc: fix PG_locked reporting in /proc/kpageflags

Expr always evaluates to zero.

Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
15 years agoPCI: Enable PCIe AER only after checking firmware support
Andrew Patterson [Fri, 20 Feb 2009 23:04:59 +0000 (16:04 -0700)]
PCI: Enable PCIe AER only after checking firmware support

The PCIe port driver currently sets the PCIe AER error reporting bits for
any root or switch port without first checking to see if firmware will grant
control. This patch moves setting these bits to the AER service driver
aer_enable_port routine.  The bits are then set for the root port and any
downstream switch ports after the check for firmware support (aer_osc_setup)
is made. The patch also unsets the bits in a similar fashion when the AER
service driver is unloaded.

Reviewed-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@hobbes.lan>
15 years agoPCI: pciehp: Handle interrupts that happen during initialization.
Eric W. Biederman [Thu, 29 Jan 2009 03:31:18 +0000 (19:31 -0800)]
PCI: pciehp: Handle interrupts that happen during initialization.

Move the enabling of interrupts after all of the data structures
are setup so that we can safely run the interrupt handler as
soon as it is registered.

Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Tested-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: Jesse Barnes <jbarnes@hobbes.lan>
15 years agoPCI: don't enable too many HT MSI mappings
Yinghai Lu [Mon, 23 Feb 2009 19:51:59 +0000 (11:51 -0800)]
PCI: don't enable too many HT MSI mappings

Prakash reported that his c51-mcp51 ondie sound card doesn't work with
MSI.  But if he hacks out the HT-MSI quirk, MSI works fine.

So this patch reworks the nv_msi_ht_cap_quirk().  It will now only
enable ht_msi on own its root device, avoiding enabling it on devices
following that root dev.

Reported-by: Prakash Punnoor <prakash@punnoor.de>
Tested-by: Prakash Punnoor <prakash@punnoor.de>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jesse Barnes <jbarnes@hobbes.lan>
15 years agoPCI: add some sysfs ABI docs
Chris Wright [Tue, 24 Feb 2009 05:50:35 +0000 (21:50 -0800)]
PCI: add some sysfs ABI docs

Add sysfs ABI docs for driver entries bind, unbind and new_id.  These
entries are pretty old, from 2.6.0 onwards AFAIK, so this documents
current behaviour.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jesse Barnes <jbarnes@hobbes.lan>
15 years agofiredtv: dvb_frontend_info for FireDTV S2, fix "frequency limits undefined" error
Beat Michel Liechti [Tue, 24 Feb 2009 14:52:49 +0000 (15:52 +0100)]
firedtv: dvb_frontend_info for FireDTV S2, fix "frequency limits undefined" error

I found that the function fdtv_frontend_init in the file firedtv-fe.c was
missing a case for FIREDTV_DVB_S2 which resulted in "frequency limits
undefined" errors in syslog.

Signed-off-by: Beat Michel Liechti <bml303@gmail.com>
Change by Stefan R: combine it with case case FIREDTV_DVB_S as
originally suggested by Beat Michel.  This enables FE_CAN_FEC_AUTO also
for FireDTV-S2 devices which is possible as long as only DVB-S channels
are used.  FE_CAN_FEC_AUTO would be wrong for DVB-S2 channels, but those
cannot be used yet since the driver is not yet converted to S2API.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agoALSA: emu10k1 - Fix digital/analog switch on audigy2 ZS
Takashi Iwai [Tue, 24 Feb 2009 14:31:02 +0000 (15:31 +0100)]
ALSA: emu10k1 - Fix digital/analog switch on audigy2 ZS

Fix the inverted logic of shared spdif switch.

Reference: Novell bnc#478496
https://bugzilla.novell.com/show_bug.cgi?id=478496

Signed-off-by: Takashi Iwai <tiwai@suse.de>
15 years agofiredtv: massive refactoring
Stefan Richter [Mon, 23 Feb 2009 13:21:10 +0000 (14:21 +0100)]
firedtv: massive refactoring

Combination of the following changes:

Mon, 23 Feb 2009 14:21:10 +0100 (CET)
firedtv: reinstate debug logging option

    Henrik Kurelid tells me that FCP debug logging (which I removed during
    cleanups) is still useful when working on driver issues together with
    end users.  So bring it back in an updated form with only 60% of the
    original code footprint.

    Logging can be enabled with
    # echo -1 > /sys/module/firedtv/parameters/debug

    1 instead of -1 enables only FCP header logging,
    2 instead of -1 enables only hexdumps of the entire FCP frames.
    0 switches logging off again.

Fri, 20 Feb 2009 20:54:27 +0100 (CET)
firedtv: build fix for INPUT=m and DVB_FIREDTV=y

Thu, 19 Feb 2009 20:40:39 +0100
firedtv: use msecs_to_jiffies

    Pointed out by Mauro Carvalho Chehab.

Sun Feb 15 20:50:46 CET 2009
firedtv: some more housekeeping

    Fix an old checkpatch warning and a new compiler warning.

Sun Feb 15 15:33:17 CET 2009
firedtv: rename a file once more

    At the moment, about a third of avc.c is specific to FireDTVs rather
    than generic AV/C code.  Rename it to firedtv-avc.c.

Sun Feb 15 15:33:17 CET 2009
firedtv: dvb demux: more compact channels backing store

    Replace struct firedtv_channel { bool active; int pid; } channel[16];
    by unsigned long channel_active; u16 channel_pid[16];.

Sun Feb 15 15:33:17 CET 2009
firedtv: dvb demux: some simplifications

    c->active was unnecessarily cleared twice.

    Also, by marking the channel inactive before the for loop,
    the loop becomes identical with fdtv_channel_collect().

Sun Feb 15 15:33:17 CET 2009
firedtv: dvb demux: remove a bogus loop

    This loop is unnecessary because
      - only active channel[].pid's will be sent to the device,
      - when a channel is activated, its pid is set to dvbdmxfeed->pid.

    Perhaps the original code was there because it was initially not fully
    covered by the fdtv->demux_mutex.

Sun Feb 15 15:33:17 CET 2009
firedtv: dvb demux: fix mutex protection

    fdtv_start_feed() accessed the channel list unsafely.
    Fully serialize it with itself and fdtv_stop_feed().

Sun Feb 15 15:33:17 CET 2009
firedtv: dvb demux: fix missing braces

    Original code was:
            ...
            case DMX_TS_PES_OTHER:
                    //Dirty fix to keep firesat->channel pid-list up to date
                    for(k=0;k<16;k++){
                            if(firesat->channel[k].active == 0)
                                    firesat->channel[k].pid =
                                            dvbdmxfeed->pid;
                                    break;
                    }
                    channel = firesat_channel_allocate(firesat);
                    break;
            default:
            ...

    Looks bogus in several respects. For now let's just add braces to the if
    because that seems to be what the author meant.

Sun Feb 15 15:33:17 CET 2009
firedtv: allow build without input subsystem

    !CONFIG_INPUT is very unlikely on systems on which firedtv is of
    interest.  But we can easily support it.

Sun Feb 15 15:33:17 CET 2009
firedtv: replace EXTRA_CFLAGS by ccflags

    The former are deprecated.
    The latter can depend on Kconfig variables.

Sun Feb 15 15:33:17 CET 2009
firedtv: concentrate ieee1394 dependencies

    Move the entire interface with drivers/ieee1394 to firedtv-1394.c.
    Move 1394-independent module initialization code to firedtv-dvb.c.

    This prepares interfacing with drivers/firewire.

Sun Feb 15 15:33:17 CET 2009
firedtv: amend Kconfig menu prompt

Sun Feb 15 15:33:17 CET 2009
firedtv: remove kernel version compatibility macro

Sun Feb 15 15:33:17 CET 2009
firedtv: combine header files

    avc.h and firedtv-*.h are small and currently not shared with other
    drivers, hence concatenate them all into firedtv.h.

Sun Feb 15 15:33:17 CET 2009
firedtv: misc style touch-ups

    Standardize on lower-case hexadecimal constants.  Adjust whitespace.
    Omit unnecessary pointer type casts and an unnecessary list head
    initialization.  Use dev_printk.

Wed Feb 11 21:21:04 CET 2009
firedtv: avc, ci: remove unused constants

Wed Feb 11 21:21:04 CET 2009
firedtv: avc: remove bitfields from read descriptor response operands

    Don't use bitfields in struct types of on-the-wire data.

Wed Feb 11 21:21:04 CET 2009
firedtv: avc: remove bitfields from DSD command operands

    Don't use bitfields in struct types of on-the-wire data.

Wed Feb 11 21:21:04 CET 2009
firedtv: avc: header file cleanup

    Remove unused constants and declarations.
    Move privately used constants into .c files.

Wed Feb 11 21:21:04 CET 2009
firedtv: avc: remove bitfields from FCP frame types

    Don't use bitfields in struct types of on-the-wire data.

    Also move many privately used constants from avc.h to avc.c
    and remove some unused constants.

Sun, 18 Jan 2009 16:30:00 +0100 (CET)
firedtv: avc: fix offset in avc_tuner_get_ts

    The parentheses were wrong.  It didn't matter though because this code
    only writes a 0 into an area which is already initialized to 0.

Sun, 18 Jan 2009 16:30:00 +0100 (CET)
firedtv: avc: reduce stack usage, remove two typedefs

    It is safe to share a memory buffer for command frame and response frame
    because the response data come in after the command frame was last used.

    Even less stack would be required if only the actual required frame size
    instead of the entire FCP register size was allocated.

    Also, rename the defined types AVCCmdFrm and AVCRspFrm to
    struct avc_command_frame and struct avc_response_frame.
    TODO:  Remove the bitfields in these types.

Sun, 18 Jan 2009 16:30:00 +0100 (CET)
firedtv: cmp: move code to avc

Sun, 18 Jan 2009 16:30:00 +0100 (CET)
firedtv: iso: move code to firedtv-1394

Sun, 18 Jan 2009 16:30:00 +0100 (CET)
firedtv: iso: remove unnecessary struct type definitions

Sun, 18 Jan 2009 16:30:00 +0100 (CET)
firedtv: iso: style changes and fixlets

    Add cleanup after failure in setup_iso_channel.
    Replace printk() by dv_err().
    Decrease indentation level in rawiso_activity_cb().

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agofiredtv: rename files, variables, functions from firesat to firedtv
Rambaldi [Sat, 17 Jan 2009 13:47:34 +0000 (14:47 +0100)]
firedtv: rename files, variables, functions from firesat to firedtv

Combination of the following changes:

Sat, 17 Jan 2009 14:47:34 +0100
firedtv: rename variables and functions from firesat to firedtv

Signed-off-by: Rambaldi <Rambaldi@xs4all.nl>
    Additional changes by Stefan Richter:

    Renamed struct firedtv *firedtv to struct firedtv *fdtv and
    firedtv_foo_bar() to fdtv_foo_bar() for brevity.

Sat, 17 Jan 2009 13:07:44 +0100
firedtv: rename files from firesat to firedtv

Signed-off-by: Rambaldi <Rambaldi@xs4all.nl>
    Additional changes by Stefan Richter:

    Name the directory "firewire" instead of "firedtv".
    Standardize on "-" instead of "_" in file names, because that's what
    drivers/firewire/ and drivers/media/dvb/dvb-usb/ use too.
    Build fix.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agofiredtv: Use DEFINE_SPINLOCK
Julia Lawall [Thu, 25 Dec 2008 14:34:25 +0000 (15:34 +0100)]
firedtv: Use DEFINE_SPINLOCK

SPIN_LOCK_UNLOCKED is deprecated.  The following makes the change suggested
in Documentation/spinlocks.txt

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agofiredtv: fix registration - adapter number could only be zero
Henrik Kurelid [Mon, 15 Dec 2008 07:17:12 +0000 (08:17 +0100)]
firedtv: fix registration - adapter number could only be zero

There was a bug causing the initialization to fail if adapter number was
greater than zero. The adapter was however registered which caused the driver
to oops the second time initialization was tried.

Signed-off-by: Henrik Kurelid <henrik@kurelid.se>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agofiredtv: use length_field() of PMT as length
Henrik Kurelid [Fri, 5 Dec 2008 09:00:16 +0000 (10:00 +0100)]
firedtv: use length_field() of PMT as length

Parsed and used the length_field() of the PMT message instead of using
the length field of the message struct, which does not seem to be filled
correctly by e.g. MythTV.

Signed-off-by: Henrik Kurelid <henrik@kurelid.se>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agofiredtv: fix returned struct for ca_info
Henrik Kurelid [Thu, 4 Dec 2008 21:40:52 +0000 (22:40 +0100)]
firedtv: fix returned struct for ca_info

The SystemId of the ca_info message was filled with garbage.
It now returns what the card returns.

Signed-off-by: Henrik Kurelid <henrik@kurelid.se>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agofiredtv: cleanups and minor fixes
Stefan Richter [Sun, 2 Nov 2008 12:45:00 +0000 (13:45 +0100)]
firedtv: cleanups and minor fixes

Combination of the following changes:

Sun, 2 Nov 2008 13:45:00 +0100 (CET)
firedtv: increase FCP frame length for DVB-S2 tune QSPK

    The last three bytes didn't go out to the wire.
    Effect of the fix not yet tested.

Sun, 2 Nov 2008 13:45:00 +0100 (CET)
firedtv: replace mdelay by msleep

    These functions can sleep (and in fact sleep for the duration of a whole
    FCP transaction).  Hence msleep is more appropriate here.

Sun, 2 Nov 2008 13:45:00 +0100 (CET)
firedtv: trivial reorganization in avc_api

    Reduce nesting level by factoring code out of avc_tuner_dsd() into
    helper functions.

Sun, 2 Nov 2008 13:45:00 +0100 (CET)
firedtv: trivial cleanups in avc_api

    Use dev_err(), no CamelCase function names, adjust comment style, put
    #if 0 around unused code and add FIXME comments, standardize on
    lower-case hexadecimal constants, use ALIGN() for some frame length
    calculations, make a local function static...

    The code which writes FCP command frames and reads FCP response frames
    is not yet brought into canonical kernel coding style because this
    involves changes of typedefs (on-the-wire bitfields).

Sun, 2 Nov 2008 13:45:00 +0100 (CET)
firedtv: don't retry oPCR updates endlessly

    In the theoretical case that the target node wasn't handling the lock
    transactions as expected or there was continued interference by other
    initiating nodes, these functions wouldn't return for ages.

Sun, 2 Nov 2008 13:45:00 +0100 (CET)
firedtv: remove bitfield typedefs from cmp, fix for big endian CPUs

    Use macros/ inline functions/ standard byte order accessors to read and
    write oPCR register values (big endian bitfields, on-the-wire data).
    The new code may not be the ultimate optimum, but it doesn't occur in a
    hot path.

    This fixes the CMP code for big endian CPUs.  So far I tested it only on
    a little endian CPU though.

    For now, include <asm/byteorder.h> instead of <linux/byteorder.h>
    because drivers/ieee1394/*.h also include the former.  I will fix this
    in drivers/ieee1394 and firedtv later.

Sun, 2 Nov 2008 13:45:00 +0100 (CET)
firedtv: trivial cleanups in cmp

    Reduce nesting level by means of early exit and goto.
    Remove obsolete includes, use dev_err(), no CamelCase function names...

Sun, 2 Nov 2008 13:45:00 +0100 (CET)
firedtv: trivial cleanups in firesat-ci

    Whitespace, variable names, comment style...

    Also, use dvb_generic_open() and dvb_generic_release() directly as
    our hooks in struct file_operations because firedtv's wrappers merely
    called these generic functions.

Sun, 2 Nov 2008 13:45:00 +0100 (CET)
firedtv: remove CA debug code

    This looks like it is not necessary to have available for endusers who
    cannot patch kernels for bug reporting and tests of fixes.

Sun, 2 Nov 2008 13:45:00 +0100 (CET)
firedtv: remove AV/C debug code

    This looks like it is not necessary to have available for endusers who
    cannot patch kernels for bug reporting and tests of fixes.

Sun, 2 Nov 2008 13:45:00 +0100 (CET)
firedtv: remove various debug code

    Most of this was already commented out.  And that which wasn't is not
    relevant in normal use.

Mon, 29 Sep 2008 19:22:48 +0200 (CEST)
firedtv: register input device as child of a FireWire device

    Instead of one virtual input device which exists for the whole lifetime
    of the driver and receives events from all connected FireDTVs, register
    one input device for each firedtv device.  These input devices will show
    up as children of the respective firedtv devices in the sysfs hierarchy.

    However, the implementation falls short because of a bug in userspace:
    Udev's path_id script gets stuck with 100% CPU utilization, maybe
    because of an assumption about the maximum ieee1394 device hierarchy
    depth.

    To avoid this bug, we use the fw-host device instead of the proper
    unit_directory device as parent of the input device.

    There is hope that the port to the new firewire stack won't be inhibited
    by this userspace bug because there are no fw-host devices there.

Mon, 29 Sep 2008 19:21:52 +0200 (CEST)
firedtv: fix string comparison and a few sparse warnings

    Sparse found a bug:
     while ((kv_buf + kv_len - 1) == '\0')
    should have been
     while (kv_buf[kv_len - 1] == '\0')
    We fix it by a better implementation without a temporary copy.

    Also fix sparse warnings of 0 instead of NULL and signedness mismatches.

Mon, 29 Sep 2008 19:21:20 +0200 (CEST)
firedtv: remove unused struct members

    and redefine an int as a bool.

Mon, 29 Sep 2008 19:20:36 +0200 (CEST)
firedtv: fix initialization of dvb_frontend.ops

    There was a NULL pointer reference if no dvb_frontend_info was found.

    Also, don't directly assign struct typed values to struct typed
    variables.  Instead write out assignments to individual strcut members.
    This reduces module size by about 1 kB.

Mon, 29 Sep 2008 19:19:41 +0200 (CEST)
firedtv: remove unused dual subunit code from initialization

    No FireDTVs with more than one subunit exists, hence simplify the
    initialization for the special case of one subunit.  The driver was able
    to check for more than one subunit but was broken for more than two
    subunits.

    While we are at it, add several missing cleanups after failure, and
    include a few dynamically allocated structures diretly into struct
    firesat instead of allocating them separately.

Mon, 29 Sep 2008 19:19:08 +0200 (CEST)
firedtv: add vendor_id and version to driver match table

    Now that nodemgr was enhanced to match against the root directory's
    vendor ID if there isn't one in the unit directory, use this to
    prevent firedtv to be bound to wrong devices by accident.

    Also add the AV/C software version ID to the match flags for
    completeness; specifier ID and software only make sense as a pair.

Mon, 29 Sep 2008 19:18:30 +0200 (CEST)
firedtv: use hpsb_node_read(), _write(), _lock()

    because they are simpler and treat the node generation more correctly.
    While we are at it, clean up and simplify surrounding code.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agoieee1394: remove superfluous assertions
Stefan Richter [Mon, 16 Feb 2009 22:42:31 +0000 (23:42 +0100)]
ieee1394: remove superfluous assertions

hpsb_read, hpsb_write, hpsb_lock are sleeping functions which nobody is
in danger to use in atomic context.  Besides, in_interrupt does not
cover all types of atomic context.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agoieee1394: inherit ud vendor_id from node vendor_id
Stefan Richter [Tue, 26 Aug 2008 23:24:25 +0000 (01:24 +0200)]
ieee1394: inherit ud vendor_id from node vendor_id

While Module_Vendor_ID in the configuration ROM's root directory is
mandatory, there often aren't vendor IDs in unit directories.  This
affects the new firedtv driver which is meant to be auto-loaded and
matched only for vendor-specific devices.

We now always copy ne->vendor_id into ud->vendor_id before we scan a
unit directory (and fill in a possibly present vendor ID from there).
This way, the root directory's vendor ID is used as fallback in the
"uevent" environment for modprobe'ing per module alias when a node was
plugged in, and in the driver match routine when protocol drivers are
bound to unit directories.  It will however not be used as sysfs
attribute of a unit directory device.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agoieee1394: add hpsb_node_read() and hpsb_node_lock()
Stefan Richter [Wed, 27 Aug 2008 11:40:02 +0000 (13:40 +0200)]
ieee1394: add hpsb_node_read() and hpsb_node_lock()

These will be used by the firedtv driver.  Like hpsb_node_write() they
are much better APIs for high-level drivers than hpsb_write() and its
siblings --- easier to use correctly and also terser.

Unlike hspb_node_write(), the two new functions will only be used by
one call site.  Hence make them static inline instead of exported
symbols.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agoieee1394: use correct barrier types between accesses of nodeid and generation
Stefan Richter [Tue, 26 Aug 2008 23:18:32 +0000 (01:18 +0200)]
ieee1394: use correct barrier types between accesses of nodeid and generation

A compiler barrier (explicit on the read side, implicit on the write
side) is not quite enough for what has to be accomplished here.  Use
hardware memory barriers on systems which need them.

(Of course a full fix of generation handling would require much more
than this.  The ieee1394 core's bus generation counter had to be tied to
the controller's bus generation counter; cf. Kristian's stack.  It's
just that I have other current business with the code around these
barrier()s, so why not do at least this small fix.)

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agofiresat: copyrights, rename to firedtv, API conversions, fix remote control input
Stefan Richter [Mon, 25 Aug 2008 22:17:30 +0000 (00:17 +0200)]
firesat: copyrights, rename to firedtv, API conversions, fix remote control input

Combination of the following changes:

Tue, 26 Aug 2008 00:17:30 +0200 (CEST)
firedtv: fix remote control input

    and update the scancode-to-keycode mapping to a current model.  Per
    default, various media key keycodes are emitted which closely match what
    is printed on the remote.  Userland can modify the mapping by means of
    evdev ioctls.  (Not tested.)

    The old scancode-to-keycode mapping is left in the driver but cannot be
    modified by ioctls.  This preserves status quo for old remotes.

Tue, 26 Aug 2008 00:11:28 +0200 (CEST)
firedtv: replace tasklet by workqueue job

    Non-atomic context is a lot nicer to work with.

Sun, 24 Aug 2008 23:30:00 +0200 (CEST)
firedtv: move some code back to ieee1394 core

    Partially reverts "ieee1394: remove unused code" of Linux 2.6.25.

Sun, 24 Aug 2008 23:29:30 +0200 (CEST)
firedtv: replace semaphore by mutex

    firesat->avc_sem and ->demux_sem have been used exactly like a mutex.
    The only exception is the schedule_remotecontrol tasklet which did a
    down_trylock in atomic context.  This is not possible with
    mutex_trylock; however the whole remote control related code is
    non-functional anyway at the moment.  This should be fixed eventually,
    probably by turning the tasklet into a worqueue job.

    Convert everything else from semaphore to mutex.

    Also rewrite a few of the affected functions to unlock the mutex at a
    single exit point, instead of in several branches.

Sun, 24 Aug 2008 23:28:45 +0200 (CEST)
firedtv: some header cleanups

    Unify #ifndef/#define/#endif guards against multiple inclusion.
    Drop extern keyword from function declarations.
    Remove #include's into header files where struct declarations suffice.

    Remove unused ohci1394 interface and related unused ieee1394 interfaces.

    Add a few missing #include's and remove a few apparently obsolete ones.
    Sort them alphabetically.

Sun, 24 Aug 2008 23:27:45 +0200 (CEST)
firedtv: nicer registration message and some initialization fixes

    Print the correct name in dvb_register_adapter().

    While we are at it, replace two switch cascades by one for loop, remove
    a superfluous member of struct firesat and of two unused arguments of
    AVCIdentifySubunit(), and fix bogus kfree's in firesat_dvbdev_init().

Tue, 26 Aug 2008 14:24:17 +0200 (CEST)
firesat: rename to firedtv

    Suggested by Andreas Monitzer.  Besides DVB-S/-S2 receivers, the driver
    also supports DVB-C and DVB-T receivers, hence the previous project name
    is too narrow now.

    Not yet done:  Rename source directory, files, types, variables...

Sun, 24 Aug 2008 23:26:23 +0200 (CEST)
firesat: add missing copyright notes

    Reported by Andreas Monitzer and Christian Dolzer.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
15 years agofiresat: avc resend
Henrik Kurelid [Sun, 24 Aug 2008 13:20:07 +0000 (15:20 +0200)]
firesat: avc resend

- Add resending of AVC message to the card if no answer is received
  - Replace the homebrewed event_wait function with a standard wait queue
  - Clean up of log/error messages
  - Increase debug level of avc communication

Signed-off-by: Henrik Kurelid <henrik@kurelid.se>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>