Staging: ks7010: sdio: Convert RX/TX queue macros into real functions.
Convert the unsafe macros into inline functions. Signed-off-by: Quytelda Kahja <quytelda@tamalin.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1646ff6c66
commit
2ec999e554
@ -32,19 +32,39 @@ static const struct sdio_device_id ks7010_sdio_ids[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(sdio, ks7010_sdio_ids);
|
||||
|
||||
#define inc_txqhead(priv) \
|
||||
(priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE)
|
||||
#define inc_txqtail(priv) \
|
||||
(priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE)
|
||||
#define cnt_txqbody(priv) \
|
||||
(((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - (priv->tx_dev.qhead)) % TX_DEVICE_BUFF_SIZE)
|
||||
static inline void inc_txqhead(struct ks_wlan_private *priv)
|
||||
{
|
||||
priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE;
|
||||
}
|
||||
|
||||
#define inc_rxqhead(priv) \
|
||||
(priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE)
|
||||
#define inc_rxqtail(priv) \
|
||||
(priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE)
|
||||
#define cnt_rxqbody(priv) \
|
||||
(((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - (priv->rx_dev.qhead)) % RX_DEVICE_BUFF_SIZE)
|
||||
static inline void inc_txqtail(struct ks_wlan_private *priv)
|
||||
{
|
||||
priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE;
|
||||
}
|
||||
|
||||
static inline unsigned int cnt_txqbody(struct ks_wlan_private *priv)
|
||||
{
|
||||
unsigned int tx_cnt = priv->tx_dev.qtail - priv->tx_dev.qhead;
|
||||
|
||||
return (tx_cnt + TX_DEVICE_BUFF_SIZE) % TX_DEVICE_BUFF_SIZE;
|
||||
}
|
||||
|
||||
static inline void inc_rxqhead(struct ks_wlan_private *priv)
|
||||
{
|
||||
priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE;
|
||||
}
|
||||
|
||||
static inline void inc_rxqtail(struct ks_wlan_private *priv)
|
||||
{
|
||||
priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE;
|
||||
}
|
||||
|
||||
static inline unsigned int cnt_rxqbody(struct ks_wlan_private *priv)
|
||||
{
|
||||
unsigned int rx_cnt = priv->rx_dev.qtail - priv->rx_dev.qhead;
|
||||
|
||||
return (rx_cnt + RX_DEVICE_BUFF_SIZE) % RX_DEVICE_BUFF_SIZE;
|
||||
}
|
||||
|
||||
/* Read single byte from device address into byte (CMD52) */
|
||||
static int ks7010_sdio_readb(struct ks_wlan_private *priv, unsigned int address,
|
||||
|
Loading…
Reference in New Issue
Block a user