Commit Graph

94104 Commits

Author SHA1 Message Date
Magnus Damm 61711f8fd8 sm501: add uart support
This patch extends the sm501 mfd with 8250 uart support. We're currently
doing this in the board specific r2d-1 code already, but it would be nice to
do move things into the mfd since it's more chip specific than board specific.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:32 -07:00
Andrea Paterniani 5d9f3f6b7c spi: spi_imx updates
Updates to the i.MX SPI controller driver:

 1) Some comments changed and/or added.

 2) End of transfers is now managed on TXFIFO empty interrupt after the
    last write to TXFIFO.  This speeds interrupt execution by removing
    the wait for TXFIFO to become empty.  On TXFIFO empty interrupt the
    handler needs only to poll for the end of the ongoing transaction
    (SPI_CONTROL_XCH) to close the transfer.
     (2.1) Write only transfers are closed flushing RXFIFO.
     (2.2) Read transfers are closed reading trailing bytes from RXFIFO.
     (2.3) Read transfers where RXFIFO overrun occurred are closed by
           flushing RXFIFO and aborting the message.

 3) Fifos are now flushed via SPI disable after the end of ongoing
    transaction.

Signed-off-by: Andrea Paterniani <a.paterniani@swapp-eng.it>
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>
2008-04-28 08:58:31 -07:00
Atsushi Nemoto 0671981478 atmel_spi: support zero length transfer
A spi transfer with zero length is not invalid.  For example, such
transfer (len == 0 && delay_usecs != 0) can be used to achieve delay
before first CLK edge after chipselect assertion.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Haavard Skinnemoen <hskinnemoen@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>
2008-04-28 08:58:31 -07:00
Harvey Harrison b687d2a8f8 spi: replace remaining __FUNCTION__ occurrences
__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Acked-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>
2008-04-28 08:58:31 -07:00
Randy Dunlap 31a1629426 documentation: move spidev_fdx example to its own source file
Move sample source code to its own source file so that it can be used
easier and build-tested/check/maintained by anyone.

(Makefile changes are in a separate patch for all of Documentation/.)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-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>
2008-04-28 08:58:31 -07:00
David Brownell cf43369d55 spi: pxa2xx_spi "sparse" fixes
Various cleanups to pxa2xx_spi suggested by "sparse": make sure that
register addresess are "void __iomem *", and make a few functions properly
static.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Ned Forrester <nforrester@whoi.edu>
Cc: Stephen Street <stephen@streetfiresound.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:31 -07:00
Alessandro Guido 79d8c7a8c8 spi: use menuconfig for CONFIG_SPI
Signed-off-by: Alessandro Guido <alessandro.guido@gmail.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>
2008-04-28 08:58:31 -07:00
Mike Travis 608dfddd84 oprofile: change cpu_buffer from array to per_cpu variable
Change cpu_buffer from array to per_cpu variable in oprofile functions.

[akpm@linux-foundation.org: coding-style fixes]
Cc: Philippe Elie <phil.el@wanadoo.fr>
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:31 -07:00
Thomas Petazzoni 7ae9392c0a x86: configurable DMI scanning code
Turn CONFIG_DMI into a selectable option if EMBEDDED is defined, in
order to be able to remove the DMI table scanning code if it's not
needed, and then reduce the kernel code size.

With CONFIG_DMI (i.e before) :

   text    data     bss     dec     hex filename
1076076  128656   98304 1303036  13e1fc vmlinux

Without CONFIG_DMI (i.e after) :

   text    data     bss     dec     hex filename
1068092  126308   98304 1292704  13b9a0 vmlinux

Result:

   text    data     bss     dec     hex filename
  -7984   -2348       0  -10332   -285c vmlinux

The new option appears in "Processor type and features", only when
CONFIG_EMBEDDED is defined.

