safe/jmp/linux-2.6
15 years agodyn_array: split dyn_array functions from init/main.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:54 +0000 (20:50 -0700)]
dyn_array: split dyn_array functions from init/main.c

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoxen: fix memory access violation bug when CONFIG_HAVE_SPARSE_IRQ is enabled
Alex Nixon [Wed, 20 Aug 2008 03:50:53 +0000 (20:50 -0700)]
xen: fix memory access violation bug when CONFIG_HAVE_SPARSE_IRQ is enabled

When sparse IRQs are enabled, it is not safe to assume an IRQ descriptor
exists for every possible IRQ.  This patch causes init_evtchn_cpu_bindings
to skip initialisation of IRQ descriptors which don't exist.

Signed-off-by: Alex Nixon <alex.nixon@citrix.com>
Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: probe nr_irqs even only mptable is used
Yinghai Lu [Wed, 20 Aug 2008 03:50:52 +0000 (20:50 -0700)]
x86: probe nr_irqs even only mptable is used

for !CONFIG_HAVE_SPARSE_IRQ

fix:

 In file included from arch/x86/kernel/early-quirks.c:18:
 include/asm/io_apic.h: In function 'probe_nr_irqs':
 include/asm/io_apic.h:209: error: 'NR_IRQS' undeclared (first use in this function)
 include/asm/io_apic.h:209: error: (Each undeclared identifier is reported only once
 include/asm/io_apic.h:209: error: for each function it appears in.)

v2: fix by Ingo

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: make HAVE_SPARSE_IRQ support selectable
Yinghai Lu [Wed, 20 Aug 2008 03:50:51 +0000 (20:50 -0700)]
x86: make HAVE_SPARSE_IRQ support selectable

Ingo said sparse_irq is some intrusive. need to make it selectable

to make it simple, remove irq_desc as parameter in some functions.
(ack, eoi, set_affinity).
may need to make member if irq_chip to take irq_desc, or struct irq later.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: print local APIC of APs one by one
Yinghai Lu [Wed, 20 Aug 2008 03:50:50 +0000 (20:50 -0700)]
x86: print local APIC of APs one by one

instead of print that of all APs at the time

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: remove first_free_entry/pin_map_size
Yinghai Lu [Wed, 20 Aug 2008 03:50:49 +0000 (20:50 -0700)]
x86: remove first_free_entry/pin_map_size

no user now

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: unify ack_apic_edge
Yinghai Lu [Wed, 20 Aug 2008 03:50:48 +0000 (20:50 -0700)]
x86: unify ack_apic_edge

use code in 64 to replace
move_native_irq(irq, desc);
in 32 bit

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: unify mask_IO_APIC_irq
Yinghai Lu [Wed, 20 Aug 2008 03:50:47 +0000 (20:50 -0700)]
x86: unify mask_IO_APIC_irq

use MACRO for 32 bit too

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: irq: interrupt array size should be NR_VECTORS
Yinghai Lu [Wed, 20 Aug 2008 03:50:46 +0000 (20:50 -0700)]
x86: irq: interrupt array size should be NR_VECTORS

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agopci: change msi-x vector to 32bit
Yinghai Lu [Wed, 20 Aug 2008 03:50:45 +0000 (20:50 -0700)]
pci: change msi-x vector to 32bit

we are using 28bit pci (bus/dev/fn + 12 bits) as irq number, so the
cache for irq number should be 32 bit too.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoio_apic: make 32 bit have io_apic resource in /proc/iomem
Yinghai Lu [Wed, 20 Aug 2008 03:50:43 +0000 (20:50 -0700)]
io_apic: make 32 bit have io_apic resource in /proc/iomem

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agorename io_apic_64.c and io_apic_32.c to io_apic.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:42 +0000 (20:50 -0700)]
rename io_apic_64.c and io_apic_32.c to io_apic.c

The two files are now line by line equal. (sans a printk)

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: make io_apic_32.c the same as io_apic_64.c
Ingo Molnar [Wed, 20 Aug 2008 07:07:45 +0000 (09:07 +0200)]
x86: make io_apic_32.c the same as io_apic_64.c

Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: make io_apic_64.c and io_apic_32.c the same
Yinghai Lu [Wed, 20 Aug 2008 03:50:41 +0000 (20:50 -0700)]
x86: make io_apic_64.c and io_apic_32.c the same

all the same except INTR_REMAPPING related and ioapic io resource.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: remove ioapic_force
Yinghai Lu [Wed, 20 Aug 2008 03:50:40 +0000 (20:50 -0700)]
x86: remove ioapic_force

no user left.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: make 64 handle sis_apic_bug like the 32 bit
Yinghai Lu [Wed, 20 Aug 2008 03:50:39 +0000 (20:50 -0700)]
x86: make 64 handle sis_apic_bug like the 32 bit

do we have 64bit system with sis chipset?

[ mingo@elte.hu: nope, the problem chipset was 32-bit only.
                 The code symmetry is good nevertheless. ]

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: make headers files the same in io_apic_xx.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:38 +0000 (20:50 -0700)]
x86: make headers files the same in io_apic_xx.c

also make no_timer_check to be global on 64 bit, because vmi_32 is using that.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agosparseirq: fix lockdep
Ingo Molnar [Wed, 20 Aug 2008 03:50:37 +0000 (20:50 -0700)]
sparseirq: fix lockdep

-tip testing found this lockdep splat:

[    0.000000] Initializing CPU#0
[    0.000000] found new irq_desc for irq 0
[    0.000000] INFO: trying to register non-static key.
[    0.000000] the code is fine but needs lockdep annotation.
[    0.000000] turning off the locking correctness validator.
[    0.000000] Pid: 0, comm: swapper Not tainted 2.6.27-rc3-tip-00191-g98ccb89-dirty #1
[    0.000000]  [<c0153c22>] register_lock_class+0x3d2/0x400
[    0.000000]  [<c0104d87>] ? mcount_call+0x5/0xa
[    0.000000]  [<c0154f3a>] __lock_acquire+0x22a/0x5d0
[    0.000000]  [<c0104d87>] ? mcount_call+0x5/0xa
[    0.000000]  [<c0155351>] lock_acquire+0x71/0xa0
[    0.000000]  [<c016d61f>] ? set_irq_chip+0x3f/0x90
[    0.000000]  [<c070f148>] _spin_lock_irqsave+0x58/0x90
[    0.000000]  [<c016d61f>] ? set_irq_chip+0x3f/0x90
[    0.000000]  [<c016d61f>] set_irq_chip+0x3f/0x90
[    0.000000]  [<c016d7e0>] ? handle_level_irq+0x0/0xe0
[    0.000000]  [<c016da1a>] set_irq_chip_and_handler_name+0x1a/0x40
[    0.000000]  [<c0a396c1>] init_ISA_irqs+0x51/0xa0
[    0.000000]  [<c0a4a365>] pre_intr_init_hook+0x25/0x30
[    0.000000]  [<c0a39723>] native_init_IRQ+0x13/0x370
[    0.000000]  [<c015569c>] ? lock_release+0xcc/0x1d0
[    0.000000]  [<c0104d87>] ? mcount_call+0x5/0xa
[    0.000000]  [<c070dc22>] ? __mutex_unlock_slowpath+0x92/0x110
[    0.000000]  [<c070dcad>] ? mutex_unlock+0xd/0x10
[    0.000000]  [<c0135f62>] ? cpu_maps_update_done+0x12/0x20
[    0.000000]  [<c06c6743>] ? register_cpu_notifier+0x23/0x30
[    0.000000]  [<c011e8ae>] init_IRQ+0xe/0x10
[    0.000000]  [<c0a357a5>] start_kernel+0x1c5/0x340
[    0.000000]  [<c0a35280>] ? unknown_bootoption+0x0/0x210
[    0.000000]  [<c0a3506b>] i386_start_kernel+0x6b/0x80
[    0.000000]  =======================
[    0.000000] found new irq_desc for irq 1
[    0.000000] found new irq_desc for irq 2
[    0.000000] found new irq_desc for irq 3

this:

 static void init_one_irq_desc(struct irq_desc *desc)
 {
         memcpy(desc, &irq_desc_init, sizeof(struct irq_desc));
 #ifdef CONFIG_TRACE_IRQFLAGS
         lockdep_set_class(&desc->lock, &irq_desc_lock_class);
 #endif
 }

should be unconditional.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: order variables in io_apic_xx.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:36 +0000 (20:50 -0700)]
x86: order variables in io_apic_xx.c

move first_system_vector to apic_64.c.

also add #ifdef CONFIG_INTR_REMAP to prepare 32 bit to use
same file.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: ordering functions in io_apic_64.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:35 +0000 (20:50 -0700)]
x86: ordering functions in io_apic_64.c

try to make functions have the same order between 32-bit and 64-bit.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: ordering functions in io_apic_32.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:34 +0000 (20:50 -0700)]
x86: ordering functions in io_apic_32.c

prepare for unification:

try to make functions be of the same order to io_apic_64.c.

v2: add calling setup_msi_irq back to arch_setup_msi_irq

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86, io-apic: remove union about dest for log/phy
Yinghai Lu [Wed, 20 Aug 2008 03:50:33 +0000 (20:50 -0700)]
x86, io-apic: remove union about dest for log/phy

let user decide the meaning of the bits.

This unifies the 32-bit and 64-bit io-apic code a bit.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: add debug info for 32bit sparse_irq
Yinghai Lu [Wed, 20 Aug 2008 03:50:32 +0000 (20:50 -0700)]
x86: add debug info for 32bit sparse_irq

so could figure out bugs where we get an interrupt, but vector_irq is
not initialized yet.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: make 32bit support per_cpu vector
Yinghai Lu [Wed, 20 Aug 2008 03:50:28 +0000 (20:50 -0700)]
x86: make 32bit support per_cpu vector

so we can merge io_apic_32.c and io_apic_64.c

v2: Use cpu_online_map as target cpus for bigsmp, just like 64-bit is doing.

Also remove some unused TARGET_CPUS macro.

v3: need to check if desc is null in smp_irq_move_cleanup

also migration needs to reset vector too, so copy __target_IO_APIC_irq
from 64bit.

(the duplication will go away once the two files are unified.)

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: make 32 bit to use sparse_irq
Yinghai Lu [Wed, 20 Aug 2008 03:50:27 +0000 (20:50 -0700)]
x86: make 32 bit to use sparse_irq

but actually irq still needs to be less than NR_IRQS, because
interrupt[NR_IRQS] in entry.S.

need to enable per_cpu vector...

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: make 32bit to use irq_2_pin in irq_cfg
Yinghai Lu [Wed, 20 Aug 2008 03:50:26 +0000 (20:50 -0700)]
x86: make 32bit to use irq_2_pin in irq_cfg

so it is more like 64 bit.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: make 32bit use irq_cfg_alloc, etc
Yinghai Lu [Wed, 20 Aug 2008 03:50:25 +0000 (20:50 -0700)]
x86: make 32bit use irq_cfg_alloc, etc

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: add irq_cfg for 32bit
Yinghai Lu [Wed, 20 Aug 2008 03:50:24 +0000 (20:50 -0700)]
x86: add irq_cfg for 32bit

it only contains vector ...

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: remove irqbalance in kernel for 32 bit
Yinghai Lu [Wed, 20 Aug 2008 03:50:23 +0000 (20:50 -0700)]
x86: remove irqbalance in kernel for 32 bit

This has been deprecated for years, the user space irqbalanced utility
works better with numa, has configurable policies, etc...

Signed-off-by: Yinghai Lu <yhlu.kernel@gmai.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: use 28 bits irq NR for pci msi/msix and ht
Yinghai Lu [Wed, 20 Aug 2008 03:50:22 +0000 (20:50 -0700)]
x86: use 28 bits irq NR for pci msi/msix and ht

also print out irq no in /proc/interrups and /proc/stat in hex, so could
tell bus/dev/func.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: put irq_2_iommu pointer into irq_desc
Yinghai Lu [Wed, 20 Aug 2008 03:50:21 +0000 (20:50 -0700)]
x86: put irq_2_iommu pointer into irq_desc

when CONFIG_HAVE_SPARSE_IRQ
preallocate some irq_2_iommu entries, and use get_one_free_irq_2_iomm to
get new one and link to irq_desc if needed.

else will use dyn_array or static array.

v2: <= nr_irqs fix

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86_64: make /proc/interrupts work with dyn irq_desc
Yinghai Lu [Wed, 20 Aug 2008 03:50:20 +0000 (20:50 -0700)]
x86_64: make /proc/interrupts work with dyn irq_desc

loop with irq_desc list

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86_64: separate irq_cfgx from irq_cfgx_free
Yinghai Lu [Wed, 20 Aug 2008 03:50:19 +0000 (20:50 -0700)]
x86_64: separate irq_cfgx from irq_cfgx_free

so later don't need to compare with -1U

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirq: separate sparse_irqs from sparse_irqs_free
Yinghai Lu [Wed, 20 Aug 2008 03:50:18 +0000 (20:50 -0700)]
irq: separate sparse_irqs from sparse_irqs_free

so later don't need compare with -1U

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86_64: rename irq_desc/irq_desc_alloc
Yinghai Lu [Wed, 20 Aug 2008 03:50:17 +0000 (20:50 -0700)]
x86_64: rename irq_desc/irq_desc_alloc

change names:

          irq_desc() ==> irq_desc_alloc
__irq_desc() ==> irq_desc

Also split a few of the uses in lowlevel x86 code.

v2: need to check if desc is null in smp_irq_move_cleanup

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: check with without_new in show_interrupts
Yinghai Lu [Wed, 20 Aug 2008 03:50:16 +0000 (20:50 -0700)]
x86: check with without_new in show_interrupts

so we don't get new one that we don't need it.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agogeneric: add irq_desc in function in parameter
Yinghai Lu [Wed, 20 Aug 2008 03:50:15 +0000 (20:50 -0700)]
generic: add irq_desc in function in parameter

So we could remove some duplicated calling to irq_desc

v2: make sure irq_desc in  init/main.c is not used without generic_hardirqs

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirq: remove >= nr_irqs checking with config_have_sparse_irq
Yinghai Lu [Wed, 20 Aug 2008 03:50:14 +0000 (20:50 -0700)]
irq: remove >= nr_irqs checking with config_have_sparse_irq

remove irq limit checks - nr_irqs is dynamic and we expand anytime.

v2: fix checking about result irq_cfg_without_new, so could use msi again
v3: use irq_desc_without_new to check irq is valid

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86, ioapic: replace loop with nr_irqs with for_each_irq_icfg
Yinghai Lu [Wed, 20 Aug 2008 03:50:13 +0000 (20:50 -0700)]
x86, ioapic: replace loop with nr_irqs with for_each_irq_icfg

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirq, fs/proc: replace loop with nr_irqs for proc/stat
Yinghai Lu [Wed, 20 Aug 2008 03:50:12 +0000 (20:50 -0700)]
irq, fs/proc: replace loop with nr_irqs for proc/stat

Replace another nr_irqs loop to avoid the allocation of all sparse
irq entries - use for_each_irq_desc instead.

v2: make sure arch without GENERIC_HARDIRQS works too

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirq: replace loop with nr_irqs with for_each_irq_desc
Yinghai Lu [Wed, 20 Aug 2008 03:50:11 +0000 (20:50 -0700)]
irq: replace loop with nr_irqs with for_each_irq_desc

There are a handful of loops that go from 0 to nr_irqs and use
get_irq_desc() on them. These would allocate all the irq_desc
entries, regardless of the need for them.

Use the smarter for_each_irq_desc() iterator that will only iterate
over the present ones.

v2: make sure arch without GENERIC_HARDIRQS work too

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirq: add irq_desc_without_new
Yinghai Lu [Wed, 20 Aug 2008 03:50:10 +0000 (20:50 -0700)]
irq: add irq_desc_without_new

add an irq_desc accessor that will not allocate any sparse entry
but returns failure if there's no entry present.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: move kstat_irqs from kstat to irq_desc
Yinghai Lu [Wed, 20 Aug 2008 03:50:09 +0000 (20:50 -0700)]
x86: move kstat_irqs from kstat to irq_desc

based on Eric's patch ...

together mold it with dyn_array for irq_desc, will allcate kstat_irqs for
nr_irq_desc alltogether if needed. -- at that point nr_cpus is known already.

v2: make sure system without generic_hardirqs works they don't have irq_desc
v3: fix merging
v4: [mingo@elte.hu] fix typo

[ mingo@elte.hu ] irq: build fix

