public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] misc:scif: do not define list_entry_next
@ 2015-11-18 12:10 Sergey Senozhatsky
  2015-11-18 16:17 ` Sudeep Dutt
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Senozhatsky @ 2015-11-18 12:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Sudeep Dutt, Dan Carpenter, linux-kernel, Sergey Senozhatsky,
	Sergey Senozhatsky

Cosmetic.

Do not define list_entry_next() and use list_next_entry()
from list.h.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 drivers/misc/mic/scif/scif_dma.c  | 27 +++++++++++----------------
 drivers/misc/mic/scif/scif_main.h |  1 +
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/misc/mic/scif/scif_dma.c b/drivers/misc/mic/scif/scif_dma.c
index 95a13c6..8804bcc 100644
--- a/drivers/misc/mic/scif/scif_dma.c
+++ b/drivers/misc/mic/scif/scif_dma.c
@@ -74,11 +74,6 @@ struct scif_copy_work {
 	bool ordered;
 };
 
-#ifndef list_entry_next
-#define list_entry_next(pos, member) \
-	list_entry(pos->member.next, typeof(*pos), member)
-#endif
-
 /**
  * scif_reserve_dma_chan:
  * @ep: Endpoint Descriptor.
@@ -851,7 +846,7 @@ static void scif_rma_local_cpu_copy(s64 offset, struct scif_window *window,
 		(window->nr_pages << PAGE_SHIFT);
 	while (rem_len) {
 		if (offset == end_offset) {
-			window = list_entry_next(window, list);
+			window = list_next_entry(window, list);
 			end_offset = window->offset +
 				(window->nr_pages << PAGE_SHIFT);
 		}
@@ -957,7 +952,7 @@ scif_rma_list_dma_copy_unaligned(struct scif_copy_work *work,
 	remaining_len -= tail_len;
 	while (remaining_len) {
 		if (offset == end_offset) {
-			window = list_entry_next(window, list);
+			window = list_next_entry(window, list);
 			end_offset = window->offset +
 				(window->nr_pages << PAGE_SHIFT);
 		}
@@ -1064,7 +1059,7 @@ scif_rma_list_dma_copy_unaligned(struct scif_copy_work *work,
 	}
 	if (tail_len) {
 		if (offset == end_offset) {
-			window = list_entry_next(window, list);
+			window = list_next_entry(window, list);
 			end_offset = window->offset +
 				(window->nr_pages << PAGE_SHIFT);
 		}
@@ -1147,13 +1142,13 @@ static int _scif_rma_list_dma_copy_aligned(struct scif_copy_work *work,
 		(dst_window->nr_pages << PAGE_SHIFT);
 	while (remaining_len) {
 		if (src_offset == end_src_offset) {
-			src_window = list_entry_next(src_window, list);
+			src_window = list_next_entry(src_window, list);
 			end_src_offset = src_window->offset +
 				(src_window->nr_pages << PAGE_SHIFT);
 			scif_init_window_iter(src_window, &src_win_iter);
 		}
 		if (dst_offset == end_dst_offset) {
-			dst_window = list_entry_next(dst_window, list);
+			dst_window = list_next_entry(dst_window, list);
 			end_dst_offset = dst_window->offset +
 				(dst_window->nr_pages << PAGE_SHIFT);
 			scif_init_window_iter(dst_window, &dst_win_iter);
@@ -1314,13 +1309,13 @@ static int scif_rma_list_dma_copy_aligned(struct scif_copy_work *work,
 	remaining_len -= tail_len;
 	while (remaining_len) {
 		if (src_offset == end_src_offset) {
-			src_window = list_entry_next(src_window, list);
+			src_window = list_next_entry(src_window, list);
 			end_src_offset = src_window->offset +
 				(src_window->nr_pages << PAGE_SHIFT);
 			scif_init_window_iter(src_window, &src_win_iter);
 		}
 		if (dst_offset == end_dst_offset) {
-			dst_window = list_entry_next(dst_window, list);
+			dst_window = list_next_entry(dst_window, list);
 			end_dst_offset = dst_window->offset +
 				(dst_window->nr_pages << PAGE_SHIFT);
 			scif_init_window_iter(dst_window, &dst_win_iter);
@@ -1405,9 +1400,9 @@ static int scif_rma_list_dma_copy_aligned(struct scif_copy_work *work,
 	if (remaining_len) {
 		loop_len = remaining_len;
 		if (src_offset == end_src_offset)
-			src_window = list_entry_next(src_window, list);
+			src_window = list_next_entry(src_window, list);
 		if (dst_offset == end_dst_offset)
-			dst_window = list_entry_next(dst_window, list);
+			dst_window = list_next_entry(dst_window, list);
 
 		src_dma_addr = __scif_off_to_dma_addr(src_window, src_offset);
 		dst_dma_addr = __scif_off_to_dma_addr(dst_window, dst_offset);
@@ -1550,12 +1545,12 @@ static int scif_rma_list_cpu_copy(struct scif_copy_work *work)
 			end_dst_offset = dst_window->offset +
 				(dst_window->nr_pages << PAGE_SHIFT);
 			if (src_offset == end_src_offset) {
-				src_window = list_entry_next(src_window, list);
+				src_window = list_next_entry(src_window, list);
 				scif_init_window_iter(src_window,
 						      &src_win_iter);
 			}
 			if (dst_offset == end_dst_offset) {
-				dst_window = list_entry_next(dst_window, list);
+				dst_window = list_next_entry(dst_window, list);
 				scif_init_window_iter(dst_window,
 						      &dst_win_iter);
 			}
diff --git a/drivers/misc/mic/scif/scif_main.h b/drivers/misc/mic/scif/scif_main.h
index a08f0b6..9082f83 100644
--- a/drivers/misc/mic/scif/scif_main.h
+++ b/drivers/misc/mic/scif/scif_main.h
@@ -27,6 +27,7 @@
 #include <linux/file.h>
 #include <linux/vmalloc.h>
 #include <linux/scif.h>
+#include <linux/list.h>
 #include "../common/mic_dev.h"
 
 #define SCIF_MGMT_NODE 0
-- 
2.6.2.280.g74301d6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/3] misc:scif: do not define list_entry_next
  2015-11-18 12:10 [PATCH 1/3] misc:scif: do not define list_entry_next Sergey Senozhatsky
@ 2015-11-18 16:17 ` Sudeep Dutt
  2015-11-19  0:21   ` Sergey Senozhatsky
  0 siblings, 1 reply; 3+ messages in thread
From: Sudeep Dutt @ 2015-11-18 16:17 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Sudeep Dutt, Greg Kroah-Hartman, Dan Carpenter, linux-kernel,
	Sergey Senozhatsky

On Wed, 2015-11-18 at 21:10 +0900, Sergey Senozhatsky wrote:
> Cosmetic.
> 
> Do not define list_entry_next() and use list_next_entry()
> from list.h.
> 

Hi Sergey,

A similar patch was posted @ https://lkml.org/lkml/2015/11/16/328

Regards,
Sudeep Dutt

> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---
>  drivers/misc/mic/scif/scif_dma.c  | 27 +++++++++++----------------
>  drivers/misc/mic/scif/scif_main.h |  1 +
>  2 files changed, 12 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/misc/mic/scif/scif_dma.c b/drivers/misc/mic/scif/scif_dma.c
> index 95a13c6..8804bcc 100644
> --- a/drivers/misc/mic/scif/scif_dma.c
> +++ b/drivers/misc/mic/scif/scif_dma.c
> @@ -74,11 +74,6 @@ struct scif_copy_work {
>  	bool ordered;
>  };
>  
> -#ifndef list_entry_next
> -#define list_entry_next(pos, member) \
> -	list_entry(pos->member.next, typeof(*pos), member)
> -#endif
> -
>  /**
>   * scif_reserve_dma_chan:
>   * @ep: Endpoint Descriptor.
> @@ -851,7 +846,7 @@ static void scif_rma_local_cpu_copy(s64 offset, struct scif_window *window,
>  		(window->nr_pages << PAGE_SHIFT);
>  	while (rem_len) {
>  		if (offset == end_offset) {
> -			window = list_entry_next(window, list);
> +			window = list_next_entry(window, list);
>  			end_offset = window->offset +
>  				(window->nr_pages << PAGE_SHIFT);
>  		}
> @@ -957,7 +952,7 @@ scif_rma_list_dma_copy_unaligned(struct scif_copy_work *work,
>  	remaining_len -= tail_len;
>  	while (remaining_len) {
>  		if (offset == end_offset) {
> -			window = list_entry_next(window, list);
> +			window = list_next_entry(window, list);
>  			end_offset = window->offset +
>  				(window->nr_pages << PAGE_SHIFT);
>  		}
> @@ -1064,7 +1059,7 @@ scif_rma_list_dma_copy_unaligned(struct scif_copy_work *work,
>  	}
>  	if (tail_len) {
>  		if (offset == end_offset) {
> -			window = list_entry_next(window, list);
> +			window = list_next_entry(window, list);
>  			end_offset = window->offset +
>  				(window->nr_pages << PAGE_SHIFT);
>  		}
> @@ -1147,13 +1142,13 @@ static int _scif_rma_list_dma_copy_aligned(struct scif_copy_work *work,
>  		(dst_window->nr_pages << PAGE_SHIFT);
>  	while (remaining_len) {
>  		if (src_offset == end_src_offset) {
> -			src_window = list_entry_next(src_window, list);
> +			src_window = list_next_entry(src_window, list);
>  			end_src_offset = src_window->offset +
>  				(src_window->nr_pages << PAGE_SHIFT);
>  			scif_init_window_iter(src_window, &src_win_iter);
>  		}
>  		if (dst_offset == end_dst_offset) {
> -			dst_window = list_entry_next(dst_window, list);
> +			dst_window = list_next_entry(dst_window, list);
>  			end_dst_offset = dst_window->offset +
>  				(dst_window->nr_pages << PAGE_SHIFT);
>  			scif_init_window_iter(dst_window, &dst_win_iter);
> @@ -1314,13 +1309,13 @@ static int scif_rma_list_dma_copy_aligned(struct scif_copy_work *work,
>  	remaining_len -= tail_len;
>  	while (remaining_len) {
>  		if (src_offset == end_src_offset) {
> -			src_window = list_entry_next(src_window, list);
> +			src_window = list_next_entry(src_window, list);
>  			end_src_offset = src_window->offset +
>  				(src_window->nr_pages << PAGE_SHIFT);
>  			scif_init_window_iter(src_window, &src_win_iter);
>  		}
>  		if (dst_offset == end_dst_offset) {
> -			dst_window = list_entry_next(dst_window, list);
> +			dst_window = list_next_entry(dst_window, list);
>  			end_dst_offset = dst_window->offset +
>  				(dst_window->nr_pages << PAGE_SHIFT);
>  			scif_init_window_iter(dst_window, &dst_win_iter);
> @@ -1405,9 +1400,9 @@ static int scif_rma_list_dma_copy_aligned(struct scif_copy_work *work,
>  	if (remaining_len) {
>  		loop_len = remaining_len;
>  		if (src_offset == end_src_offset)
> -			src_window = list_entry_next(src_window, list);
> +			src_window = list_next_entry(src_window, list);
>  		if (dst_offset == end_dst_offset)
> -			dst_window = list_entry_next(dst_window, list);
> +			dst_window = list_next_entry(dst_window, list);
>  
>  		src_dma_addr = __scif_off_to_dma_addr(src_window, src_offset);
>  		dst_dma_addr = __scif_off_to_dma_addr(dst_window, dst_offset);
> @@ -1550,12 +1545,12 @@ static int scif_rma_list_cpu_copy(struct scif_copy_work *work)
>  			end_dst_offset = dst_window->offset +
>  				(dst_window->nr_pages << PAGE_SHIFT);
>  			if (src_offset == end_src_offset) {
> -				src_window = list_entry_next(src_window, list);
> +				src_window = list_next_entry(src_window, list);
>  				scif_init_window_iter(src_window,
>  						      &src_win_iter);
>  			}
>  			if (dst_offset == end_dst_offset) {
> -				dst_window = list_entry_next(dst_window, list);
> +				dst_window = list_next_entry(dst_window, list);
>  				scif_init_window_iter(dst_window,
>  						      &dst_win_iter);
>  			}
> diff --git a/drivers/misc/mic/scif/scif_main.h b/drivers/misc/mic/scif/scif_main.h
> index a08f0b6..9082f83 100644
> --- a/drivers/misc/mic/scif/scif_main.h
> +++ b/drivers/misc/mic/scif/scif_main.h
> @@ -27,6 +27,7 @@
>  #include <linux/file.h>
>  #include <linux/vmalloc.h>
>  #include <linux/scif.h>
> +#include <linux/list.h>
>  #include "../common/mic_dev.h"
>  
>  #define SCIF_MGMT_NODE 0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/3] misc:scif: do not define list_entry_next
  2015-11-18 16:17 ` Sudeep Dutt