This patch is part of the Linux Tiny project, and is based on previous work
done by Matt Mackall <mpm@selenic.com>.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Anvin" <hpa@zytor.com>
Signed-off-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:30 -07:00
Andrew Morton d83fd8a267 drivers/acpi/thermal.c: fix build with CONFIG_DMI=n
drivers/acpi/thermal.c: In function 'acpi_thermal_init':
drivers/acpi/thermal.c:1794: error: 'thermal_dmi_table' undeclared (first use in this function)
drivers/acpi/thermal.c:1794: error: (Each undeclared identifier is reported only once
drivers/acpi/thermal.c:1794: error: for each function it appears in.)

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:30 -07:00
Michael Trimarchi 6e10efefaa atmel_serial: remove duplicated macro definition
After commit 39d4c922b5 (atmel_serial: fix
uart/console concurrent access) the UART_GET_TCR macro got redefined. This
patch removes the duplicated definition.

Signed-off-by: michael trimarchi <trimarchimichael@evidence.eu.com>
Acked-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:30 -07:00
Julia Lawall d1ec61e668 serial: use time_before, time_before_eq, etc
The functions time_before, time_before_eq, time_after, and time_after_eq
are more robust for comparing jiffies against other values.

A simplified version of the semantic patch making this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@ change_compare_np @
expression E;
@@

(
- jiffies <= E
+ time_before_eq(jiffies,E)
|
- jiffies >= E
+ time_after_eq(jiffies,E)
|
- jiffies < E
+ time_before(jiffies,E)
|
- jiffies > E
+ time_after(jiffies,E)
)

@ include depends on change_compare_np @
@@

#include <linux/jiffies.h>

@ no_include depends on !include && change_compare_np @
@@

  #include <linux/...>
+ #include <linux/jiffies.h>
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:30 -07:00
Alex Williamson 01c194d927 serial 8250: tighten test for using backup timer
Thomas Koeller had reported an issue where a device that had been making use
of the UART_BUG_TXEN code in the 8250 driver was mistakenly being caught by
the backup timer test, causing the device to work improperly.

To fix this, tighten the test requirements to enable the backup timer
workaround.

The backup timer is really meant to catch UARTs that don't re-assert the THRE
interrupt.  The expectation is that they do initially assert THRE.  This patch
clarifies the test.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Cc: Thomas Koeller <thomas@koeller.dyndns.org>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:30 -07:00
Yoichi Yuasa fc3f341b5a serial: add VR41xx SIU setup for serial console
Add VR41xx SIU setup for serial console.

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:30 -07:00
Yoichi Yuasa baac58955d serial: add vr41xx_siu_early_setup() for serial console
Add vr41xx_siu_early_setup() for serial console.

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:30 -07:00
Alan Cox eb424fd21c uart_get_baud_rate: stop mangling termios
Russell King noticed this one: We have to avoid replacing B0 when we pick a
baud rate for a "hung up" port.  Ugly but the proper fix is in the tty layer
and means changing the tty<->serial interfaces so we will defer that for now.

[akpm@linux-foundation.org: fix uninitialised var]
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:30 -07:00
Alan Cox e991a2bd4f Fix tty speed handling on 8250
We try and write the correct speed back but the serial midlayer already
mangles the speed on us and that means if we request B0 we report back B9600
when we should not.  For now we'll hack around this in the drivers and serial
code, pending a better long term solution.

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>
2008-04-28 08:58:29 -07:00
Harvey Harrison ce9f9f73af char: make functions static in synclinkmp.c
All were forward declared with static.

