Loading drivers/mailbox/mailbox.c +26 −35 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ * Author: Jassi Brar <jassisinghbrar@gmail.com> */ #include <linux/cleanup.h> #include <linux/delay.h> #include <linux/device.h> #include <linux/err.h> Loading Loading @@ -370,13 +371,9 @@ static int __mbox_bind_client(struct mbox_chan *chan, struct mbox_client *cl) */ int mbox_bind_client(struct mbox_chan *chan, struct mbox_client *cl) { int ret; mutex_lock(&con_mutex); ret = __mbox_bind_client(chan, cl); mutex_unlock(&con_mutex); guard(mutex)(&con_mutex); return ret; return __mbox_bind_client(chan, cl); } EXPORT_SYMBOL_GPL(mbox_bind_client); Loading Loading @@ -417,8 +414,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) return ERR_PTR(ret); } mutex_lock(&con_mutex); scoped_guard(mutex, &con_mutex) { chan = ERR_PTR(-EPROBE_DEFER); list_for_each_entry(mbox, &mbox_cons, node) if (mbox->dev->of_node == spec.np) { Loading @@ -429,16 +425,14 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) of_node_put(spec.np); if (IS_ERR(chan)) { mutex_unlock(&con_mutex); if (IS_ERR(chan)) return chan; } ret = __mbox_bind_client(chan, cl); if (ret) chan = ERR_PTR(ret); } mutex_unlock(&con_mutex); return chan; } EXPORT_SYMBOL_GPL(mbox_request_channel); Loading Loading @@ -547,9 +541,8 @@ int mbox_controller_register(struct mbox_controller *mbox) if (!mbox->of_xlate) mbox->of_xlate = of_mbox_index_xlate; mutex_lock(&con_mutex); scoped_guard(mutex, &con_mutex) list_add_tail(&mbox->node, &mbox_cons); mutex_unlock(&con_mutex); return 0; } Loading @@ -566,8 +559,7 @@ void mbox_controller_unregister(struct mbox_controller *mbox) if (!mbox) return; mutex_lock(&con_mutex); scoped_guard(mutex, &con_mutex) { list_del(&mbox->node); for (i = 0; i < mbox->num_chans; i++) Loading @@ -575,8 +567,7 @@ void mbox_controller_unregister(struct mbox_controller *mbox) if (mbox->txdone_poll) hrtimer_cancel(&mbox->poll_hrt); mutex_unlock(&con_mutex); } } EXPORT_SYMBOL_GPL(mbox_controller_unregister); Loading Loading
drivers/mailbox/mailbox.c +26 −35 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ * Author: Jassi Brar <jassisinghbrar@gmail.com> */ #include <linux/cleanup.h> #include <linux/delay.h> #include <linux/device.h> #include <linux/err.h> Loading Loading @@ -370,13 +371,9 @@ static int __mbox_bind_client(struct mbox_chan *chan, struct mbox_client *cl) */ int mbox_bind_client(struct mbox_chan *chan, struct mbox_client *cl) { int ret; mutex_lock(&con_mutex); ret = __mbox_bind_client(chan, cl); mutex_unlock(&con_mutex); guard(mutex)(&con_mutex); return ret; return __mbox_bind_client(chan, cl); } EXPORT_SYMBOL_GPL(mbox_bind_client); Loading Loading @@ -417,8 +414,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) return ERR_PTR(ret); } mutex_lock(&con_mutex); scoped_guard(mutex, &con_mutex) { chan = ERR_PTR(-EPROBE_DEFER); list_for_each_entry(mbox, &mbox_cons, node) if (mbox->dev->of_node == spec.np) { Loading @@ -429,16 +425,14 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) of_node_put(spec.np); if (IS_ERR(chan)) { mutex_unlock(&con_mutex); if (IS_ERR(chan)) return chan; } ret = __mbox_bind_client(chan, cl); if (ret) chan = ERR_PTR(ret); } mutex_unlock(&con_mutex); return chan; } EXPORT_SYMBOL_GPL(mbox_request_channel); Loading Loading @@ -547,9 +541,8 @@ int mbox_controller_register(struct mbox_controller *mbox) if (!mbox->of_xlate) mbox->of_xlate = of_mbox_index_xlate; mutex_lock(&con_mutex); scoped_guard(mutex, &con_mutex) list_add_tail(&mbox->node, &mbox_cons); mutex_unlock(&con_mutex); return 0; } Loading @@ -566,8 +559,7 @@ void mbox_controller_unregister(struct mbox_controller *mbox) if (!mbox) return; mutex_lock(&con_mutex); scoped_guard(mutex, &con_mutex) { list_del(&mbox->node); for (i = 0; i < mbox->num_chans; i++) Loading @@ -575,8 +567,7 @@ void mbox_controller_unregister(struct mbox_controller *mbox) if (mbox->txdone_poll) hrtimer_cancel(&mbox->poll_hrt); mutex_unlock(&con_mutex); } } EXPORT_SYMBOL_GPL(mbox_controller_unregister); Loading