OSDN Git Service

android-x86/kernel.git
13 years agoUSB: gadget: android: android USB gadget improvements:
Mike Lockwood [Tue, 12 Jan 2010 18:33:59 +0000 (10:33 -0800)]
USB: gadget: android: android USB gadget improvements:

usb: gadget: f_mass_storage: use dev_set_name()

Replacing strcpy() to device->bus_id which no longer exists in 2.6.32

Change-Id: Id978c881f457044c750bfd62f4c5bcc35bcd4fc5
Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: f_adb: Claim endpoints so they are not reused by another function.

Change-Id: Ic9536cca800162e701c81cab36054f51ea759b72
Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: f_acm: Fix crashes in acm_set_alt()

Change-Id: I91b761d392f8b1ca8784c69069b43e402b90d6a4
Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: f_acm: Include android code only if CONFIG_USB_ANDROID_ACM is set.

Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: Android support for RNDIS serial ethernet function.

Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: android: Add function name to android_register_function printk.

Change-Id: I38bf79d9b544cdeaec9385f7482a131417fc4b23
Signed-off-by: Mike Lockwood <lockwood@android.com>
13 years agoUSB: gadget: adb: Queue read requests with length specified by client.
Mike Lockwood [Sat, 19 Dec 2009 23:22:09 +0000 (18:22 -0500)]
USB: gadget: adb: Queue read requests with length specified by client.

Previously we queued 4K requests rather than the count passed into read().

Signed-off-by: Mike Lockwood <lockwood@android.com>
13 years agoUSB: gadget: android: android USB gadget improvements:
Krishna, Vamsi [Wed, 11 Feb 2009 15:37:20 +0000 (21:07 +0530)]
USB: gadget: android: android USB gadget improvements:

USB: android gadget: add remote wakeup attribute to android function

Add remote wakeup attribute to configuration descriptor of android
function to advertise remote wakeup capability to host

Acked-by: Allam, Suresh Reddy <sallam@qualcomm.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: android: Allow functions to handle setup requests.

Signed-off-by: Mike Lockwood <lockwood@android.com>
Support for specifying the list of USB functions from platform data.

The main android.c gadget driver no longer has hard coded references
to the mass_storage and adb functions.

Support for computing the product ID based on tables in platform data
and the currently enabled functions.

Moved the adb enable/disable logic from android.c to f_adb.c.

Change-Id: I6259d3fb1473ed973f700e55d17744956f3527bb
Signed-off-by: Mike Lockwood <lockwood@android.com>
13 years agoUSB: composite: Allow configurations to handle unhandled setup requests
Joe Swantek [Tue, 15 Dec 2009 12:17:40 +0000 (07:17 -0500)]
USB: composite: Allow configurations to handle unhandled setup requests

Signed-off-by: Mike Lockwood <lockwood@android.com>
13 years agoUSB: composite: Add flag to usb_function to hide its interface during enumeration
Mike Lockwood [Fri, 11 Dec 2009 16:24:07 +0000 (11:24 -0500)]
USB: composite: Add flag to usb_function to hide its interface during enumeration

Change-Id: Ie999b5190e3e2b6fd23015b8e796cdd178829929

Signed-off-by: Mike Lockwood <lockwood@android.com>
13 years agoUSB: composite: Fix USB WHQL Certification Issues
Jared Suttles [Fri, 7 Aug 2009 23:57:49 +0000 (18:57 -0500)]
USB: composite: Fix USB WHQL Certification Issues

Submitted on behalf of RaviKumar Vembu <ravi.v@motorola.com>
Signed-off-by: Jared Suttles <jared.suttles@motorola.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
13 years agodrivers: usb: gadget: Add helper function for installing ACM gadget function.
Joe Swantek [Thu, 23 Jul 2009 01:16:06 +0000 (20:16 -0500)]
drivers: usb: gadget: Add helper function for installing ACM gadget function.

Submitted on behalf of James Luan <James.Luan@motorola.com>

Signed-off-by: Joe Swantek <joseph.swantek@motorola.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
13 years agodrivers: usb: gadget: handle NULL descriptors in composite config_buf
Jared Suttles [Thu, 30 Jul 2009 21:13:27 +0000 (16:13 -0500)]
drivers: usb: gadget: handle NULL descriptors in composite config_buf

This fixes a problem in enumeration after a gadget function is removed.

Submitted on behalf of RaviKumar Vembu <ravi.v@motorola.com>

Signed-off-by: Jared Suttles <jared.suttles@motorola.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
13 years agoandroid_usb: Composite USB gadget driver for android.
Mike Lockwood [Wed, 3 Dec 2008 03:01:33 +0000 (22:01 -0500)]
android_usb: Composite USB gadget driver for android.

Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: android gadget: add remote wakeup attribute to android function

Add remote wakeup attribute to configuration descriptor of android
function to advertise remote wakeup capability to host

Acked-by: Allam, Suresh Reddy <sallam@qualcomm.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
usb gadget: link fixes for android composite gadget

Signed-off-by: Mike Lockwood <lockwood@android.com>
usb gadget: Fix null pointer errors in android composite driver

Signed-off-by: Mike Lockwood <lockwood@android.com>
usb: gadget: android: Allow usb charging to draw up to 500mA instead of 250.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
usb gadget: android: Add helper function for usb_gadget_connect and disconnect.

Signed-off-by: Mike Lockwood <lockwood@android.com>
drivers: usb: gadget: call switch_dev_unregister in mass storage unbind callback

This fixes a problem unloading the android gadget driver when built as a module

Signed-off-by: Mike Lockwood <lockwood@android.com>
usb: gadget: android: Add dependency on switch driver.

Signed-off-by: Mike Lockwood <lockwood@android.com>
USB: gadget: android: Fix USB WHQL Certification Issues

Submitted on behalf of RaviKumar Vembu <ravi.v@motorola.com>
Signed-off-by: Jared Suttles <jared.suttles@motorola.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
drivers: usb: gadget: Add "usb_mass_storage" platform driver.

This will be used for configuring vendor, product and release from board file.

Submitted on behalf of RaviKumar Vembu <ravi.v@motorola.com>
Signed-off-by: Jared Suttles <jared.suttles@motorola.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
drivers: usb: gadget: Use usb_mass_storage platform device as parent for lun

If a platform device is specified for the f_mass_storage function, use it as the
parent driver for the lun files in sysfs.
This allows a platform independent file path for controlling USB mass storage
from user space.

Signed-off-by: Mike Lockwood <lockwood@android.com>
drivers: usb: gadget: Add platform data struct for usb_mass_storage device

Signed-off-by: Mike Lockwood <lockwood@android.com>
usb: gadget: mass_storage: Fix Mass Storage Panic during PC reboot

Submitted on behalf of RaviKumar Vembu <ravi.v@motorola.com>
Signed-off-by: Jared Suttles <jared.suttles@motorola.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
usb: gadget: f_mass_storage: Handle setup request correctly

Signed-off-by: Mike Lockwood <lockwood@android.com>
usb: gadget: f_mass_storage: Clean up wakelocks on error paths

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
13 years agommc: sdio: Add high speed support to sdio_reset_comm()
Daniel Chen [Wed, 9 Dec 2009 17:45:36 +0000 (09:45 -0800)]
mmc: sdio: Add high speed support to sdio_reset_comm()

Signed-off-by: San Mehat <san@google.com>
13 years agommc: block: Resume multi-block reads after transient read errors.
David Ding [Fri, 9 Oct 2009 13:38:10 +0000 (06:38 -0700)]
mmc: block: Resume multi-block reads after transient read errors.

Signed-off-by: Bentao Zou <bzou1@motorola.com>
Signed-off-by: David Ding <david.j.ding@motorola.com>
Signed-off-by: San Mehat <san@google.com>
13 years agommc: sdio: Claim host in sdio_reset_comm()
Dmitry Shmidt [Wed, 29 Jul 2009 17:22:03 +0000 (10:22 -0700)]
mmc: sdio: Claim host in sdio_reset_comm()

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agommc: mmcblk: Add support for deferred SD bus resume
San Mehat [Thu, 30 Jul 2009 15:21:19 +0000 (08:21 -0700)]
mmc: mmcblk: Add support for deferred SD bus resume

Signed-off-by: San Mehat <san@google.com>
mmc: card: Add MMC_BLOCK_DEFERRED_RESUME option to Kconfig

Signed-off-by: San Mehat <san@google.com>
13 years agommc: core: Add deferred bus resume policy.
San Mehat [Thu, 30 Jul 2009 14:55:28 +0000 (07:55 -0700)]
mmc: core: Add deferred bus resume policy.

A card driver can now specify that the underlying bus should *not*
auto-resume with the rest of the system. This is useful for reducing resume
latency as well as saving power when the card driver is not using the
bus. In the future, we'll add support for manual suspend

Signed-off-by: San Mehat <san@google.com>
13 years agommc: core: Hold a wake lock accross delayed work + mmc rescan
San Mehat [Mon, 23 Mar 2009 19:20:37 +0000 (12:20 -0700)]
mmc: core: Hold a wake lock accross delayed work + mmc rescan

Signed-off-by: San Mehat <san@android.com>
mmc: core: Rework mmc_delayed_work wakelock so that the wakelock is only extended if a card is added or removed.

Signed-off-by: San Mehat <san@google.com>
13 years agommc: sd: Add retries in re-detection
San Mehat [Thu, 4 Dec 2008 19:18:00 +0000 (11:18 -0800)]
mmc: sd: Add retries in re-detection

Signed-off-by: San Mehat <san@android.com>
mmc: sd: Remove debugging printk

Signed-off-by: Dima Zavin <dima@android.com>
13 years agommc: sd: When resuming, try a little harder to init the card
San Mehat [Mon, 1 Dec 2008 16:52:34 +0000 (08:52 -0800)]
mmc: sd: When resuming, try a little harder to init the card

Signed-off-by: San Mehat <san@android.com>
13 years agommc: Add new API call 'sdio_reset_comm' for resetting communication with an SDIO...
San Mehat [Thu, 15 May 2008 16:15:37 +0000 (09:15 -0700)]
mmc: Add new API call 'sdio_reset_comm' for resetting communication with an SDIO device

Signed-off-by: San Mehat <san@android.com>
13 years agotrout: Add functions for WiFi
Dmitry Shmidt [Tue, 11 Nov 2008 19:22:38 +0000 (11:22 -0800)]
trout: Add functions for WiFi

13 years agommc: Add concept of an 'embedded' SDIO device.
San Mehat [Mon, 14 Apr 2008 22:22:49 +0000 (15:22 -0700)]
mmc: Add concept of an 'embedded' SDIO device.

This is required to support chips which use SDIO for signaling/
communication but do not implement the various card enumeration registers
as required for full SD / SDIO cards.

mmc: sdio: Fix bug where we're freeing the CIS tables we never allocated when using EMBEDDED_SDIO
mmc: Add max_blksize to embedded SDIO data

Signed-off-by: San Mehat <san@google.com>
13 years agommc: sd: Add new CONFIG_MMC_PARANOID_SD_INIT for enabling retries during SD detection
San Mehat [Tue, 11 Nov 2008 17:35:36 +0000 (09:35 -0800)]
mmc: sd: Add new CONFIG_MMC_PARANOID_SD_INIT for enabling retries during SD detection

Signed-off-by: San Mehat <san@google.com>
13 years agommc: Add status IRQ and status callback function to mmc platform data
San Mehat [Tue, 11 Nov 2008 00:29:50 +0000 (16:29 -0800)]
mmc: Add status IRQ and status callback function to mmc platform data

Signed-off-by: San Mehat <san@google.com>
13 years agoInput: synaptics_i2c_rmi: Add irqflags to platform data struct to pass them to driver
Rebecca Schultz Zavin [Mon, 30 Mar 2009 05:10:22 +0000 (22:10 -0700)]
Input: synaptics_i2c_rmi: Add irqflags to platform data struct to pass them to driver

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoInput: synaptics_i2c_rmi: Send new multi touch events
Arve Hjønnevåg [Tue, 21 Jul 2009 03:11:31 +0000 (20:11 -0700)]
Input: synaptics_i2c_rmi: Send new multi touch events

Send both fingers using the new multitouch protocol in addition to
the old single finger event and second finger ABS_HAT* hack.

The new protocol does not specify how to report up events. To make
sure the user-space frameworks can generate up events, we send at
least one event where ABS_MT_TOUCH_MAJOR is zero before we stop
sending events for a finger.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoInput: synaptics_i2c_rmi: Add sensitivity adjust option.
Arve Hjønnevåg [Wed, 15 Jul 2009 03:51:49 +0000 (20:51 -0700)]
Input: synaptics_i2c_rmi: Add sensitivity adjust option.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoInput: synaptics_i2c_rmi: Add support for panels with has-no-relative-data property.
Arve Hjønnevåg [Thu, 9 Jul 2009 04:32:06 +0000 (21:32 -0700)]
Input: synaptics_i2c_rmi: Add support for panels with has-no-relative-data property.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoInput: synaptics_i2c_rmi: Driver for Synaptics Touchscreens using RMI over I2C.
Arve Hjønnevåg [Wed, 22 Aug 2007 04:56:46 +0000 (21:56 -0700)]
Input: synaptics_i2c_rmi: Driver for Synaptics Touchscreens using RMI over I2C.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Input: synaptics_i2c_rmi: disable_irq -> disable_irq_nosync

Also remove duplicate swap macro

Change-Id: I77266431ba5c267a5d92c4bdc2f127a5297065a8
Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoinput: keychord: Add keychord driver
Mike Lockwood [Mon, 15 Dec 2008 19:51:56 +0000 (14:51 -0500)]
input: keychord: Add keychord driver

This driver allows userspace to receive notification when client
specified key combinations are pressed.
The client opens /dev/keychord and writes a list of keychords
for the driver to monitor.
The client then reads or polls /dev/keychord for notifications.
A client specified ID for the keychord is returned from read()
when a keychord press is detected.

