Received: by 10.223.185.116 with SMTP id b49csp2200185wrg; Sun, 4 Mar 2018 21:21:06 -0800 (PST) X-Google-Smtp-Source: AG47ELvX1LyB1WSdYP+94YhMS0tK4JL3iBJgpkfAs7Jy2OmA/hBcNgfA8+lsWyF1L2pQxVNvRLU8 X-Received: by 2002:a17:902:b704:: with SMTP id d4-v6mr12278630pls.406.1520227265999; Sun, 04 Mar 2018 21:21:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520227265; cv=none; d=google.com; s=arc-20160816; b=MIrUxgBP73V1ZVJKuE7z/mscz48YFjI0EuKPGQgX2MeV7JS4mdGOGJhrMZ0rk7y/RF qWMHUQpKNoBN+YQcrZUrdAs6eVM1q1z1B6e3zoJq+y4GUZRVp/6eyCcYRLguJPhVjbqL jFJJgu5CrTZEPxOD+aO2gIuksrhiORSo05l6kKt01Q7nK7AFS5dO7qCOJxvtOO7dJ45O eUYv9KP71IiFkUenDDY8wVJo8i2WeTZ2zrD1+aPWy+PsHKdzMe1TnOqlT0wbhSAEiiwf Hkv/l/bw9snKBMu5Z/g9h51cDt/HSCVlwLg9/P/PBtnZYXkDjqErSW7FnPJjbzgmZTXl vN9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=WZ25gcUtLMvd9cAt/rsDV80zsN5hPb+wVtqTVo1Ng10=; b=W936icIdTRxEh2UwV11os8gID7dVFJhAAZbQa+Njlc75MhDHzrApTczdYcwaSRAAxm ilyIwnTka459uzLmRag1d4ALYvnuXnNAuwi0uet5+fuQM9hUDUXAJKwSsk3mZfCE1KCB CwnwqYrpovZCGgzvo3x1rUSMor1+W0ZCCpWlxOYHaCoTxz2nOPTGJNVHOn89avpaz484 w04Js3a7aSWY29MxCQhOTohS0SOOroY2ziLOogc2jUUpbLzJhPlfa6SUyr1KdABrZJOe ho9kOSzVtoRnVs0xJoXU+jNZgtcqj7CehnpYmWOoqtASjs13td7eh5SzNTxggsSX3qin aAFw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=exchange.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si8690172plk.576.2018.03.04.21.20.52; Sun, 04 Mar 2018 21:21:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=exchange.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932739AbeCEFT5 (ORCPT + 99 others); Mon, 5 Mar 2018 00:19:57 -0500 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:46036 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752356AbeCEFSf (ORCPT ); Mon, 5 Mar 2018 00:18:35 -0500 Received: from linuxonhyperv2.linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id siVBeG6wy3NvpsiVBeHLtC; Sun, 04 Mar 2018 22:17:33 -0700 x-originating-ip: 107.180.71.197 Received: from kys by linuxonhyperv2.linuxonhyperv.com with local (Exim 4.89_1) (envelope-from ) id 1esiVB-00050M-6p; Sun, 04 Mar 2018 22:17:33 -0700 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: "lantianyu1986@gmail.com" , Tianyu Lan , "K . Y . Srinivasan" Subject: [PATCH V2 06/12] vmbus/ring_buffer: remove some redundant helper function. Date: Sun, 4 Mar 2018 22:17:16 -0700 Message-Id: <20180305051722.19157-6-kys@exchange.microsoft.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180305051722.19157-1-kys@exchange.microsoft.com> References: <20180305051539.19079-1-kys@exchange.microsoft.com> <20180305051722.19157-1-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfO3FmTSGDr+t1J2VpC6dCIL02eaZf0GUknKOk79IuzofJAxlSZ8x1gdyY9DxeXTIbeFY9CYZSt2hYaNqcAm2MYNYiaW1RdDgOZLqbXf9llZEKVRJAe6W +BCV7ExcHDOTn/qi6fLa60yqntcP4MwXB4Ao6GAgzylHDf3ZMXyZQMQGCGIcEh8NcJKBSA7xq0Ho7xQmYfv3m18NIhGiQ9DubiES9N24jlrP/qTY9ZRNg3qJ 19cYOExk8FQ4cRSDod7rPAeQA4f58slxNRLItDCHOdYvi7i2v5C0Yl7zPwQ+U4nG5uISLLuHYihs1VNS735s3MRRNRQhyLtJ1o2ZQdKlJY8Jf1whpPC996S+ vFX7dmdDj7bApjHu7yv5gCuVBXs6Y0ZspUwBNQdCpXhhZn6DYpk8NHFw6Ox+sU/hm19RBh7I1wv2lgTw8vAjwgzF7GERvg7oc790qSuipli3r3fIkBesDDOK GLSFL16hPgRJha9C6ubw6EXSEDwns9g4+C0WNaiZ1/fknVHxG+R4w3bLC5mbhsdlNX9CU04HO4RObKCjZ31K6LeGdA64GpUe+1M9XGYkjaOyISR1GO8EGdJ2 /9Zilfj3F05rM8dPKNTgW9+IX3nWtTfPxH6KjHWx0rk8O3BbZu1BLG4MG8cZKSRuLmY= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "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 Signed-off-by: K. Y. Srinivasan --- 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