mailbox.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Mailbox: Common code for Mailbox controllers and users
  4. *
  5. * Copyright (C) 2013-2014 Linaro Ltd.
  6. * Author: Jassi Brar <[email protected]>
  7. */
  8. #include <linux/interrupt.h>
  9. #include <linux/spinlock.h>
  10. #include <linux/mutex.h>
  11. #include <linux/delay.h>
  12. #include <linux/slab.h>
  13. #include <linux/err.h>
  14. #include <linux/module.h>
  15. #include <linux/device.h>
  16. #include <linux/bitops.h>
  17. #include <linux/mailbox_client.h>
  18. #include <linux/mailbox_controller.h>
  19. #include "mailbox.h"
  20. static LIST_HEAD(mbox_cons);
  21. static DEFINE_MUTEX(con_mutex);
  22. static int add_to_rbuf(struct mbox_chan *chan, void *mssg)
  23. {
  24. int idx;
  25. unsigned long flags;
  26. spin_lock_irqsave(&chan->lock, flags);
  27. /* See if there is any space left */
  28. if (chan->msg_count == MBOX_TX_QUEUE_LEN) {
  29. spin_unlock_irqrestore(&chan->lock, flags);
  30. return -ENOBUFS;
  31. }
  32. idx = chan->msg_free;
  33. chan->msg_data[idx] = mssg;
  34. chan->msg_count++;
  35. if (idx == MBOX_TX_QUEUE_LEN - 1)
  36. chan->msg_free = 0;
  37. else
  38. chan->msg_free++;
  39. spin_unlock_irqrestore(&chan->lock, flags);
  40. return idx;
  41. }
  42. static void msg_submit(struct mbox_chan *chan)
  43. {
  44. unsigned count, idx;
  45. unsigned long flags;
  46. void *data;
  47. int err = -EBUSY;
  48. spin_lock_irqsave(&chan->lock, flags);
  49. if (!chan->msg_count || chan->active_req)
  50. goto exit;
  51. count = chan->msg_count;
  52. idx = chan->msg_free;
  53. if (idx >= count)
  54. idx -= count;
  55. else
  56. idx += MBOX_TX_QUEUE_LEN - count;
  57. data = chan->msg_data[idx];
  58. if (chan->cl->tx_prepare)
  59. chan->cl->tx_prepare(chan->cl, data);
  60. /* Try to submit a message to the MBOX controller */
  61. err = chan->mbox->ops->send_data(chan, data);
  62. if (!err) {
  63. chan->active_req = data;
  64. chan->msg_count--;
  65. }
  66. exit:
  67. spin_unlock_irqrestore(&chan->lock, flags);
  68. if (!err && (chan->txdone_method & TXDONE_BY_POLL)) {
  69. /* kick start the timer immediately to avoid delays */
  70. spin_lock_irqsave(&chan->mbox->poll_hrt_lock, flags);
  71. hrtimer_start(&chan->mbox->poll_hrt, 0, HRTIMER_MODE_REL);
  72. spin_unlock_irqrestore(&chan->mbox->poll_hrt_lock, flags);
  73. }
  74. }
  75. static void tx_tick(struct mbox_chan *chan, int r)
  76. {
  77. unsigned long flags;
  78. void *mssg;
  79. spin_lock_irqsave(&chan->lock, flags);
  80. mssg = chan->active_req;
  81. chan->active_req = NULL;
  82. spin_unlock_irqrestore(&chan->lock, flags);
  83. /* Submit next message */
  84. msg_submit(chan);
  85. if (!mssg)
  86. return;
  87. /* Notify the client */
  88. if (chan->cl->tx_done)
  89. chan->cl->tx_done(chan->cl, mssg, r);
  90. if (r != -ETIME && chan->cl->tx_block)
  91. complete(&chan->tx_complete);
  92. }
  93. static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer)
  94. {
  95. struct mbox_controller *mbox =
  96. container_of(hrtimer, struct mbox_controller, poll_hrt);
  97. bool txdone, resched = false;
  98. int i;
  99. unsigned long flags;
  100. for (i = 0; i < mbox->num_chans; i++) {
  101. struct mbox_chan *chan = &mbox->chans[i];
  102. if (chan->active_req && chan->cl) {
  103. txdone = chan->mbox->ops->last_tx_done(chan);
  104. if (txdone)
  105. tx_tick(chan, 0);
  106. else
  107. resched = true;
  108. }
  109. }
  110. if (resched) {
  111. spin_lock_irqsave(&mbox->poll_hrt_lock, flags);
  112. if (!hrtimer_is_queued(hrtimer))
  113. hrtimer_forward_now(hrtimer, ms_to_ktime(mbox->txpoll_period));
  114. spin_unlock_irqrestore(&mbox->poll_hrt_lock, flags);
  115. return HRTIMER_RESTART;
  116. }
  117. return HRTIMER_NORESTART;
  118. }
  119. /**
  120. * mbox_chan_received_data - A way for controller driver to push data
  121. * received from remote to the upper layer.
  122. * @chan: Pointer to the mailbox channel on which RX happened.
  123. * @mssg: Client specific message typecasted as void *
  124. *
  125. * After startup and before shutdown any data received on the chan
  126. * is passed on to the API via atomic mbox_chan_received_data().
  127. * The controller should ACK the RX only after this call returns.
  128. */
  129. void mbox_chan_received_data(struct mbox_chan *chan, void *mssg)
  130. {
  131. /* No buffering the received data */
  132. if (chan->cl->rx_callback)
  133. chan->cl->rx_callback(chan->cl, mssg);
  134. }
  135. EXPORT_SYMBOL_GPL(mbox_chan_received_data);
  136. /**
  137. * mbox_chan_txdone - A way for controller driver to notify the
  138. * framework that the last TX has completed.
  139. * @chan: Pointer to the mailbox chan on which TX happened.
  140. * @r: Status of last TX - OK or ERROR
  141. *
  142. * The controller that has IRQ for TX ACK calls this atomic API
  143. * to tick the TX state machine. It works only if txdone_irq
  144. * is set by the controller.
  145. */
  146. void mbox_chan_txdone(struct mbox_chan *chan, int r)
  147. {
  148. if (unlikely(!(chan->txdone_method & TXDONE_BY_IRQ))) {
  149. dev_err(chan->mbox->dev,
  150. "Controller can't run the TX ticker\n");
  151. return;
  152. }
  153. tx_tick(chan, r);
  154. }
  155. EXPORT_SYMBOL_GPL(mbox_chan_txdone);
  156. /**
  157. * mbox_client_txdone - The way for a client to run the TX state machine.
  158. * @chan: Mailbox channel assigned to this client.
  159. * @r: Success status of last transmission.
  160. *
  161. * The client/protocol had received some 'ACK' packet and it notifies
  162. * the API that the last packet was sent successfully. This only works
  163. * if the controller can't sense TX-Done.
  164. */
  165. void mbox_client_txdone(struct mbox_chan *chan, int r)
  166. {
  167. if (unlikely(!(chan->txdone_method & TXDONE_BY_ACK))) {
  168. dev_err(chan->mbox->dev, "Client can't run the TX ticker\n");
  169. return;
  170. }
  171. tx_tick(chan, r);
  172. }
  173. EXPORT_SYMBOL_GPL(mbox_client_txdone);
  174. /**
  175. * mbox_client_peek_data - A way for client driver to pull data
  176. * received from remote by the controller.
  177. * @chan: Mailbox channel assigned to this client.
  178. *
  179. * A poke to controller driver for any received data.
  180. * The data is actually passed onto client via the
  181. * mbox_chan_received_data()
  182. * The call can be made from atomic context, so the controller's
  183. * implementation of peek_data() must not sleep.
  184. *
  185. * Return: True, if controller has, and is going to push after this,
  186. * some data.
  187. * False, if controller doesn't have any data to be read.
  188. */
  189. bool mbox_client_peek_data(struct mbox_chan *chan)
  190. {
  191. if (chan->mbox->ops->peek_data)
  192. return chan->mbox->ops->peek_data(chan);
  193. return false;
  194. }
  195. EXPORT_SYMBOL_GPL(mbox_client_peek_data);
  196. /**
  197. * mbox_send_message - For client to submit a message to be
  198. * sent to the remote.
  199. * @chan: Mailbox channel assigned to this client.
  200. * @mssg: Client specific message typecasted.
  201. *
  202. * For client to submit data to the controller destined for a remote
  203. * processor. If the client had set 'tx_block', the call will return
  204. * either when the remote receives the data or when 'tx_tout' millisecs
  205. * run out.
  206. * In non-blocking mode, the requests are buffered by the API and a
  207. * non-negative token is returned for each queued request. If the request
  208. * is not queued, a negative token is returned. Upon failure or successful
  209. * TX, the API calls 'tx_done' from atomic context, from which the client
  210. * could submit yet another request.
  211. * The pointer to message should be preserved until it is sent
  212. * over the chan, i.e, tx_done() is made.
  213. * This function could be called from atomic context as it simply
  214. * queues the data and returns a token against the request.
  215. *
  216. * Return: Non-negative integer for successful submission (non-blocking mode)
  217. * or transmission over chan (blocking mode).
  218. * Negative value denotes failure.
  219. */
  220. int mbox_send_message(struct mbox_chan *chan, void *mssg)
  221. {
  222. int t;
  223. if (!chan || !chan->cl)
  224. return -EINVAL;
  225. t = add_to_rbuf(chan, mssg);
  226. if (t < 0) {
  227. dev_err(chan->mbox->dev, "Try increasing MBOX_TX_QUEUE_LEN\n");
  228. return t;
  229. }
  230. msg_submit(chan);
  231. if (chan->cl->tx_block) {
  232. unsigned long wait;
  233. int ret;
  234. if (!chan->cl->tx_tout) /* wait forever */
  235. wait = msecs_to_jiffies(3600000);
  236. else
  237. wait = msecs_to_jiffies(chan->cl->tx_tout);
  238. ret = wait_for_completion_timeout(&chan->tx_complete, wait);
  239. if (ret == 0) {
  240. t = -ETIME;
  241. tx_tick(chan, t);
  242. }
  243. }
  244. return t;
  245. }
  246. EXPORT_SYMBOL_GPL(mbox_send_message);
  247. /**
  248. * mbox_flush - flush a mailbox channel
  249. * @chan: mailbox channel to flush
  250. * @timeout: time, in milliseconds, to allow the flush operation to succeed
  251. *
  252. * Mailbox controllers that need to work in atomic context can implement the
  253. * ->flush() callback to busy loop until a transmission has been completed.
  254. * The implementation must call mbox_chan_txdone() upon success. Clients can
  255. * call the mbox_flush() function at any time after mbox_send_message() to
  256. * flush the transmission. After the function returns success, the mailbox
  257. * transmission is guaranteed to have completed.
  258. *
  259. * Returns: 0 on success or a negative error code on failure.
  260. */
  261. int mbox_flush(struct mbox_chan *chan, unsigned long timeout)
  262. {
  263. int ret;
  264. if (!chan->mbox->ops->flush)
  265. return -ENOTSUPP;
  266. ret = chan->mbox->ops->flush(chan, timeout);
  267. if (ret < 0)
  268. tx_tick(chan, ret);
  269. return ret;
  270. }
  271. EXPORT_SYMBOL_GPL(mbox_flush);
  272. static int __mbox_bind_client(struct mbox_chan *chan, struct mbox_client *cl)
  273. {
  274. struct device *dev = cl->dev;
  275. unsigned long flags;
  276. int ret;
  277. if (chan->cl || !try_module_get(chan->mbox->dev->driver->owner)) {
  278. dev_dbg(dev, "%s: mailbox not free\n", __func__);
  279. return -EBUSY;
  280. }
  281. spin_lock_irqsave(&chan->lock, flags);
  282. chan->msg_free = 0;
  283. chan->msg_count = 0;
  284. chan->active_req = NULL;
  285. chan->cl = cl;
  286. init_completion(&chan->tx_complete);
  287. if (chan->txdone_method == TXDONE_BY_POLL && cl->knows_txdone)
  288. chan->txdone_method = TXDONE_BY_ACK;
  289. spin_unlock_irqrestore(&chan->lock, flags);
  290. if (chan->mbox->ops->startup) {
  291. ret = chan->mbox->ops->startup(chan);
  292. if (ret) {
  293. dev_err(dev, "Unable to startup the chan (%d)\n", ret);
  294. mbox_free_channel(chan);
  295. return ret;
  296. }
  297. }
  298. return 0;
  299. }
  300. /**
  301. * mbox_bind_client - Request a mailbox channel.
  302. * @chan: The mailbox channel to bind the client to.
  303. * @cl: Identity of the client requesting the channel.
  304. *
  305. * The Client specifies its requirements and capabilities while asking for
  306. * a mailbox channel. It can't be called from atomic context.
  307. * The channel is exclusively allocated and can't be used by another
  308. * client before the owner calls mbox_free_channel.
  309. * After assignment, any packet received on this channel will be
  310. * handed over to the client via the 'rx_callback'.
  311. * The framework holds reference to the client, so the mbox_client
  312. * structure shouldn't be modified until the mbox_free_channel returns.
  313. *
  314. * Return: 0 if the channel was assigned to the client successfully.
  315. * <0 for request failure.
  316. */
  317. int mbox_bind_client(struct mbox_chan *chan, struct mbox_client *cl)
  318. {
  319. int ret;
  320. mutex_lock(&con_mutex);
  321. ret = __mbox_bind_client(chan, cl);
  322. mutex_unlock(&con_mutex);
  323. return ret;
  324. }
  325. EXPORT_SYMBOL_GPL(mbox_bind_client);
  326. /**
  327. * mbox_request_channel - Request a mailbox channel.
  328. * @cl: Identity of the client requesting the channel.
  329. * @index: Index of mailbox specifier in 'mboxes' property.
  330. *
  331. * The Client specifies its requirements and capabilities while asking for
  332. * a mailbox channel. It can't be called from atomic context.
  333. * The channel is exclusively allocated and can't be used by another
  334. * client before the owner calls mbox_free_channel.
  335. * After assignment, any packet received on this channel will be
  336. * handed over to the client via the 'rx_callback'.
  337. * The framework holds reference to the client, so the mbox_client
  338. * structure shouldn't be modified until the mbox_free_channel returns.
  339. *
  340. * Return: Pointer to the channel assigned to the client if successful.
  341. * ERR_PTR for request failure.
  342. */
  343. struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
  344. {
  345. struct device *dev = cl->dev;
  346. struct mbox_controller *mbox;
  347. struct of_phandle_args spec;
  348. struct mbox_chan *chan;
  349. int ret;
  350. if (!dev || !dev->of_node) {
  351. pr_debug("%s: No owner device node\n", __func__);
  352. return ERR_PTR(-ENODEV);
  353. }
  354. mutex_lock(&con_mutex);
  355. if (of_parse_phandle_with_args(dev->of_node, "mboxes",
  356. "#mbox-cells", index, &spec)) {
  357. dev_dbg(dev, "%s: can't parse \"mboxes\" property\n", __func__);
  358. mutex_unlock(&con_mutex);
  359. return ERR_PTR(-ENODEV);
  360. }
  361. chan = ERR_PTR(-EPROBE_DEFER);
  362. list_for_each_entry(mbox, &mbox_cons, node)
  363. if (mbox->dev->of_node == spec.np) {
  364. chan = mbox->of_xlate(mbox, &spec);
  365. if (!IS_ERR(chan))
  366. break;
  367. }
  368. of_node_put(spec.np);
  369. if (IS_ERR(chan)) {
  370. mutex_unlock(&con_mutex);
  371. return chan;
  372. }
  373. ret = __mbox_bind_client(chan, cl);
  374. if (ret)
  375. chan = ERR_PTR(ret);
  376. mutex_unlock(&con_mutex);
  377. return chan;
  378. }
  379. EXPORT_SYMBOL_GPL(mbox_request_channel);
  380. struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl,
  381. const char *name)
  382. {
  383. struct device_node *np = cl->dev->of_node;
  384. struct property *prop;
  385. const char *mbox_name;
  386. int index = 0;
  387. if (!np) {
  388. dev_err(cl->dev, "%s() currently only supports DT\n", __func__);
  389. return ERR_PTR(-EINVAL);
  390. }
  391. if (!of_get_property(np, "mbox-names", NULL)) {
  392. dev_err(cl->dev,
  393. "%s() requires an \"mbox-names\" property\n", __func__);
  394. return ERR_PTR(-EINVAL);
  395. }
  396. of_property_for_each_string(np, "mbox-names", prop, mbox_name) {
  397. if (!strncmp(name, mbox_name, strlen(name)))
  398. return mbox_request_channel(cl, index);
  399. index++;
  400. }
  401. dev_err(cl->dev, "%s() could not locate channel named \"%s\"\n",
  402. __func__, name);
  403. return ERR_PTR(-EINVAL);
  404. }
  405. EXPORT_SYMBOL_GPL(mbox_request_channel_byname);
  406. /**
  407. * mbox_free_channel - The client relinquishes control of a mailbox
  408. * channel by this call.
  409. * @chan: The mailbox channel to be freed.
  410. */
  411. void mbox_free_channel(struct mbox_chan *chan)
  412. {
  413. unsigned long flags;
  414. if (!chan || !chan->cl)
  415. return;
  416. if (chan->mbox->ops->shutdown)
  417. chan->mbox->ops->shutdown(chan);
  418. /* The queued TX requests are simply aborted, no callbacks are made */
  419. spin_lock_irqsave(&chan->lock, flags);
  420. chan->cl = NULL;
  421. chan->active_req = NULL;
  422. if (chan->txdone_method == TXDONE_BY_ACK)
  423. chan->txdone_method = TXDONE_BY_POLL;
  424. module_put(chan->mbox->dev->driver->owner);
  425. spin_unlock_irqrestore(&chan->lock, flags);
  426. }
  427. EXPORT_SYMBOL_GPL(mbox_free_channel);
  428. static struct mbox_chan *
  429. of_mbox_index_xlate(struct mbox_controller *mbox,
  430. const struct of_phandle_args *sp)
  431. {
  432. int ind = sp->args[0];
  433. if (ind >= mbox->num_chans)
  434. return ERR_PTR(-EINVAL);
  435. return &mbox->chans[ind];
  436. }
  437. /**
  438. * mbox_controller_register - Register the mailbox controller
  439. * @mbox: Pointer to the mailbox controller.
  440. *
  441. * The controller driver registers its communication channels
  442. */
  443. int mbox_controller_register(struct mbox_controller *mbox)
  444. {
  445. int i, txdone;
  446. /* Sanity check */
  447. if (!mbox || !mbox->dev || !mbox->ops || !mbox->num_chans)
  448. return -EINVAL;
  449. if (mbox->txdone_irq)
  450. txdone = TXDONE_BY_IRQ;
  451. else if (mbox->txdone_poll)
  452. txdone = TXDONE_BY_POLL;
  453. else /* It has to be ACK then */
  454. txdone = TXDONE_BY_ACK;
  455. if (txdone == TXDONE_BY_POLL) {
  456. if (!mbox->ops->last_tx_done) {
  457. dev_err(mbox->dev, "last_tx_done method is absent\n");
  458. return -EINVAL;
  459. }
  460. hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC,
  461. HRTIMER_MODE_REL);
  462. mbox->poll_hrt.function = txdone_hrtimer;
  463. spin_lock_init(&mbox->poll_hrt_lock);
  464. }
  465. for (i = 0; i < mbox->num_chans; i++) {
  466. struct mbox_chan *chan = &mbox->chans[i];
  467. chan->cl = NULL;
  468. chan->mbox = mbox;
  469. chan->txdone_method = txdone;
  470. spin_lock_init(&chan->lock);
  471. }
  472. if (!mbox->of_xlate)
  473. mbox->of_xlate = of_mbox_index_xlate;
  474. mutex_lock(&con_mutex);
  475. list_add_tail(&mbox->node, &mbox_cons);
  476. mutex_unlock(&con_mutex);
  477. return 0;
  478. }
  479. EXPORT_SYMBOL_GPL(mbox_controller_register);
  480. /**
  481. * mbox_controller_unregister - Unregister the mailbox controller
  482. * @mbox: Pointer to the mailbox controller.
  483. */
  484. void mbox_controller_unregister(struct mbox_controller *mbox)
  485. {
  486. int i;
  487. if (!mbox)
  488. return;
  489. mutex_lock(&con_mutex);
  490. list_del(&mbox->node);
  491. for (i = 0; i < mbox->num_chans; i++)
  492. mbox_free_channel(&mbox->chans[i]);
  493. if (mbox->txdone_poll)
  494. hrtimer_cancel(&mbox->poll_hrt);
  495. mutex_unlock(&con_mutex);
  496. }
  497. EXPORT_SYMBOL_GPL(mbox_controller_unregister);
  498. static void __devm_mbox_controller_unregister(struct device *dev, void *res)
  499. {
  500. struct mbox_controller **mbox = res;
  501. mbox_controller_unregister(*mbox);
  502. }
  503. static int devm_mbox_controller_match(struct device *dev, void *res, void *data)
  504. {
  505. struct mbox_controller **mbox = res;
  506. if (WARN_ON(!mbox || !*mbox))
  507. return 0;
  508. return *mbox == data;
  509. }
  510. /**
  511. * devm_mbox_controller_register() - managed mbox_controller_register()
  512. * @dev: device owning the mailbox controller being registered
  513. * @mbox: mailbox controller being registered
  514. *
  515. * This function adds a device-managed resource that will make sure that the
  516. * mailbox controller, which is registered using mbox_controller_register()
  517. * as part of this function, will be unregistered along with the rest of
  518. * device-managed resources upon driver probe failure or driver removal.
  519. *
  520. * Returns 0 on success or a negative error code on failure.
  521. */
  522. int devm_mbox_controller_register(struct device *dev,
  523. struct mbox_controller *mbox)
  524. {
  525. struct mbox_controller **ptr;
  526. int err;
  527. ptr = devres_alloc(__devm_mbox_controller_unregister, sizeof(*ptr),
  528. GFP_KERNEL);
  529. if (!ptr)
  530. return -ENOMEM;
  531. err = mbox_controller_register(mbox);
  532. if (err < 0) {
  533. devres_free(ptr);
  534. return err;
  535. }
  536. devres_add(dev, ptr);
  537. *ptr = mbox;
  538. return 0;
  539. }
  540. EXPORT_SYMBOL_GPL(devm_mbox_controller_register);
  541. /**
  542. * devm_mbox_controller_unregister() - managed mbox_controller_unregister()
  543. * @dev: device owning the mailbox controller being unregistered
  544. * @mbox: mailbox controller being unregistered
  545. *
  546. * This function unregisters the mailbox controller and removes the device-
  547. * managed resource that was set up to automatically unregister the mailbox
  548. * controller on driver probe failure or driver removal. It's typically not
  549. * necessary to call this function.
  550. */
  551. void devm_mbox_controller_unregister(struct device *dev, struct mbox_controller *mbox)
  552. {
  553. WARN_ON(devres_release(dev, __devm_mbox_controller_unregister,
  554. devm_mbox_controller_match, mbox));
  555. }
  556. EXPORT_SYMBOL_GPL(devm_mbox_controller_unregister);