Commit e35efc81 authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman

staging: brcm80211: rename dhd_prot and get rid of dhd_prot_t typedef

The structure dhd_prot has been renamed to brcmf_proto to align with
fullmac naming convention and removed structure typedef dhd_prot_t.
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Reviewed-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b8b5418b
...@@ -21,11 +21,6 @@ ...@@ -21,11 +21,6 @@
#ifndef _dhd_h_ #ifndef _dhd_h_
#define _dhd_h_ #define _dhd_h_
/* Forward decls */
struct dhd_bus;
struct dhd_prot;
struct dhd_info;
#define BRCMF_C_IOCTL_SMLEN 256 /* "small" ioctl buffer required */ #define BRCMF_C_IOCTL_SMLEN 256 /* "small" ioctl buffer required */
#define BRCMF_C_IOCTL_MEDLEN 1536 /* "med" ioctl buffer required */ #define BRCMF_C_IOCTL_MEDLEN 1536 /* "med" ioctl buffer required */
#define BRCMF_C_IOCTL_MAXLEN 8192 #define BRCMF_C_IOCTL_MAXLEN 8192
...@@ -633,12 +628,17 @@ typedef struct wl_ioctl { ...@@ -633,12 +628,17 @@ typedef struct wl_ioctl {
uint needed; /* bytes needed (optional) */ uint needed; /* bytes needed (optional) */
} wl_ioctl_t; } wl_ioctl_t;
/* Forward decls for struct dhd_pub (see below) */
struct dhd_bus; /* device bus info */
struct brcmf_proto; /* device communication protocol info */
struct dhd_info; /* device driver info */
/* Common structure for module and instance linkage */ /* Common structure for module and instance linkage */
typedef struct dhd_pub { typedef struct dhd_pub {
/* Linkage ponters */ /* Linkage ponters */
struct dhd_bus *bus; /* Bus module handle */ struct dhd_bus *bus;
struct dhd_prot *prot; /* Protocol module handle */ struct brcmf_proto *prot;
struct dhd_info *info; /* Info module handle */ struct dhd_info *info;
/* Internal dhd items */ /* Internal dhd items */
bool up; /* Driver up/down (to OS) */ bool up; /* Driver up/down (to OS) */
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "dhd_bus.h" #include "dhd_bus.h"
#include "dhd_dbg.h" #include "dhd_dbg.h"
struct cdc_ioctl { struct brcmf_proto_cdc_ioctl {
u32 cmd; /* ioctl command value */ u32 cmd; /* ioctl command value */
u32 len; /* lower 16: output buflen; u32 len; /* lower 16: output buflen;
* upper 16: input buflen (excludes header) */ * upper 16: input buflen (excludes header) */
...@@ -72,7 +72,7 @@ struct cdc_ioctl { ...@@ -72,7 +72,7 @@ struct cdc_ioctl {
((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | \ ((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | \
((idx) << BDC_FLAG2_IF_SHIFT))) ((idx) << BDC_FLAG2_IF_SHIFT)))
struct bdc_header { struct brcmf_proto_bdc_header {
u8 flags; u8 flags;
u8 priority; /* 802.1d Priority, 4:7 flow control info for usb */ u8 priority; /* 802.1d Priority, 4:7 flow control info for usb */
u8 flags2; u8 flags2;
...@@ -103,19 +103,20 @@ int wifi_get_mac_addr(unsigned char *buf); ...@@ -103,19 +103,20 @@ int wifi_get_mac_addr(unsigned char *buf);
* round off at the end of buffer * round off at the end of buffer
*/ */
typedef struct dhd_prot { struct brcmf_proto {
u16 reqid; u16 reqid;
u8 pending; u8 pending;
u32 lastcmd; u32 lastcmd;
u8 bus_header[BUS_HEADER_LEN]; u8 bus_header[BUS_HEADER_LEN];
struct cdc_ioctl msg; struct brcmf_proto_cdc_ioctl msg;
unsigned char buf[BRCMF_C_IOCTL_MAXLEN + ROUND_UP_MARGIN]; unsigned char buf[BRCMF_C_IOCTL_MAXLEN + ROUND_UP_MARGIN];
} dhd_prot_t; };
static int brcmf_proto_cdc_msg(dhd_pub_t *dhd) static int brcmf_proto_cdc_msg(dhd_pub_t *dhd)
{ {
dhd_prot_t *prot = dhd->prot; struct brcmf_proto *prot = dhd->prot;
int len = le32_to_cpu(prot->msg.len) + sizeof(struct cdc_ioctl); int len = le32_to_cpu(prot->msg.len) +
sizeof(struct brcmf_proto_cdc_ioctl);
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
...@@ -134,14 +135,14 @@ static int brcmf_proto_cdc_msg(dhd_pub_t *dhd) ...@@ -134,14 +135,14 @@ static int brcmf_proto_cdc_msg(dhd_pub_t *dhd)
static int brcmf_proto_cdc_cmplt(dhd_pub_t *dhd, u32 id, u32 len) static int brcmf_proto_cdc_cmplt(dhd_pub_t *dhd, u32 id, u32 len)
{ {
int ret; int ret;
dhd_prot_t *prot = dhd->prot; struct brcmf_proto *prot = dhd->prot;
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
do { do {
ret = brcmf_sdbrcm_bus_rxctl(dhd->bus, ret = brcmf_sdbrcm_bus_rxctl(dhd->bus,
(unsigned char *)&prot->msg, (unsigned char *)&prot->msg,
len + sizeof(struct cdc_ioctl)); len + sizeof(struct brcmf_proto_cdc_ioctl));
if (ret < 0) if (ret < 0)
break; break;
} while (CDC_IOC_ID(le32_to_cpu(prot->msg.flags)) != id); } while (CDC_IOC_ID(le32_to_cpu(prot->msg.flags)) != id);
...@@ -153,8 +154,8 @@ int ...@@ -153,8 +154,8 @@ int
brcmf_proto_cdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, brcmf_proto_cdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,
uint len) uint len)
{ {
dhd_prot_t *prot = dhd->prot; struct brcmf_proto *prot = dhd->prot;
struct cdc_ioctl *msg = &prot->msg; struct brcmf_proto_cdc_ioctl *msg = &prot->msg;
void *info; void *info;
int ret = 0, retries = 0; int ret = 0, retries = 0;
u32 id, flags = 0; u32 id, flags = 0;
...@@ -174,7 +175,7 @@ brcmf_proto_cdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, ...@@ -174,7 +175,7 @@ brcmf_proto_cdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,
} }
} }
memset(msg, 0, sizeof(struct cdc_ioctl)); memset(msg, 0, sizeof(struct brcmf_proto_cdc_ioctl));
msg->cmd = cpu_to_le32(cmd); msg->cmd = cpu_to_le32(cmd);
msg->len = cpu_to_le32(len); msg->len = cpu_to_le32(len);
...@@ -235,15 +236,15 @@ brcmf_proto_cdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, ...@@ -235,15 +236,15 @@ brcmf_proto_cdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,
int brcmf_proto_cdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, int brcmf_proto_cdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd,
void *buf, uint len) void *buf, uint len)
{ {
dhd_prot_t *prot = dhd->prot; struct brcmf_proto *prot = dhd->prot;
struct cdc_ioctl *msg = &prot->msg; struct brcmf_proto_cdc_ioctl *msg = &prot->msg;
int ret = 0; int ret = 0;
u32 flags, id; u32 flags, id;
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
DHD_CTL(("%s: cmd %d len %d\n", __func__, cmd, len)); DHD_CTL(("%s: cmd %d len %d\n", __func__, cmd, len));
memset(msg, 0, sizeof(struct cdc_ioctl)); memset(msg, 0, sizeof(struct brcmf_proto_cdc_ioctl));
msg->cmd = cpu_to_le32(cmd); msg->cmd = cpu_to_le32(cmd);
msg->len = cpu_to_le32(len); msg->len = cpu_to_le32(len);
...@@ -289,7 +290,7 @@ int ...@@ -289,7 +290,7 @@ int
brcmf_proto_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, brcmf_proto_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf,
int len) int len)
{ {
dhd_prot_t *prot = dhd->prot; struct brcmf_proto *prot = dhd->prot;
int ret = -1; int ret = -1;
if (dhd->busstate == DHD_BUS_DOWN) { if (dhd->busstate == DHD_BUS_DOWN) {
...@@ -326,14 +327,14 @@ brcmf_proto_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, ...@@ -326,14 +327,14 @@ brcmf_proto_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf,
ret = brcmf_proto_cdc_query_ioctl(dhd, ifidx, ioc->cmd, ret = brcmf_proto_cdc_query_ioctl(dhd, ifidx, ioc->cmd,
buf, len); buf, len);
if (ret > 0) if (ret > 0)
ioc->used = ret - sizeof(struct cdc_ioctl); ioc->used = ret - sizeof(struct brcmf_proto_cdc_ioctl);
} }
/* Too many programs assume ioctl() returns 0 on success */ /* Too many programs assume ioctl() returns 0 on success */
if (ret >= 0) if (ret >= 0)
ret = 0; ret = 0;
else { else {
struct cdc_ioctl *msg = &prot->msg; struct brcmf_proto_cdc_ioctl *msg = &prot->msg;
/* len == needed when set/query fails from dongle */ /* len == needed when set/query fails from dongle */
ioc->needed = le32_to_cpu(msg->len); ioc->needed = le32_to_cpu(msg->len);
} }
...@@ -380,7 +381,7 @@ void brcmf_proto_dump(dhd_pub_t *dhdp, struct brcmu_strbuf *strbuf) ...@@ -380,7 +381,7 @@ void brcmf_proto_dump(dhd_pub_t *dhdp, struct brcmu_strbuf *strbuf)
void brcmf_proto_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf) void brcmf_proto_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf)
{ {
struct bdc_header *h; struct brcmf_proto_bdc_header *h;
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
...@@ -388,7 +389,7 @@ void brcmf_proto_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf) ...@@ -388,7 +389,7 @@ void brcmf_proto_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf)
skb_push(pktbuf, BDC_HEADER_LEN); skb_push(pktbuf, BDC_HEADER_LEN);
h = (struct bdc_header *)(pktbuf->data); h = (struct brcmf_proto_bdc_header *)(pktbuf->data);
h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT); h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT);
if (PKTSUMNEEDED(pktbuf)) if (PKTSUMNEEDED(pktbuf))
...@@ -402,7 +403,7 @@ void brcmf_proto_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf) ...@@ -402,7 +403,7 @@ void brcmf_proto_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf)
int brcmf_proto_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf) int brcmf_proto_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf)
{ {
struct bdc_header *h; struct brcmf_proto_bdc_header *h;
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
...@@ -414,7 +415,7 @@ int brcmf_proto_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf) ...@@ -414,7 +415,7 @@ int brcmf_proto_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf)
return -EBADE; return -EBADE;
} }
h = (struct bdc_header *)(pktbuf->data); h = (struct brcmf_proto_bdc_header *)(pktbuf->data);
*ifidx = BDC_GET_IF_IDX(h); *ifidx = BDC_GET_IF_IDX(h);
if (*ifidx >= DHD_MAX_IFS) { if (*ifidx >= DHD_MAX_IFS) {
...@@ -446,9 +447,9 @@ int brcmf_proto_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf) ...@@ -446,9 +447,9 @@ int brcmf_proto_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf)
int brcmf_proto_attach(dhd_pub_t *dhd) int brcmf_proto_attach(dhd_pub_t *dhd)
{ {
dhd_prot_t *cdc; struct brcmf_proto *cdc;
cdc = kzalloc(sizeof(dhd_prot_t), GFP_ATOMIC); cdc = kzalloc(sizeof(struct brcmf_proto), GFP_ATOMIC);
if (!cdc) { if (!cdc) {
DHD_ERROR(("%s: kmalloc failed\n", __func__)); DHD_ERROR(("%s: kmalloc failed\n", __func__));
goto fail; goto fail;
...@@ -456,14 +457,14 @@ int brcmf_proto_attach(dhd_pub_t *dhd) ...@@ -456,14 +457,14 @@ int brcmf_proto_attach(dhd_pub_t *dhd)
/* ensure that the msg buf directly follows the cdc msg struct */ /* ensure that the msg buf directly follows the cdc msg struct */
if ((unsigned long)(&cdc->msg + 1) != (unsigned long)cdc->buf) { if ((unsigned long)(&cdc->msg + 1) != (unsigned long)cdc->buf) {
DHD_ERROR(("dhd_prot_t is not correctly defined\n")); DHD_ERROR(("struct brcmf_proto is not correctly defined\n"));
goto fail; goto fail;
} }
dhd->prot = cdc; dhd->prot = cdc;
dhd->hdrlen += BDC_HEADER_LEN; dhd->hdrlen += BDC_HEADER_LEN;
dhd->maxctl = BRCMF_C_IOCTL_MAXLEN + dhd->maxctl = BRCMF_C_IOCTL_MAXLEN +
sizeof(struct cdc_ioctl) + ROUND_UP_MARGIN; sizeof(struct brcmf_proto_cdc_ioctl) + ROUND_UP_MARGIN;
return 0; return 0;
fail: fail:
......
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