fix:

 arch/x86/xen/spinlock.c: In function 'xen_spin_lock_slow':
 arch/x86/xen/spinlock.c:90: error: 'struct kernel_stat' has no member named 'irqs'

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: put timer_rand_state pointer into irq_desc
Yinghai Lu [Wed, 20 Aug 2008 03:50:08 +0000 (20:50 -0700)]
x86: put timer_rand_state pointer into irq_desc

irq_timer_state[] is a NR_IRQS sized array that is a side-by array to
the real irq_desc[] array.

Integrate that field into the (now dynamic) irq_desc dynamic array and
save some RAM.

v2: keep the old way to support arch not support irq_desc

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: put irq_2_pin pointer into irq_cfg
Yinghai Lu [Wed, 20 Aug 2008 03:50:07 +0000 (20:50 -0700)]
x86: put irq_2_pin pointer into irq_cfg

preallocate 32 irq_2_pin entries, and use get_one_free_irq_2_pin() to get
one more and link to irq_cfg if needed.

so don't waste one where no irq is enabled.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: add irq_cfg in io_apic_64.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:06 +0000 (20:50 -0700)]
x86: add irq_cfg in io_apic_64.c

preallocate size is 32, and if it is not enough, irq_cfg will more
via alloc_bootmem() or kzalloc(). (depending on how early we are in
system setup)

v2: fix typo about size of init_one_irq_cfg ... should use sizeof(struct irq_cfg)
v3: according to Eric, change get_irq_cfg() to irq_cfg()
v4: squash add irq_cfg_alloc in

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirq: sparse irqs, fix IRQ auto-probe crash
Ingo Molnar [Wed, 20 Aug 2008 03:50:29 +0000 (20:50 -0700)]
irq: sparse irqs, fix IRQ auto-probe crash

fix:

