firmware loader: always let firmware_buf own the pages buffer
authorMing Lei <ming.lei@canonical.com>
Sat, 4 Aug 2012 04:01:21 +0000 (12:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Aug 2012 20:22:45 +0000 (13:22 -0700)
commit1f2b79599ee8f5fc82cc73c6c090eb6cdff881d6
tree6b3fed8d355f708cc6a001e772f07783a300d2cd
parent1244691c73b250be522e77ac1a00ad53b601b4c4
firmware loader: always let firmware_buf own the pages buffer

This patch always let firmware_buf own the pages buffer allocated
inside firmware_data_write, and add all instances of firmware_buf
into the firmware cache global list. Also introduce one private field
in 'struct firmware', so release_firmware will see the instance of
firmware_buf associated with the current firmware instance, then just
'free' the instance of firmware_buf.

The firmware_buf instance represents one pages buffer for one
firmware image, so lots of firmware loading requests can share
the same firmware_buf instance if they request the same firmware
image file.

This patch will make implementation of the following cache_firmware/
uncache_firmware very easy and simple.

In fact, the patch improves request_formware/release_firmware:

        - only request userspace to write firmware image once if
several devices share one same firmware image and its drivers
call request_firmware concurrently.

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
include/linux/firmware.h
This page took 0.028931 seconds and 5 git commands to generate.