Commit d14c7c1d authored by Andrey Borzenkov's avatar Andrey Borzenkov Committed by John W. Linville

orinoco: checkpatch cleanup

Fix errors and obvious warnings reported by checkpatch in all files
except orinoco.c. Orinoco.c is part of different patch series of Dave.
Signed-off-by: default avatarAndrey Borzenkov <arvidjaar@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent aa6320d3
...@@ -60,7 +60,8 @@ airport_suspend(struct macio_dev *mdev, pm_message_t state) ...@@ -60,7 +60,8 @@ airport_suspend(struct macio_dev *mdev, pm_message_t state)
orinoco_unlock(priv, &flags); orinoco_unlock(priv, &flags);
disable_irq(dev->irq); disable_irq(dev->irq);
pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 0); pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
macio_get_of_node(mdev), 0, 0);
return 0; return 0;
} }
...@@ -75,7 +76,8 @@ airport_resume(struct macio_dev *mdev) ...@@ -75,7 +76,8 @@ airport_resume(struct macio_dev *mdev)
printk(KERN_DEBUG "%s: Airport waking up\n", dev->name); printk(KERN_DEBUG "%s: Airport waking up\n", dev->name);
pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 1); pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
macio_get_of_node(mdev), 0, 1);
msleep(200); msleep(200);
enable_irq(dev->irq); enable_irq(dev->irq);
...@@ -93,7 +95,7 @@ airport_resume(struct macio_dev *mdev) ...@@ -93,7 +95,7 @@ airport_resume(struct macio_dev *mdev)
priv->hw_unavailable--; priv->hw_unavailable--;
if (priv->open && (! priv->hw_unavailable)) { if (priv->open && (!priv->hw_unavailable)) {
err = __orinoco_up(dev); err = __orinoco_up(dev);
if (err) if (err)
printk(KERN_ERR "%s: Error %d restarting card on PBOOK_WAKE\n", printk(KERN_ERR "%s: Error %d restarting card on PBOOK_WAKE\n",
...@@ -127,7 +129,8 @@ airport_detach(struct macio_dev *mdev) ...@@ -127,7 +129,8 @@ airport_detach(struct macio_dev *mdev)
macio_release_resource(mdev, 0); macio_release_resource(mdev, 0);
pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 0); pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
macio_get_of_node(mdev), 0, 0);
ssleep(1); ssleep(1);
macio_set_drvdata(mdev, NULL); macio_set_drvdata(mdev, NULL);
...@@ -153,9 +156,11 @@ static int airport_hard_reset(struct orinoco_private *priv) ...@@ -153,9 +156,11 @@ static int airport_hard_reset(struct orinoco_private *priv)
* off. */ * off. */
disable_irq(dev->irq); disable_irq(dev->irq);
pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(card->mdev), 0, 0); pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
macio_get_of_node(card->mdev), 0, 0);
ssleep(1); ssleep(1);
pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(card->mdev), 0, 1); pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
macio_get_of_node(card->mdev), 0, 1);
ssleep(1); ssleep(1);
enable_irq(dev->irq); enable_irq(dev->irq);
...@@ -182,7 +187,7 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match) ...@@ -182,7 +187,7 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
/* Allocate space for private device-specific data */ /* Allocate space for private device-specific data */
dev = alloc_orinocodev(sizeof(*card), &mdev->ofdev.dev, dev = alloc_orinocodev(sizeof(*card), &mdev->ofdev.dev,
airport_hard_reset, NULL); airport_hard_reset, NULL);
if (! dev) { if (!dev) {
printk(KERN_ERR PFX "Cannot allocate network device\n"); printk(KERN_ERR PFX "Cannot allocate network device\n");
return -ENODEV; return -ENODEV;
} }
...@@ -216,7 +221,8 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match) ...@@ -216,7 +221,8 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
hermes_struct_init(hw, card->vaddr, HERMES_16BIT_REGSPACING); hermes_struct_init(hw, card->vaddr, HERMES_16BIT_REGSPACING);
/* Power up card */ /* Power up card */
pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 1); pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
macio_get_of_node(mdev), 0, 1);
ssleep(1); ssleep(1);
/* Reset it before we get the interrupt */ /* Reset it before we get the interrupt */
...@@ -256,10 +262,9 @@ static struct of_device_id airport_match[] = ...@@ -256,10 +262,9 @@ static struct of_device_id airport_match[] =
{}, {},
}; };
MODULE_DEVICE_TABLE (of, airport_match); MODULE_DEVICE_TABLE(of, airport_match);
static struct macio_driver airport_driver = static struct macio_driver airport_driver = {
{
.name = DRIVER_NAME, .name = DRIVER_NAME,
.match_table = airport_match, .match_table = airport_match,
.probe = airport_attach, .probe = airport_attach,
......
...@@ -45,7 +45,8 @@ ...@@ -45,7 +45,8 @@
#include "hermes.h" #include "hermes.h"
MODULE_DESCRIPTION("Low-level driver helper for Lucent Hermes chipset and Prism II HFA384x wireless MAC controller"); MODULE_DESCRIPTION("Low-level driver helper for Lucent Hermes chipset"
" and Prism II HFA384x wireless MAC controller");
MODULE_AUTHOR("Pavel Roskin <proski@gnu.org>" MODULE_AUTHOR("Pavel Roskin <proski@gnu.org>"
" & David Gibson <hermes@gibson.dropbear.id.au>"); " & David Gibson <hermes@gibson.dropbear.id.au>");
MODULE_LICENSE("Dual MPL/GPL"); MODULE_LICENSE("Dual MPL/GPL");
...@@ -61,13 +62,13 @@ MODULE_LICENSE("Dual MPL/GPL"); ...@@ -61,13 +62,13 @@ MODULE_LICENSE("Dual MPL/GPL");
*/ */
#define DMSG(stuff...) do {printk(KERN_DEBUG "hermes @ %p: " , hw->iobase); \ #define DMSG(stuff...) do {printk(KERN_DEBUG "hermes @ %p: " , hw->iobase); \
printk(stuff);} while (0) printk(stuff); } while (0)
#undef HERMES_DEBUG #undef HERMES_DEBUG
#ifdef HERMES_DEBUG #ifdef HERMES_DEBUG
#include <stdarg.h> #include <stdarg.h>
#define DEBUG(lvl, stuff...) if ( (lvl) <= HERMES_DEBUG) DMSG(stuff) #define DEBUG(lvl, stuff...) if ((lvl) <= HERMES_DEBUG) DMSG(stuff)
#else /* ! HERMES_DEBUG */ #else /* ! HERMES_DEBUG */
...@@ -95,14 +96,13 @@ static int hermes_issue_cmd(hermes_t *hw, u16 cmd, u16 param0, ...@@ -95,14 +96,13 @@ static int hermes_issue_cmd(hermes_t *hw, u16 cmd, u16 param0,
/* First wait for the command register to unbusy */ /* First wait for the command register to unbusy */
reg = hermes_read_regn(hw, CMD); reg = hermes_read_regn(hw, CMD);
while ( (reg & HERMES_CMD_BUSY) && k ) { while ((reg & HERMES_CMD_BUSY) && k) {
k--; k--;
udelay(1); udelay(1);
reg = hermes_read_regn(hw, CMD); reg = hermes_read_regn(hw, CMD);
} }
if (reg & HERMES_CMD_BUSY) { if (reg & HERMES_CMD_BUSY)
return -EBUSY; return -EBUSY;
}
hermes_write_regn(hw, PARAM2, param2); hermes_write_regn(hw, PARAM2, param2);
hermes_write_regn(hw, PARAM1, param1); hermes_write_regn(hw, PARAM1, param1);
...@@ -199,8 +199,8 @@ int hermes_init(hermes_t *hw) ...@@ -199,8 +199,8 @@ int hermes_init(hermes_t *hw)
k = CMD_BUSY_TIMEOUT; k = CMD_BUSY_TIMEOUT;
reg = hermes_read_regn(hw, CMD); reg = hermes_read_regn(hw, CMD);
while (k && (reg & HERMES_CMD_BUSY)) { while (k && (reg & HERMES_CMD_BUSY)) {
if (reg == 0xffff) /* Special case - the card has probably been removed, if (reg == 0xffff) /* Special case - the card has probably been
so don't wait for the timeout */ removed, so don't wait for the timeout */
return -ENODEV; return -ENODEV;
k--; k--;
...@@ -228,7 +228,10 @@ EXPORT_SYMBOL(hermes_init); ...@@ -228,7 +228,10 @@ 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.
* *
* Returns: < 0 on internal error, 0 on success, > 0 on error returned by the firmware * Returns:
* < 0 on internal error
* 0 on success
* > 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, int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
...@@ -241,7 +244,7 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0, ...@@ -241,7 +244,7 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
err = hermes_issue_cmd(hw, cmd, parm0, 0, 0); err = hermes_issue_cmd(hw, cmd, parm0, 0, 0);
if (err) { if (err) {
if (! hermes_present(hw)) { if (!hermes_present(hw)) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "hermes @ %p: " printk(KERN_WARNING "hermes @ %p: "
"Card removed while issuing command " "Card removed while issuing command "
...@@ -257,13 +260,13 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0, ...@@ -257,13 +260,13 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
reg = hermes_read_regn(hw, EVSTAT); reg = hermes_read_regn(hw, EVSTAT);
k = CMD_COMPL_TIMEOUT; k = CMD_COMPL_TIMEOUT;
while ( (! (reg & HERMES_EV_CMD)) && k) { while ((!(reg & HERMES_EV_CMD)) && k) {
k--; k--;
udelay(10); udelay(10);
reg = hermes_read_regn(hw, EVSTAT); reg = hermes_read_regn(hw, EVSTAT);
} }
if (! hermes_present(hw)) { if (!hermes_present(hw)) {
printk(KERN_WARNING "hermes @ %p: Card removed " printk(KERN_WARNING "hermes @ %p: Card removed "
"while waiting for command 0x%04x completion.\n", "while waiting for command 0x%04x completion.\n",
hw->iobase, cmd); hw->iobase, cmd);
...@@ -271,7 +274,7 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0, ...@@ -271,7 +274,7 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
goto out; goto out;
} }
if (! (reg & HERMES_EV_CMD)) { if (!(reg & HERMES_EV_CMD)) {
printk(KERN_ERR "hermes @ %p: Timeout waiting for " printk(KERN_ERR "hermes @ %p: Timeout waiting for "
"command 0x%04x completion.\n", hw->iobase, cmd); "command 0x%04x completion.\n", hw->iobase, cmd);
err = -ETIMEDOUT; err = -ETIMEDOUT;
...@@ -302,30 +305,29 @@ int hermes_allocate(hermes_t *hw, u16 size, u16 *fid) ...@@ -302,30 +305,29 @@ int hermes_allocate(hermes_t *hw, u16 size, u16 *fid)
int k; int k;
u16 reg; u16 reg;
if ( (size < HERMES_ALLOC_LEN_MIN) || (size > HERMES_ALLOC_LEN_MAX) ) if ((size < HERMES_ALLOC_LEN_MIN) || (size > HERMES_ALLOC_LEN_MAX))
return -EINVAL; return -EINVAL;
err = hermes_docmd_wait(hw, HERMES_CMD_ALLOC, size, NULL); err = hermes_docmd_wait(hw, HERMES_CMD_ALLOC, size, NULL);
if (err) { if (err)
return err; return err;
}
reg = hermes_read_regn(hw, EVSTAT); reg = hermes_read_regn(hw, EVSTAT);
k = ALLOC_COMPL_TIMEOUT; k = ALLOC_COMPL_TIMEOUT;
while ( (! (reg & HERMES_EV_ALLOC)) && k) { while ((!(reg & HERMES_EV_ALLOC)) && k) {
k--; k--;
udelay(10); udelay(10);
reg = hermes_read_regn(hw, EVSTAT); reg = hermes_read_regn(hw, EVSTAT);
} }
if (! hermes_present(hw)) { if (!hermes_present(hw)) {
printk(KERN_WARNING "hermes @ %p: " printk(KERN_WARNING "hermes @ %p: "
"Card removed waiting for frame allocation.\n", "Card removed waiting for frame allocation.\n",
hw->iobase); hw->iobase);
return -ENODEV; return -ENODEV;
} }
if (! (reg & HERMES_EV_ALLOC)) { if (!(reg & HERMES_EV_ALLOC)) {
printk(KERN_ERR "hermes @ %p: " printk(KERN_ERR "hermes @ %p: "
"Timeout waiting for frame allocation\n", "Timeout waiting for frame allocation\n",
hw->iobase); hw->iobase);
...@@ -341,7 +343,10 @@ EXPORT_SYMBOL(hermes_allocate); ...@@ -341,7 +343,10 @@ 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.
* *
* Returns: < 0 on internal failure (errno), 0 on success, >0 on error * Returns:
* < 0 on internal failure (errno)
* 0 on success
* > 0 on error
* from firmware * from firmware
* *
* Callable from any context */ * Callable from any context */
...@@ -353,7 +358,7 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset) ...@@ -353,7 +358,7 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
u16 reg; u16 reg;
/* Paranoia.. */ /* Paranoia.. */
if ( (offset > HERMES_BAP_OFFSET_MAX) || (offset % 2) ) if ((offset > HERMES_BAP_OFFSET_MAX) || (offset % 2))
return -EINVAL; return -EINVAL;
k = HERMES_BAP_BUSY_TIMEOUT; k = HERMES_BAP_BUSY_TIMEOUT;
...@@ -374,7 +379,7 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset) ...@@ -374,7 +379,7 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
/* Wait for the BAP to be ready */ /* Wait for the BAP to be ready */
k = HERMES_BAP_BUSY_TIMEOUT; k = HERMES_BAP_BUSY_TIMEOUT;
reg = hermes_read_reg(hw, oreg); reg = hermes_read_reg(hw, oreg);
while ( (reg & (HERMES_OFFSET_BUSY | HERMES_OFFSET_ERR)) && k) { while ((reg & (HERMES_OFFSET_BUSY | HERMES_OFFSET_ERR)) && k) {
k--; k--;
udelay(1); udelay(1);
reg = hermes_read_reg(hw, oreg); reg = hermes_read_reg(hw, oreg);
...@@ -386,9 +391,8 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset) ...@@ -386,9 +391,8 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
(reg & HERMES_OFFSET_BUSY) ? "timeout" : "error", (reg & HERMES_OFFSET_BUSY) ? "timeout" : "error",
reg, id, offset); reg, id, offset);
if (reg & HERMES_OFFSET_BUSY) { if (reg & HERMES_OFFSET_BUSY)
return -ETIMEDOUT; return -ETIMEDOUT;
}
return -EIO; /* error or wrong offset */ return -EIO; /* error or wrong offset */
} }
...@@ -400,7 +404,10 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset) ...@@ -400,7 +404,10 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
* BAP. Synchronization/serialization is the caller's problem. len * BAP. Synchronization/serialization is the caller's problem. len
* must be even. * must be even.
* *
* Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware * Returns:
* < 0 on internal failure (errno)
* 0 on success
* > 0 on error from firmware
*/ */
int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
u16 id, u16 offset) u16 id, u16 offset)
...@@ -408,7 +415,7 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, ...@@ -408,7 +415,7 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
int err = 0; int err = 0;
if ( (len < 0) || (len % 2) ) if ((len < 0) || (len % 2))
return -EINVAL; return -EINVAL;
err = hermes_bap_seek(hw, bap, id, offset); err = hermes_bap_seek(hw, bap, id, offset);
...@@ -426,7 +433,10 @@ EXPORT_SYMBOL(hermes_bap_pread); ...@@ -426,7 +433,10 @@ 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.
* *
* Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware * Returns:
* < 0 on internal failure (errno)
* 0 on success
* > 0 on error from firmware
*/ */
int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
u16 id, u16 offset) u16 id, u16 offset)
...@@ -465,7 +475,7 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize, ...@@ -465,7 +475,7 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
u16 rlength, rtype; u16 rlength, rtype;
unsigned nwords; unsigned nwords;
if ( (bufsize < 0) || (bufsize % 2) ) if ((bufsize < 0) || (bufsize % 2))
return -EINVAL; return -EINVAL;
err = hermes_docmd_wait(hw, HERMES_CMD_ACCESS, rid, NULL); err = hermes_docmd_wait(hw, HERMES_CMD_ACCESS, rid, NULL);
...@@ -478,7 +488,7 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize, ...@@ -478,7 +488,7 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
rlength = hermes_read_reg(hw, dreg); rlength = hermes_read_reg(hw, dreg);
if (! rlength) if (!rlength)
return -ENODATA; return -ENODATA;
rtype = hermes_read_reg(hw, dreg); rtype = hermes_read_reg(hw, dreg);
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
* Copyright (C) 2000, David Gibson, Linuxcare Australia. * Copyright (C) 2000, David Gibson, Linuxcare Australia.
* (C) Copyright David Gibson, IBM Corp. 2001-2003. * (C) Copyright David Gibson, IBM Corp. 2001-2003.
* *
* Portions taken from hfa384x.h, Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. * Portions taken from hfa384x.h.
* Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
* *
* This file distributed under the GPL, version 2. * This file distributed under the GPL, version 2.
*/ */
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
*/ */
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <asm/io.h> #include <linux/io.h>
/* /*
* Limits and constants * Limits and constants
...@@ -384,11 +385,12 @@ typedef struct hermes { ...@@ -384,11 +385,12 @@ typedef struct hermes {
/* Register access convenience macros */ /* Register access convenience macros */
#define hermes_read_reg(hw, off) \ #define hermes_read_reg(hw, off) \
(ioread16((hw)->iobase + ( (off) << (hw)->reg_spacing ))) (ioread16((hw)->iobase + ((off) << (hw)->reg_spacing)))
#define hermes_write_reg(hw, off, val) \ #define hermes_write_reg(hw, off, val) \
(iowrite16((val), (hw)->iobase + ((off) << (hw)->reg_spacing))) (iowrite16((val), (hw)->iobase + ((off) << (hw)->reg_spacing)))
#define hermes_read_regn(hw, name) hermes_read_reg((hw), HERMES_##name) #define hermes_read_regn(hw, name) hermes_read_reg((hw), HERMES_##name)
#define hermes_write_regn(hw, name, val) hermes_write_reg((hw), HERMES_##name, (val)) #define hermes_write_regn(hw, name, val) \
hermes_write_reg((hw), HERMES_##name, (val))
/* 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);
...@@ -441,11 +443,12 @@ static inline int hermes_inquire(hermes_t *hw, u16 rid) ...@@ -441,11 +443,12 @@ static inline int hermes_inquire(hermes_t *hw, u16 rid)
return hermes_docmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL); return hermes_docmd_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)
#define HERMES_RECLEN_TO_BYTES(n) ( ((n)-1) * 2 ) #define HERMES_RECLEN_TO_BYTES(n) (((n)-1) * 2)
/* Note that for the next two, the count is in 16-bit words, not bytes */ /* 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, void *buf, unsigned count) static inline void hermes_read_words(struct hermes *hw, int off,
void *buf, unsigned count)
{ {
off = off << hw->reg_spacing; off = off << hw->reg_spacing;
ioread16_rep(hw->iobase + off, buf, count); ioread16_rep(hw->iobase + off, buf, count);
...@@ -460,7 +463,8 @@ static inline void hermes_write_bytes(struct hermes *hw, int off, ...@@ -460,7 +463,8 @@ static inline void hermes_write_bytes(struct hermes *hw, int off,
iowrite8(buf[count - 1], hw->iobase + off); iowrite8(buf[count - 1], hw->iobase + off);
} }
static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count) static inline void hermes_clear_words(struct hermes *hw, int off,
unsigned count)
{ {
unsigned i; unsigned i;
...@@ -471,9 +475,10 @@ static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count ...@@ -471,9 +475,10 @@ static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count
} }
#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))) (hermes_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),HERMES_BYTES_TO_RECLEN(sizeof(*buf)),(buf))) (hermes_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(hermes_t *hw, int bap, u16 rid, u16 *word)
{ {
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
#include "hermes.h" #include "hermes.h"
/* To enable debug messages */ /* To enable debug messages */
//#define ORINOCO_DEBUG 3 /*#define ORINOCO_DEBUG 3*/
#define WIRELESS_SPY // enable iwspy support #define WIRELESS_SPY /* enable iwspy support */
#define MAX_SCAN_LEN 4096 #define MAX_SCAN_LEN 4096
...@@ -168,7 +168,10 @@ struct orinoco_private { ...@@ -168,7 +168,10 @@ struct orinoco_private {
#ifdef ORINOCO_DEBUG #ifdef ORINOCO_DEBUG
extern int orinoco_debug; extern int orinoco_debug;
#define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0) #define DEBUG(n, args...) do { \
if (orinoco_debug > (n)) \
printk(KERN_DEBUG args); \
} while (0)
#else #else
#define DEBUG(n, args...) do { } while (0) #define DEBUG(n, args...) do { } while (0)
#endif /* ORINOCO_DEBUG */ #endif /* ORINOCO_DEBUG */
...@@ -185,7 +188,7 @@ extern void free_orinocodev(struct net_device *dev); ...@@ -185,7 +188,7 @@ extern void free_orinocodev(struct net_device *dev);
extern int __orinoco_up(struct net_device *dev); extern int __orinoco_up(struct net_device *dev);
extern int __orinoco_down(struct net_device *dev); extern int __orinoco_down(struct net_device *dev);
extern int orinoco_reinit_firmware(struct net_device *dev); extern int orinoco_reinit_firmware(struct net_device *dev);
extern irqreturn_t orinoco_interrupt(int irq, void * dev_id); extern irqreturn_t orinoco_interrupt(int irq, void *dev_id);
/********************************************************************/ /********************************************************************/
/* Locking and synchronization functions */ /* Locking and synchronization functions */
......
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
/********************************************************************/ /********************************************************************/
MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>"); MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>");
MODULE_DESCRIPTION("Driver for PCMCIA Lucent Orinoco, Prism II based and similar wireless cards"); MODULE_DESCRIPTION("Driver for PCMCIA Lucent Orinoco,"
" Prism II based and similar wireless cards");
MODULE_LICENSE("Dual MPL/GPL"); MODULE_LICENSE("Dual MPL/GPL");
/* Module parameters */ /* Module parameters */
...@@ -111,7 +112,7 @@ orinoco_cs_probe(struct pcmcia_device *link) ...@@ -111,7 +112,7 @@ orinoco_cs_probe(struct pcmcia_device *link)
dev = alloc_orinocodev(sizeof(*card), &handle_to_dev(link), dev = alloc_orinocodev(sizeof(*card), &handle_to_dev(link),
orinoco_cs_hard_reset, NULL); orinoco_cs_hard_reset, NULL);
if (! dev) if (!dev)
return -ENOMEM; return -ENOMEM;
priv = netdev_priv(dev); priv = netdev_priv(dev);
card = priv->card; card = priv->card;
...@@ -162,8 +163,10 @@ static void orinoco_cs_detach(struct pcmcia_device *link) ...@@ -162,8 +163,10 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
*/ */
#define CS_CHECK(fn, ret) do { \ #define CS_CHECK(fn, ret) do { \
last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \ last_fn = (fn); \
} while (0) if ((last_ret = (ret)) != 0) \
goto cs_failed; \
} while (0)
static int orinoco_cs_config_check(struct pcmcia_device *p_dev, static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *cfg,
...@@ -307,8 +310,8 @@ orinoco_cs_config(struct pcmcia_device *link) ...@@ -307,8 +310,8 @@ orinoco_cs_config(struct pcmcia_device *link)
* initialized and arranged in a linked list at link->dev_node. */ * initialized and arranged in a linked list at link->dev_node. */
strcpy(card->node.dev_name, dev->name); strcpy(card->node.dev_name, dev->name);
link->dev_node = &card->node; /* link->dev_node being non-NULL is also link->dev_node = &card->node; /* link->dev_node being non-NULL is also
used to indicate that the * used to indicate that the
net_device has been registered */ * net_device has been registered */
/* Finally, report what we've done */ /* Finally, report what we've done */
printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io " printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io "
...@@ -359,7 +362,7 @@ static int orinoco_cs_suspend(struct pcmcia_device *link) ...@@ -359,7 +362,7 @@ static int orinoco_cs_suspend(struct pcmcia_device *link)
/* This is probably racy, but I can't think of /* This is probably racy, but I can't think of
a better way, short of rewriting the PCMCIA a better way, short of rewriting the PCMCIA
layer to not suck :-( */ layer to not suck :-( */
if (! test_bit(0, &card->hard_reset_in_progress)) { if (!test_bit(0, &card->hard_reset_in_progress)) {
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
err = __orinoco_down(dev); err = __orinoco_down(dev);
...@@ -384,7 +387,7 @@ static int orinoco_cs_resume(struct pcmcia_device *link) ...@@ -384,7 +387,7 @@ static int orinoco_cs_resume(struct pcmcia_device *link)
int err = 0; int err = 0;
unsigned long flags; unsigned long flags;
if (! test_bit(0, &card->hard_reset_in_progress)) { if (!test_bit(0, &card->hard_reset_in_progress)) {
err = orinoco_reinit_firmware(dev); err = orinoco_reinit_firmware(dev);
if (err) { if (err) {
printk(KERN_ERR "%s: Error %d re-initializing firmware\n", printk(KERN_ERR "%s: Error %d re-initializing firmware\n",
...@@ -397,7 +400,7 @@ static int orinoco_cs_resume(struct pcmcia_device *link) ...@@ -397,7 +400,7 @@ static int orinoco_cs_resume(struct pcmcia_device *link)
netif_device_attach(dev); netif_device_attach(dev);
priv->hw_unavailable--; priv->hw_unavailable--;
if (priv->open && ! priv->hw_unavailable) { if (priv->open && !priv->hw_unavailable) {
err = __orinoco_up(dev); err = __orinoco_up(dev);
if (err) if (err)
printk(KERN_ERR "%s: Error %d restarting card\n", printk(KERN_ERR "%s: Error %d restarting card\n",
......
...@@ -103,10 +103,9 @@ static int orinoco_nortel_hw_init(struct orinoco_pci_card *card) ...@@ -103,10 +103,9 @@ static int orinoco_nortel_hw_init(struct orinoco_pci_card *card)
iowrite16(0x8, card->bridge_io + 2); iowrite16(0x8, card->bridge_io + 2);
for (i = 0; i < 30; i++) { for (i = 0; i < 30; i++) {
mdelay(30); mdelay(30);
if (ioread16(card->bridge_io) & 0x10) { if (ioread16(card->bridge_io) & 0x10)
break; break;
} }
}
if (i == 30) { if (i == 30) {
printk(KERN_ERR PFX "brg1 timed out\n"); printk(KERN_ERR PFX "brg1 timed out\n");
return -EBUSY; return -EBUSY;
......
...@@ -237,7 +237,8 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION ...@@ -237,7 +237,8 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
" (Pavel Roskin <proski@gnu.org>," " (Pavel Roskin <proski@gnu.org>,"
" David Gibson <hermes@gibson.dropbear.id.au> &" " David Gibson <hermes@gibson.dropbear.id.au> &"
" Jean Tourrilhes <jt@hpl.hp.com>)"; " Jean Tourrilhes <jt@hpl.hp.com>)";
MODULE_AUTHOR("Pavel Roskin <proski@gnu.org> & David Gibson <hermes@gibson.dropbear.id.au>"); MODULE_AUTHOR("Pavel Roskin <proski@gnu.org> &"
" David Gibson <hermes@gibson.dropbear.id.au>");
MODULE_DESCRIPTION("Driver for wireless LAN cards using direct PCI interface"); MODULE_DESCRIPTION("Driver for wireless LAN cards using direct PCI interface");
MODULE_LICENSE("Dual MPL/GPL"); MODULE_LICENSE("Dual MPL/GPL");
......
...@@ -90,7 +90,7 @@ static int orinoco_pci_resume(struct pci_dev *pdev) ...@@ -90,7 +90,7 @@ static int orinoco_pci_resume(struct pci_dev *pdev)
priv->hw_unavailable--; priv->hw_unavailable--;
if (priv->open && (! priv->hw_unavailable)) { if (priv->open && (!priv->hw_unavailable)) {
err = __orinoco_up(dev); err = __orinoco_up(dev);
if (err) if (err)
printk(KERN_ERR "%s: Error %d restarting card on resume\n", printk(KERN_ERR "%s: Error %d restarting card on resume\n",
......
...@@ -146,9 +146,8 @@ static int orinoco_plx_hw_init(struct orinoco_pci_card *card) ...@@ -146,9 +146,8 @@ static int orinoco_plx_hw_init(struct orinoco_pci_card *card)
}; };
printk(KERN_DEBUG PFX "CIS: "); printk(KERN_DEBUG PFX "CIS: ");
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++)
printk("%02X:", ioread8(card->attr_io + (i << 1))); printk("%02X:", ioread8(card->attr_io + (i << 1)));
}
printk("\n"); printk("\n");
/* Verify whether a supported PC card is present */ /* Verify whether a supported PC card is present */
......
...@@ -133,7 +133,7 @@ spectrum_reset(struct pcmcia_device *link, int idle) ...@@ -133,7 +133,7 @@ spectrum_reset(struct pcmcia_device *link, int idle)
udelay(1000); udelay(1000);
return 0; return 0;
cs_failed: cs_failed:
cs_error(link, last_fn, last_ret); cs_error(link, last_fn, last_ret);
return -ENODEV; return -ENODEV;
} }
...@@ -185,7 +185,7 @@ spectrum_cs_probe(struct pcmcia_device *link) ...@@ -185,7 +185,7 @@ spectrum_cs_probe(struct pcmcia_device *link)
dev = alloc_orinocodev(sizeof(*card), &handle_to_dev(link), dev = alloc_orinocodev(sizeof(*card), &handle_to_dev(link),
spectrum_cs_hard_reset, spectrum_cs_hard_reset,
spectrum_cs_stop_firmware); spectrum_cs_stop_firmware);
if (! dev) if (!dev)
return -ENOMEM; return -ENOMEM;
priv = netdev_priv(dev); priv = netdev_priv(dev);
card = priv->card; card = priv->card;
...@@ -367,9 +367,8 @@ spectrum_cs_config(struct pcmcia_device *link) ...@@ -367,9 +367,8 @@ spectrum_cs_config(struct pcmcia_device *link)
card->node.major = card->node.minor = 0; card->node.major = card->node.minor = 0;
/* Reset card */ /* Reset card */
if (spectrum_cs_hard_reset(priv) != 0) { if (spectrum_cs_hard_reset(priv) != 0)
goto failed; goto failed;
}
SET_NETDEV_DEV(dev, &handle_to_dev(link)); SET_NETDEV_DEV(dev, &handle_to_dev(link));
/* Tell the stack we exist */ /* Tell the stack we exist */
...@@ -382,8 +381,8 @@ spectrum_cs_config(struct pcmcia_device *link) ...@@ -382,8 +381,8 @@ spectrum_cs_config(struct pcmcia_device *link)
* initialized and arranged in a linked list at link->dev_node. */ * initialized and arranged in a linked list at link->dev_node. */
strcpy(card->node.dev_name, dev->name); strcpy(card->node.dev_name, dev->name);
link->dev_node = &card->node; /* link->dev_node being non-NULL is also link->dev_node = &card->node; /* link->dev_node being non-NULL is also
used to indicate that the * used to indicate that the
net_device has been registered */ * net_device has been registered */
/* Finally, report what we've done */ /* Finally, report what we've done */
printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io " printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io "
......
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