linux-2.6
16 years agodrivers/video/fsl-diu-fb.c: add missing of_node_put
Julia Lawall [Tue, 5 Aug 2008 20:01:28 +0000 (13:01 -0700)] 
drivers/video/fsl-diu-fb.c: add missing of_node_put

of_node_put is needed before discarding a value received from
of_find_node_by_type, eg in error handling code.

The semantic patch that makes the change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
struct device_node *n;
struct device_node *n1;
struct device_node *n2;
statement S;
identifier f1,f2;
expression E1,E2;
constant C;
@@

n = of_find_node_by_type(...)
...
if (!n) S
... when != of_node_put(n)
    when != n1 = f1(n,...)
    when != E1 = n
    when any
    when strict
(
+ of_node_put(n);
  return -C;
|
  of_node_put(n);
|
  n2 = f2(n,...)
|
  E2 = n
|
  return ...;
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Cc: Timur Tabi <timur@freescale.com>
Cc: York Sun <yorksun@freescale.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoradeonfb: give i2c buses nicer names
Jean Delvare [Tue, 5 Aug 2008 20:01:27 +0000 (13:01 -0700)] 
radeonfb: give i2c buses nicer names

The name of the i2c buses shows in the output of "i2cdetect -l", so
it's important to give informative names.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agofbcon: fix scrolling after logo is cleared
Krzysztof Helt [Tue, 5 Aug 2008 20:01:26 +0000 (13:01 -0700)] 
fbcon: fix scrolling after logo is cleared

If the 'clear' command is used on the frame buffer with a logo the upper
area is filled by few lines but not scrolled anymore.

Fix this by removing the protected area for the logo if any part of the
logo is cleared.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoradeon: misc corrections
David Miller [Tue, 5 Aug 2008 20:01:25 +0000 (13:01 -0700)] 
radeon: misc corrections

I have a new PCI-E radeon RV380 series card (PCI device ID 5b64) that
hangs in my sparc64 boxes when the init scripts set the font.  The problem
goes away if I disable acceleration.

I haven't figured out that bug yet, but along the way I found some
corrections to make based upon some auditing.

1) The RB2D_DC_FLUSH_ALL value used by the kernel fb driver
   and the XORG video driver differ.  I've made the kernel
   match what XORG is using.

2) In radeonfb_engine_reset() we have top-level code structure
   that roughly looks like:

if (family is 300, 350, or V350)
do this;
else
do that;
...
if (family is NOT 300, OR
    family is NOT 350, OR
    family is NOT V350)
do another thing;

   this last conditional makes no sense, is always true,
   and obviously was likely meant to be "family is NOT
   300, 350, or V350".  So I've made the code match the
   intent.

Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Tested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoRemove the deprecated cli() sti() functions
Mark Asselstine [Tue, 5 Aug 2008 20:01:24 +0000 (13:01 -0700)] 
Remove the deprecated cli() sti() functions

These functions have been deprecated for some time now but remained until
all legacy callers could be removed.  With a few commits in 2.6.26 this
has happened so now we can remove these deprecated functions.

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agobacklight: add MODULE_ALIAS() to pwm_backlight driver
Ben Dooks [Tue, 5 Aug 2008 20:01:24 +0000 (13:01 -0700)] 
backlight: add MODULE_ALIAS() to pwm_backlight driver

Add the missing MODULE_ALIAS() to the pwm_backlight driver.

Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agobacklight: add more information output to pwm_backlight
Ben Dooks [Tue, 5 Aug 2008 20:01:22 +0000 (13:01 -0700)] 
backlight: add more information output to pwm_backlight

Make the error paths in the pwm_backlight driver more informative in the
probe path, especially for the times that it finds an error.

Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Cc: Richard Purdie <rpurdie@rpsys.net>
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoblackfin RTC driver: drop PIE/stopwatch code since the hardware can only do a max...
Mike Frysinger [Tue, 5 Aug 2008 20:01:21 +0000 (13:01 -0700)] 
blackfin RTC driver: drop PIE/stopwatch code since the hardware can only do a max of 1HZ and this same functionality is provided by UIE

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoblackfin RTC driver: convert PIE handling to irq_set_state() as pointed out by David...
Mike Frysinger [Tue, 5 Aug 2008 20:01:21 +0000 (13:01 -0700)] 
blackfin RTC driver: convert PIE handling to irq_set_state() as pointed out by David Brownell

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoblackfin RTC driver: wait for the write complete interrupt complete before sleeping
Mike Frysinger [Tue, 5 Aug 2008 20:01:20 +0000 (13:01 -0700)] 
blackfin RTC driver: wait for the write complete interrupt complete before sleeping

Since we use the write complete interrupt, wait for it
to complete before sleeping so we don't wake right back up due to it

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoblackfin RTC driver: disable the write complete irq upon close
Mike Frysinger [Tue, 5 Aug 2008 20:01:19 +0000 (13:01 -0700)] 
blackfin RTC driver: disable the write complete irq upon close

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoblackfin RTC driver: don't bother passing the rtc struct down to bfin_rtc_int_{set...
Mike Frysinger [Tue, 5 Aug 2008 20:01:18 +0000 (13:01 -0700)] 
blackfin RTC driver: don't bother passing the rtc struct down to bfin_rtc_int_{set,clear} since it isnt needed (shaves off ~100bytes)

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoblackfin RTC driver: add support for power management framework
Mike Frysinger [Tue, 5 Aug 2008 20:01:18 +0000 (13:01 -0700)] 
blackfin RTC driver: add support for power management framework

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoblackfin RTC driver: Fix bug Only RTC interrupt can wake up deeper sleep core
Sonic Zhang [Tue, 5 Aug 2008 20:01:17 +0000 (13:01 -0700)] 
blackfin RTC driver: Fix bug Only RTC interrupt can wake up deeper sleep core

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoblackfin RTC driver: if we dont define irq_set_freq, the common rtc-dev layer will...
Mike Frysinger [Tue, 5 Aug 2008 20:01:15 +0000 (13:01 -0700)] 
blackfin RTC driver: if we dont define irq_set_freq, the common rtc-dev layer will give us the same behavior of returning ENOTTY

Signed-off-by: Mike Frysinger <michael.frysinger@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agogenirq: better warning on irqchip->set_type() failure
David Brownell [Tue, 5 Aug 2008 20:01:14 +0000 (13:01 -0700)] 
genirq: better warning on irqchip->set_type() failure

While I'm glad to finally see the hole fixed whereby passing an invalid
IRQ trigger type to request_irq() would be ignored, the current diagnostic
isn't quite useful.  Fixed by also listing the trigger type which was
rejected.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agosemaphore: __down_common: use signal_pending_state()
Oleg Nesterov [Tue, 5 Aug 2008 20:01:13 +0000 (13:01 -0700)] 
semaphore: __down_common: use signal_pending_state()

Change __down_common() to use signal_pending_state() instead of open
coding.

The changes in kernel/semaphore.o are just artifacts, the state checks are
optimized away.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agorelay: fix "full buffer with exactly full last subbuffer" accounting problem
Tom Zanussi [Tue, 5 Aug 2008 20:01:10 +0000 (13:01 -0700)] 
relay: fix "full buffer with exactly full last subbuffer" accounting problem

In relay's current read implementation, if the buffer is completely full
but hasn't triggered the buffer-full condition (i.e. the last write
didn't cross the subbuffer boundary) and the last subbuffer is exactly
full, the subbuffer accounting code erroneously finds nothing available.
This patch fixes the problem.

Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Mathieu Desnoyers <compudj@krystal.dyndns.org>
Cc: Andrea Righi <righi.andrea@gmail.com>
Cc: <stable@kernel.org> [2.6.25.x, 2.6.26.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agospi: new orion_spi driver
Shadi Ammouri [Tue, 5 Aug 2008 20:01:09 +0000 (13:01 -0700)] 
spi: new orion_spi driver

This adds an SPI driver for the SPI controller found in various Marvell
Orion ARM SoCs.  It currently supports only one slave, which must use SPI
mode 0.

[dbrownell@users.sourceforge.net: cleanups, meet specs, pass "sparse"]
Signed-off-by: Shadi Ammouri <shadi@marvell.com>
Signed-off-by: Saeed Bishara <saeed@marvell.com>
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoblock/cciss.c: remove pointless curr_queue calculation
Hannes Reinecke [Tue, 5 Aug 2008 20:01:08 +0000 (13:01 -0700)] 
block/cciss.c: remove pointless curr_queue calculation

curr_queue is a local variable in a for loop, and it's being initialized
at the start of each loop.  So any assignment at the end of the loop is
pointless.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agovt8623fb: fix kernel oops
Ondrej Zajicek [Tue, 5 Aug 2008 20:01:06 +0000 (13:01 -0700)] 
vt8623fb: fix kernel oops

commit 20e061fb750d36ec0ffcb2e44ed7dafa9018223b
  Author: Ondrej Zajicek <santiago@crfreenet.org>
  Date:   Mon Apr 28 02:15:18 2008 -0700

      fbdev: framebuffer_alloc() fixes

      Correct the dev arg of framebuffer_alloc() in arkfb, s3fb and vt8623fb.

causes a null-pointer deref because "info->dev is NULL, info was just
kzallocated".

Signed-off-by: Ondrej Zajicek <santiago@crfreenet.org>
Reported-by: "MadLoisae@gmx.net" <MadLoisae@gmx.net>
Tested-by: "MadLoisae@gmx.net" <MadLoisae@gmx.net>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: <stable@kernel.org> [2.6.26.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agokdump: report actual value of VMCOREINFO_OSRELEASE in VMCOREINFO
Bernhard Walle [Tue, 5 Aug 2008 20:01:05 +0000 (13:01 -0700)] 
kdump: report actual value of VMCOREINFO_OSRELEASE in VMCOREINFO

The current implementation reports the structure name as
VMCOREINFO_OSRELEASE in VMCOREINFO, e.g.

        VMCOREINFO_OSRELEASE=init_uts_ns.name.release

That doesn't make sense because it's always the same. Instead, use the
value, e.g.

        VMCOREINFO_OSRELEASE=2.6.26-rc3

That's also what the 'makedumpfile -g' does.

Signed-off-by: Bernhard Walle <bwalle@suse.de>
Cc: "Ken'ichi Ohmichi" <oomichi@mxs.nes.nec.co.jp>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agopowerpc: 86xx: mpc8610_hpcd: add watchdog node
Anton Vorontsov [Tue, 5 Aug 2008 20:01:02 +0000 (13:01 -0700)] 
powerpc: 86xx: mpc8610_hpcd: add watchdog node

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agomm_init.c: avoid ifdef-inside-macro-expansion
Andrew Morton [Tue, 5 Aug 2008 20:01:01 +0000 (13:01 -0700)] 
mm_init.c: avoid ifdef-inside-macro-expansion

gcc-3.2:

  mm/mm_init.c:77:1: directives may not be used inside a macro argument
  mm/mm_init.c:76:47: unterminated argument list invoking macro "mminit_dprintk"
  mm/mm_init.c: In function `mminit_verify_pageflags_layout':
  mm/mm_init.c:80: `mminit_dprintk' undeclared (first use in this function)
  mm/mm_init.c:80: (Each undeclared identifier is reported only once
  mm/mm_init.c:80: for each function it appears in.)
  mm/mm_init.c:80: syntax error before numeric constant

Also fix a typo in a comment.

Reported-by: Adrian Bunk <bunk@kernel.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
Linus Torvalds [Tue, 5 Aug 2008 18:39:33 +0000 (11:39 -0700)] 
Merge git://git./linux/kernel/git/bart/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6:
  ide: ->cable_detect method cannot be marked __devinit
  ide: ->quirkproc method cannot be marked __devinit
  cs5520: add enablebits checking
  cdrom: don't check CDC_PLAY_AUDIO in cdrom_count_tracks()
  ide-cd: fix endianity for the error message in cdrom_read_capacity
  ide: remove CONFIG_IDE_MAX_HWIFS
  remove unneeded #include <linux/ide.h>'s
  ide: fix regression caused by ide_device_{get,put}() addition (take 2)
  remove unnecessary <linux/hdreg.h> includes
  ide: sanitize struct ide_port_ops documentation (take 2)
  ide: fix ide_fix_driveid()
  ide: fix pre-EIDE SWDMA support on big-endian

16 years agoFix USB storage hang on command abort
Alan Stern [Tue, 5 Aug 2008 17:05:17 +0000 (13:05 -0400)] 
Fix USB storage hang on command abort

Okay, I found the cause of the hang.  It is a simple bug in the USB
scatter-gather library, caused by changes added in response to the S-G
chaining modification.

This patch (as1125) fixes a bug in the USB scatter-gather library.
Early exit from the S-G initialization loop does not reset the count of
outstanding URBs.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoide: ->cable_detect method cannot be marked __devinit
Bartlomiej Zolnierkiewicz [Tue, 5 Aug 2008 16:17:04 +0000 (18:17 +0200)] 
ide: ->cable_detect method cannot be marked __devinit

Now that we have warm-plug support ->cable_detect method no longer
can be be marked __devinit.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: ->quirkproc method cannot be marked __devinit
Bartlomiej Zolnierkiewicz [Tue, 5 Aug 2008 16:17:03 +0000 (18:17 +0200)] 
ide: ->quirkproc method cannot be marked __devinit

Now that we have warm-plug support ->quirkproc method no longer
can be be marked __devinit.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agocs5520: add enablebits checking
Bartlomiej Zolnierkiewicz [Tue, 5 Aug 2008 16:17:03 +0000 (18:17 +0200)] 
cs5520: add enablebits checking

Based on sparse comments in OpenFirmware code
(no Cx5510/Cx5520 datasheet here).

This fixes 2.6.26 regression reported by TAKADA
and caused by addition of warm-plug support.

Tested-by: TAKADA Yoshihito <takada@mbf.nifty.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agocdrom: don't check CDC_PLAY_AUDIO in cdrom_count_tracks()
Tejun Heo [Tue, 5 Aug 2008 16:17:02 +0000 (18:17 +0200)] 
cdrom: don't check CDC_PLAY_AUDIO in cdrom_count_tracks()

According to MMC-3 (or any later versions) READ TOCs are mandatory
commands and have nothing to do with CDC_PLAY_AUDIO.  I have no idea why
the check was put there in the first place but it now only breaks
automatic actions on certain drives.

Note that this test was only effective when ide-cdrom was being used
as sr didn't mask CDC_PLAY_AUDIO according to the capabilities.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Cc: Borislav Petkov <petkovbb@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-cd: fix endianity for the error message in cdrom_read_capacity
Petr Tesarik [Tue, 5 Aug 2008 16:17:02 +0000 (18:17 +0200)] 
ide-cd: fix endianity for the error message in cdrom_read_capacity

Aesthetic regards aside, commit e8e7b9eb11c34ee18bde8b7011af41938d1ad667
still leaves a bug in the error message, because it uses the unconverted
big-endian value for printk.

Fix this by using a local variable in machine byte order. The result is
correct, more readable, and also produces slightly shorter code on i386.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: <stable@kernel.org>
Acked-by: Borislav Petkov <petkovbb@gmail.com>
[bart: __u32 -> u32]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove CONFIG_IDE_MAX_HWIFS
Adrian Bunk [Tue, 5 Aug 2008 16:17:01 +0000 (18:17 +0200)] 
ide: remove CONFIG_IDE_MAX_HWIFS

The benefits of a user settable CONFIG_IDE_MAX_HWIFS have become pretty
tiny and are no longer considered worth the trouble of an own option.

Simply always #define MAX_HWIFS to 10.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoremove unneeded #include <linux/ide.h>'s
Adrian Bunk [Tue, 5 Aug 2008 16:17:00 +0000 (18:17 +0200)] 
remove unneeded #include <linux/ide.h>'s

This patch remove unneeded #include <linux/ide.h>'s.

It also adds a required #include <linux/interrupt.h> that was previously
implicitely pulled by ide.h

Signed-off-by: Adrian Bunk <bunk@kernel.org>
[bart: revert change to tests/lkdtm.c (spotted by Stephen Rothwell)]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: fix regression caused by ide_device_{get,put}() addition (take 2)
Bartlomiej Zolnierkiewicz [Tue, 5 Aug 2008 16:16:59 +0000 (18:16 +0200)] 
ide: fix regression caused by ide_device_{get,put}() addition (take 2)

On Monday 28 July 2008, Benjamin Herrenschmidt wrote:

[...]

> Vector: 300 (Data Access) at [c58b7b80]
>     pc: c014f264: elv_may_queue+0x10/0x44
>     lr: c0152750: get_request+0x2c/0x2c0
>     sp: c58b7c30
>    msr: 1032
>    dar: c
>  dsisr: 40000000
>   current = 0xc58aaae0
>     pid   = 854, comm = media-bay
> enter ? for help
> mon> t
> [c58b7c40c0152750 get_request+0x2c/0x2c0
> [c58b7c70c0152a08 get_request_wait+0x24/0xec
> [c58b7cc0c0225674 ide_cd_queue_pc+0x58/0x1a0
> [c58b7d40c022672c ide_cdrom_packet+0x9c/0xdc
> [c58b7d70c0261810 cdrom_get_disc_info+0x60/0xd0
> [c58b7dc0c026208c cdrom_mrw_exit+0x1c/0x11c
> [c58b7e30c0260f7c unregister_cdrom+0x84/0xe8
> [c58b7e50c022395c ide_cd_release+0x80/0x84
> [c58b7e70c0163650 kref_put+0x54/0x6c
> [c58b7e80c0223884 ide_cd_put+0x40/0x5c
> [c58b7ea0c0211100 generic_ide_remove+0x28/0x3c
> [c58b7eb0c01e9d34 __device_release_driver+0x78/0xb4
> [c58b7ec0c01e9e44 device_release_driver+0x28/0x44
> [c58b7ee0c01e8f7c bus_remove_device+0xac/0xd8
> [c58b7f00c01e7424 device_del+0x104/0x198
> [c58b7f20c01e74d0 device_unregister+0x18/0x30
> [c58b7f40c02121c4 __ide_port_unregister_devices+0x6c/0x88
> [c58b7f60c0212398 ide_port_unregister_devices+0x38/0x80
> [c58b7f80c0208ca4 media_bay_step+0x1cc/0x5c0
> [c58b7fb0c0209124 media_bay_task+0x8c/0xcc
> [c58b7fd0c00485c0 kthread+0x48/0x84
> [c58b7ff0c0011b20 kernel_thread+0x44/0x60

The guilty commit turned out to be 08da591e14cf87247ec09b17c350235157a92fc3
("ide: add ide_device_{get,put}() helpers").  ide_device_put() is called
before kref_put() in ide_cd_put() so IDE device is already gone by the time
ide_cd_release() is reached.

Fix it by calling ide_device_get() before kref_get() and ide_device_put()
after kref_put() in all affected device drivers.

v2:
Brown paper bag time.  In v1 cd->drive was referenced after dropping last
reference on cd object (which could result in OOPS in ide_device_put() as
reported/debugged by Mariusz Kozlowski).  Fix it by caching cd->drive in
the local variable (fix other device drivers too).

Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reported-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Tested-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Tested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoremove unnecessary <linux/hdreg.h> includes
Bartlomiej Zolnierkiewicz [Tue, 5 Aug 2008 16:16:58 +0000 (18:16 +0200)] 
remove unnecessary <linux/hdreg.h> includes

Following files don't need <linux/hdreg.h> at all:

- arch/mips/jazz/setup.c
- arch/sh/boards/mach-systemh/irq.c
- drivers/macintosh/mediabay.c
- drivers/scsi/hptiop.c
- drivers/usb/storage/freecom.c
- arch/powerpc/include/asm/ide.h
- init/main.c

Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: sanitize struct ide_port_ops documentation (take 2)
Bartlomiej Zolnierkiewicz [Tue, 5 Aug 2008 16:16:57 +0000 (18:16 +0200)] 
ide: sanitize struct ide_port_ops documentation (take 2)

v2:
Add missing '@'-s.  (Noticed by Randy Dunlap)

Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: fix ide_fix_driveid()
Bartlomiej Zolnierkiewicz [Tue, 5 Aug 2008 16:16:56 +0000 (18:16 +0200)] 
ide: fix ide_fix_driveid()

Fix byte-swapping for id->words161_175[], id->words206_254[]
and id->words206_254[].

Luckily all words previously left in little-endian byte-order
are marked as reserved so this fix shouldn't affect user-space
applications.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: fix pre-EIDE SWDMA support on big-endian
Bartlomiej Zolnierkiewicz [Tue, 5 Aug 2008 16:16:55 +0000 (18:16 +0200)] 
ide: fix pre-EIDE SWDMA support on big-endian

id->tDMA is of 'unsigned char' type so endianness is already
correct and calling le16_to_cpu() is wrong.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agofs: rename buffer trylock
Nick Piggin [Sat, 2 Aug 2008 10:02:13 +0000 (12:02 +0200)] 
fs: rename buffer trylock

Like the page lock change, this also requires name change, so convert the
raw test_and_set bitop to a trylock.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agomm: rename page trylock
Nick Piggin [Sat, 2 Aug 2008 10:01:03 +0000 (12:01 +0200)] 
mm: rename page trylock

Converting page lock to new locking bitops requires a change of page flag
operation naming, so we might as well convert it to something nicer
(!TestSetPageLocked_Lock => trylock_page, SetPageLocked => set_page_locked).

This also facilitates lockdeping of page lock.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
Linus Torvalds [Tue, 5 Aug 2008 02:04:36 +0000 (19:04 -0700)] 
Merge git://git./linux/kernel/git/davem/sparc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  sparc64: Remove all cpumask_t local variables in xcall dispatch.
  sparc64: Kill error_mask from hypervisor_xcall_deliver().
  sparc64: Build cpu list and mondo block at top-level xcall_deliver().
  sparc64: Disable local interrupts around xcall_deliver_impl() invocation.
  sparc64: Make all xcall_deliver's go through common helper function.
  sparc64: Always allocate the send mondo blocks, even on non-sun4v.
  sparc64: Make smp_cross_call_masked() take a cpumask_t pointer.
  sparc64: Directly call xcall_deliver() in smp_start_sync_tick_client.
  sparc64: Call xcall_deliver() directly in some cases.
  sparc64: Use cpumask_t pointers and for_each_cpu_mask_nr() in xcall_deliver.
  sparc64: Use xcall_deliver() consistently.
  sparc64: Use function pointer for cross-call sending.
  arch/sparc64/kernel/signal.c: removed duplicated #include
  sparc64: Need to disable preemption around smp_tsb_sync().

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
Linus Torvalds [Tue, 5 Aug 2008 00:26:15 +0000 (17:26 -0700)] 
Merge git://git./linux/kernel/git/lethal/sh-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (29 commits)
  sh: enable maple_keyb in dreamcast_defconfig.
  SH2(A) cache update
  nommu: Provide vmalloc_exec().
  add addrespace definition for sh2a.
  sh: Kill off ARCH_SUPPORTS_AOUT and remnants of a.out support.
  sh: define GENERIC_HARDIRQS_NO__DO_IRQ.
  sh: define GENERIC_LOCKBREAK.
  sh: Save NUMA node data in vmcore for crash dumps.
  sh: module_alloc() should be using vmalloc_exec().
  sh: Fix up __bug_table handling in module loader.
  sh: Add documentation and integrate into docbook build.
  sh: Fix up broken kerneldoc comments.
  maple: Kill useless private_data pointer.
  maple: Clean up maple_driver_register/unregister routines.
  input: Clean up maple keyboard driver
  maple: allow removal and reinsertion of keyboard driver module
  sh: /proc/asids depends on MMU.
  arch/sh/boards/mach-se/7343/irq.c: removed duplicated #include
  arch/sh/boards/board-ap325rxa.c: removed duplicated #include
  sh/boards/Makefile typo fix
  ...

16 years agoMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
Linus Torvalds [Tue, 5 Aug 2008 00:25:06 +0000 (17:25 -0700)] 
Merge branch 'merge' of git://git./linux/kernel/git/paulus/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
  powerpc: Remove use of CONFIG_PPC_MERGE
  powerpc: Force printing of 'total_memory' to unsigned long long
  powerpc: Fix compiler warning in arch/powerpc/mm/mem.c
  powerpc: Move include files to arch/powerpc/include/asm

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes
Linus Torvalds [Tue, 5 Aug 2008 00:24:28 +0000 (17:24 -0700)] 
Merge git://git./linux/kernel/git/sam/kbuild-fixes

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes:
  kconfig: drop the ""trying to assign nonexistent symbol" warning
  kconfig: always write out .config

16 years agotracehook: kerneldoc fix
Roland McGrath [Mon, 4 Aug 2008 20:56:01 +0000 (13:56 -0700)] 
tracehook: kerneldoc fix

My last change to tracehook.h made it confuse the kerneldoc parser.
Move the #define's before the comment so it's happy again.

Signed-off-by: Roland McGrath <roland@redhat.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agomn10300: Fix up __bug_table handling in module loader.
Paul Mundt [Mon, 4 Aug 2008 10:21:23 +0000 (11:21 +0100)] 
mn10300: Fix up __bug_table handling in module loader.

Platforms that are using GENERIC_BUG must call in to
module_bug_finalize()/module_bug_cleanup() in order to scan modules with
their own __bug_table sections that are otherwise unaccounted.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoMerge branch 'audit.b56' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit...
Linus Torvalds [Tue, 5 Aug 2008 00:21:38 +0000 (17:21 -0700)] 
Merge branch 'audit.b56' of git://git./linux/kernel/git/viro/audit-current

* 'audit.b56' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current:
  Re: [PATCH] Fix the kernel panic of audit_filter_task when key field is set

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
Linus Torvalds [Tue, 5 Aug 2008 00:19:18 +0000 (17:19 -0700)] 
Merge git://git./linux/kernel/git/jejb/scsi-rc-fixes-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
  [SCSI] scsi_transport_spi: fix oops in revalidate
  [SCSI] ses: fix VPD inquiry overrun
  [SCSI] block: Fix miscalculation of sg_io timeout in CDROM_SEND_PACKET handler.
  [SCSI] hptiop: add more PCI device IDs

16 years agom68k: some asm-sparc include files moved
Stephen Rothwell [Sun, 3 Aug 2008 20:02:10 +0000 (22:02 +0200)] 
m68k: some asm-sparc include files moved

So copy their contents into the asm-m68k files.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years ago__sched_setscheduler: don't do any policy checks when not "user"
Jeremy Fitzhardinge [Sun, 3 Aug 2008 16:33:03 +0000 (09:33 -0700)] 
__sched_setscheduler: don't do any policy checks when not "user"

The "user" parameter to __sched_setscheduler indicates whether the
change is being done on behalf of a user process or not.  If not, we
shouldn't apply any permissions checks, so don't call
security_task_setscheduler().

Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
Tested-by: Steve Wise <swise@opengridcomputing.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoMerge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
Linus Torvalds [Tue, 5 Aug 2008 00:15:07 +0000 (17:15 -0700)] 
Merge branch 'for-linus' of git://git390.osdl.marist.edu/linux-2.6

* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6:
  [S390] move include/asm-s390 to arch/s390/include/asm

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-fixes-2.6
Linus Torvalds [Tue, 5 Aug 2008 00:14:21 +0000 (17:14 -0700)] 
Merge git://git./linux/kernel/git/brodo/pcmcia-fixes-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-fixes-2.6:
  pcmcia: rsrc_nonstatic: check value, not pointer

16 years agosc1200 watchdog driver: Fix locking, sems and coding style
Alan Cox [Mon, 4 Aug 2008 16:56:28 +0000 (17:56 +0100)] 
sc1200 watchdog driver: Fix locking, sems and coding style

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 agoalpha: Fix breakage in wdt_pci
Andrew Morton [Mon, 4 Aug 2008 16:56:02 +0000 (17:56 +0100)] 
alpha: Fix breakage in wdt_pci

drivers/watchdog/wdt_pci.c: In function 'wdtpci_ctr_mode':
drivers/watchdog/wdt_pci.c:120: error: implicit declaration of function 'udelay'
{standard input}: Assembler messages:

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 agowdt: Cleanup and sort out locking and inb_p
Alan Cox [Mon, 4 Aug 2008 16:55:35 +0000 (17:55 +0100)] 
wdt: Cleanup and sort out locking and inb_p

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 agos3c2410_wdt watchdog driver: Locking and coding style
Alan Cox [Mon, 4 Aug 2008 16:54:46 +0000 (17:54 +0100)] 
s3c2410_wdt watchdog driver: Locking and coding style

Kill off use of semaphores.
Fix ioctl races and locking holes.

From: Alan Cox <alan@redhat.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 agoit8712f_wdt: Locking and coding style
Alan Cox [Mon, 4 Aug 2008 16:54:01 +0000 (17:54 +0100)] 
it8712f_wdt: Locking and coding style

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 agoar7_wdt watchdog driver: Fix locking
Alan Cox [Mon, 4 Aug 2008 16:53:22 +0000 (17:53 +0100)] 
ar7_wdt watchdog driver: Fix locking

Use unlocked_ioctl
Remove semaphores

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agovt: Deadlock workaround
Alan Cox [Mon, 4 Aug 2008 16:47:07 +0000 (17:47 +0100)] 
vt: Deadlock workaround

2.6.26 corrected the mutex locking on tty resizing to fix the case where
you could get the tty/vt sizing out of sync. That turns out to have a
deadlock.

The actual fix is really major and I've got it lined up as part of the ops
changes for 2.6.28 so for 2.6.26/2.6.27 it is safer to reintroduce this
ages old minor bug.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agocris: Fixup compile problems
Alan Cox [Mon, 4 Aug 2008 16:21:18 +0000 (17:21 +0100)] 
cris: Fixup compile problems

It now compiles with the tty changes but isn't tested (which has to be
better than not compiling..

Closes bug #11218

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoblackfin: Fix compile failure in tty code
Alan Cox [Mon, 4 Aug 2008 16:22:11 +0000 (17:22 +0100)] 
blackfin: Fix compile failure in tty code

Blackfin peers into the ldisc in an odd way for IRDA snooping which
therefore got missed. Simple enough fix.

Closes bug #11233

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoMerge git://git.infradead.org/users/dwmw2/random-2.6
Linus Torvalds [Tue, 5 Aug 2008 00:03:56 +0000 (17:03 -0700)] 
Merge git://git.infradead.org/users/dwmw2/random-2.6

* git://git.infradead.org/users/dwmw2/random-2.6:
  drivers/video/console/promcon.c: fix build error
  Fix IHEX firmware generation/loading

16 years agosound: ensure device number is valid in snd_seq_oss_synth_make_info
Willy Tarreau [Sat, 2 Aug 2008 16:25:16 +0000 (18:25 +0200)] 
sound: ensure device number is valid in snd_seq_oss_synth_make_info

snd_seq_oss_synth_make_info() incorrectly reports information
to userspace without first checking for the validity of the
device number, leading to possible information leak (CVE-2008-3272).

Reported-By: Tobias Klein <tk@trapkit.de>
Acked-and-tested-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@kernel.org
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/kkeil/ISDN-2.6
Linus Torvalds [Tue, 5 Aug 2008 00:00:37 +0000 (17:00 -0700)] 
Merge git://git./linux/kernel/git/kkeil/ISDN-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/kkeil/ISDN-2.6:
  Add DIP switch readout for HFC-4S IOB4ST
  Fix remaining big endian issue of hfcmulti
  mISDN cleanup user interface
  mISDN fix main ISDN Makefile

16 years agodrivers/char/efirtc.c: removed duplicated #include
Huang Weiyi [Sat, 2 Aug 2008 13:10:23 +0000 (21:10 +0800)] 
drivers/char/efirtc.c: removed duplicated #include

Removed duplicated include <linux/smp_lock.h> in
drivers/char/efirtc.c.

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agomlock() fix return values
KOSAKI Motohiro [Mon, 4 Aug 2008 20:41:14 +0000 (13:41 -0700)] 
mlock() fix return values

Halesh says:

Please find the below testcase provide to test mlock.

Test Case :
===========================

#include <sys/resource.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>

int main(void)
{
  int fd,ret, i = 0;
  char *addr, *addr1 = NULL;
  unsigned int page_size;
  struct rlimit rlim;

  if (0 != geteuid())
  {
   printf("Execute this pgm as root\n");
   exit(1);
  }

  /* create a file */
  if ((fd = open("mmap_test.c",O_RDWR|O_CREAT,0755)) == -1)
  {
   printf("cant create test file\n");
   exit(1);
  }

  page_size = sysconf(_SC_PAGE_SIZE);

  /* set the MEMLOCK limit */
  rlim.rlim_cur = 2000;
  rlim.rlim_max = 2000;

  if ((ret = setrlimit(RLIMIT_MEMLOCK,&rlim)) != 0)
  {
   printf("Cant change limit values\n");
   exit(1);
  }

  addr = 0;
  while (1)
  {
  /* map a page into memory each time*/
  if ((addr = (char *) mmap(addr,page_size, PROT_READ |
PROT_WRITE,MAP_SHARED,fd,0)) == MAP_FAILED)
  {
   printf("cant do mmap on file\n");
   exit(1);
  }

  if (0 == i)
    addr1 = addr;
  i++;
  errno = 0;
  /* lock the mapped memory pagewise*/
  if ((ret = mlock((char *)addr, 1500)) == -1)
  {
   printf("errno value is %d\n", errno);
   printf("cant lock maped region\n");
   exit(1);
  }
  addr = addr + page_size;
 }
}
======================================================

This testcase results in an mlock() failure with errno 14 that is EFAULT,
but it has nowhere been specified that mlock() will return EFAULT.  When I
tested the same on older kernels like 2.6.18, I got the correct result i.e
errno 12 (ENOMEM).

I think in source code mlock(2), setting errno ENOMEM has been missed in
do_mlock() , on mlock_fixup() failure.

SUSv3 requires the following behavior frmo mlock(2).

[ENOMEM]
    Some or all of the address range specified by the addr and
    len arguments does not correspond to valid mapped pages
    in the address space of the process.

[EAGAIN]
    Some or all of the memory identified by the operation could not
    be locked when the call was made.

This rule isn't so nice and slighly strange.  but many people think
POSIX/SUS compliance is important.

Reported-by: Halesh Sadashiv <halesh.sadashiv@ap.sony.com>
Tested-by: Halesh Sadashiv <halesh.sadashiv@ap.sony.com>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: <stable@kernel.org> [2.6.25.x, 2.6.26.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoatmel_spi: fix hang due to missed interrupt
Gerard Kam [Mon, 4 Aug 2008 20:41:12 +0000 (13:41 -0700)] 
atmel_spi: fix hang due to missed interrupt

For some time my at91sam9260 board with JFFS2 on serial flash (m25p80)
would hang when accessing the serial flash and SPI bus.  Slowing the SPI
clock down to 9 MHz reduced the occurrence of the hang from "always"
during boot to a nuisance level that allowed other SW development to
continue.  Finally had to address this issue when an application stresses
the I/O to always cause a hang.

Hang seems to be caused by a missed SPI interrupt, so that the task ends
up waiting forever after calling spi_sync().  The fix has 2 parts.  First
is to halt the DMA engine before the "current" PDC registers are loaded.
This ensures that the "next" registers are loaded before the DMA operation
takes off.  The second part of the fix is a kludge that adds a
"completion" interrupt in case the ENDRX interrupt for the last segment of
the DMA chaining operation was missed.

The patch allows the SPI clock for the serial flash to be increased from 9
MHz to 15 MHz (or more?).  No hangs or SPI overruns were encountered.

Haavard: while this patch does indeed improve things, I still see overruns
and CRC errors on my NGW100 board when running the DataFlash at 10 MHz.
However, I think some improvement is better than nothing, so I'm passing
this on for inclusion in 2.6.27.

Signed-off-by: Gerard Kam <gerardk5@verizon.net>
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agospi: S3C24XX: reset register status on resume.
Ben Dooks [Mon, 4 Aug 2008 20:41:10 +0000 (13:41 -0700)] 
spi: S3C24XX: reset register status on resume.

Fix a bug in the spi_s3c24xx driver where it does not reset the registers
of the hardware when resuming from suspend (this block has been reset over
suspend).

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agosparc64: Remove all cpumask_t local variables in xcall dispatch.
David S. Miller [Mon, 4 Aug 2008 23:56:15 +0000 (16:56 -0700)] 
sparc64: Remove all cpumask_t local variables in xcall dispatch.

All of the xcall delivery implementation is cpumask agnostic, so
we can pass around pointers to const cpumask_t objects everywhere.

The sad remaining case is the argument to arch_send_call_function_ipi().

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoRevert "UFS: add const to parser token table"
Linus Torvalds [Mon, 4 Aug 2008 23:50:38 +0000 (16:50 -0700)] 
Revert "UFS: add const to parser token table"

This reverts commit f9247273cb69ba101877e946d2d83044409cc8c5 (and
fb2e405fc1fc8b20d9c78eaa1c7fd5a297efde43 - "fix fs/nfs/nfsroot.c
compilation" - that fixed a missed conversion).

The changes cause problems for at least the sparc build.  Let's re-do
them when the exact issues are resolved.

Requested-by: Andrew Morton <akpm@linux-foundation.org>
Requested-by: Steven Whitehouse <swhiteho@redhat.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agosparc64: Kill error_mask from hypervisor_xcall_deliver().
David S. Miller [Mon, 4 Aug 2008 23:47:57 +0000 (16:47 -0700)] 
sparc64: Kill error_mask from hypervisor_xcall_deliver().

It can eat up a lot of stack space when NR_CPUS is large.
We retain some of it's functionality by reporting at least one
of the cpu's which are seen in error state.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agosparc64: Build cpu list and mondo block at top-level xcall_deliver().
David S. Miller [Mon, 4 Aug 2008 23:42:58 +0000 (16:42 -0700)] 
sparc64: Build cpu list and mondo block at top-level xcall_deliver().

Then modify all of the xcall dispatch implementations get passed and
use this information.

Now all of the xcall dispatch implementations do not need to be mindful
of details such as "is current cpu in the list?" and "is cpu online?"

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoRevert "[SCSI] extend the last_sector_bug flag to cover more sectors"
Linus Torvalds [Mon, 4 Aug 2008 23:36:20 +0000 (16:36 -0700)] 
Revert "[SCSI] extend the last_sector_bug flag to cover more sectors"

This reverts commit 2b142900784c6e38c8d39fa57d5f95ef08e735d8, since it
seems to break some other USB storage devices (at least a JMicron USB to
ATA bridge).  As such, while it apparently fixes some cardreaders, it
would need to be made conditional on the exact reader it fixes in order
to avoid causing regressions.

Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agosparc64: Disable local interrupts around xcall_deliver_impl() invocation.
David S. Miller [Mon, 4 Aug 2008 23:18:40 +0000 (16:18 -0700)] 
sparc64: Disable local interrupts around xcall_deliver_impl() invocation.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agosparc64: Make all xcall_deliver's go through common helper function.
David S. Miller [Mon, 4 Aug 2008 23:16:20 +0000 (16:16 -0700)] 
sparc64: Make all xcall_deliver's go through common helper function.

This just facilitates the next changeset where we'll be building
the cpu list and mondo block in this helper function.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agosparc64: Always allocate the send mondo blocks, even on non-sun4v.
David S. Miller [Mon, 4 Aug 2008 23:13:51 +0000 (16:13 -0700)] 
sparc64: Always allocate the send mondo blocks, even on non-sun4v.

The idea is that we'll use this cpu list array and mondo block
even for non-hypervisor platforms.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agosparc64: Make smp_cross_call_masked() take a cpumask_t pointer.
David S. Miller [Mon, 4 Aug 2008 07:51:18 +0000 (00:51 -0700)] 
sparc64: Make smp_cross_call_masked() take a cpumask_t pointer.

Ideally this could be simplified further such that we could pass
the pointer down directly into the xcall_deliver() implementation.

But if we do that we need to do the "cpu_online(cpu)" and
"cpu != self" checks down in those functions.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agosparc64: Directly call xcall_deliver() in smp_start_sync_tick_client.
David S. Miller [Mon, 4 Aug 2008 07:02:31 +0000 (00:02 -0700)] 
sparc64: Directly call xcall_deliver() in smp_start_sync_tick_client.

We know the cpu is online and not the current cpu here.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agosparc64: Call xcall_deliver() directly in some cases.
David S. Miller [Mon, 4 Aug 2008 06:56:28 +0000 (23:56 -0700)] 
sparc64: Call xcall_deliver() directly in some cases.

For these cases the callers make sure:

1) The cpus indicated are online.

2) The current cpu is not in the list of indicated cpus.

Therefore we can pass a pointer to the mask directly.

One of the motivations in this transformation is to make use of
"&cpumask_of_cpu(cpu)" which evaluates to a pointer to constant
data in the kernel and thus takes up no stack space.

Hopefully someone in the future will change the interface of
arch_send_call_function_ipi() such that it passes a const cpumask_t
pointer so that this will optimize ever further.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agosparc64: Use cpumask_t pointers and for_each_cpu_mask_nr() in xcall_deliver.
David S. Miller [Mon, 4 Aug 2008 06:24:26 +0000 (23:24 -0700)] 
sparc64: Use cpumask_t pointers and for_each_cpu_mask_nr() in xcall_deliver.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agosparc64: Use xcall_deliver() consistently.
David S. Miller [Mon, 4 Aug 2008 06:07:18 +0000 (23:07 -0700)] 
sparc64: Use xcall_deliver() consistently.

There remained some spots still vectoring to the appropriate
*_xcall_deliver() function manually.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agosparc64: Use function pointer for cross-call sending.
David S. Miller [Mon, 4 Aug 2008 05:52:41 +0000 (22:52 -0700)] 
sparc64: Use function pointer for cross-call sending.

Initialize it using the smp_setup_processor_id() hook.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agoarch/sparc64/kernel/signal.c: removed duplicated #include
Huang Weiyi [Sun, 3 Aug 2008 07:04:13 +0000 (00:04 -0700)] 
arch/sparc64/kernel/signal.c: removed duplicated #include

Removed duplicated #include <linux/tracehook.h> in
arch/sparc64/kernel/signal.c.

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agosparc64: Need to disable preemption around smp_tsb_sync().
David S. Miller [Sun, 3 Aug 2008 07:01:05 +0000 (00:01 -0700)] 
sparc64: Need to disable preemption around smp_tsb_sync().

Based upon a bug report by Mariusz Kozlowski

It uses smp_call_function_masked() now, which has a preemption-disabled
requirement.

Signed-off-by: David S. Miller <davem@davemloft.net>
16 years agokconfig: drop the ""trying to assign nonexistent symbol" warning
Sam Ravnborg [Mon, 4 Aug 2008 20:29:37 +0000 (22:29 +0200)] 
kconfig: drop the ""trying to assign nonexistent symbol" warning

They really stand out now that make *config is less chatty - and
they are generally ignored - so drop them.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Adrian Bunk <bunk@kernel.org>
16 years agokconfig: always write out .config
Sam Ravnborg [Mon, 4 Aug 2008 20:18:07 +0000 (22:18 +0200)] 
kconfig: always write out .config

Always write out .config also in the case where config
did not change.
This fixes: http://bugzilla.kernel.org/show_bug.cgi?id=11230

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Cc: Adrian Bunk <bunk@kernel.org>
16 years agoRe: [PATCH] Fix the kernel panic of audit_filter_task when key field is set
zhangxiliang [Sat, 2 Aug 2008 02:56:37 +0000 (10:56 +0800)] 
Re: [PATCH] Fix the kernel panic of audit_filter_task when key field is set

Sorry, I miss a blank between if and "(".
And I add "unlikely" to check "ctx" in audit_match_perm() and audit_match_filetype().
This is a new patch for it.

Signed-off-by: Zhang Xiliang <zhangxiliang@cn.fujitsu.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
16 years agosh: enable maple_keyb in dreamcast_defconfig.
Paul Mundt [Mon, 4 Aug 2008 07:52:34 +0000 (16:52 +0900)] 
sh: enable maple_keyb in dreamcast_defconfig.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
16 years agoSH2(A) cache update
Yoshinori Sato [Mon, 4 Aug 2008 07:33:47 +0000 (16:33 +0900)] 
SH2(A) cache update

Includes:
- SH2 (7619) Writeback support.
- SH2A cache handling fix.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
16 years agonommu: Provide vmalloc_exec().
Paul Mundt [Mon, 4 Aug 2008 07:01:47 +0000 (16:01 +0900)] 
nommu: Provide vmalloc_exec().

Now that SH has switched to vmalloc_exec() for PAGE_KERNEL_EXEC usage,
it's apparent that nommu has no vmalloc_exec() definition of its own.
Stub in the one from mm/vmalloc.c.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
16 years agoadd addrespace definition for sh2a.
Takashi Yoshii [Mon, 4 Aug 2008 05:28:38 +0000 (14:28 +0900)] 
add addrespace definition for sh2a.

Newfile: arch/sh/include/cpu-sh2a/cpu/addrspace.h

This file seems had be removed to use fallback (cpu-common/cpu/addrspace.h),
but, I'd like to add sh2a specific file here, because
1. the values defined there are not suitable for sh2a.
2. I don't think there is "common" definition for these values.

Values are chosen by consideration of followings...
 P1 is 0. perhaps no question.
 P2 is from hardware manual, which says no-cache area starts at 20000000.
 It means that P? space size=20000000.
 P3 is P2+size since asm/ptrace.h uses P3 as a end of P2.
 P4 is P3+size since asm/fixup.h uses P4 as a end of P3.

Signed-off-by: Takashi YOSHII <yoshii.takashi@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
16 years agosh: Kill off ARCH_SUPPORTS_AOUT and remnants of a.out support.
Paul Mundt [Mon, 4 Aug 2008 05:18:53 +0000 (14:18 +0900)] 
sh: Kill off ARCH_SUPPORTS_AOUT and remnants of a.out support.

SH never really supported a.out, so this was all just copied over blindly
from x86 way back when. As we don't reference linux/a.out.h anywhere in
the tree, these can now safely be killed off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
16 years agosh: define GENERIC_HARDIRQS_NO__DO_IRQ.
Paul Mundt [Mon, 4 Aug 2008 05:17:13 +0000 (14:17 +0900)] 
sh: define GENERIC_HARDIRQS_NO__DO_IRQ.

We haven't called in to __do_IRQ() in a long time, so it seems like a
reasonable time to switch this on by default.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
16 years agosh: define GENERIC_LOCKBREAK.
Paul Mundt [Mon, 4 Aug 2008 05:09:15 +0000 (14:09 +0900)] 
sh: define GENERIC_LOCKBREAK.

Needed for fixing up the __raw_spin_is_contended() reference which
results in a build error.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
16 years agosh: Save NUMA node data in vmcore for crash dumps.
Paul Mundt [Mon, 4 Aug 2008 04:42:49 +0000 (13:42 +0900)] 
sh: Save NUMA node data in vmcore for crash dumps.

Presently the NUMA node data isn't saved on kexec. This implements a
simple arch_crash_save_vmcoreinfo() for saving off the relevant data.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
16 years agosh: module_alloc() should be using vmalloc_exec().
Paul Mundt [Mon, 4 Aug 2008 04:34:29 +0000 (13:34 +0900)] 
sh: module_alloc() should be using vmalloc_exec().

SH-X2 extended mode TLB allows for toggling of the exec bit, so make
sure we are using the right protection bits for module space there
also.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
16 years agosh: Fix up __bug_table handling in module loader.
Paul Mundt [Mon, 4 Aug 2008 04:32:04 +0000 (13:32 +0900)] 
sh: Fix up __bug_table handling in module loader.

We should be calling in to the lib/bug.c module helpers, fix that up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
16 years agosh: Add documentation and integrate into docbook build.
Paul Mundt [Mon, 4 Aug 2008 03:53:55 +0000 (12:53 +0900)] 
sh: Add documentation and integrate into docbook build.

This adds some preliminary docbook bits for SH, tying in to the few
interfaces that are exposed and that have adequate kerneldoc comments.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
16 years agosh: Fix up broken kerneldoc comments.
Paul Mundt [Mon, 4 Aug 2008 03:51:06 +0000 (12:51 +0900)] 
sh: Fix up broken kerneldoc comments.

These were completely unparseable, so fix them up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
16 years agopowerpc: Remove use of CONFIG_PPC_MERGE
Kumar Gala [Fri, 1 Aug 2008 16:44:11 +0000 (02:44 +1000)] 
powerpc: Remove use of CONFIG_PPC_MERGE

Now that arch/ppc is gone and CONFIG_PPC_MERGE is always set, remove
the dead code associated with !CONFIG_PPC_MERGE from arch/powerpc
and include/asm-powerpc.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>