[PATCH 05/28] staging: most: core: rename struct memeber

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

 



This patch renames the member "ptr" of struct pipe to "aim". This is
needed to increase the readability of the code.

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

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 35fedd5..a3d60b3 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -38,7 +38,7 @@
 static int dummy_num_buffers;
 
 struct pipe {
-	struct most_aim *ptr;
+	struct most_aim *aim;
 	int refs;
 	int num_buffers;
 };
@@ -566,7 +566,7 @@ static ssize_t links_show(struct device *dev, struct device_attribute *attr,
 
 	list_for_each_entry(i, &instance_list, list) {
 		list_for_each_entry(c, &i->channel_list, list) {
-			if (c->aim0.ptr == aim || c->aim1.ptr == aim) {
+			if (c->aim0.aim == aim || c->aim1.aim == aim) {
 				offs += snprintf(buf + offs, PAGE_SIZE - offs,
 						 "%s:%s\n",
 						 dev_name(&i->iface->dev),
@@ -655,10 +655,10 @@ static int link_channel_to_aim(struct most_channel *c, struct most_aim *aim,
 	int ret;
 	struct most_aim **aim_ptr;
 
-	if (!c->aim0.ptr)
-		aim_ptr = &c->aim0.ptr;
-	else if (!c->aim1.ptr)
-		aim_ptr = &c->aim1.ptr;
+	if (!c->aim0.aim)
+		aim_ptr = &c->aim0.aim;
+	else if (!c->aim1.aim)
+		aim_ptr = &c->aim1.aim;
 	else
 		return -ENOSPC;
 
@@ -767,10 +767,10 @@ static ssize_t remove_link_store(struct device *dev,
 
 	if (aim->disconnect_channel(c->iface, c->channel_id))
 		return -EIO;
-	if (c->aim0.ptr == aim)
-		c->aim0.ptr = NULL;
-	if (c->aim1.ptr == aim)
-		c->aim1.ptr = NULL;
+	if (c->aim0.aim == aim)
+		c->aim0.aim = NULL;
+	if (c->aim1.aim == aim)
+		c->aim1.aim = NULL;
 	return len;
 }
 
@@ -914,11 +914,11 @@ static void arm_mbo(struct mbo *mbo)
 	list_add_tail(&mbo->list, &c->fifo);
 	spin_unlock_irqrestore(&c->fifo_lock, flags);
 
-	if (c->aim0.refs && c->aim0.ptr->tx_completion)
-		c->aim0.ptr->tx_completion(c->iface, c->channel_id);
+	if (c->aim0.refs && c->aim0.aim->tx_completion)
+		c->aim0.aim->tx_completion(c->iface, c->channel_id);
 
-	if (c->aim1.refs && c->aim1.ptr->tx_completion)
-		c->aim1.ptr->tx_completion(c->iface, c->channel_id);
+	if (c->aim1.refs && c->aim1.aim->tx_completion)
+		c->aim1.aim->tx_completion(c->iface, c->channel_id);
 }
 
 /**
@@ -1026,8 +1026,8 @@ int channel_has_mbo(struct most_interface *iface, int id, struct most_aim *aim)
 		return -EINVAL;
 
 	if (c->aim0.refs && c->aim1.refs &&
-	    ((aim == c->aim0.ptr && c->aim0.num_buffers <= 0) ||
-	     (aim == c->aim1.ptr && c->aim1.num_buffers <= 0)))
+	    ((aim == c->aim0.aim && c->aim0.num_buffers <= 0) ||
+	     (aim == c->aim1.aim && c->aim1.num_buffers <= 0)))
 		return 0;
 
 	spin_lock_irqsave(&c->fifo_lock, flags);
@@ -1059,13 +1059,13 @@ struct mbo *most_get_mbo(struct most_interface *iface, int id,
 		return NULL;
 
 	if (c->aim0.refs && c->aim1.refs &&
-	    ((aim == c->aim0.ptr && c->aim0.num_buffers <= 0) ||
-	     (aim == c->aim1.ptr && c->aim1.num_buffers <= 0)))
+	    ((aim == c->aim0.aim && c->aim0.num_buffers <= 0) ||
+	     (aim == c->aim1.aim && c->aim1.num_buffers <= 0)))
 		return NULL;
 
-	if (aim == c->aim0.ptr)
+	if (aim == c->aim0.aim)
 		num_buffers_ptr = &c->aim0.num_buffers;
-	else if (aim == c->aim1.ptr)
+	else if (aim == c->aim1.aim)
 		num_buffers_ptr = &c->aim1.num_buffers;
 	else
 		num_buffers_ptr = &dummy_num_buffers;
@@ -1130,12 +1130,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->aim0.refs && c->aim0.ptr->rx_completion &&
-	    c->aim0.ptr->rx_completion(mbo) == 0)
+	if (c->aim0.refs && c->aim0.aim->rx_completion &&
+	    c->aim0.aim->rx_completion(mbo) == 0)
 		return;
 
-	if (c->aim1.refs && c->aim1.ptr->rx_completion &&
-	    c->aim1.ptr->rx_completion(mbo) == 0)
+	if (c->aim1.refs && c->aim1.aim->rx_completion &&
+	    c->aim1.aim->rx_completion(mbo) == 0)
 		return;
 
 	most_put_mbo(mbo);
@@ -1203,9 +1203,9 @@ int most_start_channel(struct most_interface *iface, int id,
 	atomic_set(&c->mbo_ref, num_buffer);
 
 out:
-	if (aim == c->aim0.ptr)
+	if (aim == c->aim0.aim)
 		c->aim0.refs++;
-	if (aim == c->aim1.ptr)
+	if (aim == c->aim1.aim)
 		c->aim1.refs++;
 	mutex_unlock(&c->start_mutex);
 	return 0;
@@ -1270,9 +1270,9 @@ int most_stop_channel(struct most_interface *iface, int id,
 	c->is_poisoned = false;
 
 out:
-	if (aim == c->aim0.ptr)
+	if (aim == c->aim0.aim)
 		c->aim0.refs--;
-	if (aim == c->aim1.ptr)
+	if (aim == c->aim1.aim)
 		c->aim1.refs--;
 	mutex_unlock(&c->start_mutex);
 	return 0;
@@ -1327,13 +1327,13 @@ int most_deregister_aim(struct most_aim *aim)
 
 	list_for_each_entry_safe(i, i_tmp, &instance_list, list) {
 		list_for_each_entry_safe(c, tmp, &i->channel_list, list) {
-			if (c->aim0.ptr == aim || c->aim1.ptr == aim)
+			if (c->aim0.aim == aim || c->aim1.aim == aim)
 				aim->disconnect_channel(
 					c->iface, c->channel_id);
-			if (c->aim0.ptr == aim)
-				c->aim0.ptr = NULL;
-			if (c->aim1.ptr == aim)
-				c->aim1.ptr = NULL;
+			if (c->aim0.aim == aim)
+				c->aim0.aim = NULL;
+			if (c->aim1.aim == aim)
+				c->aim1.aim = NULL;
 		}
 	}
 	device_unregister(&aim->dev);
@@ -1479,14 +1479,14 @@ void most_deregister_interface(struct most_interface *iface)
 	inst = iface->priv;
 	for (i = 0; i < iface->num_channels; i++) {
 		c = inst->channel[i];
-		if (c->aim0.ptr)
-			c->aim0.ptr->disconnect_channel(c->iface,
+		if (c->aim0.aim)
+			c->aim0.aim->disconnect_channel(c->iface,
 							c->channel_id);
-		if (c->aim1.ptr)
-			c->aim1.ptr->disconnect_channel(c->iface,
+		if (c->aim1.aim)
+			c->aim1.aim->disconnect_channel(c->iface,
 							c->channel_id);
-		c->aim0.ptr = NULL;
-		c->aim1.ptr = NULL;
+		c->aim0.aim = NULL;
+		c->aim1.aim = NULL;
 		list_del(&c->list);
 		device_unregister(&c->dev);
 		kfree(c);
-- 
1.9.1

_______________________________________________
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