Commit b42f2074 authored by David Kilroy's avatar David Kilroy Committed by John W. Linville

orinoco: add hermes_ops

Pave the way for introducing USB alternative functions.

Force callers to dereference ops instead of providing wrappers.
Signed-off-by: default avatarDavid Kilroy <kilroyd@googlemail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f7c65594
...@@ -195,7 +195,7 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match) ...@@ -195,7 +195,7 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
ssleep(1); ssleep(1);
/* Reset it before we get the interrupt */ /* Reset it before we get the interrupt */
hermes_init(hw); hw->ops->init(hw);
if (request_irq(card->irq, orinoco_interrupt, 0, DRIVER_NAME, priv)) { if (request_irq(card->irq, orinoco_interrupt, 0, DRIVER_NAME, priv)) {
printk(KERN_ERR PFX "Couldn't get IRQ %d\n", card->irq); printk(KERN_ERR PFX "Couldn't get IRQ %d\n", card->irq);
......
...@@ -189,7 +189,7 @@ static int orinoco_set_channel(struct wiphy *wiphy, ...@@ -189,7 +189,7 @@ static int orinoco_set_channel(struct wiphy *wiphy,
if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { if (priv->iw_mode == NL80211_IFTYPE_MONITOR) {
/* Fast channel change - no commit if successful */ /* Fast channel change - no commit if successful */
hermes_t *hw = &priv->hw; hermes_t *hw = &priv->hw;
err = hermes_docmd_wait(hw, HERMES_CMD_TEST | err = hw->ops->cmd_wait(hw, HERMES_CMD_TEST |
HERMES_TEST_SET_CHANNEL, HERMES_TEST_SET_CHANNEL,
channel, NULL); channel, NULL);
} }
......
...@@ -259,7 +259,7 @@ symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw, ...@@ -259,7 +259,7 @@ symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw,
} }
/* Reset hermes chip and make sure it responds */ /* Reset hermes chip and make sure it responds */
ret = hermes_init(hw); ret = hw->ops->init(hw);
/* hermes_reset() should return 0 with the secondary firmware */ /* hermes_reset() should return 0 with the secondary firmware */
if (secondary && ret != 0) if (secondary && ret != 0)
......
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
#endif /* ! HERMES_DEBUG */ #endif /* ! HERMES_DEBUG */
static const struct hermes_ops hermes_ops_local;
/* /*
* Internal functions * Internal functions
...@@ -111,9 +112,9 @@ static int hermes_issue_cmd(hermes_t *hw, u16 cmd, u16 param0, ...@@ -111,9 +112,9 @@ static int hermes_issue_cmd(hermes_t *hw, u16 cmd, u16 param0,
*/ */
/* For doing cmds that wipe the magic constant in SWSUPPORT0 */ /* For doing cmds that wipe the magic constant in SWSUPPORT0 */
int hermes_doicmd_wait(hermes_t *hw, u16 cmd, static int hermes_doicmd_wait(hermes_t *hw, u16 cmd,
u16 parm0, u16 parm1, u16 parm2, u16 parm0, u16 parm1, u16 parm2,
struct hermes_response *resp) struct hermes_response *resp)
{ {
int err = 0; int err = 0;
int k; int k;
...@@ -163,17 +164,17 @@ int hermes_doicmd_wait(hermes_t *hw, u16 cmd, ...@@ -163,17 +164,17 @@ int hermes_doicmd_wait(hermes_t *hw, u16 cmd,
out: out:
return err; return err;
} }
EXPORT_SYMBOL(hermes_doicmd_wait);
void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing) void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing)
{ {
hw->iobase = address; hw->iobase = address;
hw->reg_spacing = reg_spacing; hw->reg_spacing = reg_spacing;
hw->inten = 0x0; hw->inten = 0x0;
hw->ops = &hermes_ops_local;
} }
EXPORT_SYMBOL(hermes_struct_init); EXPORT_SYMBOL(hermes_struct_init);
int hermes_init(hermes_t *hw) static int hermes_init(hermes_t *hw)
{ {
u16 reg; u16 reg;
int err = 0; int err = 0;
...@@ -217,7 +218,6 @@ int hermes_init(hermes_t *hw) ...@@ -217,7 +218,6 @@ int hermes_init(hermes_t *hw)
return err; return err;
} }
EXPORT_SYMBOL(hermes_init);
/* Issue a command to the chip, and (busy!) wait for it to /* Issue a command to the chip, and (busy!) wait for it to
* complete. * complete.
...@@ -228,8 +228,8 @@ EXPORT_SYMBOL(hermes_init); ...@@ -228,8 +228,8 @@ EXPORT_SYMBOL(hermes_init);
* > 0 on error returned by the firmware * > 0 on error returned by the firmware
* *
* Callable from any context, but locking is your problem. */ * Callable from any context, but locking is your problem. */
int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0, static int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
struct hermes_response *resp) struct hermes_response *resp)
{ {
int err; int err;
int k; int k;
...@@ -291,9 +291,8 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0, ...@@ -291,9 +291,8 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
out: out:
return err; return err;
} }
EXPORT_SYMBOL(hermes_docmd_wait);
int hermes_allocate(hermes_t *hw, u16 size, u16 *fid) static int hermes_allocate(hermes_t *hw, u16 size, u16 *fid)
{ {
int err = 0; int err = 0;
int k; int k;
...@@ -333,7 +332,6 @@ int hermes_allocate(hermes_t *hw, u16 size, u16 *fid) ...@@ -333,7 +332,6 @@ int hermes_allocate(hermes_t *hw, u16 size, u16 *fid)
return 0; return 0;
} }
EXPORT_SYMBOL(hermes_allocate);
/* Set up a BAP to read a particular chunk of data from card's internal buffer. /* Set up a BAP to read a particular chunk of data from card's internal buffer.
* *
...@@ -403,8 +401,8 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset) ...@@ -403,8 +401,8 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
* 0 on success * 0 on success
* > 0 on error from firmware * > 0 on error from firmware
*/ */
int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, static int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
u16 id, u16 offset) u16 id, u16 offset)
{ {
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
int err = 0; int err = 0;
...@@ -422,7 +420,6 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, ...@@ -422,7 +420,6 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
out: out:
return err; return err;
} }
EXPORT_SYMBOL(hermes_bap_pread);
/* Write a block of data to the chip's buffer, via the /* Write a block of data to the chip's buffer, via the
* BAP. Synchronization/serialization is the caller's problem. * BAP. Synchronization/serialization is the caller's problem.
...@@ -432,8 +429,8 @@ EXPORT_SYMBOL(hermes_bap_pread); ...@@ -432,8 +429,8 @@ EXPORT_SYMBOL(hermes_bap_pread);
* 0 on success * 0 on success
* > 0 on error from firmware * > 0 on error from firmware
*/ */
int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, static int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
u16 id, u16 offset) u16 id, u16 offset)
{ {
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
int err = 0; int err = 0;
...@@ -451,7 +448,6 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, ...@@ -451,7 +448,6 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
out: out:
return err; return err;
} }
EXPORT_SYMBOL(hermes_bap_pwrite);
/* Read a Length-Type-Value record from the card. /* Read a Length-Type-Value record from the card.
* *
...@@ -461,8 +457,8 @@ EXPORT_SYMBOL(hermes_bap_pwrite); ...@@ -461,8 +457,8 @@ EXPORT_SYMBOL(hermes_bap_pwrite);
* practice. * practice.
* *
* Callable from user or bh context. */ * Callable from user or bh context. */
int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize, static int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
u16 *length, void *buf) u16 *length, void *buf)
{ {
int err = 0; int err = 0;
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
...@@ -505,10 +501,9 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize, ...@@ -505,10 +501,9 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
return 0; return 0;
} }
EXPORT_SYMBOL(hermes_read_ltv);
int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, static int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
u16 length, const void *value) u16 length, const void *value)
{ {
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
int err = 0; int err = 0;
...@@ -533,4 +528,15 @@ int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, ...@@ -533,4 +528,15 @@ int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
return err; return err;
} }
EXPORT_SYMBOL(hermes_write_ltv);
/* Hermes operations for local buses */
static const struct hermes_ops hermes_ops_local = {
.init = hermes_init,
.cmd_wait = hermes_docmd_wait,
.init_cmd_wait = hermes_doicmd_wait,
.allocate = hermes_allocate,
.read_ltv = hermes_read_ltv,
.write_ltv = hermes_write_ltv,
.bap_pread = hermes_bap_pread,
.bap_pwrite = hermes_bap_pwrite
};
...@@ -374,6 +374,27 @@ struct hermes_multicast { ...@@ -374,6 +374,27 @@ struct hermes_multicast {
/* Timeouts */ /* Timeouts */
#define HERMES_BAP_BUSY_TIMEOUT (10000) /* In iterations of ~1us */ #define HERMES_BAP_BUSY_TIMEOUT (10000) /* In iterations of ~1us */
struct hermes;
/* Functions to access hardware */
struct hermes_ops {
int (*init)(struct hermes *hw);
int (*cmd_wait)(struct hermes *hw, u16 cmd, u16 parm0,
struct hermes_response *resp);
int (*init_cmd_wait)(struct hermes *hw, u16 cmd,
u16 parm0, u16 parm1, u16 parm2,
struct hermes_response *resp);
int (*allocate)(struct hermes *hw, u16 size, u16 *fid);
int (*read_ltv)(struct hermes *hw, int bap, u16 rid, unsigned buflen,
u16 *length, void *buf);
int (*write_ltv)(struct hermes *hw, int bap, u16 rid,
u16 length, const void *value);
int (*bap_pread)(struct hermes *hw, int bap, void *buf, int len,
u16 id, u16 offset);
int (*bap_pwrite)(struct hermes *hw, int bap, const void *buf,
int len, u16 id, u16 offset);
};
/* Basic control structure */ /* Basic control structure */
typedef struct hermes { typedef struct hermes {
void __iomem *iobase; void __iomem *iobase;
...@@ -381,6 +402,7 @@ typedef struct hermes { ...@@ -381,6 +402,7 @@ typedef struct hermes {
#define HERMES_16BIT_REGSPACING 0 #define HERMES_16BIT_REGSPACING 0
#define HERMES_32BIT_REGSPACING 1 #define HERMES_32BIT_REGSPACING 1
u16 inten; /* Which interrupts should be enabled? */ u16 inten; /* Which interrupts should be enabled? */
const struct hermes_ops *ops;
} hermes_t; } hermes_t;
/* Register access convenience macros */ /* Register access convenience macros */
...@@ -394,22 +416,6 @@ typedef struct hermes { ...@@ -394,22 +416,6 @@ typedef struct hermes {
/* Function prototypes */ /* Function prototypes */
void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing); void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing);
int hermes_init(hermes_t *hw);
int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
struct hermes_response *resp);
int hermes_doicmd_wait(hermes_t *hw, u16 cmd,
u16 parm0, u16 parm1, u16 parm2,
struct hermes_response *resp);
int hermes_allocate(hermes_t *hw, u16 size, u16 *fid);
int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
u16 id, u16 offset);
int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
u16 id, u16 offset);
int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen,
u16 *length, void *buf);
int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
u16 length, const void *value);
/* Inline functions */ /* Inline functions */
...@@ -426,13 +432,13 @@ static inline void hermes_set_irqmask(hermes_t *hw, u16 events) ...@@ -426,13 +432,13 @@ static inline void hermes_set_irqmask(hermes_t *hw, u16 events)
static inline int hermes_enable_port(hermes_t *hw, int port) static inline int hermes_enable_port(hermes_t *hw, int port)
{ {
return hermes_docmd_wait(hw, HERMES_CMD_ENABLE | (port << 8), return hw->ops->cmd_wait(hw, HERMES_CMD_ENABLE | (port << 8),
0, NULL); 0, NULL);
} }
static inline int hermes_disable_port(hermes_t *hw, int port) static inline int hermes_disable_port(hermes_t *hw, int port)
{ {
return hermes_docmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), return hw->ops->cmd_wait(hw, HERMES_CMD_DISABLE | (port << 8),
0, NULL); 0, NULL);
} }
...@@ -440,7 +446,7 @@ static inline int hermes_disable_port(hermes_t *hw, int port) ...@@ -440,7 +446,7 @@ static inline int hermes_disable_port(hermes_t *hw, int port)
* information frame in __orinoco_ev_info() */ * information frame in __orinoco_ev_info() */
static inline int hermes_inquire(hermes_t *hw, u16 rid) static inline int hermes_inquire(hermes_t *hw, u16 rid)
{ {
return hermes_docmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL); return hw->ops->cmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL);
} }
#define HERMES_BYTES_TO_RECLEN(n) ((((n)+1)/2) + 1) #define HERMES_BYTES_TO_RECLEN(n) ((((n)+1)/2) + 1)
...@@ -475,10 +481,10 @@ static inline void hermes_clear_words(struct hermes *hw, int off, ...@@ -475,10 +481,10 @@ static inline void hermes_clear_words(struct hermes *hw, int off,
} }
#define HERMES_READ_RECORD(hw, bap, rid, buf) \ #define HERMES_READ_RECORD(hw, bap, rid, buf) \
(hermes_read_ltv((hw), (bap), (rid), sizeof(*buf), NULL, (buf))) (hw->ops->read_ltv((hw), (bap), (rid), sizeof(*buf), NULL, (buf)))
#define HERMES_WRITE_RECORD(hw, bap, rid, buf) \ #define HERMES_WRITE_RECORD(hw, bap, rid, buf) \
(hermes_write_ltv((hw), (bap), (rid), \ (hw->ops->write_ltv((hw), (bap), (rid), \
HERMES_BYTES_TO_RECLEN(sizeof(*buf)), (buf))) HERMES_BYTES_TO_RECLEN(sizeof(*buf)), (buf)))
static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word)
{ {
......
...@@ -293,7 +293,7 @@ int hermes_read_pda(hermes_t *hw, ...@@ -293,7 +293,7 @@ int hermes_read_pda(hermes_t *hw,
/* PDA of spectrum symbol is in eeprom */ /* PDA of spectrum symbol is in eeprom */
/* Issue command to read EEPROM */ /* Issue command to read EEPROM */
ret = hermes_docmd_wait(hw, HERMES_CMD_READMIF, 0, NULL); ret = hw->ops->cmd_wait(hw, HERMES_CMD_READMIF, 0, NULL);
if (ret) if (ret)
return ret; return ret;
} else { } else {
...@@ -408,16 +408,16 @@ int hermesi_program_init(hermes_t *hw, u32 offset) ...@@ -408,16 +408,16 @@ int hermesi_program_init(hermes_t *hw, u32 offset)
/* Acknowledge any outstanding command */ /* Acknowledge any outstanding command */
hermes_write_regn(hw, EVACK, 0xFFFF); hermes_write_regn(hw, EVACK, 0xFFFF);
/* Using doicmd_wait rather than docmd_wait */ /* Using init_cmd_wait rather than cmd_wait */
err = hermes_doicmd_wait(hw, err = hw->ops->init_cmd_wait(hw,
0x0100 | HERMES_CMD_INIT, 0x0100 | HERMES_CMD_INIT,
0, 0, 0, NULL); 0, 0, 0, NULL);
if (err) if (err)
return err; return err;
err = hermes_doicmd_wait(hw, err = hw->ops->init_cmd_wait(hw,
0x0000 | HERMES_CMD_INIT, 0x0000 | HERMES_CMD_INIT,
0, 0, 0, NULL); 0, 0, 0, NULL);
if (err) if (err)
return err; return err;
...@@ -428,12 +428,12 @@ int hermesi_program_init(hermes_t *hw, u32 offset) ...@@ -428,12 +428,12 @@ int hermesi_program_init(hermes_t *hw, u32 offset)
return err; return err;
pr_debug(PFX "Enabling volatile, EP 0x%08x\n", offset); pr_debug(PFX "Enabling volatile, EP 0x%08x\n", offset);
err = hermes_doicmd_wait(hw, err = hw->ops->init_cmd_wait(hw,
HERMES_PROGRAM_ENABLE_VOLATILE, HERMES_PROGRAM_ENABLE_VOLATILE,
offset & 0xFFFFu, offset & 0xFFFFu,
offset >> 16, offset >> 16,
0, 0,
NULL); NULL);
pr_debug(PFX "PROGRAM_ENABLE returned %d\n", err); pr_debug(PFX "PROGRAM_ENABLE returned %d\n", err);
return err; return err;
...@@ -451,7 +451,7 @@ int hermesi_program_end(hermes_t *hw) ...@@ -451,7 +451,7 @@ int hermesi_program_end(hermes_t *hw)
int rc = 0; int rc = 0;
int err; int err;
rc = hermes_docmd_wait(hw, HERMES_PROGRAM_DISABLE, 0, &resp); rc = hw->ops->cmd_wait(hw, HERMES_PROGRAM_DISABLE, 0, &resp);
pr_debug(PFX "PROGRAM_DISABLE returned %d, " pr_debug(PFX "PROGRAM_DISABLE returned %d, "
"r0 0x%04x, r1 0x%04x, r2 0x%04x\n", "r0 0x%04x, r1 0x%04x, r2 0x%04x\n",
...@@ -468,8 +468,8 @@ int hermesi_program_end(hermes_t *hw) ...@@ -468,8 +468,8 @@ int hermesi_program_end(hermes_t *hw)
hermes_write_regn(hw, EVACK, 0xFFFF); hermes_write_regn(hw, EVACK, 0xFFFF);
/* Reinitialise, ignoring return */ /* Reinitialise, ignoring return */
(void) hermes_doicmd_wait(hw, 0x0000 | HERMES_CMD_INIT, (void) hw->ops->init_cmd_wait(hw, 0x0000 | HERMES_CMD_INIT,
0, 0, 0, NULL); 0, 0, 0, NULL);
return rc ? rc : err; return rc ? rc : err;
} }
......
...@@ -177,9 +177,9 @@ int determine_fw_capabilities(struct orinoco_private *priv, ...@@ -177,9 +177,9 @@ int determine_fw_capabilities(struct orinoco_private *priv,
/* 3Com MAC : 00:50:DA:* */ /* 3Com MAC : 00:50:DA:* */
memset(tmp, 0, sizeof(tmp)); memset(tmp, 0, sizeof(tmp));
/* Get the Symbol firmware version */ /* Get the Symbol firmware version */
err = hermes_read_ltv(hw, USER_BAP, err = hw->ops->read_ltv(hw, USER_BAP,
HERMES_RID_SECONDARYVERSION_SYMBOL, HERMES_RID_SECONDARYVERSION_SYMBOL,
SYMBOL_MAX_VER_LEN, NULL, &tmp); SYMBOL_MAX_VER_LEN, NULL, &tmp);
if (err) { if (err) {
dev_warn(dev, "Error %d reading Symbol firmware info. " dev_warn(dev, "Error %d reading Symbol firmware info. "
"Wildly guessing capabilities...\n", err); "Wildly guessing capabilities...\n", err);
...@@ -286,8 +286,8 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) ...@@ -286,8 +286,8 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr)
u16 reclen; u16 reclen;
/* Get the MAC address */ /* Get the MAC address */
err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR, err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR,
ETH_ALEN, NULL, dev_addr); ETH_ALEN, NULL, dev_addr);
if (err) { if (err) {
dev_warn(dev, "Failed to read MAC address!\n"); dev_warn(dev, "Failed to read MAC address!\n");
goto out; goto out;
...@@ -296,8 +296,8 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) ...@@ -296,8 +296,8 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr)
dev_dbg(dev, "MAC address %pM\n", dev_addr); dev_dbg(dev, "MAC address %pM\n", dev_addr);
/* Get the station name */ /* Get the station name */
err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME, err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME,
sizeof(nickbuf), &reclen, &nickbuf); sizeof(nickbuf), &reclen, &nickbuf);
if (err) { if (err) {
dev_err(dev, "failed to read station name\n"); dev_err(dev, "failed to read station name\n");
goto out; goto out;
...@@ -413,11 +413,11 @@ int orinoco_hw_allocate_fid(struct orinoco_private *priv) ...@@ -413,11 +413,11 @@ int orinoco_hw_allocate_fid(struct orinoco_private *priv)
struct hermes *hw = &priv->hw; struct hermes *hw = &priv->hw;
int err; int err;
err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid); err = hw->ops->allocate(hw, priv->nicbuf_size, &priv->txfid);
if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) { if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) {
/* Try workaround for old Symbol firmware bug */ /* Try workaround for old Symbol firmware bug */
priv->nicbuf_size = TX_NICBUF_SIZE_BUG; priv->nicbuf_size = TX_NICBUF_SIZE_BUG;
err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid); err = hw->ops->allocate(hw, priv->nicbuf_size, &priv->txfid);
dev_warn(dev, "Firmware ALLOC bug detected " dev_warn(dev, "Firmware ALLOC bug detected "
"(old Symbol firmware?). Work around %s\n", "(old Symbol firmware?). Work around %s\n",
...@@ -463,8 +463,9 @@ int orinoco_hw_program_rids(struct orinoco_private *priv) ...@@ -463,8 +463,9 @@ int orinoco_hw_program_rids(struct orinoco_private *priv)
struct hermes_idstring idbuf; struct hermes_idstring idbuf;
/* Set the MAC address */ /* Set the MAC address */
err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR, err = hw->ops->write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR,
HERMES_BYTES_TO_RECLEN(ETH_ALEN), dev->dev_addr); HERMES_BYTES_TO_RECLEN(ETH_ALEN),
dev->dev_addr);
if (err) { if (err) {
printk(KERN_ERR "%s: Error %d setting MAC address\n", printk(KERN_ERR "%s: Error %d setting MAC address\n",
dev->name, err); dev->name, err);
...@@ -527,7 +528,7 @@ int orinoco_hw_program_rids(struct orinoco_private *priv) ...@@ -527,7 +528,7 @@ int orinoco_hw_program_rids(struct orinoco_private *priv)
idbuf.len = cpu_to_le16(strlen(priv->desired_essid)); idbuf.len = cpu_to_le16(strlen(priv->desired_essid));
memcpy(&idbuf.val, priv->desired_essid, sizeof(idbuf.val)); memcpy(&idbuf.val, priv->desired_essid, sizeof(idbuf.val));
/* WinXP wants partner to configure OWNSSID even in IBSS mode. (jimc) */ /* WinXP wants partner to configure OWNSSID even in IBSS mode. (jimc) */
err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNSSID, err = hw->ops->write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNSSID,
HERMES_BYTES_TO_RECLEN(strlen(priv->desired_essid)+2), HERMES_BYTES_TO_RECLEN(strlen(priv->desired_essid)+2),
&idbuf); &idbuf);
if (err) { if (err) {
...@@ -535,7 +536,7 @@ int orinoco_hw_program_rids(struct orinoco_private *priv) ...@@ -535,7 +536,7 @@ int orinoco_hw_program_rids(struct orinoco_private *priv)
dev->name, err); dev->name, err);
return err; return err;
} }
err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFDESIREDSSID, err = hw->ops->write_ltv(hw, USER_BAP, HERMES_RID_CNFDESIREDSSID,
HERMES_BYTES_TO_RECLEN(strlen(priv->desired_essid)+2), HERMES_BYTES_TO_RECLEN(strlen(priv->desired_essid)+2),
&idbuf); &idbuf);
if (err) { if (err) {
...@@ -547,9 +548,9 @@ int orinoco_hw_program_rids(struct orinoco_private *priv) ...@@ -547,9 +548,9 @@ int orinoco_hw_program_rids(struct orinoco_private *priv)
/* Set the station name */ /* Set the station name */
idbuf.len = cpu_to_le16(strlen(priv->nick)); idbuf.len = cpu_to_le16(strlen(priv->nick));
memcpy(&idbuf.val, priv->nick, sizeof(idbuf.val)); memcpy(&idbuf.val, priv->nick, sizeof(idbuf.val));
err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME, err = hw->ops->write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME,
HERMES_BYTES_TO_RECLEN(strlen(priv->nick)+2), HERMES_BYTES_TO_RECLEN(strlen(priv->nick)+2),
&idbuf); &idbuf);
if (err) { if (err) {
printk(KERN_ERR "%s: Error %d setting nickname\n", printk(KERN_ERR "%s: Error %d setting nickname\n",
dev->name, err); dev->name, err);
...@@ -664,12 +665,12 @@ int orinoco_hw_program_rids(struct orinoco_private *priv) ...@@ -664,12 +665,12 @@ int orinoco_hw_program_rids(struct orinoco_private *priv)
if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { if (priv->iw_mode == NL80211_IFTYPE_MONITOR) {
/* Enable monitor mode */ /* Enable monitor mode */
dev->type = ARPHRD_IEEE80211; dev->type = ARPHRD_IEEE80211;
err = hermes_docmd_wait(hw, HERMES_CMD_TEST | err = hw->ops->cmd_wait(hw, HERMES_CMD_TEST |
HERMES_TEST_MONITOR, 0, NULL); HERMES_TEST_MONITOR, 0, NULL);
} else { } else {
/* Disable monitor mode */ /* Disable monitor mode */
dev->type = ARPHRD_ETHER; dev->type = ARPHRD_ETHER;
err = hermes_docmd_wait(hw, HERMES_CMD_TEST | err = hw->ops->cmd_wait(hw, HERMES_CMD_TEST |
HERMES_TEST_STOP, 0, NULL); HERMES_TEST_STOP, 0, NULL);
} }
if (err) if (err)
...@@ -695,8 +696,8 @@ int orinoco_hw_get_tkip_iv(struct orinoco_private *priv, int key, u8 *tsc) ...@@ -695,8 +696,8 @@ int orinoco_hw_get_tkip_iv(struct orinoco_private *priv, int key, u8 *tsc)
if ((key < 0) || (key >= 4)) if ((key < 0) || (key >= 4))
return -EINVAL; return -EINVAL;
err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV, err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV,
sizeof(tsc_arr), NULL, &tsc_arr); sizeof(tsc_arr), NULL, &tsc_arr);
if (!err) if (!err)
memcpy(tsc, &tsc_arr[key][0], sizeof(tsc_arr[0])); memcpy(tsc, &tsc_arr[key][0], sizeof(tsc_arr[0]));
...@@ -875,7 +876,7 @@ int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv) ...@@ -875,7 +876,7 @@ int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv)
memcpy(key, priv->keys[i].key, memcpy(key, priv->keys[i].key,
priv->keys[i].key_len); priv->keys[i].key_len);
err = hermes_write_ltv(hw, USER_BAP, err = hw->ops->write_ltv(hw, USER_BAP,
HERMES_RID_CNFDEFAULTKEY0 + i, HERMES_RID_CNFDEFAULTKEY0 + i,
HERMES_BYTES_TO_RECLEN(keylen), HERMES_BYTES_TO_RECLEN(keylen),
key); key);
...@@ -1092,7 +1093,7 @@ int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, ...@@ -1092,7 +1093,7 @@ int __orinoco_hw_set_multicast_list(struct orinoco_private *priv,
memcpy(mclist.addr[i++], p->dmi_addr, ETH_ALEN); memcpy(mclist.addr[i++], p->dmi_addr, ETH_ALEN);
} }
err = hermes_write_ltv(hw, USER_BAP, err = hw->ops->write_ltv(hw, USER_BAP,
HERMES_RID_CNFGROUPADDRESSES, HERMES_RID_CNFGROUPADDRESSES,
HERMES_BYTES_TO_RECLEN(mc_count * ETH_ALEN), HERMES_BYTES_TO_RECLEN(mc_count * ETH_ALEN),
&mclist); &mclist);
...@@ -1134,15 +1135,15 @@ int orinoco_hw_get_essid(struct orinoco_private *priv, int *active, ...@@ -1134,15 +1135,15 @@ int orinoco_hw_get_essid(struct orinoco_private *priv, int *active,
rid = (priv->port_type == 3) ? HERMES_RID_CNFOWNSSID : rid = (priv->port_type == 3) ? HERMES_RID_CNFOWNSSID :
HERMES_RID_CNFDESIREDSSID; HERMES_RID_CNFDESIREDSSID;
err = hermes_read_ltv(hw, USER_BAP, rid, sizeof(essidbuf), err = hw->ops->read_ltv(hw, USER_BAP, rid, sizeof(essidbuf),
NULL, &essidbuf); NULL, &essidbuf);
if (err) if (err)
goto fail_unlock; goto fail_unlock;
} else { } else {
*active = 0; *active = 0;
err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTSSID, err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENTSSID,
sizeof(essidbuf), NULL, &essidbuf); sizeof(essidbuf), NULL, &essidbuf);
if (err) if (err)
goto fail_unlock; goto fail_unlock;
} }
...@@ -1213,8 +1214,8 @@ int orinoco_hw_get_bitratelist(struct orinoco_private *priv, ...@@ -1213,8 +1214,8 @@ int orinoco_hw_get_bitratelist(struct orinoco_private *priv,
if (orinoco_lock(priv, &flags) != 0) if (orinoco_lock(priv, &flags) != 0)
return -EBUSY; return -EBUSY;
err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_SUPPORTEDDATARATES, err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_SUPPORTEDDATARATES,
sizeof(list), NULL, &list); sizeof(list), NULL, &list);
orinoco_unlock(priv, &flags); orinoco_unlock(priv, &flags);
if (err) if (err)
...@@ -1281,7 +1282,7 @@ int orinoco_hw_trigger_scan(struct orinoco_private *priv, ...@@ -1281,7 +1282,7 @@ int orinoco_hw_trigger_scan(struct orinoco_private *priv,
idbuf.len = cpu_to_le16(len); idbuf.len = cpu_to_le16(len);
memcpy(idbuf.val, ssid->ssid, len); memcpy(idbuf.val, ssid->ssid, len);
err = hermes_write_ltv(hw, USER_BAP, err = hw->ops->write_ltv(hw, USER_BAP,
HERMES_RID_CNFSCANSSID_AGERE, HERMES_RID_CNFSCANSSID_AGERE,
HERMES_BYTES_TO_RECLEN(len + 2), HERMES_BYTES_TO_RECLEN(len + 2),
&idbuf); &idbuf);
...@@ -1345,8 +1346,8 @@ int orinoco_hw_get_current_bssid(struct orinoco_private *priv, ...@@ -1345,8 +1346,8 @@ int orinoco_hw_get_current_bssid(struct orinoco_private *priv,
hermes_t *hw = &priv->hw; hermes_t *hw = &priv->hw;
int err; int err;
err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID, err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID,
ETH_ALEN, NULL, addr); ETH_ALEN, NULL, addr);
return err; return err;
} }
...@@ -399,8 +399,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -399,8 +399,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
memset(&desc, 0, sizeof(desc)); memset(&desc, 0, sizeof(desc));
*txcntl = cpu_to_le16(tx_control); *txcntl = cpu_to_le16(tx_control);
err = hermes_bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), err = hw->ops->bap_pwrite(hw, USER_BAP, &desc, sizeof(desc),
txfid, 0); txfid, 0);
if (err) { if (err) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR "%s: Error %d writing Tx " printk(KERN_ERR "%s: Error %d writing Tx "
...@@ -413,8 +413,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -413,8 +413,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
memset(&desc, 0, sizeof(desc)); memset(&desc, 0, sizeof(desc));
desc.tx_control = cpu_to_le16(tx_control); desc.tx_control = cpu_to_le16(tx_control);
err = hermes_bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), err = hw->ops->bap_pwrite(hw, USER_BAP, &desc, sizeof(desc),
txfid, 0); txfid, 0);
if (err) { if (err) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR "%s: Error %d writing Tx " printk(KERN_ERR "%s: Error %d writing Tx "
...@@ -457,8 +457,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -457,8 +457,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
memcpy(eh, &hdr, sizeof(hdr)); memcpy(eh, &hdr, sizeof(hdr));
} }
err = hermes_bap_pwrite(hw, USER_BAP, skb->data, skb->len, err = hw->ops->bap_pwrite(hw, USER_BAP, skb->data, skb->len,
txfid, HERMES_802_3_OFFSET); txfid, HERMES_802_3_OFFSET);
if (err) { if (err) {
printk(KERN_ERR "%s: Error %d writing packet to BAP\n", printk(KERN_ERR "%s: Error %d writing packet to BAP\n",
dev->name, err); dev->name, err);
...@@ -489,8 +489,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -489,8 +489,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
skb->data + ETH_HLEN, skb->len - ETH_HLEN, mic); skb->data + ETH_HLEN, skb->len - ETH_HLEN, mic);
/* Write the MIC */ /* Write the MIC */
err = hermes_bap_pwrite(hw, USER_BAP, &mic_buf[0], len, err = hw->ops->bap_pwrite(hw, USER_BAP, &mic_buf[0], len,
txfid, HERMES_802_3_OFFSET + offset); txfid, HERMES_802_3_OFFSET + offset);
if (err) { if (err) {
printk(KERN_ERR "%s: Error %d writing MIC to BAP\n", printk(KERN_ERR "%s: Error %d writing MIC to BAP\n",
dev->name, err); dev->name, err);
...@@ -501,7 +501,7 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -501,7 +501,7 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
/* Finally, we actually initiate the send */ /* Finally, we actually initiate the send */
netif_stop_queue(dev); netif_stop_queue(dev);
err = hermes_docmd_wait(hw, HERMES_CMD_TX | HERMES_CMD_RECL, err = hw->ops->cmd_wait(hw, HERMES_CMD_TX | HERMES_CMD_RECL,
txfid, NULL); txfid, NULL);
if (err) { if (err) {
netif_start_queue(dev); netif_start_queue(dev);
...@@ -571,9 +571,9 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw) ...@@ -571,9 +571,9 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw)
return; /* Nothing's really happened */ return; /* Nothing's really happened */
/* Read part of the frame header - we need status and addr1 */ /* Read part of the frame header - we need status and addr1 */
err = hermes_bap_pread(hw, IRQ_BAP, &hdr, err = hw->ops->bap_pread(hw, IRQ_BAP, &hdr,
sizeof(struct hermes_txexc_data), sizeof(struct hermes_txexc_data),
fid, 0); fid, 0);
hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID); hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID);
stats->tx_errors++; stats->tx_errors++;
...@@ -763,9 +763,9 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid, ...@@ -763,9 +763,9 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid,
/* If any, copy the data from the card to the skb */ /* If any, copy the data from the card to the skb */
if (datalen > 0) { if (datalen > 0) {
err = hermes_bap_pread(hw, IRQ_BAP, skb_put(skb, datalen), err = hw->ops->bap_pread(hw, IRQ_BAP, skb_put(skb, datalen),
ALIGN(datalen, 2), rxfid, ALIGN(datalen, 2), rxfid,
HERMES_802_2_OFFSET); HERMES_802_2_OFFSET);
if (err) { if (err) {
printk(KERN_ERR "%s: error %d reading monitor frame\n", printk(KERN_ERR "%s: error %d reading monitor frame\n",
dev->name, err); dev->name, err);
...@@ -813,8 +813,8 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) ...@@ -813,8 +813,8 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw)
rxfid = hermes_read_regn(hw, RXFID); rxfid = hermes_read_regn(hw, RXFID);
err = hermes_bap_pread(hw, IRQ_BAP, desc, sizeof(*desc), err = hw->ops->bap_pread(hw, IRQ_BAP, desc, sizeof(*desc),
rxfid, 0); rxfid, 0);
if (err) { if (err) {
printk(KERN_ERR "%s: error %d reading Rx descriptor. " printk(KERN_ERR "%s: error %d reading Rx descriptor. "
"Frame dropped.\n", dev->name, err); "Frame dropped.\n", dev->name, err);
...@@ -881,9 +881,9 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) ...@@ -881,9 +881,9 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw)
nothing is removed. 2 is for aligning the IP header. */ nothing is removed. 2 is for aligning the IP header. */
skb_reserve(skb, ETH_HLEN + 2); skb_reserve(skb, ETH_HLEN + 2);
err = hermes_bap_pread(hw, IRQ_BAP, skb_put(skb, length), err = hw->ops->bap_pread(hw, IRQ_BAP, skb_put(skb, length),
ALIGN(length, 2), rxfid, ALIGN(length, 2), rxfid,
HERMES_802_2_OFFSET); HERMES_802_2_OFFSET);
if (err) { if (err) {
printk(KERN_ERR "%s: error %d reading frame. " printk(KERN_ERR "%s: error %d reading frame. "
"Frame dropped.\n", dev->name, err); "Frame dropped.\n", dev->name, err);
...@@ -1144,9 +1144,9 @@ static void orinoco_join_ap(struct work_struct *work) ...@@ -1144,9 +1144,9 @@ static void orinoco_join_ap(struct work_struct *work)
goto out; goto out;
/* Read scan results from the firmware */ /* Read scan results from the firmware */
err = hermes_read_ltv(hw, USER_BAP, err = hw->ops->read_ltv(hw, USER_BAP,
HERMES_RID_SCANRESULTSTABLE, HERMES_RID_SCANRESULTSTABLE,
MAX_SCAN_LEN, &len, buf); MAX_SCAN_LEN, &len, buf);
if (err) { if (err) {
printk(KERN_ERR "%s: Cannot read scan results\n", printk(KERN_ERR "%s: Cannot read scan results\n",
dev->name); dev->name);
...@@ -1193,8 +1193,8 @@ static void orinoco_send_bssid_wevent(struct orinoco_private *priv) ...@@ -1193,8 +1193,8 @@ static void orinoco_send_bssid_wevent(struct orinoco_private *priv)
union iwreq_data wrqu; union iwreq_data wrqu;
int err; int err;
err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID, err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID,
ETH_ALEN, NULL, wrqu.ap_addr.sa_data); ETH_ALEN, NULL, wrqu.ap_addr.sa_data);
if (err != 0) if (err != 0)
return; return;
...@@ -1216,8 +1216,8 @@ static void orinoco_send_assocreqie_wevent(struct orinoco_private *priv) ...@@ -1216,8 +1216,8 @@ static void orinoco_send_assocreqie_wevent(struct orinoco_private *priv)
if (!priv->has_wpa) if (!priv->has_wpa)
return; return;
err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_REQ_INFO, err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_REQ_INFO,
sizeof(buf), NULL, &buf); sizeof(buf), NULL, &buf);
if (err != 0) if (err != 0)
return; return;
...@@ -1246,8 +1246,9 @@ static void orinoco_send_assocrespie_wevent(struct orinoco_private *priv) ...@@ -1246,8 +1246,9 @@ static void orinoco_send_assocrespie_wevent(struct orinoco_private *priv)
if (!priv->has_wpa) if (!priv->has_wpa)
return; return;
err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_RESP_INFO, err = hw->ops->read_ltv(hw, USER_BAP,
sizeof(buf), NULL, &buf); HERMES_RID_CURRENT_ASSOC_RESP_INFO,
sizeof(buf), NULL, &buf);
if (err != 0) if (err != 0)
return; return;
...@@ -1370,8 +1371,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) ...@@ -1370,8 +1371,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
infofid = hermes_read_regn(hw, INFOFID); infofid = hermes_read_regn(hw, INFOFID);
/* Read the info frame header - don't try too hard */ /* Read the info frame header - don't try too hard */
err = hermes_bap_pread(hw, IRQ_BAP, &info, sizeof(info), err = hw->ops->bap_pread(hw, IRQ_BAP, &info, sizeof(info),
infofid, 0); infofid, 0);
if (err) { if (err) {
printk(KERN_ERR "%s: error %d reading info frame. " printk(KERN_ERR "%s: error %d reading info frame. "
"Frame dropped.\n", dev->name, err); "Frame dropped.\n", dev->name, err);
...@@ -1392,8 +1393,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) ...@@ -1392,8 +1393,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
len = sizeof(tallies); len = sizeof(tallies);
} }
err = hermes_bap_pread(hw, IRQ_BAP, &tallies, len, err = hw->ops->bap_pread(hw, IRQ_BAP, &tallies, len,
infofid, sizeof(info)); infofid, sizeof(info));
if (err) if (err)
break; break;
...@@ -1428,8 +1429,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) ...@@ -1428,8 +1429,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
break; break;
} }
err = hermes_bap_pread(hw, IRQ_BAP, &linkstatus, len, err = hw->ops->bap_pread(hw, IRQ_BAP, &linkstatus, len,
infofid, sizeof(info)); infofid, sizeof(info));
if (err) if (err)
break; break;
newstatus = le16_to_cpu(linkstatus.linkstatus); newstatus = le16_to_cpu(linkstatus.linkstatus);
...@@ -1493,8 +1494,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) ...@@ -1493,8 +1494,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
} }
/* Read scan data */ /* Read scan data */
err = hermes_bap_pread(hw, IRQ_BAP, (void *) buf, len, err = hw->ops->bap_pread(hw, IRQ_BAP, (void *) buf, len,
infofid, sizeof(info)); infofid, sizeof(info));
if (err) { if (err) {
kfree(buf); kfree(buf);
qabort_scan(priv); qabort_scan(priv);
...@@ -1546,8 +1547,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) ...@@ -1546,8 +1547,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
break; break;
/* Read scan data */ /* Read scan data */
err = hermes_bap_pread(hw, IRQ_BAP, (void *) bss, len, err = hw->ops->bap_pread(hw, IRQ_BAP, (void *) bss, len,
infofid, sizeof(info)); infofid, sizeof(info));
if (err) if (err)
kfree(bss); kfree(bss);
else else
...@@ -1646,7 +1647,7 @@ static int orinoco_reinit_firmware(struct orinoco_private *priv) ...@@ -1646,7 +1647,7 @@ static int orinoco_reinit_firmware(struct orinoco_private *priv)
struct hermes *hw = &priv->hw; struct hermes *hw = &priv->hw;
int err; int err;
err = hermes_init(hw); err = hw->ops->init(hw);
if (priv->do_fw_download && !err) { if (priv->do_fw_download && !err) {
err = orinoco_download(priv); err = orinoco_download(priv);
if (err) if (err)
...@@ -1983,7 +1984,7 @@ int orinoco_init(struct orinoco_private *priv) ...@@ -1983,7 +1984,7 @@ int orinoco_init(struct orinoco_private *priv)
priv->nicbuf_size = IEEE80211_MAX_FRAME_LEN + ETH_HLEN; priv->nicbuf_size = IEEE80211_MAX_FRAME_LEN + ETH_HLEN;
/* Initialize the firmware */ /* Initialize the firmware */
err = hermes_init(hw); err = hw->ops->init(hw);
if (err != 0) { if (err != 0) {
dev_err(dev, "Failed to initialize firmware (err = %d)\n", dev_err(dev, "Failed to initialize firmware (err = %d)\n",
err); err);
......
...@@ -457,7 +457,7 @@ static int orinoco_ioctl_setfreq(struct net_device *dev, ...@@ -457,7 +457,7 @@ static int orinoco_ioctl_setfreq(struct net_device *dev,
if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { if (priv->iw_mode == NL80211_IFTYPE_MONITOR) {
/* Fast channel change - no commit if successful */ /* Fast channel change - no commit if successful */
hermes_t *hw = &priv->hw; hermes_t *hw = &priv->hw;
err = hermes_docmd_wait(hw, HERMES_CMD_TEST | err = hw->ops->cmd_wait(hw, HERMES_CMD_TEST |
HERMES_TEST_SET_CHANNEL, HERMES_TEST_SET_CHANNEL,
chan, NULL); chan, NULL);
} }
...@@ -1272,8 +1272,8 @@ static int orinoco_ioctl_getrid(struct net_device *dev, ...@@ -1272,8 +1272,8 @@ static int orinoco_ioctl_getrid(struct net_device *dev,
if (orinoco_lock(priv, &flags) != 0) if (orinoco_lock(priv, &flags) != 0)
return -EBUSY; return -EBUSY;
err = hermes_read_ltv(hw, USER_BAP, rid, MAX_RID_LEN, &length, err = hw->ops->read_ltv(hw, USER_BAP, rid, MAX_RID_LEN, &length,
extra); extra);
if (err) if (err)
goto out; goto out;
......
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