Merge "msm-camera: Add support for YV12 preview format" into msm-3.0
diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt
index d79aead..b1db115 100644
--- a/Documentation/driver-model/devres.txt
+++ b/Documentation/driver-model/devres.txt
@@ -266,3 +266,6 @@
pcim_iounmap()
pcim_iomap_table() : array of mapped addresses indexed by BAR
pcim_iomap_regions() : do request_region() and iomap() on multiple BARs
+
+REGULATOR
+ devm_regulator_get()
diff --git a/arch/arm/mach-msm/include/mach/memory.h b/arch/arm/mach-msm/include/mach/memory.h
index 9cd73db..e1fc054 100644
--- a/arch/arm/mach-msm/include/mach/memory.h
+++ b/arch/arm/mach-msm/include/mach/memory.h
@@ -1,7 +1,7 @@
/* arch/arm/mach-msm/include/mach/memory.h
*
* Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -23,8 +23,13 @@
#define MAX_PHYSMEM_BITS 32
#define SECTION_SIZE_BITS 28
-/* Maximum number of Memory Regions */
-#define MAX_NR_REGIONS 4
+/* Maximum number of Memory Regions
+* The largest system can have 4 memory banks, each divided into 8 regions
+*/
+#define MAX_NR_REGIONS 32
+
+/* The number of regions each memory bank is divided into */
+#define NR_REGIONS_PER_BANK 8
/* Certain configurations of MSM7x30 have multiple memory banks.
* One or more of these banks can contain holes in the memory map as well.
diff --git a/arch/arm/mach-msm/memory_topology.c b/arch/arm/mach-msm/memory_topology.c
index 5854a23..6208a0d 100644
--- a/arch/arm/mach-msm/memory_topology.c
+++ b/arch/arm/mach-msm/memory_topology.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -31,11 +31,11 @@
/* reserved for future use */
u64 num_partitions;
int state;
- int mask;
- struct mutex state_mutex;
} mem_regions[MAX_NR_REGIONS];
+static struct mutex mem_regions_mutex;
static unsigned int nr_mem_regions;
+static int mem_regions_mask;
enum {
STATE_POWER_DOWN = 0x0,
@@ -43,14 +43,6 @@
STATE_DEFAULT = STATE_ACTIVE
};
-enum {
- MEM_NO_CHANGE = 0x0,
- MEM_DEEP_POWER_DOWN,
- MEM_SELF_REFRESH,
-};
-
-static unsigned int dmm_mode;
-
static int default_mask = ~0x0;
/* Return the number of chipselects populated with a memory bank */
@@ -111,50 +103,55 @@
}
}
-static int switch_memory_state(int id, int new_state)
+static int switch_memory_state(int mask, int new_state, int start_region,
+ int end_region)
{
- int mask = 0;
- int power_down_masks[MAX_NR_REGIONS] = { 0xFFFFFF00, 0xFFFF00FF,
- 0xFF00FFFF, 0x00FFFFFF };
- int self_refresh_masks[MAX_NR_REGIONS] = { 0xFFFFFFF0, 0xFFFFFF0F,
- 0xFFFFF0FF, 0xFFFF0FFF };
- mutex_lock(&mem_regions[id].state_mutex);
+ int final_mask = 0;
+ int i;
- if (new_state == mem_regions[id].state)
- goto no_change;
+ mutex_lock(&mem_regions_mutex);
- pr_info("request memory %d state switch (%d->%d) mode %d\n", id,
- mem_regions[id].state, new_state, dmm_mode);
- if (new_state == STATE_POWER_DOWN) {
- if (dmm_mode == MEM_DEEP_POWER_DOWN)
- mask = mem_regions[id].mask & power_down_masks[id];
- else
- mask = mem_regions[id].mask & self_refresh_masks[id];
- } else if (new_state == STATE_ACTIVE) {
- if (dmm_mode == MEM_DEEP_POWER_DOWN)
- mask = mem_regions[id].mask | (~power_down_masks[id]);
- else
- mask = mem_regions[id].mask | (~self_refresh_masks[id]);
+ for (i = start_region; i <= end_region; i++) {
+ if (new_state == mem_regions[i].state)
+ goto no_change;
+ /* All region states must be the same to change them */
+ if (mem_regions[i].state != mem_regions[start_region].state)
+ goto no_change;
}
- if (rpm_change_memory_state(mask, mask) == 0) {
- mem_regions[id].state = new_state;
- mem_regions[id].mask = mask;
- pr_info("completed memory %d state switch to %d mode %d\n",
- id, new_state, dmm_mode);
- mutex_unlock(&mem_regions[id].state_mutex);
+ if (new_state == STATE_POWER_DOWN)
+ final_mask = mem_regions_mask & mask;
+ else if (new_state == STATE_ACTIVE)
+ final_mask = mem_regions_mask | ~mask;
+ else
+ goto no_change;
+
+ pr_info("request memory %d to %d state switch (%d->%d)\n",
+ start_region, end_region, mem_regions[start_region].state,
+ new_state);
+ if (rpm_change_memory_state(final_mask, final_mask) == 0) {
+ for (i = start_region; i <= end_region; i++)
+ mem_regions[i].state = new_state;
+ mem_regions_mask = final_mask;
+
+ pr_info("completed memory %d to %d state switch to %d\n",
+ start_region, end_region, new_state);
+ mutex_unlock(&mem_regions_mutex);
return 0;
}
- pr_err("failed memory %d state switch (%d->%d) mode %d\n", id,
- mem_regions[id].state, new_state, dmm_mode);
+ pr_err("failed memory %d to %d state switch (%d->%d)\n",
+ start_region, end_region, mem_regions[start_region].state,
+ new_state);
+
no_change:
- mutex_unlock(&mem_regions[id].state_mutex);
+ mutex_unlock(&mem_regions_mutex);
return -EINVAL;
}
#else
-static int switch_memory_state(int id, int new_state)
+static int switch_memory_state(int mask, int new_state, int start_region,
+ int end_region)
{
return -EINVAL;
}
@@ -165,29 +162,34 @@
*/
int soc_change_memory_power(u64 start, u64 size, int change)
{
-
int i = 0;
- int match = 0;
-
- /* Find the memory region starting just below start */
- for (i = 0; i < nr_mem_regions; i++) {
- if (mem_regions[i].start <= start &&
- mem_regions[i].start >= mem_regions[match].start) {
- match = i;
- }
- }
-
- if (start + size > mem_regions[match].start + mem_regions[match].size) {
- pr_info("passed size exceeds size of memory bank\n");
- return 0;
- }
+ int mask = default_mask;
+ u64 end = start + size;
+ int start_region = 0;
+ int end_region = 0;
if (change != STATE_ACTIVE && change != STATE_POWER_DOWN) {
pr_info("requested state transition invalid\n");
return 0;
}
+ /* Find the memory regions that fall within the range */
+ for (i = 0; i < nr_mem_regions; i++) {
+ if (mem_regions[i].start <= start &&
+ mem_regions[i].start >=
+ mem_regions[start_region].start) {
+ start_region = i;
+ }
+ if (end <= mem_regions[i].start + mem_regions[i].size) {
+ end_region = i;
+ break;
+ }
+ }
- if (!switch_memory_state(match, change))
+ /* Set the bitmask for each region in the range */
+ for (i = start_region; i <= end_region; i++)
+ mask &= ~(0x1 << i);
+
+ if (!switch_memory_state(mask, change, start_region, end_region))
return size;
else
return 0;
@@ -212,9 +214,10 @@
int __init meminfo_init(unsigned int type, unsigned int min_bank_size)
{
- unsigned int i;
+ unsigned int i, j;
unsigned long bank_size;
unsigned long bank_start;
+ unsigned long region_size;
struct smem_ram_ptable *ram_ptable;
/* physical memory banks */
unsigned int nr_mem_banks = 0;
@@ -229,40 +232,35 @@
return -EINVAL;
}
- /* Determine power control mode based on the hw version */
- /* This check will be removed when PASR is fully supported */
- if (cpu_is_msm8960() &&
- SOCINFO_VERSION_MAJOR(socinfo_get_version()) < 2)
- dmm_mode = MEM_DEEP_POWER_DOWN;
- else
- dmm_mode = MEM_SELF_REFRESH;
-
pr_info("meminfo_init: smem ram ptable found: ver: %d len: %d\n",
ram_ptable->version, ram_ptable->len);
for (i = 0; i < ram_ptable->len; i++) {
+ /* A bank is valid only if is greater than min_bank_size. If
+ * non-valid memory (e.g. modem memory) became greater than
+ * min_bank_size, there is currently no way to differentiate.
+ */
if (ram_ptable->parts[i].type == type &&
ram_ptable->parts[i].size >= min_bank_size) {
bank_start = ram_ptable->parts[i].start;
bank_size = ram_ptable->parts[i].size;
- /* Divide into logical memory regions of same size */
- while (bank_size) {
+ region_size = bank_size / NR_REGIONS_PER_BANK;
+
+ for (j = 0; j < NR_REGIONS_PER_BANK; j++) {
mem_regions[nr_mem_regions].start =
bank_start;
mem_regions[nr_mem_regions].size =
- MIN_MEMORY_BLOCK_SIZE;
- mutex_init(&mem_regions[nr_mem_regions]
- .state_mutex);
+ region_size;
mem_regions[nr_mem_regions].state =
STATE_DEFAULT;
- mem_regions[nr_mem_regions].mask = default_mask;
- bank_start += MIN_MEMORY_BLOCK_SIZE;
- bank_size -= MIN_MEMORY_BLOCK_SIZE;
+ bank_start += region_size;
nr_mem_regions++;
}
nr_mem_banks++;
}
}
+ mutex_init(&mem_regions_mutex);
+ mem_regions_mask = default_mask;
pr_info("Found %d memory banks grouped into %d memory regions\n",
nr_mem_banks, nr_mem_regions);
return 0;
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5b2328d..2b58215 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1319,6 +1319,40 @@
}
EXPORT_SYMBOL_GPL(regulator_get);
+static void devm_regulator_release(struct device *dev, void *res)
+{
+ regulator_put(*(struct regulator **)res);
+}
+
+/**
+ * devm_regulator_get - Resource managed regulator_get()
+ * @dev: device for regulator "consumer"
+ * @id: Supply name or regulator ID.
+ *
+ * Managed regulator_get(). Regulators returned from this function are
+ * automatically regulator_put() on driver detach. See regulator_get() for more
+ * information.
+ */
+struct regulator *devm_regulator_get(struct device *dev, const char *id)
+{
+ struct regulator **ptr, *regulator;
+
+ ptr = devres_alloc(devm_regulator_release, sizeof(*ptr), GFP_KERNEL);
+ if (!ptr)
+ return ERR_PTR(-ENOMEM);
+
+ regulator = regulator_get(dev, id);
+ if (!IS_ERR(regulator)) {
+ *ptr = regulator;
+ devres_add(dev, ptr);
+ } else {
+ devres_free(ptr);
+ }
+
+ return regulator;
+}
+EXPORT_SYMBOL_GPL(devm_regulator_get);
+
/**
* regulator_get_exclusive - obtain exclusive access to a regulator.
* @dev: device for regulator "consumer"
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index e13b4c4..a0763da 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -3,6 +3,7 @@
* Android IPC Subsystem
*
* Copyright (C) 2007-2008 Google, Inc.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -97,9 +98,9 @@
BINDER_DEBUG_BUFFER_ALLOC = 1U << 13,
BINDER_DEBUG_PRIORITY_CAP = 1U << 14,
BINDER_DEBUG_BUFFER_ALLOC_ASYNC = 1U << 15,
+ BINDER_DEBUG_TOP_ERRORS = 1U << 16,
};
-static uint32_t binder_debug_mask = BINDER_DEBUG_USER_ERROR |
- BINDER_DEBUG_FAILED_TRANSACTION | BINDER_DEBUG_DEAD_TRANSACTION;
+static uint32_t binder_debug_mask;
module_param_named(debug_mask, binder_debug_mask, uint, S_IWUSR | S_IRUGO);
static int binder_debug_no_lock;
@@ -638,7 +639,8 @@
goto free_range;
if (vma == NULL) {
- printk(KERN_ERR "binder: %d: binder_alloc_buf failed to "
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: %d: binder_alloc_buf failed to "
"map pages in userspace, no vma\n", proc->pid);
goto err_no_vma;
}
@@ -651,7 +653,8 @@
BUG_ON(*page);
*page = alloc_page(GFP_KERNEL | __GFP_ZERO);
if (*page == NULL) {
- printk(KERN_ERR "binder: %d: binder_alloc_buf failed "
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: %d: binder_alloc_buf failed "
"for page at %p\n", proc->pid, page_addr);
goto err_alloc_page_failed;
}
@@ -660,7 +663,8 @@
page_array_ptr = page;
ret = map_vm_area(&tmp_area, PAGE_KERNEL, &page_array_ptr);
if (ret) {
- printk(KERN_ERR "binder: %d: binder_alloc_buf failed "
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: %d: binder_alloc_buf failed "
"to map page at %p in kernel\n",
proc->pid, page_addr);
goto err_map_kernel_failed;
@@ -669,7 +673,8 @@
(uintptr_t)page_addr + proc->user_buffer_offset;
ret = vm_insert_page(vma, user_page_addr, page[0]);
if (ret) {
- printk(KERN_ERR "binder: %d: binder_alloc_buf failed "
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: %d: binder_alloc_buf failed "
"to map page at %lx in userspace\n",
proc->pid, user_page_addr);
goto err_vm_insert_page_failed;
@@ -718,7 +723,8 @@
size_t size;
if (proc->vma == NULL) {
- printk(KERN_ERR "binder: %d: binder_alloc_buf, no vma\n",
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: %d: binder_alloc_buf, no vma\n",
proc->pid);
return NULL;
}
@@ -756,7 +762,8 @@
}
}
if (best_fit == NULL) {
- printk(KERN_ERR "binder: %d: binder_alloc_buf size %zd failed, "
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: %d: binder_alloc_buf size %zd failed, "
"no address space\n", proc->pid, size);
return NULL;
}
@@ -991,7 +998,8 @@
node->internal_strong_refs == 0 &&
!(node == binder_context_mgr_node &&
node->has_strong_ref)) {
- printk(KERN_ERR "binder: invalid inc strong "
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: invalid inc strong "
"node for %d\n", node->debug_id);
return -EINVAL;
}
@@ -1007,7 +1015,8 @@
node->local_weak_refs++;
if (!node->has_weak_ref && list_empty(&node->work.entry)) {
if (target_list == NULL) {
- printk(KERN_ERR "binder: invalid inc weak node "
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: invalid inc weak node "
"for %d\n", node->debug_id);
return -EINVAL;
}
@@ -1044,7 +1053,7 @@
if (node->proc) {
rb_erase(&node->rb_node, &node->proc->nodes);
binder_debug(BINDER_DEBUG_INTERNAL_REFS,
- "binder: refless node %d deleted\n",
+ "binder: refless node %d deleted\n",
node->debug_id);
} else {
hlist_del(&node->dead_node);
@@ -1263,14 +1272,16 @@
binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
"binder: send failed reply for "
"transaction %d to %d:%d\n",
- t->debug_id, target_thread->proc->pid,
+ t->debug_id,
+ target_thread->proc->pid,
target_thread->pid);
binder_pop_transaction(target_thread, t);
target_thread->return_error = error_code;
wake_up_interruptible(&target_thread->wait);
} else {
- printk(KERN_ERR "binder: reply failed, target "
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: reply failed, target "
"thread, %d:%d, has error code %d "
"already\n", target_thread->proc->pid,
target_thread->pid,
@@ -1308,14 +1319,15 @@
int debug_id = buffer->debug_id;
binder_debug(BINDER_DEBUG_TRANSACTION,
- "binder: %d buffer release %d, size %zd-%zd, failed at %p\n",
- proc->pid, buffer->debug_id,
+ "binder: %d buffer release %d, size %zd-%zd, failed at"
+ " %p\n", proc->pid, buffer->debug_id,
buffer->data_size, buffer->offsets_size, failed_at);
if (buffer->target_node)
binder_dec_node(buffer->target_node, 1, 0);
- offp = (size_t *)(buffer->data + ALIGN(buffer->data_size, sizeof(void *)));
+ offp = (size_t *)(buffer->data + ALIGN(buffer->data_size,
+ sizeof(void *)));
if (failed_at)
off_end = failed_at;
else
@@ -1325,7 +1337,8 @@
if (*offp > buffer->data_size - sizeof(*fp) ||
buffer->data_size < sizeof(*fp) ||
!IS_ALIGNED(*offp, sizeof(void *))) {
- printk(KERN_ERR "binder: transaction release %d bad"
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: transaction release %d bad"
"offset %zd, size %zd\n", debug_id,
*offp, buffer->data_size);
continue;
@@ -1334,29 +1347,35 @@
switch (fp->type) {
case BINDER_TYPE_BINDER:
case BINDER_TYPE_WEAK_BINDER: {
- struct binder_node *node = binder_get_node(proc, fp->binder);
+ struct binder_node *node = binder_get_node(proc,
+ fp->binder);
if (node == NULL) {
- printk(KERN_ERR "binder: transaction release %d"
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: transaction release %d"
" bad node %p\n", debug_id, fp->binder);
break;
}
binder_debug(BINDER_DEBUG_TRANSACTION,
" node %d u%p\n",
node->debug_id, node->ptr);
- binder_dec_node(node, fp->type == BINDER_TYPE_BINDER, 0);
+ binder_dec_node(node, fp->type == BINDER_TYPE_BINDER,
+ 0);
} break;
case BINDER_TYPE_HANDLE:
case BINDER_TYPE_WEAK_HANDLE: {
- struct binder_ref *ref = binder_get_ref(proc, fp->handle);
+ struct binder_ref *ref = binder_get_ref(proc,
+ fp->handle);
if (ref == NULL) {
- printk(KERN_ERR "binder: transaction release %d"
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: transaction release %d"
" bad handle %ld\n", debug_id,
fp->handle);
break;
}
binder_debug(BINDER_DEBUG_TRANSACTION,
" ref %d desc %d (node %d)\n",
- ref->debug_id, ref->desc, ref->node->debug_id);
+ ref->debug_id, ref->desc,
+ ref->node->debug_id);
binder_dec_ref(ref, fp->type == BINDER_TYPE_HANDLE);
} break;
@@ -1368,7 +1387,8 @@
break;
default:
- printk(KERN_ERR "binder: transaction release %d bad "
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: transaction release %d bad "
"object type %lx\n", debug_id, fp->type);
break;
}
@@ -1594,15 +1614,19 @@
case BINDER_TYPE_BINDER:
case BINDER_TYPE_WEAK_BINDER: {
struct binder_ref *ref;
- struct binder_node *node = binder_get_node(proc, fp->binder);
+ struct binder_node *node = binder_get_node(proc,
+ fp->binder);
if (node == NULL) {
- node = binder_new_node(proc, fp->binder, fp->cookie);
+ node = binder_new_node(proc, fp->binder,
+ fp->cookie);
if (node == NULL) {
return_error = BR_FAILED_REPLY;
goto err_binder_new_node_failed;
}
- node->min_priority = fp->flags & FLAT_BINDER_FLAG_PRIORITY_MASK;
- node->accept_fds = !!(fp->flags & FLAT_BINDER_FLAG_ACCEPTS_FDS);
+ node->min_priority = fp->flags &
+ FLAT_BINDER_FLAG_PRIORITY_MASK;
+ node->accept_fds = !!(fp->flags &
+ FLAT_BINDER_FLAG_ACCEPTS_FDS);
}
if (fp->cookie != node->cookie) {
binder_user_error("binder: %d:%d sending u%p "
@@ -1632,7 +1656,8 @@
} break;
case BINDER_TYPE_HANDLE:
case BINDER_TYPE_WEAK_HANDLE: {
- struct binder_ref *ref = binder_get_ref(proc, fp->handle);
+ struct binder_ref *ref = binder_get_ref(proc,
+ fp->handle);
if (ref == NULL) {
binder_user_error("binder: %d:%d got "
"transaction with invalid "
@@ -1648,24 +1673,31 @@
fp->type = BINDER_TYPE_WEAK_BINDER;
fp->binder = ref->node->ptr;
fp->cookie = ref->node->cookie;
- binder_inc_node(ref->node, fp->type == BINDER_TYPE_BINDER, 0, NULL);
+ binder_inc_node(ref->node, fp->type ==
+ BINDER_TYPE_BINDER, 0, NULL);
binder_debug(BINDER_DEBUG_TRANSACTION,
- " ref %d desc %d -> node %d u%p\n",
- ref->debug_id, ref->desc, ref->node->debug_id,
- ref->node->ptr);
+ " ref %d desc %d -> node %d u%p\n",
+ ref->debug_id, ref->desc,
+ ref->node->debug_id,
+ ref->node->ptr);
} else {
struct binder_ref *new_ref;
- new_ref = binder_get_ref_for_node(target_proc, ref->node);
+ new_ref = binder_get_ref_for_node(target_proc,
+ ref->node);
if (new_ref == NULL) {
return_error = BR_FAILED_REPLY;
goto err_binder_get_ref_for_node_failed;
}
fp->handle = new_ref->desc;
- binder_inc_ref(new_ref, fp->type == BINDER_TYPE_HANDLE, NULL);
+ binder_inc_ref(new_ref, fp->type ==
+ BINDER_TYPE_HANDLE, NULL);
binder_debug(BINDER_DEBUG_TRANSACTION,
- " ref %d desc %d -> ref %d desc %d (node %d)\n",
- ref->debug_id, ref->desc, new_ref->debug_id,
- new_ref->desc, ref->node->debug_id);
+ " ref %d desc %d -> ref %d"
+ " desc %d (node %d)\n",
+ ref->debug_id, ref->desc,
+ new_ref->debug_id,
+ new_ref->desc,
+ ref->node->debug_id);
}
} break;
@@ -1675,13 +1707,19 @@
if (reply) {
if (!(in_reply_to->flags & TF_ACCEPT_FDS)) {
- binder_user_error("binder: %d:%d got reply with fd, %ld, but target does not allow fds\n",
- proc->pid, thread->pid, fp->handle);
+ binder_user_error("binder: %d:%d got"
+ " reply with fd, %ld, but"
+ " target does not allow fds\n",
+ proc->pid, thread->pid,
+ fp->handle);
return_error = BR_FAILED_REPLY;
goto err_fd_not_allowed;
}
} else if (!target_node->accept_fds) {
- binder_user_error("binder: %d:%d got transaction with fd, %ld, but target does not allow fds\n",
+ binder_user_error(
+ "binder: %d:%d got transaction"
+ " with fd, %ld, but target does"
+ " not allow fds\n",
proc->pid, thread->pid, fp->handle);
return_error = BR_FAILED_REPLY;
goto err_fd_not_allowed;
@@ -1689,12 +1727,15 @@
file = fget(fp->handle);
if (file == NULL) {
- binder_user_error("binder: %d:%d got transaction with invalid fd, %ld\n",
+ binder_user_error(
+ "binder: %d:%d got transaction"
+ " with invalid fd, %ld\n",
proc->pid, thread->pid, fp->handle);
return_error = BR_FAILED_REPLY;
goto err_fget_failed;
}
- target_fd = task_get_unused_fd_flags(target_proc, O_CLOEXEC);
+ target_fd = task_get_unused_fd_flags(target_proc,
+ O_CLOEXEC);
if (target_fd < 0) {
fput(file);
return_error = BR_FAILED_REPLY;
@@ -1702,7 +1743,8 @@
}
task_fd_install(target_proc, target_fd, file);
binder_debug(BINDER_DEBUG_TRANSACTION,
- " fd %ld -> %d\n", fp->handle, target_fd);
+ " fd %ld -> %d\n", fp->handle,
+ target_fd);
/* TODO: fput? */
fp->handle = target_fd;
} break;
@@ -1851,9 +1893,11 @@
break;
}
binder_debug(BINDER_DEBUG_USER_REFS,
- "binder: %d:%d %s ref %d desc %d s %d w %d for node %d\n",
- proc->pid, thread->pid, debug_string, ref->debug_id,
- ref->desc, ref->strong, ref->weak, ref->node->debug_id);
+ "binder: %d:%d %s ref %d desc %d s %d w %d"
+ " for node %d\n", proc->pid, thread->pid,
+ debug_string, ref->debug_id, ref->desc,
+ ref->strong, ref->weak,
+ ref->node->debug_id);
break;
}
case BC_INCREFS_DONE:
@@ -1914,15 +1958,19 @@
binder_debug(BINDER_DEBUG_USER_REFS,
"binder: %d:%d %s node %d ls %d lw %d\n",
proc->pid, thread->pid,
- cmd == BC_INCREFS_DONE ? "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE",
- node->debug_id, node->local_strong_refs, node->local_weak_refs);
+ cmd == BC_INCREFS_DONE ? "BC_INCREFS_DONE"
+ : "BC_ACQUIRE_DONE",
+ node->debug_id, node->local_strong_refs,
+ node->local_weak_refs);
break;
}
case BC_ATTEMPT_ACQUIRE:
- printk(KERN_ERR "binder: BC_ATTEMPT_ACQUIRE not supported\n");
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: BC_ATTEMPT_ACQUIRE not supported\n");
return -EINVAL;
case BC_ACQUIRE_RESULT:
- printk(KERN_ERR "binder: BC_ACQUIRE_RESULT not supported\n");
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: BC_ACQUIRE_RESULT not supported\n");
return -EINVAL;
case BC_FREE_BUFFER: {
@@ -1948,9 +1996,11 @@
break;
}
binder_debug(BINDER_DEBUG_FREE_BUFFER,
- "binder: %d:%d BC_FREE_BUFFER u%p found buffer %d for %s transaction\n",
- proc->pid, thread->pid, data_ptr, buffer->debug_id,
- buffer->transaction ? "active" : "finished");
+ "binder: %d:%d BC_FREE_BUFFER u%p found"
+ " buffer %d for %s transaction\n",
+ proc->pid, thread->pid, data_ptr,
+ buffer->debug_id, buffer->transaction ?
+ "active" : "finished");
if (buffer->transaction) {
buffer->transaction->buffer = NULL;
@@ -2047,13 +2097,15 @@
}
binder_debug(BINDER_DEBUG_DEATH_NOTIFICATION,
- "binder: %d:%d %s %p ref %d desc %d s %d w %d for node %d\n",
+ "binder: %d:%d %s %p ref %d desc %d s %d"
+ " w %d for node %d\n",
proc->pid, thread->pid,
cmd == BC_REQUEST_DEATH_NOTIFICATION ?
"BC_REQUEST_DEATH_NOTIFICATION" :
"BC_CLEAR_DEATH_NOTIFICATION",
cookie, ref->debug_id, ref->desc,
- ref->strong, ref->weak, ref->node->debug_id);
+ ref->strong, ref->weak,
+ ref->node->debug_id);
if (cmd == BC_REQUEST_DEATH_NOTIFICATION) {
if (ref->death) {
@@ -2067,10 +2119,12 @@
death = kzalloc(sizeof(*death), GFP_KERNEL);
if (death == NULL) {
thread->return_error = BR_ERROR;
- binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
- "binder: %d:%d "
- "BC_REQUEST_DEATH_NOTIFICATION failed\n",
- proc->pid, thread->pid);
+ binder_debug(
+ BINDER_DEBUG_FAILED_TRANSACTION,
+ "binder: %d:%d "
+ "BC_REQUEST_DEATH_NOTIFICATION"
+ " failed\n",
+ proc->pid, thread->pid);
break;
}
binder_stats_created(BINDER_STAT_DEATH);
@@ -2159,7 +2213,8 @@
} break;
default:
- printk(KERN_ERR "binder: %d:%d unknown command %d\n",
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: %d:%d unknown command %d\n",
proc->pid, thread->pid, cmd);
return -EINVAL;
}
@@ -2629,9 +2684,11 @@
unsigned int size = _IOC_SIZE(cmd);
void __user *ubuf = (void __user *)arg;
- /*printk(KERN_INFO "binder_ioctl: %d:%d %x %lx\n", proc->pid, current->pid, cmd, arg);*/
+ /*binder_debug(BINDER_DEBUG_TOP_ERRORS, "binder_ioctl: %d:%d %x %lx\n",
+ proc->pid, current->pid, cmd, arg);*/
- ret = wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2);
+ ret = wait_event_interruptible(binder_user_error_wait,
+ binder_stop_on_user_error < 2);
if (ret)
return ret;
@@ -2688,20 +2745,23 @@
break;
}
case BINDER_SET_MAX_THREADS:
- if (copy_from_user(&proc->max_threads, ubuf, sizeof(proc->max_threads))) {
+ if (copy_from_user(&proc->max_threads, ubuf,
+ sizeof(proc->max_threads))) {
ret = -EINVAL;
goto err;
}
break;
case BINDER_SET_CONTEXT_MGR:
if (binder_context_mgr_node != NULL) {
- printk(KERN_ERR "binder: BINDER_SET_CONTEXT_MGR already set\n");
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: BINDER_SET_CONTEXT_MGR already set\n");
ret = -EBUSY;
goto err;
}
if (binder_context_mgr_uid != -1) {
if (binder_context_mgr_uid != current->cred->euid) {
- printk(KERN_ERR "binder: BINDER_SET_"
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: BINDER_SET_"
"CONTEXT_MGR bad uid %d != %d\n",
current->cred->euid,
binder_context_mgr_uid);
@@ -2747,7 +2807,9 @@
mutex_unlock(&binder_lock);
wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2);
if (ret && ret != -ERESTARTSYS)
- printk(KERN_INFO "binder: %d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret);
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: %d:%d ioctl %x %lx returned %d\n",
+ proc->pid, current->pid, cmd, arg, ret);
return ret;
}
@@ -2821,7 +2883,9 @@
#ifdef CONFIG_CPU_CACHE_VIPT
if (cache_is_vipt_aliasing()) {
while (CACHE_COLOUR((vma->vm_start ^ (uint32_t)proc->buffer))) {
- printk(KERN_INFO "binder_mmap: %d %lx-%lx maps %p bad alignment\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer);
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder_mmap: %d %lx-%lx maps %p bad alignment\n",
+ proc->pid, vma->vm_start, vma->vm_end, proc->buffer);
vma->vm_start += PAGE_SIZE;
}
}
@@ -2852,7 +2916,8 @@
proc->files = get_files_struct(current);
proc->vma = vma;
- /*printk(KERN_INFO "binder_mmap: %d %lx-%lx maps %p\n",
+ /*binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder_mmap: %d %lx-%lx maps %p\n",
proc->pid, vma->vm_start, vma->vm_end, proc->buffer);*/
return 0;
@@ -2865,7 +2930,8 @@
err_get_vm_area_failed:
err_already_mapped:
err_bad_arg:
- printk(KERN_ERR "binder_mmap: %d %lx-%lx %s failed %d\n",
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder_mmap: %d %lx-%lx %s failed %d\n",
proc->pid, vma->vm_start, vma->vm_end, failure_string, ret);
return ret;
}
@@ -3020,7 +3086,8 @@
if (t) {
t->buffer = NULL;
buffer->transaction = NULL;
- printk(KERN_ERR "binder: release proc %d, "
+ binder_debug(BINDER_DEBUG_TOP_ERRORS,
+ "binder: release proc %d, "
"transaction %d, not freed\n",
proc->pid, t->debug_id);
/*BUG();*/
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index fb5d4e4..f46449a 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -135,6 +135,8 @@
/* regulator get and put */
struct regulator *__must_check regulator_get(struct device *dev,
const char *id);
+struct regulator *__must_check devm_regulator_get(struct device *dev,
+ const char *id);
struct regulator *__must_check regulator_get_exclusive(struct device *dev,
const char *id);
void regulator_put(struct regulator *regulator);
@@ -202,6 +204,13 @@
*/
return NULL;
}
+
+static inline struct regulator *__must_check
+devm_regulator_get(struct device *dev, const char *id)
+{
+ return NULL;
+}
+
static inline void regulator_put(struct regulator *regulator)
{
}
diff --git a/sound/soc/msm/qdsp6/q6asm.c b/sound/soc/msm/qdsp6/q6asm.c
index ab7f9f7..62168d2 100644
--- a/sound/soc/msm/qdsp6/q6asm.c
+++ b/sound/soc/msm/qdsp6/q6asm.c
@@ -515,6 +515,7 @@
pr_err("%s:map_buffer failed,"
"error = %ld\n",
__func__, PTR_ERR((void *)buf[cnt].mem_buffer));
+ mutex_unlock(&ac->cmd_lock);
goto fail;
}
buf[cnt].data =
@@ -522,6 +523,7 @@
if (!buf[cnt].data) {
pr_err("%s:invalid vaddr,"
" iomap failed\n", __func__);
+ mutex_unlock(&ac->cmd_lock);
goto fail;
}
buf[cnt].used = 1;
@@ -944,6 +946,7 @@
idx = port->cpu_buf;
if (port->buf == NULL) {
pr_debug("%s:Buffer pointer null\n", __func__);
+ mutex_unlock(&port->lock);
return NULL;
}
/* dir 0: used = 0 means buf in use