orinoco: add hermes_ops
Pave the way for introducing USB alternative functions. Force callers to dereference ops instead of providing wrappers. Signed-off-by: David Kilroy <kilroyd@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
f7c65594f7
commit
b42f2074de
@@ -70,6 +70,7 @@
|
||||
|
||||
#endif /* ! HERMES_DEBUG */
|
||||
|
||||
static const struct hermes_ops hermes_ops_local;
|
||||
|
||||
/*
|
||||
* Internal functions
|
||||
@@ -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 */
|
||||
int hermes_doicmd_wait(hermes_t *hw, u16 cmd,
|
||||
u16 parm0, u16 parm1, u16 parm2,
|
||||
struct hermes_response *resp)
|
||||
static int hermes_doicmd_wait(hermes_t *hw, u16 cmd,
|
||||
u16 parm0, u16 parm1, u16 parm2,
|
||||
struct hermes_response *resp)
|
||||
{
|
||||
int err = 0;
|
||||
int k;
|
||||
@@ -163,17 +164,17 @@ int hermes_doicmd_wait(hermes_t *hw, u16 cmd,
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(hermes_doicmd_wait);
|
||||
|
||||
void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing)
|
||||
{
|
||||
hw->iobase = address;
|
||||
hw->reg_spacing = reg_spacing;
|
||||
hw->inten = 0x0;
|
||||
hw->ops = &hermes_ops_local;
|
||||
}
|
||||
EXPORT_SYMBOL(hermes_struct_init);
|
||||
|
||||
int hermes_init(hermes_t *hw)
|
||||
static int hermes_init(hermes_t *hw)
|
||||
{
|
||||
u16 reg;
|
||||
int err = 0;
|
||||
@@ -217,7 +218,6 @@ int hermes_init(hermes_t *hw)
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(hermes_init);
|
||||
|
||||
/* Issue a command to the chip, and (busy!) wait for it to
|
||||
* complete.
|
||||
@@ -228,8 +228,8 @@ EXPORT_SYMBOL(hermes_init);
|
||||
* > 0 on error returned by the firmware
|
||||
*
|
||||
* Callable from any context, but locking is your problem. */
|
||||
int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
|
||||
struct hermes_response *resp)
|
||||
static int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
|
||||
struct hermes_response *resp)
|
||||
{
|
||||
int err;
|
||||
int k;
|
||||
@@ -291,9 +291,8 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
|
||||
out:
|
||||
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 k;
|
||||
@@ -333,7 +332,6 @@ int hermes_allocate(hermes_t *hw, u16 size, u16 *fid)
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(hermes_allocate);
|
||||
|
||||
/* 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)
|
||||
* 0 on success
|
||||
* > 0 on error from firmware
|
||||
*/
|
||||
int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
|
||||
u16 id, u16 offset)
|
||||
static int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
|
||||
u16 id, u16 offset)
|
||||
{
|
||||
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
|
||||
int err = 0;
|
||||
@@ -422,7 +420,6 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(hermes_bap_pread);
|
||||
|
||||
/* Write a block of data to the chip's buffer, via the
|
||||
* BAP. Synchronization/serialization is the caller's problem.
|
||||
@@ -432,8 +429,8 @@ EXPORT_SYMBOL(hermes_bap_pread);
|
||||
* 0 on success
|
||||
* > 0 on error from firmware
|
||||
*/
|
||||
int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
|
||||
u16 id, u16 offset)
|
||||
static int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
|
||||
u16 id, u16 offset)
|
||||
{
|
||||
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
|
||||
int err = 0;
|
||||
@@ -451,7 +448,6 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(hermes_bap_pwrite);
|
||||
|
||||
/* Read a Length-Type-Value record from the card.
|
||||
*
|
||||
@@ -461,8 +457,8 @@ EXPORT_SYMBOL(hermes_bap_pwrite);
|
||||
* practice.
|
||||
*
|
||||
* Callable from user or bh context. */
|
||||
int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
|
||||
u16 *length, void *buf)
|
||||
static int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
|
||||
u16 *length, void *buf)
|
||||
{
|
||||
int err = 0;
|
||||
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
|
||||
@@ -505,10 +501,9 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(hermes_read_ltv);
|
||||
|
||||
int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
|
||||
u16 length, const void *value)
|
||||
static int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
|
||||
u16 length, const void *value)
|
||||
{
|
||||
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
|
||||
int err = 0;
|
||||
@@ -533,4 +528,15 @@ int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
|
||||
|
||||
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
|
||||
};
|
||||
|
Reference in New Issue
Block a user