summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2005-05-13 19:00:11 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2005-05-13 19:00:11 +0000
commitac8112a615bf00cbda21b8489a72ce6b1aa35c47 (patch)
treef43e2391a403d0f8609c93816a751c192a3e2b14 /sys
parent99fb3a0f1e2d93f19c1c42c805fc69c9cd3fd175 (diff)
simplify test conditions. ((v & f1) || (v & f2)) <=> (v & (f1 | f2)) in
these particular cases. avoid extra calls to letoh32().
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/ral.c22
-rw-r--r--sys/dev/usb/if_ral.c12
2 files changed, 14 insertions, 20 deletions
diff --git a/sys/dev/ic/ral.c b/sys/dev/ic/ral.c
index cd223285e99..b84af1c3773 100644
--- a/sys/dev/ic/ral.c
+++ b/sys/dev/ic/ral.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ral.c,v 1.49 2005/04/17 13:41:48 damien Exp $ */
+/* $OpenBSD: ral.c,v 1.50 2005/05/13 19:00:07 damien Exp $ */
/*-
* Copyright (c) 2005
@@ -1021,8 +1021,7 @@ ral_encryption_intr(struct ral_softc *sc)
sc->txq.next_encrypt * RAL_TX_DESC_SIZE, RAL_TX_DESC_SIZE,
BUS_DMASYNC_POSTREAD);
- if ((letoh32(desc->flags) & RAL_TX_BUSY) ||
- (letoh32(desc->flags) & RAL_TX_CIPHER_BUSY))
+ if (letoh32(desc->flags) & (RAL_TX_BUSY | RAL_TX_CIPHER_BUSY))
break;
/* for TKIP, swap eiv field to fix a bug in ASIC */
@@ -1228,8 +1227,7 @@ ral_decryption_intr(struct ral_softc *sc)
sc->rxq.cur_decrypt * RAL_TX_DESC_SIZE, RAL_TX_DESC_SIZE,
BUS_DMASYNC_POSTREAD);
- if ((letoh32(desc->flags) & RAL_RX_BUSY) ||
- (letoh32(desc->flags) & RAL_RX_CIPHER_BUSY))
+ if (letoh32(desc->flags) & (RAL_RX_BUSY | RAL_RX_CIPHER_BUSY))
break;
if (data->drop) {
@@ -1352,14 +1350,13 @@ ral_rx_intr(struct ral_softc *sc)
sc->rxq.cur * RAL_RX_DESC_SIZE, RAL_RX_DESC_SIZE,
BUS_DMASYNC_POSTREAD);
- if ((letoh32(desc->flags) & RAL_RX_BUSY) ||
- (letoh32(desc->flags) & RAL_RX_CIPHER_BUSY))
+ if (letoh32(desc->flags) & (RAL_RX_BUSY | RAL_RX_CIPHER_BUSY))
break;
data->drop = 0;
- if ((letoh32(desc->flags) & RAL_RX_PHY_ERROR) ||
- (letoh32(desc->flags) & RAL_RX_CRC_ERROR)) {
+ if (letoh32(desc->flags) &
+ (RAL_RX_PHY_ERROR | RAL_RX_CRC_ERROR)) {
/*
* This should not happen since we did not request
* to receive those frames when we filled RXCSR0.
@@ -1711,10 +1708,9 @@ ral_tx_mgt(struct ral_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
*(uint16_t *)wh->i_dur = htole16(dur);
/* tell hardware to add timestamp for probe responses */
- if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
- IEEE80211_FC0_TYPE_MGT &&
- (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) ==
- IEEE80211_FC0_SUBTYPE_PROBE_RESP)
+ if ((wh->i_fc[0] &
+ (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
+ (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
flags |= RAL_TX_TIMESTAMP;
}
diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c
index 5e37b2c1918..262a76d2f4b 100644
--- a/sys/dev/usb/if_ral.c
+++ b/sys/dev/usb/if_ral.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ral.c,v 1.30 2005/05/13 18:42:50 damien Exp $ */
+/* $OpenBSD: if_ral.c,v 1.31 2005/05/13 19:00:10 damien Exp $ */
/*-
* Copyright (c) 2005
@@ -854,8 +854,7 @@ ural_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
/* rx descriptor is located at the end */
desc = (struct ural_rx_desc *)(data->buf + len - RAL_RX_DESC_SIZE);
- if ((letoh32(desc->flags) & RAL_RX_PHY_ERROR) ||
- (letoh32(desc->flags) & RAL_RX_CRC_ERROR)) {
+ if (letoh32(desc->flags) & (RAL_RX_PHY_ERROR | RAL_RX_CRC_ERROR)) {
/*
* This should not happen since we did not request to receive
* those frames when we filled RAL_TXRX_CSR2.
@@ -1187,10 +1186,9 @@ ural_tx_mgt(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
*(uint16_t *)wh->i_dur = htole16(dur);
/* tell hardware to add timestamp for probe responses */
- if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
- IEEE80211_FC0_TYPE_MGT &&
- (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) ==
- IEEE80211_FC0_SUBTYPE_PROBE_RESP)
+ if ((wh->i_fc[0] &
+ (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) ==
+ (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP))
flags |= RAL_TX_TIMESTAMP;
}