]> git.baikalelectronics.ru Git - kernel.git/commit
firmware: drop bit ops in favor of simple state machine
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 17 Nov 2016 10:00:49 +0000 (11:00 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Nov 2016 20:28:54 +0000 (21:28 +0100)
commitd86d2800a6b1a81a77bb15512e98da1ebf44a2be
tree90af94390fc112eb3fd2d1e4914a2052da8d5677
parent7896a9335e785e80887c6b4f4812dd7f9ed00e05
firmware: drop bit ops in favor of simple state machine

We track the state of the firmware loading with bit ops.  Since the
state machine has only a few states and they are all mutual exclusive
there are only a few simple state transition we can model this simplify.

   UNKNOWN -> LOADING -> DONE | ABORTED

Because we don't use any bit ops on fw_state::status anymore we are able
to change the data type to enum fw_status and update the function
arguments accordingly.

READ_ONCE() and WRITE_ONCE() are propably not needed because there are a
lot of load and stores around fw_st->status. But let's make it explicit
and not be sorry later.

Cc: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/firmware_class.c