svn commit: r299176 - head/sys/dev/usb/wlan

Pedro F. Giffuni pfg at FreeBSD.org
Fri May 6 15:09:23 UTC 2016


Author: pfg
Date: Fri May  6 15:09:21 2016
New Revision: 299176
URL: https://svnweb.freebsd.org/changeset/base/299176

Log:
  dev/usb: unsigned some loop indexes.
  
  Although usually small, values produced by nitems() are unsigned.
  By unsigning the corresponding indexes we avoid signed vs unsigned
  comparisons. This may have some effect on performance, although given the
  small sizes the effect will not be perceivable, and it makes the code
  clearer.
  
  Respect the style of the changed files: one uses u_int while the other
  uses "unsigned int".
  
  Reviewed by:	hselasky

Modified:
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_urtw.c

Modified: head/sys/dev/usb/wlan/if_run.c
==============================================================================
--- head/sys/dev/usb/wlan/if_run.c	Fri May  6 13:45:42 2016	(r299175)
+++ head/sys/dev/usb/wlan/if_run.c	Fri May  6 15:09:21 2016	(r299176)
@@ -5222,7 +5222,7 @@ run_rssi2dbm(struct run_softc *sc, uint8
 static void
 run_rt5390_bbp_init(struct run_softc *sc)
 {
-	int i;
+	u_int i;
 	uint8_t bbp;
 
 	/* Apply maximum likelihood detection for 2 stream case. */
@@ -5332,7 +5332,7 @@ run_rt3070_rf_init(struct run_softc *sc)
 {
 	uint32_t tmp;
 	uint8_t bbp4, mingain, rf, target;
-	int i;
+	u_int i;
 
 	run_rt3070_rf_read(sc, 30, &rf);
 	/* toggle RF R30 bit 7 */
@@ -5476,7 +5476,7 @@ run_rt3593_rf_init(struct run_softc *sc)
 {
 	uint32_t tmp;
 	uint8_t rf;
-	int i;
+	u_int i;
 
 	/* Disable the GPIO bits 4 and 7 for LNA PE control. */
 	run_read(sc, RT3070_GPIO_SWITCH, &tmp);
@@ -5525,7 +5525,7 @@ run_rt5390_rf_init(struct run_softc *sc)
 {
 	uint32_t tmp;
 	uint8_t rf;
-	int i;
+	u_int i;
 
 	/* Toggle RF R2 to initiate calibration. */
 	if (sc->mac_ver == 0x5390) {

Modified: head/sys/dev/usb/wlan/if_urtw.c
==============================================================================
--- head/sys/dev/usb/wlan/if_urtw.c	Fri May  6 13:45:42 2016	(r299175)
+++ head/sys/dev/usb/wlan/if_urtw.c	Fri May  6 15:09:21 2016	(r299176)
@@ -1910,7 +1910,7 @@ fail:
 static uint16_t
 urtw_rate2rtl(uint32_t rate)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < nitems(urtw_ratetable); i++) {
 		if (rate == urtw_ratetable[i].reg)
@@ -1923,7 +1923,7 @@ urtw_rate2rtl(uint32_t rate)
 static uint16_t
 urtw_rtl2rate(uint32_t rate)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < nitems(urtw_ratetable); i++) {
 		if (rate == urtw_ratetable[i].val)
@@ -2450,7 +2450,7 @@ fail:
 static usb_error_t
 urtw_8225_rf_init(struct urtw_softc *sc)
 {
-	int i;
+	unsigned int i;
 	uint16_t data;
 	usb_error_t error;
 
@@ -2831,7 +2831,7 @@ fail:
 static usb_error_t
 urtw_8225v2_rf_init(struct urtw_softc *sc)
 {
-	int i;
+	unsigned int i;
 	uint16_t data;
 	uint32_t data32;
 	usb_error_t error;
@@ -3164,7 +3164,7 @@ static usb_error_t
 urtw_8225v2b_rf_init(struct urtw_softc *sc)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
-	int i;
+	unsigned int i;
 	uint8_t data8;
 	usb_error_t error;
 


More information about the svn-src-head mailing list