Fixes sparse warnings:
drivers/char/synclinkmp.c:1476:5: warning: symbol 'read_proc' was not declared. Should it be static?
drivers/char/synclinkmp.c:2027:5: warning: symbol 'bh_action' was not declared. Should it be static?
drivers/char/synclinkmp.c:2058:6: warning: symbol 'bh_handler' was not declared. Should it be static?
drivers/char/synclinkmp.c:2103:6: warning: symbol 'bh_receive' was not declared. Should it be static?
drivers/char/synclinkmp.c:2112:6: warning: symbol 'bh_transmit' was not declared. Should it be static?
drivers/char/synclinkmp.c:2124:6: warning: symbol 'bh_status' was not declared. Should it be static?
drivers/char/synclinkmp.c:2136:6: warning: symbol 'isr_timer' was not declared. Should it be static?
drivers/char/synclinkmp.c:2162:6: warning: symbol 'isr_rxint' was not declared. Should it be static?
drivers/char/synclinkmp.c:2221:6: warning: symbol 'isr_rxrdy' was not declared. Should it be static?
drivers/char/synclinkmp.c:2351:6: warning: symbol 'isr_txint' was not declared. Should it be static?
drivers/char/synclinkmp.c:2379:6: warning: symbol 'isr_txrdy' was not declared. Should it be static?
drivers/char/synclinkmp.c:2410:6: warning: symbol 'isr_rxdmaok' was not declared. Should it be static?
drivers/char/synclinkmp.c:2427:6: warning: symbol 'isr_rxdmaerror' was not declared. Should it be static?
drivers/char/synclinkmp.c:2445:6: warning: symbol 'isr_txdmaok' was not declared. Should it be static?
drivers/char/synclinkmp.c:2463:6: warning: symbol 'isr_txdmaerror' was not declared. Should it be static?
drivers/char/synclinkmp.c:2480:6: warning: symbol 'isr_io_pin' was not declared. Should it be static?
drivers/char/synclinkmp.c:3420:5: warning: symbol 'alloc_dma_bufs' was not declared. Should it be static?
drivers/char/synclinkmp.c:3494:5: warning: symbol 'alloc_buf_list' was not declared. Should it be static?
drivers/char/synclinkmp.c:3553:5: warning: symbol 'alloc_frame_bufs' was not declared. Should it be static?
drivers/char/synclinkmp.c:3570:6: warning: symbol 'free_dma_bufs' was not declared. Should it be static?
drivers/char/synclinkmp.c:3580:5: warning: symbol 'alloc_tmp_rx_buf' was not declared. Should it be static?
drivers/char/synclinkmp.c:3588:6: warning: symbol 'free_tmp_rx_buf' was not declared. Should it be static?
drivers/char/synclinkmp.c:3594:5: warning: symbol 'claim_resources' was not declared. Should it be static?
drivers/char/synclinkmp.c:3681:6: warning: symbol 'release_resources' was not declared. Should it be static?
drivers/char/synclinkmp.c:3737:6: warning: symbol 'add_device' was not declared. Should it be static?
drivers/char/synclinkmp.c:3860:6: warning: symbol 'device_init' was not declared. Should it be static?
drivers/char/synclinkmp.c:4054:6: warning: symbol 'enable_loopback' was not declared. Should it be static?
drivers/char/synclinkmp.c:4101:6: warning: symbol 'set_rate' was not declared. Should it be static?
drivers/char/synclinkmp.c:4147:6: warning: symbol 'rx_stop' was not declared. Should it be static?
drivers/char/synclinkmp.c:4168:6: warning: symbol 'rx_start' was not declared. Should it be static?
drivers/char/synclinkmp.c:4225:6: warning: symbol 'tx_start' was not declared. Should it be static?
drivers/char/synclinkmp.c:4295:6: warning: symbol 'tx_stop' was not declared. Should it be static?
drivers/char/synclinkmp.c:4322:6: warning: symbol 'tx_load_fifo' was not declared. Should it be static?
drivers/char/synclinkmp.c:4371:6: warning: symbol 'reset_port' was not declared. Should it be static?
drivers/char/synclinkmp.c:4395:6: warning: symbol 'reset_adapter' was not declared. Should it be static?
drivers/char/synclinkmp.c:4407:6: warning: symbol 'async_mode' was not declared. Should it be static?
drivers/char/synclinkmp.c:4546:6: warning: symbol 'hdlc_mode' was not declared. Should it be static?
drivers/char/synclinkmp.c:4748:6: warning: symbol 'tx_set_idle' was not declared. Should it be static?
drivers/char/synclinkmp.c:4768:6: warning: symbol 'get_signals' was not declared. Should it be static?
drivers/char/synclinkmp.c:4797:6: warning: symbol 'set_signals' was not declared. Should it be static?
drivers/char/synclinkmp.c:4826:6: warning: symbol 'rx_reset_buffers' was not declared. Should it be static?
drivers/char/synclinkmp.c:4837:6: warning: symbol 'rx_free_frame_buffers' was not declared. Should it be static?
drivers/char/synclinkmp.c:4865:5: warning: symbol 'rx_get_frame' was not declared. Should it be static?
drivers/char/synclinkmp.c:5040:6: warning: symbol 'tx_load_dma_buffer' was not declared. Should it be static?
drivers/char/synclinkmp.c:5080:5: warning: symbol 'register_test' was not declared. Should it be static?
drivers/char/synclinkmp.c:5119:5: warning: symbol 'irq_test' was not declared. Should it be static?
drivers/char/synclinkmp.c:5211:5: warning: symbol 'init_adapter' was not declared. Should it be static?
drivers/char/synclinkmp.c:5270:5: warning: symbol 'loopback_test' was not declared. Should it be static?
drivers/char/synclinkmp.c:5335:5: warning: symbol 'adapter_test' was not declared. Should it be static?
drivers/char/synclinkmp.c:5397:5: warning: symbol 'memory_test' was not declared. Should it be static?
drivers/char/synclinkmp.c:5449:6: warning: symbol 'load_pci_memory' was not declared. Should it be static?
drivers/char/synclinkmp.c:5468:6: warning: symbol 'trace_block' was not declared. Should it be static?
drivers/char/synclinkmp.c:5503:6: warning: symbol 'tx_timeout' was not declared. Should it be static?
drivers/char/synclinkmp.c:5530:6: warning: symbol 'status_timeout' was not declared. Should it be static?
drivers/char/synclinkmp.c:5581:15: warning: symbol 'read_reg' was not declared. Should it be static?
drivers/char/synclinkmp.c:5586:6: warning: symbol 'write_reg' was not declared. Should it be static?
drivers/char/synclinkmp.c:5592:5: warning: symbol 'read_reg16' was not declared. Should it be static?
drivers/char/synclinkmp.c:5598:6: warning: symbol 'write_reg16' was not declared. Should it be static?
drivers/char/synclinkmp.c:5604:15: warning: symbol 'read_status_reg' was not declared. Should it be static?
drivers/char/synclinkmp.c:5610:6: warning: symbol 'write_control_reg' was not declared. Should it be static?

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:29 -07:00
Joe Perches 0fab6de09c synclink drivers bool conversion
Remove more TRUE/FALSE defines and uses
Remove == TRUE tests
Convert BOOLEAN to bool
Convert int to bool where appropriate

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:29 -07:00
Sam Ravnborg 7a63ce5a1f serial: silence section mismatch warnings in 8250_pci
Fix following warnings:
WARNING: drivers/serial/built-in.o(.data+0x5b8): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:pci_ite887x_exit()
WARNING: drivers/serial/built-in.o(.data+0x5e0): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:pci_plx9050_exit()
WARNING: drivers/serial/built-in.o(.data+0x608): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:pci_plx9050_exit()
WARNING: drivers/serial/built-in.o(.data+0x658): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:pci_plx9050_exit()
WARNING: drivers/serial/built-in.o(.data+0x680): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:pci_plx9050_exit()
WARNING: drivers/serial/built-in.o(.data+0x6a8): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:pci_plx9050_exit()
WARNING: drivers/serial/built-in.o(.data+0x6d0): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:sbs_exit()
WARNING: drivers/serial/built-in.o(.data+0x6f8): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:sbs_exit()
WARNING: drivers/serial/built-in.o(.data+0x720): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:sbs_exit()
WARNING: drivers/serial/built-in.o(.data+0x748): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:sbs_exit()

pci_serial_quirks contains a number of function pointers where the referenced
function is annotated __devexit.  This is OK so we annotate pci_serial_quirks
with __refdata to ignore the __devexit references

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:29 -07:00
Harvey Harrison eee3754f5e ncpfs: fix sparse warning in ncpsign_kernel.c
We're casting anyway, might as well cast to the correct sign.
Specific to i386 (ifdef __i386__)

fs/ncpfs/ncpsign_kernel.c:58:23: warning: incorrect type in initializer (different signedness)
fs/ncpfs/ncpsign_kernel.c:58:23:    expected unsigned int *data2
fs/ncpfs/ncpsign_kernel.c:58:23:    got int *<noident>

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Acked-by: Petr Vandrovec <VANDROVE@vc.cvut.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:29 -07:00
Harvey Harrison 305787e44e ncpfs: fix sparse warnings in ioctl.c
In both cases, these inode variables arebeing used to test the
server's root inode against NULL.  Change them to s_inode.
fs/ncpfs/ioctl.c:391:18: warning: symbol 'inode' shadows an earlier one
fs/ncpfs/ioctl.c:264:28: originally declared here
fs/ncpfs/ioctl.c:441:17: warning: symbol 'inode' shadows an earlier one
fs/ncpfs/ioctl.c:264:28: originally declared here

