int num_buffers;
};
-struct most_c_obj {
+struct most_channel {
struct device dev;
struct completion cleanup;
atomic_t mbo_ref;
wait_queue_head_t hdm_fifo_wq;
};
-#define to_c_obj(d) container_of(d, struct most_c_obj, dev)
+#define to_channel(d) container_of(d, struct most_channel, dev)
struct most_inst_obj {
int dev_id;
struct most_interface *iface;
struct list_head channel_list;
- struct most_c_obj *channel[MAX_CHANNELS];
+ struct most_channel *channel[MAX_CHANNELS];
struct list_head list;
};
*/
static void most_free_mbo_coherent(struct mbo *mbo)
{
- struct most_c_obj *c = mbo->context;
+ struct most_channel *c = mbo->context;
u16 const coherent_buf_size = c->cfg.buffer_size + c->cfg.extra_len;
dma_free_coherent(NULL, coherent_buf_size, mbo->virt_address,
* flush_channel_fifos - clear the channel fifos
* @c: pointer to channel object
*/
-static void flush_channel_fifos(struct most_c_obj *c)
+static void flush_channel_fifos(struct most_channel *c)
{
unsigned long flags, hf_flags;
struct mbo *mbo, *tmp;
* flush_trash_fifo - clear the trash fifo
* @c: pointer to channel object
*/
-static int flush_trash_fifo(struct most_c_obj *c)
+static int flush_trash_fifo(struct most_channel *c)
{
struct mbo *mbo, *tmp;
unsigned long flags;
struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
unsigned int i = c->channel_id;
strcpy(buf, "");
struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
unsigned int i = c->channel_id;
strcpy(buf, "");
struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
unsigned int i = c->channel_id;
return snprintf(buf, PAGE_SIZE, "%d\n",
struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
unsigned int i = c->channel_id;
return snprintf(buf, PAGE_SIZE, "%d\n",
struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
unsigned int i = c->channel_id;
return snprintf(buf, PAGE_SIZE, "%d\n",
struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
unsigned int i = c->channel_id;
return snprintf(buf, PAGE_SIZE, "%d\n",
struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
return snprintf(buf, PAGE_SIZE, "%d\n", c->is_starving);
}
struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.num_buffers);
}
const char *buf,
size_t count)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
int ret = kstrtou16(buf, 0, &c->cfg.num_buffers);
struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.buffer_size);
}
const char *buf,
size_t count)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
int ret = kstrtou16(buf, 0, &c->cfg.buffer_size);
if (ret)
struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
if (c->cfg.direction & MOST_CH_TX)
return snprintf(buf, PAGE_SIZE, "tx\n");
const char *buf,
size_t count)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
if (!strcmp(buf, "dir_rx\n")) {
c->cfg.direction = MOST_CH_RX;
char *buf)
{
int i;
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
if (c->cfg.data_type & ch_data_type[i].most_ch_data_type)
size_t count)
{
int i;
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
if (!strcmp(buf, ch_data_type[i].name)) {
struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.subbuffer_size);
}
const char *buf,
size_t count)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
int ret = kstrtou16(buf, 0, &c->cfg.subbuffer_size);
if (ret)
struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.packets_per_xact);
}
const char *buf,
size_t count)
{
- struct most_c_obj *c = to_c_obj(dev);
+ struct most_channel *c = to_channel(dev);
int ret = kstrtou16(buf, 0, &c->cfg.packets_per_xact);
if (ret)
static ssize_t links_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
- struct most_c_obj *c;
+ struct most_channel *c;
struct most_inst_obj *i;
struct most_aim *aim = to_most_aim(dev);
int offs = 0;
*
* This retrieves the pointer to a channel object.
*/
-static struct
-most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch)
+static struct most_channel *get_channel_by_name(char *mdev, char *mdev_ch)
{
- struct most_c_obj *c, *tmp;
+ struct most_channel *c, *tmp;
struct most_inst_obj *i, *i_tmp;
int found = 0;
return c;
}
-static inline int link_channel_to_aim(struct most_c_obj *c,
- struct most_aim *aim, char *aim_param)
+static
+inline int link_channel_to_aim(struct most_channel *c, struct most_aim *aim,
+ char *aim_param)
{
int ret;
struct most_aim **aim_ptr;
const char *buf,
size_t len)
{
- struct most_c_obj *c;
+ struct most_channel *c;
struct most_aim *aim = to_most_aim(dev);
char buffer[STRING_SIZE];
char *mdev;
const char *buf,
size_t len)
{
- struct most_c_obj *c;
+ struct most_channel *c;
struct most_aim *aim = to_most_aim(dev);
char buffer[STRING_SIZE];
char *mdev;
static inline void trash_mbo(struct mbo *mbo)
{
unsigned long flags;
- struct most_c_obj *c = mbo->context;
+ struct most_channel *c = mbo->context;
spin_lock_irqsave(&c->fifo_lock, flags);
list_add(&mbo->list, &c->trash_fifo);
spin_unlock_irqrestore(&c->fifo_lock, flags);
}
-static bool hdm_mbo_ready(struct most_c_obj *c)
+static bool hdm_mbo_ready(struct most_channel *c)
{
bool empty;
static void nq_hdm_mbo(struct mbo *mbo)
{
unsigned long flags;
- struct most_c_obj *c = mbo->context;
+ struct most_channel *c = mbo->context;
spin_lock_irqsave(&c->fifo_lock, flags);
list_add_tail(&mbo->list, &c->halt_fifo);
static int hdm_enqueue_thread(void *data)
{
- struct most_c_obj *c = data;
+ struct most_channel *c = data;
struct mbo *mbo;
int ret;
typeof(c->iface->enqueue) enqueue = c->iface->enqueue;
return 0;
}
-static int run_enqueue_thread(struct most_c_obj *c, int channel_id)
+static int run_enqueue_thread(struct most_channel *c, int channel_id)
{
struct task_struct *task =
kthread_run(hdm_enqueue_thread, c, "hdm_fifo_%d",
static void arm_mbo(struct mbo *mbo)
{
unsigned long flags;
- struct most_c_obj *c;
+ struct most_channel *c;
BUG_ON((!mbo) || (!mbo->context));
c = mbo->context;
*
* Returns the number of allocated and enqueued MBOs.
*/
-static int arm_mbo_chain(struct most_c_obj *c, int dir,
+static int arm_mbo_chain(struct most_channel *c, int dir,
void (*compl)(struct mbo *))
{
unsigned int i;
*/
static void most_write_completion(struct mbo *mbo)
{
- struct most_c_obj *c;
+ struct most_channel *c;
BUG_ON((!mbo) || (!mbo->context));
int channel_has_mbo(struct most_interface *iface, int id, struct most_aim *aim)
{
struct most_inst_obj *inst = iface->priv;
- struct most_c_obj *c = inst->channel[id];
+ struct most_channel *c = inst->channel[id];
unsigned long flags;
int empty;
struct most_aim *aim)
{
struct mbo *mbo;
- struct most_c_obj *c;
+ struct most_channel *c;
struct most_inst_obj *inst = iface->priv;
unsigned long flags;
int *num_buffers_ptr;
*/
void most_put_mbo(struct mbo *mbo)
{
- struct most_c_obj *c = mbo->context;
+ struct most_channel *c = mbo->context;
if (c->cfg.direction == MOST_CH_TX) {
arm_mbo(mbo);
*/
static void most_read_completion(struct mbo *mbo)
{
- struct most_c_obj *c = mbo->context;
+ struct most_channel *c = mbo->context;
if (unlikely(c->is_poisoned || (mbo->status == MBO_E_CLOSE))) {
trash_mbo(mbo);
int num_buffer;
int ret;
struct most_inst_obj *inst = iface->priv;
- struct most_c_obj *c = inst->channel[id];
+ struct most_channel *c = inst->channel[id];
if (unlikely(!c))
return -EINVAL;
struct most_aim *aim)
{
struct most_inst_obj *inst;
- struct most_c_obj *c;
+ struct most_channel *c;
if (unlikely((!iface) || (id >= iface->num_channels) || (id < 0))) {
pr_err("Bad interface or index out of range\n");
*/
int most_deregister_aim(struct most_aim *aim)
{
- struct most_c_obj *c, *tmp;
+ struct most_channel *c, *tmp;
struct most_inst_obj *i, *i_tmp;
if (!aim) {
int id;
char name[STRING_SIZE];
char channel_name[STRING_SIZE];
- struct most_c_obj *c;
+ struct most_channel *c;
struct most_inst_obj *inst;
if (!iface || !iface->enqueue || !iface->configure ||
void most_deregister_interface(struct most_interface *iface)
{
int i;
- struct most_c_obj *c;
+ struct most_channel *c;
struct most_inst_obj *inst;
pr_info("deregistering MOST device %s (%s)\n", dev_name(&iface->dev), iface->description);
void most_stop_enqueue(struct most_interface *iface, int id)
{
struct most_inst_obj *inst = iface->priv;
- struct most_c_obj *c = inst->channel[id];
+ struct most_channel *c = inst->channel[id];
if (!c)
return;
void most_resume_enqueue(struct most_interface *iface, int id)
{
struct most_inst_obj *inst = iface->priv;
- struct most_c_obj *c = inst->channel[id];
+ struct most_channel *c = inst->channel[id];
if (!c)
return;