rt2500usb_register_write(rt2x00dev, TXRX_CSR1, reg);
rt2500usb_register_read(rt2x00dev, TXRX_CSR10, ®);
- if (preamble == SHORT_PREAMBLE)
- rt2x00_set_field16(®, TXRX_CSR10_AUTORESPOND_PREAMBLE, 1);
- else
- rt2x00_set_field16(®, TXRX_CSR10_AUTORESPOND_PREAMBLE, 0);
+ rt2x00_set_field16(®, TXRX_CSR10_AUTORESPOND_PREAMBLE,
+ (preamble == SHORT_PREAMBLE));
rt2500usb_register_write(rt2x00dev, TXRX_CSR10, reg);
}
rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg);
rt2x00pci_register_read(rt2x00dev, TXRX_CSR4, ®);
- if (preamble == SHORT_PREAMBLE)
- rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_PREAMBLE, 1);
- else
- rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_PREAMBLE, 0);
+ rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_PREAMBLE,
+ (preamble == SHORT_PREAMBLE));
rt2x00pci_register_write(rt2x00dev, TXRX_CSR4, reg);
}
reg = 0;
rt2x00_set_field32(®, PHY_CSR4_VALUE, value);
- if (rt2x00_rf(&rt2x00dev->chip, RF5225) ||
- rt2x00_rf(&rt2x00dev->chip, RF2527))
- rt2x00_set_field32(®, PHY_CSR4_NUMBER_OF_BITS, 21);
- else
- rt2x00_set_field32(®, PHY_CSR4_NUMBER_OF_BITS, 20);
-
+ /*
+ * RF5225 and RF2527 contain 21 bits per RF register value,
+ * all others contain 20 bits.
+ */
+ rt2x00_set_field32(®, PHY_CSR4_NUMBER_OF_BITS,
+ 20 + !!(rt2x00_rf(&rt2x00dev->chip, RF5225) ||
+ rt2x00_rf(&rt2x00dev->chip, RF2527)));
rt2x00_set_field32(®, PHY_CSR4_IF_SELECT, 0);
rt2x00_set_field32(®, PHY_CSR4_BUSY, 1);
rt73usb_register_write(rt2x00dev, TXRX_CSR0, reg);
rt73usb_register_read(rt2x00dev, TXRX_CSR4, ®);
- if (preamble == SHORT_PREAMBLE)
- rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_PREAMBLE, 1);
- else
- rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_PREAMBLE, 0);
+ rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_PREAMBLE,
+ (preamble == SHORT_PREAMBLE));
rt73usb_register_write(rt2x00dev, TXRX_CSR4, reg);
}