netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: akpm@linux-foundation.org
To: kaber@trash.net
Cc: netfilter-devel@vger.kernel.org, akpm@linux-foundation.org,
	florian@openwrt.org, davem@davemloft.net, horms@verge.net.au,
	juliusv@google.com, sshtylyov@ru.mvista.com, tiwai@suse.de
Subject: [patch 1/1] net/netfilter/ipvs/ip_vs_wrr.c: use lib/gcd.c
Date: Mon, 21 Dec 2009 16:37:23 -0800	[thread overview]
Message-ID: <200912220037.nBM0bNBZ005989@imap1.linux-foundation.org> (raw)

From: Florian Fainelli <florian@openwrt.org>

Remove the private version of the greatest common divider to use
lib/gcd.c, the latter also implementing the a < b case.

[akpm@linux-foundation.org: repair neighboring whitespace because the diff looked odd]
Signed-off-by: Florian Fainelli <florian@openwrt.org>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Takashi Iwai <tiwai@suse.de>
Acked-by: Simon Horman <horms@verge.net.au>
Cc: Julius Volz <juliusv@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 net/netfilter/ipvs/Kconfig     |    3 ++-
 net/netfilter/ipvs/ip_vs_wrr.c |   15 +--------------
 2 files changed, 3 insertions(+), 15 deletions(-)

diff -puN net/netfilter/ipvs/Kconfig~net-netfilter-ipvs-ip_vs_wrrc-use-lib-gcdc net/netfilter/ipvs/Kconfig
--- a/net/netfilter/ipvs/Kconfig~net-netfilter-ipvs-ip_vs_wrrc-use-lib-gcdc
+++ a/net/netfilter/ipvs/Kconfig
@@ -112,7 +112,8 @@ config	IP_VS_RR
 	  module, choose M here. If unsure, say N.
  
 config	IP_VS_WRR
-        tristate "weighted round-robin scheduling" 
+	tristate "weighted round-robin scheduling"
+	select GCD
 	---help---
 	  The weighted robin-robin scheduling algorithm directs network
 	  connections to different real servers based on server weights
diff -puN net/netfilter/ipvs/ip_vs_wrr.c~net-netfilter-ipvs-ip_vs_wrrc-use-lib-gcdc net/netfilter/ipvs/ip_vs_wrr.c
--- a/net/netfilter/ipvs/ip_vs_wrr.c~net-netfilter-ipvs-ip_vs_wrrc-use-lib-gcdc
+++ a/net/netfilter/ipvs/ip_vs_wrr.c
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/net.h>
+#include <linux/gcd.h>
 
 #include <net/ip_vs.h>
 
@@ -38,20 +39,6 @@ struct ip_vs_wrr_mark {
 };
 
 
-/*
- *    Get the gcd of server weights
- */
-static int gcd(int a, int b)
-{
-	int c;
-
-	while ((c = a % b)) {
-		a = b;
-		b = c;
-	}
-	return b;
-}
-
 static int ip_vs_wrr_gcd_weight(struct ip_vs_service *svc)
 {
 	struct ip_vs_dest *dest;
_

             reply	other threads:[~2009-12-22  0:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-22  0:37 akpm [this message]
2009-12-22  8:43 ` [patch 1/1] net/netfilter/ipvs/ip_vs_wrr.c: use lib/gcd.c Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200912220037.nBM0bNBZ005989@imap1.linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=florian@openwrt.org \
    --cc=horms@verge.net.au \
    --cc=juliusv@google.com \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=sshtylyov@ru.mvista.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).