platform/kernel/linux-3.10.git
16 years agoMerge phase #5 (misc) of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux...
Linus Torvalds [Mon, 13 Oct 2008 16:54:35 +0000 (09:54 -0700)]
Merge phase #5 (misc) of git://git./linux/kernel/git/tip/linux-2.6-tip

Merges oprofile, timers/hpet, x86/traps, x86/time, and x86/core misc items.

* 'x86-core-v4-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (132 commits)
  x86: change early_ioremap to use slots instead of nesting
  x86: adjust dependencies for CONFIG_X86_CMOV
  dumpstack: x86: various small unification steps, fix
  x86: remove additional_cpus
  x86: remove additional_cpus configurability
  x86: improve UP kernel when CPU-hotplug and SMP is enabled
  dumpstack: x86: various small unification steps
  dumpstack: i386: make kstack= an early boot-param and add oops=panic
  dumpstack: x86: use log_lvl and unify trace formatting
  dumptrace: x86: consistently include loglevel, print stack switch
  dumpstack: x86: add "end" parameter to valid_stack_ptr and print_context_stack
  dumpstack: x86: make printk_address equal
  dumpstack: x86: move die_nmi to dumpstack_32.c
  traps: x86: finalize unification of traps.c
  traps: x86: make traps_32.c and traps_64.c equal
  traps: x86: various noop-changes preparing for unification of traps_xx.c
  traps: x86_64: use task_pid_nr(tsk) instead of tsk->pid in do_general_protection
  traps: i386: expand clear_mem_error and remove from mach_traps.h
  traps: x86_64: make io_check_error equal to the one on i386
  traps: i386: use preempt_conditional_sti/cli in do_int3
  ...

16 years agotty: rename the remaining oddly named n_tty functions
Alan Cox [Mon, 13 Oct 2008 09:46:24 +0000 (10:46 +0100)]
tty: rename the remaining oddly named n_tty functions

Original idea for this from a patch by Rodolfo Giometti which merges various
bits of PPS support

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agofs3270: Correct error returns
Alan Cox [Mon, 13 Oct 2008 09:46:09 +0000 (10:46 +0100)]
fs3270: Correct error returns

Drop the kernel lock further and also correct cases where we set rc to an
error code, and then return 0

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agofs3270: remove extra locks
Alan Cox [Mon, 13 Oct 2008 09:45:52 +0000 (10:45 +0100)]
fs3270: remove extra locks

get_current_tty now does internal locking and returns a referenced object,
thus our use of tty_mutex here can go away.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: tty_io.c shadows sparse fix
Jason Wessel [Mon, 13 Oct 2008 09:45:36 +0000 (10:45 +0100)]
tty: tty_io.c shadows sparse fix

drivers/char/tty_io.c:1413:17: warning: symbol 'buf' shadows an earlier one
drivers/char/tty_io.c:1379:20: originally declared here

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoserial: fix device name reporting when minor space is shared between drivers
David S. Miller [Mon, 13 Oct 2008 09:45:26 +0000 (10:45 +0100)]
serial: fix device name reporting when minor space is shared between drivers

The multiple drivers share the minor space occupied by a particular major
number, the actual index within the device name's space is indicated by
the tty_driver->name_base + uart_port->line

Another usable formula is (uart_driver->minor - MINOR_BASE) + port->line

Use those to print the device names properly in such situations in
serial_core.c and 8250.c

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoapplicom: Fix an unchecked user ioctl range and an error return
Alan Cox [Mon, 13 Oct 2008 09:45:17 +0000 (10:45 +0100)]
applicom: Fix an unchecked user ioctl range and an error return

Closes bug #11408 by checking the card index range for command 0
Fixes the ioctl to return ENOTTY which is correct for unknown ioctls

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Minor tidyups and document fixes for n_tty
Alan Cox [Mon, 13 Oct 2008 09:45:06 +0000 (10:45 +0100)]
tty: Minor tidyups and document fixes for n_tty

Remove/fix some bogus NULL checks, comment some locking etc

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Remove lots of NULL checks
Alan Cox [Mon, 13 Oct 2008 09:44:57 +0000 (10:44 +0100)]
tty: Remove lots of NULL checks

Many tty drivers contain 'can't happen' checks against NULL pointers passed
in by the tty layer. These have never been possible to occur. Even more
importantly if they ever do occur we want to know as it would be a serious
bug.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: fix up gigaset a bit
Alan Cox [Mon, 13 Oct 2008 09:44:43 +0000 (10:44 +0100)]
tty: fix up gigaset a bit

Stephen's fixes reminded me that gigaset is still rather broken so fix it up
a bit

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Fallout from tty-move-canon-specials
Stephen Rothwell [Mon, 13 Oct 2008 09:44:33 +0000 (10:44 +0100)]
tty: Fallout from tty-move-canon-specials

Today's linux-next build (x86_64 allmodconfig) failed like this:

