mtd: nand: add generic READ ID length calculation functions
authorBrian Norris <computersforpeace@gmail.com>
Tue, 25 Sep 2012 03:40:52 +0000 (20:40 -0700)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 29 Sep 2012 14:57:58 +0000 (15:57 +0100)
commite3b88bd604283ef83ae6e8f53622d5b1ffe9d43a
tree7263eeadca07ad77f7e9108ba456158b039da502
parentf23a481c4e0ccb006470b1c890cc7236ba634e67
mtd: nand: add generic READ ID length calculation functions

When decoding the extended ID bytes of a NAND chip, we have to calculate the ID
length according to some heuristic patterns (e.g., Does the ID wrap around?
Does it end in trailing zeros?). Currently, these heuristics are built into
complicated if/else blocks that can be hard to understand.

Now, these checks can be done generically in a function, making them more
robust and reusable. In fact, this sort of calculation is needed in future
additions to nand_base.c. And with this advancement, we get the added benefit
of a more readable "extended ID decode".

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/nand/nand_base.c