A module that is meant to make up the userspace experience of the driver is no longer referred to as AIM. Instead it is denoted as a component of the core. Further, it is understood as an integral part of the core, the purpose of which is to meaningfully enhance the core with new features (interface the userspace in a certain way). Therefore, this patch renames aim with component or its abbreviation comp. Signed-off-by: Christian Gromm <christian.gromm@xxxxxxxxxxxxx> --- v2: fix patch numeration v3: - add cover letter - create patches with -M switch to make file movement visible drivers/staging/most/cdev/cdev.c | 143 +++++++++++----------- drivers/staging/most/core.c | 236 ++++++++++++++++++------------------- drivers/staging/most/core.h | 15 ++- drivers/staging/most/net/net.c | 47 ++++---- drivers/staging/most/sound/sound.c | 18 +-- drivers/staging/most/video/video.c | 157 ++++++++++++------------ 6 files changed, 305 insertions(+), 311 deletions(-) diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c index 4b4c112..373baf2 100644 --- a/drivers/staging/most/cdev/cdev.c +++ b/drivers/staging/most/cdev/cdev.c @@ -24,13 +24,13 @@ #include <linux/idr.h> #include <most/core.h> -static dev_t aim_devno; -static struct class *aim_class; +static dev_t comp_devno; +static struct class *comp_class; static struct ida minor_id; static unsigned int major; -static struct most_aim cdev_aim; +static struct core_component cdev_comp; -struct aim_channel { +struct comp_channel { wait_queue_head_t wq; spinlock_t unlink; /* synchronization lock to unlink channels */ struct cdev cdev; @@ -46,28 +46,28 @@ struct aim_channel { struct list_head list; }; -#define to_channel(d) container_of(d, struct aim_channel, cdev) +#define to_channel(d) container_of(d, struct comp_channel, cdev) static struct list_head channel_list; static spinlock_t ch_list_lock; -static inline bool ch_has_mbo(struct aim_channel *c) +static inline bool ch_has_mbo(struct comp_channel *c) { - return channel_has_mbo(c->iface, c->channel_id, &cdev_aim) > 0; + return channel_has_mbo(c->iface, c->channel_id, &cdev_comp) > 0; } -static inline bool ch_get_mbo(struct aim_channel *c, struct mbo **mbo) +static inline bool ch_get_mbo(struct comp_channel *c, struct mbo **mbo) { if (!kfifo_peek(&c->fifo, mbo)) { - *mbo = most_get_mbo(c->iface, c->channel_id, &cdev_aim); + *mbo = most_get_mbo(c->iface, c->channel_id, &cdev_comp); if (*mbo) kfifo_in(&c->fifo, mbo, 1); } return *mbo; } -static struct aim_channel *get_channel(struct most_interface *iface, int id) +static struct comp_channel *get_channel(struct most_interface *iface, int id) { - struct aim_channel *c, *tmp; + struct comp_channel *c, *tmp; unsigned long flags; int found_channel = 0; @@ -84,27 +84,27 @@ static struct aim_channel *get_channel(struct most_interface *iface, int id) return c; } -static void stop_channel(struct aim_channel *c) +static void stop_channel(struct comp_channel *c) { struct mbo *mbo; while (kfifo_out((struct kfifo *)&c->fifo, &mbo, 1)) most_put_mbo(mbo); - most_stop_channel(c->iface, c->channel_id, &cdev_aim); + most_stop_channel(c->iface, c->channel_id, &cdev_comp); } -static void destroy_cdev(struct aim_channel *c) +static void destroy_cdev(struct comp_channel *c) { unsigned long flags; - device_destroy(aim_class, c->devno); + device_destroy(comp_class, c->devno); cdev_del(&c->cdev); spin_lock_irqsave(&ch_list_lock, flags); list_del(&c->list); spin_unlock_irqrestore(&ch_list_lock, flags); } -static void destroy_channel(struct aim_channel *c) +static void destroy_channel(struct comp_channel *c) { ida_simple_remove(&minor_id, MINOR(c->devno)); kfifo_free(&c->fifo); @@ -112,16 +112,16 @@ static void destroy_channel(struct aim_channel *c) } /** - * aim_open - implements the syscall to open the device + * comp_open - implements the syscall to open the device * @inode: inode pointer * @filp: file pointer * * This stores the channel pointer in the private data field of * the file structure and activates the channel within the core. */ -static int aim_open(struct inode *inode, struct file *filp) +static int comp_open(struct inode *inode, struct file *filp) { - struct aim_channel *c; + struct comp_channel *c; int ret; c = to_channel(inode->i_cdev); @@ -149,7 +149,7 @@ static int aim_open(struct inode *inode, struct file *filp) } c->mbo_offs = 0; - ret = most_start_channel(c->iface, c->channel_id, &cdev_aim); + ret = most_start_channel(c->iface, c->channel_id, &cdev_comp); if (!ret) c->access_ref = 1; mutex_unlock(&c->io_mutex); @@ -157,15 +157,15 @@ static int aim_open(struct inode *inode, struct file *filp) } /** - * aim_close - implements the syscall to close the device + * comp_close - implements the syscall to close the device * @inode: inode pointer * @filp: file pointer * * This stops the channel within the core. */ -static int aim_close(struct inode *inode, struct file *filp) +static int comp_close(struct inode *inode, struct file *filp) { - struct aim_channel *c = to_channel(inode->i_cdev); + struct comp_channel *c = to_channel(inode->i_cdev); mutex_lock(&c->io_mutex); spin_lock(&c->unlink); @@ -182,19 +182,19 @@ static int aim_close(struct inode *inode, struct file *filp) } /** - * aim_write - implements the syscall to write to the device + * comp_write - implements the syscall to write to the device * @filp: file pointer * @buf: pointer to user buffer * @count: number of bytes to write * @offset: offset from where to start writing */ -static ssize_t aim_write(struct file *filp, const char __user *buf, - size_t count, loff_t *offset) +static ssize_t comp_write(struct file *filp, const char __user *buf, + size_t count, loff_t *offset) { int ret; size_t to_copy, left; struct mbo *mbo = NULL; - struct aim_channel *c = filp->private_data; + struct comp_channel *c = filp->private_data; mutex_lock(&c->io_mutex); while (c->dev && !ch_get_mbo(c, &mbo)) { @@ -236,18 +236,18 @@ static ssize_t aim_write(struct file *filp, const char __user *buf, } /** - * aim_read - implements the syscall to read from the device + * comp_read - implements the syscall to read from the device * @filp: file pointer * @buf: pointer to user buffer * @count: number of bytes to read * @offset: offset from where to start reading */ static ssize_t -aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset) +comp_read(struct file *filp, char __user *buf, size_t count, loff_t *offset) { size_t to_copy, not_copied, copied; struct mbo *mbo; - struct aim_channel *c = filp->private_data; + struct comp_channel *c = filp->private_data; mutex_lock(&c->io_mutex); while (c->dev && !kfifo_peek(&c->fifo, &mbo)) { @@ -287,9 +287,9 @@ static ssize_t aim_write(struct file *filp, const char __user *buf, return copied; } -static unsigned int aim_poll(struct file *filp, poll_table *wait) +static unsigned int comp_poll(struct file *filp, poll_table *wait) { - struct aim_channel *c = filp->private_data; + struct comp_channel *c = filp->private_data; unsigned int mask = 0; poll_wait(filp, &c->wq, wait); @@ -309,24 +309,24 @@ static unsigned int aim_poll(struct file *filp, poll_table *wait) */ static const struct file_operations channel_fops = { .owner = THIS_MODULE, - .read = aim_read, - .write = aim_write, - .open = aim_open, - .release = aim_close, - .poll = aim_poll, + .read = comp_read, + .write = comp_write, + .open = comp_open, + .release = comp_close, + .poll = comp_poll, }; /** - * aim_disconnect_channel - disconnect a channel + * comp_disconnect_channel - disconnect a channel * @iface: pointer to interface instance * @channel_id: channel index * * This frees allocated memory and removes the cdev that represents this * channel in user space. */ -static int aim_disconnect_channel(struct most_interface *iface, int channel_id) +static int comp_disconnect_channel(struct most_interface *iface, int channel_id) { - struct aim_channel *c; + struct comp_channel *c; if (!iface) { pr_info("Bad interface pointer\n"); @@ -354,15 +354,15 @@ static int aim_disconnect_channel(struct most_interface *iface, int channel_id) } /** - * aim_rx_completion - completion handler for rx channels + * comp_rx_completion - completion handler for rx channels * @mbo: pointer to buffer object that has completed * * This searches for the channel linked to this MBO and stores it in the local * fifo buffer. */ -static int aim_rx_completion(struct mbo *mbo) +static int comp_rx_completion(struct mbo *mbo) { - struct aim_channel *c; + struct comp_channel *c; if (!mbo) return -EINVAL; @@ -387,15 +387,15 @@ static int aim_rx_completion(struct mbo *mbo) } /** - * aim_tx_completion - completion handler for tx channels + * comp_tx_completion - completion handler for tx channels * @iface: pointer to interface instance * @channel_id: channel index/ID * * This wakes sleeping processes in the wait-queue. */ -static int aim_tx_completion(struct most_interface *iface, int channel_id) +static int comp_tx_completion(struct most_interface *iface, int channel_id) { - struct aim_channel *c; + struct comp_channel *c; if (!iface) { pr_info("Bad interface pointer\n"); @@ -414,7 +414,7 @@ static int aim_tx_completion(struct most_interface *iface, int channel_id) } /** - * aim_probe - probe function of the driver module + * comp_probe - probe function of the driver module * @iface: pointer to interface instance * @channel_id: channel index/ID * @cfg: pointer to actual channel configuration @@ -425,17 +425,16 @@ static int aim_tx_completion(struct most_interface *iface, int channel_id) * * Returns 0 on success or error code otherwise. */ -static int aim_probe(struct most_interface *iface, int channel_id, - struct most_channel_config *cfg, - char *name) +static int comp_probe(struct most_interface *iface, int channel_id, + struct most_channel_config *cfg, char *name) { - struct aim_channel *c; + struct comp_channel *c; unsigned long cl_flags; int retval; int current_minor; if ((!iface) || (!cfg) || (!name)) { - pr_info("Probing AIM with bad arguments"); + pr_info("Probing component with bad arguments"); return -EINVAL; } c = get_channel(iface, channel_id); @@ -472,7 +471,7 @@ static int aim_probe(struct most_interface *iface, int channel_id, spin_lock_irqsave(&ch_list_lock, cl_flags); list_add_tail(&c->list, &channel_list); spin_unlock_irqrestore(&ch_list_lock, cl_flags); - c->dev = device_create(aim_class, + c->dev = device_create(comp_class, NULL, c->devno, NULL, @@ -497,12 +496,12 @@ static int aim_probe(struct most_interface *iface, int channel_id, return retval; } -static struct most_aim cdev_aim = { - .name = "aim_cdev", - .probe_channel = aim_probe, - .disconnect_channel = aim_disconnect_channel, - .rx_completion = aim_rx_completion, - .tx_completion = aim_tx_completion, +static struct core_component cdev_comp = { + .name = "cdev", + .probe_channel = comp_probe, + .disconnect_channel = comp_disconnect_channel, + .rx_completion = comp_rx_completion, + .tx_completion = comp_tx_completion, }; static int __init mod_init(void) @@ -515,26 +514,26 @@ static int __init mod_init(void) spin_lock_init(&ch_list_lock); ida_init(&minor_id); - err = alloc_chrdev_region(&aim_devno, 0, 50, "cdev"); + err = alloc_chrdev_region(&comp_devno, 0, 50, "cdev"); if (err < 0) goto dest_ida; - major = MAJOR(aim_devno); + major = MAJOR(comp_devno); - aim_class = class_create(THIS_MODULE, "most_cdev_aim"); - if (IS_ERR(aim_class)) { + comp_class = class_create(THIS_MODULE, "most_cdev_comp"); + if (IS_ERR(comp_class)) { pr_err("no udev support\n"); - err = PTR_ERR(aim_class); + err = PTR_ERR(comp_class); goto free_cdev; } - err = most_register_aim(&cdev_aim); + err = most_register_component(&cdev_comp); if (err) goto dest_class; return 0; dest_class: - class_destroy(aim_class); + class_destroy(comp_class); free_cdev: - unregister_chrdev_region(aim_devno, 1); + unregister_chrdev_region(comp_devno, 1); dest_ida: ida_destroy(&minor_id); return err; @@ -542,18 +541,18 @@ static int __init mod_init(void) static void __exit mod_exit(void) { - struct aim_channel *c, *tmp; + struct comp_channel *c, *tmp; pr_info("exit module\n"); - most_deregister_aim(&cdev_aim); + most_deregister_component(&cdev_comp); list_for_each_entry_safe(c, tmp, &channel_list, list) { destroy_cdev(c); destroy_channel(c); } - class_destroy(aim_class); - unregister_chrdev_region(aim_devno, 1); + class_destroy(comp_class); + unregister_chrdev_region(comp_devno, 1); ida_destroy(&minor_id); } @@ -561,4 +560,4 @@ static void __exit mod_exit(void) module_exit(mod_exit); MODULE_AUTHOR("Christian Gromm <christian.gromm@xxxxxxxxxxxxx>"); MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("character device AIM for mostcore"); +MODULE_DESCRIPTION("character device component for mostcore"); diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index 50b57de..7961690 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c @@ -40,13 +40,13 @@ struct device_driver drv; struct bus_type bus; struct class *class; - struct list_head mod_list; + struct list_head comp_list; } mc; #define to_driver(d) container_of(d, struct mostcore, drv); struct pipe { - struct most_aim *aim; + struct core_component *comp; int refs; int num_buffers; }; @@ -545,17 +545,13 @@ static ssize_t interface_show(struct device *dev, NULL, }; - -/* ___ ___ - * ___A I M___ - */ -static struct most_aim *match_module(char *name) +static struct core_component *match_component(char *name) { - struct most_aim *aim; + struct core_component *comp; - list_for_each_entry(aim, &mc.mod_list, list) { - if (!strcmp(aim->name, name)) - return aim; + list_for_each_entry(comp, &mc.comp_list, list) { + if (!strcmp(comp->name, name)) + return comp; } return NULL; } @@ -568,19 +564,19 @@ int print_links(struct device *dev, void *data) struct most_interface *iface = to_most_interface(dev); list_for_each_entry(c, &iface->p->channel_list, list) { - if (c->pipe0.aim) { + if (c->pipe0.comp) { offs += snprintf(buf + offs, PAGE_SIZE - offs, "%s:%s:%s\n", - c->pipe0.aim->name, + c->pipe0.comp->name, dev_name(&iface->dev), dev_name(&c->dev)); } - if (c->pipe1.aim) { + if (c->pipe1.comp) { offs += snprintf(buf + offs, PAGE_SIZE - offs, "%s:%s:%s\n", - c->pipe1.aim->name, + c->pipe1.comp->name, dev_name(&iface->dev), dev_name(&c->dev)); } @@ -594,14 +590,14 @@ static ssize_t links_show(struct device_driver *drv, char *buf) return strlen(buf); } -static ssize_t modules_show(struct device_driver *drv, char *buf) +static ssize_t components_show(struct device_driver *drv, char *buf) { - struct most_aim *aim; + struct core_component *comp; int offs = 0; - list_for_each_entry(aim, &mc.mod_list, list) { + list_for_each_entry(comp, &mc.comp_list, list) { offs += snprintf(buf + offs, PAGE_SIZE - offs, "%s\n", - aim->name); + comp->name); } return offs; } @@ -678,24 +674,24 @@ static struct most_channel *get_channel(char *mdev, char *mdev_ch) return NULL; } -static int link_channel_to_aim(struct most_channel *c, struct most_aim *aim, - char *aim_param) +static int link_channel_to_component(struct most_channel *c, + struct core_component *comp, + char *comp_param) { int ret; - struct most_aim **aim_ptr; + struct core_component **comp_ptr; - if (!c->pipe0.aim) - aim_ptr = &c->pipe0.aim; - else if (!c->pipe1.aim) - aim_ptr = &c->pipe1.aim; + if (!c->pipe0.comp) + comp_ptr = &c->pipe0.comp; + else if (!c->pipe1.comp) + comp_ptr = &c->pipe1.comp; else return -ENOSPC; - *aim_ptr = aim; - ret = aim->probe_channel(c->iface, c->channel_id, - &c->cfg, aim_param); + *comp_ptr = comp; + ret = comp->probe_channel(c->iface, c->channel_id, &c->cfg, comp_param); if (ret) { - *aim_ptr = NULL; + *comp_ptr = NULL; return ret; } @@ -704,18 +700,18 @@ static int link_channel_to_aim(struct most_channel *c, struct most_aim *aim, /** * add_link_store - store() function for add_link attribute - * @aim_obj: pointer to AIM object + * @comp_obj: pointer to component object * @attr: its attributes * @buf: buffer * @len: buffer length * * This parses the string given by buf and splits it into * three substrings. Note: third substring is optional. In case a cdev - * AIM is loaded the optional 3rd substring will make up the name of + * component is loaded the optional 3rd substring will make up the name of * device node in the /dev directory. If omitted, the device node will * inherit the channel's name within sysfs. * - * Searches for a pair of device and channel and probes the AIM + * Searches for a pair of device and channel and probes the component * * Example: * (1) echo "mdev0:ch6:my_rxchannel" >add_link @@ -729,33 +725,34 @@ static ssize_t add_link_store(struct device_driver *drv, size_t len) { struct most_channel *c; - struct most_aim *aim; + struct core_component *comp; char buffer[STRING_SIZE]; char *mdev; char *mdev_ch; - char *aim_name; - char *aim_param; + char *comp_name; + char *comp_param; char devnod_buf[STRING_SIZE]; int ret; size_t max_len = min_t(size_t, len + 1, STRING_SIZE); strlcpy(buffer, buf, max_len); - ret = split_string(buffer, &mdev, &mdev_ch, &aim_name, &aim_param); + ret = split_string(buffer, &mdev, &mdev_ch, &comp_name, + &comp_param); if (ret) return ret; - aim = match_module(aim_name); - if (!aim_param || *aim_param == 0) { + comp = match_component(comp_name); + if (!comp_param || *comp_param == 0) { snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev, mdev_ch); - aim_param = devnod_buf; + comp_param = devnod_buf; } c = get_channel(mdev, mdev_ch); if (!c) return -ENODEV; - ret = link_channel_to_aim(c, aim, aim_param); + ret = link_channel_to_component(c, comp, comp_param); if (ret) return ret; @@ -764,7 +761,7 @@ static ssize_t add_link_store(struct device_driver *drv, /** * remove_link_store - store function for remove_link attribute - * @aim_obj: pointer to AIM object + * @comp_obj: pointer to component object * @attr: its attributes * @buf: buffer * @len: buffer length @@ -777,53 +774,53 @@ static ssize_t remove_link_store(struct device_driver *drv, size_t len) { struct most_channel *c; - struct most_aim *aim; + struct core_component *comp; char buffer[STRING_SIZE]; char *mdev; char *mdev_ch; - char *aim_name; + char *comp_name; int ret; size_t max_len = min_t(size_t, len + 1, STRING_SIZE); strlcpy(buffer, buf, max_len); - ret = split_string(buffer, &mdev, &mdev_ch, &aim_name, NULL); + ret = split_string(buffer, &mdev, &mdev_ch, &comp_name, NULL); if (ret) return ret; - aim = match_module(aim_name); + comp = match_component(comp_name); c = get_channel(mdev, mdev_ch); if (!c) return -ENODEV; - if (aim->disconnect_channel(c->iface, c->channel_id)) + if (comp->disconnect_channel(c->iface, c->channel_id)) return -EIO; - if (c->pipe0.aim == aim) - c->pipe0.aim = NULL; - if (c->pipe1.aim == aim) - c->pipe1.aim = NULL; + if (c->pipe0.comp == comp) + c->pipe0.comp = NULL; + if (c->pipe1.comp == comp) + c->pipe1.comp = NULL; return len; } #define DRV_ATTR(_name) &driver_attr_##_name.attr static DRIVER_ATTR_RO(links); -static DRIVER_ATTR_RO(modules); +static DRIVER_ATTR_RO(components); static DRIVER_ATTR_WO(add_link); static DRIVER_ATTR_WO(remove_link); -static struct attribute *module_attrs[] = { +static struct attribute *mc_attrs[] = { DRV_ATTR(links), - DRV_ATTR(modules), + DRV_ATTR(components), DRV_ATTR(add_link), DRV_ATTR(remove_link), NULL, }; -static struct attribute_group module_attr_group = { - .attrs = module_attrs, +static struct attribute_group mc_attr_group = { + .attrs = mc_attrs, }; -static const struct attribute_group *module_attr_groups[] = { - &module_attr_group, +static const struct attribute_group *mc_attr_groups[] = { + &mc_attr_group, NULL, }; /* ___ ___ @@ -927,7 +924,7 @@ static int run_enqueue_thread(struct most_channel *c, int channel_id) * * In case the MBO belongs to a channel that recently has been * poisoned, the MBO is scheduled to be trashed. - * Calls the completion handler of an attached AIM. + * Calls the completion handler of an attached component. */ static void arm_mbo(struct mbo *mbo) { @@ -947,11 +944,11 @@ static void arm_mbo(struct mbo *mbo) list_add_tail(&mbo->list, &c->fifo); spin_unlock_irqrestore(&c->fifo_lock, flags); - if (c->pipe0.refs && c->pipe0.aim->tx_completion) - c->pipe0.aim->tx_completion(c->iface, c->channel_id); + if (c->pipe0.refs && c->pipe0.comp->tx_completion) + c->pipe0.comp->tx_completion(c->iface, c->channel_id); - if (c->pipe1.refs && c->pipe1.aim->tx_completion) - c->pipe1.aim->tx_completion(c->iface, c->channel_id); + if (c->pipe1.refs && c->pipe1.comp->tx_completion) + c->pipe1.comp->tx_completion(c->iface, c->channel_id); } /** @@ -1048,7 +1045,8 @@ static void most_write_completion(struct mbo *mbo) arm_mbo(mbo); } -int channel_has_mbo(struct most_interface *iface, int id, struct most_aim *aim) +int channel_has_mbo(struct most_interface *iface, int id, + struct core_component *comp) { struct most_channel *c = iface->p->channel[id]; unsigned long flags; @@ -1058,8 +1056,8 @@ int channel_has_mbo(struct most_interface *iface, int id, struct most_aim *aim) return -EINVAL; if (c->pipe0.refs && c->pipe1.refs && - ((aim == c->pipe0.aim && c->pipe0.num_buffers <= 0) || - (aim == c->pipe1.aim && c->pipe1.num_buffers <= 0))) + ((comp == c->pipe0.comp && c->pipe0.num_buffers <= 0) || + (comp == c->pipe1.comp && c->pipe1.num_buffers <= 0))) return 0; spin_lock_irqsave(&c->fifo_lock, flags); @@ -1078,7 +1076,7 @@ int channel_has_mbo(struct most_interface *iface, int id, struct most_aim *aim) * Returns a pointer to MBO on success or NULL otherwise. */ struct mbo *most_get_mbo(struct most_interface *iface, int id, - struct most_aim *aim) + struct core_component *comp) { struct mbo *mbo; struct most_channel *c; @@ -1090,13 +1088,13 @@ struct mbo *most_get_mbo(struct most_interface *iface, int id, return NULL; if (c->pipe0.refs && c->pipe1.refs && - ((aim == c->pipe0.aim && c->pipe0.num_buffers <= 0) || - (aim == c->pipe1.aim && c->pipe1.num_buffers <= 0))) + ((comp == c->pipe0.comp && c->pipe0.num_buffers <= 0) || + (comp == c->pipe1.comp && c->pipe1.num_buffers <= 0))) return NULL; - if (aim == c->pipe0.aim) + if (comp == c->pipe0.comp) num_buffers_ptr = &c->pipe0.num_buffers; - else if (aim == c->pipe1.aim) + else if (comp == c->pipe1.comp) num_buffers_ptr = &c->pipe1.num_buffers; else num_buffers_ptr = &dummy_num_buffers; @@ -1141,7 +1139,7 @@ void most_put_mbo(struct mbo *mbo) * hardware and copied to the buffer of the MBO. * * In case the channel has been poisoned it puts the buffer in the trash queue. - * Otherwise, it passes the buffer to an AIM for further processing. + * Otherwise, it passes the buffer to an component for further processing. */ static void most_read_completion(struct mbo *mbo) { @@ -1161,12 +1159,12 @@ static void most_read_completion(struct mbo *mbo) if (atomic_sub_and_test(1, &c->mbo_nq_level)) c->is_starving = 1; - if (c->pipe0.refs && c->pipe0.aim->rx_completion && - c->pipe0.aim->rx_completion(mbo) == 0) + if (c->pipe0.refs && c->pipe0.comp->rx_completion && + c->pipe0.comp->rx_completion(mbo) == 0) return; - if (c->pipe1.refs && c->pipe1.aim->rx_completion && - c->pipe1.aim->rx_completion(mbo) == 0) + if (c->pipe1.refs && c->pipe1.comp->rx_completion && + c->pipe1.comp->rx_completion(mbo) == 0) return; most_put_mbo(mbo); @@ -1183,7 +1181,7 @@ static void most_read_completion(struct mbo *mbo) * Returns 0 on success or error code otherwise. */ int most_start_channel(struct most_interface *iface, int id, - struct most_aim *aim) + struct core_component *comp) { int num_buffer; int ret; @@ -1194,7 +1192,7 @@ int most_start_channel(struct most_interface *iface, int id, mutex_lock(&c->start_mutex); if (c->pipe0.refs + c->pipe1.refs > 0) - goto out; /* already started by other aim */ + goto out; /* already started by other component */ if (!try_module_get(iface->mod)) { pr_info("failed to acquire HDM lock\n"); @@ -1233,9 +1231,9 @@ int most_start_channel(struct most_interface *iface, int id, atomic_set(&c->mbo_ref, num_buffer); out: - if (aim == c->pipe0.aim) + if (comp == c->pipe0.comp) c->pipe0.refs++; - if (aim == c->pipe1.aim) + if (comp == c->pipe1.comp) c->pipe1.refs++; mutex_unlock(&c->start_mutex); return 0; @@ -1253,7 +1251,7 @@ int most_start_channel(struct most_interface *iface, int id, * @id: channel ID */ int most_stop_channel(struct most_interface *iface, int id, - struct most_aim *aim) + struct core_component *comp) { struct most_channel *c; @@ -1298,9 +1296,9 @@ int most_stop_channel(struct most_interface *iface, int id, c->is_poisoned = false; out: - if (aim == c->pipe0.aim) + if (comp == c->pipe0.comp) c->pipe0.refs--; - if (aim == c->pipe1.aim) + if (comp == c->pipe1.comp) c->pipe1.refs--; mutex_unlock(&c->start_mutex); return 0; @@ -1308,56 +1306,56 @@ int most_stop_channel(struct most_interface *iface, int id, EXPORT_SYMBOL_GPL(most_stop_channel); /** - * most_register_aim - registers an AIM (driver) with the core - * @aim: instance of AIM to be registered + * most_register_component - registers an component (driver) with the core + * @comp: instance of component to be registered */ -int most_register_aim(struct most_aim *aim) +int most_register_component(struct core_component *comp) { - if (!aim) { - pr_err("Bad driver\n"); + if (!comp) { + pr_err("Bad component\n"); return -EINVAL; } - list_add_tail(&aim->list, &mc.mod_list); - pr_info("registered new application interfacing module %s\n", aim->name); + list_add_tail(&comp->list, &mc.comp_list); + pr_info("registered new core component %s\n", comp->name); return 0; } -EXPORT_SYMBOL_GPL(most_register_aim); +EXPORT_SYMBOL_GPL(most_register_component); static int disconnect_channels(struct device *dev, void *data) { struct most_interface *iface; struct most_channel *c, *tmp; - struct most_aim *aim = data; + struct core_component *comp = data; iface = to_most_interface(dev); list_for_each_entry_safe(c, tmp, &iface->p->channel_list, list) { - if (c->pipe0.aim == aim || c->pipe1.aim == aim) - aim->disconnect_channel(c->iface, c->channel_id); - if (c->pipe0.aim == aim) - c->pipe0.aim = NULL; - if (c->pipe1.aim == aim) - c->pipe1.aim = NULL; + if (c->pipe0.comp == comp || c->pipe1.comp == comp) + comp->disconnect_channel(c->iface, c->channel_id); + if (c->pipe0.comp == comp) + c->pipe0.comp = NULL; + if (c->pipe1.comp == comp) + c->pipe1.comp = NULL; } return 0; } /** - * most_deregister_aim - deregisters an AIM (driver) with the core - * @aim: AIM to be removed + * most_deregister_component - deregisters an component (driver) with the core + * @comp: component to be removed */ -int most_deregister_aim(struct most_aim *aim) +int most_deregister_component(struct core_component *comp) { - if (!aim) { - pr_err("Bad driver\n"); + if (!comp) { + pr_err("Bad component\n"); return -EINVAL; } - bus_for_each_dev(&mc.bus, NULL, aim, disconnect_channels); - list_del(&aim->list); - pr_info("deregistering module %s\n", aim->name); + bus_for_each_dev(&mc.bus, NULL, comp, disconnect_channels); + list_del(&comp->list); + pr_info("deregistering component %s\n", comp->name); return 0; } -EXPORT_SYMBOL_GPL(most_deregister_aim); +EXPORT_SYMBOL_GPL(most_deregister_component); static void release_interface(struct device *dev) { @@ -1457,7 +1455,7 @@ int most_register_interface(struct most_interface *iface) mutex_init(&c->nq_mutex); list_add_tail(&c->list, &iface->p->channel_list); } - pr_info("registered new MOST device mdev%d (%s)\n", + pr_info("registered new device mdev%d (%s)\n", id, iface->description); return 0; @@ -1489,17 +1487,17 @@ void most_deregister_interface(struct most_interface *iface) int i; struct most_channel *c; - pr_info("deregistering MOST device %s (%s)\n", dev_name(&iface->dev), iface->description); + pr_info("deregistering device %s (%s)\n", dev_name(&iface->dev), iface->description); for (i = 0; i < iface->num_channels; i++) { c = iface->p->channel[i]; - if (c->pipe0.aim) - c->pipe0.aim->disconnect_channel(c->iface, + if (c->pipe0.comp) + c->pipe0.comp->disconnect_channel(c->iface, c->channel_id); - if (c->pipe1.aim) - c->pipe1.aim->disconnect_channel(c->iface, + if (c->pipe1.comp) + c->pipe1.comp->disconnect_channel(c->iface, c->channel_id); - c->pipe0.aim = NULL; - c->pipe1.aim = NULL; + c->pipe0.comp = NULL; + c->pipe1.comp = NULL; list_del(&c->list); device_unregister(&c->dev); kfree(c); @@ -1567,14 +1565,14 @@ static int __init most_init(void) int err; pr_info("init()\n"); - INIT_LIST_HEAD(&mc.mod_list); + INIT_LIST_HEAD(&mc.comp_list); ida_init(&mdev_id); mc.bus.name = "most", mc.bus.match = most_match, - mc.drv.name = "most_core", + mc.drv.name = "core", mc.drv.bus = &mc.bus, - mc.drv.groups = module_attr_groups; + mc.drv.groups = mc_attr_groups; err = bus_register(&mc.bus); if (err) { @@ -1593,7 +1591,7 @@ static int __init most_init(void) pr_info("Cannot register core driver\n"); goto exit_class; } - mc.dev.init_name = "most_bus"; + mc.dev.init_name = "most"; mc.dev.release = release_most_sub; if (device_register(&mc.dev)) { err = -ENOMEM; diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h index 09fa472..d74276d 100644 --- a/drivers/staging/most/core.h +++ b/drivers/staging/most/core.h @@ -268,7 +268,7 @@ struct most_interface { * @tx_completion: completion handler for transmitted packets * @context: context pointer to be used by mostcore */ -struct most_aim { +struct core_component { struct list_head list; const char *name; int (*probe_channel)(struct most_interface *iface, int channel_idx, @@ -279,7 +279,6 @@ struct most_aim { int (*tx_completion)(struct most_interface *iface, int channel_idx); }; -#define to_most_aim(d) container_of(d, struct most_aim, dev) /** * most_register_interface - Registers instance of the interface. * @iface: Pointer to the interface instance description. @@ -314,16 +313,16 @@ struct most_aim { * in wait fifo. */ void most_resume_enqueue(struct most_interface *iface, int channel_idx); -int most_register_aim(struct most_aim *aim); -int most_deregister_aim(struct most_aim *aim); +int most_register_component(struct core_component *comp); +int most_deregister_component(struct core_component *comp); struct mbo *most_get_mbo(struct most_interface *iface, int channel_idx, - struct most_aim *); + struct core_component *comp); void most_put_mbo(struct mbo *mbo); int channel_has_mbo(struct most_interface *iface, int channel_idx, - struct most_aim *aim); + struct core_component *comp); int most_start_channel(struct most_interface *iface, int channel_idx, - struct most_aim *); + struct core_component *comp); int most_stop_channel(struct most_interface *iface, int channel_idx, - struct most_aim *); + struct core_component *comp); #endif /* MOST_CORE_H_ */ diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c index 194fe63..01b36ad 100644 --- a/drivers/staging/most/net/net.c +++ b/drivers/staging/most/net/net.c @@ -1,5 +1,5 @@ /* - * Networking AIM - Networking Application Interface Module for MostCore + * Networking component - Networking Application Interface Module for MostCore * * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG * @@ -74,7 +74,7 @@ struct net_dev_context { static struct list_head net_devices = LIST_HEAD_INIT(net_devices); static struct mutex probe_disc_mt; /* ch->linked = true, most_nd_open */ static struct spinlock list_lock; /* list_head, ch->linked = false, dev_hold */ -static struct most_aim aim; +static struct core_component comp; static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo) { @@ -184,15 +184,15 @@ static int most_nd_open(struct net_device *dev) mutex_lock(&probe_disc_mt); - if (most_start_channel(nd->iface, nd->rx.ch_id, &aim)) { + if (most_start_channel(nd->iface, nd->rx.ch_id, &comp)) { netdev_err(dev, "most_start_channel() failed\n"); ret = -EBUSY; goto unlock; } - if (most_start_channel(nd->iface, nd->tx.ch_id, &aim)) { + if (most_start_channel(nd->iface, nd->tx.ch_id, &comp)) { netdev_err(dev, "most_start_channel() failed\n"); - most_stop_channel(nd->iface, nd->rx.ch_id, &aim); + most_stop_channel(nd->iface, nd->rx.ch_id, &comp); ret = -EBUSY; goto unlock; } @@ -218,8 +218,8 @@ static int most_nd_stop(struct net_device *dev) netif_stop_queue(dev); if (nd->iface->request_netinfo) nd->iface->request_netinfo(nd->iface, nd->tx.ch_id, NULL); - most_stop_channel(nd->iface, nd->rx.ch_id, &aim); - most_stop_channel(nd->iface, nd->tx.ch_id, &aim); + most_stop_channel(nd->iface, nd->rx.ch_id, &comp); + most_stop_channel(nd->iface, nd->tx.ch_id, &comp); return 0; } @@ -231,7 +231,7 @@ static netdev_tx_t most_nd_start_xmit(struct sk_buff *skb, struct mbo *mbo; int ret; - mbo = most_get_mbo(nd->iface, nd->tx.ch_id, &aim); + mbo = most_get_mbo(nd->iface, nd->tx.ch_id, &comp); if (!mbo) { netif_stop_queue(dev); @@ -296,9 +296,8 @@ static struct net_dev_context *get_net_dev_hold(struct most_interface *iface) return nd; } -static int aim_probe_channel(struct most_interface *iface, int channel_idx, - struct most_channel_config *ccfg, - char *name) +static int comp_probe_channel(struct most_interface *iface, int channel_idx, + struct most_channel_config *ccfg, char *name) { struct net_dev_context *nd; struct net_dev_channel *ch; @@ -353,8 +352,8 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, return ret; } -static int aim_disconnect_channel(struct most_interface *iface, - int channel_idx) +static int comp_disconnect_channel(struct most_interface *iface, + int channel_idx) { struct net_dev_context *nd; struct net_dev_channel *ch; @@ -400,8 +399,8 @@ static int aim_disconnect_channel(struct most_interface *iface, return ret; } -static int aim_resume_tx_channel(struct most_interface *iface, - int channel_idx) +static int comp_resume_tx_channel(struct most_interface *iface, + int channel_idx) { struct net_dev_context *nd; @@ -419,7 +418,7 @@ static int aim_resume_tx_channel(struct most_interface *iface, return 0; } -static int aim_rx_data(struct mbo *mbo) +static int comp_rx_data(struct mbo *mbo) { const u32 zero = 0; struct net_dev_context *nd; @@ -501,24 +500,24 @@ static int aim_rx_data(struct mbo *mbo) return ret; } -static struct most_aim aim = { - .name = "aim_networking", - .probe_channel = aim_probe_channel, - .disconnect_channel = aim_disconnect_channel, - .tx_completion = aim_resume_tx_channel, - .rx_completion = aim_rx_data, +static struct core_component comp = { + .name = "net", + .probe_channel = comp_probe_channel, + .disconnect_channel = comp_disconnect_channel, + .tx_completion = comp_resume_tx_channel, + .rx_completion = comp_rx_data, }; static int __init most_net_init(void) { spin_lock_init(&list_lock); mutex_init(&probe_disc_mt); - return most_register_aim(&aim); + return most_register_component(&comp); } static void __exit most_net_exit(void) { - most_deregister_aim(&aim); + most_deregister_component(&comp); } /** diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c index 4c3397a..a409cd5 100644 --- a/drivers/staging/most/sound/sound.c +++ b/drivers/staging/most/sound/sound.c @@ -24,10 +24,10 @@ #include <linux/kthread.h> #include <most/core.h> -#define DRIVER_NAME "aim_sound" +#define DRIVER_NAME "sound" static struct list_head dev_list; -static struct most_aim audio_aim; +static struct core_component snd_component; /** * struct channel - private structure to keep channel specific data @@ -240,7 +240,7 @@ static int playback_thread(void *data) kthread_should_stop() || (channel->is_stream_running && (mbo = most_get_mbo(channel->iface, channel->id, - &audio_aim)))); + &snd_component)))); if (!mbo) continue; @@ -283,7 +283,7 @@ static int pcm_open(struct snd_pcm_substream *substream) } } - if (most_start_channel(channel->iface, channel->id, &audio_aim)) { + if (most_start_channel(channel->iface, channel->id, &snd_component)) { pr_err("most_start_channel() failed!\n"); if (cfg->direction == MOST_CH_TX) kthread_stop(channel->playback_task); @@ -310,7 +310,7 @@ static int pcm_close(struct snd_pcm_substream *substream) if (channel->cfg->direction == MOST_CH_TX) kthread_stop(channel->playback_task); - most_stop_channel(channel->iface, channel->id, &audio_aim); + most_stop_channel(channel->iface, channel->id, &snd_component); return 0; } @@ -723,9 +723,9 @@ static int audio_tx_completion(struct most_interface *iface, int channel_id) } /** - * Initialization of the struct most_aim + * Initialization of the struct core_component */ -static struct most_aim audio_aim = { +static struct core_component snd_component = { .name = DRIVER_NAME, .probe_channel = audio_probe_channel, .disconnect_channel = audio_disconnect_channel, @@ -739,7 +739,7 @@ static int __init audio_init(void) INIT_LIST_HEAD(&dev_list); - return most_register_aim(&audio_aim); + return most_register_component(&snd_component); } static void __exit audio_exit(void) @@ -753,7 +753,7 @@ static void __exit audio_exit(void) snd_card_free(channel->card); } - most_deregister_aim(&audio_aim); + most_deregister_component(&snd_component); } module_init(audio_init); diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c index 5b704d9..dff6f3d 100644 --- a/drivers/staging/most/video/video.c +++ b/drivers/staging/most/video/video.c @@ -1,5 +1,5 @@ /* - * V4L2 AIM - V4L2 Application Interface Module for MostCore + * V4L2 Component - V4L2 Application Interface Module for MostCore * * Copyright (C) 2015, Microchip Technology Germany II GmbH & Co. KG * @@ -29,9 +29,9 @@ #include <most/core.h> -#define V4L2_AIM_MAX_INPUT 1 +#define V4L2_CMP_MAX_INPUT 1 -static struct most_aim aim_info; +static struct core_component comp_info; struct most_video_dev { struct most_interface *iface; @@ -52,7 +52,7 @@ struct most_video_dev { wait_queue_head_t wait_data; }; -struct aim_fh { +struct comp_fh { /* must be the first field of this struct! */ struct v4l2_fh fh; struct most_video_dev *mdev; @@ -72,14 +72,14 @@ static inline struct mbo *get_top_mbo(struct most_video_dev *mdev) return list_first_entry(&mdev->pending_mbos, struct mbo, list); } -static int aim_vdev_open(struct file *filp) +static int comp_vdev_open(struct file *filp) { int ret; struct video_device *vdev = video_devdata(filp); struct most_video_dev *mdev = video_drvdata(filp); - struct aim_fh *fh; + struct comp_fh *fh; - v4l2_info(&mdev->v4l2_dev, "aim_vdev_open()\n"); + v4l2_info(&mdev->v4l2_dev, "comp_vdev_open()\n"); switch (vdev->vfl_type) { case VFL_TYPE_GRABBER: @@ -104,7 +104,7 @@ static int aim_vdev_open(struct file *filp) v4l2_fh_add(&fh->fh); - ret = most_start_channel(mdev->iface, mdev->ch_idx, &aim_info); + ret = most_start_channel(mdev->iface, mdev->ch_idx, &comp_info); if (ret) { v4l2_err(&mdev->v4l2_dev, "most_start_channel() failed\n"); goto err_rm; @@ -122,13 +122,13 @@ static int aim_vdev_open(struct file *filp) return ret; } -static int aim_vdev_close(struct file *filp) +static int comp_vdev_close(struct file *filp) { - struct aim_fh *fh = filp->private_data; + struct comp_fh *fh = filp->private_data; struct most_video_dev *mdev = fh->mdev; struct mbo *mbo, *tmp; - v4l2_info(&mdev->v4l2_dev, "aim_vdev_close()\n"); + v4l2_info(&mdev->v4l2_dev, "comp_vdev_close()\n"); /* * We need to put MBOs back before we call most_stop_channel() @@ -148,7 +148,7 @@ static int aim_vdev_close(struct file *filp) spin_lock_irq(&mdev->list_lock); } spin_unlock_irq(&mdev->list_lock); - most_stop_channel(mdev->iface, mdev->ch_idx, &aim_info); + most_stop_channel(mdev->iface, mdev->ch_idx, &comp_info); mdev->mute = false; v4l2_fh_del(&fh->fh); @@ -159,10 +159,10 @@ static int aim_vdev_close(struct file *filp) return 0; } -static ssize_t aim_vdev_read(struct file *filp, char __user *buf, - size_t count, loff_t *pos) +static ssize_t comp_vdev_read(struct file *filp, char __user *buf, + size_t count, loff_t *pos) { - struct aim_fh *fh = filp->private_data; + struct comp_fh *fh = filp->private_data; struct most_video_dev *mdev = fh->mdev; int ret = 0; @@ -209,9 +209,9 @@ static ssize_t aim_vdev_read(struct file *filp, char __user *buf, return ret; } -static unsigned int aim_vdev_poll(struct file *filp, poll_table *wait) +static unsigned int comp_vdev_poll(struct file *filp, poll_table *wait) { - struct aim_fh *fh = filp->private_data; + struct comp_fh *fh = filp->private_data; struct most_video_dev *mdev = fh->mdev; unsigned int mask = 0; @@ -224,7 +224,7 @@ static unsigned int aim_vdev_poll(struct file *filp, poll_table *wait) return mask; } -static void aim_set_format_struct(struct v4l2_format *f) +static void comp_set_format_struct(struct v4l2_format *f) { f->fmt.pix.width = 8; f->fmt.pix.height = 8; @@ -236,8 +236,8 @@ static void aim_set_format_struct(struct v4l2_format *f) f->fmt.pix.priv = 0; } -static int aim_set_format(struct most_video_dev *mdev, unsigned int cmd, - struct v4l2_format *format) +static int comp_set_format(struct most_video_dev *mdev, unsigned int cmd, + struct v4l2_format *format) { if (format->fmt.pix.pixelformat != V4L2_PIX_FMT_MPEG) return -EINVAL; @@ -245,7 +245,7 @@ static int aim_set_format(struct most_video_dev *mdev, unsigned int cmd, if (cmd == VIDIOC_TRY_FMT) return 0; - aim_set_format_struct(format); + comp_set_format_struct(format); return 0; } @@ -253,12 +253,12 @@ static int aim_set_format(struct most_video_dev *mdev, unsigned int cmd, static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct aim_fh *fh = priv; + struct comp_fh *fh = priv; struct most_video_dev *mdev = fh->mdev; v4l2_info(&mdev->v4l2_dev, "vidioc_querycap()\n"); - strlcpy(cap->driver, "v4l2_most_aim", sizeof(cap->driver)); + strlcpy(cap->driver, "v4l2_component", sizeof(cap->driver)); strlcpy(cap->card, "MOST", sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "%s", mdev->iface->description); @@ -273,7 +273,7 @@ static int vidioc_querycap(struct file *file, void *priv, static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct aim_fh *fh = priv; + struct comp_fh *fh = priv; struct most_video_dev *mdev = fh->mdev; v4l2_info(&mdev->v4l2_dev, "vidioc_enum_fmt_vid_cap() %d\n", f->index); @@ -292,36 +292,36 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { - struct aim_fh *fh = priv; + struct comp_fh *fh = priv; struct most_video_dev *mdev = fh->mdev; v4l2_info(&mdev->v4l2_dev, "vidioc_g_fmt_vid_cap()\n"); - aim_set_format_struct(f); + comp_set_format_struct(f); return 0; } static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { - struct aim_fh *fh = priv; + struct comp_fh *fh = priv; struct most_video_dev *mdev = fh->mdev; - return aim_set_format(mdev, VIDIOC_TRY_FMT, f); + return comp_set_format(mdev, VIDIOC_TRY_FMT, f); } static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { - struct aim_fh *fh = priv; + struct comp_fh *fh = priv; struct most_video_dev *mdev = fh->mdev; - return aim_set_format(mdev, VIDIOC_S_FMT, f); + return comp_set_format(mdev, VIDIOC_S_FMT, f); } static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm) { - struct aim_fh *fh = priv; + struct comp_fh *fh = priv; struct most_video_dev *mdev = fh->mdev; v4l2_info(&mdev->v4l2_dev, "vidioc_g_std()\n"); @@ -333,10 +333,10 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm) static int vidioc_enum_input(struct file *file, void *priv, struct v4l2_input *input) { - struct aim_fh *fh = priv; + struct comp_fh *fh = priv; struct most_video_dev *mdev = fh->mdev; - if (input->index >= V4L2_AIM_MAX_INPUT) + if (input->index >= V4L2_CMP_MAX_INPUT) return -EINVAL; strcpy(input->name, "MOST Video"); @@ -350,7 +350,7 @@ static int vidioc_enum_input(struct file *file, void *priv, static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) { - struct aim_fh *fh = priv; + struct comp_fh *fh = priv; struct most_video_dev *mdev = fh->mdev; *i = mdev->ctrl_input; return 0; @@ -358,23 +358,23 @@ static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) static int vidioc_s_input(struct file *file, void *priv, unsigned int index) { - struct aim_fh *fh = priv; + struct comp_fh *fh = priv; struct most_video_dev *mdev = fh->mdev; v4l2_info(&mdev->v4l2_dev, "vidioc_s_input(%d)\n", index); - if (index >= V4L2_AIM_MAX_INPUT) + if (index >= V4L2_CMP_MAX_INPUT) return -EINVAL; mdev->ctrl_input = index; return 0; } -static const struct v4l2_file_operations aim_fops = { +static const struct v4l2_file_operations comp_fops = { .owner = THIS_MODULE, - .open = aim_vdev_open, - .release = aim_vdev_close, - .read = aim_vdev_read, - .poll = aim_vdev_poll, + .open = comp_vdev_open, + .release = comp_vdev_close, + .read = comp_vdev_read, + .poll = comp_vdev_poll, .unlocked_ioctl = video_ioctl2, }; @@ -390,8 +390,8 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index) .vidioc_s_input = vidioc_s_input, }; -static const struct video_device aim_videodev_template = { - .fops = &aim_fops, +static const struct video_device comp_videodev_template = { + .fops = &comp_fops, .release = video_device_release, .ioctl_ops = &video_ioctl_ops, .tvnorms = V4L2_STD_UNKNOWN, @@ -399,7 +399,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index) /**************************************************************************/ -static struct most_video_dev *get_aim_dev( +static struct most_video_dev *get_comp_dev( struct most_interface *iface, int channel_idx) { struct most_video_dev *mdev; @@ -416,11 +416,11 @@ static struct most_video_dev *get_aim_dev( return NULL; } -static int aim_rx_data(struct mbo *mbo) +static int comp_rx_data(struct mbo *mbo) { unsigned long flags; struct most_video_dev *mdev = - get_aim_dev(mbo->ifp, mbo->hdm_channel_id); + get_comp_dev(mbo->ifp, mbo->hdm_channel_id); if (!mdev) return -EIO; @@ -437,11 +437,11 @@ static int aim_rx_data(struct mbo *mbo) return 0; } -static int aim_register_videodev(struct most_video_dev *mdev) +static int comp_register_videodev(struct most_video_dev *mdev) { int ret; - v4l2_info(&mdev->v4l2_dev, "aim_register_videodev()\n"); + v4l2_info(&mdev->v4l2_dev, "comp_register_videodev()\n"); init_waitqueue_head(&mdev->wait_data); @@ -451,7 +451,7 @@ static int aim_register_videodev(struct most_video_dev *mdev) return -ENOMEM; /* Fill the video capture device struct */ - *mdev->vdev = aim_videodev_template; + *mdev->vdev = comp_videodev_template; mdev->vdev->v4l2_dev = &mdev->v4l2_dev; mdev->vdev->lock = &mdev->lock; snprintf(mdev->vdev->name, sizeof(mdev->vdev->name), "MOST: %s", @@ -469,14 +469,14 @@ static int aim_register_videodev(struct most_video_dev *mdev) return ret; } -static void aim_unregister_videodev(struct most_video_dev *mdev) +static void comp_unregister_videodev(struct most_video_dev *mdev) { - v4l2_info(&mdev->v4l2_dev, "aim_unregister_videodev()\n"); + v4l2_info(&mdev->v4l2_dev, "comp_unregister_videodev()\n"); video_unregister_device(mdev->vdev); } -static void aim_v4l2_dev_release(struct v4l2_device *v4l2_dev) +static void comp_v4l2_dev_release(struct v4l2_device *v4l2_dev) { struct most_video_dev *mdev = container_of(v4l2_dev, struct most_video_dev, v4l2_dev); @@ -485,14 +485,13 @@ static void aim_v4l2_dev_release(struct v4l2_device *v4l2_dev) kfree(mdev); } -static int aim_probe_channel(struct most_interface *iface, int channel_idx, - struct most_channel_config *ccfg, - char *name) +static int comp_probe_channel(struct most_interface *iface, int channel_idx, + struct most_channel_config *ccfg, char *name) { int ret; - struct most_video_dev *mdev = get_aim_dev(iface, channel_idx); + struct most_video_dev *mdev = get_comp_dev(iface, channel_idx); - pr_info("aim_probe_channel(%s)\n", name); + pr_info("comp_probe_channel(%s)\n", name); if (mdev) { pr_err("channel already linked\n"); @@ -520,7 +519,7 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, INIT_LIST_HEAD(&mdev->pending_mbos); mdev->iface = iface; mdev->ch_idx = channel_idx; - mdev->v4l2_dev.release = aim_v4l2_dev_release; + mdev->v4l2_dev.release = comp_v4l2_dev_release; /* Create the v4l2_device */ strlcpy(mdev->v4l2_dev.name, name, sizeof(mdev->v4l2_dev.name)); @@ -531,14 +530,14 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, return ret; } - ret = aim_register_videodev(mdev); + ret = comp_register_videodev(mdev); if (ret) goto err_unreg; spin_lock_irq(&list_lock); list_add(&mdev->list, &video_devices); spin_unlock_irq(&list_lock); - v4l2_info(&mdev->v4l2_dev, "aim_probe_channel() done\n"); + v4l2_info(&mdev->v4l2_dev, "comp_probe_channel() done\n"); return 0; err_unreg: @@ -547,48 +546,48 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, return ret; } -static int aim_disconnect_channel(struct most_interface *iface, - int channel_idx) +static int comp_disconnect_channel(struct most_interface *iface, + int channel_idx) { - struct most_video_dev *mdev = get_aim_dev(iface, channel_idx); + struct most_video_dev *mdev = get_comp_dev(iface, channel_idx); if (!mdev) { pr_err("no such channel is linked\n"); return -ENOENT; } - v4l2_info(&mdev->v4l2_dev, "aim_disconnect_channel()\n"); + v4l2_info(&mdev->v4l2_dev, "comp_disconnect_channel()\n"); spin_lock_irq(&list_lock); list_del(&mdev->list); spin_unlock_irq(&list_lock); - aim_unregister_videodev(mdev); + comp_unregister_videodev(mdev); v4l2_device_disconnect(&mdev->v4l2_dev); v4l2_device_put(&mdev->v4l2_dev); return 0; } -static struct most_aim aim_info = { - .name = "aim_v4l", - .probe_channel = aim_probe_channel, - .disconnect_channel = aim_disconnect_channel, - .rx_completion = aim_rx_data, +static struct core_component comp_info = { + .name = "video", + .probe_channel = comp_probe_channel, + .disconnect_channel = comp_disconnect_channel, + .rx_completion = comp_rx_data, }; -static int __init aim_init(void) +static int __init comp_init(void) { spin_lock_init(&list_lock); - return most_register_aim(&aim_info); + return most_register_component(&comp_info); } -static void __exit aim_exit(void) +static void __exit comp_exit(void) { struct most_video_dev *mdev, *tmp; /* * As the mostcore currently doesn't call disconnect_channel() - * for linked channels while we call most_deregister_aim() + * for linked channels while we call most_deregister_component() * we simulate this call here. * This must be fixed in core. */ @@ -597,20 +596,20 @@ static void __exit aim_exit(void) list_del(&mdev->list); spin_unlock_irq(&list_lock); - aim_unregister_videodev(mdev); + comp_unregister_videodev(mdev); v4l2_device_disconnect(&mdev->v4l2_dev); v4l2_device_put(&mdev->v4l2_dev); spin_lock_irq(&list_lock); } spin_unlock_irq(&list_lock); - most_deregister_aim(&aim_info); + most_deregister_component(&comp_info); BUG_ON(!list_empty(&video_devices)); } -module_init(aim_init); -module_exit(aim_exit); +module_init(comp_init); +module_exit(comp_exit); -MODULE_DESCRIPTION("V4L2 Application Interface Module for MostCore"); +MODULE_DESCRIPTION("V4L2 Component for MostCore"); MODULE_AUTHOR("Andrey Shvetsov <andrey.shvetsov@xxxxxx>"); MODULE_LICENSE("GPL"); -- 1.9.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel