Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 258448
b: refs/heads/master
c: 933d594
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Roskin authored and John W. Linville committed Jul 15, 2011
1 parent 5554ed3 commit 9a5e3ce
Show file tree
Hide file tree
Showing 22 changed files with 156 additions and 155 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 16c929df0895e6f52f4a0f17683d709f5fef95d8
refs/heads/master: 933d594313a5928ffc5325d7bbb6e2383d79622e
9 changes: 4 additions & 5 deletions trunk/drivers/net/wireless/orinoco/airport.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
struct orinoco_private *priv;
struct airport *card;
unsigned long phys_addr;
hermes_t *hw;
struct hermes *hw;

if (macio_resource_count(mdev) < 1 || macio_irq_count(mdev) < 1) {
printk(KERN_ERR PFX "Wrong interrupt/addresses in OF tree\n");
Expand Down Expand Up @@ -228,10 +228,9 @@ MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
MODULE_DESCRIPTION("Driver for the Apple Airport wireless card.");
MODULE_LICENSE("Dual MPL/GPL");

static struct of_device_id airport_match[] =
{
static struct of_device_id airport_match[] = {
{
.name = "radio",
.name = "radio",
},
{},
};
Expand All @@ -240,7 +239,7 @@ MODULE_DEVICE_TABLE(of, airport_match);

static struct macio_driver airport_driver = {
.driver = {
.name = DRIVER_NAME,
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = airport_match,
},
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/net/wireless/orinoco/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int orinoco_wiphy_register(struct wiphy *wiphy)
for (i = 0; i < NUM_CHANNELS; i++) {
if (priv->channel_mask & (1 << i)) {
priv->channels[i].center_freq =
ieee80211_dsss_chan_to_freq(i+1);
ieee80211_dsss_chan_to_freq(i + 1);
channels++;
}
}
Expand Down Expand Up @@ -182,7 +182,7 @@ static int orinoco_set_channel(struct wiphy *wiphy,
channel = ieee80211_freq_to_dsss_chan(chan->center_freq);

if ((channel < 1) || (channel > NUM_CHANNELS) ||
!(priv->channel_mask & (1 << (channel-1))))
!(priv->channel_mask & (1 << (channel - 1))))
return -EINVAL;

if (orinoco_lock(priv, &flags) != 0)
Expand All @@ -191,7 +191,7 @@ static int orinoco_set_channel(struct wiphy *wiphy,
priv->channel = channel;
if (priv->iw_mode == NL80211_IFTYPE_MONITOR) {
/* Fast channel change - no commit if successful */
hermes_t *hw = &priv->hw;
struct hermes *hw = &priv->hw;
err = hw->ops->cmd_wait(hw, HERMES_CMD_TEST |
HERMES_TEST_SET_CHANNEL,
channel, NULL);
Expand Down
7 changes: 3 additions & 4 deletions trunk/drivers/net/wireless/orinoco/fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ orinoco_dl_firmware(struct orinoco_private *priv,
/* Plug Data Area (PDA) */
__le16 *pda;

hermes_t *hw = &priv->hw;
struct hermes *hw = &priv->hw;
const struct firmware *fw_entry;
const struct orinoco_fw_header *hdr;
const unsigned char *first_block;
Expand Down Expand Up @@ -205,7 +205,7 @@ symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw,
const unsigned char *image, const void *end,
int secondary)
{
hermes_t *hw = &priv->hw;
struct hermes *hw = &priv->hw;
int ret = 0;
const unsigned char *ptr;
const unsigned char *first_block;
Expand Down Expand Up @@ -322,9 +322,8 @@ symbol_dl_firmware(struct orinoco_private *priv,
fw_entry->data + fw_entry->size, 1);
if (!orinoco_cached_fw_get(priv, false))
release_firmware(fw_entry);
if (ret) {
if (ret)
dev_err(dev, "Secondary firmware download failed\n");
}

return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/wireless/orinoco/fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int orinoco_download(struct orinoco_private *priv);
void orinoco_cache_fw(struct orinoco_private *priv, int ap);
void orinoco_uncache_fw(struct orinoco_private *priv);
#else
#define orinoco_cache_fw(priv, ap) do { } while(0)
#define orinoco_cache_fw(priv, ap) do { } while (0)
#define orinoco_uncache_fw(priv) do { } while (0)
#endif

Expand Down
40 changes: 21 additions & 19 deletions trunk/drivers/net/wireless/orinoco/hermes.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static const struct hermes_ops hermes_ops_local;
Callable from any context.
*/
static int hermes_issue_cmd(hermes_t *hw, u16 cmd, u16 param0,
static int hermes_issue_cmd(struct hermes *hw, u16 cmd, u16 param0,
u16 param1, u16 param2)
{
int k = CMD_BUSY_TIMEOUT;
Expand Down Expand Up @@ -132,7 +132,7 @@ static int hermes_issue_cmd(hermes_t *hw, u16 cmd, u16 param0,
*/

/* For doing cmds that wipe the magic constant in SWSUPPORT0 */
static int hermes_doicmd_wait(hermes_t *hw, u16 cmd,
static int hermes_doicmd_wait(struct hermes *hw, u16 cmd,
u16 parm0, u16 parm1, u16 parm2,
struct hermes_response *resp)
{
Expand Down Expand Up @@ -185,7 +185,8 @@ static int hermes_doicmd_wait(hermes_t *hw, u16 cmd,
return err;
}

void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing)
void hermes_struct_init(struct hermes *hw, void __iomem *address,
int reg_spacing)
{
hw->iobase = address;
hw->reg_spacing = reg_spacing;
Expand All @@ -195,7 +196,7 @@ void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing)
}
EXPORT_SYMBOL(hermes_struct_init);

static int hermes_init(hermes_t *hw)
static int hermes_init(struct hermes *hw)
{
u16 reg;
int err = 0;
Expand Down Expand Up @@ -249,7 +250,7 @@ static int hermes_init(hermes_t *hw)
* > 0 on error returned by the firmware
*
* Callable from any context, but locking is your problem. */
static int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
static int hermes_docmd_wait(struct hermes *hw, u16 cmd, u16 parm0,
struct hermes_response *resp)
{
int err;
Expand Down Expand Up @@ -313,7 +314,7 @@ static int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
return err;
}

static int hermes_allocate(hermes_t *hw, u16 size, u16 *fid)
static int hermes_allocate(struct hermes *hw, u16 size, u16 *fid)
{
int err = 0;
int k;
Expand Down Expand Up @@ -363,7 +364,7 @@ static int hermes_allocate(hermes_t *hw, u16 size, u16 *fid)
* from firmware
*
* Callable from any context */
static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
static int hermes_bap_seek(struct hermes *hw, int bap, u16 id, u16 offset)
{
int sreg = bap ? HERMES_SELECT1 : HERMES_SELECT0;
int oreg = bap ? HERMES_OFFSET1 : HERMES_OFFSET0;
Expand Down Expand Up @@ -422,7 +423,7 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
* 0 on success
* > 0 on error from firmware
*/
static int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
static int hermes_bap_pread(struct hermes *hw, int bap, void *buf, int len,
u16 id, u16 offset)
{
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
Expand All @@ -436,7 +437,7 @@ static int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
goto out;

/* Actually do the transfer */
hermes_read_words(hw, dreg, buf, len/2);
hermes_read_words(hw, dreg, buf, len / 2);

out:
return err;
Expand All @@ -450,8 +451,8 @@ static int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
* 0 on success
* > 0 on error from firmware
*/
static int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
u16 id, u16 offset)
static int hermes_bap_pwrite(struct hermes *hw, int bap, const void *buf,
int len, u16 id, u16 offset)
{
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
int err = 0;
Expand All @@ -478,8 +479,8 @@ static int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
* practice.
*
* Callable from user or bh context. */
static int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
u16 *length, void *buf)
static int hermes_read_ltv(struct hermes *hw, int bap, u16 rid,
unsigned bufsize, u16 *length, void *buf)
{
int err = 0;
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
Expand Down Expand Up @@ -523,7 +524,7 @@ static int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
return 0;
}

static int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
static int hermes_write_ltv(struct hermes *hw, int bap, u16 rid,
u16 length, const void *value)
{
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
Expand Down Expand Up @@ -553,14 +554,14 @@ static int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
/*** Hermes AUX control ***/

static inline void
hermes_aux_setaddr(hermes_t *hw, u32 addr)
hermes_aux_setaddr(struct hermes *hw, u32 addr)
{
hermes_write_reg(hw, HERMES_AUXPAGE, (u16) (addr >> 7));
hermes_write_reg(hw, HERMES_AUXOFFSET, (u16) (addr & 0x7F));
}

static inline int
hermes_aux_control(hermes_t *hw, int enabled)
hermes_aux_control(struct hermes *hw, int enabled)
{
int desired_state = enabled ? HERMES_AUX_ENABLED : HERMES_AUX_DISABLED;
int action = enabled ? HERMES_AUX_ENABLE : HERMES_AUX_DISABLE;
Expand Down Expand Up @@ -594,7 +595,7 @@ hermes_aux_control(hermes_t *hw, int enabled)
* wl_lkm Agere fw does
* Don't know about intersil
*/
static int hermesi_program_init(hermes_t *hw, u32 offset)
static int hermesi_program_init(struct hermes *hw, u32 offset)
{
int err;

Expand Down Expand Up @@ -643,7 +644,7 @@ static int hermesi_program_init(hermes_t *hw, u32 offset)
* wl_lkm Agere fw does
* Don't know about intersil
*/
static int hermesi_program_end(hermes_t *hw)
static int hermesi_program_end(struct hermes *hw)
{
struct hermes_response resp;
int rc = 0;
Expand Down Expand Up @@ -684,7 +685,8 @@ static int hermes_program_bytes(struct hermes *hw, const char *data,
}

/* Read PDA from the adapter */
static int hermes_read_pda(hermes_t *hw, __le16 *pda, u32 pda_addr, u16 pda_len)
static int hermes_read_pda(struct hermes *hw, __le16 *pda, u32 pda_addr,
u16 pda_len)
{
int ret;
u16 pda_size;
Expand Down
37 changes: 20 additions & 17 deletions trunk/drivers/net/wireless/orinoco/hermes.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*
* As a module of low level hardware access routines, there is no
* locking. Users of this module should ensure that they serialize
* access to the hermes_t structure, and to the hardware
* access to the hermes structure, and to the hardware
*/

#include <linux/if_ether.h>
Expand All @@ -43,7 +43,7 @@
#define HERMES_BAP_DATALEN_MAX (4096)
#define HERMES_BAP_OFFSET_MAX (4096)
#define HERMES_PORTID_MAX (7)
#define HERMES_NUMPORTS_MAX (HERMES_PORTID_MAX+1)
#define HERMES_NUMPORTS_MAX (HERMES_PORTID_MAX + 1)
#define HERMES_PDR_LEN_MAX (260) /* in bytes, from EK */
#define HERMES_PDA_RECS_MAX (200) /* a guess */
#define HERMES_PDA_LEN_MAX (1024) /* in bytes, from EK */
Expand Down Expand Up @@ -148,7 +148,7 @@
#define HERMES_CMD_WRITEMIF (0x0031)

/*--- Debugging Commands -----------------------------*/
#define HERMES_CMD_TEST (0x0038)
#define HERMES_CMD_TEST (0x0038)


/* Test command arguments */
Expand Down Expand Up @@ -178,8 +178,8 @@

#define HERMES_DESCRIPTOR_OFFSET 0
#define HERMES_802_11_OFFSET (14)
#define HERMES_802_3_OFFSET (14+32)
#define HERMES_802_2_OFFSET (14+32+14)
#define HERMES_802_3_OFFSET (14 + 32)
#define HERMES_802_2_OFFSET (14 + 32 + 14)
#define HERMES_TXCNTL2_OFFSET (HERMES_802_3_OFFSET - 2)

#define HERMES_RXSTAT_ERR (0x0003)
Expand Down Expand Up @@ -406,7 +406,7 @@ struct hermes_ops {
};

/* Basic control structure */
typedef struct hermes {
struct hermes {
void __iomem *iobase;
int reg_spacing;
#define HERMES_16BIT_REGSPACING 0
Expand All @@ -415,7 +415,7 @@ typedef struct hermes {
bool eeprom_pda;
const struct hermes_ops *ops;
void *priv;
} hermes_t;
};

/* Register access convenience macros */
#define hermes_read_reg(hw, off) \
Expand All @@ -427,42 +427,43 @@ typedef struct hermes {
hermes_write_reg((hw), HERMES_##name, (val))

/* Function prototypes */
void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing);
void hermes_struct_init(struct hermes *hw, void __iomem *address,
int reg_spacing);

/* Inline functions */

static inline int hermes_present(hermes_t *hw)
static inline int hermes_present(struct hermes *hw)
{
return hermes_read_regn(hw, SWSUPPORT0) == HERMES_MAGIC;
}

static inline void hermes_set_irqmask(hermes_t *hw, u16 events)
static inline void hermes_set_irqmask(struct hermes *hw, u16 events)
{
hw->inten = events;
hermes_write_regn(hw, INTEN, events);
}

static inline int hermes_enable_port(hermes_t *hw, int port)
static inline int hermes_enable_port(struct hermes *hw, int port)
{
return hw->ops->cmd_wait(hw, HERMES_CMD_ENABLE | (port << 8),
0, NULL);
}

static inline int hermes_disable_port(hermes_t *hw, int port)
static inline int hermes_disable_port(struct hermes *hw, int port)
{
return hw->ops->cmd_wait(hw, HERMES_CMD_DISABLE | (port << 8),
0, NULL);
}

/* Initiate an INQUIRE command (tallies or scan). The result will come as an
* information frame in __orinoco_ev_info() */
static inline int hermes_inquire(hermes_t *hw, u16 rid)
static inline int hermes_inquire(struct hermes *hw, u16 rid)
{
return hw->ops->cmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL);
}

#define HERMES_BYTES_TO_RECLEN(n) ((((n)+1)/2) + 1)
#define HERMES_RECLEN_TO_BYTES(n) (((n)-1) * 2)
#define HERMES_BYTES_TO_RECLEN(n) ((((n) + 1) / 2) + 1)
#define HERMES_RECLEN_TO_BYTES(n) (((n) - 1) * 2)

/* Note that for the next two, the count is in 16-bit words, not bytes */
static inline void hermes_read_words(struct hermes *hw, int off,
Expand Down Expand Up @@ -498,7 +499,8 @@ static inline void hermes_clear_words(struct hermes *hw, int off,
(hw->ops->write_ltv((hw), (bap), (rid), \
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(struct hermes *hw, int bap, u16 rid,
u16 *word)
{
__le16 rec;
int err;
Expand All @@ -508,7 +510,8 @@ static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word)
return err;
}

static inline int hermes_write_wordrec(hermes_t *hw, int bap, u16 rid, u16 word)
static inline int hermes_write_wordrec(struct hermes *hw, int bap, u16 rid,
u16 word)
{
__le16 rec = cpu_to_le16(word);
return HERMES_WRITE_RECORD(hw, bap, rid, &rec);
Expand Down
Loading

0 comments on commit 9a5e3ce

Please sign in to comment.