aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2017-02-12 01:02:24 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-14 13:20:35 -0500
commite4165a0fad0963bf8b4a59f54d3360ccb6a6d1ea (patch)
treefb91d8f72f6c01e2779e2b0892202bade31907fa
parent6e47dd3e2938f41d75045bbcb64aa9df3a463b2a (diff)
vmbus: constify parameters where possible
Functions that just query state of ring buffer can have parameters marked const. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/hv/hyperv_vmbus.h6
-rw-r--r--drivers/hv/ring_buffer.c22
-rw-r--r--include/linux/hyperv.h12
3 files changed, 19 insertions, 21 deletions
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index e15a130de3c9..884f83bba1ab 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -283,14 +283,14 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
283void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info); 283void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);
284 284
285int hv_ringbuffer_write(struct vmbus_channel *channel, 285int hv_ringbuffer_write(struct vmbus_channel *channel,
286 struct kvec *kv_list, u32 kv_count); 286 const struct kvec *kv_list, u32 kv_count);
287 287
288int hv_ringbuffer_read(struct vmbus_channel *channel, 288int hv_ringbuffer_read(struct vmbus_channel *channel,
289 void *buffer, u32 buflen, u32 *buffer_actual_len, 289 void *buffer, u32 buflen, u32 *buffer_actual_len,
290 u64 *requestid, bool raw); 290 u64 *requestid, bool raw);
291 291
292void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, 292void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info,
293 struct hv_ring_buffer_debug_info *debug_info); 293 struct hv_ring_buffer_debug_info *debug_info);
294 294
295/* 295/*
296 * Maximum channels is determined by the size of the interrupt page 296 * Maximum channels is determined by the size of the interrupt page
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 75c9eefd55b5..490e9ea098e6 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -96,11 +96,9 @@ hv_set_next_write_location(struct hv_ring_buffer_info *ring_info,
96 96
97/* Get the next read location for the specified ring buffer. */ 97/* Get the next read location for the specified ring buffer. */
98static inline u32 98static inline u32
99hv_get_next_read_location(struct hv_ring_buffer_info *ring_info) 99hv_get_next_read_location(const struct hv_ring_buffer_info *ring_info)
100{ 100{
101 u32 next = ring_info->ring_buffer->read_index; 101 return ring_info->ring_buffer->read_index;
102
103 return next;
104} 102}
105 103
106/* 104/*
@@ -108,8 +106,8 @@ hv_get_next_read_location(struct hv_ring_buffer_info *ring_info)
108 * This allows the caller to skip. 106 * This allows the caller to skip.
109 */ 107 */
110static inline u32 108static inline u32
111hv_get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info, 109hv_get_next_readlocation_withoffset(const struct hv_ring_buffer_info *ring_info,
112 u32 offset) 110 u32 offset)
113{ 111{
114 u32 next = ring_info->ring_buffer->read_index; 112 u32 next = ring_info->ring_buffer->read_index;
115 113
@@ -130,7 +128,7 @@ hv_set_next_read_location(struct hv_ring_buffer_info *ring_info,
130 128
131/* Get the size of the ring buffer. */ 129/* Get the size of the ring buffer. */
132static inline u32 130static inline u32
133hv_get_ring_buffersize(struct hv_ring_buffer_info *ring_info) 131hv_get_ring_buffersize(const struct hv_ring_buffer_info *ring_info)
134{ 132{
135 return ring_info->ring_datasize; 133 return ring_info->ring_datasize;
136} 134}
@@ -147,7 +145,7 @@ hv_get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
147 * Assume there is enough room. Handles wrap-around in src case only!! 145 * Assume there is enough room. Handles wrap-around in src case only!!
148 */ 146 */
149static u32 hv_copyfrom_ringbuffer( 147static u32 hv_copyfrom_ringbuffer(
150 struct hv_ring_buffer_info *ring_info, 148 const struct hv_ring_buffer_info *ring_info,
151 void *dest, 149 void *dest,
152 u32 destlen, 150 u32 destlen,
153 u32 start_read_offset) 151 u32 start_read_offset)
@@ -171,7 +169,7 @@ static u32 hv_copyfrom_ringbuffer(
171static u32 hv_copyto_ringbuffer( 169static u32 hv_copyto_ringbuffer(
172 struct hv_ring_buffer_info *ring_info, 170 struct hv_ring_buffer_info *ring_info,
173 u32 start_write_offset, 171 u32 start_write_offset,
174 void *src, 172 const void *src,
175 u32 srclen) 173 u32 srclen)
176{ 174{
177 void *ring_buffer = hv_get_ring_buffer(ring_info); 175 void *ring_buffer = hv_get_ring_buffer(ring_info);
@@ -186,8 +184,8 @@ static u32 hv_copyto_ringbuffer(
186} 184}
187 185
188/* Get various debug metrics for the specified ring buffer. */ 186/* Get various debug metrics for the specified ring buffer. */
189void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, 187void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info,
190 struct hv_ring_buffer_debug_info *debug_info) 188 struct hv_ring_buffer_debug_info *debug_info)
191{ 189{
192 u32 bytes_avail_towrite; 190 u32 bytes_avail_towrite;
193 u32 bytes_avail_toread; 191 u32 bytes_avail_toread;
@@ -264,7 +262,7 @@ void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
264 262
265/* Write to the ring buffer. */ 263/* Write to the ring buffer. */
266int hv_ringbuffer_write(struct vmbus_channel *channel, 264int hv_ringbuffer_write(struct vmbus_channel *channel,
267 struct kvec *kv_list, u32 kv_count) 265 const struct kvec *kv_list, u32 kv_count)
268{ 266{
269 int i = 0; 267 int i = 0;
270 u32 bytes_avail_towrite; 268 u32 bytes_avail_towrite;
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 08eb71a22c14..62bbf3c1aa4a 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -138,8 +138,8 @@ struct hv_ring_buffer_info {
138 * for the specified ring buffer 138 * for the specified ring buffer
139 */ 139 */
140static inline void 140static inline void
141hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi, 141hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi,
142 u32 *read, u32 *write) 142 u32 *read, u32 *write)
143{ 143{
144 u32 read_loc, write_loc, dsize; 144 u32 read_loc, write_loc, dsize;
145 145
@@ -153,7 +153,7 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
153 *read = dsize - *write; 153 *read = dsize - *write;
154} 154}
155 155
156static inline u32 hv_get_bytes_to_read(struct hv_ring_buffer_info *rbi) 156static inline u32 hv_get_bytes_to_read(const struct hv_ring_buffer_info *rbi)
157{ 157{
158 u32 read_loc, write_loc, dsize, read; 158 u32 read_loc, write_loc, dsize, read;
159 159
@@ -167,7 +167,7 @@ static inline u32 hv_get_bytes_to_read(struct hv_ring_buffer_info *rbi)
167 return read; 167 return read;
168} 168}
169 169
170static inline u32 hv_get_bytes_to_write(struct hv_ring_buffer_info *rbi) 170static inline u32 hv_get_bytes_to_write(const struct hv_ring_buffer_info *rbi)
171{ 171{
172 u32 read_loc, write_loc, dsize, write; 172 u32 read_loc, write_loc, dsize, write;
173 173
@@ -1448,9 +1448,9 @@ void vmbus_set_event(struct vmbus_channel *channel);
1448 1448
1449/* Get the start of the ring buffer. */ 1449/* Get the start of the ring buffer. */
1450static inline void * 1450static inline void *
1451hv_get_ring_buffer(struct hv_ring_buffer_info *ring_info) 1451hv_get_ring_buffer(const struct hv_ring_buffer_info *ring_info)
1452{ 1452{
1453 return (void *)ring_info->ring_buffer->buffer; 1453 return ring_info->ring_buffer->buffer;
1454} 1454}
1455 1455
1456/* 1456/*