Commit f2825db1 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] firmware loader: delay firmware hotplug event

From: Dmitry Torokhov <dtor_core@ameritech.net>

Do not call hotplug until firmware class device is completely instantiated.
parent 8813723a
......@@ -27,6 +27,7 @@ enum {
FW_STATUS_LOADING,
FW_STATUS_DONE,
FW_STATUS_ABORT,
FW_STATUS_READY,
};
static int loading_timeout = 10; /* In seconds */
......@@ -96,6 +97,9 @@ firmware_class_hotplug(struct class_device *class_dev, char **envp,
int i = 0;
char *scratch = buffer;
if (!test_bit(FW_STATUS_READY, &fw_priv->status))
return -ENODEV;
if (buffer_size < (FIRMWARE_NAME_MAX + 10))
return -ENOMEM;
if (num_envp < 1)
......@@ -362,6 +366,7 @@ fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p,
goto error_unreg;
}
set_bit(FW_STATUS_READY, &fw_priv->status);
*class_dev_p = class_dev;
goto out;
......@@ -415,6 +420,7 @@ request_firmware(const struct firmware **firmware_p, const char *name,
add_timer(&fw_priv->timeout);
}
kobject_hotplug("add", &class_dev->kobj);
wait_for_completion(&fw_priv->completion);
set_bit(FW_STATUS_DONE, &fw_priv->status);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment