From owner-svn-src-head@freebsd.org Tue Sep 22 02:25:53 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8ADDA05A42; Tue, 22 Sep 2015 02:25:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCEEC139F; Tue, 22 Sep 2015 02:25:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8M2PrPI075636; Tue, 22 Sep 2015 02:25:53 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8M2PqmH075633; Tue, 22 Sep 2015 02:25:52 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509220225.t8M2PqmH075633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 22 Sep 2015 02:25:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288086 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Sep 2015 02:25:54 -0000 Author: adrian Date: Tue Sep 22 02:25:52 2015 New Revision: 288086 URL: https://svnweb.freebsd.org/changeset/base/288086 Log: Remove duplicate use of RV(), LE_* and other macros. Submitted by: Andriy Voskoboinyk Differential Revision: https://reviews.freebsd.org/D3705 Modified: head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_proto.c head/sys/net80211/ieee80211_scan_sta.c Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Tue Sep 22 02:25:29 2015 (r288085) +++ head/sys/net80211/ieee80211_mesh.c Tue Sep 22 02:25:52 2015 (r288086) @@ -434,13 +434,12 @@ mesh_rt_flush_invalid(struct ieee80211va MESH_RT_UNLOCK(ms); } -#define N(a) (sizeof(a) / sizeof(a[0])) int ieee80211_mesh_register_proto_path(const struct ieee80211_mesh_proto_path *mpp) { int i, firstempty = -1; - for (i = 0; i < N(mesh_proto_paths); i++) { + for (i = 0; i < nitems(mesh_proto_paths); i++) { if (strncmp(mpp->mpp_descr, mesh_proto_paths[i].mpp_descr, IEEE80211_MESH_PROTO_DSZ) == 0) return EEXIST; @@ -460,7 +459,7 @@ ieee80211_mesh_register_proto_metric(con { int i, firstempty = -1; - for (i = 0; i < N(mesh_proto_metrics); i++) { + for (i = 0; i < nitems(mesh_proto_metrics); i++) { if (strncmp(mpm->mpm_descr, mesh_proto_metrics[i].mpm_descr, IEEE80211_MESH_PROTO_DSZ) == 0) return EEXIST; @@ -480,7 +479,7 @@ mesh_select_proto_path(struct ieee80211v struct ieee80211_mesh_state *ms = vap->iv_mesh; int i; - for (i = 0; i < N(mesh_proto_paths); i++) { + for (i = 0; i < nitems(mesh_proto_paths); i++) { if (strcasecmp(mesh_proto_paths[i].mpp_descr, name) == 0) { ms->ms_ppath = &mesh_proto_paths[i]; return 0; @@ -495,7 +494,7 @@ mesh_select_proto_metric(struct ieee8021 struct ieee80211_mesh_state *ms = vap->iv_mesh; int i; - for (i = 0; i < N(mesh_proto_metrics); i++) { + for (i = 0; i < nitems(mesh_proto_metrics); i++) { if (strcasecmp(mesh_proto_metrics[i].mpm_descr, name) == 0) { ms->ms_pmetric = &mesh_proto_metrics[i]; return 0; @@ -503,7 +502,6 @@ mesh_select_proto_metric(struct ieee8021 } return ENOENT; } -#undef N static void mesh_gatemode_setup(struct ieee80211vap *vap) Modified: head/sys/net80211/ieee80211_proto.c ============================================================================== --- head/sys/net80211/ieee80211_proto.c Tue Sep 22 02:25:29 2015 (r288085) +++ head/sys/net80211/ieee80211_proto.c Tue Sep 22 02:25:52 2015 (r288086) @@ -491,7 +491,6 @@ int ieee80211_fix_rate(struct ieee80211_node *ni, struct ieee80211_rateset *nrs, int flags) { -#define RV(v) ((v) & IEEE80211_RATE_VAL) struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; int i, j, rix, error; @@ -545,7 +544,8 @@ ieee80211_fix_rate(struct ieee80211_node * Sort rates. */ for (j = i + 1; j < nrs->rs_nrates; j++) { - if (RV(nrs->rs_rates[i]) > RV(nrs->rs_rates[j])) { + if (IEEE80211_RV(nrs->rs_rates[i]) > + IEEE80211_RV(nrs->rs_rates[j])) { r = nrs->rs_rates[i]; nrs->rs_rates[i] = nrs->rs_rates[j]; nrs->rs_rates[j] = r; @@ -604,8 +604,7 @@ ieee80211_fix_rate(struct ieee80211_node "ucastrate %x\n", __func__, fixedrate, ucastrate, flags); return badrate | IEEE80211_RATE_BASIC; } else - return RV(okrate); -#undef RV + return IEEE80211_RV(okrate); } /* Modified: head/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sta.c Tue Sep 22 02:25:29 2015 (r288085) +++ head/sys/net80211/ieee80211_scan_sta.c Tue Sep 22 02:25:52 2015 (r288086) @@ -737,12 +737,6 @@ sta_cancel(struct ieee80211_scan_state * return 0; } -/* unaligned little endian access */ -#define LE_READ_2(p) \ - ((uint16_t) \ - ((((const uint8_t *)(p))[0] ) | \ - (((const uint8_t *)(p))[1] << 8))) - /* * Demote any supplied 11g channel to 11b. There should * always be an 11b channel but we check anyway... @@ -876,7 +870,6 @@ static int check_rate(struct ieee80211vap *vap, const struct ieee80211_channel *chan, const struct ieee80211_scan_entry *se) { -#define RV(v) ((v) & IEEE80211_RATE_VAL) const struct ieee80211_rateset *srs; int i, j, nrs, r, okrate, badrate, fixedrate, ucastrate; const uint8_t *rs; @@ -891,7 +884,7 @@ check_rate(struct ieee80211vap *vap, con fixedrate = IEEE80211_FIXED_RATE_NONE; again: for (i = 0; i < nrs; i++) { - r = RV(rs[i]); + r = IEEE80211_RV(rs[i]); badrate = r; /* * Check any fixed rate is included. @@ -902,7 +895,7 @@ again: * Check against our supported rates. */ for (j = 0; j < srs->rs_nrates; j++) - if (r == RV(srs->rs_rates[j])) { + if (r == IEEE80211_RV(srs->rs_rates[j])) { if (r > okrate) /* NB: track max */ okrate = r; break; @@ -928,8 +921,7 @@ back: if (okrate == 0 || ucastrate != fixedrate) return badrate | IEEE80211_RATE_BASIC; else - return RV(okrate); -#undef RV + return IEEE80211_RV(okrate); } static __inline int