• Ian Abbott's avatar
    staging: comedi: rearrange comedi_write() code · 06181de1
    Ian Abbott authored
    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: default avatarIan Abbott <abbotti@mev.co.uk>
    Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    06181de1
comedi_fops.c 66.3 KB