Signed-off-by: Mike Lockwood <lockwood@android.com>
keychord: fix to build without CONFIG_PREEMPT

Change-Id: I911f13aeda4224b6fa57863bc7e8972fec8837fb

13 years agoinput: Add keyreset driver.
Arve Hjønnevåg [Sat, 22 Nov 2008 05:47:23 +0000 (21:47 -0800)]
input: Add keyreset driver.

Add a platform device in the board file to specify a reset key-combo.
The first time the key-combo is detected a work function that syncs
the filesystems is scheduled. If all the keys are released and then
pressed again, it calls panic. Reboot on panic should be set for
this to work.

Change-Id: I9d54283ca1fba45e4b1ae1a407524cdda8171143
Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoInput: gpio_input: disable_irq -> disable_irq_nosync
Arve Hjønnevåg [Sat, 18 Apr 2009 01:24:59 +0000 (18:24 -0700)]
Input: gpio_input: disable_irq -> disable_irq_nosync

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoInput: gpio_event: Allow multiple input devices per gpio_event device
Arve Hjønnevåg [Fri, 24 Jul 2009 22:19:56 +0000 (15:19 -0700)]
Input: gpio_event: Allow multiple input devices per gpio_event device

This is needed to support devices that put non-keyboard buttons in
the keyboard matrix. For instance several devices put the trackball
button in the keyboard matrix. In this case BTN_MOUSE should be
reported from the same input device as REL_X/Y.

It is also useful for devices that have multiple logical keyboard in
the same matrix. The HTC dream has a menu key on the external keyboard
and another menu key on the slide-out keyboard. With a single input
device only one of these menu keys can be mapped to KEY_MENU.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoInput: gpio_input: Fix keys with keycode 0x100-0x1ff
Arve Hjønnevåg [Wed, 15 Jul 2009 03:58:41 +0000 (20:58 -0700)]
Input: gpio_input: Fix keys with keycode 0x100-0x1ff

KEY_MAX is no longer a power of 2.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoInput: Generic GPIO Input device.
Arve Hjønnevåg [Thu, 16 Oct 2008 01:23:47 +0000 (18:23 -0700)]
Input: Generic GPIO Input device.

Supports keyboard matrixces, direct inputs, direct outputs and axes connected to gpios.

Change-Id: I5e921e6e3a1cc169316ee3b665f4cc21b5735114
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Nick Pelly <npelly@google.com>
13 years agoGrants system server access to /proc/<pid>/oom_adj for Android applications.
Mike Chan [Thu, 24 Apr 2008 17:22:26 +0000 (10:22 -0700)]
Grants system server access to /proc/<pid>/oom_adj for Android applications.

Signed-off-by: Brian Swetland <swetland@google.com>
13 years agoFAT: Add new ioctl VFAT_IOCTL_GET_VOLUME_ID for reading the volume ID.
Mike Lockwood [Sat, 15 Mar 2008 17:29:36 +0000 (13:29 -0400)]
FAT: Add new ioctl VFAT_IOCTL_GET_VOLUME_ID for reading the volume ID.

Signed-off-by: Brian Swetland <swetland@google.com>
13 years agomisc: uidstat: Adding uid stat driver to collect network statistics.
Mike Chan [Wed, 7 Jan 2009 19:40:42 +0000 (11:40 -0800)]
misc: uidstat: Adding uid stat driver to collect network statistics.

Signed-off-by: Mike Chan <mike@android.com>
13 years agosysfs_net_ipv4: Add sysfs-based knobs for controlling TCP window size
Robert Love [Thu, 31 Jul 2008 15:12:44 +0000 (11:12 -0400)]
sysfs_net_ipv4: Add sysfs-based knobs for controlling TCP window size

Add a family of knobs to /sys/kernel/ipv4 for controlling the TCP window size:

tcp_wmem_min
tcp_wmem_def
tcp_wmem_max
tcp_rmem_min
tcp_rmem_def
tcp_rmem_max

This six values mirror the sysctl knobs in /proc/sys/net/ipv4/tcp_wmem and
/proc/sys/net/ipv4/tcp_rmem.

Sysfs, unlike sysctl, allows us to set and manage the files' permissions and
owners.

Signed-off-by: Robert Love <rlove@google.com>
13 years agonet: socket ioctl to reset connections matching local address
Robert Love [Mon, 12 May 2008 21:08:29 +0000 (17:08 -0400)]
net: socket ioctl to reset connections matching local address

Introduce a new socket ioctl, SIOCKILLADDR, that nukes all sockets
bound to the same local address. This is useful in situations with
dynamic IPs, to kill stuck connections.

Signed-off-by: Brian Swetland <swetland@google.com>
net: fix tcp_v4_nuke_addr

Signed-off-by: Dima Zavin <dima@android.com>
net: ipv4: Fix a spinlock recursion bug in tcp_v4_nuke.

We can't hold the lock while calling to tcp_done(), so we drop
it before calling. We then have to start at the top of the chain again.

Signed-off-by: Dima Zavin <dima@android.com>
net: ipv4: Fix race in tcp_v4_nuke_addr().

To fix a recursive deadlock in 2.6.29, we stopped holding the hash table lock
across tcp_done() calls. This fixed the deadlock, but introduced a race where
the socket could die or change state.

Fix: Before unlocking the hash table, we grab a reference to the socket. We
can then unlock the hash table without risk of the socket going away. We then
lock the socket, which is safe because it is pinned. We can then call
tcp_done() without recursive deadlock and without race. Upon return, we unlock
the socket and then unpin it, killing it.

Change-Id: Idcdae072b48238b01bdbc8823b60310f1976e045
Signed-off-by: Robert Love <rlove@google.com>
Acked-by: Dima Zavin <dima@android.com>
ipv4: disable bottom halves around call to tcp_done().

Signed-off-by: Robert Love <rlove@google.com>
Signed-off-by: Colin Cross <ccross@android.com>
ipv4: Move sk_error_report inside bh_lock_sock in tcp_v4_nuke_addr

When sk_error_report is called, it wakes up the user-space thread, which then
calls tcp_close.  When the tcp_close is interrupted by the tcp_v4_nuke_addr
ioctl thread running tcp_done, it leaks 392 bytes and triggers a WARN_ON.

This patch moves the call to sk_error_report inside the bh_lock_sock, which
matches the locking used in tcp_v4_err.

Signed-off-by: Colin Cross <ccross@android.com>
13 years agoParanoid network.
Robert Love [Wed, 15 Oct 2008 19:35:44 +0000 (15:35 -0400)]
Paranoid network.

With CONFIG_ANDROID_PARANOID_NETWORK, require specific uids/gids to instantiate
network sockets.

Signed-off-by: Robert Love <rlove@google.com>
paranoid networking: Use in_egroup_p() to check group membership

The previous group_search() caused trouble for partners with module builds.
in_egroup_p() is also cleaner.

