Lines Matching refs:mbo
91 struct mbo *_mbo = list_first_entry(ptr, struct mbo, list); \
100 static void most_free_mbo_coherent(struct mbo *mbo) in most_free_mbo_coherent() argument
102 struct most_channel *c = mbo->context; in most_free_mbo_coherent()
106 c->iface->dma_free(mbo, coherent_buf_size); in most_free_mbo_coherent()
108 kfree(mbo->virt_address); in most_free_mbo_coherent()
109 kfree(mbo); in most_free_mbo_coherent()
121 struct mbo *mbo, *tmp; in flush_channel_fifos() local
127 list_for_each_entry_safe(mbo, tmp, &c->fifo, list) { in flush_channel_fifos()
128 list_del(&mbo->list); in flush_channel_fifos()
130 most_free_mbo_coherent(mbo); in flush_channel_fifos()
136 list_for_each_entry_safe(mbo, tmp, &c->halt_fifo, list) { in flush_channel_fifos()
137 list_del(&mbo->list); in flush_channel_fifos()
139 most_free_mbo_coherent(mbo); in flush_channel_fifos()
154 struct mbo *mbo, *tmp; in flush_trash_fifo() local
158 list_for_each_entry_safe(mbo, tmp, &c->trash_fifo, list) { in flush_trash_fifo()
159 list_del(&mbo->list); in flush_trash_fifo()
161 most_free_mbo_coherent(mbo); in flush_trash_fifo()
736 static inline void trash_mbo(struct mbo *mbo) in trash_mbo() argument
739 struct most_channel *c = mbo->context; in trash_mbo()
742 list_add(&mbo->list, &c->trash_fifo); in trash_mbo()
760 static void nq_hdm_mbo(struct mbo *mbo) in nq_hdm_mbo() argument
763 struct most_channel *c = mbo->context; in nq_hdm_mbo()
766 list_add_tail(&mbo->list, &c->halt_fifo); in nq_hdm_mbo()
774 struct mbo *mbo; in hdm_enqueue_thread() local
791 mbo = list_pop_mbo(&c->halt_fifo); in hdm_enqueue_thread()
795 mbo->buffer_length = c->cfg.buffer_size; in hdm_enqueue_thread()
797 ret = enqueue(mbo->ifp, mbo->hdm_channel_id, mbo); in hdm_enqueue_thread()
802 nq_hdm_mbo(mbo); in hdm_enqueue_thread()
835 static void arm_mbo(struct mbo *mbo) in arm_mbo() argument
840 c = mbo->context; in arm_mbo()
843 trash_mbo(mbo); in arm_mbo()
848 ++*mbo->num_buffers_ptr; in arm_mbo()
849 list_add_tail(&mbo->list, &c->fifo); in arm_mbo()
873 void (*compl)(struct mbo *)) in arm_mbo_chain() argument
876 struct mbo *mbo; in arm_mbo_chain() local
883 mbo = kzalloc(sizeof(*mbo), GFP_KERNEL); in arm_mbo_chain()
884 if (!mbo) in arm_mbo_chain()
887 mbo->context = c; in arm_mbo_chain()
888 mbo->ifp = c->iface; in arm_mbo_chain()
889 mbo->hdm_channel_id = c->channel_id; in arm_mbo_chain()
891 mbo->virt_address = in arm_mbo_chain()
892 c->iface->dma_alloc(mbo, coherent_buf_size); in arm_mbo_chain()
894 mbo->virt_address = in arm_mbo_chain()
897 if (!mbo->virt_address) in arm_mbo_chain()
900 mbo->complete = compl; in arm_mbo_chain()
901 mbo->num_buffers_ptr = &dummy_num_buffers; in arm_mbo_chain()
903 nq_hdm_mbo(mbo); in arm_mbo_chain()
907 list_add_tail(&mbo->list, &c->fifo); in arm_mbo_chain()
914 kfree(mbo); in arm_mbo_chain()
925 void most_submit_mbo(struct mbo *mbo) in most_submit_mbo() argument
927 if (WARN_ONCE(!mbo || !mbo->context, in most_submit_mbo()
931 nq_hdm_mbo(mbo); in most_submit_mbo()
942 static void most_write_completion(struct mbo *mbo) in most_write_completion() argument
946 c = mbo->context; in most_write_completion()
947 if (unlikely(c->is_poisoned || (mbo->status == MBO_E_CLOSE))) in most_write_completion()
948 trash_mbo(mbo); in most_write_completion()
950 arm_mbo(mbo); in most_write_completion()
984 struct mbo *most_get_mbo(struct most_interface *iface, int id, in most_get_mbo()
987 struct mbo *mbo; in most_get_mbo() local
1013 mbo = list_pop_mbo(&c->fifo); in most_get_mbo()
1017 mbo->num_buffers_ptr = num_buffers_ptr; in most_get_mbo()
1018 mbo->buffer_length = c->cfg.buffer_size; in most_get_mbo()
1019 return mbo; in most_get_mbo()
1027 void most_put_mbo(struct mbo *mbo) in most_put_mbo() argument
1029 struct most_channel *c = mbo->context; in most_put_mbo()
1032 arm_mbo(mbo); in most_put_mbo()
1035 nq_hdm_mbo(mbo); in most_put_mbo()
1050 static void most_read_completion(struct mbo *mbo) in most_read_completion() argument
1052 struct most_channel *c = mbo->context; in most_read_completion()
1054 if (unlikely(c->is_poisoned || (mbo->status == MBO_E_CLOSE))) { in most_read_completion()
1055 trash_mbo(mbo); in most_read_completion()
1059 if (mbo->status == MBO_E_INVAL) { in most_read_completion()
1060 nq_hdm_mbo(mbo); in most_read_completion()
1069 c->pipe0.comp->rx_completion(mbo) == 0) in most_read_completion()
1073 c->pipe1.comp->rx_completion(mbo) == 0) in most_read_completion()
1076 most_put_mbo(mbo); in most_read_completion()