2023-04-19 08:07:46

by Su Hui

[permalink] [raw]
Subject: [PATCH] Drivers: hv: vmbus: Remove unnecessary (void*) conversions

No need cast (void*) to (struct hv_ring_buffer *).

Signed-off-by: Suhui <[email protected]>
---
drivers/hv/ring_buffer.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index c6692fd5ab15..5471321169e9 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -209,9 +209,8 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
for (i = 0; i < 2 * (page_cnt - 1); i++)
pfns_wraparound[i + 1] = pfn + i % (page_cnt - 1) + 1;

- ring_info->ring_buffer = (struct hv_ring_buffer *)
- vmap_pfn(pfns_wraparound, page_cnt * 2 - 1,
- PAGE_KERNEL);
+ ring_info->ring_buffer = vmap_pfn(pfns_wraparound, page_cnt * 2 - 1,
+ PAGE_KERNEL);
kfree(pfns_wraparound);

if (!ring_info->ring_buffer)
@@ -231,9 +230,8 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
pages_wraparound[i + 1] =
&pages[i % (page_cnt - 1) + 1];

- ring_info->ring_buffer = (struct hv_ring_buffer *)
- vmap(pages_wraparound, page_cnt * 2 - 1, VM_MAP,
- PAGE_KERNEL);
+ ring_info->ring_buffer = vmap(pages_wraparound, page_cnt * 2 - 1, VM_MAP,
+ PAGE_KERNEL);

kfree(pages_wraparound);
if (!ring_info->ring_buffer)
--
2.34.1


2023-04-20 22:05:18

by Wei Liu

[permalink] [raw]
Subject: Re: [PATCH] Drivers: hv: vmbus: Remove unnecessary (void*) conversions

On Wed, Apr 19, 2023 at 04:03:31PM +0800, Suhui wrote:
> No need cast (void*) to (struct hv_ring_buffer *).
>
> Signed-off-by: Suhui <[email protected]>

Unfortunately due to recent changes this patch no longer applies to
hyperv-next.

> ---
> drivers/hv/ring_buffer.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
> index c6692fd5ab15..5471321169e9 100644
> --- a/drivers/hv/ring_buffer.c
> +++ b/drivers/hv/ring_buffer.c
> @@ -209,9 +209,8 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
> for (i = 0; i < 2 * (page_cnt - 1); i++)
> pfns_wraparound[i + 1] = pfn + i % (page_cnt - 1) + 1;
>
> - ring_info->ring_buffer = (struct hv_ring_buffer *)
> - vmap_pfn(pfns_wraparound, page_cnt * 2 - 1,
> - PAGE_KERNEL);
> + ring_info->ring_buffer = vmap_pfn(pfns_wraparound, page_cnt * 2 - 1,
> + PAGE_KERNEL);
> kfree(pfns_wraparound);
>
> if (!ring_info->ring_buffer)
> @@ -231,9 +230,8 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
> pages_wraparound[i + 1] =
> &pages[i % (page_cnt - 1) + 1];
>
> - ring_info->ring_buffer = (struct hv_ring_buffer *)
> - vmap(pages_wraparound, page_cnt * 2 - 1, VM_MAP,
> - PAGE_KERNEL);
> + ring_info->ring_buffer = vmap(pages_wraparound, page_cnt * 2 - 1, VM_MAP,
> + PAGE_KERNEL);
>
> kfree(pages_wraparound);
> if (!ring_info->ring_buffer)
> --
> 2.34.1
>