[PATCH 13/50] staging: most: core: rename structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch renames the structure most_c_obj to most_channel. This is needed
to enhance readability.

Signed-off-by: Christian Gromm <christian.gromm@xxxxxxxxxxxxx>
---
 drivers/staging/most/core.c | 104 ++++++++++++++++++++++----------------------
 1 file changed, 52 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 662fe1c..f7aa5ad 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -43,7 +43,7 @@ struct most_c_aim_obj {
 	int num_buffers;
 };
 
-struct most_c_obj {
+struct most_channel {
 	struct device dev;
 	struct completion cleanup;
 	atomic_t mbo_ref;
@@ -69,13 +69,13 @@ struct most_c_obj {
 	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;
 };
 
@@ -112,7 +112,7 @@ static const struct {
  */
 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,
@@ -126,7 +126,7 @@ static void most_free_mbo_coherent(struct mbo *mbo)
  * 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;
@@ -160,7 +160,7 @@ static void flush_channel_fifos(struct most_c_obj *c)
  * 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;
@@ -180,7 +180,7 @@ static ssize_t available_directions_show(struct device *dev,
 					 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, "");
@@ -196,7 +196,7 @@ static ssize_t available_datatypes_show(struct device *dev,
 					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, "");
@@ -216,7 +216,7 @@ static ssize_t number_of_packet_buffers_show(struct device *dev,
 					     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",
@@ -227,7 +227,7 @@ static ssize_t number_of_stream_buffers_show(struct device *dev,
 					     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",
@@ -238,7 +238,7 @@ static ssize_t size_of_packet_buffer_show(struct device *dev,
 					  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",
@@ -249,7 +249,7 @@ static ssize_t size_of_stream_buffer_show(struct device *dev,
 					  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",
@@ -260,7 +260,7 @@ static ssize_t channel_starving_show(struct device *dev,
 				     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);
 }
@@ -269,7 +269,7 @@ static ssize_t set_number_of_buffers_show(struct device *dev,
 					  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);
 }
@@ -279,7 +279,7 @@ static ssize_t set_number_of_buffers_store(struct device *dev,
 					   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);
 
@@ -292,7 +292,7 @@ static ssize_t set_buffer_size_show(struct device *dev,
 				    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);
 }
@@ -302,7 +302,7 @@ static ssize_t set_buffer_size_store(struct device *dev,
 				     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)
@@ -314,7 +314,7 @@ static ssize_t set_direction_show(struct device *dev,
 				  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");
@@ -328,7 +328,7 @@ static ssize_t set_direction_store(struct device *dev,
 				   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;
@@ -350,7 +350,7 @@ static ssize_t set_datatype_show(struct device *dev,
 				 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)
@@ -365,7 +365,7 @@ static ssize_t set_datatype_store(struct device *dev,
 				  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)) {
@@ -385,7 +385,7 @@ static ssize_t set_subbuffer_size_show(struct device *dev,
 				       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);
 }
@@ -395,7 +395,7 @@ static ssize_t set_subbuffer_size_store(struct device *dev,
 					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)
@@ -407,7 +407,7 @@ static ssize_t set_packets_per_xact_show(struct device *dev,
 					 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);
 }
@@ -417,7 +417,7 @@ static ssize_t set_packets_per_xact_store(struct device *dev,
 					  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)
@@ -535,7 +535,7 @@ static const struct attribute_group *interface_attr_groups[] = {
 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;
@@ -599,10 +599,9 @@ static int split_string(char *buf, char **a, char **b, char **c)
  *
  * 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;
 
@@ -626,8 +625,9 @@ most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch)
 	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;
@@ -677,7 +677,7 @@ static ssize_t add_link_store(struct device *dev,
 			      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;
@@ -725,7 +725,7 @@ static ssize_t remove_link_store(struct device *dev,
 				 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;
@@ -802,14 +802,14 @@ static struct device_driver mostcore = {
 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;
 
@@ -826,7 +826,7 @@ static bool hdm_mbo_ready(struct most_c_obj *c)
 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);
@@ -836,7 +836,7 @@ static void nq_hdm_mbo(struct mbo *mbo)
 
 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;
@@ -874,7 +874,7 @@ static int hdm_enqueue_thread(void *data)
 	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",
@@ -901,7 +901,7 @@ static int run_enqueue_thread(struct most_c_obj *c, int channel_id)
 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;
@@ -936,7 +936,7 @@ static void arm_mbo(struct mbo *mbo)
  *
  * 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;
@@ -1004,7 +1004,7 @@ EXPORT_SYMBOL_GPL(most_submit_mbo);
  */
 static void most_write_completion(struct mbo *mbo)
 {
-	struct most_c_obj *c;
+	struct most_channel *c;
 
 	BUG_ON((!mbo) || (!mbo->context));
 
@@ -1020,7 +1020,7 @@ static void most_write_completion(struct mbo *mbo)
 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;
 
@@ -1051,7 +1051,7 @@ struct mbo *most_get_mbo(struct most_interface *iface, int id,
 			 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;
@@ -1093,7 +1093,7 @@ EXPORT_SYMBOL_GPL(most_get_mbo);
  */
 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);
@@ -1116,7 +1116,7 @@ EXPORT_SYMBOL_GPL(most_put_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);
@@ -1159,7 +1159,7 @@ int most_start_channel(struct most_interface *iface, int id,
 	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;
@@ -1228,7 +1228,7 @@ int most_stop_channel(struct most_interface *iface, int id,
 		      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");
@@ -1320,7 +1320,7 @@ EXPORT_SYMBOL_GPL(most_register_aim);
  */
 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) {
@@ -1368,7 +1368,7 @@ int most_register_interface(struct most_interface *iface)
 	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 ||
@@ -1474,7 +1474,7 @@ EXPORT_SYMBOL_GPL(most_register_interface);
 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);
@@ -1513,7 +1513,7 @@ EXPORT_SYMBOL_GPL(most_deregister_interface);
 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;
@@ -1535,7 +1535,7 @@ EXPORT_SYMBOL_GPL(most_stop_enqueue);
 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;
-- 
2.7.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux