[OPW,kernel] Solving several checkpatch.pl warnings 'line over 80 characters' in binder.c
diff mbox

Message ID 1381170185-3661-1-git-send-email-maria.solher@gmail.com
State Changes Requested
Headers show

Commit Message

Maria Soler Heredia Oct. 7, 2013, 6:23 p.m. UTC
---
 drivers/staging/android/binder.c | 170 +++++++++++++++++++++++++--------------
 1 file changed, 108 insertions(+), 62 deletions(-)

Comments

Josh Triplett Oct. 7, 2013, 7:18 p.m. UTC | #1
On Mon, Oct 07, 2013 at 08:23:05PM +0200, Maria Soler Heredia wrote:

You need a Signed-off-by.

> ---
>  drivers/staging/android/binder.c | 170 +++++++++++++++++++++++++--------------
>  1 file changed, 108 insertions(+), 62 deletions(-)
> 
> diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
> index 98ac020..80d5c5b 100644
> --- a/drivers/staging/android/binder.c
> +++ b/drivers/staging/android/binder.c
> @@ -1189,9 +1189,9 @@ static void binder_send_failed_reply(struct binder_transaction *t,
>  			}
>  			if (target_thread->return_error == BR_OK) {
>  				binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
> -					     "send failed reply for transaction %d to %d:%d\n",
> -					      t->debug_id, target_thread->proc->pid,
> -					      target_thread->pid);
> +					"send failed reply for transaction %d to %d:%d\n",
> +					t->debug_id, target_thread->proc->pid,
> +					target_thread->pid);
>  
>  				binder_pop_transaction(target_thread, t);
>  				target_thread->return_error = error_code;
> @@ -1239,7 +1239,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
>  	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 *)));

You don't need to indent continuations that deeply.  Just indent one or two tabs
deeper than the line you're continuing.  (After an assignment like this,
two often looks clearer.)

> @@ -1257,7 +1258,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
>  		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);

For this one, just split the declaration and initializer into a
declaration and assignment: first declare node, then assign to it on a
separate line.

> @@ -1472,7 +1474,8 @@ static void binder_transaction(struct binder_proc *proc,
>  	if (target_node)
>  		binder_inc_node(target_node, 1, 0, NULL);
>  
> -	offp = (size_t *)(t->buffer->data + ALIGN(tr->data_size, sizeof(void *)));
> +	offp = (size_t *)(t->buffer->data +
> +					ALIGN(tr->data_size, sizeof(void *)));

Same as before: just one or two tabs.

> @@ -1508,15 +1511,19 @@ static void binder_transaction(struct binder_proc *proc,
>  		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);

Split into a declaration and assignment instead.

>  			if (node == NULL) {
> -				node = binder_new_node(proc, fp->binder, fp->cookie);
> +				node = binder_new_node(proc, fp->binder,
> +								fp->cookie);

Just one or two tabs.

> @@ -1610,7 +1621,8 @@ static void binder_transaction(struct binder_proc *proc,
>  				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);

Just one or two tabs.

> @@ -1823,7 +1836,8 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
>  				     "%d:%d %s node %d ls %d lw %d\n",
>  				     proc->pid, thread->pid,
>  				     cmd == BC_INCREFS_DONE ? "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE",

You need to break this line as well.  Just don't break it inside one of
the string constants.

> @@ -1996,7 +2011,8 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
>  				}
>  				ref->death = NULL;
>  				if (list_empty(&death->work.entry)) {
> -					death->work.type = BINDER_WORK_CLEAR_DEATH_NOTIFICATION;
> +					death->work.type =
> +					   BINDER_WORK_CLEAR_DEATH_NOTIFICATION;

No, don't start indenting with spaces rather than a tab just to make the
line short enough.  This one just seems unfixable without reorganizing
this function; leave it as is.

> @@ -2018,7 +2034,9 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
>  
>  			ptr += sizeof(void *);
>  			list_for_each_entry(w, &proc->delivered_death, entry) {
> -				struct binder_ref_death *tmp_death = container_of(w, struct binder_ref_death, work);
> +				struct binder_ref_death *tmp_death =
> +					container_of(w, struct binder_ref_death,
> +							work);

Split into declaration and assignment.

> @@ -2034,7 +2052,8 @@ int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
>  			}
>  
>  			list_del_init(&death->work.entry);
> -			if (death->work.type == BINDER_WORK_DEAD_BINDER_AND_CLEAR) {
> +			if (death->work.type ==
> +					    BINDER_WORK_DEAD_BINDER_AND_CLEAR) {

This one really doesn't seem like an improvement; I'd leave it long.

> @@ -2102,7 +2121,8 @@ retry:
>  
>  	if (thread->return_error != BR_OK && ptr < end) {
>  		if (thread->return_error2 != BR_OK) {
> -			if (put_user(thread->return_error2, (uint32_t __user *)ptr))
> +			if (put_user(thread->return_error2,
> +							(uint32_t __user *)ptr))

I'd suggest lining up the arguments here.

>  				return -EFAULT;
>  			ptr += sizeof(uint32_t);
>  			binder_stat_br(proc, thread, thread->return_error2);
> @@ -2141,13 +2161,15 @@ retry:
>  			if (!binder_has_proc_work(proc, thread))
>  				ret = -EAGAIN;
>  		} else
> -			ret = wait_event_freezable_exclusive(proc->wait, binder_has_proc_work(proc, thread));
> +			ret = wait_event_freezable_exclusive(proc->wait,
> +					    binder_has_proc_work(proc, thread));

Just one or two tabs.

>  	} else {
>  		if (non_block) {
>  			if (!binder_has_thread_work(thread))
>  				ret = -EAGAIN;
>  		} else
> -			ret = wait_event_freezable(thread->wait, binder_has_thread_work(thread));
> +			ret = wait_event_freezable(thread->wait,
> +						binder_has_thread_work(thread));

Just one or two tabs.

> @@ -2198,11 +2223,14 @@ retry:
>  			binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE);
>  		} break;
>  		case BINDER_WORK_NODE: {
> -			struct binder_node *node = container_of(w, struct binder_node, work);
> +			struct binder_node *node = container_of(w,
> +						      struct binder_node, work);

Separate declaration and assignment.

> @@ -2584,7 +2615,10 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
>  			     bwr.write_buffer, bwr.read_size, bwr.read_buffer);
>  
>  		if (bwr.write_size > 0) {
> -			ret = binder_thread_write(proc, thread, (void __user *)bwr.write_buffer, bwr.write_size, &bwr.write_consumed);
> +			ret = binder_thread_write(proc, thread,
> +						(void __user *)bwr.write_buffer,
> +						bwr.write_size,
> +						&bwr.write_consumed);

Just one or two tabs.

> @@ -2657,7 +2697,8 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
>  			ret = -EINVAL;
>  			goto err;
>  		}
> -		if (put_user(BINDER_CURRENT_PROTOCOL_VERSION, &((struct binder_version *)ubuf)->protocol_version)) {
> +		if (put_user(BINDER_CURRENT_PROTOCOL_VERSION, &
> +			((struct binder_version *)ubuf)->protocol_version)) {

Never break between a unary operator like & and its operand; put the &
on the next line with the operand.

> @@ -2856,7 +2901,8 @@ static void binder_deferred_flush(struct binder_proc *proc)
>  	struct rb_node *n;
>  	int wake_count = 0;
>  	for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) {
> -		struct binder_thread *thread = rb_entry(n, struct binder_thread, rb_node);
> +		struct binder_thread *thread = rb_entry(n, struct binder_thread,
> +				rb_node);

Separate declaration and assignment.

- Josh Triplett
Maria Soler Heredia Oct. 8, 2013, 7:23 a.m. UTC | #2
Thanks for the feedback. I'll fix it and resend.

María.


On 7 October 2013 21:18, Josh Triplett <josh@joshtriplett.org> wrote:

> On Mon, Oct 07, 2013 at 08:23:05PM +0200, Maria Soler Heredia wrote:
>
> You need a Signed-off-by.
>
> > ---
> >  drivers/staging/android/binder.c | 170
> +++++++++++++++++++++++++--------------
> >  1 file changed, 108 insertions(+), 62 deletions(-)
> >
> > diff --git a/drivers/staging/android/binder.c
> b/drivers/staging/android/binder.c
> > index 98ac020..80d5c5b 100644
> > --- a/drivers/staging/android/binder.c
> > +++ b/drivers/staging/android/binder.c
> > @@ -1189,9 +1189,9 @@ static void binder_send_failed_reply(struct
> binder_transaction *t,
> >                       }
> >                       if (target_thread->return_error == BR_OK) {
> >
> binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
> > -                                          "send failed reply for
> transaction %d to %d:%d\n",
> > -                                           t->debug_id,
> target_thread->proc->pid,
> > -                                           target_thread->pid);
> > +                                     "send failed reply for transaction
> %d to %d:%d\n",
> > +                                     t->debug_id,
> target_thread->proc->pid,
> > +                                     target_thread->pid);
> >
> >                               binder_pop_transaction(target_thread, t);
> >                               target_thread->return_error = error_code;
> > @@ -1239,7 +1239,8 @@ static void
> binder_transaction_buffer_release(struct binder_proc *proc,
> >       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
> *)));
>
> You don't need to indent continuations that deeply.  Just indent one or
> two tabs
> deeper than the line you're continuing.  (After an assignment like this,
> two often looks clearer.)
>
> > @@ -1257,7 +1258,8 @@ static void
> binder_transaction_buffer_release(struct binder_proc *proc,
> >               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);
>
> For this one, just split the declaration and initializer into a
> declaration and assignment: first declare node, then assign to it on a
> separate line.
>
> > @@ -1472,7 +1474,8 @@ static void binder_transaction(struct binder_proc
> *proc,
> >       if (target_node)
> >               binder_inc_node(target_node, 1, 0, NULL);
> >
> > -     offp = (size_t *)(t->buffer->data + ALIGN(tr->data_size,
> sizeof(void *)));
> > +     offp = (size_t *)(t->buffer->data +
> > +                                     ALIGN(tr->data_size, sizeof(void
> *)));
>
> Same as before: just one or two tabs.
>
> > @@ -1508,15 +1511,19 @@ static void binder_transaction(struct
> binder_proc *proc,
> >               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);
>
> Split into a declaration and assignment instead.
>
> >                       if (node == NULL) {
> > -                             node = binder_new_node(proc, fp->binder,
> fp->cookie);
> > +                             node = binder_new_node(proc, fp->binder,
> > +
> fp->cookie);
>
> Just one or two tabs.
>
> > @@ -1610,7 +1621,8 @@ static void binder_transaction(struct binder_proc
> *proc,
> >                               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);
>
> Just one or two tabs.
>
> > @@ -1823,7 +1836,8 @@ int binder_thread_write(struct binder_proc *proc,
> struct binder_thread *thread,
> >                                    "%d:%d %s node %d ls %d lw %d\n",
> >                                    proc->pid, thread->pid,
> >                                    cmd == BC_INCREFS_DONE ?
> "BC_INCREFS_DONE" : "BC_ACQUIRE_DONE",
>
> You need to break this line as well.  Just don't break it inside one of
> the string constants.
>
> > @@ -1996,7 +2011,8 @@ int binder_thread_write(struct binder_proc *proc,
> struct binder_thread *thread,
> >                               }
> >                               ref->death = NULL;
> >                               if (list_empty(&death->work.entry)) {
> > -                                     death->work.type =
> BINDER_WORK_CLEAR_DEATH_NOTIFICATION;
> > +                                     death->work.type =
> > +
>  BINDER_WORK_CLEAR_DEATH_NOTIFICATION;
>
> No, don't start indenting with spaces rather than a tab just to make the
> line short enough.  This one just seems unfixable without reorganizing
> this function; leave it as is.
>
> > @@ -2018,7 +2034,9 @@ int binder_thread_write(struct binder_proc *proc,
> struct binder_thread *thread,
> >
> >                       ptr += sizeof(void *);
> >                       list_for_each_entry(w, &proc->delivered_death,
> entry) {
> > -                             struct binder_ref_death *tmp_death =
> container_of(w, struct binder_ref_death, work);
> > +                             struct binder_ref_death *tmp_death =
> > +                                     container_of(w, struct
> binder_ref_death,
> > +                                                     work);
>
> Split into declaration and assignment.
>
> > @@ -2034,7 +2052,8 @@ int binder_thread_write(struct binder_proc *proc,
> struct binder_thread *thread,
> >                       }
> >
> >                       list_del_init(&death->work.entry);
> > -                     if (death->work.type ==
> BINDER_WORK_DEAD_BINDER_AND_CLEAR) {
> > +                     if (death->work.type ==
> > +
> BINDER_WORK_DEAD_BINDER_AND_CLEAR) {
>
> This one really doesn't seem like an improvement; I'd leave it long.
>
> > @@ -2102,7 +2121,8 @@ retry:
> >
> >       if (thread->return_error != BR_OK && ptr < end) {
> >               if (thread->return_error2 != BR_OK) {
> > -                     if (put_user(thread->return_error2, (uint32_t
> __user *)ptr))
> > +                     if (put_user(thread->return_error2,
> > +                                                     (uint32_t __user
> *)ptr))
>
> I'd suggest lining up the arguments here.
>
> >                               return -EFAULT;
> >                       ptr += sizeof(uint32_t);
> >                       binder_stat_br(proc, thread,
> thread->return_error2);
> > @@ -2141,13 +2161,15 @@ retry:
> >                       if (!binder_has_proc_work(proc, thread))
> >                               ret = -EAGAIN;
> >               } else
> > -                     ret = wait_event_freezable_exclusive(proc->wait,
> binder_has_proc_work(proc, thread));
> > +                     ret = wait_event_freezable_exclusive(proc->wait,
> > +                                         binder_has_proc_work(proc,
> thread));
>
> Just one or two tabs.
>
> >       } else {
> >               if (non_block) {
> >                       if (!binder_has_thread_work(thread))
> >                               ret = -EAGAIN;
> >               } else
> > -                     ret = wait_event_freezable(thread->wait,
> binder_has_thread_work(thread));
> > +                     ret = wait_event_freezable(thread->wait,
> > +
> binder_has_thread_work(thread));
>
> Just one or two tabs.
>
> > @@ -2198,11 +2223,14 @@ retry:
> >
> binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE);
> >               } break;
> >               case BINDER_WORK_NODE: {
> > -                     struct binder_node *node = container_of(w, struct
> binder_node, work);
> > +                     struct binder_node *node = container_of(w,
> > +                                                   struct binder_node,
> work);
>
> Separate declaration and assignment.
>
> > @@ -2584,7 +2615,10 @@ static long binder_ioctl(struct file *filp,
> unsigned int cmd, unsigned long arg)
> >                            bwr.write_buffer, bwr.read_size,
> bwr.read_buffer);
> >
> >               if (bwr.write_size > 0) {
> > -                     ret = binder_thread_write(proc, thread, (void
> __user *)bwr.write_buffer, bwr.write_size, &bwr.write_consumed);
> > +                     ret = binder_thread_write(proc, thread,
> > +                                             (void __user
> *)bwr.write_buffer,
> > +                                             bwr.write_size,
> > +                                             &bwr.write_consumed);
>
> Just one or two tabs.
>
> > @@ -2657,7 +2697,8 @@ static long binder_ioctl(struct file *filp,
> unsigned int cmd, unsigned long arg)
> >                       ret = -EINVAL;
> >                       goto err;
> >               }
> > -             if (put_user(BINDER_CURRENT_PROTOCOL_VERSION, &((struct
> binder_version *)ubuf)->protocol_version)) {
> > +             if (put_user(BINDER_CURRENT_PROTOCOL_VERSION, &
> > +                     ((struct binder_version
> *)ubuf)->protocol_version)) {
>
> Never break between a unary operator like & and its operand; put the &
> on the next line with the operand.
>
> > @@ -2856,7 +2901,8 @@ static void binder_deferred_flush(struct
> binder_proc *proc)
> >       struct rb_node *n;
> >       int wake_count = 0;
> >       for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) {
> > -             struct binder_thread *thread = rb_entry(n, struct
> binder_thread, rb_node);
> > +             struct binder_thread *thread = rb_entry(n, struct
> binder_thread,
> > +                             rb_node);
>
> Separate declaration and assignment.
>
> - Josh Triplett
>
Maria Soler Heredia Oct. 8, 2013, 7:44 a.m. UTC | #3
By the way:

What do you mean by

> > @@ -2102,7 +2121,8 @@ retry:
> >
> >       if (thread->return_error != BR_OK && ptr < end) {
> >               if (thread->return_error2 != BR_OK) {
> > -                     if (put_user(thread->return_error2, (uint32_t
__user *)ptr))
> > +                     if (put_user(thread->return_error2,
> > +                                                     (uint32_t __user
*)ptr))
> I'd suggest lining up the arguments here.

Something like this? They are not "lined up" but it is the best I think I
can do with tabs and no spaces.
+                     if (put_user(thread->return_error2,
+                             (uint32_t __user *)ptr))

Should I use spaces instead and leave it like this?
+                     if (put_user(thread->return_error2,
+                         (uint32_t __user *)ptr))

And about the unary operator, I missed the coma and I thought it was an
and. It makes more sense now.

Thanks again. Really useful.
María.
Josh Triplett Oct. 8, 2013, 4:23 p.m. UTC | #4
On Tue, Oct 08, 2013 at 09:44:40AM +0200, María Soler Heredia wrote:
> By the way:
> 
> What do you mean by
> 
> > > @@ -2102,7 +2121,8 @@ retry:
> > >
> > >       if (thread->return_error != BR_OK && ptr < end) {
> > >               if (thread->return_error2 != BR_OK) {
> > > -                     if (put_user(thread->return_error2, (uint32_t
> __user *)ptr))
> > > +                     if (put_user(thread->return_error2,
> > > +                                                     (uint32_t __user
> *)ptr))
> > I'd suggest lining up the arguments here.
> 
> Something like this? They are not "lined up" but it is the best I think I
> can do with tabs and no spaces.
> +                     if (put_user(thread->return_error2,
> +                             (uint32_t __user *)ptr))

Either that, or add a few spaces after the tab to line up the (uint32_t
under the thread-> (with the open paren on the second line under the 't'
of "thread" on the first line).

Greg, which would you prefer?

- Josh Triplett
Greg KH Oct. 8, 2013, 9:35 p.m. UTC | #5
On Tue, Oct 08, 2013 at 09:23:06AM -0700, Josh Triplett wrote:
> On Tue, Oct 08, 2013 at 09:44:40AM +0200, María Soler Heredia wrote:
> > By the way:
> > 
> > What do you mean by
> > 
> > > > @@ -2102,7 +2121,8 @@ retry:
> > > >
> > > >       if (thread->return_error != BR_OK && ptr < end) {
> > > >               if (thread->return_error2 != BR_OK) {
> > > > -                     if (put_user(thread->return_error2, (uint32_t
> > __user *)ptr))
> > > > +                     if (put_user(thread->return_error2,
> > > > +                                                     (uint32_t __user
> > *)ptr))
> > > I'd suggest lining up the arguments here.
> > 
> > Something like this? They are not "lined up" but it is the best I think I
> > can do with tabs and no spaces.
> > +                     if (put_user(thread->return_error2,
> > +                             (uint32_t __user *)ptr))
> 
> Either that, or add a few spaces after the tab to line up the (uint32_t
> under the thread-> (with the open paren on the second line under the 't'
> of "thread" on the first line).
> 
> Greg, which would you prefer?

My personal style is:
			if (put_user(thread->return_error2,
				     (uint32_t __user *)ptr))

But I really don't care either way when people are cleaning up code, as
it doesn't matter and both are readable just fine.

thanks,

greg k-h
Josh Triplett Oct. 8, 2013, 10 p.m. UTC | #6
On Tue, Oct 08, 2013 at 02:35:24PM -0700, Greg KH wrote:
> On Tue, Oct 08, 2013 at 09:23:06AM -0700, Josh Triplett wrote:
> > On Tue, Oct 08, 2013 at 09:44:40AM +0200, María Soler Heredia wrote:
> > > By the way:
> > > 
> > > What do you mean by
> > > 
> > > > > @@ -2102,7 +2121,8 @@ retry:
> > > > >
> > > > >       if (thread->return_error != BR_OK && ptr < end) {
> > > > >               if (thread->return_error2 != BR_OK) {
> > > > > -                     if (put_user(thread->return_error2, (uint32_t
> > > __user *)ptr))
> > > > > +                     if (put_user(thread->return_error2,
> > > > > +                                                     (uint32_t __user
> > > *)ptr))
> > > > I'd suggest lining up the arguments here.
> > > 
> > > Something like this? They are not "lined up" but it is the best I think I
> > > can do with tabs and no spaces.
> > > +                     if (put_user(thread->return_error2,
> > > +                             (uint32_t __user *)ptr))
> > 
> > Either that, or add a few spaces after the tab to line up the (uint32_t
> > under the thread-> (with the open paren on the second line under the 't'
> > of "thread" on the first line).
> > 
> > Greg, which would you prefer?
> 
> My personal style is:
> 			if (put_user(thread->return_error2,
> 				     (uint32_t __user *)ptr))
> 
> But I really don't care either way when people are cleaning up code, as
> it doesn't matter and both are readable just fine.

That'd be my preference as well, though both would be an improvement.

- Josh Triplett

Patch
diff mbox

diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index 98ac020..80d5c5b 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -1189,9 +1189,9 @@  static void binder_send_failed_reply(struct binder_transaction *t,
 			}
 			if (target_thread->return_error == BR_OK) {
 				binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,
-					     "send failed reply for transaction %d to %d:%d\n",
-					      t->debug_id, target_thread->proc->pid,
-					      target_thread->pid);
+					"send failed reply for transaction %d to %d:%d\n",
+					t->debug_id, target_thread->proc->pid,
+					target_thread->pid);
 
 				binder_pop_transaction(target_thread, t);
 				target_thread->return_error = error_code;
@@ -1239,7 +1239,8 @@  static void binder_transaction_buffer_release(struct binder_proc *proc,
 	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
@@ -1257,7 +1258,8 @@  static void binder_transaction_buffer_release(struct binder_proc *proc,
 		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) {
 				pr_err("transaction release %d bad node %p\n",
 					debug_id, fp->binder);
@@ -1277,8 +1279,8 @@  static void binder_transaction_buffer_release(struct binder_proc *proc,
 				break;
 			}
 			binder_debug(BINDER_DEBUG_TRANSACTION,
-				     "        ref %d desc %d (node %d)\n",
-				     ref->debug_id, ref->desc, ref->node->debug_id);
+				"        ref %d desc %d (node %d)\n",
+				ref->debug_id, ref->desc, ref->node->debug_id);
 			binder_dec_ref(ref, fp->type == BINDER_TYPE_HANDLE);
 		} break;
 
@@ -1472,7 +1474,8 @@  static void binder_transaction(struct binder_proc *proc,
 	if (target_node)
 		binder_inc_node(target_node, 1, 0, NULL);
 
-	offp = (size_t *)(t->buffer->data + ALIGN(tr->data_size, sizeof(void *)));
+	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("%d:%d got transaction with invalid data ptr\n",
@@ -1508,15 +1511,19 @@  static void binder_transaction(struct binder_proc *proc,
 		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("%d:%d sending u%p node %d, cookie mismatch %p != %p\n",
@@ -1561,12 +1568,13 @@  static void binder_transaction(struct binder_proc *proc,
 					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);
 				trace_binder_transaction_ref_to_node(t, ref);
 				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);
@@ -1575,13 +1583,15 @@  static void binder_transaction(struct binder_proc *proc,
 					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);
 				trace_binder_transaction_ref_to_ref(t, ref,
 								    new_ref);
 				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;
 
@@ -1592,7 +1602,8 @@  static void binder_transaction(struct binder_proc *proc,
 			if (reply) {
 				if (!(in_reply_to->flags & TF_ACCEPT_FDS)) {
 					binder_user_error("%d:%d got reply with fd, %d, but target does not allow fds\n",
-						proc->pid, thread->pid, fp->handle);
+						proc->pid, thread->pid,
+						fp->handle);
 					return_error = BR_FAILED_REPLY;
 					goto err_fd_not_allowed;
 				}
@@ -1610,7 +1621,8 @@  static void binder_transaction(struct binder_proc *proc,
 				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;
@@ -1619,7 +1631,8 @@  static void binder_transaction(struct binder_proc *proc,
 			task_fd_install(target_proc, target_fd, file);
 			trace_binder_transaction_fd(t, fp->handle, target_fd);
 			binder_debug(BINDER_DEBUG_TRANSACTION,
-				     "        fd %d -> %d\n", fp->handle, target_fd);
+				     "        fd %d -> %d\n", fp->handle,
+				     target_fd);
 			/* TODO: fput? */
 			fp->handle = target_fd;
 		} break;
@@ -1823,7 +1836,8 @@  int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
 				     "%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);
+				     node->debug_id, node->local_strong_refs,
+				     node->local_weak_refs);
 			break;
 		}
 		case BC_ATTEMPT_ACQUIRE:
@@ -1854,7 +1868,8 @@  int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
 			}
 			binder_debug(BINDER_DEBUG_FREE_BUFFER,
 				     "%d:%d BC_FREE_BUFFER u%p found buffer %d for %s transaction\n",
-				     proc->pid, thread->pid, data_ptr, buffer->debug_id,
+				     proc->pid, thread->pid, data_ptr,
+				     buffer->debug_id,
 				     buffer->transaction ? "active" : "finished");
 
 			if (buffer->transaction) {
@@ -1946,13 +1961,13 @@  int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
 			}
 
 			binder_debug(BINDER_DEBUG_DEATH_NOTIFICATION,
-				     "%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);
+				"%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);
 
 			if (cmd == BC_REQUEST_DEATH_NOTIFICATION) {
 				if (ref->death) {
@@ -1996,7 +2011,8 @@  int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
 				}
 				ref->death = NULL;
 				if (list_empty(&death->work.entry)) {
-					death->work.type = BINDER_WORK_CLEAR_DEATH_NOTIFICATION;
+					death->work.type =
+					   BINDER_WORK_CLEAR_DEATH_NOTIFICATION;
 					if (thread->looper & (BINDER_LOOPER_STATE_REGISTERED | BINDER_LOOPER_STATE_ENTERED)) {
 						list_add_tail(&death->work.entry, &thread->todo);
 					} else {
@@ -2018,7 +2034,9 @@  int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
 
 			ptr += sizeof(void *);
 			list_for_each_entry(w, &proc->delivered_death, entry) {
-				struct binder_ref_death *tmp_death = container_of(w, struct binder_ref_death, work);
+				struct binder_ref_death *tmp_death =
+					container_of(w, struct binder_ref_death,
+							work);
 				if (tmp_death->cookie == cookie) {
 					death = tmp_death;
 					break;
@@ -2034,7 +2052,8 @@  int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
 			}
 
 			list_del_init(&death->work.entry);
-			if (death->work.type == BINDER_WORK_DEAD_BINDER_AND_CLEAR) {
+			if (death->work.type ==
+					    BINDER_WORK_DEAD_BINDER_AND_CLEAR) {
 				death->work.type = BINDER_WORK_CLEAR_DEATH_NOTIFICATION;
 				if (thread->looper & (BINDER_LOOPER_STATE_REGISTERED | BINDER_LOOPER_STATE_ENTERED)) {
 					list_add_tail(&death->work.entry, &thread->todo);
@@ -2102,7 +2121,8 @@  retry:
 
 	if (thread->return_error != BR_OK && ptr < end) {
 		if (thread->return_error2 != BR_OK) {
-			if (put_user(thread->return_error2, (uint32_t __user *)ptr))
+			if (put_user(thread->return_error2,
+							(uint32_t __user *)ptr))
 				return -EFAULT;
 			ptr += sizeof(uint32_t);
 			binder_stat_br(proc, thread, thread->return_error2);
@@ -2141,13 +2161,15 @@  retry:
 			if (!binder_has_proc_work(proc, thread))
 				ret = -EAGAIN;
 		} else
-			ret = wait_event_freezable_exclusive(proc->wait, binder_has_proc_work(proc, thread));
+			ret = wait_event_freezable_exclusive(proc->wait,
+					    binder_has_proc_work(proc, thread));
 	} else {
 		if (non_block) {
 			if (!binder_has_thread_work(thread))
 				ret = -EAGAIN;
 		} else
-			ret = wait_event_freezable(thread->wait, binder_has_thread_work(thread));
+			ret = wait_event_freezable(thread->wait,
+						binder_has_thread_work(thread));
 	}
 
 	binder_lock(__func__);
@@ -2166,11 +2188,14 @@  retry:
 		struct binder_transaction *t = NULL;
 
 		if (!list_empty(&thread->todo))
-			w = list_first_entry(&thread->todo, struct binder_work, entry);
+			w = list_first_entry(&thread->todo, struct binder_work,
+				       entry);
 		else if (!list_empty(&proc->todo) && wait_for_proc_work)
 			w = list_first_entry(&proc->todo, struct binder_work, entry);
 		else {
-			if (ptr - buffer == 4 && !(thread->looper & BINDER_LOOPER_STATE_NEED_RETURN)) /* no data added */
+			if (ptr - buffer == 4 && !(thread->looper &
+				BINDER_LOOPER_STATE_NEED_RETURN))
+				/* no data add */
 				goto retry;
 			break;
 		}
@@ -2198,11 +2223,14 @@  retry:
 			binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE);
 		} break;
 		case BINDER_WORK_NODE: {
-			struct binder_node *node = container_of(w, struct binder_node, work);
+			struct binder_node *node = container_of(w,
+						      struct binder_node, work);
 			uint32_t cmd = BR_NOOP;
 			const char *cmd_name;
-			int strong = node->internal_strong_refs || node->local_strong_refs;
-			int weak = !hlist_empty(&node->refs) || node->local_weak_refs || strong;
+			int strong = node->internal_strong_refs ||
+						node->local_strong_refs;
+			int weak = !hlist_empty(&node->refs) ||
+						node->local_weak_refs || strong;
 			if (weak && !node->has_weak_ref) {
 				cmd = BR_INCREFS;
 				cmd_name = "BR_INCREFS";
@@ -2237,23 +2265,26 @@  retry:
 
 				binder_stat_br(proc, thread, cmd);
 				binder_debug(BINDER_DEBUG_USER_REFS,
-					     "%d:%d %s %d u%p c%p\n",
-					     proc->pid, thread->pid, cmd_name, node->debug_id, node->ptr, node->cookie);
+				       "%d:%d %s %d u%p c%p\n",
+				       proc->pid, thread->pid, cmd_name,
+				       node->debug_id, node->ptr, node->cookie);
 			} else {
 				list_del_init(&w->entry);
 				if (!weak && !strong) {
 					binder_debug(BINDER_DEBUG_INTERNAL_REFS,
-						     "%d:%d node %d u%p c%p deleted\n",
-						     proc->pid, thread->pid, node->debug_id,
-						     node->ptr, node->cookie);
+						"%d:%d node %d u%p c%p deleted\n",
+						proc->pid, thread->pid,
+						node->debug_id,	node->ptr,
+						node->cookie);
 					rb_erase(&node->rb_node, &proc->nodes);
 					kfree(node);
 					binder_stats_deleted(BINDER_STAT_NODE);
 				} else {
 					binder_debug(BINDER_DEBUG_INTERNAL_REFS,
-						     "%d:%d node %d u%p c%p state unchanged\n",
-						     proc->pid, thread->pid, node->debug_id, node->ptr,
-						     node->cookie);
+						"%d:%d node %d u%p c%p state unchanged\n",
+						proc->pid, thread->pid,
+						node->debug_id, node->ptr,
+						node->cookie);
 				}
 			}
 		} break;
@@ -2584,7 +2615,10 @@  static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 			     bwr.write_buffer, bwr.read_size, bwr.read_buffer);
 
 		if (bwr.write_size > 0) {
-			ret = binder_thread_write(proc, thread, (void __user *)bwr.write_buffer, bwr.write_size, &bwr.write_consumed);
+			ret = binder_thread_write(proc, thread,
+						(void __user *)bwr.write_buffer,
+						bwr.write_size,
+						&bwr.write_consumed);
 			trace_binder_write_done(ret);
 			if (ret < 0) {
 				bwr.read_consumed = 0;
@@ -2594,7 +2628,11 @@  static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 			}
 		}
 		if (bwr.read_size > 0) {
-			ret = binder_thread_read(proc, thread, (void __user *)bwr.read_buffer, bwr.read_size, &bwr.read_consumed, filp->f_flags & O_NONBLOCK);
+			ret = binder_thread_read(proc, thread,
+						 (void __user *)bwr.read_buffer,
+						 bwr.read_size,
+						 &bwr.read_consumed,
+						 filp->f_flags & O_NONBLOCK);
 			trace_binder_read_done(ret);
 			if (!list_empty(&proc->todo))
 				wake_up_interruptible(&proc->wait);
@@ -2606,8 +2644,8 @@  static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		}
 		binder_debug(BINDER_DEBUG_READ_WRITE,
 			     "%d:%d wrote %zd of %zd, read return %zd of %zd\n",
-			     proc->pid, thread->pid, bwr.write_consumed, bwr.write_size,
-			     bwr.read_consumed, bwr.read_size);
+			     proc->pid, thread->pid, bwr.write_consumed,
+			     bwr.write_size, bwr.read_consumed, bwr.read_size);
 		if (copy_to_user(ubuf, &bwr, sizeof(bwr))) {
 			ret = -EFAULT;
 			goto err;
@@ -2615,7 +2653,8 @@  static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		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;
 		}
@@ -2630,7 +2669,8 @@  static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 			if (!uid_eq(binder_context_mgr_uid, current->cred->euid)) {
 				pr_err("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));
+				       from_kuid(&init_user_ns,
+						binder_context_mgr_uid));
 				ret = -EPERM;
 				goto err;
 			}
@@ -2657,7 +2697,8 @@  static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 			ret = -EINVAL;
 			goto err;
 		}
-		if (put_user(BINDER_CURRENT_PROTOCOL_VERSION, &((struct binder_version *)ubuf)->protocol_version)) {
+		if (put_user(BINDER_CURRENT_PROTOCOL_VERSION, &
+			((struct binder_version *)ubuf)->protocol_version)) {
 			ret = -EINVAL;
 			goto err;
 		}
@@ -2754,12 +2795,15 @@  static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
 #ifdef CONFIG_CPU_CACHE_VIPT
 	if (cache_is_vipt_aliasing()) {
 		while (CACHE_COLOUR((vma->vm_start ^ (uint32_t)proc->buffer))) {
-			pr_info("binder_mmap: %d %lx-%lx maps %p bad alignment\n", proc->pid, vma->vm_start, vma->vm_end, proc->buffer);
+			pr_info("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;
 		}
 	}
 #endif
-	proc->pages = kzalloc(sizeof(proc->pages[0]) * ((vma->vm_end - vma->vm_start) / PAGE_SIZE), GFP_KERNEL);
+	proc->pages = kzalloc(sizeof(proc->pages[0]) *
+			(vma->vm_end - vma->vm_start) / PAGE_SIZE, GFP_KERNEL);
 	if (proc->pages == NULL) {
 		ret = -ENOMEM;
 		failure_string = "alloc page array";
@@ -2770,7 +2814,8 @@  static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
 	vma->vm_ops = &binder_vm_ops;
 	vma->vm_private_data = proc;
 
-	if (binder_update_page_range(proc, 1, proc->buffer, proc->buffer + PAGE_SIZE, vma)) {
+	if (binder_update_page_range(proc, 1, proc->buffer,
+				proc->buffer + PAGE_SIZE, vma)) {
 		ret = -ENOMEM;
 		failure_string = "alloc small buf";
 		goto err_alloc_small_buf_failed;
@@ -2856,7 +2901,8 @@  static void binder_deferred_flush(struct binder_proc *proc)
 	struct rb_node *n;
 	int wake_count = 0;
 	for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) {
-		struct binder_thread *thread = rb_entry(n, struct binder_thread, rb_node);
+		struct binder_thread *thread = rb_entry(n, struct binder_thread,
+				rb_node);
 		thread->looper |= BINDER_LOOPER_STATE_NEED_RETURN;
 		if (thread->looper & BINDER_LOOPER_STATE_WAITING) {
 			wake_up_interruptible(&thread->wait);