In this case, we are about to return anyway, just reuse result.
fs/ncpfs/ioctl.c:521:8: warning: symbol 'result' shadows an earlier one
fs/ncpfs/ioctl.c:268:6: originally declared here

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Acked-by: Petr Vandrovec <VANDROVE@vc.cvut.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:29 -07:00
Harvey Harrison cdf8803768 ncpfs: add prototypes to ncp_fs.h
Removes some externs from C files, noticed from the sparse warnings:
fs/ncpfs/dir.c:90:26: warning: symbol 'ncp_root_dentry_operations' was not declared. Should it be static?
fs/ncpfs/symlink.c:107:5: warning: symbol 'ncp_symlink' was not declared. Should it be static?
fs/ncpfs/symlink.c:101:39: warning: symbol 'ncp_symlink_aops' was not declared. Should it be static?

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Acked-by: Petr Vandrovec <VANDROVE@vc.cvut.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:29 -07:00
WANG Cong 5dc62b1b64 uml: clean up arch/um/drivers/ubd_kern.c
Make some global functions and variables static.

And remove some useless declarations for local functions, since we just need
to move their definitions ahead.

[jdike@addtoit.com: checkpatch cleanups]
Signed-off-by: WANG Cong <wangcong@zeuux.org>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:29 -07:00
WANG Cong 4415d8a5aa arch/um/os-Linux/sys-i386/task_size.c: improve a bit
Improve this code a bit: check sigaction's return value and remove a useless
fflush().

Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: WANG Cong <wangcong@zeuux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:28 -07:00
WANG Cong 074a0db8e1 uml: make several things static
Make several things static, because they no longer need to be global.

Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: WANG Cong <wangcong@zeuux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:28 -07:00
WANG Cong 1605ec0443 uml: make three functions static
Make the following three functions static, since they don't need to be global.

arch/um/drivers/mcast_kern.c::mcast_setup()
arch/um/drivers/mconsole_user.c::mconsole_reply_v0()
arch/um/drivers/port_user.c::port_pre_exec()

Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: WANG Cong <wangcong@zeuux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:28 -07:00
WANG Cong 02d324b15d uml: remove a useless function
arch/um/drivers/chan_kern.c::chan_out_fd() is not used by anyone.  Remove it.

Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: WANG Cong <wangcong@zeuux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:28 -07:00
WANG Cong 3af7cb7bbc uml: make a function static
arch/um/drivers/chan_kern.c::open_chan() can become static.

Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: WANG Cong <wangcong@zeuux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:28 -07:00
WANG Cong 626c59f5ed arch/um/os-Linux/start_up.c: various improvements.
- lets ptrace_child become void
 - adds checking for the return value of change_sig
 - moves errors info into stderr instead of stdout.

Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: WANG Cong <wangcong@zeuux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:28 -07:00
Harvey Harrison 3595726ac3 uml: replace remaining __FUNCTION__ occurrences
__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:28 -07:00
WANG Cong 3af9c5bed1 arch/um/kernel/um_arch.c: some small improvements
Make some small improvements for arch/um/kernel/um_arch.c.

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:28 -07:00
KOSAKI Motohiro 16a26ef5ad cris: add constfy to pgd_offset()
add constfy to pgd_offset() for avoid following warnings.

  CC      mm/pagewalk.o
mm/pagewalk.c: In function 'walk_page_range':
mm/pagewalk.c:111: warning: passing argument 1 of 'pgd_offset' discards qualifiers from p\
ointer target type

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: "Vegard Nossum" <vegard.nossum@gmail.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:28 -07:00
Johannes Weiner 5fd284fd97 cris: remove redundant display of free swap space in show_mem()
show_mem() has no need to print the amount of free swap space manually because
show_free_areas() does this already and is called by the former.

The two outputs only differ in text formatting:

  printk("Free swap  = %lukB\n", ...);
  printk("Free swap:       %6ldkB\n", ...);

Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
Cc: Mikael Starvik <mikael.starvik@axis.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:28 -07:00
Alan Cox 032c17e8af crisv10: prepare for BKL push down
Just the modem bits this time

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Mikael Starvik <mikael.starvik@axis.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:28 -07:00
Harvey Harrison f85e7cdc3f m68k: replace remaining __FUNCTION__ occurrences
__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:27 -07:00
Johannes Weiner 6feef6e5f2 m68k: remove redundant display of free swap space in show_mem()
show_mem() has no need to print the amount of free swap space manually because
show_free_areas() does this already and is called by the former.

The two outputs only differ in text formatting:

  printk("Free swap  = %lukB\n", ...);
  printk("Free swap:       %6ldkB\n", ...);

Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:27 -07:00
Andrew Morton ed6b9b97f4 alpha: teach the compiler that BUG doesn't return
Fix things like this:

security/selinux/netnode.c: In function 'sel_netnode_find':
security/selinux/netnode.c:126: warning: 'idx' may be used uninitialized in this function
security/selinux/netnode.c: In function 'sel_netnode_sid':
security/selinux/netnode.c:225: warning: 'ret' may be used uninitialized in this function
security/selinux/netnode.c:168: warning: 'idx' may be used uninitialized in this function

due to code correctly not expecting BUG() to return.

For some reason this reduces the object code size for that particular file.

Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:27 -07:00
S.Caglar Onur 037f436f52 arch/alpha/kernel/traps.c: use time_* macros
The functions time_before, time_before_eq, time_after, and time_after_eq are
more robust for comparing jiffies against other values.

So implement usage of the time_after() macro, defined in linux/jiffies.h,
which deals with wrapping correctly

[akpm@linux-foundation.org: fix warning]
Signed-off-by: S.Caglar Onur <caglar@pardus.org.tr>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:27 -07:00
Harvey Harrison 95d193a903 alpha: replace __inline with inline
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:27 -07:00
Harvey Harrison bbb8d343af alpha: remove remaining __FUNCTION__ occurrences
__FUNCTION__ is gcc-specific, use __func__

The change in pci-iommu,c should be safe as arena has not been assigned
when we get to this point.

Some were within #if 0 blocks, have changed them and left the blocks
as they appear to be debugging infrastructure.

A #define FN __FUNCTION__ was removed and occurances of FN were replaced
with __func__ as well.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:27 -07:00
Jim Meyering b901d40c97 alpha: handle kcalloc failure
arch/alpha/kernel/module.c (module_frob_arch_sections): Handle kcalloc failure.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:27 -07:00
Serge E. Hallyn 1236cc3cf8 smack: use cap_task_prctl
With the introduction of per-process securebits, the capabilities-related
prctl callbacks were moved into cap_task_prctl().  Have smack use
cap_task_prctl() so that PR_SET_KEEPCAPS is defined.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:27 -07:00
Casey Schaufler 30aa4faf62 smack: make smk_cipso_doi() and smk_unlbl_ambient()
The functions smk_cipso_doi and smk_unlbl_ambient are not used outside
smackfs.c and should hence be static.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:27 -07:00
Serge E. Hallyn 55d00ccfb3 root_plug: use cap_task_prctl
With the introduction of per-process securebits, the capabilities-related
prctl callbacks were moved into cap_task_prctl().  Have root_plug use
cap_task_prctl() so that PR_SET_KEEPCAPS is defined.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:27 -07:00
Harvey Harrison c60264c494 smack: fix integer as NULL pointer warning in smack_lsm.c
security/smack/smack_lsm.c:1257:16: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:27 -07:00
Andrew G. Morgan 3898b1b4eb capabilities: implement per-process securebits
Filesystem capability support makes it possible to do away with (set)uid-0
based privilege and use capabilities instead.  That is, with filesystem
support for capabilities but without this present patch, it is (conceptually)
possible to manage a system with capabilities alone and never need to obtain
privilege via (set)uid-0.

