]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
mtd: don't WARN about overloaded users of mtd->reboot_notifier.notifier_call
authorBrian Norris <computersforpeace@gmail.com>
Wed, 4 Nov 2015 01:01:53 +0000 (17:01 -0800)
committerBrian Norris <computersforpeace@gmail.com>
Fri, 6 Nov 2015 17:33:15 +0000 (09:33 -0800)
commitf8479dd6a03cfdc3b14e742045bfd8748cd86bd7
treeec1e4357aa02de5114a19bfa78d869b72641f091
parent28ec8a864f4b67bb801aede7919391531612c7dd
mtd: don't WARN about overloaded users of mtd->reboot_notifier.notifier_call

There are multiple types of users of mtd->reboot_notifier.notifier_call:

(1) A while back, the cfi_cmdset_000{1,2} chip drivers implemented a
reboot notifier to (on a best effort basis) attempt to reset their flash
chips before rebooting.

(2) More recently, we implemented a common _reboot() hook so that MTD
drivers (particularly, NAND flash) could better halt I/O operations
without having to reimplement the same notifier boilerplate.

Currently, the WARN_ONCE() condition here was written to handle (2), but
at the same time it mis-diagnosed case (1) as an already-registered MTD.
Let's fix this by having the WARN_ONCE() condition better imitate the
condition that immediately follows it. (Wow, I don't know how I missed
that one.)

(Side note: Unfortunately, we can't yet combine the reboot notifier code
for (1) and (2) with a patch like [1], because some users of (1) also
use mtdconcat, and so the mtd_info struct from cfi_cmdset_000{1,2} won't
actually get registered with mtdcore, and therefore their reboot
notifier won't get registered.)

[1] http://patchwork.ozlabs.org/patch/417981/

Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Jesper Nilsson <jespern@axis.com>
Cc: linux-cris-kernel@axis.com
Tested-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/mtdcore.c