mtd: cfi_cmdset_0002: do not fail on no extended query table as they are both optional
authorGuillaume LECERF <glecerf@gmail.com>
Sat, 24 Apr 2010 15:58:17 +0000 (17:58 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Fri, 14 May 2010 00:33:27 +0000 (01:33 +0100)
commit564b84978df2bf83d334940f1a1190702579f79f
tree10f7ce02b4c0bb876c3e2c24afdb6eb0ac7707a4
parent58598861227877bb481b9035d2a07283577a2274
mtd: cfi_cmdset_0002: do not fail on no extended query table as they are both optional

After looking at AMD's CFI specification [1], both of the extended query
tables are optional. Thus, it looks like relying that at least one of
those tables exist is a bug in cfi_cmdset_0002.

This patch inverts the logic and checks for unlock function pointers before
exiting on error. This approach leaves place to add a call to a fixup
function to try to handle chips compatible with the early AMD specification
from 1995 [2].

[1] http://www.amd.com/us-en/assets/content_type/DownloadableAssets/cfi_r20.pdf
[2] http://noel.feld.cvut.cz/hw/amd/20158a.pdf

Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/chips/cfi_cmdset_0002.c