Of course, conceptually isn't quite the same as currently possible since few
user applications, certainly not enough to run a viable system, are currently
prepared to leverage capabilities to exercise privilege.  Further, many
applications exist that may never get upgraded in this way, and the kernel
will continue to want to support their setuid-0 base privilege needs.

Where pure-capability applications evolve and replace setuid-0 binaries, it is
desirable that there be a mechanisms by which they can contain their
privilege.  In addition to leveraging the per-process bounding and inheritable
sets, this should include suppressing the privilege of the uid-0 superuser
from the process' tree of children.

The feature added by this patch can be leveraged to suppress the privilege
associated with (set)uid-0.  This suppression requires CAP_SETPCAP to
initiate, and only immediately affects the 'current' process (it is inherited
through fork()/exec()).  This reimplementation differs significantly from the
historical support for securebits which was system-wide, unwieldy and which
has ultimately withered to a dead relic in the source of the modern kernel.

With this patch applied a process, that is capable(CAP_SETPCAP), can now drop
all legacy privilege (through uid=0) for itself and all subsequently
fork()'d/exec()'d children with:

  prctl(PR_SET_SECUREBITS, 0x2f);

This patch represents a no-op unless CONFIG_SECURITY_FILE_CAPABILITIES is
enabled at configure time.

[akpm@linux-foundation.org: fix uninitialised var warning]
[serue@us.ibm.com: capabilities: use cap_task_prctl when !CONFIG_SECURITY]
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Reviewed-by: James Morris <jmorris@namei.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Paul Moore <paul.moore@hp.com>
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:26 -07:00
Michael Hennerich 4016a1390d mm/nommu.c: return 0 from kobjsize with invalid objects
Don't perform kobjsize operations on objects the kernel doesn't manage.

On Blackfin, drivers can get dma coherent memory by calling a function
dma_alloc_coherent(). We do this in nommu by configuring a chunk of uncached
memory at the top of memory.

Since we don't want the kernel to use the uncached memory, we lie to the
kernel, and tell it that it's max memory is between 0, and the start of the
uncached dma coherent section.

this all works well, until this memory gets exposed into userspace (with a
frame buffer), when you look at the process's maps, it shows the framebuf:

root:/proc> cat maps
[snip]
03f0ef00-03f34700 rw-p 00000000 1f:00 192        /dev/fb0
root:/proc>

This is outside the "normal" range for the kernel. When the kernel tries to
find the size of this object (when you run ps), it dies in nommu.c in
kobjsize.

BUG_ON(page->index >= MAX_ORDER);

since the page we are referring to is outside what the kernel thinks is it's
max valid memory.

root:~> while [ 1 ]; ps > /dev/null; done
kernel BUG at mm/nommu.c:119!
Kernel panic - not syncing: BUG!

We fixed this by adding a check to reject out of range object pointers as it
already does that for NULL pointers.

Signed-off-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:26 -07:00
Dimitri Sivanich 468fd62ed9 vmstats: add cond_resched() to refresh_cpu_vm_stats()
We've found that it can take quite a bit of time (100's of usec) to get
through the zone loop in refresh_cpu_vm_stats().

Adding a cond_resched() to allow other threads to run in the non-preemptive
case.

Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
Acked-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:26 -07:00
KAMEZAWA Hiroyuki 8cece85ec7 mm: fix broken gfp_zone with __GFP_THISNODE
This hack, "base = MAX_NR_ZONES", at __GFP_THISNODE was used for old
zonliests.

Now, new zonelist[] have a list for __GFP_THISNODE and this hack is incorrect.
Should be removed.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 08:58:26 -07:00