firmware loader: simplify pages ownership transfer
authorMing Lei <ming.lei@canonical.com>
Sat, 4 Aug 2012 04:01:16 +0000 (12:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Aug 2012 20:13:18 +0000 (13:13 -0700)
commit65710cb6ea315b3ef76a8a3da7be99afcf58d2bb
tree40043563aca5fa81fbc1f04f16ea887b6b372212
parent3cd52ab68b7f17eddbff46c1f8e5a105cd901f8e
firmware loader: simplify pages ownership transfer

This patch doesn't transfer ownership of pages' buffer to the
instance of firmware until the firmware loading is completed,
which will simplify firmware_loading_store a lot, so help
to introduce the following cache_firmware and uncache_firmware
mechanism during system suspend-resume cycle.

In fact, this patch fixes one bug: if writing data into
firmware loader device is bypassed between writting 1 and 0 to
'loading', OOPS will be triggered without the patch.

Also handle the vmap failure case, and add some comments to make
code more readable.

Signed-off-by: Ming Lei <ming.lei@canonical.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/firmware_class.c