/drivers/char/tty_ioctl.c: In function 'change_termios':
drivers/isdn/capi/capi.c:1234: error: implicit declaration of function 'n_tty_ioctl'
drivers/isdn/gigaset/ser-gigaset.c: In function 'gigaset_tty_ioctl':
drivers/isdn/gigaset/ser-gigaset.c:648: error: implicit declaration of function 'n_tty_ioctl'

Introduced by commit 686b5e4aea05a80e370dc931b7f4a8d03c80da54
("tty-move-canon-specials").  I added the following patch (which may not
be correct).

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: some ICANON magic is in the wrong places
Alan Cox [Mon, 13 Oct 2008 09:44:17 +0000 (10:44 +0100)]
tty: some ICANON magic is in the wrong places

Move the set up on ldisc change into the ldisc
Move the INQ/OUTQ cases into the driver not in shared ioctl code where it
gives bogus answers for other ldisc values

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: simplify ktermios allocation
Alan Cox [Mon, 13 Oct 2008 09:44:08 +0000 (10:44 +0100)]
tty: simplify ktermios allocation

Copy the simplification from the pty unix98 special case to the generic one.
This allows us to kill off driver->termios_locked entirely which is nice. We
have to whack bits of the cris driver as it meddles in places it shouldn't
providing its own arrays that were never used anyway.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agopty: simplify unix98 allocation
Alan Cox [Mon, 13 Oct 2008 09:43:58 +0000 (10:43 +0100)]
pty: simplify unix98 allocation

We need both termios and termios_locked so allocate them as one

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agopty: Fix allocation failure double free
Alan Cox [Mon, 13 Oct 2008 09:43:48 +0000 (10:43 +0100)]
pty: Fix allocation failure double free

The updating and moving around of the pty code added a bug where both the
helper and caller free the main tty struct (the pty driver must free the
o_tty pair itself however).

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agopty: Coding style and polish
Alan Cox [Mon, 13 Oct 2008 09:43:38 +0000 (10:43 +0100)]
pty: Coding style and polish

We've done the heavy lifting now its time to mop up a bit

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoSimplify devpts_pty_kill
Sukadev Bhattiprolu [Mon, 13 Oct 2008 09:43:27 +0000 (10:43 +0100)]
Simplify devpts_pty_kill

When creating a new pty, save the pty's inode in the tty->driver_data.
Use this inode in pty_kill() to identify the devpts instance. Since
we now have the inode for the pty, we can skip get_node() lookup and
remove the unused get_node().

TODO:
- check if the mutex_lock is needed in pty_kill().

Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoSimplify devpts_pty_new()
Sukadev Bhattiprolu [Mon, 13 Oct 2008 09:43:18 +0000 (10:43 +0100)]
Simplify devpts_pty_new()

devpts_pty_new() is called when setting up a new pty and would not
will not have an existing dentry or inode for the pty. So don't bother
looking for an existing dentry - just create a new one.

Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoSimplify devpts_get_tty()
Sukadev Bhattiprolu [Mon, 13 Oct 2008 09:43:08 +0000 (10:43 +0100)]
Simplify devpts_get_tty()

As pointed out by H. Peter Anvin, since the inode for the pty is known,
we don't need to look it up.

Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoAdd an instance parameter devpts interfaces
Sukadev Bhattiprolu [Mon, 13 Oct 2008 09:42:59 +0000 (10:42 +0100)]
Add an instance parameter devpts interfaces

Pass-in 'inode' or 'tty' parameter to devpts interfaces.  With multiple
devpts instances, these parameters will be used in subsequent patches
to identify the instance of devpts mounted. The parameters also help
simplify devpts implementation.

Changelog[v3]:
- minor changes due to merge with ttydev updates
- rename parameters to emphasize they are ptmx or pts inodes
- pass-in tty_struct * to devpts_pty_kill() (this will help
  cleanup the get_node() call in a subsequent patch)

Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoMove tty lookup/reopen to caller
Sukadev Bhattiprolu [Mon, 13 Oct 2008 09:42:49 +0000 (10:42 +0100)]
Move tty lookup/reopen to caller

Move tty_driver_lookup_tty() and tty_reopen() from tty_init_dev()
into tty_open() (one of the two callers of tty_init_dev()).  These
calls are not really required in ptmx_open(), the other caller,
since ptmx_open() would be setting up a new tty.

Changelog[v2]:
- remove the lookup and reopen calls from ptmx_open
- merge with recent changes to ttydev tree

Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: extract the pty init time special cases
Alan Cox [Mon, 13 Oct 2008 09:42:39 +0000 (10:42 +0100)]
tty: extract the pty init time special cases

The majority of the remaining init_dev code is pty special cases. We
refactor this code into the driver->install method.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Finish fixing up the init_dev interface to use ERR_PTR
Alan Cox [Mon, 13 Oct 2008 09:42:29 +0000 (10:42 +0100)]
tty: Finish fixing up the init_dev interface to use ERR_PTR

Original suggestion and proposal from Sukadev Bhattiprolu.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: More driver operations
Alan Cox [Mon, 13 Oct 2008 09:42:19 +0000 (10:42 +0100)]
tty: More driver operations

We have the lookup operation abstracted which is nice for pty cleanup but
we really want to abstract the add/remove entries as well so that we can
pull the pty code out of the tty core and create a clear defined interface
for the tty driver table.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: kref the tty driver object
Alan Cox [Mon, 13 Oct 2008 09:42:09 +0000 (10:42 +0100)]
tty: kref the tty driver object

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Clean up the tty_init_dev changes further
Alan Cox [Mon, 13 Oct 2008 09:42:00 +0000 (10:42 +0100)]
tty: Clean up the tty_init_dev changes further

Fix up the naming, style and extract some bits of code into the driver
specific code

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Move parts of tty_init_dev into new functions
Sukadev Bhattiprolu [Mon, 13 Oct 2008 09:41:51 +0000 (10:41 +0100)]
tty: Move parts of tty_init_dev into new functions

Move the 'find-tty' and 'fast-track-open' parts of init_dev() to
separate functions.

Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Remove more special casing and out of place code
Alan Cox [Mon, 13 Oct 2008 09:41:42 +0000 (10:41 +0100)]
tty: Remove more special casing and out of place code

Carry on pushing code out of tty_io when it belongs to other drivers. I'm
not 100% happy with some of this and it will be worth revisiting some of the
exports later when the restructuring work is done.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: shutdown method
Alan Cox [Mon, 13 Oct 2008 09:41:30 +0000 (10:41 +0100)]
tty: shutdown method

Right now there are various drivers that try to use tty->count to know when
they get the final close. Aristeau Rozanski showed while debugging the vt
sysfs race that this isn't entirely safe.

Instead of driver side tricks to work around this introduce a shutdown which
is called when the tty is being destructed. This also means that the shutdown
method is tied into the refcounting.

Use this to rework the console close/sysfs logic.

Remove lots of special case code from the tty core code. The pty code can now
have a shutdown() method that replaces the special case hackery in the tree
free up paths.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agovt: remove bogus lock dropping
Alan Cox [Mon, 13 Oct 2008 09:41:16 +0000 (10:41 +0100)]
vt: remove bogus lock dropping

For hysterical raisins the vt layer drops and retakes locks in the write
method. This is a left over from the days when user/kernel data was passed
directly to the tty not pre-buffered.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agopty: If the administrator creates a device for a ptmx slave we should not error
Alan Cox [Mon, 13 Oct 2008 09:41:03 +0000 (10:41 +0100)]
pty: If the administrator creates a device for a ptmx slave we should not error

The open path for ptmx slaves is via the ptmx device. Opening them any
other way is not allowed. Vegard Nossum found that previously this was not
the case and mknod foo c 128 42; cat foo would produce nasty diagnostics

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Fix abusers of current->sighand->tty
Alan Cox [Mon, 13 Oct 2008 09:40:53 +0000 (10:40 +0100)]
tty: Fix abusers of current->sighand->tty

Various people outside the tty layer still stick their noses in behind the
scenes. We need to make sure they also obey the locking and referencing rules.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Redo current tty locking
Alan Cox [Mon, 13 Oct 2008 09:40:43 +0000 (10:40 +0100)]
tty: Redo current tty locking

Currently it is sometimes locked by the tty mutex and sometimes by the
sighand lock. The latter is in fact correct and now we can hand back referenced
objects we can fix this up without problems around sleeping functions.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: the vhangup syscall is racy
Alan Cox [Mon, 13 Oct 2008 09:40:30 +0000 (10:40 +0100)]
tty: the vhangup syscall is racy

We now have the infrastructure to sort this out but rather than teaching
the syscall tty lock rules we move the hard work into a tty helper

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agomxser: Switch to kref tty
Alan Cox [Mon, 13 Oct 2008 09:40:19 +0000 (10:40 +0100)]
mxser: Switch to kref tty

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agostallion: Use krefs
Alan Cox [Mon, 13 Oct 2008 09:40:07 +0000 (10:40 +0100)]
stallion: Use krefs

Use tty_port_init and krefs in the stallion drivers to protect us from devices
going away underneath us. As with the other drives some rearranging is done to
pass the tty structure down properly on the user side.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: kref usage for isicom and moxa
Alan Cox [Mon, 13 Oct 2008 09:39:58 +0000 (10:39 +0100)]
tty: kref usage for isicom and moxa

Rather than blindly keep taking krefs we reorder the code in a few places
to pass the tty down to the right place (which is important as from the user
side it is not the case that tty == port->tty in all situations). For the irq
and related paths use the krefs to stop the tty being freed under us.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: usb-serial krefs
Alan Cox [Mon, 13 Oct 2008 09:39:46 +0000 (10:39 +0100)]
tty: usb-serial krefs

Use kref in the USB serial drivers so that we don't free tty structures
from under the URB receive handlers as has historically been the case if
you were unlucky. This also gives us a framework for general tty drivers to
use tty_port objects and refcount.

Contains two err->dev_err changes merged together to fix clashes in the
-next tree.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Move tty_write_message out of kernel/printk
Alan Cox [Mon, 13 Oct 2008 09:39:23 +0000 (10:39 +0100)]
tty: Move tty_write_message out of kernel/printk

This is pure tty code so put it in the tty layer where it can be with the
locking relevant material it uses

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Make get_current_tty use a kref
Alan Cox [Mon, 13 Oct 2008 09:39:13 +0000 (10:39 +0100)]
tty: Make get_current_tty use a kref

We now return a kref covered tty reference. That ensures the tty structure
doesn't go away when you have a return from get_current_tty. This is not
enough to protect you from most of the resources being freed behind your
back - yet.

[Updated to include fixes for SELinux problems found by Andrew Morton and
 an s390 leak found while debugging the former]

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: compare the tty winsize
Alan Cox [Mon, 13 Oct 2008 09:39:01 +0000 (10:39 +0100)]
tty: compare the tty winsize

We always use the real tty one for stuff so the pty one should not be
compared. As we propagate window changes to both it doesn't currently
matter but will when we tidy up the pty termios logic a bit more

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Termios locking - sort out real_tty confusions and lock reads
Alan Cox [Mon, 13 Oct 2008 09:38:46 +0000 (10:38 +0100)]
tty: Termios locking - sort out real_tty confusions and lock reads

This moves us towards sanity and should mean our termios locking is now
complete and comprehensive.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Add termiox
Alan Cox [Mon, 13 Oct 2008 09:38:18 +0000 (10:38 +0100)]
tty: Add termiox

We need a way to describe the various additional modes and flow control
features that random weird hardware shows up and software such as wine
wants to emulate as Windows supports them.

TCGETX/TCSETX and the termiox ioctl are a SYS5 extension that we might as
well adopt. This patches adds the structures and the basic ioctl interfaces
when the TCGETX etc defines are added for an architecture. Drivers wishing
to use this stuff need to add new methods.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: ipw need reworking
Alan Cox [Mon, 13 Oct 2008 09:38:07 +0000 (10:38 +0100)]
tty: ipw need reworking

This came in via another tree and unfortunately is rather broken on
the tty side. Comment the apparent locking problems for someone who knows
the driver to look at.

Fix the termios and other ioctl handling. The driver was calling the wrong
methods for what it wanted to do but the right ones existed so its a simple
fix up.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Cris has a nice RS485 ioctl so we should steal it
Alan Cox [Mon, 13 Oct 2008 09:37:48 +0000 (10:37 +0100)]
tty: Cris has a nice RS485 ioctl so we should steal it

JP Tosoni observed:

"About a RS485 ioctl: could you consider the attached files which are
 already in the Linux kernel (in include/asm-cris).  They define a
 TIOCSERSETRS485 (ioctl.h), and the data structure (rs485.h)
 with allows to specify timings. Sounds just like what we want ?"

and he's right: sort of. Rework the structure to use flag bits and make the
time delay a fixed sized field so we don't get 32/64bit problems. Add the ioctls
to x86 so that people know what to add to their platform of choice.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: use krefs to protect driver module counts
Alan Cox [Mon, 13 Oct 2008 09:37:36 +0000 (10:37 +0100)]
tty: use krefs to protect driver module counts

The tty layer keeps driver module counts that are used so the driver knows
when it can be unloaded. For obvious reasons we want to tie that to the
refcounting properly.

At this point the driver side itself isn't refcounted nicely but we can do
that later and kref the drivers.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Add a kref count
Alan Cox [Mon, 13 Oct 2008 09:37:26 +0000 (10:37 +0100)]
tty: Add a kref count

Introduce a kref to the tty structure and use it to protect the tty->signal
tty references. For now we don't introduce it for anything else.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agopps: Reserve a line discipline number for PPS
Alan Cox [Mon, 13 Oct 2008 09:37:17 +0000 (10:37 +0100)]
pps: Reserve a line discipline number for PPS

Add a new line discipline for "pulse per second" devices connected to
a serial port.

Signed-off-by: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: Split tty_port into its own file
Alan Cox [Mon, 13 Oct 2008 09:37:07 +0000 (10:37 +0100)]
tty: Split tty_port into its own file

Not much in it yet but this will grow a lot

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: split the buffering from tty_io
Alan Cox [Mon, 13 Oct 2008 09:36:58 +0000 (10:36 +0100)]
tty: split the buffering from tty_io

The two are basically independent chunks of code so lets split them up for
readability and sanity. It also makes the API boundaries much clearer.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agouml: small cleanups and note bugs to be dealt with by uml authors...
Alan Cox [Mon, 13 Oct 2008 09:36:49 +0000 (10:36 +0100)]
uml: small cleanups and note bugs to be dealt with by uml authors...

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agotty: move tioclinux from a special case
Alan Cox [Mon, 13 Oct 2008 09:36:40 +0000 (10:36 +0100)]
tty: move tioclinux from a special case

Right now we have ifdefs and hooks in the core ioctl handler for TIOCLINUX
and then test if its a console. This is brain dead. Instead call the
tioclinux helper from the relevant driver ioctl methods.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoserial: allow 8250 to be used on sparc
David Miller [Mon, 13 Oct 2008 09:36:31 +0000 (10:36 +0100)]
serial: allow 8250 to be used on sparc

This requires three changes:

1) Remove !SPARC restriction in Kconfig.

2) Move Sparc specific serial drivers before 8250, so that serial
   console devices don't change names on us, even if 8250 finds
   devices.

3) Since the Sparc specific serial drivers try to use the
   same major/minor device namespace as 8250, some coordination
   is necessary.  Use the sunserial_*() layer routines to allocate
   minor number space within TTY_MAJOR when CONFIG_SPARC.

   This has no effect on other platforms.

Thanks to Josip Rodin for bringing up this issue and testing
plus debugging various revisions of this patch.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years ago8250: remove a few inlines of dubious value
Will Newton [Mon, 13 Oct 2008 09:36:21 +0000 (10:36 +0100)]
8250: remove a few inlines of dubious value

Remove some inlines from various functions that are called once, are too
big to inline, or are called only from slow path code.  This saves around
300 bytes of code for me.

Signed-off-by: Will Newton <will.newton@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoserial_8250: pci_enable_device fail is not fully handled
Alan Cox [Mon, 13 Oct 2008 09:36:11 +0000 (10:36 +0100)]
serial_8250: pci_enable_device fail is not fully handled

<rmk> talking about leaks - I noticed that the 'check return of
pci_enable_dev()' in the 8250 pci resume function finally made it in
despite my objections against it (causing stuff in higher levels to
leak).

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoftdi: A few errors are err() that should be debug which causes much spewage
Alan Cox [Mon, 13 Oct 2008 09:36:00 +0000 (10:36 +0100)]
ftdi: A few errors are err() that should be debug which causes much spewage

Fixes #10783

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agousb: fix pl2303 initialization
Jason Wessel [Mon, 13 Oct 2008 09:35:51 +0000 (10:35 +0100)]
usb: fix pl2303 initialization

This patch removes the private check for the termios_initialized for
the pl2303 usb driver.  It forced the baud to 9600 on the first call
to pl2303_set_termios()

Based on the tty changes in the 2.6.27 kernel, the termios passed to
the *_set_termios functions is always populated the first time.

This means there is no need to privately initialize the settings the
first time, and doing so will not allow the use of the kernel
parameter "console=ttyUSB0,115200" as an example.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoserial-make-uart_ports-ioport-unsigned-long-fix
Andrew Morton [Mon, 13 Oct 2008 09:35:42 +0000 (10:35 +0100)]
serial-make-uart_ports-ioport-unsigned-long-fix

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agonozomi: Fix close on error
Alan Cox [Mon, 13 Oct 2008 09:35:33 +0000 (10:35 +0100)]
nozomi: Fix close on error

Nozomi assumes the close method isn't called if open errors. The tty layer
is different to other drives in this respect however. Pointed out by Denis J
Barrow.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoserial: Make uart_port's ioport "unsigned long".
David Miller [Mon, 13 Oct 2008 09:35:23 +0000 (10:35 +0100)]
serial: Make uart_port's ioport "unsigned long".

Otherwise the top 32-bits of the resource value get chopped
off on 64-bit systems, and the resulting I/O accesses go to
random places.

Thanks to testing and debugging by Josip Rodin, which helped
track this down.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoaudit: Handle embedded NUL in TTY input auditing
Miloslav Trmac [Mon, 13 Oct 2008 09:35:15 +0000 (10:35 +0100)]
audit: Handle embedded NUL in TTY input auditing

Data read from a TTY can contain an embedded NUL byte (e.g. after
pressing Ctrl-2, or sent to a PTY).  After the previous patch, the data
would be logged only up to the first NUL.

This patch modifies the AUDIT_TTY record to always use the hexadecimal
format, which does not terminate at the first NUL byte.  The vast
majority of recorded TTY input data will contain either ' ' or '\n', so
the hexadecimal format would have been used anyway.

Signed-off-by: Miloslav Trmac <mitr@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoip2: avoid add_timer with pending timer
Akinobu Mita [Mon, 13 Oct 2008 09:35:05 +0000 (10:35 +0100)]
ip2: avoid add_timer with pending timer

add_timer() is not supposed to be called when the timer is pending.
ip2 driver attempts to avoid that condition by setting and resetting
a flag (TimerOn) in timer function. But there is some gap between
add_timer() and setting TimerOn.

This patch fix this problem by using mod_timer() and remove TimerOn
which has been unnecessary by this change.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoip2: init/deinit cleanup
Jiri Slaby [Mon, 13 Oct 2008 09:34:56 +0000 (10:34 +0100)]
ip2: init/deinit cleanup

Cleanup of module_init/exit:
- mostly whitespace
- remove empty functions
- replace c++ comments
- remove useless prints (module loaded, unloaded)
- mark the calls as __exit and __init
- use break; and return; to save some indent levels after it
- note resource leakage

It's still mess, but now it's readable.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoip2: fix sparse warnings
Jiri Slaby [Mon, 13 Oct 2008 09:34:45 +0000 (10:34 +0100)]
ip2: fix sparse warnings

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoip2: cleanup globals
Jiri Slaby [Mon, 13 Oct 2008 09:34:36 +0000 (10:34 +0100)]
ip2: cleanup globals

- do not init .bss zeroed data to zero again (by memset or
  explicit assignment)
- use char [] instead of char * for string constants

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoChar: merge ip2main and ip2base
Jiri Slaby [Mon, 13 Oct 2008 09:34:27 +0000 (10:34 +0100)]
Char: merge ip2main and ip2base

It's pretty useless to have one setup() function separated along with
module_init() which only calls a function from ip2main anyway. Get rid
of ip2base.

Remove also checks of always-true now.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoChar: sx, fix io unmapping
Jiri Slaby [Mon, 13 Oct 2008 09:34:18 +0000 (10:34 +0100)]
Char: sx, fix io unmapping

board->base is increased for CF cards after mapping. Use board->base2
for unmapping the region, since it holds the original/correct address.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoChar: cyclades. remove bogus iomap
Jiri Slaby [Mon, 13 Oct 2008 09:34:09 +0000 (10:34 +0100)]
Char: cyclades. remove bogus iomap

readl/writel are not expected to accept iomap return value. Replace
bogus mapping by standard ioremap.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoFix oti6858 debug level
Scott Ashcroft [Mon, 13 Oct 2008 09:34:00 +0000 (10:34 +0100)]
Fix oti6858 debug level

For some reason the oti6858 driver undefines and redefines the dbg
macro. This makes it spew debugging messages at KERN_INFO instead of
KERN_DEBUG.

This patch removes the undef and define making the driver log like every
other USB serial driver.

Signed-off-by: Scott Ashcroft <scott.ashcroft@talk21.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoBlackfin Serial Driver: Fix bug - request UART2/3 peripheral mapped interrupts in...
Sonic Zhang [Mon, 13 Oct 2008 09:33:51 +0000 (10:33 +0100)]
Blackfin Serial Driver: Fix bug - request UART2/3 peripheral mapped interrupts in PIO mode

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoBlackfin Serial Driver: Fix bug - ircp fails on sir over Blackfin UART
Graf Yang [Mon, 13 Oct 2008 09:33:42 +0000 (10:33 +0100)]
Blackfin Serial Driver: Fix bug - ircp fails on sir over Blackfin UART

We now use the sir_dev/irtty_sir/uart/bfin_serial drivers framework
to monitor the TX status.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoBlackfin Serial Driver: Fix bug - Don't call tx_stop in tx_transfer.
Sonic Zhang [Mon, 13 Oct 2008 09:33:33 +0000 (10:33 +0100)]
Blackfin Serial Driver: Fix bug - Don't call tx_stop in tx_transfer.

Disable irq and return immediately.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoBlackfin Serial Driver: Remove useless stop
Sonic Zhang [Mon, 13 Oct 2008 09:33:25 +0000 (10:33 +0100)]
Blackfin Serial Driver: Remove useless stop

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoBlackfin Serial Driver: move common variables out of serial headers and into the...
Mike Frysinger [Mon, 13 Oct 2008 09:33:16 +0000 (10:33 +0100)]
Blackfin Serial Driver: move common variables out of serial headers and into the serial driver