Signed-off-by: Nick Pelly <npelly@google.com>
Fix 2.6.29 build.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
net: Fix compilation of the IPv6 module

Fix compilation of the IPv6 module -- current->euid does not exist anymore,
current_euid() is what needs to be used.

Signed-off-by: Steinar H. Gunderson <sesse@google.com>
13 years agoashmem for 2.6.27.
Robert Love [Tue, 14 Oct 2008 14:00:47 +0000 (10:00 -0400)]
ashmem for 2.6.27.

Forward port of ashmem to 2.6.27.

Signed-off-by: Robert Love <rlove@google.com>
ashmem: Don't install fault handler for private mmaps.

Ashmem is used to create named private heaps. If this heap is backed
by a tmpfs file it will allocate two pages for every page touched.
In 2.6.27, the extra page would later be freed, but 2.6.29 does not
scan anonymous pages when running without swap so the memory is not
freed while the file is referenced. This change changes the behavior
of private ashmem mmaps to match /dev/zero instead tmpfs.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
ashmem: Add common prefix to name reported in /proc/pid/maps

Signed-off-by: Arve Hjønnevåg <arve@android.com>
ashmem: don't require a page aligned size

This makes ashmem more similar to shmem and mmap, by
not requiring the specified size to be page aligned,
instead rounding it internally as needed.

Signed-off-by: Marco Nelissen <marcone@android.com>
13 years agoAdd android_aid.h
Robert Love [Wed, 15 Oct 2008 19:34:49 +0000 (15:34 -0400)]
Add android_aid.h

Add <linux/android_aid.h>, our mapping of AID defines to gid numbers.

Signed-off-by: Robert Love <rlove@google.com>
13 years agopmem: Add pmem driver
Rebecca Schultz [Thu, 24 Jul 2008 18:22:53 +0000 (11:22 -0700)]
pmem: Add pmem driver

Signed-off-by: Rebecca Schultz <rschultz@google.com>
pmem: Use the thread group leader insted of the current thread.

Instead of keeping track of the current thread, use the thread group leader

Signed-off-by: Rebecca Schultz <rschultz@google.com>
pmem: Add some apis to reference and flush pmem files by file struct

The api to refer to pmem files by fd should be depricated, it can
cause problems if a processes fd table changes while the kernel is processing
data in a pmem file.  This change adds the safer api.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
pmem: Remove unused depricated fd api to pmem.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
pmem: Remove error message when calling get_pmem_addr

This call is used from the mdp driver to determine if the memory
is in pmem or in the fb.  We will encounter this case during normal operation
so this error message should be removed.

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
pmem: Add include sched.h to fix compile errors

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
pmem: remove HW3D_* ioctls

Signed-off-by: Dima Zavin <dima@android.com>
pmem: Expose is_pmem_file to the in-kernel users.

Signed-off-by: Dima Zavin <dima@android.com>
pmem: Make the exposed functions be noops if CONFIG_ANDROID_PMEM is not set.

Signed-off-by: Dima Zavin <dima@android.com>
misc: pmem: don't flush if file was opened with O_SYNC

Change-Id: I067218658a0d7f7ecc1fe73e9ff6b0c3b3054653
Signed-off-by: Dima Zavin <dima@android.com>
pmem: Add cache flush ioctl for pmem buffers

Change-Id: I9156bad829e8c65087f122b48cc57638902fab12
Signed-off-by: Dima Zavin <dima@android.com>
Allow multiple pmem master mmap()s.

Signed-off-by: Jamie Gennis <jgennis@google.com>
Change-Id: Icbe619c92e0ebb391f0a93f81937705452a67d87

pmem: convert data_list_sem to a mutex

Also rename a function that now conflicts with a new
define in asm/pgtable.h

Change-Id: I4798048cb8dece1bc03604e7d0b03d86e0c0ef7f
Signed-off-by: Dima Zavin <dima@android.com>
13 years agoswitch: switch class and GPIO drivers.
Mike Lockwood [Tue, 14 Oct 2008 16:50:16 +0000 (12:50 -0400)]
switch: switch class and GPIO drivers.

switch: Export symbol switch_set_state.

Signed-off-by: Mike Lockwood <lockwood@android.com>
switch: gpio: Don't call request_irq with interrupts disabled

Signed-off-by: Arve Hjønnevåg <arve@android.com>
switch: Use device_create instead of device_create_drvdata.

device_create_drvdata is obsolete.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
switch_gpio: Add missing #include <linux/interrupt.h>

Change-Id: I6c397e41bbe1457162cc69e31a29db5d9f76fccb
Signed-off-by: Mike Lockwood <lockwood@android.com>
13 years agopower_supply: Hold a wake_lock while power supply change notifications are pending
Arve Hjønnevåg [Tue, 22 Sep 2009 00:26:47 +0000 (17:26 -0700)]
power_supply: Hold a wake_lock while power supply change notifications are pending

When connecting usb or the charger the device would often go back to sleep
before the charge led and screen turned on.

Change-Id: I01def6d86ddece0d4e31d2a91d176ed0975b6b9d
Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoinput: evdev: Use unique wakelock names
Mike Chan [Wed, 28 Oct 2009 00:37:44 +0000 (17:37 -0700)]
input: evdev: Use unique wakelock names

wakelock names are now contain evdev->name and pid

Signed-off-by: Mike Chan <mike@android.com>
13 years agoInput: Use monotonic time for event time stamps.
Arve Hjønnevåg [Fri, 17 Oct 2008 22:28:08 +0000 (15:28 -0700)]
Input: Use monotonic time for event time stamps.

Since wall time can jump backwards, it cannot be used to determine if one
event occured before another or for how long a key was pressed.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoInput: Hold wake lock while event queue is not empty.
Arve Hjønnevåg [Fri, 17 Oct 2008 22:20:55 +0000 (15:20 -0700)]
Input: Hold wake lock while event queue is not empty.

Allows userspace code to process input events while
the device appears to be asleep.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoledtrig-sleep: Add led trigger for sleep debugging.
Arve Hjønnevåg [Mon, 31 Mar 2008 04:47:13 +0000 (21:47 -0700)]
ledtrig-sleep: Add led trigger for sleep debugging.

Signed-off-by: Brian Swetland <swetland@google.com>
13 years agortc: Try to prevent RTC errors from accumulating.
Arve Hjønnevåg [Sat, 26 Jul 2008 03:58:15 +0000 (20:58 -0700)]
rtc: Try to prevent RTC errors from accumulating.

When we resume we only know how many whole seconds has elapsed.
These errors would accumulate in delta. We now only set the delta
if it would change by more than two seconds. If we drift back by
by more than a second add one in resume.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agortc: alarm: Add in-kernel alarm interface
Arve Hjønnevåg [Mon, 4 May 2009 21:09:15 +0000 (14:09 -0700)]
rtc: alarm: Add in-kernel alarm interface

Drivers can now create alarms that will use an hrtimer while the
system is running and the rtc to wake up from suspend.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agortc: Add android alarm driver.
Arve Hjønnevåg [Wed, 15 Oct 2008 00:38:04 +0000 (17:38 -0700)]
rtc: Add android alarm driver.