@ 2015-11-19  0:21   ` Sergey Senozhatsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Senozhatsky @ 2015-11-19  0:21 UTC (permalink / raw)
  To: Sudeep Dutt
  Cc: Sergey Senozhatsky, Greg Kroah-Hartman, Dan Carpenter,
	linux-kernel, Sergey Senozhatsky

On (11/18/15 08:17), Sudeep Dutt wrote:
> On Wed, 2015-11-18 at 21:10 +0900, Sergey Senozhatsky wrote:
> > Cosmetic.
> > 
> > Do not define list_entry_next() and use list_next_entry()
> > from list.h.
> > 
> 
> Hi Sergey,
> 
> A similar patch was posted @ https://lkml.org/lkml/2015/11/16/328

Oh, sorry for the noise then. thanks!

	-ss

> 
> Regards,
> Sudeep Dutt
> 
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> > ---
> >  drivers/misc/mic/scif/scif_dma.c  | 27 +++++++++++----------------
> >  drivers/misc/mic/scif/scif_main.h |  1 +
> >  2 files changed, 12 insertions(+), 16 deletions(-)
> > 
> > diff --git a/drivers/misc/mic/scif/scif_dma.c b/drivers/misc/mic/scif/scif_dma.c
> > index 95a13c6..8804bcc 100644
> > --- a/drivers/misc/mic/scif/scif_dma.c
> > +++ b/drivers/misc/mic/scif/scif_dma.c
> > @@ -74,11 +74,6 @@ struct scif_copy_work {
> >  	bool ordered;
> >  };
> >  
> > -#ifndef list_entry_next
> > -#define list_entry_next(pos, member) \
> > -	list_entry(pos->member.next, typeof(*pos), member)
> > -#endif
> > -
> >  /**
> >   * scif_reserve_dma_chan:
> >   * @ep: Endpoint Descriptor.
> > @@ -851,7 +846,7 @@ static void scif_rma_local_cpu_copy(s64 offset, struct scif_window *window,
> >  		(window->nr_pages << PAGE_SHIFT);
> >  	while (rem_len) {
> >  		if (offset == end_offset) {
> > -			window = list_entry_next(window, list);
> > +			window = list_next_entry(window, list);
> >  			end_offset = window->offset +
> >  				(window->nr_pages << PAGE_SHIFT);
> >  		}
> > @@ -957,7 +952,7 @@ scif_rma_list_dma_copy_unaligned(struct scif_copy_work *work,
> >  	remaining_len -= tail_len;
> >  	while (remaining_len) {
> >  		if (offset == end_offset) {
> > -			window = list_entry_next(window, list);
> > +			window = list_next_entry(window, list);
> >  			end_offset = window->offset +
> >  				(window->nr_pages << PAGE_SHIFT);
> >  		}
> > @@ -1064,7 +1059,7 @@ scif_rma_list_dma_copy_unaligned(struct scif_copy_work *work,
> >  	}
> >  	if (tail_len) {
> >  		if (offset == end_offset) {
> > -			window = list_entry_next(window, list);
> > +			window = list_next_entry(window, list);
> >  			end_offset = window->offset +
> >  				(window->nr_pages << PAGE_SHIFT);
> >  		}
> > @@ -1147,13 +1142,13 @@ static int _scif_rma_list_dma_copy_aligned(struct scif_copy_work *work,
> >  		(dst_window->nr_pages << PAGE_SHIFT);
> >  	while (remaining_len) {
> >  		if (src_offset == end_src_offset) {
> > -			src_window = list_entry_next(src_window, list);
> > +			src_window = list_next_entry(src_window, list);
> >  			end_src_offset = src_window->offset +
> >  				(src_window->nr_pages << PAGE_SHIFT);
> >  			scif_init_window_iter(src_window, &src_win_iter);
> >  		}
> >  		if (dst_offset == end_dst_offset) {
> > -			dst_window = list_entry_next(dst_window, list);
> > +			dst_window = list_next_entry(dst_window, list);
> >  			end_dst_offset = dst_window->offset +
> >  				(dst_window->nr_pages << PAGE_SHIFT);
> >  			scif_init_window_iter(dst_window, &dst_win_iter);
> > @@ -1314,13 +1309,13 @@ static int scif_rma_list_dma_copy_aligned(struct scif_copy_work *work,
> >  	remaining_len -= tail_len;
> >  	while (remaining_len) {
> >  		if (src_offset == end_src_offset) {
> > -			src_window = list_entry_next(src_window, list);
> > +			src_window = list_next_entry(src_window, list);
> >  			end_src_offset = src_window->offset +
> >  				(src_window->nr_pages << PAGE_SHIFT);
> >  			scif_init_window_iter(src_window, &src_win_iter);
> >  		}
> >  		if (dst_offset == end_dst_offset) {
> > -			dst_window = list_entry_next(dst_window, list);
> > +			dst_window = list_next_entry(dst_window, list);
> >  			end_dst_offset = dst_window->offset +
> >  				(dst_window->nr_pages << PAGE_SHIFT);
> >  			scif_init_window_iter(dst_window, &dst_win_iter);
> > @@ -1405,9 +1400,9 @@ static int scif_rma_list_dma_copy_aligned(struct scif_copy_work *work,
> >  	if (remaining_len) {
> >  		loop_len = remaining_len;
> >  		if (src_offset == end_src_offset)
> > -			src_window = list_entry_next(src_window, list);
> > +			src_window = list_next_entry(src_window, list);
> >  		if (dst_offset == end_dst_offset)
> > -			dst_window = list_entry_next(dst_window, list);
> > +			dst_window = list_next_entry(dst_window, list);
> >  
> >  		src_dma_addr = __scif_off_to_dma_addr(src_window, src_offset);
> >  		dst_dma_addr = __scif_off_to_dma_addr(dst_window, dst_offset);
> > @@ -1550,12 +1545,12 @@ static int scif_rma_list_cpu_copy(struct scif_copy_work *work)
> >  			end_dst_offset = dst_window->offset +
> >  				(dst_window->nr_pages << PAGE_SHIFT);
> >  			if (src_offset == end_src_offset) {
> > -				src_window = list_entry_next(src_window, list);
> > +				src_window = list_next_entry(src_window, list);
> >  				scif_init_window_iter(src_window,
> >  						      &src_win_iter);
> >  			}
> >  			if (dst_offset == end_dst_offset) {
> > -				dst_window = list_entry_next(dst_window, list);
> > +				dst_window = list_next_entry(dst_window, list);
> >  				scif_init_window_iter(dst_window,
> >  						      &dst_win_iter);
> >  			}
> > diff --git a/drivers/misc/mic/scif/scif_main.h b/drivers/misc/mic/scif/scif_main.h
> > index a08f0b6..9082f83 100644
> > --- a/drivers/misc/mic/scif/scif_main.h
> > +++ b/drivers/misc/mic/scif/scif_main.h
> > @@ -27,6 +27,7 @@
> >  #include <linux/file.h>
> >  #include <linux/vmalloc.h>
> >  #include <linux/scif.h>
> > +#include <linux/list.h>
> >  #include "../common/mic_dev.h"
> >  
> >  #define SCIF_MGMT_NODE 0
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-19  0:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-18 12:10 [PATCH 1/3] misc:scif: do not define list_entry_next Sergey Senozhatsky
2015-11-18 16:17 ` Sudeep Dutt
2015-11-19  0:21   ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox