netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: davem@davemloft.net
Cc: dccp@vger.kernel.org, netdev@vger.kernel.org,
	Gerrit Renker <gerrit@erg.abdn.ac.uk>
Subject: [PATCH 6/7] [CCID-2/3]: Fix sparse warnings
Date: Tue, 27 May 2008 09:32:46 +0100	[thread overview]
Message-ID: <1211877167-10995-7-git-send-email-gerrit@erg.abdn.ac.uk> (raw)
In-Reply-To: <1211877167-10995-6-git-send-email-gerrit@erg.abdn.ac.uk>

This patch fixes the following two sparse warnings:

 1. Due to a nested min(max()) expression, sparse gave the following warnings:

    net/dccp/ccids/ccid3.c:91:21: warning: symbol '__x' shadows an earlier one
    net/dccp/ccids/ccid3.c:91:21: warning: symbol '__y' shadows an earlier one

    (Didn't use clamp() here since this part is liketly to be split later, when
     implementing the changes from draft rfc3448bis.)

 2. Declaration of function prototypes was in .c instead of .h file.
    This resulted in "should it be static" warnings. Corrected by moving the
    declarations to the tfrc.h file instead of the tfrc.c file.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
 net/dccp/ccids/ccid3.c    |    3 ++-
 net/dccp/ccids/lib/tfrc.c |    8 --------
 net/dccp/ccids/lib/tfrc.h |   11 +++++++++--
 3 files changed, 11 insertions(+), 11 deletions(-)

--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -150,7 +150,8 @@ static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp)
 
 	} else if (ktime_us_delta(now, hctx->t_ld) - (s64)hctx->rtt >= 0) {
 
-		hctx->x = max(min(2 * hctx->x, min_rate),
+		hctx->x = min(2 * hctx->x, min_rate);
+		hctx->x = max(hctx->x,
 			      scaled_div(((u64)hctx->s) << 6, hctx->rtt));
 		hctx->t_ld = now;
 	}
--- a/net/dccp/ccids/lib/tfrc.c
+++ b/net/dccp/ccids/lib/tfrc.c
@@ -14,14 +14,6 @@ module_param(tfrc_debug, bool, 0444);
 MODULE_PARM_DESC(tfrc_debug, "Enable debug messages");
 #endif
 
-extern int  tfrc_tx_packet_history_init(void);
-extern void tfrc_tx_packet_history_exit(void);
-extern int  tfrc_rx_packet_history_init(void);
-extern void tfrc_rx_packet_history_exit(void);
-
-extern int  tfrc_li_init(void);
-extern void tfrc_li_exit(void);
-
 static int __init tfrc_module_init(void)
 {
 	int rc = tfrc_li_init();
--- a/net/dccp/ccids/lib/tfrc.h
+++ b/net/dccp/ccids/lib/tfrc.h
@@ -58,7 +58,14 @@ static inline u32 tfrc_ewma(const u32 avg, const u32 newval, const u8 weight)
 	return avg ? (weight * avg + (10 - weight) * newval) / 10 : newval;
 }
 
-extern u32 tfrc_calc_x(u16 s, u32 R, u32 p);
-extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue);
+extern u32  tfrc_calc_x(u16 s, u32 R, u32 p);
+extern u32  tfrc_calc_x_reverse_lookup(u32 fvalue);
 
+extern int  tfrc_tx_packet_history_init(void);
+extern void tfrc_tx_packet_history_exit(void);
+extern int  tfrc_rx_packet_history_init(void);
+extern void tfrc_rx_packet_history_exit(void);
+
+extern int  tfrc_li_init(void);
+extern void tfrc_li_exit(void);
 #endif /* _TFRC_H_ */
-- 
1.5.5


  reply	other threads:[~2008-05-27  8:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <dccp_bug_fixes_and_format_updates>
2008-05-27  8:32 ` [DCCP] [Patch 0/7]: Bug fixes and format updates Gerrit Renker
2008-05-27  8:32   ` [PATCH 1/7] [DCCP]: Fix to handle short sequence numbers packet correctly Gerrit Renker
2008-05-27  8:32     ` [PATCH 2/7] [CCID-2]: Remove ccid2hc{tx,rx}_ prefixes Gerrit Renker
2008-05-27  8:32       ` [PATCH 3/7] [CCID-3]: Remove ccid3hc{tx,rx}_ prefixes Gerrit Renker
2008-05-27  8:32         ` [PATCH 4/7] [CCID-3]: Fix "t_ipi explosion" bug Gerrit Renker
2008-05-27  8:32           ` [PATCH 5/7] [CCID-3]: Remove ugly RTT-sampling history lookup Gerrit Renker
2008-05-27  8:32             ` Gerrit Renker [this message]
2008-05-27  8:32               ` [PATCH 7/7] [TCP][DCCP]: Consolidate duplicate code which does RFC3390 conversion Gerrit Renker
2008-05-27 13:37                 ` David Miller
2008-05-28  6:24                   ` [Patch v2 1/1] [tcp/dccp]: " Gerrit Renker
2008-05-31 13:49                     ` [Patch v3 " Gerrit Renker
2008-05-27 13:37               ` [PATCH 6/7] [CCID-2/3]: Fix sparse warnings David Miller
2008-05-27 13:36             ` [PATCH 5/7] [CCID-3]: Remove ugly RTT-sampling history lookup David Miller
2008-05-27 13:35           ` [PATCH 4/7] [CCID-3]: Fix "t_ipi explosion" bug David Miller
2008-05-27 14:16             ` Gerrit Renker
2008-05-27 13:26         ` [PATCH 3/7] [CCID-3]: Remove ccid3hc{tx,rx}_ prefixes David Miller
2008-05-27 13:25       ` [PATCH 2/7] [CCID-2]: Remove ccid2hc{tx,rx}_ prefixes David Miller
2008-05-27 14:07         ` Gerrit Renker
2008-05-27 19:31           ` David Miller
2008-05-27 13:22     ` [PATCH 1/7] [DCCP]: Fix to handle short sequence numbers packet correctly David Miller
2008-05-28  6:12   ` [DCCP] [Patch 0/7]: Bug fixes and format updates Gerrit Renker

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=1211877167-10995-7-git-send-email-gerrit@erg.abdn.ac.uk \
    --to=gerrit@erg.abdn.ac.uk \
    --cc=davem@davemloft.net \
    --cc=dccp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).