b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: Remove uses of return value of seq_printf
@ 2015-02-17  1:31 Joe Perches
  2015-02-17 12:15 ` Antonio Quartulli
  2015-02-20 20:18 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Joe Perches @ 2015-02-17  1:31 UTC (permalink / raw)
  To: Marek Lindner, Antonio Quartulli; +Cc: netdev, b.a.t.m.a.n, LKML

This function is soon going to return void so remove the
return value use.

Convert the return value to test seq_has_overflowed() instead.

Signed-off-by: Joe Perches <joe@perches.com>
---
 net/batman-adv/gateway_client.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 27649e8..a0876ea 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -592,15 +592,16 @@ static int batadv_write_buffer_text(struct batadv_priv *bat_priv,
 
 	curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
 
-	ret = seq_printf(seq, "%s %pM (%3i) %pM [%10s]: %u.%u/%u.%u MBit\n",
-			 (curr_gw == gw_node ? "=>" : "  "),
-			 gw_node->orig_node->orig,
-			 router_ifinfo->bat_iv.tq_avg, router->addr,
-			 router->if_incoming->net_dev->name,
-			 gw_node->bandwidth_down / 10,
-			 gw_node->bandwidth_down % 10,
-			 gw_node->bandwidth_up / 10,
-			 gw_node->bandwidth_up % 10);
+	seq_printf(seq, "%s %pM (%3i) %pM [%10s]: %u.%u/%u.%u MBit\n",
+		   (curr_gw == gw_node ? "=>" : "  "),
+		   gw_node->orig_node->orig,
+		   router_ifinfo->bat_iv.tq_avg, router->addr,
+		   router->if_incoming->net_dev->name,
+		   gw_node->bandwidth_down / 10,
+		   gw_node->bandwidth_down % 10,
+		   gw_node->bandwidth_up / 10,
+		   gw_node->bandwidth_up % 10);
+	ret = seq_has_overflowed(seq);
 
 	if (curr_gw)
 		batadv_gw_node_free_ref(curr_gw);



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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Remove uses of return value of seq_printf
  2015-02-17  1:31 [B.A.T.M.A.N.] [PATCH] batman-adv: Remove uses of return value of seq_printf Joe Perches
@ 2015-02-17 12:15 ` Antonio Quartulli
  2015-02-20 20:18 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: Antonio Quartulli @ 2015-02-17 12:15 UTC (permalink / raw)
  To: Joe Perches, Marek Lindner; +Cc: netdev, b.a.t.m.a.n, LKML

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

Hi Joe,

thank you very much for this patch.

On 17/02/15 02:31, Joe Perches wrote:
> This function is soon going to return void so remove the
> return value use.
> 
> Convert the return value to test seq_has_overflowed() instead.
> 
> Signed-off-by: Joe Perches <joe@perches.com>


Acked-by: Antonio Quartulli <antonio@meshcoding.com>


-- 
Antonio Quartulli


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Remove uses of return value of seq_printf
  2015-02-17  1:31 [B.A.T.M.A.N.] [PATCH] batman-adv: Remove uses of return value of seq_printf Joe Perches
  2015-02-17 12:15 ` Antonio Quartulli
@ 2015-02-20 20:18 ` David Miller
  2015-02-22 21:47   ` [B.A.T.M.A.N.] [PATCH net-next] batman-adv: Fix use of seq_has_overflowed() Joe Perches
  1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2015-02-20 20:18 UTC (permalink / raw)
  To: joe; +Cc: netdev, b.a.t.m.a.n, mareklindner, antonio, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Mon, 16 Feb 2015 17:31:39 -0800

> This function is soon going to return void so remove the
> return value use.
> 
> Convert the return value to test seq_has_overflowed() instead.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied to net-next.

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

* [B.A.T.M.A.N.] [PATCH net-next] batman-adv: Fix use of seq_has_overflowed()
  2015-02-20 20:18 ` David Miller
@ 2015-02-22 21:47   ` Joe Perches
  2015-02-22 22:00     ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2015-02-22 21:47 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, b.a.t.m.a.n, mareklindner, antonio, linux-kernel

net-next commit 6d91147d183c ("batman-adv: Remove uses of return value
of seq_printf") incorrectly changed the overflow occurred return from
-1 to 1.  Change it back so that the test of batadv_write_buffer_text's
return value in batadv_gw_client_seq_print_text works properly.

Signed-off-by: Joe Perches <joe@perches.com>
---

sorry 'bout that.

I believe this won't have any real effect unless there
are something like 500+ entries in the gateway list.

 net/batman-adv/gateway_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index a0876ea..090828c 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -601,7 +601,7 @@ static int batadv_write_buffer_text(struct batadv_priv *bat_priv,
 		   gw_node->bandwidth_down % 10,
 		   gw_node->bandwidth_up / 10,
 		   gw_node->bandwidth_up % 10);
-	ret = seq_has_overflowed(seq);
+	ret = seq_has_overflowed(seq) ? -1 : 0;
 
 	if (curr_gw)
 		batadv_gw_node_free_ref(curr_gw);



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

* Re: [B.A.T.M.A.N.] [PATCH net-next] batman-adv: Fix use of seq_has_overflowed()
  2015-02-22 21:47   ` [B.A.T.M.A.N.] [PATCH net-next] batman-adv: Fix use of seq_has_overflowed() Joe Perches
@ 2015-02-22 22:00     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-02-22 22:00 UTC (permalink / raw)
  To: joe; +Cc: netdev, b.a.t.m.a.n, mareklindner, antonio, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Sun, 22 Feb 2015 13:47:56 -0800

> net-next commit 6d91147d183c ("batman-adv: Remove uses of return value
> of seq_printf") incorrectly changed the overflow occurred return from
> -1 to 1.  Change it back so that the test of batadv_write_buffer_text's
> return value in batadv_gw_client_seq_print_text works properly.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied, thanks Joe.

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

end of thread, other threads:[~2015-02-22 22:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-17  1:31 [B.A.T.M.A.N.] [PATCH] batman-adv: Remove uses of return value of seq_printf Joe Perches
2015-02-17 12:15 ` Antonio Quartulli
2015-02-20 20:18 ` David Miller
2015-02-22 21:47   ` [B.A.T.M.A.N.] [PATCH net-next] batman-adv: Fix use of seq_has_overflowed() Joe Perches
2015-02-22 22:00     ` David Miller

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).