move common variables out of serial headers and into the serial driver and
rename "nr_ports" to "nr_active_ports" so as to easily differentiate
between BFIN_UART_NR_PORTS (the # of available) and nr_ports (the # of enabled)

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoBlackfin Serial Driver: trim trailing whitespace -- no functional changes
Mike Frysinger [Mon, 13 Oct 2008 09:33:06 +0000 (10:33 +0100)]
Blackfin Serial Driver: trim trailing whitespace -- no functional changes

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoBlackfin Serial Driver: Fix bug - should suspend/resume/remove all uart ports.
Sonic Zhang [Mon, 13 Oct 2008 09:32:44 +0000 (10:32 +0100)]
Blackfin Serial Driver: Fix bug - should suspend/resume/remove all uart ports.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoBlackfin Serial Driver: use __initdata for data, not __init
Mike Frysinger [Mon, 13 Oct 2008 09:32:35 +0000 (10:32 +0100)]
Blackfin Serial Driver: use __initdata for data, not __init

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoepca: call tty_port_init
Alan Cox [Mon, 13 Oct 2008 09:32:09 +0000 (10:32 +0100)]
epca: call tty_port_init

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agocoldfire: scheduled SERIAL_COLDFIRE removal
Adrian Bunk [Mon, 13 Oct 2008 09:31:59 +0000 (10:31 +0100)]
coldfire: scheduled SERIAL_COLDFIRE removal

This patch contains the scheduled removal of the obsolete
SERIAL_COLDFIRE driver.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agodrivers/char/hvc_console.c: adjust call to put_tty_driver
Julia Lawall [Mon, 13 Oct 2008 09:31:49 +0000 (10:31 +0100)]
drivers/char/hvc_console.c: adjust call to put_tty_driver

The call to put_tty_driver is out of place and is applied to the wrong
argument.

The function enclosing the patched code calls alloc_tty_driver and stores
the result in drv.  Subsequently, there are two occurrences of error
handling code, one making a goto to put_tty and one making a goto to
stop_thread.  At the point of the first one the assignment hvc_driver = drv
has not yet been executed, and from inspecting the rest of the file it
seems that hvc_driver would be NULL.  Thus the current call to
put_tty_driver is useless, and one applied to drv is needed.  The goto
stop_thread is in the error handling code for a call to
tty_register_driver, but the error cases in tty_register_driver do not free
its argument, so it should be done here.  Thus, I have moved the put_tty
label after the stop_thread label, so that put_tty_driver is called in both
cases.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
expression E,f;
position p1,p2,p3;
identifier l;
statement S;
@@

x = alloc_tty_driver@p1(...)
...
if (x == NULL) S
... when != E = x
    when != put_tty_driver(x)
goto@p2 l;
... when != E = x
    when != f(...,x,...)
    when any
(
return \(0\|x\);
|
return@p3 ...;
)

@script:python@
p1 << r.p1;
p2 << r.p2;
p3 << r.p3;
@@

print "%s: call on line %s not freed or saved before return on line %s via line %s" % (p1[0].file,p1[0].line,p3[0].line,p2[0].line)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agodrivers/serial/crisv10.c: add missing put_tty_driver
Julia Lawall [Mon, 13 Oct 2008 09:31:37 +0000 (10:31 +0100)]
drivers/serial/crisv10.c: add missing put_tty_driver

alloc_tty_driver is called at the beginning of the function containing the
lines of code shown in the patch.  Thus, put_tty_driver is needed before
returning in the error handling code.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@nr exists@
local idexpression x;
expression E,f;
position p1,p2,p3;
identifier l;
statement S;
@@

x = alloc_tty_driver@p1(...)
...
if (x == NULL) S
... when != E = x
    when != put_tty_driver(x)
    when != goto l;
(
return \(0\|x\);
|
return@p3 ...;
)

@script:python@
p1 << nr.p1;
p3 << nr.p3;
@@

print "%s: call on line %s not freed or saved before return on line %s" % (p1[0].file,p1[0].line,p3[0].line)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoMN10300: MEI are renaming themselves to Panasonic
David Howells [Mon, 13 Oct 2008 09:42:44 +0000 (10:42 +0100)]
MN10300: MEI are renaming themselves to Panasonic

MEI are renaming themselves to Panasonic, so update the MAINTAINERS
record for the MN10300 arch.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoMerge branches 'oprofile-v2' and 'timers/hpet' into x86/core-v4
Ingo Molnar [Mon, 13 Oct 2008 12:18:42 +0000 (14:18 +0200)]
Merge branches 'oprofile-v2' and 'timers/hpet' into x86/core-v4

16 years agoMerge branch 'linus' into oprofile-v2
Ingo Molnar [Mon, 13 Oct 2008 09:05:51 +0000 (11:05 +0200)]
Merge branch 'linus' into oprofile-v2

Conflicts:
arch/x86/kernel/apic_32.c
arch/x86/oprofile/nmi_int.c
include/linux/pci_ids.h

16 years agox86: change early_ioremap to use slots instead of nesting
Yinghai Lu [Sun, 14 Sep 2008 09:33:12 +0000 (02:33 -0700)]
x86: change early_ioremap to use slots instead of nesting

so we could remove the requirement that one needs to call
early_iounmap() in exactly reverse order of early_ioremap().

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: adjust dependencies for CONFIG_X86_CMOV
Jan Beulich [Fri, 29 Aug 2008 11:50:38 +0000 (12:50 +0100)]
x86: adjust dependencies for CONFIG_X86_CMOV

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodumpstack: x86: various small unification steps, fix
Alexander van Heukelum [Sun, 5 Oct 2008 10:39:36 +0000 (12:39 +0200)]
dumpstack: x86: various small unification steps, fix

After "dumpstack: x86: various small unification steps", the
assembler gives the following compile error. The error is in
dumpstack_64.c.

{standard input}: Assembler messages:
{standard input}:720: Error: Incorrect register `%rbx' used with `l' suffix
{standard input}:1340: Error: Incorrect register `%r12' used with `l' suffix

Indeed the suffix in get_bp() was wrong.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: remove additional_cpus
Thomas Gleixner [Sun, 5 Oct 2008 15:51:52 +0000 (17:51 +0200)]
x86: remove additional_cpus

remove remainder of additional_cpus logic. We now just listen to the
disabled_cpus value like we did for years. disabled_cpus is always >=
0 so no need for an extra check.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: remove additional_cpus configurability
Ingo Molnar [Sun, 5 Oct 2008 15:12:36 +0000 (17:12 +0200)]
x86: remove additional_cpus configurability

additional_cpus=<x> parameter is dangerous and broken: for example
if we boot additional_cpus=-2 on a stock dual-core system it will
crash the box on bootup.

So reduce the maze of code a bit by removingthe user-configurability
angle.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: improve UP kernel when CPU-hotplug and SMP is enabled
Thomas Gleixner [Sun, 5 Oct 2008 14:52:24 +0000 (16:52 +0200)]
x86: improve UP kernel when CPU-hotplug and SMP is enabled

num_possible_cpus() can be > 1 when disabled CPUs have been accounted.

Disabled CPUs are not in the cpu_present_map, so we can use
num_present_cpus() as a safe indicator to switch to UP alternatives.

Reported-by: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: <stable@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodumpstack: x86: various small unification steps
Alexander van Heukelum [Sat, 4 Oct 2008 21:12:46 +0000 (23:12 +0200)]
dumpstack: x86: various small unification steps

- define STACKSLOTS_PER_LINE and use it
 - define get_bp macro to hide the %%ebp/%%rbp difference
 - i386: check task==NULL in dump_trace, like x86_64
 - i386: show_trace(NULL, ...) uses current automatically
 - x86_64: use [#%d] for die_counter, like i386
 - whitespace and comments

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodumpstack: i386: make kstack= an early boot-param and add oops=panic
Alexander van Heukelum [Sat, 4 Oct 2008 21:12:45 +0000 (23:12 +0200)]
dumpstack: i386: make kstack= an early boot-param and add oops=panic

- make kstack= and early_param
 - add oops=panic, setting panic_on_oops

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodumpstack: x86: use log_lvl and unify trace formatting
Alexander van Heukelum [Sat, 4 Oct 2008 21:12:44 +0000 (23:12 +0200)]
dumpstack: x86: use log_lvl and unify trace formatting

- x86: Write log_lvl strings if available
 - start raw stack dumps on new line
 - i386: Remove extra indentation for raw stack dumps

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodumptrace: x86: consistently include loglevel, print stack switch
Alexander van Heukelum [Sat, 4 Oct 2008 21:12:43 +0000 (23:12 +0200)]
dumptrace: x86: consistently include loglevel, print stack switch

- i386 and x86_64: always printk the 'data' parameter
 - i386: announce stack switch (irq -> normal)
 - i386: check if there is a stack switch before announcing it

There is a warning that 'context' might come out corrupt in early
boot. If this is true it should be fixed, not worked around.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodumpstack: x86: add "end" parameter to valid_stack_ptr and print_context_stack
Alexander van Heukelum [Sat, 4 Oct 2008 21:12:42 +0000 (23:12 +0200)]
dumpstack: x86: add "end" parameter to valid_stack_ptr and print_context_stack

- Add "end" parameter to valid_stack_ptr and print_context_stack
 - use sizeof(long) as the size of a word on the stack

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodumpstack: x86: make printk_address equal
Alexander van Heukelum [Sat, 4 Oct 2008 21:12:41 +0000 (23:12 +0200)]
dumpstack: x86: make printk_address equal

- x86_64: use %p to print an address
 - make i386-version the same as the above

The result should be the same on x86_64; on i386 the
output only changes if CONFIG_KALLSYMS is turned off,
in which case the address is printed twice.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodumpstack: x86: move die_nmi to dumpstack_32.c
Alexander van Heukelum [Sat, 4 Oct 2008 21:12:40 +0000 (23:12 +0200)]
dumpstack: x86: move die_nmi to dumpstack_32.c

For some reason die_nmi is still defined in traps.c for
i386, but is found in dumpstack_64.c for x86_64. Move it
to dumpstack_32.c

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agotraps: x86: finalize unification of traps.c
Alexander van Heukelum [Fri, 3 Oct 2008 20:00:40 +0000 (22:00 +0200)]
traps: x86: finalize unification of traps.c

traps_32.c and traps_64.c are now equal. Move one to traps.c,
delete the other one and change the Makefile

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agotraps: x86: make traps_32.c and traps_64.c equal
Alexander van Heukelum [Fri, 3 Oct 2008 20:00:39 +0000 (22:00 +0200)]
traps: x86: make traps_32.c and traps_64.c equal

Use CONFIG_X86_64/CONFIG_X86_32 to condtionally compile the
parts needed for x86_64 or i386 only.

Runs a small userspace for a number of minimal configurations
and boots the defconfigs.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agotraps: x86: various noop-changes preparing for unification of traps_xx.c
Alexander van Heukelum [Fri, 3 Oct 2008 21:17:11 +0000 (23:17 +0200)]
traps: x86: various noop-changes preparing for unification of traps_xx.c

- reordering include files
 - whitespace changes
 - comment changes
 - removed unused bad_intr()
 - make default_do_nmi static

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>