[   10.631533] calling  yenta_socket_init+0x0/0x20
[   10.631533] Yenta: CardBus bridge found at 0000:15:00.0 [17aa:2012]
[   10.631533] Yenta: Using INTVAL to route CSC interrupts to PCI
[   10.631533] Yenta: Routing CardBus interrupts to PCI
[   10.631533] Yenta TI: socket 0000:15:00.0, mfunc 0x01d01002, devctl 0x64
[   10.731599] BUG: unable to handle kernel NULL pointer dereference at 00000040
[   10.731838] IP: [<c0c95b5f>] _spin_lock_irq+0xf/0x20
[   10.732221] *pde = 00000000
[   10.732741] Oops: 0002 [#1] SMP
[   10.733453]
[   10.734253] Pid: 1, comm: swapper Tainted: G        W (2.6.27-rc3-tip-00173-gd7eaa4f-dirty #1)
[   10.735188] EIP: 0060:[<c0c95b5f>] EFLAGS: 00010002 CPU: 0
[   10.735523] EIP is at _spin_lock_irq+0xf/0x20
[   10.735523] EAX: 00000040 EBX: 00000000 ECX: f6e04c90 EDX: 00000100
[   10.735523] ESI: 000000df EDI: f6e04c90 EBP: f7867df0 ESP: f7867df0
[   10.735523]  DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
[   10.735523] Process swapper (pid: 1, ti=f7867000 task=f7870000 task.ti=f7867000)
[   10.735523] Stack: f7867e04 c0155fbd 00000000 00000000 f6e04c90 f7867e5c c0c6e319 c0f6a074
[   10.735523]        f6e04c90 000017aa 00002012 c112b648 f791f240 c112b5e0 f7867e44 c010440b
[   10.735523]        f791f240 f791f29c c112b8ec f791f240 00000000 f7867e5c c048f893 03c0b648
[   10.735523] Call Trace:
[   10.735523]  [<c0155fbd>] ? probe_irq_on+0x3d/0x140
[   10.735523]  [<c0c6e319>] ? yenta_probe+0x529/0x640
[   10.735523]  [<c010440b>] ? mcount_call+0x5/0xa
[   10.735523]  [<c048f893>] ? pci_match_device+0xa3/0xb0
[   10.735523]  [<c048fc1e>] ? pci_device_probe+0x5e/0x80
[   10.735523]  [<c0515423>] ? driver_probe_device+0x83/0x180
[   10.735523]  [<c0515594>] ? __driver_attach+0x74/0x80
[   10.735523]  [<c0514b69>] ? bus_for_each_dev+0x49/0x70
[   10.735523]  [<c051528e>] ? driver_attach+0x1e/0x20
[   10.735523]  [<c0515520>] ? __driver_attach+0x0/0x80
[   10.735523]  [<c05150d3>] ? bus_add_driver+0x1a3/0x220
[   10.735523]  [<c048fb60>] ? pci_device_remove+0x0/0x40
[   10.735523]  [<c05157f4>] ? driver_register+0x54/0x130
[   10.735523]  [<c048fe2f>] ? __pci_register_driver+0x4f/0x90
[   10.735523]  [<c11e9419>] ? yenta_socket_init+0x19/0x20
[   10.735523]  [<c0101125>] ? do_one_initcall+0x35/0x160
[   10.735523]  [<c11e9400>] ? yenta_socket_init+0x0/0x20
[   10.735523]  [<c01391a6>] ? __queue_work+0x36/0x50
[   10.735523]  [<c013922d>] ? queue_work_on+0x3d/0x50
[   10.735523]  [<c11a2758>] ? kernel_init+0x148/0x210
[   10.735523]  [<c11a2610>] ? kernel_init+0x0/0x210
[   10.735523]  [<c01043f3>] ? kernel_thread_helper+0x7/0x10
[   10.735523]  =======================
[   10.735523] Code: 10 38 f2 74 06 f3 90 8a 10 eb f6 5d 89 c8 c3 8d b6 00 00 00 00 8d bc 27 00 00 00 00 55 89 e5 e8 a4 e8 46 ff fa ba 00 01 00 00 90 <66> 0f c1 10 38 f2 74 06 f3 90 8a 10 eb f6 5d c3 90 55 89 e5 53

as auto-probing wants to iterate over existing irqs.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agogeneric: sparse irqs: use irq_desc() together with dyn_array, instead of irq_desc[]
Yinghai Lu [Wed, 20 Aug 2008 03:50:05 +0000 (20:50 -0700)]
generic: sparse irqs: use irq_desc() together with dyn_array, instead of irq_desc[]

add CONFIG_HAVE_SPARSE_IRQ to for use condensed array.
Get rid of irq_desc[] array assumptions.

Preallocate 32 irq_desc, and irq_desc() will try to get more.

( No change in functionality is expected anywhere, except the odd build
  failure where we missed a code site or where a crossing commit itroduces
  new irq_desc[] usage. )

v2: according to Eric, change get_irq_desc() to irq_desc()

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: remove nr_irq_vectors
Yinghai Lu [Wed, 20 Aug 2008 03:50:04 +0000 (20:50 -0700)]
x86: remove nr_irq_vectors

remove unused defines derived from the (now obsolete) NR_IRQS define.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86, irq: get nr_irqs from madt
Yinghai Lu [Wed, 20 Aug 2008 03:50:03 +0000 (20:50 -0700)]
x86, irq: get nr_irqs from madt

Until now, NR_IRQS was derived from black magic defines that had to
be "large enough" to both accomodate NR_CPUS and MAX_NR_IO_APICs.

This resulted in a way too large irq_desc[] array on most x86 systems.
Especially with larger CPU masks, the size of irq_desc can spiral out
of control quickly.

So be smarter about it and use precise allocation instead: determine the
default maximum possible IRQ number from the ACPI MADT. Use a minimum limit
of at least 32 IRQs for broken BIOSes.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirq: sparse irqs, fix #3
Ingo Molnar [Wed, 20 Aug 2008 03:50:31 +0000 (20:50 -0700)]
irq: sparse irqs, fix #3

fix non-APIC UP build:

 arch/x86/kernel/built-in.o: In function `setup_arch':
 : undefined reference to `pin_map_size'
 arch/x86/kernel/built-in.o: In function `setup_arch':
 : undefined reference to `first_free_entry'

Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: use dyn_array in io_apic_xx.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:02 +0000 (20:50 -0700)]
x86: use dyn_array in io_apic_xx.c

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirq: make irqs in kernel stat use per_cpu_dyn_array
Yinghai Lu [Wed, 20 Aug 2008 03:50:01 +0000 (20:50 -0700)]
irq: make irqs in kernel stat use per_cpu_dyn_array

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirq: sparse irqs, export nr_irqs
Ingo Molnar [Wed, 20 Aug 2008 03:50:30 +0000 (20:50 -0700)]
irq: sparse irqs, export nr_irqs

fix:

  Building modules, stage 2.
  MODPOST 458 modules
  ERROR: "nr_irqs" [drivers/serial/8250.ko] undefined!

Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirq: make irq_desc to use dyn_array
Yinghai Lu [Wed, 20 Aug 2008 03:50:00 +0000 (20:50 -0700)]
irq: make irq_desc to use dyn_array

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirq: make irq2_iommu to use dyn_array
Yinghai Lu [Wed, 20 Aug 2008 03:49:59 +0000 (20:49 -0700)]
irq: make irq2_iommu to use dyn_array

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirqs: make irq_timer_state to use dyn_array
Yinghai Lu [Wed, 20 Aug 2008 03:49:58 +0000 (20:49 -0700)]
irqs: make irq_timer_state to use dyn_array

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agodrivers/xen: use nr_irqs
Yinghai Lu [Wed, 20 Aug 2008 03:49:57 +0000 (20:49 -0700)]
drivers/xen: use nr_irqs

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agofs/proc: use nr_irqs
Yinghai Lu [Wed, 20 Aug 2008 03:49:56 +0000 (20:49 -0700)]
fs/proc: use nr_irqs

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agodrivers/serial: use nr_irqs
Yinghai Lu [Wed, 20 Aug 2008 03:49:55 +0000 (20:49 -0700)]
drivers/serial: use nr_irqs

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agodrivers/scsi: use nr_irqs
Yinghai Lu [Wed, 20 Aug 2008 03:49:54 +0000 (20:49 -0700)]
drivers/scsi: use nr_irqs

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agodrivers/rtc: use nr_irqs
Yinghai Lu [Wed, 20 Aug 2008 03:49:53 +0000 (20:49 -0700)]
drivers/rtc: use nr_irqs

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agodrivers/pcmcia: use nr_irqs
Yinghai Lu [Wed, 20 Aug 2008 03:49:52 +0000 (20:49 -0700)]
drivers/pcmcia: use nr_irqs

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agodrivers/pci/ intr remapping: use nr_irqs
Yinghai Lu [Wed, 20 Aug 2008 03:49:51 +0000 (20:49 -0700)]
drivers/pci/ intr remapping: use nr_irqs

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agodrivers/net: use nr_irqs
Yinghai Lu [Wed, 20 Aug 2008 03:49:50 +0000 (20:49 -0700)]
drivers/net: use nr_irqs

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agodrivers/char: use nr_irqs
Yinghai Lu [Wed, 20 Aug 2008 03:49:49 +0000 (20:49 -0700)]
drivers/char: use nr_irqs

convert them to nr_irqs.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: use nr_irqs
Yinghai Lu [Wed, 20 Aug 2008 03:49:48 +0000 (20:49 -0700)]
x86: use nr_irqs

also add first_free_entry and pin_map_size, which were NR_IRQS derived
constants.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoirq: introduce nr_irqs
Yinghai Lu [Wed, 20 Aug 2008 03:49:47 +0000 (20:49 -0700)]
irq: introduce nr_irqs

at this point nr_irqs is equal NR_IRQS

convert a few easy users from NR_IRQS to dynamic nr_irqs.

v2: according to Eric, we need to take care of arch without generic_hardirqs

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: enable dyn_array support
Yinghai Lu [Wed, 20 Aug 2008 03:49:46 +0000 (20:49 -0700)]
x86: enable dyn_array support

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: alloc dyn_array all together
Yinghai Lu [Wed, 20 Aug 2008 03:49:45 +0000 (20:49 -0700)]
x86: alloc dyn_array all together

so could spare some memory with small alignment in bootmem

also tighten the alignment checking, and make print out less debug info.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoadd per_cpu_dyn_array support
Yinghai Lu [Wed, 20 Aug 2008 03:49:44 +0000 (20:49 -0700)]
add per_cpu_dyn_array support

allow dyn-array in per_cpu area, allocated dynamically.

usage:

|  /* in .h */
| struct kernel_stat {
|        struct cpu_usage_stat   cpustat;
|        unsigned int *irqs;
| };
|
|  /* in .c */
| DEFINE_PER_CPU(struct kernel_stat, kstat);
|
| DEFINE_PER_CPU_DYN_ARRAY_ADDR(per_cpu__kstat_irqs, per_cpu__kstat.irqs, sizeof(unsigned int), nr_irqs, sizeof(unsigned long), NULL);

after setup_percpu()/per_cpu_alloc_dyn_array(), the dyn_array in
per_cpu area is ready to use.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agogeneric: add dyn_array support
Yinghai Lu [Wed, 20 Aug 2008 03:49:43 +0000 (20:49 -0700)]
generic: add dyn_array support

Allow crazy big arrays via bootmem at init stage.
Architectures use CONFIG_HAVE_DYN_ARRAY to enable it.

usage:

| static struct irq_desc irq_desc_init __initdata = {
|        .status = IRQ_DISABLED,
|        .chip = &no_irq_chip,
|        .handle_irq = handle_bad_irq,
|        .depth = 1,
|        .lock = __SPIN_LOCK_UNLOCKED(irq_desc->lock),
| #ifdef CONFIG_SMP
|        .affinity = CPU_MASK_ALL
| #endif
| };
|
| static void __init init_work(void *data)
| {
|        struct dyn_array *da = data;
|        struct  irq_desc *desc;
|        int i;
|
|        desc = *da->name;
|
|        for (i = 0; i < *da->nr; i++)
|                memcpy(&desc[i], &irq_desc_init, sizeof(struct irq_desc));
| }
|
| struct irq_desc *irq_desc;
| DEFINE_DYN_ARRAY(irq_desc, sizeof(struct irq_desc), nr_irqs, PAGE_SIZE, init_work);

after pre_alloc_dyn_array() after setup_arch(), the array is ready to be
used.

Via this facility we can replace irq_desc[NR_IRQS] array with dyn_array
irq_desc[nr_irqs].

v2: remove _nopanic in pre_alloc_dyn_array()

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: remove irq_vectors_limits
Yinghai Lu [Wed, 20 Aug 2008 03:49:42 +0000 (20:49 -0700)]
x86: remove irq_vectors_limits

there's no user left.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agox86: add after_bootmem flag for 32bit
Yinghai Lu [Wed, 20 Aug 2008 03:49:41 +0000 (20:49 -0700)]
x86: add after_bootmem flag for 32bit

to prepare to use dyn_array support etc.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoserial, 8250: remove NR_IRQ usage
Alan Cox [Wed, 20 Aug 2008 03:49:40 +0000 (20:49 -0700)]
serial, 8250: remove NR_IRQ usage

Works on my test box with a quick test.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoMerge branch 'linus' into genirq
Ingo Molnar [Thu, 16 Oct 2008 14:51:32 +0000 (16:51 +0200)]
Merge branch 'linus' into genirq

15 years agoMerge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
Linus Torvalds [Tue, 14 Oct 2008 23:53:02 +0000 (16:53 -0700)]
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:
  i2c-viapro: Add support for SMBus Process Call transactions
  i2c: Restore i2c_smbus_process_call function
  i2c: Do earlier driver model init
  i2c: Only build Tyan SMBus mux drivers on x86
  i2c: Guard against oopses from bad init sequences
  i2c: Document the implementation details of the /dev interface
  i2c: Improve dev-interface documentation
  i2c-parport-light: Don't register a platform device resource
  hwmon: (dme1737) Convert to a new-style i2c driver
  hwmon: (dme1737) Be less i2c-centric
  i2c/tps65010: Vibrator hookup to gpiolib
  i2c-viapro: Add VX800/VX820 support
  i2c: Renesas Highlander FPGA SMBus support
  i2c-pca-isa: Don't grab arbitrary resources
  i2c/isp1301_omap: Convert to a new-style i2c driver, part 2
  i2c/isp1301_omap: Convert to a new-style i2c driver, part 1

15 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Linus Torvalds [Tue, 14 Oct 2008 23:35:43 +0000 (16:35 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/jikos/hid

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (55 commits)
  HID: build drivers for all quirky devices by default
  HID: add missing blacklist entry for Apple ATV ircontrol
  HID: add support for Bright ABNT2 brazilian device
  HID: Don't let Avermedia Radio FM800 be handled by usb hid drivers
  HID: fix numlock led on Dell device 0x413c/0x2105
  HID: remove warn() macro from usb hid drivers
  HID: remove info() macro from usb HID drivers
  HID: add appletv IR receiver quirk
  HID: fix a lockup regression when using force feedback on a PID device
  HID: hiddev.h: Fix example code.
  HID: hiddev.h: Fix mixed space and tabs in example code.
  HID: convert to dev_* prints
  HID: remove hid-ff
  HID: move zeroplus FF processing
  HID: move thrustmaster FF processing
  HID: move pantherlord FF processing
  HID: fix incorrent length condition in hidraw_write()
  HID: fix tty<->hid deadlock
  HID: ignore iBuddy devices
  HID: report descriptor fix for remaining MacBook JIS keyboards
  ...

15 years agoMerge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfashe...
Linus Torvalds [Tue, 14 Oct 2008 23:34:11 +0000 (16:34 -0700)]
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: (56 commits)
  ocfs2: Make cached block reads the common case.
  ocfs2: Kill the last naked wait_on_buffer() for cached reads.
  ocfs2: Move ocfs2_bread() into dir.c
  ocfs2: Simplify ocfs2_read_block()
  ocfs2: Require an inode for ocfs2_read_block(s)().
  ocfs2: Separate out sync reads from ocfs2_read_blocks()
  ocfs2: Refactor xattr list and remove ocfs2_xattr_handler().
  ocfs2: Calculate EA hash only by its suffix.
  ocfs2: Move trusted and user attribute support into xattr.c
  ocfs2: Uninline ocfs2_xattr_name_hash()
  ocfs2: Don't check for NULL before brelse()
  ocfs2: use smaller counters in ocfs2_remove_xattr_clusters_from_cache
  ocfs2: Documentation update for user_xattr / nouser_xattr mount options
  ocfs2: make la_debug_mutex static
  ocfs2: Remove pointless !!
  ocfs2: Add empty bucket support in xattr.
  ocfs2/xattr.c: Fix a bug when inserting xattr.
  ocfs2: Add xattr mount option in ocfs2_show_options()
  ocfs2: Switch over to JBD2.
  ocfs2: Add the 'inode64' mount option.
  ...

15 years agortc-cmos: look for PNP RTC first, then for platform RTC
Bjorn Helgaas [Tue, 14 Oct 2008 23:01:59 +0000 (17:01 -0600)]
rtc-cmos: look for PNP RTC first, then for platform RTC

We shouldn't rely on "pnp_platform_devices" to tell us whether there
is a PNP RTC device.

I introduced "pnp_platform_devices", but I think it was a mistake.
All it tells us is whether we found any PNPBIOS or PNPACPI devices.
Many machines have some PNP devices, but do not describe the RTC
via PNP.  On those machines, we need to do the platform driver probe
to find the RTC.

We should just register the PNP driver and see whether it claims anything.
If we don't find a PNP RTC, fall back to the platform driver probe.

This (in conjunction with the arch/x86/kernel/rtc.c patch to add
a platform RTC device when PNP doesn't have one) should resolve
these issues:

    http://bugzilla.kernel.org/show_bug.cgi?id=11580
    https://bugzilla.redhat.com/show_bug.cgi?id=451188

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Reported-by: Rik Theys <rik.theys@esat.kuleuven.be>
Reported-by: shr_msn@yahoo.com.tw
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agox86: register a platform RTC device if PNP doesn't describe it
Bjorn Helgaas [Tue, 14 Oct 2008 23:01:03 +0000 (17:01 -0600)]
x86: register a platform RTC device if PNP doesn't describe it

Most if not all x86 platforms have an RTC device, but sometimes the RTC
is not exposed as a PNP0b00/PNP0b01/PNP0b02 device in PNPBIOS or ACPI:

    http://bugzilla.kernel.org/show_bug.cgi?id=11580
    https://bugzilla.redhat.com/show_bug.cgi?id=451188

It's best if we can discover the RTC via PNP because then we know
which flavor of device it is, where it lives, and which IRQ it uses.

But if we can't, we should register a platform device using the
compiled-in RTC_PORT/RTC_IRQ resource assumptions.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Reported-by: Rik Theys <rik.theys@esat.kuleuven.be>
Reported-by: shr_msn@yahoo.com.tw
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agortc-cmos: move wake setup from ACPI glue into RTC driver
Bjorn Helgaas [Tue, 14 Oct 2008 19:50:21 +0000 (13:50 -0600)]
rtc-cmos: move wake setup from ACPI glue into RTC driver

Move rtc_wake_setup() from drivers/acpi/glue.c into the RTC driver
in drivers/rtc/rtc-cmos.c.

This removes the ordering constraint between the module_init(acpi_rtc_init)
and the cmos_do_probe() code that depends on it.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoHID: build drivers for all quirky devices by default
Jiri Kosina [Tue, 14 Oct 2008 21:37:33 +0000 (23:37 +0200)]
HID: build drivers for all quirky devices by default

Once kernel configuration has CONFIG_HID turned on, let also all the
specialized drivers for quirky devices to be built (unless CONFIG_EMBEDDED is
specified), as usually users don't care that much which driver
gives them the functionality, but when they want generic support, they
probably want to have support for all the quirky devices as well.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: add missing blacklist entry for Apple ATV ircontrol
Jiri Kosina [Tue, 14 Oct 2008 20:45:40 +0000 (22:45 +0200)]
HID: add missing blacklist entry for Apple ATV ircontrol

This device is already handled by hid-apple driver, but the blacklist entry
was missing in generic driver.

Reported-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: add support for Bright ABNT2 brazilian device
Mauro Carvalho Chehab [Tue, 14 Oct 2008 20:41:43 +0000 (22:41 +0200)]
HID: add support for Bright ABNT2 brazilian device

This keyboard needs to reset the LEDS during probe.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: Don't let Avermedia Radio FM800 be handled by usb hid drivers
Mauro Carvalho Chehab [Tue, 14 Oct 2008 20:34:32 +0000 (22:34 +0200)]
HID: Don't let Avermedia Radio FM800 be handled by usb hid drivers

Based on an original patch from Alexey Klimov <klimov.linux@gmail.com>,
against kernel version 2.6.27.

This device is already handled by radio-mr800 driver, and we therefore
want usbhid not to touch it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: fix numlock led on Dell device 0x413c/0x2105
Mauro Carvalho Chehab [Tue, 14 Oct 2008 13:08:47 +0000 (11:08 -0200)]
HID: fix numlock led on Dell device 0x413c/0x2105

This keyboard needs to re-sync numlock after probing.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: remove warn() macro from usb hid drivers
From: Greg Kroah-Hartman [Sat, 11 Oct 2008 22:25:51 +0000 (00:25 +0200)]
HID: remove warn() macro from usb hid drivers

USB should not be having it's own printk macros, so remove warn() and
use the system-wide standard of dev_warn() wherever possible.  In the
few places that will not work out, use a basic printk().

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: remove info() macro from usb HID drivers
Greg Kroah-Hartman [Sat, 11 Oct 2008 22:14:23 +0000 (00:14 +0200)]
HID: remove info() macro from usb HID drivers

USB should not be having it's own printk macros, so remove info() and
use the system-wide standard of dev_info() wherever possible.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: add appletv IR receiver quirk
Peter Korsgaard [Mon, 6 Oct 2008 09:15:34 +0000 (11:15 +0200)]
HID: add appletv IR receiver quirk

Similar to the existing IRCONTROL4 handling

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: fix a lockup regression when using force feedback on a PID device
Anssi Hannula [Sat, 4 Oct 2008 12:44:06 +0000 (14:44 +0200)]
HID: fix a lockup regression when using force feedback on a PID device

Commit 8006479c9b75fb6594a7b746af3d7f1fbb68f18f introduced a spinlock in
input_dev->event_lock, which is locked when handling input events.
However, the hid-pidff driver sleeps when handling events as it waits for
reports being sent to the device before changing the report contents
again.
This causes a system lockup when trying to use force feedback with a PID
device, a regression introduced in 2.6.24 and 2.6.23.15.

Fix it by extracting the raw report data from struct hid_report
immediately when hid_submit_report() is called, therefore allowing
drivers to change the contents of struct hid_report immediately without
affecting the already-queued transfer.

In hid-pidff, re-add the removed usbhid_wait_io() to
pidff_erase_effect() instead, to prevent a full report queue from causing
the submission to fail, thus not freeing up device memory.
pidff_erase_effect() is not called while dev->event_lock is held.

Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: hiddev.h: Fix example code.
Antonio Ospite [Thu, 2 Oct 2008 20:15:02 +0000 (22:15 +0200)]
HID: hiddev.h: Fix example code.

Fix hiddev.h example code.
To get the correct usage code, you need to set report_type and
report_id.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: hiddev.h: Fix mixed space and tabs in example code.
Antonio Ospite [Thu, 2 Oct 2008 20:14:54 +0000 (22:14 +0200)]
HID: hiddev.h: Fix mixed space and tabs in example code.

Fix mixed space and tabs in example code.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: convert to dev_* prints
Jiri Slaby [Thu, 18 Sep 2008 10:23:34 +0000 (12:23 +0200)]
HID: convert to dev_* prints

Since we have a real device bound to a driver, we may use struct
device for printing. Use dev_* functions instead of printks in
4 drivers.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: remove hid-ff
Jiri Slaby [Thu, 18 Sep 2008 10:23:33 +0000 (12:23 +0200)]
HID: remove hid-ff

hid-ff.c now calls only pidff (generic driver), the special ones are now
in separate drivers. Invoke pidff on all non-special directly.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: move zeroplus FF processing
Jiri Slaby [Thu, 18 Sep 2008 10:23:32 +0000 (12:23 +0200)]
HID: move zeroplus FF processing

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: move thrustmaster FF processing
Jiri Slaby [Thu, 18 Sep 2008 10:23:31 +0000 (12:23 +0200)]
HID: move thrustmaster FF processing

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: move pantherlord FF processing
Jiri Slaby [Thu, 18 Sep 2008 17:43:32 +0000 (19:43 +0200)]
HID: move pantherlord FF processing

Move the force feedback processing into a separate module.

[jkosina@suse.cz: fix Kconfig texts a little bit]

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: fix incorrent length condition in hidraw_write()
Jiri Kosina [Wed, 17 Sep 2008 17:41:58 +0000 (19:41 +0200)]
HID: fix incorrent length condition in hidraw_write()

The bound check on the buffer length

if (count > HID_MIN_BUFFER_SIZE)

is of course incorrent, the proper check is

if (count > HID_MAX_BUFFER_SIZE)

Fix it.

Reported-by: Jerry Ryle <jerry@mindtribe.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15 years agoHID: fix tty<->hid deadlock
Jiri Slaby [Mon, 8 Sep 2008 23:23:03 +0000 (01:23 +0200)]
HID: fix tty<->hid deadlock

hid_compat_load() runs on the default workqueue, it request_module(), it
execs modprobe, it exits, tty flushes default workqueue, it hangs, because
we are still in it.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Tested-by: <Valdis.Kletnieks@vt.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>