[PATCH 1/2] Pin firmware module (was Re: [PATCH] request_firmware(): fixes and polishing.)

From: Dmitry Torokhov
Date: Sun Feb 29 2004 - 01:38:07 EST


===================================================================


ChangeSet@xxxxxx, 2004-02-29 00:06:09-05:00, dtor_core@xxxxxxxxxxxxx
Firmware loader:
We need to pin the firmware loader module until the last reference
to the firmware class device is dropped and the class device is
destroyed.


firmware_class.c | 6 ++++++
1 files changed, 6 insertions(+)


===================================================================



diff -Nru a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
--- a/drivers/base/firmware_class.c Sun Feb 29 01:20:57 2004
+++ b/drivers/base/firmware_class.c Sun Feb 29 01:20:57 2004
@@ -263,6 +263,8 @@

kfree(fw_priv);
kfree(class_dev);
+
+ module_put(THIS_MODULE);
}

static void
@@ -325,6 +327,7 @@
kfree(class_dev);
return retval;
}
+
static int
fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p,
const char *fw_name, struct device *device)
@@ -337,6 +340,9 @@
retval = fw_register_class_device(&class_dev, fw_name, device);
if (retval)
goto out;
+
+ /* Need to pin this module until class device is destroyed */
+ __module_get(THIS_MODULE);

fw_priv = class_get_devdata(class_dev);

-
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/