linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Staging: lustre: lnet: lnet: router.c : fix 80 char limit
@ 2015-03-18 21:45 Redha Gouicem
  2015-03-18 21:45 ` [PATCH 2/2] Staging: lustre: lnet: lnet: router.c: fix useless statements Redha Gouicem
  2015-03-18 21:59 ` [PATCH 1/2] Staging: lustre: lnet: lnet: router.c : fix 80 char limit Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Redha Gouicem @ 2015-03-18 21:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Redha Gouicem

This fixes lines longer than 80 char which are not debug or error messages.

Signed-off-by: Redha Gouicem <redha.gouicem@gmail.com>
---
 drivers/staging/lustre/lnet/lnet/router.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c
index c0a6aeb..89a29b7 100644
--- a/drivers/staging/lustre/lnet/lnet/router.c
+++ b/drivers/staging/lustre/lnet/lnet/router.c
@@ -107,7 +107,8 @@ lnet_peers_start_down(void)
 }
 
 void
-lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, unsigned long when)
+lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive,
+		   unsigned long when)
 {
 	if (time_before(when, lp->lp_timestamp)) { /* out of date information */
 		CDEBUG(D_NET, "Out of date\n");
@@ -1435,7 +1436,8 @@ int
 lnet_rtrpools_alloc(int im_a_router)
 {
 	lnet_rtrbufpool_t *rtrp;
-	int	large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+	int	large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1)
+	  >> PAGE_CACHE_SHIFT;
 	int	small_pages = 1;
 	int	nrb_tiny;
 	int	nrb_small;
-- 
1.9.1


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

* [PATCH 2/2] Staging: lustre: lnet: lnet: router.c: fix useless statements
  2015-03-18 21:45 [PATCH 1/2] Staging: lustre: lnet: lnet: router.c : fix 80 char limit Redha Gouicem
@ 2015-03-18 21:45 ` Redha Gouicem
  2015-03-18 22:01   ` Greg KH
  2015-03-18 21:59 ` [PATCH 1/2] Staging: lustre: lnet: lnet: router.c : fix 80 char limit Greg KH
  1 sibling, 1 reply; 4+ messages in thread
From: Redha Gouicem @ 2015-03-18 21:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Redha Gouicem

This patch removes useless returns and elses.

Signed-off-by: Redha Gouicem <redha.gouicem@gmail.com>
---
 drivers/staging/lustre/lnet/lnet/router.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c
index 89a29b7..6fe79e2 100644
--- a/drivers/staging/lustre/lnet/lnet/router.c
+++ b/drivers/staging/lustre/lnet/lnet/router.c
@@ -270,7 +270,6 @@ static void lnet_shuffle_seed(void)
 	do_gettimeofday(&tv);
 	cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
 	seeded = 1;
-	return;
 }
 
 /* NB expects LNET_LOCK held */
@@ -357,11 +356,10 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway,
 
 		if (rc == -EHOSTUNREACH) { /* gateway is not on a local net */
 			return 0;	/* ignore the route entry */
-		} else {
-			CERROR("Error %d creating route %s %d %s\n", rc,
-			       libcfs_net2str(net), hops,
-			       libcfs_nid2str(gateway));
-		}
+		CERROR("Error %d creating route %s %d %s\n", rc,
+		       libcfs_net2str(net), hops,
+		       libcfs_nid2str(gateway));
+
 		return rc;
 	}
 
@@ -607,7 +605,6 @@ lnet_swap_pinginfo(lnet_ping_info_t *info)
 		__swab64s(&stat->ns_nid);
 		__swab32s(&stat->ns_status);
 	}
-	return;
 }
 
 /**
@@ -1011,7 +1008,6 @@ lnet_ping_router_locked(lnet_peer_t *rtr)
 	}
 
 	lnet_peer_decref_locked(rtr);
-	return;
 }
 
 int
@@ -1084,7 +1080,6 @@ lnet_router_checker_stop(void)
 
 	rc = LNetEQFree(the_lnet.ln_rc_eqh);
 	LASSERT(rc == 0);
-	return;
 }
 
 static void
@@ -1581,7 +1576,6 @@ EXPORT_SYMBOL(lnet_notify);
 void
 lnet_get_tunables(void)
 {
-	return;
 }
 
 #else
@@ -1670,7 +1664,6 @@ lnet_router_checker(void)
 	lnet_net_unlock(0);
 
 	running = 0; /* lock only needed for the recursion check */
-	return;
 }
 
 /* NB lnet_peers_start_down depends on me,
-- 
1.9.1


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

* Re: [PATCH 1/2] Staging: lustre: lnet: lnet: router.c : fix 80 char limit
  2015-03-18 21:45 [PATCH 1/2] Staging: lustre: lnet: lnet: router.c : fix 80 char limit Redha Gouicem
  2015-03-18 21:45 ` [PATCH 2/2] Staging: lustre: lnet: lnet: router.c: fix useless statements Redha Gouicem
@ 2015-03-18 21:59 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2015-03-18 21:59 UTC (permalink / raw)
  To: Redha Gouicem; +Cc: linux-kernel

On Wed, Mar 18, 2015 at 10:45:46PM +0100, Redha Gouicem wrote:
> This fixes lines longer than 80 char which are not debug or error messages.
> 
> Signed-off-by: Redha Gouicem <redha.gouicem@gmail.com>
> ---
>  drivers/staging/lustre/lnet/lnet/router.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c
> index c0a6aeb..89a29b7 100644
> --- a/drivers/staging/lustre/lnet/lnet/router.c
> +++ b/drivers/staging/lustre/lnet/lnet/router.c
> @@ -107,7 +107,8 @@ lnet_peers_start_down(void)
>  }
>  
>  void
> -lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, unsigned long when)
> +lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive,
> +		   unsigned long when)
>  {
>  	if (time_before(when, lp->lp_timestamp)) { /* out of date information */
>  		CDEBUG(D_NET, "Out of date\n");
> @@ -1435,7 +1436,8 @@ int
>  lnet_rtrpools_alloc(int im_a_router)
>  {
>  	lnet_rtrbufpool_t *rtrp;
> -	int	large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
> +	int	large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1)
> +	  >> PAGE_CACHE_SHIFT;

This last change doesn't really work in that it makes the code harder to
read now.  Yeah, the original code is a mess, one way to fix this would
be to not do the assignment here in the variable initializer, but move
it below in the code to be something like:

	int large_pages;

....

	large_pages = (LNET_MTU + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;

Can you fix this patch up to look like this and resend?

thanks,

greg k-h

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

* Re: [PATCH 2/2] Staging: lustre: lnet: lnet: router.c: fix useless statements
  2015-03-18 21:45 ` [PATCH 2/2] Staging: lustre: lnet: lnet: router.c: fix useless statements Redha Gouicem
@ 2015-03-18 22:01   ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2015-03-18 22:01 UTC (permalink / raw)
  To: Redha Gouicem; +Cc: linux-kernel

On Wed, Mar 18, 2015 at 10:45:47PM +0100, Redha Gouicem wrote:
> This patch removes useless returns and elses.
> 
> Signed-off-by: Redha Gouicem <redha.gouicem@gmail.com>
> ---
>  drivers/staging/lustre/lnet/lnet/router.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c
> index 89a29b7..6fe79e2 100644
> --- a/drivers/staging/lustre/lnet/lnet/router.c
> +++ b/drivers/staging/lustre/lnet/lnet/router.c
> @@ -270,7 +270,6 @@ static void lnet_shuffle_seed(void)
>  	do_gettimeofday(&tv);
>  	cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
>  	seeded = 1;
> -	return;
>  }
>  
>  /* NB expects LNET_LOCK held */
> @@ -357,11 +356,10 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway,
>  
>  		if (rc == -EHOSTUNREACH) { /* gateway is not on a local net */
>  			return 0;	/* ignore the route entry */
> -		} else {
> -			CERROR("Error %d creating route %s %d %s\n", rc,
> -			       libcfs_net2str(net), hops,
> -			       libcfs_nid2str(gateway));
> -		}
> +		CERROR("Error %d creating route %s %d %s\n", rc,
> +		       libcfs_net2str(net), hops,
> +		       libcfs_nid2str(gateway));
> +
>  		return rc;
>  	}
>  

This change broke the build :(

Please always test build your changes, cna you fix it up and resend?

thanks,

greg k-h

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

end of thread, other threads:[~2015-03-18 22:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-18 21:45 [PATCH 1/2] Staging: lustre: lnet: lnet: router.c : fix 80 char limit Redha Gouicem
2015-03-18 21:45 ` [PATCH 2/2] Staging: lustre: lnet: lnet: router.c: fix useless statements Redha Gouicem
2015-03-18 22:01   ` Greg KH
2015-03-18 21:59 ` [PATCH 1/2] Staging: lustre: lnet: lnet: router.c : fix 80 char limit Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).