From: Johannes Berg <johannes@sipsolutions.net>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Tomas Winkler <tomasw@gmail.com>,
Kay Sievers <kay.sievers@vrfy.org>, Greg KH <greg@kroah.com>,
David Woodhouse <dwmw2@infradead.org>
Subject: [PATCH] firmware class: export nowait to userspace
Date: Thu, 11 Mar 2010 14:56:39 -0800 [thread overview]
Message-ID: <1268348199.4142.33.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <1268347174.4142.11.camel@jlt3.sipsolutions.net>
When we use request_firmware_nowait(), userspace may
not want to answer negatively right away when for
example it is answering from an initrd only, but
with request_firmware() it has to in order to not
delay the kernel boot until the request times out.
This allows userspace to differentiate between the
two in order to be able to reply negatively to async
requests only when all filesystems have been mounted
and have been checked for the requested firmware file.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
drivers/base/firmware_class.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
--- wireless-testing.orig/drivers/base/firmware_class.c 2010-03-11 11:50:39.000000000 -0800
+++ wireless-testing/drivers/base/firmware_class.c 2010-03-11 11:55:15.000000000 -0800
@@ -50,6 +50,7 @@ struct firmware_priv {
int page_array_size;
const char *vdata;
struct timer_list timeout;
+ bool nowait;
};
#ifdef CONFIG_FW_LOADER
@@ -107,6 +108,8 @@ static int firmware_uevent(struct device
return -ENOMEM;
if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout))
return -ENOMEM;
+ if (add_uevent_var(env, "NOWAIT=%d", fw_priv->nowait))
+ return -ENOMEM;
return 0;
}
@@ -422,7 +425,7 @@ error_kfree:
static int fw_setup_device(struct firmware *fw, struct device **dev_p,
const char *fw_name, struct device *device,
- int uevent)
+ int uevent, bool nowait)
{
struct device *f_dev;
struct firmware_priv *fw_priv;
@@ -438,6 +441,8 @@ static int fw_setup_device(struct firmwa
fw_priv = dev_get_drvdata(f_dev);
+ fw_priv->nowait = nowait;
+
fw_priv->fw = fw;
retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data);
if (retval) {
@@ -464,7 +469,7 @@ out:
static int
_request_firmware(const struct firmware **firmware_p, const char *name,
- struct device *device, int uevent)
+ struct device *device, int uevent, bool nowait)
{
struct device *f_dev;
struct firmware_priv *fw_priv;
@@ -497,7 +502,8 @@ _request_firmware(const struct firmware
if (uevent)
dev_info(device, "firmware: requesting %s\n", name);
- retval = fw_setup_device(firmware, &f_dev, name, device, uevent);
+ retval = fw_setup_device(firmware, &f_dev, name, device,
+ uevent, nowait);
if (retval)
goto error_kfree_fw;
@@ -554,7 +560,7 @@ request_firmware(const struct firmware *
struct device *device)
{
int uevent = 1;
- return _request_firmware(firmware_p, name, device, uevent);
+ return _request_firmware(firmware_p, name, device, uevent, false);
}
/**
@@ -600,7 +606,7 @@ request_firmware_work_func(void *arg)
return 0;
}
ret = _request_firmware(&fw, fw_work->name, fw_work->device,
- fw_work->uevent);
+ fw_work->uevent, true);
fw_work->cont(fw, fw_work->context);
next prev parent reply other threads:[~2010-03-11 22:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-11 22:39 firmware loading vs. initrd Johannes Berg
2010-03-11 22:56 ` Johannes Berg [this message]
2010-03-12 4:21 ` [PATCH] firmware class: export nowait to userspace Kay Sievers
2010-03-12 4:46 ` Johannes Berg
2010-03-12 5:29 ` Kay Sievers
2010-03-29 15:57 ` Johannes Berg
2010-03-12 4:32 ` firmware loading vs. initrd Kay Sievers
2010-03-12 4:48 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1268348199.4142.33.camel@jlt3.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=dwmw2@infradead.org \
--cc=greg@kroah.com \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tomasw@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox