From: Takashi Iwai <tiwai@suse.de>
To: Ming Lei <ming.lei@canonical.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] firmware: Refactoring for splitting user-mode helper code
Date: Thu, 31 Jan 2013 10:55:54 +0100 [thread overview]
Message-ID: <s5hsj5hwuad.wl%tiwai@suse.de> (raw)
In-Reply-To: <CACVXFVOu0PKy0MhHYrj9wP8Bcu-VRWRZRRVvnRwN3fxBEpUSMA@mail.gmail.com>
At Thu, 31 Jan 2013 17:48:34 +0800,
Ming Lei wrote:
>
(snip)
> > +/* called from request_firmware() and request_firmware_work_func() */
> > +static int
> > +_request_firmware(const struct firmware **firmware_p, const char *name,
> > + struct device *device, bool uevent, bool nowait)
> > +{
> > + struct firmware *fw;
> > + long timeout;
> > + int ret;
> > +
> > + if (!firmware_p)
> > + return -EINVAL;
> > +
> > + ret = _request_firmware_prepare(&fw, name, device);
> > + if (ret <= 0) /* error or already assigned */
> > + goto out;
> > +
> > + ret = 0;
> > + timeout = firmware_loading_timeout();
>
> The above line may be moved below the line of 'if (nowait) '.
I thought of that, too, but later found that the timeout is used in
the call of fw_load_from_user_helper() below.
> > + if (nowait) {
> > + timeout = usermodehelper_read_lock_wait(timeout);
> > + if (!timeout) {
> > + dev_dbg(device, "firmware: %s loading timed out\n",
> > + name);
> > + ret = -EBUSY;
> > + }
> > + } else {
> > + ret = usermodehelper_read_trylock();
> > + if (WARN_ON(ret)) {
> > + dev_err(device, "firmware: %s will not be loaded\n",
> > + name);
> > + }
> > + }
> > +
> > + if (!ret) {
> > + if (!fw_get_filesystem_firmware(device, fw->priv))
> > + ret = fw_load_from_user_helper(fw, name, device,
> > + uevent, nowait,
> > + timeout);
> > + if (!ret)
> > + ret = assign_firmware_buf(fw, device);
> > + }
> > +
> > + usermodehelper_read_unlock();
>
> The above should be move inside the above 'if (!ret) {...}'
Yep, but it would make the code less understandable.
I'll make rather the error path of usermodehelper lock goto's.
>
> Except for the above two comments, looks the patch v4 is fine.
>
> Please CC greg-kh when you send v5, and you may add my ack
> for the patchset.
>
> Acked-by: Ming Lei <ming.lei@canonical.com>
OK, thanks!
Takashi
next prev parent reply other threads:[~2013-01-31 9:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-30 10:35 [PATCH 0/4] firmware: Make user-mode helper optional (v4) Takashi Iwai
2013-01-30 10:35 ` [PATCH 1/4] firmware: Refactoring for splitting user-mode helper code Takashi Iwai
2013-01-31 9:48 ` Ming Lei
2013-01-31 9:55 ` Takashi Iwai [this message]
2013-01-30 10:35 ` [PATCH 2/4] firmware: Make user-mode helper optional Takashi Iwai
2013-01-30 10:35 ` [PATCH 3/4] firmware: Reduce ifdef CONFIG_FW_LOADER_USER_HELPER Takashi Iwai
2013-01-30 10:35 ` [PATCH 4/4] firmware: Ignore abort check when no user-helper is used Takashi Iwai
-- strict thread matches above, loose matches on Subject: below --
2013-01-31 10:13 [PATCH 0/4] firmware: Make user-mode helper optional (v5) Takashi Iwai
2013-01-31 10:13 ` [PATCH 1/4] firmware: Refactoring for splitting user-mode helper code Takashi Iwai
2013-01-29 14:46 [PATCH 0/4] firmware: Make user-mode helper optional (v3) Takashi Iwai
2013-01-29 14:46 ` [PATCH 1/4] firmware: Refactoring for splitting user-mode helper code Takashi Iwai
2013-01-30 3:37 ` Ming Lei
2013-01-30 7:17 ` Takashi Iwai
2013-01-30 10:25 ` Ming Lei
2013-01-30 10:31 ` Takashi Iwai
2013-01-30 10:50 ` Ming Lei
2013-01-30 10:53 ` Takashi Iwai
2013-01-30 11:08 ` Ming Lei
2013-01-30 11:08 ` Takashi Iwai
2013-01-30 11:48 ` Ming Lei
2013-01-30 12:04 ` Takashi Iwai
2013-01-25 16:05 [PATCH 0/4] firmware: Make user-mode helper optional (v2) Takashi Iwai
2013-01-25 16:05 ` [PATCH 1/4] firmware: Refactoring for splitting user-mode helper code Takashi Iwai
2013-01-29 10:24 ` Ming Lei
2013-01-29 10:59 ` Takashi Iwai
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=s5hsj5hwuad.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@canonical.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
all inboxes | Powered by JetHome®