13 years agoPM: earlysuspend: Removing dependence on console.
Rebecca Schultz [Fri, 18 Jul 2008 01:14:55 +0000 (18:14 -0700)]
PM: earlysuspend: Removing dependence on console.

Rather than signaling a full update of the display from userspace via a
console switch, this patch introduces 2 files int /sys/power,
wait_for_fb_sleep and wait_for_fb_wake.  Reading these files will block
until the requested state has been entered.  When a read from
wait_for_fb_sleep returns userspace should stop drawing.  When
wait_for_fb_wake returns, it should do a full update.  If either are called
when the fb driver is already in the requested state, they will return
immediately.

Signed-off-by: Rebecca Schultz <rschultz@google.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoconsoleearlysuspend: Fix for 2.6.32
Arve Hjønnevåg [Tue, 15 Dec 2009 06:14:52 +0000 (22:14 -0800)]
consoleearlysuspend: Fix for 2.6.32

vt_waitactive now needs a 1 based console number

Change-Id: I07ab9a3773c93d67c09d928c8d5494ce823ffa2e

13 years agoPM: earlysuspend: Add console switch when user requested sleep state changes.
Arve Hjønnevåg [Thu, 16 Oct 2008 00:52:20 +0000 (17:52 -0700)]
PM: earlysuspend: Add console switch when user requested sleep state changes.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoPM: wakelock: Don't dump unfrozen task list when aborting try_to_freeze_tasks after...
Arve Hjønnevåg [Wed, 2 Dec 2009 04:54:37 +0000 (20:54 -0800)]
PM: wakelock: Don't dump unfrozen task list when aborting try_to_freeze_tasks after less than one second

Change-Id: Ib2976e5b97a5ee4ec9abd4d4443584d9257d0941
Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoPM: wakelock: Abort task freezing if a wake lock is held.
Arve Hjønnevåg [Tue, 14 Oct 2008 23:02:39 +0000 (16:02 -0700)]
PM: wakelock: Abort task freezing if a wake lock is held.

Avoids a problem where the device sometimes hangs for 20 seconds
before the screen is turned on.

13 years agoPM: Add user-space wake lock api.
Arve Hjønnevåg [Fri, 10 Oct 2008 04:01:46 +0000 (21:01 -0700)]
PM: Add user-space wake lock api.

This adds /sys/power/wake_lock and /sys/power/wake_unlock.
Writing a string to wake_lock creates a wake lock the
first time is sees a string and locks it. Optionally, the
string can be followed by a timeout.
To unlock the wake lock, write the same string to wake_unlock.

Change-Id: I66c6e3fe6487d17f9c2fafde1174042e57d15cd7

13 years agoPM: Enable early suspend through /sys/power/state
Arve Hjønnevåg [Fri, 10 Oct 2008 02:17:11 +0000 (19:17 -0700)]
PM: Enable early suspend through /sys/power/state

If EARLYSUSPEND is enabled then writes to /sys/power/state no longer
blocks, and the kernel will try to enter the requested state every
time no wakelocks are held. Write "on" to resume normal operation.

13 years agoPM: Implement early suspend api
Arve Hjønnevåg [Wed, 8 Oct 2008 03:48:01 +0000 (20:48 -0700)]
PM: Implement early suspend api

13 years agoPM: wakelocks: Use seq_file for /proc/wakelocks so we can get more than 3K of stats.
Arve Hjønnevåg [Thu, 3 Dec 2009 02:22:00 +0000 (18:22 -0800)]
PM: wakelocks: Use seq_file for /proc/wakelocks so we can get more than 3K of stats.

Change-Id: I42ed8bea639684f7a8a95b2057516764075c6b01
Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agopower: wakelocks: fix buffer overflow in print_wake_locks
Erik Gilling [Wed, 26 Aug 2009 03:09:12 +0000 (20:09 -0700)]
power: wakelocks: fix buffer overflow in print_wake_locks

Change-Id: Ic944e3b3d3bc53eddc6fd0963565fd072cac373c
Signed-off-by: Erik Gilling <konkers@android.com>
13 years agopower: Prevent spinlock recursion when wake_unlock() is called
Mike Chan [Wed, 26 Aug 2009 01:10:32 +0000 (18:10 -0700)]
power: Prevent spinlock recursion when wake_unlock() is called

Signed-off-by: Mike Chan <mike@android.com>
13 years agoPM: Implement wakelock api.
Arve Hjønnevåg [Wed, 10 Sep 2008 05:14:34 +0000 (22:14 -0700)]
PM: Implement wakelock api.

PM: wakelock: Replace expire work with a timer

The expire work function did not work in the normal case.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoPM: Add early suspend api.
Arve Hjønnevåg [Sat, 27 Sep 2008 05:10:56 +0000 (22:10 -0700)]
PM: Add early suspend api.

13 years agoPM: Add wake lock api.
Arve Hjønnevåg [Sat, 27 Sep 2008 05:10:56 +0000 (22:10 -0700)]
PM: Add wake lock api.

13 years ago[docs] android: Add android config documentation to boot framework.
Mike Chan [Thu, 22 Jan 2009 20:23:32 +0000 (12:23 -0800)]
[docs] android: Add android config documentation to boot framework.

Signed-off-by: Mike Chan <mike@android.com>
13 years agomtd: nand: Allow NAND chip ids to be included standalone.
Dima Zavin [Thu, 4 Dec 2008 20:19:57 +0000 (12:19 -0800)]
mtd: nand: Allow NAND chip ids to be included standalone.

Lets non-standard NAND drivers take advantage of known NAND
chip information.

Change-Id: I87e2fcb40b07b2ec91e102f1fa7f419a4b4af0a3
Signed-off-by: Dima Zavin <dima@android.com>
13 years agoMake /dev/mem configurable, as we don't want it.
Robert Love [Tue, 29 Apr 2008 20:44:10 +0000 (16:44 -0400)]
Make /dev/mem configurable, as we don't want it.

Signed-off-by: Brian Swetland <swetland@google.com>
13 years agosched: Enable might_sleep before initializing drivers.
Arve Hjønnevåg [Thu, 11 Dec 2008 04:06:28 +0000 (20:06 -0800)]
sched: Enable might_sleep before initializing drivers.

This allows detection of init bugs in built-in drivers.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agoAdd build option to to set the default panic timeout.
Arve Hjønnevåg [Tue, 8 May 2007 08:39:13 +0000 (15:39 +0700)]
Add build option to to set the default panic timeout.

13 years ago[ARM] Optionally flush entire dcache from v6_dma_flush_range
Arve Hjønnevåg [Wed, 10 Jun 2009 03:17:45 +0000 (20:17 -0700)]
[ARM] Optionally flush entire dcache from v6_dma_flush_range

If CACHE_FLUSH_RANGE_LIMIT is defined, then the entire dcache will
be flushed if the requested range is larger than this limit.

Change-Id: I29277d645a9d6716b1952cf3b870c78496261dd0
Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years agomm: Check if any page in a pageblock is reserved before marking it MIGRATE_RESERVE
Arve Hjønnevåg [Thu, 19 Mar 2009 00:27:31 +0000 (17:27 -0700)]
mm: Check if any page in a pageblock is reserved before marking it MIGRATE_RESERVE

This fixes a problem where the first pageblock got marked MIGRATE_RESERVE even
though it only had a few free pages. This in turn caused no contiguous memory
to be reserved and frequent kswapd wakeups that emptied the caches to get more
contiguous memory.

13 years agomm: Add min_free_order_shift tunable.
Arve Hjønnevåg [Tue, 17 Feb 2009 22:51:02 +0000 (14:51 -0800)]
mm: Add min_free_order_shift tunable.

By default the kernel tries to keep half as much memory free at each
order as it does for one order below. This can be too agressive when
running without swap.

Change-Id: I5efc1a0b50f41ff3ac71e92d2efd175dedd54ead
Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years ago[ARM] avoid mis-detecting some V7 cores in the decompressor
Brian Swetland [Tue, 27 Jan 2009 01:15:49 +0000 (17:15 -0800)]
[ARM] avoid mis-detecting some V7 cores in the decompressor

This allows kernel decompress to happen nearly instantly instead
of taking over 20 seconds.

Signed-off-by: Brian Swetland <swetland@google.com>
13 years ago[ARM] armv6 dcc tty driver
Arve Hjønnevåg [Sun, 2 Dec 2007 02:34:14 +0000 (18:34 -0800)]
[ARM] armv6 dcc tty driver

Signed-off-by: Brian Swetland <swetland@google.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
13 years ago[ARM] Add code to prevent system calls from being restarted muliple times before...
Arve Hjønnevåg [Mon, 9 Apr 2007 10:13:02 +0000 (17:13 +0700)]
[ARM] Add code to prevent system calls from being restarted muliple times before returning from the kernel.

Fixes crashes with thumb syscalls.

13 years agoARM: Make low-level printk work
Tony Lindgren [Mon, 9 May 2005 21:10:26 +0000 (14:10 -0700)]
ARM: Make low-level printk work

Makes low-level printk work.

Signed-off-by: Tony Lindgren <tony@atomide.com>
13 years agoRevert "Staging: android: mark subsystem as broken"
Arve Hjønnevåg [Wed, 9 Dec 2009 04:37:55 +0000 (20:37 -0800)]
Revert "Staging: android: mark subsystem as broken"

This reverts commit 2cdf99ce2b9418c9d7c5f907195cfac421375520.

13 years agostaging/android: fix build issues
Corentin Chary [Sat, 28 Nov 2009 08:45:14 +0000 (09:45 +0100)]
staging/android: fix build issues

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
13 years agoRevert "Staging: android: delete android drivers"
Arve Hjønnevåg [Sat, 13 Feb 2010 04:32:37 +0000 (20:32 -0800)]
Revert "Staging: android: delete android drivers"

This reverts commit b0a0ccfad85b3657fe999805df65f5cfe634ab8a.

13 years agoLinux 2.6.38
Linus Torvalds [Tue, 15 Mar 2011 01:20:32 +0000 (18:20 -0700)]
Linux 2.6.38

13 years agoMerge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux...
Linus Torvalds [Mon, 14 Mar 2011 22:20:39 +0000 (15:20 -0700)]
Merge branch 'fixes' of git://git./linux/kernel/git/dhowells/linux-2.6-mn10300

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-2.6-mn10300:
  MN10300: atomic_read() should ensure it emits a load
  MN10300: The SMP_ICACHE_INV_FLUSH_RANGE IPI command does not exist
  MN10300: Proper use of macros get_user() in the case of incremented pointers

13 years agoMerge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus
Linus Torvalds [Mon, 14 Mar 2011 22:20:12 +0000 (15:20 -0700)]
Merge branch 'upstream' of git://git.linux-mips.org/upstream-linus

* 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus: (26 commits)
  MIPS: Alchemy: Fix reset for MTX-1 and XXS1500
  MIPS: MTX-1: Make au1000_eth probe all PHY addresses
  MIPS: Jz4740: Add HAVE_CLK
  MIPS: Move idle task creation to work queue
  MIPS, Perf-events: Use unsigned delta for right shift in event update
  MIPS, Perf-events: Work with the new callchain interface
  MIPS, Perf-events: Fix event check in validate_event()
  MIPS, Perf-events: Work with the new PMU interface
  MIPS, Perf-events: Work with irq_work
  MIPS: Fix always CONFIG_LOONGSON_UART_BASE=y
  MIPS: Loongson: Fix potentially wrong string handling
  MIPS: Fix GCC-4.6 'set but not used' warning in arch/mips/mm/init.c
  MIPS: Fix GCC-4.6 'set but not used' warning in ieee754int.h
  MIPS: Remove unused code from arch/mips/kernel/syscall.c
  MIPS: Fix GCC-4.6 'set but not used' warning in signal*.c
  MIPS: MSP: Fix MSP71xx bpci interrupt handler return value
  MIPS: Select R4K timer lib for all MSP platforms
  MIPS: Loongson: Remove ad-hoc cmdline default
  MIPS: Clear the correct flag in sysmips(MIPS_FIXADE, ...).
  MIPS: Add an unreachable return statement to satisfy buggy GCCs.
  ...

13 years agoMerge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Mon, 14 Mar 2011 22:19:09 +0000 (15:19 -0700)]
Merge branch 'x86-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: ce4100: Set pci ops via callback instead of module init
  x86/mm: Fix pgd_lock deadlock
  x86/mm: Handle mm_fault_error() in kernel space
  x86: Don't check for BIOS corruption in first 64K when there's no need to

13 years agoRevert "oom: oom_kill_process: fix the child_points logic"
Linus Torvalds [Mon, 14 Mar 2011 22:17:07 +0000 (15:17 -0700)]
Revert "oom: oom_kill_process: fix the child_points logic"

This reverts the parent commit.  I hate doing that, but it's generating
some discussion ("half of it is right"), and since I am planning on
doing the 2.6.38 release later today we can punt it to stable if
required. Let's not rock the boat right now.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agooom: oom_kill_process: fix the child_points logic
Oleg Nesterov [Mon, 14 Mar 2011 19:05:30 +0000 (20:05 +0100)]
oom: oom_kill_process: fix the child_points logic

oom_kill_process() starts with victim_points == 0.  This means that
(most likely) any child has more points and can be killed erroneously.

Also, "children has a different mm" doesn't match the reality, we should
check child->mm != t->mm.  This check is not exactly correct if t->mm ==
NULL but this doesn't really matter, oom_kill_task() will kill them
anyway.

Note: "Kill all processes sharing p->mm" in oom_kill_task() is wrong
too.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMIPS: Alchemy: Fix reset for MTX-1 and XXS1500
Florian Fainelli [Mon, 21 Feb 2011 13:28:02 +0000 (14:28 +0100)]
MIPS: Alchemy: Fix reset for MTX-1 and XXS1500

Since commit 32fd6901 (MIPS: Alchemy: get rid of common/reset.c)
Alchemy-based boards use their own reset function. For MTX-1 and XXS1500,
the reset function pokes at the BCSR.SYSTEM_RESET register, but this does
not work. According to Bruno Randolf, this was not tested when written.

Previously, the generic au1000_restart() routine called the board specific
reset function, which for MTX-1 and XXS1500 did not work, but finally made
a jump to the reset vector, which really triggers a system restart. Fix
reboot for both targets by jumping to the reset vector.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
To: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2093/
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS: MTX-1: Make au1000_eth probe all PHY addresses
Florian Fainelli [Sun, 27 Feb 2011 18:53:53 +0000 (19:53 +0100)]
MIPS: MTX-1: Make au1000_eth probe all PHY addresses

When au1000_eth probes the MII bus for PHY address, if we do not set
au1000_eth platform data's phy_search_highest_address, the MII probing
logic will exit early and will assume a valid PHY is found at address 0.
For MTX-1, the PHY is at address 31, and without this patch, the link
detection/speed/duplex would not work correctly.

CC: stable@kernel.org
Signed-off-by: Florian Fainelli <florian@openwrt.org>
To: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2111/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS: Jz4740: Add HAVE_CLK
Maurus Cuelenaere [Mon, 28 Feb 2011 23:20:01 +0000 (00:20 +0100)]
MIPS: Jz4740: Add HAVE_CLK

Jz4740 supports the clock framework but doesn't have HAVE_CLK defined,
so define it!

Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
To: linux-mips@linux-mips.org
To: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/2112/
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS: Move idle task creation to work queue
Maksim Rayskiy [Sat, 12 Feb 2011 18:21:32 +0000 (10:21 -0800)]
MIPS: Move idle task creation to work queue

To avoid forking usermode thread when creating an idle task, move fork_idle
to a work queue.

If kernel starts with maxcpus= option which does not bring all available
cpus online at boot time, idle tasks for offline cpus are not created. If
later offline cpus are hotplugged through sysfs, __cpu_up is called in
the context of the user task, and fork_idle copies its non-zero mm
pointer.  This causes BUG() in per_cpu_trap_init.

This also avoids issues with resource limits of the CPU writing to sysfs,
containers, maybe others.

Signed-off-by: Maksim Rayskiy <mrayskiy@broadcom.com>
To: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2070/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS, Perf-events: Use unsigned delta for right shift in event update
Deng-Cheng Zhu [Fri, 21 Jan 2011 08:19:21 +0000 (16:19 +0800)]
MIPS, Perf-events: Use unsigned delta for right shift in event update

Leverage the commit for ARM by Will Deacon:

446a5a8b1eb91a6990e5c8fe29f14e7a95b69132
    ARM: 6205/1: perf: ensure counter delta is treated as unsigned

    Hardware performance counters on ARM are 32-bits wide but atomic64_t
    variables are used to represent counter data in the hw_perf_event structure.

    The armpmu_event_update function right-shifts a signed 64-bit delta variable
    and adds the result to the event count. This can lead to shifting in sign-bits
    if the MSB of the 32-bit counter value is set. This results in perf output
    such as:

     Performance counter stats for 'sleep 20':

     18446744073460670464  cycles             <-- 0xFFFFFFFFF12A6000
            7783773  instructions             #      0.000 IPC
                465  context-switches
                161  page-faults
            1172393  branches

       20.154242147  seconds time elapsed

    This patch ensures that the delta value is treated as unsigned so that the
    right shift sets the upper bits to zero.

Acked-by: Will Deacon <will.deacon@arm.com>
Acked-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
To: a.p.zijlstra@chello.nl
To: fweisbec@gmail.com
To: will.deacon@arm.com
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: wuzhangjin@gmail.com
Cc: paulus@samba.org
Cc: mingo@elte.hu
Cc: acme@redhat.com
Cc: matt@console-pimps.org
Cc: sshtylyov@mvista.com
Patchwork: http://patchwork.linux-mips.org/patch/2015/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS, Perf-events: Work with the new callchain interface
Deng-Cheng Zhu [Fri, 21 Jan 2011 08:19:20 +0000 (16:19 +0800)]
MIPS, Perf-events: Work with the new callchain interface

This is the MIPS part of the following commits by Frederic Weisbecker:

f72c1a931e311bb7780fee19e41a89ac42cab50e
    perf: Factorize callchain context handling

    Store the kernel and user contexts from the generic layer instead
    of archs, this gathers some repetitive code.

56962b4449af34070bb1994621ef4f0265eed4d8
    perf: Generalize some arch callchain code

    - Most archs use one callchain buffer per cpu, except x86 that needs
      to deal with NMIs. Provide a default perf_callchain_buffer()
      implementation that x86 overrides.

    - Centralize all the kernel/user regs handling and invoke new arch
      handlers from there: perf_callchain_user() / perf_callchain_kernel()
      That avoid all the user_mode(), current->mm checks and so...

    - Invert some parameters in perf_callchain_*() helpers: entry to the
      left, regs to the right, following the traditional (dst, src).

70791ce9ba68a5921c9905ef05d23f62a90bc10c
    perf: Generalize callchain_store()

    callchain_store() is the same on every archs, inline it in
    perf_event.h and rename it to perf_callchain_store() to avoid
    any collision.

    This removes repetitive code.

c1a65932fd7216fdc9a0db8bbffe1d47842f862c
    perf: Drop unappropriate tests on arch callchains

    Drop the TASK_RUNNING test on user tasks for callchains as
    this check doesn't seem to make any sense.

    Also remove the tests for !current that is not supposed to
    happen and current->pid as this should be handled at the
    generic level, with exclude_idle attribute.

Reported-by: Wu Zhangjin <wuzhangjin@gmail.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
To: a.p.zijlstra@chello.nl
To: will.deacon@arm.com
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: paulus@samba.org
Cc: mingo@elte.hu
Cc: acme@redhat.com
Cc: dengcheng.zhu@gmail.com
Cc: matt@console-pimps.org
Cc: sshtylyov@mvista.com
Patchwork: http://patchwork.linux-mips.org/patch/2014/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS, Perf-events: Fix event check in validate_event()
Deng-Cheng Zhu [Fri, 21 Jan 2011 08:19:19 +0000 (16:19 +0800)]
MIPS, Perf-events: Fix event check in validate_event()

Ignore events that are in off/error state or belong to a different PMU.

This patch originates from the following commit for ARM by Will Deacon:

65b4711ff513767341aa1915c822de6ec0de65cb
    ARM: 6352/1: perf: fix event validation

    The validate_event function in the ARM perf events backend has the
    following problems:

    1.) Events that are disabled count towards the cost.
    2.) Events associated with other PMUs [for example, software events or
        breakpoints] do not count towards the cost, but do fail validation,
        causing the group to fail.

    This patch changes validate_event so that it ignores events in the
    PERF_EVENT_STATE_OFF state or that are scheduled for other PMUs.

Acked-by: Will Deacon <will.deacon@arm.com>
Acked-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
To: a.p.zijlstra@chello.nl
To: fweisbec@gmail.com
To: will.deacon@arm.com
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: wuzhangjin@gmail.com
Cc: paulus@samba.org
Cc: mingo@elte.hu
Cc: acme@redhat.com
Cc: dengcheng.zhu@gmail.com
Cc: matt@console-pimps.org
Cc: sshtylyov@mvista.com
Cc: ddaney@caviumnetworks.com
Patchwork: http://patchwork.linux-mips.org/patch/2013/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS, Perf-events: Work with the new PMU interface
Deng-Cheng Zhu [Fri, 21 Jan 2011 08:19:18 +0000 (16:19 +0800)]
MIPS, Perf-events: Work with the new PMU interface

This is the MIPS part of the following commits by Peter Zijlstra:

a4eaf7f14675cb512d69f0c928055e73d0c6d252
    perf: Rework the PMU methods

    Replace pmu::{enable,disable,start,stop,unthrottle} with
    pmu::{add,del,start,stop}, all of which take a flags argument.

    The new interface extends the capability to stop a counter while
    keeping it scheduled on the PMU. We replace the throttled state with
    the generic stopped state.

    This also allows us to efficiently stop/start counters over certain
    code paths (like IRQ handlers).

    It also allows scheduling a counter without it starting, allowing for
    a generic frozen state (useful for rotating stopped counters).

    The stopped state is implemented in two different ways, depending on
    how the architecture implemented the throttled state:

     1) We disable the counter:
        a) the pmu has per-counter enable bits, we flip that
        b) we program a NOP event, preserving the counter state

     2) We store the counter state and ignore all read/overflow events

For MIPSXX, the stopped state is implemented in the way of 1.b as above.

33696fc0d141bbbcb12f75b69608ea83282e3117
    perf: Per PMU disable

    Changes perf_disable() into perf_pmu_disable().

24cd7f54a0d47e1d5b3de29e2456bfbd2d8447b7
    perf: Reduce perf_disable() usage

    Since the current perf_disable() usage is only an optimization,
    remove it for now. This eases the removal of the __weak
    hw_perf_enable() interface.

b0a873ebbf87bf38bf70b5e39a7cadc96099fa13
    perf: Register PMU implementations

    Simple registration interface for struct pmu, this provides the
    infrastructure for removing all the weak functions.

51b0fe39549a04858001922919ab355dee9bdfcf
    perf: Deconstify struct pmu

    sed -ie 's/const struct pmu\>/struct pmu/g' `git grep -l "const struct pmu\>"`

Reported-by: Wu Zhangjin <wuzhangjin@gmail.com>
Acked-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
To: a.p.zijlstra@chello.nl
To: fweisbec@gmail.com
To: will.deacon@arm.com
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: wuzhangjin@gmail.com
Cc: paulus@samba.org
Cc: mingo@elte.hu
Cc: acme@redhat.com
Cc: dengcheng.zhu@gmail.com
Cc: matt@console-pimps.org
Cc: sshtylyov@mvista.com
Cc: ddaney@caviumnetworks.com
Patchwork: http://patchwork.linux-mips.org/patch/2012/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS, Perf-events: Work with irq_work
Deng-Cheng Zhu [Fri, 21 Jan 2011 08:19:17 +0000 (16:19 +0800)]
MIPS, Perf-events: Work with irq_work

This is the MIPS part of the following commit by Peter Zijlstra:

e360adbe29241a0194e10e20595360dd7b98a2b3
    irq_work: Add generic hardirq context callbacks

    Provide a mechanism that allows running code in IRQ context. It is
    most useful for NMI code that needs to interact with the rest of the
    system -- like wakeup a task to drain buffers.

    Perf currently has such a mechanism, so extract that and provide it as
    a generic feature, independent of perf so that others may also
    benefit.

    The IRQ context callback is generated through self-IPIs where
    possible, or on architectures like powerpc the decrementer (the
    built-in timer facility) is set to generate an interrupt immediately.

    Architectures that don't have anything like this get to do with a
    callback from the timer tick. These architectures can call
    irq_work_run() at the tail of any IRQ handlers that might enqueue such
    work (like the perf IRQ handler) to avoid undue latencies in
    processing the work.

For MIPSXX, we need to call irq_work_run() at the tail of the perf IRQ
handler as described above.

Reported-by: Wu Zhangjin <wuzhangjin@gmail.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
To: fweisbec@gmail.com
To: will.deacon@arm.com
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: paulus@samba.org
Cc: mingo@elte.hu
Cc: acme@redhat.com
Cc: matt@console-pimps.org
Cc: sshtylyov@mvista.com,
Patchwork: http://patchwork.linux-mips.org/patch/2011/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS: Fix always CONFIG_LOONGSON_UART_BASE=y
Yoichi Yuasa [Mon, 7 Feb 2011 02:31:36 +0000 (11:31 +0900)]
MIPS: Fix always CONFIG_LOONGSON_UART_BASE=y

Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
Cc: linux-mips <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/2055/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS: Loongson: Fix potentially wrong string handling
Stefan Weil [Sun, 30 Jan 2011 20:41:44 +0000 (21:41 +0100)]
MIPS: Loongson: Fix potentially wrong string handling

This error was reported by cppcheck:
arch/mips/loongson/common/machtype.c:56: error: Dangerous usage of 'str' (strncpy doesn't always 0-terminate it)

If strncpy copied MACHTYPE_LEN bytes, the destination string str
was not terminated.

The patch adds one more byte to str and makes sure that this byte is
always 0.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Cc: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Arnaud Patard <apatard@mandriva.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/2053/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS: Fix GCC-4.6 'set but not used' warning in arch/mips/mm/init.c
David Daney [Mon, 24 Jan 2011 22:51:37 +0000 (14:51 -0800)]
MIPS: Fix GCC-4.6 'set but not used' warning in arch/mips/mm/init.c

Under some combinations of CONFIG_*, lastpfn in page_is_ram is 'set
but not used'.  Mark it as __maybe_unused to quiet the warning/error.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2033/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS: Fix GCC-4.6 'set but not used' warning in ieee754int.h
David Daney [Mon, 24 Jan 2011 22:51:36 +0000 (14:51 -0800)]
MIPS: Fix GCC-4.6 'set but not used' warning in ieee754int.h

GCC-4.6 can find more unused code than previous versions could.

In the case of arch/mips/math-emu/ieee754int.h, the COMPXSP and
COMPXDP macros are used in several places, but a couple of them leave
xs unused.  The easiest thing to do is mark it as __maybe_unused to
quiet the warning.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2032/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
13 years agoMIPS: Remove unused code from arch/mips/kernel/syscall.c
David Daney [Mon, 24 Jan 2011 22:51:35 +0000 (14:51 -0800)]
MIPS: Remove unused code from arch/mips/kernel/syscall.c

The variable arg3 in _sys_sysmips() is unused.  Remove it.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2034/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>