Skip to content

Commit

Permalink
remoteproc: Drop wait in __rproc_boot()
Browse files Browse the repository at this point in the history
In the event that rproc_boot() is called before the firmware loaded
completion has been flagged it will wait with the mutex held,
obstructing the request_firmware_nowait() callback from completing the
wait.

As rproc_fw_config_virtio() has been reduced to only triggering
auto-boot there is no longer a reason for waiting in rproc_boot(), so
drop this.

Cc: Sarangdhar Joshi <[email protected]>
Signed-off-by: Bjorn Andersson <[email protected]>
Signed-off-by: Michal Simek <[email protected]>
  • Loading branch information
andersson authored and Michal Simek committed Aug 11, 2017
1 parent 6aba027 commit 6e95d8b
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions drivers/remoteproc/remoteproc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ static void rproc_fw_config_virtio(const struct firmware *fw, void *context)

/* if rproc is marked always-on, request it to boot */
if (rproc->auto_boot)
rproc_boot_nowait(rproc);
rproc_boot(rproc);

release_firmware(fw);
/* allow rproc_del() contexts, if any, to proceed */
Expand Down Expand Up @@ -1232,7 +1232,6 @@ static void rproc_crash_handler_work(struct work_struct *work)
/**
* __rproc_boot() - boot a remote processor
* @rproc: handle of a remote processor
* @wait: wait for rproc registration completion
*
* Boot a remote processor (i.e. load its firmware, power it on, ...).
*
Expand All @@ -1241,7 +1240,7 @@ static void rproc_crash_handler_work(struct work_struct *work)
*
* Returns 0 on success, and an appropriate error value otherwise.
*/
static int __rproc_boot(struct rproc *rproc, bool wait)
static int __rproc_boot(struct rproc *rproc)
{
const struct firmware *firmware_p;
struct device *dev;
Expand Down Expand Up @@ -1275,10 +1274,6 @@ static int __rproc_boot(struct rproc *rproc, bool wait)
goto downref_rproc;
}

/* if rproc virtio is not yet configured, wait */
if (wait)
wait_for_completion(&rproc->firmware_loading_complete);

ret = rproc_fw_boot(rproc, firmware_p);

release_firmware(firmware_p);
Expand All @@ -1297,21 +1292,10 @@ static int __rproc_boot(struct rproc *rproc, bool wait)
*/
int rproc_boot(struct rproc *rproc)
{
return __rproc_boot(rproc, true);
return __rproc_boot(rproc);
}
EXPORT_SYMBOL(rproc_boot);

/**
* rproc_boot_nowait() - boot a remote processor
* @rproc: handle of a remote processor
*
* Same as rproc_boot() but don't wait for rproc registration completion
*/
int rproc_boot_nowait(struct rproc *rproc)
{
return __rproc_boot(rproc, false);
}

/**
* rproc_shutdown() - power off the remote processor
* @rproc: the remote processor
Expand Down

0 comments on commit 6e95d8b

Please sign in to comment.