staging: brcm80211: Remove OSL_ERROR entry point

Get rid of generic OSL_ERROR and error code
translation to the only place that needs it: dhd.

Signed-off-by: Brett Rudley <brudley@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Brett Rudley 2010-11-01 17:10:17 -07:00 committed by Greg Kroah-Hartman
parent 683ab518a1
commit 9014378bf4
3 changed files with 51 additions and 77 deletions

View File

@ -1620,6 +1620,51 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr)
return 0;
}
static s16 linuxbcmerrormap[] = { 0, /* 0 */
-EINVAL, /* BCME_ERROR */
-EINVAL, /* BCME_BADARG */
-EINVAL, /* BCME_BADOPTION */
-EINVAL, /* BCME_NOTUP */
-EINVAL, /* BCME_NOTDOWN */
-EINVAL, /* BCME_NOTAP */
-EINVAL, /* BCME_NOTSTA */
-EINVAL, /* BCME_BADKEYIDX */
-EINVAL, /* BCME_RADIOOFF */
-EINVAL, /* BCME_NOTBANDLOCKED */
-EINVAL, /* BCME_NOCLK */
-EINVAL, /* BCME_BADRATESET */
-EINVAL, /* BCME_BADBAND */
-E2BIG, /* BCME_BUFTOOSHORT */
-E2BIG, /* BCME_BUFTOOLONG */
-EBUSY, /* BCME_BUSY */
-EINVAL, /* BCME_NOTASSOCIATED */
-EINVAL, /* BCME_BADSSIDLEN */
-EINVAL, /* BCME_OUTOFRANGECHAN */
-EINVAL, /* BCME_BADCHAN */
-EFAULT, /* BCME_BADADDR */
-ENOMEM, /* BCME_NORESOURCE */
-EOPNOTSUPP, /* BCME_UNSUPPORTED */
-EMSGSIZE, /* BCME_BADLENGTH */
-EINVAL, /* BCME_NOTREADY */
-EPERM, /* BCME_NOTPERMITTED */
-ENOMEM, /* BCME_NOMEM */
-EINVAL, /* BCME_ASSOCIATED */
-ERANGE, /* BCME_RANGE */
-EINVAL, /* BCME_NOTFOUND */
-EINVAL, /* BCME_WME_NOT_ENABLED */
-EINVAL, /* BCME_TSPEC_NOTFOUND */
-EINVAL, /* BCME_ACM_NOTSUPPORTED */
-EINVAL, /* BCME_NOT_WME_ASSOCIATION */
-EIO, /* BCME_SDIO_ERROR */
-ENODEV, /* BCME_DONGLE_DOWN */
-EINVAL, /* BCME_VERSION */
-EIO, /* BCME_TXFAIL */
-EIO, /* BCME_RXFAIL */
-EINVAL, /* BCME_NODEVICE */
-EINVAL, /* BCME_NMODE_DISABLED */
-ENODATA, /* BCME_NONRESIDENT */
};
static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
{
dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);
@ -1741,7 +1786,12 @@ done:
if (buf)
kfree(buf);
return OSL_ERROR(bcmerror);
if (bcmerror > 0)
bcmerror = 0;
else if (bcmerror < BCME_LAST)
bcmerror = BCME_ERROR;
return linuxbcmerrormap[-bcmerror];
}
static int dhd_stop(struct net_device *net)

View File

@ -134,9 +134,6 @@ extern void osl_dma_unmap(osl_t *osh, uint pa, uint size, int direction);
#define SELECT_BUS_READ(osh, mmap_op, bus_op) mmap_op
#endif
#define OSL_ERROR(bcmerror) osl_error(bcmerror)
extern int osl_error(int bcmerror);
/* the largest reasonable packet buffer driver uses for ethernet MTU in bytes */
#define PKTBUFSZ 2048 /* largest reasonable packet buffer, driver uses for ethernet MTU */

View File

