提交 b78f721b 编写于 作者: R Roland Vossen 提交者: Greg Kroah-Hartman

staging: brcm80211: removed fullmac BRCMF_IOCTL_MAGIC support

Linux will never call brcmf_netdev_ioctl_entry() with the value
BRCMF_IOCTL_MAGIC in a user space buffer. Thus, unused code could be
removed.
Reported-by: NJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: NRoland Vossen <rvossen@broadcom.com>
Reviewed-by: NArend van Spriel <arend@broadcom.com>
Reviewed-by: NFranky Lin <frankyl@broadcom.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 6514e853
......@@ -235,39 +235,6 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
fnc_num, addr, data);
}
int brcmf_sdcard_cis_read(struct brcmf_sdio_dev *sdiodev, uint func, u8 * cis,
uint length)
{
int status;
u8 *tmp_buf, *tmp_ptr;
u8 *ptr;
bool ascii = func & ~0xf;
func &= 0x7;
status = brcmf_sdioh_cis_read(sdiodev, func, cis, length);
if (ascii) {
/* Move binary bits to tmp and format them
into the provided buffer. */
tmp_buf = kmalloc(length, GFP_ATOMIC);
if (tmp_buf == NULL) {
brcmf_dbg(ERROR, "out of memory\n");
return -ENOMEM;
}
memcpy(tmp_buf, cis, length);
for (tmp_ptr = tmp_buf, ptr = cis; ptr < (cis + length - 4);
tmp_ptr++) {
ptr += sprintf((char *)ptr, "%.2x ", *tmp_ptr & 0xff);
if ((((tmp_ptr - tmp_buf) + 1) & 0xf) == 0)
ptr += sprintf((char *)ptr, "\n");
}
kfree(tmp_buf);
}
return status;
}
int
brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address)
{
......
......@@ -423,39 +423,6 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr)
return scratch;
}
int brcmf_sdioh_cis_read(struct brcmf_sdio_dev *sdiodev, uint func,
u8 *cisd, u32 length)
{
u32 count;
int offset;
u32 foo;
u8 *cis = cisd;
brcmf_dbg(TRACE, "Func = %d\n", func);
if (!sdiodev->func_cis_ptr[func]) {
memset(cis, 0, length);
brcmf_dbg(ERROR, "no func_cis_ptr[%d]\n", func);
return -ENOTSUPP;
}
brcmf_dbg(ERROR, "func_cis_ptr[%d]=0x%04x\n",
func, sdiodev->func_cis_ptr[func]);
for (count = 0; count < length; count++) {
offset = sdiodev->func_cis_ptr[func] + count;
if (brcmf_sdioh_card_regread(sdiodev, 0, offset, 1, &foo) < 0) {
brcmf_dbg(ERROR, "regread failed: Can't read CIS\n");
return -EIO;
}
*cis = (u8) (foo & 0xff);
cis++;
}
return 0;
}
static int brcmf_sdioh_enablefuncs(struct brcmf_sdio_dev *sdiodev)
{
int err_ret;
......
......@@ -789,7 +789,6 @@ struct brcmf_c_ioctl {
#define BRCMF_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */
/* common ioctl definitions */
#define BRCMF_GET_MAGIC 0
#define BRCMF_GET_VERSION 1
#define BRCMF_GET_VAR 2
#define BRCMF_SET_VAR 3
......
......@@ -56,18 +56,6 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen);
extern int
brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen);
/* Check for and handle local prot-specific iovar commands */
extern int brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *drvr, const char *name,
void *params, int plen, void *arg, int len,
bool set);
/* Add bus dump output to a buffer */
extern void brcmf_sdbrcm_bus_dump(struct brcmf_pub *drvr,
struct brcmu_strbuf *strbuf);
/* Clear any bus counters */
extern void brcmf_bus_clearcounts(struct brcmf_pub *drvr);
extern void brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick);
#endif /* _BRCMF_BUS_H_ */
......@@ -348,11 +348,6 @@ static void pkt_set_sum_good(struct sk_buff *skb, bool x)
skb->ip_summed = (x ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE);
}
void brcmf_proto_dump(struct brcmf_pub *drvr, struct brcmu_strbuf *strbuf)
{
brcmu_bprintf(strbuf, "Protocol CDC: reqid %d\n", drvr->prot->reqid);
}
void brcmf_proto_hdrpush(struct brcmf_pub *drvr, int ifidx,
struct sk_buff *pktbuf)
{
......
......@@ -48,41 +48,6 @@ static const char brcmf_version[] =
"Dongle Host Driver, version " BRCMF_VERSION_STR;
#endif
/* IOVar table */
enum {
IOV_VERSION = 1,
IOV_MSGLEVEL,
IOV_BCMERRORSTR,
IOV_BCMERROR,
IOV_DUMP,
IOV_CLEARCOUNTS,
IOV_LOGDUMP,
IOV_LOGCAL,
IOV_LOGSTAMP,
IOV_GPIOOB,
IOV_LAST
};
static const struct brcmu_iovar brcmf_iovars[] = {
{"version", IOV_VERSION, 0, IOVT_BUFFER, sizeof(brcmf_version)}
,
#ifdef BCMDBG
{"msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0}
,
#endif /* BCMDBG */
{"bcmerrorstr", IOV_BCMERRORSTR, 0, IOVT_BUFFER, BCME_STRLEN}
,
{"bcmerror", IOV_BCMERROR, 0, IOVT_INT8, 0}
,
{"dump", IOV_DUMP, 0, IOVT_BUFFER, BRCMF_IOCTL_MAXLEN}
,
{"clearcounts", IOV_CLEARCOUNTS, 0, IOVT_VOID, 0}
,
{"gpioob", IOV_GPIOOB, 0, IOVT_UINT32, 0}
,
{NULL, 0, 0, 0, 0}
};
/* Message trace header */
struct msgtrace_hdr {
u8 version;
......@@ -112,132 +77,6 @@ void brcmf_c_init(void)
brcmf_msg_level = BRCMF_ERROR_VAL;
}
static int brcmf_c_dump(struct brcmf_pub *drvr, char *buf, int buflen)
{
struct brcmu_strbuf b;
struct brcmu_strbuf *strbuf = &b;
brcmu_binit(strbuf, buf, buflen);
/* Base info */
brcmu_bprintf(strbuf, "%s\n", brcmf_version);
brcmu_bprintf(strbuf, "\n");
brcmu_bprintf(strbuf, "pub.up %d pub.txoff %d pub.busstate %d\n",
drvr->up, drvr->txoff, drvr->busstate);
brcmu_bprintf(strbuf, "pub.hdrlen %d pub.maxctl %d pub.rxsz %d\n",
drvr->hdrlen, drvr->maxctl, drvr->rxsz);
brcmu_bprintf(strbuf, "pub.iswl %d pub.drv_version %ld pub.mac %pM\n",
drvr->iswl, drvr->drv_version, &drvr->mac);
brcmu_bprintf(strbuf, "pub.bcmerror %d tickcnt %d\n", drvr->bcmerror,
drvr->tickcnt);
brcmu_bprintf(strbuf, "dongle stats:\n");
brcmu_bprintf(strbuf,
"tx_packets %ld tx_bytes %ld tx_errors %ld tx_dropped %ld\n",
drvr->dstats.tx_packets, drvr->dstats.tx_bytes,
drvr->dstats.tx_errors, drvr->dstats.tx_dropped);
brcmu_bprintf(strbuf,
"rx_packets %ld rx_bytes %ld rx_errors %ld rx_dropped %ld\n",
drvr->dstats.rx_packets, drvr->dstats.rx_bytes,
drvr->dstats.rx_errors, drvr->dstats.rx_dropped);
brcmu_bprintf(strbuf, "multicast %ld\n", drvr->dstats.multicast);
brcmu_bprintf(strbuf, "bus stats:\n");
brcmu_bprintf(strbuf, "tx_packets %ld tx_multicast %ld tx_errors %ld\n",
drvr->tx_packets, drvr->tx_multicast, drvr->tx_errors);
brcmu_bprintf(strbuf, "tx_ctlpkts %ld tx_ctlerrs %ld\n",
drvr->tx_ctlpkts, drvr->tx_ctlerrs);
brcmu_bprintf(strbuf, "rx_packets %ld rx_multicast %ld rx_errors %ld\n",
drvr->rx_packets, drvr->rx_multicast, drvr->rx_errors);
brcmu_bprintf(strbuf,
"rx_ctlpkts %ld rx_ctlerrs %ld rx_dropped %ld rx_flushed %ld\n",
drvr->rx_ctlpkts, drvr->rx_ctlerrs, drvr->rx_dropped,
drvr->rx_flushed);
brcmu_bprintf(strbuf,
"rx_readahead_cnt %ld tx_realloc %ld fc_packets %ld\n",
drvr->rx_readahead_cnt, drvr->tx_realloc, drvr->fc_packets);
brcmu_bprintf(strbuf, "wd_dpc_sched %ld\n", drvr->wd_dpc_sched);
brcmu_bprintf(strbuf, "\n");
/* Add any prot info */
brcmf_proto_dump(drvr, strbuf);
brcmu_bprintf(strbuf, "\n");
/* Add any bus info */
brcmf_sdbrcm_bus_dump(drvr, strbuf);
return !strbuf->size ? -EOVERFLOW : 0;
}
static int
brcmf_c_doiovar(struct brcmf_pub *drvr, const struct brcmu_iovar *vi,
u32 actionid, const char *name, void *params, int plen,
void *arg, int len, int val_size)
{
int bcmerror = 0;
s32 int_val = 0;
brcmf_dbg(TRACE, "Enter\n");
bcmerror = brcmu_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid));
if (bcmerror != 0)
goto exit;
if (plen >= (int)sizeof(int_val))
memcpy(&int_val, params, sizeof(int_val));
switch (actionid) {
case IOV_GVAL(IOV_VERSION):
/* Need to have checked buffer length */
strncpy((char *)arg, brcmf_version, len);
break;
case IOV_GVAL(IOV_MSGLEVEL):
int_val = (s32) brcmf_msg_level;
memcpy(arg, &int_val, val_size);
break;
case IOV_SVAL(IOV_MSGLEVEL):
brcmf_msg_level = int_val;
break;
case IOV_GVAL(IOV_BCMERRORSTR):
strncpy((char *)arg, "bcm_error",
BCME_STRLEN);
((char *)arg)[BCME_STRLEN - 1] = 0x00;
break;
case IOV_GVAL(IOV_BCMERROR):
int_val = (s32) drvr->bcmerror;
memcpy(arg, &int_val, val_size);
break;
case IOV_GVAL(IOV_DUMP):
bcmerror = brcmf_c_dump(drvr, arg, len);
break;
case IOV_SVAL(IOV_CLEARCOUNTS):
drvr->tx_packets = drvr->rx_packets = 0;
drvr->tx_errors = drvr->rx_errors = 0;
drvr->tx_ctlpkts = drvr->rx_ctlpkts = 0;
drvr->tx_ctlerrs = drvr->rx_ctlerrs = 0;
drvr->rx_dropped = 0;
drvr->rx_readahead_cnt = 0;
drvr->tx_realloc = 0;
drvr->wd_dpc_sched = 0;
memset(&drvr->dstats, 0, sizeof(drvr->dstats));
brcmf_bus_clearcounts(drvr);
break;
default:
bcmerror = -ENOTSUPP;
break;
}
exit:
return bcmerror;
}
bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q,
struct sk_buff *pkt, int prec)
{
......@@ -286,136 +125,6 @@ bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q,
return p != NULL;
}
static int
brcmf_c_iovar_op(struct brcmf_pub *drvr, const char *name,
void *params, int plen, void *arg, int len, bool set)
{
int bcmerror = 0;
int val_size;
const struct brcmu_iovar *vi = NULL;
u32 actionid;
brcmf_dbg(TRACE, "Enter\n");
if (name == NULL || len < 0)
return -EINVAL;
/* Set does not take qualifiers */
if (set && (params || plen))
return -EINVAL;
/* Get must have return space;*/
if (!set && !(arg && len))
return -EINVAL;
vi = brcmu_iovar_lookup(brcmf_iovars, name);
if (vi == NULL) {
bcmerror = -ENOTSUPP;
goto exit;
}
brcmf_dbg(CTL, "%s %s, len %d plen %d\n",
name, set ? "set" : "get", len, plen);
/* set up 'params' pointer in case this is a set command so that
* the convenience int and bool code can be common to set and get
*/
if (params == NULL) {
params = arg;
plen = len;
}
if (vi->type == IOVT_VOID)
val_size = 0;
else if (vi->type == IOVT_BUFFER)
val_size = len;
else
/* all other types are integer sized */
val_size = sizeof(int);
actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);
bcmerror =
brcmf_c_doiovar(drvr, vi, actionid, name, params, plen, arg, len,
val_size);
exit:
return bcmerror;
}
int brcmf_c_ioctl(struct brcmf_pub *drvr, struct brcmf_c_ioctl *ioc, void *buf,
uint buflen)
{
int bcmerror = 0;
brcmf_dbg(TRACE, "Enter\n");
if (!buf)
return -EINVAL;
switch (ioc->cmd) {
case BRCMF_GET_MAGIC:
if (buflen < sizeof(int))
bcmerror = -EOVERFLOW;
else
*(int *)buf = BRCMF_IOCTL_MAGIC;
break;
case BRCMF_GET_VERSION:
if (buflen < sizeof(int))
bcmerror = -EOVERFLOW;
else
*(int *)buf = BRCMF_IOCTL_VERSION;
break;
case BRCMF_GET_VAR:
case BRCMF_SET_VAR:{
char *arg;
uint arglen;
/* scan past the name to any arguments */
for (arg = buf, arglen = buflen; *arg && arglen;
arg++, arglen--)
;
if (*arg) {
bcmerror = -EOVERFLOW;
break;
}
/* account for the NUL terminator */
arg++, arglen--;
/* call with the appropriate arguments */
if (ioc->cmd == BRCMF_GET_VAR)
bcmerror = brcmf_c_iovar_op(drvr, buf, arg,
arglen, buf, buflen, IOV_GET);
else
bcmerror =
brcmf_c_iovar_op(drvr, buf, NULL, 0, arg,
arglen, IOV_SET);
if (bcmerror != -ENOTSUPP)
break;
/* if still not found, try bus module */
if (ioc->cmd == BRCMF_GET_VAR)
bcmerror = brcmf_sdbrcm_bus_iovar_op(drvr,
buf, arg, arglen, buf, buflen,
IOV_GET);
else
bcmerror = brcmf_sdbrcm_bus_iovar_op(drvr,
buf, NULL, 0, arg, arglen,
IOV_SET);
break;
}
default:
bcmerror = -ENOTSUPP;
}
return bcmerror;
}
#ifdef BCMDBG
static void
brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
......
......@@ -1012,15 +1012,6 @@ static int brcmf_netdev_ioctl_entry(struct net_device *net, struct ifreq *ifr,
goto done;
}
/* check for local brcmf ioctl and handle it */
if (driver == BRCMF_IOCTL_MAGIC) {
bcmerror = brcmf_c_ioctl((void *)&drvr_priv->pub, &ioc,
buf, buflen);
if (bcmerror)
drvr_priv->pub.bcmerror = bcmerror;
goto done;
}
/* send to dongle (must be up, and wl) */
if ((drvr_priv->pub.busstate != BRCMF_BUS_DATA)) {
brcmf_dbg(ERROR, "DONGLE_DOWN\n");
......
......@@ -52,16 +52,9 @@ extern int brcmf_proto_hdrpull(struct brcmf_pub *, int *ifidx,
extern int brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx,
struct brcmf_ioctl *ioc, void *buf, int len);
/* Add prot dump output to a buffer */
extern void brcmf_proto_dump(struct brcmf_pub *drvr,
struct brcmu_strbuf *strbuf);
/* Update local copy of dongle statistics */
extern void brcmf_proto_dstats(struct brcmf_pub *drvr);
extern int brcmf_c_ioctl(struct brcmf_pub *drvr, struct brcmf_c_ioctl *ioc,
void *buf, uint buflen);
extern int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr);
extern int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx,
......
......@@ -149,16 +149,6 @@ extern u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint func,
extern void brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint func,
u32 addr, u8 data, int *err);
/* Read CIS content for specified function.
* fn: function whose CIS is being requested (0 is common CIS)
* cis: pointer to memory location to place results
* length: number of bytes to read
* Internally, this routine uses the values from the cis base regs (0x9-0xB)
* to form an SDIO-space address to read the data from.
*/
extern int brcmf_sdcard_cis_read(struct brcmf_sdio_dev *sdiodev, uint func,
u8 *cis, uint length);
/* Synchronous access to device (client) core registers via CMD53 to F1.
* addr: backplane address (i.e. >= regsva from attach)
* size: register width in bytes (2 or 4)
......@@ -255,10 +245,6 @@ brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev,
u32 addr, uint regwidth,
u32 buflen, u8 *buffer, struct sk_buff *pkt);
/* get cis data */
extern int brcmf_sdioh_cis_read(struct brcmf_sdio_dev *sdiodev, uint fuc,
u8 *cis, u32 length);
/* Watchdog timer interface for pm ops */
extern void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev,
bool enable);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册