2012-10-20 22:33:32

by Ken O'Brien

[permalink] [raw]
Subject: [PATCH 1/2] staging: android: checkpatch.pl fixes

Fixed all instances of strings spanning multiple lines from checkpatch.pl.

Signed-off-by: Ken O'Brien <[email protected]>
---
drivers/staging/android/binder.c | 148 +++++++++++++++++++--------------------
1 file changed, 74 insertions(+), 74 deletions(-)

diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index 7b0ba92..8607628 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -556,7 +556,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
goto free_range;

if (vma == NULL) {
- pr_err("binder: %d: binder_alloc_buf failed to "
+ pr_err("binder: %d: binder_alloc_buf failed to " \
"map pages in userspace, no vma\n", proc->pid);
goto err_no_vma;
}
@@ -569,7 +569,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
BUG_ON(*page);
*page = alloc_page(GFP_KERNEL | __GFP_ZERO);
if (*page == NULL) {
- pr_err("binder: %d: binder_alloc_buf failed "
+ pr_err("binder: %d: binder_alloc_buf failed " \
"for page at %p\n", proc->pid, page_addr);
goto err_alloc_page_failed;
}
@@ -578,7 +578,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
page_array_ptr = page;
ret = map_vm_area(&tmp_area, PAGE_KERNEL, &page_array_ptr);
if (ret) {
- pr_err("binder: %d: binder_alloc_buf failed "
+ pr_err("binder: %d: binder_alloc_buf failed " \
"to map page at %p in kernel\n",
proc->pid, page_addr);
goto err_map_kernel_failed;
@@ -587,7 +587,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
(uintptr_t)page_addr + proc->user_buffer_offset;
ret = vm_insert_page(vma, user_page_addr, page[0]);
if (ret) {
- pr_err("binder: %d: binder_alloc_buf failed "
+ pr_err("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;
@@ -645,7 +645,7 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
ALIGN(offsets_size, sizeof(void *));

if (size < data_size || size < offsets_size) {
- binder_user_error("binder: %d: got transaction with invalid "
+ binder_user_error("binder: %d: got transaction with invalid " \
"size %zd-%zd\n", proc->pid, data_size, offsets_size);
return NULL;
}
@@ -674,7 +674,7 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
}
}
if (best_fit == NULL) {
- pr_err("binder: %d: binder_alloc_buf size %zd failed, "
+ pr_err("binder: %d: binder_alloc_buf size %zd failed, " \
"no address space\n", proc->pid, size);
return NULL;
}
@@ -909,7 +909,7 @@ static int binder_inc_node(struct binder_node *node, int strong, int internal,
node->internal_strong_refs == 0 &&
!(node == binder_context_mgr_node &&
node->has_strong_ref)) {
- pr_err("binder: invalid inc strong "
+ pr_err("binder: invalid inc strong " \
"node for %d\n", node->debug_id);
return -EINVAL;
}
@@ -925,7 +925,7 @@ static int binder_inc_node(struct binder_node *node, int strong, int internal,
node->local_weak_refs++;
if (!node->has_weak_ref && list_empty(&node->work.entry)) {
if (target_list == NULL) {
- pr_err("binder: invalid inc weak node "
+ pr_err("binder: invalid inc weak node " \
"for %d\n", node->debug_id);
return -EINVAL;
}
@@ -1118,7 +1118,7 @@ static int binder_dec_ref(struct binder_ref *ref, int strong)
{
if (strong) {
if (ref->strong == 0) {
- binder_user_error("binder: %d invalid dec strong, "
+ binder_user_error("binder: %d invalid dec strong, " \
"ref %d desc %d s %d w %d\n",
ref->proc->pid, ref->debug_id,
ref->desc, ref->strong, ref->weak);
@@ -1133,7 +1133,7 @@ static int binder_dec_ref(struct binder_ref *ref, int strong)
}
} else {
if (ref->weak == 0) {
- binder_user_error("binder: %d invalid dec weak, "
+ binder_user_error("binder: %d invalid dec weak, " \
"ref %d desc %d s %d w %d\n",
ref->proc->pid, ref->debug_id,
ref->desc, ref->strong, ref->weak);
@@ -1179,7 +1179,7 @@ static void binder_send_failed_reply(struct binder_transaction *t,
}
if (target_thread->return_error == BR_OK) {
binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
- "binder: send failed reply for "
+ "binder: send failed reply for " \
"transaction %d to %d:%d\n",
t->debug_id, target_thread->proc->pid,
target_thread->pid);
@@ -1188,7 +1188,7 @@ static void binder_send_failed_reply(struct binder_transaction *t,
target_thread->return_error = error_code;
wake_up_interruptible(&target_thread->wait);
} else {
- pr_err("binder: reply failed, target "
+ pr_err("binder: reply failed, target " \
"thread, %d:%d, has error code %d "
"already\n", target_thread->proc->pid,
target_thread->pid,
@@ -1199,20 +1199,20 @@ static void binder_send_failed_reply(struct binder_transaction *t,
struct binder_transaction *next = t->from_parent;

binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
- "binder: send failed reply "
+ "binder: send failed reply " \
"for transaction %d, target dead\n",
t->debug_id);

binder_pop_transaction(target_thread, t);
if (next == NULL) {
binder_debug(BINDER_DEBUG_DEAD_BINDER,
- "binder: reply failed,"
+ "binder: reply failed," \
" no target thread at root\n");
return;
}
t = next;
binder_debug(BINDER_DEBUG_DEAD_BINDER,
- "binder: reply failed, no target "
+ "binder: reply failed, no target " \
"thread -- retry %d\n", t->debug_id);
}
}
@@ -1243,7 +1243,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
if (*offp > buffer->data_size - sizeof(*fp) ||
buffer->data_size < sizeof(*fp) ||
!IS_ALIGNED(*offp, sizeof(void *))) {
- pr_err("binder: transaction release %d bad"
+ pr_err("binder: transaction release %d bad" \
"offset %zd, size %zd\n", debug_id,
*offp, buffer->data_size);
continue;
@@ -1254,7 +1254,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
case BINDER_TYPE_WEAK_BINDER: {
struct binder_node *node = binder_get_node(proc, fp->binder);
if (node == NULL) {
- pr_err("binder: transaction release %d"
+ pr_err("binder: transaction release %d" \
" bad node %p\n", debug_id, fp->binder);
break;
}
@@ -1267,7 +1267,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
case BINDER_TYPE_WEAK_HANDLE: {
struct binder_ref *ref = binder_get_ref(proc, fp->handle);
if (ref == NULL) {
- pr_err("binder: transaction release %d"
+ pr_err("binder: transaction release %d" \
" bad handle %ld\n", debug_id,
fp->handle);
break;
@@ -1286,7 +1286,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
break;

default:
- pr_err("binder: transaction release %d bad "
+ pr_err("binder: transaction release %d bad " \
"object type %lx\n", debug_id, fp->type);
break;
}
@@ -1320,7 +1320,7 @@ static void binder_transaction(struct binder_proc *proc,
if (reply) {
in_reply_to = thread->transaction_stack;
if (in_reply_to == NULL) {
- binder_user_error("binder: %d:%d got reply transaction "
+ binder_user_error("binder: %d:%d got reply transaction " \
"with no transaction stack\n",
proc->pid, thread->pid);
return_error = BR_FAILED_REPLY;
@@ -1328,8 +1328,8 @@ static void binder_transaction(struct binder_proc *proc,
}
binder_set_nice(in_reply_to->saved_priority);
if (in_reply_to->to_thread != thread) {
- binder_user_error("binder: %d:%d got reply transaction "
- "with bad transaction stack,"
+ binder_user_error("binder: %d:%d got reply transaction " \
+ "with bad transaction stack," \
" transaction %d has target %d:%d\n",
proc->pid, thread->pid, in_reply_to->debug_id,
in_reply_to->to_proc ?
@@ -1347,8 +1347,8 @@ static void binder_transaction(struct binder_proc *proc,
goto err_dead_binder;
}
if (target_thread->transaction_stack != in_reply_to) {
- binder_user_error("binder: %d:%d got reply transaction "
- "with bad target transaction stack %d, "
+ binder_user_error("binder: %d:%d got reply transaction " \
+ "with bad target transaction stack %d, " \
"expected %d\n",
proc->pid, thread->pid,
target_thread->transaction_stack ?
@@ -1365,7 +1365,7 @@ static void binder_transaction(struct binder_proc *proc,
struct binder_ref *ref;
ref = binder_get_ref(proc, tr->target.handle);
if (ref == NULL) {
- binder_user_error("binder: %d:%d got "
+ binder_user_error("binder: %d:%d got " \
"transaction to invalid handle\n",
proc->pid, thread->pid);
return_error = BR_FAILED_REPLY;
@@ -1389,8 +1389,8 @@ static void binder_transaction(struct binder_proc *proc,
struct binder_transaction *tmp;
tmp = thread->transaction_stack;
if (tmp->to_thread != thread) {
- binder_user_error("binder: %d:%d got new "
- "transaction with bad transaction stack"
+ binder_user_error("binder: %d:%d got new " \
+ "transaction with bad transaction stack" \
", transaction %d has target %d:%d\n",
proc->pid, thread->pid, tmp->debug_id,
tmp->to_proc ? tmp->to_proc->pid : 0,
@@ -1436,7 +1436,7 @@ static void binder_transaction(struct binder_proc *proc,

if (reply)
binder_debug(BINDER_DEBUG_TRANSACTION,
- "binder: %d:%d BC_REPLY %d -> %d:%d, "
+ "binder: %d:%d BC_REPLY %d -> %d:%d, " \
"data %p-%p size %zd-%zd\n",
proc->pid, thread->pid, t->debug_id,
target_proc->pid, target_thread->pid,
@@ -1444,7 +1444,7 @@ static void binder_transaction(struct binder_proc *proc,
tr->data_size, tr->offsets_size);
else
binder_debug(BINDER_DEBUG_TRANSACTION,
- "binder: %d:%d BC_TRANSACTION %d -> "
+ "binder: %d:%d BC_TRANSACTION %d -> " \
"%d - node %d, data %p-%p size %zd-%zd\n",
proc->pid, thread->pid, t->debug_id,
target_proc->pid, target_node->debug_id,
@@ -1477,19 +1477,19 @@ static void binder_transaction(struct binder_proc *proc,
offp = (size_t *)(t->buffer->data + ALIGN(tr->data_size, sizeof(void *)));

if (copy_from_user(t->buffer->data, tr->data.ptr.buffer, tr->data_size)) {
- binder_user_error("binder: %d:%d got transaction with invalid "
+ binder_user_error("binder: %d:%d got transaction with invalid " \
"data ptr\n", proc->pid, thread->pid);
return_error = BR_FAILED_REPLY;
goto err_copy_data_failed;
}
if (copy_from_user(offp, tr->data.ptr.offsets, tr->offsets_size)) {
- binder_user_error("binder: %d:%d got transaction with invalid "
+ binder_user_error("binder: %d:%d got transaction with invalid " \
"offsets ptr\n", proc->pid, thread->pid);
return_error = BR_FAILED_REPLY;
goto err_copy_data_failed;
}
if (!IS_ALIGNED(tr->offsets_size, sizeof(size_t))) {
- binder_user_error("binder: %d:%d got transaction with "
+ binder_user_error("binder: %d:%d got transaction with " \
"invalid offsets size, %zd\n",
proc->pid, thread->pid, tr->offsets_size);
return_error = BR_FAILED_REPLY;
@@ -1501,7 +1501,7 @@ static void binder_transaction(struct binder_proc *proc,
if (*offp > t->buffer->data_size - sizeof(*fp) ||
t->buffer->data_size < sizeof(*fp) ||
!IS_ALIGNED(*offp, sizeof(void *))) {
- binder_user_error("binder: %d:%d got transaction with "
+ binder_user_error("binder: %d:%d got transaction with " \
"invalid offset, %zd\n",
proc->pid, thread->pid, *offp);
return_error = BR_FAILED_REPLY;
@@ -1523,7 +1523,7 @@ static void binder_transaction(struct binder_proc *proc,
node->accept_fds = !!(fp->flags & FLAT_BINDER_FLAG_ACCEPTS_FDS);
}
if (fp->cookie != node->cookie) {
- binder_user_error("binder: %d:%d sending u%p "
+ binder_user_error("binder: %d:%d sending u%p " \
"node %d, cookie mismatch %p != %p\n",
proc->pid, thread->pid,
fp->binder, node->debug_id,
@@ -1552,8 +1552,8 @@ static void binder_transaction(struct binder_proc *proc,
case BINDER_TYPE_WEAK_HANDLE: {
struct binder_ref *ref = binder_get_ref(proc, fp->handle);
if (ref == NULL) {
- binder_user_error("binder: %d:%d got "
- "transaction with invalid "
+ binder_user_error("binder: %d:%d got " \
+ "transaction with invalid " \
"handle, %ld\n", proc->pid,
thread->pid, fp->handle);
return_error = BR_FAILED_REPLY;
@@ -1626,7 +1626,7 @@ static void binder_transaction(struct binder_proc *proc,
} break;

default:
- binder_user_error("binder: %d:%d got transactio"
+ binder_user_error("binder: %d:%d got transactio" \
"n with invalid object type, %lx\n",
proc->pid, thread->pid, fp->type);
return_error = BR_FAILED_REPLY;
@@ -1734,9 +1734,9 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
ref = binder_get_ref_for_node(proc,
binder_context_mgr_node);
if (ref->desc != target) {
- binder_user_error("binder: %d:"
- "%d tried to acquire "
- "reference to desc 0, "
+ binder_user_error("binder: %d:" \
+ "%d tried to acquire " \
+ "reference to desc 0, " \
"got %d instead\n",
proc->pid, thread->pid,
ref->desc);
@@ -1744,7 +1744,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
} else
ref = binder_get_ref(proc, target);
if (ref == NULL) {
- binder_user_error("binder: %d:%d refcou"
+ binder_user_error("binder: %d:%d refcou" \
"nt change on invalid ref %d\n",
proc->pid, thread->pid, target);
break;
@@ -1788,7 +1788,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
ptr += sizeof(void *);
node = binder_get_node(proc, node_ptr);
if (node == NULL) {
- binder_user_error("binder: %d:%d "
+ binder_user_error("binder: %d:%d " \
"%s u%p no match\n",
proc->pid, thread->pid,
cmd == BC_INCREFS_DONE ?
@@ -1798,7 +1798,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
break;
}
if (cookie != node->cookie) {
- binder_user_error("binder: %d:%d %s u%p node %d"
+ binder_user_error("binder: %d:%d %s u%p node %d" \
" cookie mismatch %p != %p\n",
proc->pid, thread->pid,
cmd == BC_INCREFS_DONE ?
@@ -1809,8 +1809,8 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
}
if (cmd == BC_ACQUIRE_DONE) {
if (node->pending_strong_ref == 0) {
- binder_user_error("binder: %d:%d "
- "BC_ACQUIRE_DONE node %d has "
+ binder_user_error("binder: %d:%d " \
+ "BC_ACQUIRE_DONE node %d has " \
"no pending acquire request\n",
proc->pid, thread->pid,
node->debug_id);
@@ -1819,8 +1819,8 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
node->pending_strong_ref = 0;
} else {
if (node->pending_weak_ref == 0) {
- binder_user_error("binder: %d:%d "
- "BC_INCREFS_DONE node %d has "
+ binder_user_error("binder: %d:%d " \
+ "BC_INCREFS_DONE node %d has " \
"no pending increfs request\n",
proc->pid, thread->pid,
node->debug_id);
@@ -1853,14 +1853,14 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,

buffer = binder_buffer_lookup(proc, data_ptr);
if (buffer == NULL) {
- binder_user_error("binder: %d:%d "
+ binder_user_error("binder: %d:%d " \
"BC_FREE_BUFFER u%p no match\n",
proc->pid, thread->pid, data_ptr);
break;
}
if (!buffer->allow_user_free) {
- binder_user_error("binder: %d:%d "
- "BC_FREE_BUFFER u%p matched "
+ binder_user_error("binder: %d:%d " \
+ "BC_FREE_BUFFER u%p matched " \
"unreturned buffer\n",
proc->pid, thread->pid, data_ptr);
break;
@@ -1903,14 +1903,14 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
proc->pid, thread->pid);
if (thread->looper & BINDER_LOOPER_STATE_ENTERED) {
thread->looper |= BINDER_LOOPER_STATE_INVALID;
- binder_user_error("binder: %d:%d ERROR:"
- " BC_REGISTER_LOOPER called "
+ binder_user_error("binder: %d:%d ERROR:" \
+ " BC_REGISTER_LOOPER called " \
"after BC_ENTER_LOOPER\n",
proc->pid, thread->pid);
} else if (proc->requested_threads == 0) {
thread->looper |= BINDER_LOOPER_STATE_INVALID;
- binder_user_error("binder: %d:%d ERROR:"
- " BC_REGISTER_LOOPER called "
+ binder_user_error("binder: %d:%d ERROR:" \
+ " BC_REGISTER_LOOPER called " \
"without request\n",
proc->pid, thread->pid);
} else {
@@ -1925,8 +1925,8 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
proc->pid, thread->pid);
if (thread->looper & BINDER_LOOPER_STATE_REGISTERED) {
thread->looper |= BINDER_LOOPER_STATE_INVALID;
- binder_user_error("binder: %d:%d ERROR:"
- " BC_ENTER_LOOPER called after "
+ binder_user_error("binder: %d:%d ERROR:" \
+ " BC_ENTER_LOOPER called after " \
"BC_REGISTER_LOOPER\n",
proc->pid, thread->pid);
}
@@ -1954,7 +1954,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
ptr += sizeof(void *);
ref = binder_get_ref(proc, target);
if (ref == NULL) {
- binder_user_error("binder: %d:%d %s "
+ binder_user_error("binder: %d:%d %s " \
"invalid ref %d\n",
proc->pid, thread->pid,
cmd == BC_REQUEST_DEATH_NOTIFICATION ?
@@ -1975,9 +1975,9 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,

if (cmd == BC_REQUEST_DEATH_NOTIFICATION) {
if (ref->death) {
- binder_user_error("binder: %d:%"
- "d BC_REQUEST_DEATH_NOTI"
- "FICATION death notific"
+ binder_user_error("binder: %d:%" \
+ "d BC_REQUEST_DEATH_NOTI" \
+ "FICATION death notific" \
"ation already set\n",
proc->pid, thread->pid);
break;
@@ -1986,7 +1986,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
if (death == NULL) {
thread->return_error = BR_ERROR;
binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
- "binder: %d:%d "
+ "binder: %d:%d " \
"BC_REQUEST_DEATH_NOTIFICATION failed\n",
proc->pid, thread->pid);
break;
@@ -2006,19 +2006,19 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
}
} else {
if (ref->death == NULL) {
- binder_user_error("binder: %d:%"
- "d BC_CLEAR_DEATH_NOTIFI"
- "CATION death notificat"
+ binder_user_error("binder: %d:%" \
+ "d BC_CLEAR_DEATH_NOTIFI" \
+ "CATION death notificat" \
"ion not active\n",
proc->pid, thread->pid);
break;
}
death = ref->death;
if (death->cookie != cookie) {
- binder_user_error("binder: %d:%"
- "d BC_CLEAR_DEATH_NOTIFI"
- "CATION death notificat"
- "ion cookie mismatch "
+ binder_user_error("binder: %d:%" \
+ "d BC_CLEAR_DEATH_NOTIFI" \
+ "CATION death notificat" \
+ "ion cookie mismatch " \
"%p != %p\n",
proc->pid, thread->pid,
death->cookie, cookie);
@@ -2058,7 +2058,7 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
"binder: %d:%d BC_DEAD_BINDER_DONE %p found %p\n",
proc->pid, thread->pid, cookie, death);
if (death == NULL) {
- binder_user_error("binder: %d:%d BC_DEAD"
+ binder_user_error("binder: %d:%d BC_DEAD" \
"_BINDER_DONE %p not found\n",
proc->pid, thread->pid, cookie);
break;
@@ -2154,8 +2154,8 @@ retry:
if (wait_for_proc_work) {
if (!(thread->looper & (BINDER_LOOPER_STATE_REGISTERED |
BINDER_LOOPER_STATE_ENTERED))) {
- binder_user_error("binder: %d:%d ERROR: Thread waiting "
- "for process work before calling BC_REGISTER_"
+ binder_user_error("binder: %d:%d ERROR: Thread waiting " \
+ "for process work before calling BC_REGISTER_" \
"LOOPER or BC_ENTER_LOOPER (state %x)\n",
proc->pid, thread->pid, thread->looper);
wait_event_interruptible(binder_user_error_wait,
@@ -2366,7 +2366,7 @@ retry:

binder_stat_br(proc, thread, cmd);
binder_debug(BINDER_DEBUG_TRANSACTION,
- "binder: %d:%d %s %d %d:%d, cmd %d"
+ "binder: %d:%d %s %d %d:%d, cmd %d" \
"size %zd-%zd ptr %p-%p\n",
proc->pid, thread->pid,
(cmd == BR_TRANSACTION) ? "BR_TRANSACTION" :
@@ -2619,7 +2619,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
}
if (uid_valid(binder_context_mgr_uid)) {
if (!uid_eq(binder_context_mgr_uid, current->cred->euid)) {
- pr_err("binder: BINDER_SET_"
+ pr_err("binder: BINDER_SET_" \
"CONTEXT_MGR bad uid %d != %d\n",
from_kuid(&init_user_ns, current->cred->euid),
from_kuid(&init_user_ns, binder_context_mgr_uid));
@@ -2946,7 +2946,7 @@ static void binder_deferred_release(struct binder_proc *proc)
if (t) {
t->buffer = NULL;
buffer->transaction = NULL;
- pr_err("binder: release proc %d, "
+ pr_err("binder: release proc %d, " \
"transaction %d, not freed\n",
proc->pid, t->debug_id);
/*BUG();*/
--
1.7.12.4


2012-10-20 22:33:45

by Ken O'Brien

[permalink] [raw]
Subject: [PATCH 2/2] staging: android: binder.c: checkpatch.pl

Fixed 3 instances of "WARNING: static const char * array should probably be static const char * const" warnings from checkpatch

Signed-off-by: Ken O'Brien <[email protected]>
---
drivers/staging/android/binder.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index 8607628..b17f9ba 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -3218,7 +3218,7 @@ static void print_binder_proc(struct seq_file *m,
m->count = start_pos;
}

-static const char *binder_return_strings[] = {
+static const char *const binder_return_strings[] = {
"BR_ERROR",
"BR_OK",
"BR_TRANSACTION",
@@ -3239,7 +3239,7 @@ static const char *binder_return_strings[] = {
"BR_FAILED_REPLY"
};

-static const char *binder_command_strings[] = {
+static const char *const binder_command_strings[] = {
"BC_TRANSACTION",
"BC_REPLY",
"BC_ACQUIRE_RESULT",
@@ -3259,7 +3259,7 @@ static const char *binder_command_strings[] = {
"BC_DEAD_BINDER_DONE"
};

-static const char *binder_objstat_strings[] = {
+static const char *const binder_objstat_strings[] = {
"proc",
"thread",
"node",
--
1.7.12.4

2012-10-21 01:05:15

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: android: checkpatch.pl fixes

On Sat, 2012-10-20 at 23:33 +0100, Ken O'Brien wrote:
> Fixed all instances of strings spanning multiple lines from checkpatch.pl.
[]
> diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
[]
> @@ -556,7 +556,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
> goto free_range;
>
> if (vma == NULL) {
> - pr_err("binder: %d: binder_alloc_buf failed to "
> + pr_err("binder: %d: binder_alloc_buf failed to " \
> "map pages in userspace, no vma\n", proc->pid);

Hi Ken.

Nice try, but the "right" way to do this is to coalesce formats like:

pr_err("binder: %d: binder_alloc_buf failed to map pages in userspace, no vma\n",
proc->pid);

and ignore 80 column line lengths for these coalesced formats.

An even better way is to add

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

before any #include and change the format to:

pr_err("%d: binder_alloc_buf failed to map pages in userspace, no vma\n",
proc->pid);

2012-10-21 02:05:31

by Cruz Julian Bishop

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: android: checkpatch.pl fixes

On Sat, 2012-10-20 at 18:05 -0700, Joe Perches wrote:
> On Sat, 2012-10-20 at 23:33 +0100, Ken O'Brien wrote:
> > Fixed all instances of strings spanning multiple lines from checkpatch.pl.
> []
> > diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
> []
> > @@ -556,7 +556,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
> > goto free_range;
> >
> > if (vma == NULL) {
> > - pr_err("binder: %d: binder_alloc_buf failed to "
> > + pr_err("binder: %d: binder_alloc_buf failed to " \
> > "map pages in userspace, no vma\n", proc->pid);
>
> Hi Ken.
>
> Nice try, but the "right" way to do this is to coalesce formats like:
>
> pr_err("binder: %d: binder_alloc_buf failed to map pages in userspace, no vma\n",
> proc->pid);
>
> and ignore 80 column line lengths for these coalesced formats.

Going off that, is there currently any way to insert, say,
a comment that filters out the next line for checkpatch
errors?

For example,

/* checkpatch_ignore_(rulename) */
(Long line that can't be broken here)


>
> An even better way is to add
>
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>
> before any #include and change the format to:
>
> pr_err("%d: binder_alloc_buf failed to map pages in userspace, no vma\n",
> proc->pid);
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2012-10-21 02:09:08

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: android: checkpatch.pl fixes

On Sun, 2012-10-21 at 12:05 +1000, Cruz Julian Bishop wrote:
> is there currently any way to insert, say,
> a comment that filters out the next line for checkpatch
> errors?
>
> For example,
>
> /* checkpatch_ignore_(rulename) */
> (Long line that can't be broken here)

Nope. checkpatch is a stupid little tool.
It has its place, but it's a very limited one.

If you want to extend it, knock your self out...

2012-10-22 09:37:50

by David Howells

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: android: checkpatch.pl fixes

Joe Perches <[email protected]> wrote:

> On Sat, 2012-10-20 at 23:33 +0100, Ken O'Brien wrote:
> ...
> > - pr_err("binder: %d: binder_alloc_buf failed to "
> > + pr_err("binder: %d: binder_alloc_buf failed to " \
> > "map pages in userspace, no vma\n", proc->pid);
> ...
> Nice try, but the "right" way to do this is to coalesce formats like:
>
> pr_err("binder: %d: binder_alloc_buf failed to map pages in userspace, no vma\n",
> proc->pid);

Surely the right way is to fix _checkpatch_ to see ["]\n\s*["] and merge the
lines before checking them? We shouldn't have to fix up the source in either
of these fashions just because checkpatch is broken.

David

2012-10-22 12:15:12

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: android: checkpatch.pl fixes

waOn Mon, 2012-10-22 at 10:37 +0100, David Howells wrote:
> Joe Perches <[email protected]> wrote:
>
> > On Sat, 2012-10-20 at 23:33 +0100, Ken O'Brien wrote:
> > ...
> > > - pr_err("binder: %d: binder_alloc_buf failed to "
> > > + pr_err("binder: %d: binder_alloc_buf failed to " \
> > > "map pages in userspace, no vma\n", proc->pid);
> > ...
> > Nice try, but the "right" way to do this is to coalesce formats like:
> >
> > pr_err("binder: %d: binder_alloc_buf failed to map pages in userspace, no vma\n",
> > proc->pid);
>
> Surely the right way is to fix _checkpatch_ to see ["]\n\s*["] and merge the
> lines before checking them? We shouldn't have to fix up the source in either
> of these fashions just because checkpatch is broken.

checkpatch is stupid, but it's not broken here.

Formats should be coalesced into a single line to make
grepping the source for dmesg output easier.

More likely checkpatch could be changed to bleat yet
another warning like

"line continuation used outside macro definition"

2012-10-22 13:03:21

by Peter Hurley

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: android: checkpatch.pl fixes

On Mon, 2012-10-22 at 05:15 -0700, Joe Perches wrote:
> waOn Mon, 2012-10-22 at 10:37 +0100, David Howells wrote:
> > Joe Perches <[email protected]> wrote:
> >
> > > On Sat, 2012-10-20 at 23:33 +0100, Ken O'Brien wrote:
> > > ...
> > > > - pr_err("binder: %d: binder_alloc_buf failed to "
> > > > + pr_err("binder: %d: binder_alloc_buf failed to " \
> > > > "map pages in userspace, no vma\n", proc->pid);
> > > ...
> > > Nice try, but the "right" way to do this is to coalesce formats like:
> > >
> > > pr_err("binder: %d: binder_alloc_buf failed to map pages in userspace, no vma\n",
> > > proc->pid);
> >
> > Surely the right way is to fix _checkpatch_ to see ["]\n\s*["] and merge the
> > lines before checking them? We shouldn't have to fix up the source in either
> > of these fashions just because checkpatch is broken.
>
> checkpatch is stupid, but it's not broken here.
>
> Formats should be coalesced into a single line to make
> grepping the source for dmesg output easier.

But MODULE_PARM_DESC() multi-line strings are ok, right?

grep - 'MODULE_PARM_DESC.*"$' drivers

shows it's in widespread use.

> More likely checkpatch could be changed to bleat yet
> another warning like
>
> "line continuation used outside macro definition"

2012-10-22 13:16:45

by Joe Perches

[permalink] [raw]
Subject: [PATCH] checkpatch: Warn on unnecessary line continuations

Line continuations are not normal kernel style.
Bleat a warning when used outside of a macro definition.

Signed-off-by: Joe Perches <[email protected]>
---

On Mon, 2012-10-22 at 09:02 -0400, Peter Hurley wrote:
> On Mon, 2012-10-22 at 05:15 -0700, Joe Perches wrote:
> > waOn Mon, 2012-10-22 at 10:37 +0100, David Howells wrote:
> > > Joe Perches <[email protected]> wrote:
> > >
> > > > On Sat, 2012-10-20 at 23:33 +0100, Ken O'Brien wrote:
> > > > ...
> > > > > - pr_err("binder: %d: binder_alloc_buf failed to "
> > > > > + pr_err("binder: %d: binder_alloc_buf failed to " \
> > > > > "map pages in userspace, no vma\n", proc->pid);
> > > > ...
> > > > Nice try, but the "right" way to do this is to coalesce formats like:
> > > >
> > > > pr_err("binder: %d: binder_alloc_buf failed to map pages in userspace, no vma\n",
> > > > proc->pid);
> > >
> > > Surely the right way is to fix _checkpatch_ to see ["]\n\s*["] and merge the
> > > lines before checking them? We shouldn't have to fix up the source in either
> > > of these fashions just because checkpatch is broken.
> >
> > checkpatch is stupid, but it's not broken here.
> >
> > Formats should be coalesced into a single line to make
> > grepping the source for dmesg output easier.
>
> But MODULE_PARM_DESC() multi-line strings are ok, right?
>

I don't think so.
Maybe this patch:

scripts/checkpatch.pl | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 21a9f5d..d4ea29a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3011,6 +3011,14 @@ sub process {
"Macros with complex values should be enclosed in parenthesis\n" . "$herectx");
}
}
+
+# check for line continuations outside of #defines
+
+ } else {
+ if ($line =~ /^\+.*\\$/) {
+ WARN("LINE_CONTINUATIONS",
+ "Avoid unnecessary line continuations\n" . $herecurr);
+ }
}

# do {} while (0) macro tests:

2012-10-22 16:45:18

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH] checkpatch: Warn on unnecessary line continuations

On Mon, 2012-10-22 at 06:16 -0700, Joe Perches wrote:
> Line continuations are not normal kernel style.
> Bleat a warning when used outside of a macro definition.
[]
> Maybe this patch:

bad patch, please ignore.

2012-10-22 20:03:14

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: android: checkpatch.pl fixes

On Sat, Oct 20, 2012 at 11:33:19PM +0100, Ken O'Brien wrote:
> Fixed all instances of strings spanning multiple lines from checkpatch.pl.
>
> Signed-off-by: Ken O'Brien <[email protected]>

Why did you send me 3 copies of this series? Which one should I use?

Based on this thread, I'll throw away all 3 copies, care to try again?

thanks,

greg k-h

2012-10-24 14:48:40

by Ken O'Brien

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: android: checkpatch.pl fixes

I'll try again. With regard to the 3 copies, that was due a
malfunction of my mail program. Apologies.

On Mon, Oct 22, 2012 at 9:03 PM, Greg KH <[email protected]> wrote:
> On Sat, Oct 20, 2012 at 11:33:19PM +0100, Ken O'Brien wrote:
>> Fixed all instances of strings spanning multiple lines from checkpatch.pl.
>>
>> Signed-off-by: Ken O'Brien <[email protected]>
>
> Why did you send me 3 copies of this series? Which one should I use?
>
> Based on this thread, I'll throw away all 3 copies, care to try again?
>
> thanks,
>
> greg k-h



--
Ken O'Brien
PhD Researcher
Simulation Science and Extreme Events Cluster,
3B1, UCD CASL,
8 Belfield Business Park,
Dublin 4,
Ireland.

2012-10-28 04:46:52

by Joe Perches

[permalink] [raw]
Subject: [PATCH v2] checkpatch: Warn on unnecessary line continuations

When the previous line is not a line continuation and the
current line has a line continuation but is not a #define,
emit a warning.

Signed-off-by: Joe Perches <[email protected]>
---
scripts/checkpatch.pl | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f18750e..d4f61a6 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3013,6 +3013,15 @@ sub process {
"Macros with complex values should be enclosed in parenthesis\n" . "$herectx");
}
}
+
+# check for line continuations outside of #defines
+
+ } else {
+ if ($prevline !~ /^..*\\$/ &&
+ $line =~ /^\+.*\\$/) {
+ WARN("LINE_CONTINUATIONS",
+ "Avoid unnecessary line continuations\n" . $herecurr);
+ }
}

# do {} while (0) macro tests: