From: Javier Carrasco <javier.carrasco@wolfvision.net>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] usb: typec: tipd: add function to request firmware
Date: Fri, 8 Dec 2023 19:58:52 +0100 [thread overview]
Message-ID: <196acb44-fb0d-45b6-a9c3-b5a289a41917@wolfvision.net> (raw)
In-Reply-To: <ZXMudF++A9/y4TNk@kuha.fi.intel.com>
Hi Heikki,
On 08.12.23 15:55, Heikki Krogerus wrote:
>> + ret = request_firmware(fw, firmware_name, tps->dev);
>> + if (ret) {
>> + dev_err(tps->dev, "failed to retrieve \"%s\"\n", firmware_name);
>> + /* probe deferring in case the file system is not ready */
>> + return (ret == -ENOENT) ? -EPROBE_DEFER : ret;
>
> It's more likely that the firmware really isn't available, and it will
> never be available in this case. I think there is only one place in
> kernel where failing request_firmware() can lead to deferred probe
> (drivers/tee/optee/smc_abi.c) and there the code can actually see the
> system state - that's actually the condition.
>
> So just return dev_err_probe() here:
>
> ret = request_firmware(fw, firmware_name, tps->dev);
> if (ret)
> return dev_err_probe(tps->dev, ret, "failed to retrieve \"%s\"", firmware_name);
>
Thank you for your feedback.
This solution arose from a real use case: in the system I am using to
test the tps65987d, the filesystem is not ready when the probe function
is called. If I just return on -ENOENT, the device will never get the
update.
Note that we are only triggering the update if the device is in patch
mode, so a firmware will be expected for the device to run and reach the
app mode.
In that case deferring the probe and keeping on trying to make the
update makes sense because otherwise the device will not be able to
offer its functionality. If the device is not in patch mode, no update
will be triggered and the firmware will not be requested, so there will
not be any unnecessary probe deferring.
I see that the driver you mentioned checks if the system_state is still
not SYSTEM_RUNNING to defer the probe.
I have not tested if something like that would be possible in this case,
but giving up on the first attempt if the firmware is not found makes
the assumption that the filesystem where the fw resides will always be
ready when the probe function is called, which in my particular case is
a wrong assumption.
If the firmware was updated at any point during normal operation, the
assumption would be definitely right, but maybe not while booting.
Thank you and best regards,
Javier Carrasco
next prev parent reply other threads:[~2023-12-08 19:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-07 11:51 [PATCH 0/4] usb: typec: tipd: add patch update support for tps6598x Javier Carrasco
2023-12-07 11:51 ` [PATCH 1/4] usb: typec: tipd: add init and reset functions to tipd_data Javier Carrasco
2023-12-07 11:51 ` [PATCH 2/4] usb: typec: tipd: add function to request firmware Javier Carrasco
2023-12-08 14:55 ` Heikki Krogerus
2023-12-08 18:58 ` Javier Carrasco [this message]
2023-12-12 14:15 ` Heikki Krogerus
2023-12-12 14:41 ` Javier Carrasco
2023-12-13 15:15 ` Heikki Krogerus
2023-12-13 15:32 ` Javier Carrasco
2023-12-07 11:51 ` [PATCH 3/4] usb: typec: tipd: declare in_data in as const in exec_cmd functions Javier Carrasco
2023-12-07 11:51 ` [PATCH 4/4] usb: typec: tipd: add patch update support for tps6598x Javier Carrasco
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=196acb44-fb0d-45b6-a9c3-b5a289a41917@wolfvision.net \
--to=javier.carrasco@wolfvision.net \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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®