Sort function prototypes and add missing 'static' keywords.

Submitted by:	Andriy Voskoboinyk <s3erios at gmail dot com>
Differential Revision:	https://reviews.freebsd.org/D3847
This commit is contained in:
Kevin Lo 2015-10-09 14:31:32 +00:00
parent b39ce43e4c
commit f4ea007a07
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=289066

View File

@ -188,10 +188,10 @@ static int urtwn_alloc_list(struct urtwn_softc *,
struct urtwn_data[], int, int);
static int urtwn_alloc_rx_list(struct urtwn_softc *);
static int urtwn_alloc_tx_list(struct urtwn_softc *);
static void urtwn_free_tx_list(struct urtwn_softc *);
static void urtwn_free_rx_list(struct urtwn_softc *);
static void urtwn_free_list(struct urtwn_softc *,
struct urtwn_data data[], int);
static void urtwn_free_rx_list(struct urtwn_softc *);
static void urtwn_free_tx_list(struct urtwn_softc *);
static struct urtwn_data * _urtwn_getbuf(struct urtwn_softc *);
static struct urtwn_data * urtwn_getbuf(struct urtwn_softc *);
static int urtwn_write_region_1(struct urtwn_softc *, uint16_t,
@ -265,10 +265,10 @@ static void urtwn_set_txpower(struct urtwn_softc *,
static void urtwn_scan_start(struct ieee80211com *);
static void urtwn_scan_end(struct ieee80211com *);
static void urtwn_set_channel(struct ieee80211com *);
static void urtwn_update_mcast(struct ieee80211com *);
static void urtwn_set_chan(struct urtwn_softc *,
struct ieee80211_channel *,
struct ieee80211_channel *);
static void urtwn_update_mcast(struct ieee80211com *);
static void urtwn_iq_calib(struct urtwn_softc *);
static void urtwn_lc_calib(struct urtwn_softc *);
static void urtwn_init(struct urtwn_softc *);
@ -470,20 +470,6 @@ urtwn_attach(device_t self)
return (ENXIO); /* failure */
}
static void
urtwn_drain_mbufq(struct urtwn_softc *sc)
{
struct mbuf *m;
struct ieee80211_node *ni;
URTWN_ASSERT_LOCKED(sc);
while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) {
ni = (struct ieee80211_node *)m->m_pkthdr.rcvif;
m->m_pkthdr.rcvif = NULL;
ieee80211_free_node(ni);
m_freem(m);
}
}
static int
urtwn_detach(device_t self)
{
@ -529,33 +515,16 @@ urtwn_detach(device_t self)
}
static void
urtwn_free_tx_list(struct urtwn_softc *sc)
urtwn_drain_mbufq(struct urtwn_softc *sc)
{
urtwn_free_list(sc, sc->sc_tx, URTWN_TX_LIST_COUNT);
}
static void
urtwn_free_rx_list(struct urtwn_softc *sc)
{
urtwn_free_list(sc, sc->sc_rx, URTWN_RX_LIST_COUNT);
}
static void
urtwn_free_list(struct urtwn_softc *sc, struct urtwn_data data[], int ndata)
{
int i;
for (i = 0; i < ndata; i++) {
struct urtwn_data *dp = &data[i];
if (dp->buf != NULL) {
free(dp->buf, M_USBDEV);
dp->buf = NULL;
}
if (dp->ni != NULL) {
ieee80211_free_node(dp->ni);
dp->ni = NULL;
}
struct mbuf *m;
struct ieee80211_node *ni;
URTWN_ASSERT_LOCKED(sc);
while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) {
ni = (struct ieee80211_node *)m->m_pkthdr.rcvif;
m->m_pkthdr.rcvif = NULL;
ieee80211_free_node(ni);
m_freem(m);
}
}
@ -874,6 +843,102 @@ urtwn_txeof(struct usb_xfer *xfer, struct urtwn_data *data)
sc->sc_txtimer = 0;
}
static int
urtwn_alloc_list(struct urtwn_softc *sc, struct urtwn_data data[],
int ndata, int maxsz)
{
int i, error;
for (i = 0; i < ndata; i++) {
struct urtwn_data *dp = &data[i];
dp->sc = sc;
dp->m = NULL;
dp->buf = malloc(maxsz, M_USBDEV, M_NOWAIT);
if (dp->buf == NULL) {
device_printf(sc->sc_dev,
"could not allocate buffer\n");
error = ENOMEM;
goto fail;
}
dp->ni = NULL;
}
return (0);
fail:
urtwn_free_list(sc, data, ndata);
return (error);
}
static int
urtwn_alloc_rx_list(struct urtwn_softc *sc)
{
int error, i;
error = urtwn_alloc_list(sc, sc->sc_rx, URTWN_RX_LIST_COUNT,
URTWN_RXBUFSZ);
if (error != 0)
return (error);
STAILQ_INIT(&sc->sc_rx_active);
STAILQ_INIT(&sc->sc_rx_inactive);
for (i = 0; i < URTWN_RX_LIST_COUNT; i++)
STAILQ_INSERT_HEAD(&sc->sc_rx_inactive, &sc->sc_rx[i], next);
return (0);
}
static int
urtwn_alloc_tx_list(struct urtwn_softc *sc)
{
int error, i;
error = urtwn_alloc_list(sc, sc->sc_tx, URTWN_TX_LIST_COUNT,
URTWN_TXBUFSZ);
if (error != 0)
return (error);
STAILQ_INIT(&sc->sc_tx_active);
STAILQ_INIT(&sc->sc_tx_inactive);
STAILQ_INIT(&sc->sc_tx_pending);
for (i = 0; i < URTWN_TX_LIST_COUNT; i++)
STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, &sc->sc_tx[i], next);
return (0);
}
static void
urtwn_free_list(struct urtwn_softc *sc, struct urtwn_data data[], int ndata)
{
int i;
for (i = 0; i < ndata; i++) {
struct urtwn_data *dp = &data[i];
if (dp->buf != NULL) {
free(dp->buf, M_USBDEV);
dp->buf = NULL;
}
if (dp->ni != NULL) {
ieee80211_free_node(dp->ni);
dp->ni = NULL;
}
}
}
static void
urtwn_free_rx_list(struct urtwn_softc *sc)
{
urtwn_free_list(sc, sc->sc_rx, URTWN_RX_LIST_COUNT);
}
static void
urtwn_free_tx_list(struct urtwn_softc *sc)
{
urtwn_free_list(sc, sc->sc_tx, URTWN_TX_LIST_COUNT);
}
static void
urtwn_bulk_tx_callback(struct usb_xfer *xfer, usb_error_t error)
{
@ -1762,7 +1827,6 @@ urtwn_r88e_get_rssi(struct urtwn_softc *sc, int rate, void *physt)
return (rssi);
}
static int
urtwn_tx_start(struct urtwn_softc *sc, struct ieee80211_node *ni,
struct mbuf *m0, struct urtwn_data *data)
@ -1980,71 +2044,6 @@ urtwn_parent(struct ieee80211com *ic)
ieee80211_start_all(ic);
}
static int
urtwn_alloc_list(struct urtwn_softc *sc, struct urtwn_data data[],
int ndata, int maxsz)
{
int i, error;
for (i = 0; i < ndata; i++) {
struct urtwn_data *dp = &data[i];
dp->sc = sc;
dp->m = NULL;
dp->buf = malloc(maxsz, M_USBDEV, M_NOWAIT);
if (dp->buf == NULL) {
device_printf(sc->sc_dev,
"could not allocate buffer\n");
error = ENOMEM;
goto fail;
}
dp->ni = NULL;
}
return (0);
fail:
urtwn_free_list(sc, data, ndata);
return (error);
}
static int
urtwn_alloc_rx_list(struct urtwn_softc *sc)
{
int error, i;
error = urtwn_alloc_list(sc, sc->sc_rx, URTWN_RX_LIST_COUNT,
URTWN_RXBUFSZ);
if (error != 0)
return (error);
STAILQ_INIT(&sc->sc_rx_active);
STAILQ_INIT(&sc->sc_rx_inactive);
for (i = 0; i < URTWN_RX_LIST_COUNT; i++)
STAILQ_INSERT_HEAD(&sc->sc_rx_inactive, &sc->sc_rx[i], next);
return (0);
}
static int
urtwn_alloc_tx_list(struct urtwn_softc *sc)
{
int error, i;
error = urtwn_alloc_list(sc, sc->sc_tx, URTWN_TX_LIST_COUNT,
URTWN_TXBUFSZ);
if (error != 0)
return (error);
STAILQ_INIT(&sc->sc_tx_active);
STAILQ_INIT(&sc->sc_tx_inactive);
STAILQ_INIT(&sc->sc_tx_pending);
for (i = 0; i < URTWN_TX_LIST_COUNT; i++)
STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, &sc->sc_tx[i], next);
return (0);
}
static __inline int
urtwn_power_on(struct urtwn_softc *sc)
{
@ -2685,7 +2684,7 @@ urtwn_bb_init(struct urtwn_softc *sc)
}
}
void
static void
urtwn_rf_init(struct urtwn_softc *sc)
{
const struct urtwn_rf_prog *prog;
@ -2826,7 +2825,7 @@ urtwn_edca_init(struct urtwn_softc *sc)
urtwn_write_4(sc, R92C_EDCA_VO_PARAM, 0x002fa226);
}
void
static void
urtwn_write_txpower(struct urtwn_softc *sc, int chain,
uint16_t power[URTWN_RIDX_COUNT])
{
@ -2886,7 +2885,7 @@ urtwn_write_txpower(struct urtwn_softc *sc, int chain,
SM(R92C_TXAGC_MCS15, power[27]));
}
void
static void
urtwn_get_txpower(struct urtwn_softc *sc, int chain,
struct ieee80211_channel *c, struct ieee80211_channel *extc,
uint16_t power[URTWN_RIDX_COUNT])
@ -2985,7 +2984,7 @@ urtwn_get_txpower(struct urtwn_softc *sc, int chain,
#endif
}
void
static void
urtwn_r88e_get_txpower(struct urtwn_softc *sc, int chain,
struct ieee80211_channel *c, struct ieee80211_channel *extc,
uint16_t power[URTWN_RIDX_COUNT])
@ -3054,7 +3053,7 @@ urtwn_r88e_get_txpower(struct urtwn_softc *sc, int chain,
}
}
void
static void
urtwn_set_txpower(struct urtwn_softc *sc, struct ieee80211_channel *c,
struct ieee80211_channel *extc)
{