OSDN Git Service

mtd: nand: denali: use more FIELD_PREP / FIELD_GET where appropriate
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 22 Sep 2017 03:46:44 +0000 (12:46 +0900)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Fri, 22 Sep 2017 07:04:31 +0000 (09:04 +0200)
commit8e4cbf7f0a55a235fdd8c088da1259b9fe8e9393
tree48433555bfdd69bb04b875dbfe985bd8ce4f5c95
parente0d53b3f8ed2b14dab54a04a4589fa72b0827fa5
mtd: nand: denali: use more FIELD_PREP / FIELD_GET where appropriate

In several places in this driver, the register fields are retrieved
as follows:

  val = reg & FOO_MASK;

Then, modified as follows:

  reg &= ~FOO_MASK;
  reg |= val;

This code relies on its shift is 0, which we will never know until
we check the definition of FOO_MASK.  Use FIELD_PREP / FIELD_GET
where appropriate.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/denali.c