public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kys@exchange.microsoft.com
To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com,
	vkuznets@redhat.com, jasowang@redhat.com,
	leann.ogasawara@canonical.com, marcelo.cerri@canonical.com,
	sthemmin@microsoft.com
Cc: Tianyu Lan <Tianyu.Lan@microsoft.com>,
	"lantianyu1986@gmail.com" <lantianyu1986@gmail.com>
Subject: [PATCH V2 06/12] vmbus/ring_buffer: remove some redundant helper function.
Date: Sun,  4 Mar 2018 22:17:16 -0700	[thread overview]
Message-ID: <20180305051722.19157-6-kys@exchange.microsoft.com> (raw)
In-Reply-To: <20180305051722.19157-1-kys@exchange.microsoft.com>

From: "lantianyu1986@gmail.com" <lantianyu1986@gmail.com>

Some hv_get/set** helper functions in ring_buffer code are
only called once or not used. This patch is to clear up these codes.

Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/hv/ring_buffer.c | 49 ++++--------------------------------------------
 1 file changed, 4 insertions(+), 45 deletions(-)

diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 50e071444a5c..1aa17795727b 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -78,46 +78,6 @@ static void hv_signal_on_write(u32 old_write, struct vmbus_channel *channel)
 		vmbus_setevent(channel);
 }
 
-/* Get the next write location for the specified ring buffer. */
-static inline u32
-hv_get_next_write_location(struct hv_ring_buffer_info *ring_info)
-{
-	u32 next = ring_info->ring_buffer->write_index;
-
-	return next;
-}
-
-/* Set the next write location for the specified ring buffer. */
-static inline void
-hv_set_next_write_location(struct hv_ring_buffer_info *ring_info,
-		     u32 next_write_location)
-{
-	ring_info->ring_buffer->write_index = next_write_location;
-}
-
-/* Set the next read location for the specified ring buffer. */
-static inline void
-hv_set_next_read_location(struct hv_ring_buffer_info *ring_info,
-		    u32 next_read_location)
-{
-	ring_info->ring_buffer->read_index = next_read_location;
-	ring_info->priv_read_index = next_read_location;
-}
-
-/* Get the size of the ring buffer. */
-static inline u32
-hv_get_ring_buffersize(const struct hv_ring_buffer_info *ring_info)
-{
-	return ring_info->ring_datasize;
-}
-
-/* Get the read and write indices as u64 of the specified ring buffer. */
-static inline u64
-hv_get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
-{
-	return (u64)ring_info->ring_buffer->write_index << 32;
-}
-
 /*
  * Helper routine to copy from source to ring buffer.
  * Assume there is enough room. Handles wrap-around in dest case only!!
@@ -129,7 +89,7 @@ static u32 hv_copyto_ringbuffer(
 	u32				srclen)
 {
 	void *ring_buffer = hv_get_ring_buffer(ring_info);
-	u32 ring_buffer_size = hv_get_ring_buffersize(ring_info);
+	u32 ring_buffer_size = ring_info->ring_datasize;
 
 	memcpy(ring_buffer + start_write_offset, src, srclen);
 
@@ -275,8 +235,7 @@ int hv_ringbuffer_write(struct vmbus_channel *channel,
 	}
 
 	/* Write to the ring buffer */
-	next_write_location = hv_get_next_write_location(outring_info);
-
+	next_write_location = outring_info->ring_buffer->write_index;
 	old_write = next_write_location;
 
 	for (i = 0; i < kv_count; i++) {
@@ -287,7 +246,7 @@ int hv_ringbuffer_write(struct vmbus_channel *channel,
 	}
 
 	/* Set previous packet start */
-	prev_indices = hv_get_ring_bufferindices(outring_info);
+	prev_indices = (u64)outring_info->ring_buffer->write_index << 32;
 
 	next_write_location = hv_copyto_ringbuffer(outring_info,
 					     next_write_location,
@@ -298,7 +257,7 @@ int hv_ringbuffer_write(struct vmbus_channel *channel,
 	virt_mb();
 
 	/* Now, update the write location */
-	hv_set_next_write_location(outring_info, next_write_location);
+	outring_info->ring_buffer->write_index = next_write_location;
 
 
 	spin_unlock_irqrestore(&outring_info->ring_lock, flags);
-- 
2.15.1

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

  parent reply	other threads:[~2018-03-05  5:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05  5:15 [PATCH V2 00/12] Drivers: hv: Miscellaneous fixes kys
2018-03-05  5:17 ` [PATCH V2 01/12] tools/hv: Fix IP reporting by KVP daemon with SRIOV kys
2018-03-05  5:17   ` [PATCH V2 02/12] hyper-v: use GFP_KERNEL for hv_context.hv_numa_map kys
2018-03-05  5:17   ` [PATCH V2 03/12] hv: Synthetic typo correction kys
2018-03-05  5:17   ` [PATCH V2 04/12] tools: hv: fix compiler warnings about major/target_fname kys
2018-03-05  5:17   ` [PATCH V2 05/12] tools: hv: include string.h in hv_fcopy_daemon kys
2018-03-05  5:17   ` kys [this message]
2018-03-06 17:56     ` [PATCH V2 06/12] vmbus/ring_buffer: remove some redundant helper function Greg KH
2018-03-05  5:17   ` [PATCH V2 07/12] hv_vmbus: Correct the stale comments regarding cpu affinity kys
2018-03-05  5:17   ` [PATCH V2 08/12] Drivers: hv: vmbus: Implement Direct Mode for stimer0 kys
2018-03-05  5:17   ` [PATCH V2 09/12] hv_balloon: fix printk loglevel kys
2018-03-05  5:17   ` [PATCH V2 10/12] hv_balloon: simplify hv_online_page()/hv_page_online_one() kys
2018-03-05  5:17   ` [PATCH V2 11/12] hv_balloon: fix bugs in num_pages_onlined accounting kys
2018-03-05  5:17   ` [PATCH V2 12/12] hv_balloon: trace post_status kys

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180305051722.19157-6-kys@exchange.microsoft.com \
    --to=kys@exchange.microsoft.com \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=apw@canonical.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jasowang@redhat.com \
    --cc=kys@microsoft.com \
    --cc=lantianyu1986@gmail.com \
    --cc=leann.ogasawara@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.cerri@canonical.com \
    --cc=olaf@aepfle.de \
    --cc=sthemmin@microsoft.com \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox