Re: [GIT *] Allow request_firmware() to be satisfied from in-kernel,use it in more drivers.

From: Linus Torvalds
Date: Mon Jul 14 2008 - 21:03:21 EST




On Mon, 14 Jul 2008, david@xxxxxxx wrote:
> >
> > Does it waste some ram? Sure. Tough.
>
> I agree with this, but the proponents of the seperate firmware are listing the
> fact that the firmware doesn't tie up ram as one of the big reasons for making
> the change.

That's a totally bogus argument.

The fact is, if you build it into your module, you'll waste at _least_ as
much ram as if you just load it once at module load time.

So there is no actual valid reason to object to "request_firmware()".

I don't know why people get confused about this. I suspect that people
kind of expect that since they need to reload the firmware when resuming
the device, they should also do the "request_firmware()" at resume time.

Maybe it's worth explicitly documenting that request_firmware()/release()
should be done as a module init/exit (or a device detect-eject) time
option. Quite frankly, I think the current firmware docs are actually
actively misleading, because they link the request_firmware() with the
copying to device: quoting from Documentation/firmware_class/README:

High level behavior (driver code):
==================================

if(request_firmware(&fw_entry, $FIRMWARE, device) == 0)
copy_fw_to_device(fw_entry->data, fw_entry->size);
release(fw_entry);

and that is a fundamentally broken world-view.

The logic _should_ be that the firmware is requested at module init or
device discovery, and the release is done at module exit or device eject.

The "request_firmware()" should absolutely *not* be mentally tied to
"copy_fw_to_device" at all. They are very distinct issues, and in fact
must be totally separate for any driver that supports hotplug.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/