Commit a38a9ef1 authored by Fabian Frederick's avatar Fabian Frederick Committed by John W. Linville

brcm80211: use container_of to resolve dma_info from dma_pub

Use container_of instead of casting first structure member.

Compiled but untested.
Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Acked-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d68e9f5d
...@@ -746,7 +746,7 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring, ...@@ -746,7 +746,7 @@ dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring,
/* !! may be called with core in reset */ /* !! may be called with core in reset */
void dma_detach(struct dma_pub *pub) void dma_detach(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
brcms_dbg_dma(di->core, "%s:\n", di->name); brcms_dbg_dma(di->core, "%s:\n", di->name);
...@@ -842,7 +842,7 @@ static void _dma_rxenable(struct dma_info *di) ...@@ -842,7 +842,7 @@ static void _dma_rxenable(struct dma_info *di)
void dma_rxinit(struct dma_pub *pub) void dma_rxinit(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
brcms_dbg_dma(di->core, "%s:\n", di->name); brcms_dbg_dma(di->core, "%s:\n", di->name);
...@@ -924,7 +924,7 @@ static struct sk_buff *_dma_getnextrxp(struct dma_info *di, bool forceall) ...@@ -924,7 +924,7 @@ static struct sk_buff *_dma_getnextrxp(struct dma_info *di, bool forceall)
*/ */
int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list) int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
struct sk_buff_head dma_frames; struct sk_buff_head dma_frames;
struct sk_buff *p, *next; struct sk_buff *p, *next;
uint len; uint len;
...@@ -1022,7 +1022,7 @@ static bool dma64_txidle(struct dma_info *di) ...@@ -1022,7 +1022,7 @@ static bool dma64_txidle(struct dma_info *di)
*/ */
bool dma_rxfill(struct dma_pub *pub) bool dma_rxfill(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
struct sk_buff *p; struct sk_buff *p;
u16 rxin, rxout; u16 rxin, rxout;
u32 flags = 0; u32 flags = 0;
...@@ -1106,7 +1106,7 @@ bool dma_rxfill(struct dma_pub *pub) ...@@ -1106,7 +1106,7 @@ bool dma_rxfill(struct dma_pub *pub)
void dma_rxreclaim(struct dma_pub *pub) void dma_rxreclaim(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
struct sk_buff *p; struct sk_buff *p;
brcms_dbg_dma(di->core, "%s:\n", di->name); brcms_dbg_dma(di->core, "%s:\n", di->name);
...@@ -1126,7 +1126,7 @@ void dma_counterreset(struct dma_pub *pub) ...@@ -1126,7 +1126,7 @@ void dma_counterreset(struct dma_pub *pub)
/* get the address of the var in order to change later */ /* get the address of the var in order to change later */
unsigned long dma_getvar(struct dma_pub *pub, const char *name) unsigned long dma_getvar(struct dma_pub *pub, const char *name)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
if (!strcmp(name, "&txavail")) if (!strcmp(name, "&txavail"))
return (unsigned long)&(di->dma.txavail); return (unsigned long)&(di->dma.txavail);
...@@ -1137,7 +1137,7 @@ unsigned long dma_getvar(struct dma_pub *pub, const char *name) ...@@ -1137,7 +1137,7 @@ unsigned long dma_getvar(struct dma_pub *pub, const char *name)
void dma_txinit(struct dma_pub *pub) void dma_txinit(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
u32 control = D64_XC_XE; u32 control = D64_XC_XE;
brcms_dbg_dma(di->core, "%s:\n", di->name); brcms_dbg_dma(di->core, "%s:\n", di->name);
...@@ -1170,7 +1170,7 @@ void dma_txinit(struct dma_pub *pub) ...@@ -1170,7 +1170,7 @@ void dma_txinit(struct dma_pub *pub)
void dma_txsuspend(struct dma_pub *pub) void dma_txsuspend(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
brcms_dbg_dma(di->core, "%s:\n", di->name); brcms_dbg_dma(di->core, "%s:\n", di->name);
...@@ -1182,7 +1182,7 @@ void dma_txsuspend(struct dma_pub *pub) ...@@ -1182,7 +1182,7 @@ void dma_txsuspend(struct dma_pub *pub)
void dma_txresume(struct dma_pub *pub) void dma_txresume(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
brcms_dbg_dma(di->core, "%s:\n", di->name); brcms_dbg_dma(di->core, "%s:\n", di->name);
...@@ -1194,7 +1194,7 @@ void dma_txresume(struct dma_pub *pub) ...@@ -1194,7 +1194,7 @@ void dma_txresume(struct dma_pub *pub)
bool dma_txsuspended(struct dma_pub *pub) bool dma_txsuspended(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
return (di->ntxd == 0) || return (di->ntxd == 0) ||
((bcma_read32(di->core, ((bcma_read32(di->core,
...@@ -1204,7 +1204,7 @@ bool dma_txsuspended(struct dma_pub *pub) ...@@ -1204,7 +1204,7 @@ bool dma_txsuspended(struct dma_pub *pub)
void dma_txreclaim(struct dma_pub *pub, enum txd_range range) void dma_txreclaim(struct dma_pub *pub, enum txd_range range)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
struct sk_buff *p; struct sk_buff *p;
brcms_dbg_dma(di->core, "%s: %s\n", brcms_dbg_dma(di->core, "%s: %s\n",
...@@ -1225,7 +1225,7 @@ void dma_txreclaim(struct dma_pub *pub, enum txd_range range) ...@@ -1225,7 +1225,7 @@ void dma_txreclaim(struct dma_pub *pub, enum txd_range range)
bool dma_txreset(struct dma_pub *pub) bool dma_txreset(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
u32 status; u32 status;
if (di->ntxd == 0) if (di->ntxd == 0)
...@@ -1252,7 +1252,7 @@ bool dma_txreset(struct dma_pub *pub) ...@@ -1252,7 +1252,7 @@ bool dma_txreset(struct dma_pub *pub)
bool dma_rxreset(struct dma_pub *pub) bool dma_rxreset(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
u32 status; u32 status;
if (di->nrxd == 0) if (di->nrxd == 0)
...@@ -1377,7 +1377,7 @@ static void dma_update_txavail(struct dma_info *di) ...@@ -1377,7 +1377,7 @@ static void dma_update_txavail(struct dma_info *di)
int dma_txfast(struct brcms_c_info *wlc, struct dma_pub *pub, int dma_txfast(struct brcms_c_info *wlc, struct dma_pub *pub,
struct sk_buff *p) struct sk_buff *p)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
struct brcms_ampdu_session *session = &di->ampdu_session; struct brcms_ampdu_session *session = &di->ampdu_session;
struct ieee80211_tx_info *tx_info; struct ieee80211_tx_info *tx_info;
bool is_ampdu; bool is_ampdu;
...@@ -1427,7 +1427,7 @@ int dma_txfast(struct brcms_c_info *wlc, struct dma_pub *pub, ...@@ -1427,7 +1427,7 @@ int dma_txfast(struct brcms_c_info *wlc, struct dma_pub *pub,
void dma_txflush(struct dma_pub *pub) void dma_txflush(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
struct brcms_ampdu_session *session = &di->ampdu_session; struct brcms_ampdu_session *session = &di->ampdu_session;
if (!skb_queue_empty(&session->skb_list)) if (!skb_queue_empty(&session->skb_list))
...@@ -1436,7 +1436,7 @@ void dma_txflush(struct dma_pub *pub) ...@@ -1436,7 +1436,7 @@ void dma_txflush(struct dma_pub *pub)
int dma_txpending(struct dma_pub *pub) int dma_txpending(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
return ntxdactive(di, di->txin, di->txout); return ntxdactive(di, di->txin, di->txout);
} }
...@@ -1446,7 +1446,7 @@ int dma_txpending(struct dma_pub *pub) ...@@ -1446,7 +1446,7 @@ int dma_txpending(struct dma_pub *pub)
*/ */
void dma_kick_tx(struct dma_pub *pub) void dma_kick_tx(struct dma_pub *pub)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
struct brcms_ampdu_session *session = &di->ampdu_session; struct brcms_ampdu_session *session = &di->ampdu_session;
if (!skb_queue_empty(&session->skb_list) && dma64_txidle(di)) if (!skb_queue_empty(&session->skb_list) && dma64_txidle(di))
...@@ -1465,7 +1465,7 @@ void dma_kick_tx(struct dma_pub *pub) ...@@ -1465,7 +1465,7 @@ void dma_kick_tx(struct dma_pub *pub)
*/ */
struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range) struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
{ {
struct dma_info *di = (struct dma_info *)pub; struct dma_info *di = container_of(pub, struct dma_info, dma);
u16 start, end, i; u16 start, end, i;
u16 active_desc; u16 active_desc;
struct sk_buff *txp; struct sk_buff *txp;
...@@ -1547,7 +1547,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range) ...@@ -1547,7 +1547,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
void dma_walk_packets(struct dma_pub *dmah, void (*callback_fnc) void dma_walk_packets(struct dma_pub *dmah, void (*callback_fnc)
(void *pkt, void *arg_a), void *arg_a) (void *pkt, void *arg_a), void *arg_a)
{ {
struct dma_info *di = (struct dma_info *) dmah; struct dma_info *di = container_of(dmah, struct dma_info, dma);
uint i = di->txin; uint i = di->txin;
uint end = di->txout; uint end = di->txout;
struct sk_buff *skb; struct sk_buff *skb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment