diff options
Diffstat (limited to 'drivers/mailbox/mailbox.c')
-rw-r--r-- | drivers/mailbox/mailbox.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 08ce9a1ab53a..6abb35ff49fa 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c | |||
@@ -284,6 +284,34 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg) | |||
284 | EXPORT_SYMBOL_GPL(mbox_send_message); | 284 | EXPORT_SYMBOL_GPL(mbox_send_message); |
285 | 285 | ||
286 | /** | 286 | /** |
287 | * mbox_flush - flush a mailbox channel | ||
288 | * @chan: mailbox channel to flush | ||
289 | * @timeout: time, in milliseconds, to allow the flush operation to succeed | ||
290 | * | ||
291 | * Mailbox controllers that need to work in atomic context can implement the | ||
292 | * ->flush() callback to busy loop until a transmission has been completed. | ||
293 | * The implementation must call mbox_chan_txdone() upon success. Clients can | ||
294 | * call the mbox_flush() function at any time after mbox_send_message() to | ||
295 | * flush the transmission. After the function returns success, the mailbox | ||
296 | * transmission is guaranteed to have completed. | ||
297 | * | ||
298 | * Returns: 0 on success or a negative error code on failure. | ||
299 | */ | ||
300 | int mbox_flush(struct mbox_chan *chan, unsigned long timeout) | ||
301 | { | ||
302 | int ret; | ||
303 | |||
304 | if (!chan->mbox->ops->flush) | ||
305 | return -ENOTSUPP; | ||
306 | |||
307 | ret = chan->mbox->ops->flush(chan, timeout); | ||
308 | if (ret < 0) | ||
309 | tx_tick(chan, ret); | ||
310 | |||
311 | return ret; | ||
312 | } | ||
313 | |||
314 | /** | ||
287 | * mbox_request_channel - Request a mailbox channel. | 315 | * mbox_request_channel - Request a mailbox channel. |
288 | * @cl: Identity of the client requesting the channel. | 316 | * @cl: Identity of the client requesting the channel. |
289 | * @index: Index of mailbox specifier in 'mboxes' property. | 317 | * @index: Index of mailbox specifier in 'mboxes' property. |