At Tue, 25 Sep 2012 12:26:35 +0100, Mark Brown wrote:
On Thu, Sep 20, 2012 at 08:29:17PM -0700, Ian Minett wrote:
+static int request_firmware_cached(const struct firmware **firmware_p,
- const char *name, struct device *device)
+{
- if (*firmware_p)
return 0; /* already loaded */
- return request_firmware(firmware_p, name, device);
+}
This looks *awfully* like it should be a part of the generic firmware loading infrastructure rather than driver local (the name of the function is even likely to collide with something in the core code).
Yes, the support of firmware caching in the firmware loader base code was merged fairly recently (since 3.6). So, I took Ian's patch as is for now and will adapt to the standard code later on.
More generally, why is this driver different to other Linux drivers which don't normally cache the firmware?
They usually do, if it's needed in the normal resume path.
There's some uses for this (see all the hassle with suspend and resume on USB devices...) so it seems like it'd be useful to have in the framework, possibly as the default behaviour and probably with a mechanism to discard the firmware.
Takashi