staging: comedi: rearrange comedi_write() code
commit06181de14ff09b274b699ee2dd39fe5e37efb419
authorIan Abbott <abbotti@mev.co.uk>
Wed, 18 Nov 2015 17:55:04 +0000 (18 17:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Dec 2015 23:58:54 +0000 (21 15:58 -0800)
tree66eba4cfa2f1d2b7874a5a3dc084b0657a5aade3
parentb4717ff608c180115ace1d307e7f452e114ca29c
staging: comedi: rearrange comedi_write() code

Rearrange the code in `comedi_write()` to reduce the amount of
indentation.  The code never reiterates the `while` loop once `count`
has become non-zero, so we can check that in the `while` condition to
save an indentation level.  (Note that `nbytes` has been checked to be
non-zero before entering the loop, so we can remove that check.)  Move
the code that makes the subdevice "become non-busy" outside the `while`
loop, using a new flag variable `become_nonbusy` to decide whether it
needs to be done.  This simplifies the wait queue handling so there is a
single place where the task is removed from the wait queue, and we can
remove the `on_wait_queue` flag variable.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c