@ -46,74 +46,6 @@ struct osl_info {
/* Global ASSERT type flag */
u32 g_assert_type;
#ifdef BRCM_FULLMAC
static s16 linuxbcmerrormap[] = { 0, /* 0 */
-EINVAL, /* BCME_ERROR */
-EINVAL, /* BCME_BADARG */
-EINVAL, /* BCME_BADOPTION */
-EINVAL, /* BCME_NOTUP */
-EINVAL, /* BCME_NOTDOWN */
-EINVAL, /* BCME_NOTAP */
-EINVAL, /* BCME_NOTSTA */
-EINVAL, /* BCME_BADKEYIDX */
-EINVAL, /* BCME_RADIOOFF */
-EINVAL, /* BCME_NOTBANDLOCKED */
-EINVAL, /* BCME_NOCLK */
-EINVAL, /* BCME_BADRATESET */
-EINVAL, /* BCME_BADBAND */
-E2BIG, /* BCME_BUFTOOSHORT */
-E2BIG, /* BCME_BUFTOOLONG */
-EBUSY, /* BCME_BUSY */
-EINVAL, /* BCME_NOTASSOCIATED */
-EINVAL, /* BCME_BADSSIDLEN */
-EINVAL, /* BCME_OUTOFRANGECHAN */
-EINVAL, /* BCME_BADCHAN */
-EFAULT, /* BCME_BADADDR */
-ENOMEM, /* BCME_NORESOURCE */
-EOPNOTSUPP, /* BCME_UNSUPPORTED */
-EMSGSIZE, /* BCME_BADLENGTH */
-EINVAL, /* BCME_NOTREADY */
-EPERM, /* BCME_NOTPERMITTED */
-ENOMEM, /* BCME_NOMEM */
-EINVAL, /* BCME_ASSOCIATED */
-ERANGE, /* BCME_RANGE */
-EINVAL, /* BCME_NOTFOUND */
-EINVAL, /* BCME_WME_NOT_ENABLED */
-EINVAL, /* BCME_TSPEC_NOTFOUND */
-EINVAL, /* BCME_ACM_NOTSUPPORTED */
-EINVAL, /* BCME_NOT_WME_ASSOCIATION */
-EIO, /* BCME_SDIO_ERROR */
-ENODEV, /* BCME_DONGLE_DOWN */
-EINVAL, /* BCME_VERSION */
-EIO, /* BCME_TXFAIL */
-EIO, /* BCME_RXFAIL */
-EINVAL, /* BCME_NODEVICE */
-EINVAL, /* BCME_NMODE_DISABLED */
-ENODATA, /* BCME_NONRESIDENT */
/* When an new error code is added to bcmutils.h, add os
* spcecific error translation here as well
*/
/* check if BCME_LAST changed since the last time this function was updated */
#if BCME_LAST != -42
#error "You need to add a OS error translation in the linuxbcmerrormap \
for new error code defined in bcmutils.h"
#endif
};
/* translate bcmerrors into linux errors */
int osl_error(int bcmerror)
{
if (bcmerror > 0)
bcmerror = 0;
else if (bcmerror < BCME_LAST)
bcmerror = BCME_ERROR;
/* Array bounds covered by ASSERT in osl_attach */
return linuxbcmerrormap[-bcmerror];
}
#endif /* BRCM_FULLMAC */
osl_t *osl_attach(void *pdev, uint bustype, bool pkttag)
{
osl_t *osh;
@ -123,11 +55,6 @@ osl_t *osl_attach(void *pdev, uint bustype, bool pkttag)
bzero(osh, sizeof(osl_t));
#ifdef BRCM_FULLMAC
/* Check that error map has the right number of entries in it */
ASSERT(ABS(BCME_LAST) == (ARRAY_SIZE(linuxbcmerrormap) - 1));
#endif /* BRCM_FULLMAC */
osh->magic = OS_HANDLE_MAGIC;
osh->failed = 0;
osh->pdev = pdev;