Commit bf79451e authored by Jeff Garzik's avatar Jeff Garzik

[wireless ipw2200] trim trailing whitespace

parent 2ff55fef
/****************************************************************************** /******************************************************************************
Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved.
802.11 status code portion of this file from ethereal-0.10.6: 802.11 status code portion of this file from ethereal-0.10.6:
...@@ -8,22 +8,22 @@ ...@@ -8,22 +8,22 @@
By Gerald Combs <gerald@ethereal.com> By Gerald Combs <gerald@ethereal.com>
Copyright 1998 Gerald Combs Copyright 1998 Gerald Combs
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of version 2 of the GNU General Public License as under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation. published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details. more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA. Temple Place - Suite 330, Boston, MA 02111-1307, USA.
The full GNU General Public License is included in this distribution in the The full GNU General Public License is included in this distribution in the
file called LICENSE. file called LICENSE.
Contact Information: Contact Information:
James P. Ketrenos <ipw2100-admin@linux.intel.com> James P. Ketrenos <ipw2100-admin@linux.intel.com>
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
...@@ -56,7 +56,7 @@ static const char ipw_modes[] = { ...@@ -56,7 +56,7 @@ static const char ipw_modes[] = {
}; };
static void ipw_rx(struct ipw_priv *priv); static void ipw_rx(struct ipw_priv *priv);
static int ipw_queue_tx_reclaim(struct ipw_priv *priv, static int ipw_queue_tx_reclaim(struct ipw_priv *priv,
struct clx2_tx_queue *txq, int qindex); struct clx2_tx_queue *txq, int qindex);
static int ipw_queue_reset(struct ipw_priv *priv); static int ipw_queue_reset(struct ipw_priv *priv);
...@@ -101,23 +101,23 @@ static int is_valid_channel(int mode_mask, int channel) ...@@ -101,23 +101,23 @@ static int is_valid_channel(int mode_mask, int channel)
return 0; return 0;
} }
static char *snprint_line(char *buf, size_t count, static char *snprint_line(char *buf, size_t count,
const u8 *data, u32 len, u32 ofs) const u8 *data, u32 len, u32 ofs)
{ {
int out, i, j, l; int out, i, j, l;
char c; char c;
out = snprintf(buf, count, "%08X", ofs); out = snprintf(buf, count, "%08X", ofs);
for (l = 0, i = 0; i < 2; i++) { for (l = 0, i = 0; i < 2; i++) {
out += snprintf(buf + out, count - out, " "); out += snprintf(buf + out, count - out, " ");
for (j = 0; j < 8 && l < len; j++, l++) for (j = 0; j < 8 && l < len; j++, l++)
out += snprintf(buf + out, count - out, "%02X ", out += snprintf(buf + out, count - out, "%02X ",
data[(i * 8 + j)]); data[(i * 8 + j)]);
for (; j < 8; j++) for (; j < 8; j++)
out += snprintf(buf + out, count - out, " "); out += snprintf(buf + out, count - out, " ");
} }
out += snprintf(buf + out, count - out, " "); out += snprintf(buf + out, count - out, " ");
for (l = 0, i = 0; i < 2; i++) { for (l = 0, i = 0; i < 2; i++) {
out += snprintf(buf + out, count - out, " "); out += snprintf(buf + out, count - out, " ");
...@@ -125,14 +125,14 @@ static char *snprint_line(char *buf, size_t count, ...@@ -125,14 +125,14 @@ static char *snprint_line(char *buf, size_t count,
c = data[(i * 8 + j)]; c = data[(i * 8 + j)];
if (!isascii(c) || !isprint(c)) if (!isascii(c) || !isprint(c))
c = '.'; c = '.';
out += snprintf(buf + out, count - out, "%c", c); out += snprintf(buf + out, count - out, "%c", c);
} }
for (; j < 8; j++) for (; j < 8; j++)
out += snprintf(buf + out, count - out, " "); out += snprintf(buf + out, count - out, " ");
} }
return buf; return buf;
} }
...@@ -145,7 +145,7 @@ static void printk_buf(int level, const u8 *data, u32 len) ...@@ -145,7 +145,7 @@ static void printk_buf(int level, const u8 *data, u32 len)
while (len) { while (len) {
printk(KERN_DEBUG "%s\n", printk(KERN_DEBUG "%s\n",
snprint_line(line, sizeof(line), &data[ofs], snprint_line(line, sizeof(line), &data[ofs],
min(len, 16U), ofs)); min(len, 16U), ofs));
ofs += 16; ofs += 16;
len -= min(len, 16U); len -= min(len, 16U);
...@@ -161,21 +161,21 @@ static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg); ...@@ -161,21 +161,21 @@ static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg);
static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value); static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value);
static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c)
{ {
IPW_DEBUG_IO("%s %d: write_indirect8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c)); IPW_DEBUG_IO("%s %d: write_indirect8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c));
_ipw_write_reg8(a, b, c); _ipw_write_reg8(a, b, c);
} }
static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value); static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value);
static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c)
{ {
IPW_DEBUG_IO("%s %d: write_indirect16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c)); IPW_DEBUG_IO("%s %d: write_indirect16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c));
_ipw_write_reg16(a, b, c); _ipw_write_reg16(a, b, c);
} }
static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value); static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value);
static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c)
{ {
IPW_DEBUG_IO("%s %d: write_indirect32(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c)); IPW_DEBUG_IO("%s %d: write_indirect32(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(b), (u32)(c));
_ipw_write_reg32(a, b, c); _ipw_write_reg32(a, b, c);
} }
...@@ -229,7 +229,7 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *data, int n ...@@ -229,7 +229,7 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *data, int n
static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg,
u32 value) u32 value)
{ {
IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n",
priv, reg, value); priv, reg, value);
_ipw_write32(priv, CX2_INDIRECT_ADDR, reg); _ipw_write32(priv, CX2_INDIRECT_ADDR, reg);
_ipw_write32(priv, CX2_INDIRECT_DATA, value); _ipw_write32(priv, CX2_INDIRECT_DATA, value);
...@@ -241,7 +241,7 @@ static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) ...@@ -241,7 +241,7 @@ static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value)
IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value);
_ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); _ipw_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK);
_ipw_write8(priv, CX2_INDIRECT_DATA, value); _ipw_write8(priv, CX2_INDIRECT_DATA, value);
IPW_DEBUG_IO(" reg = 0x%8lX : value = 0x%8X\n", IPW_DEBUG_IO(" reg = 0x%8lX : value = 0x%8X\n",
(unsigned long)(priv->hw_base + CX2_INDIRECT_DATA), (unsigned long)(priv->hw_base + CX2_INDIRECT_DATA),
value); value);
} }
...@@ -285,7 +285,7 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, ...@@ -285,7 +285,7 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
u32 dif_len = addr - aligned_addr; u32 dif_len = addr - aligned_addr;
u32 aligned_len; u32 aligned_len;
u32 i; u32 i;
IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num);
/* Read the first nibble byte by byte */ /* Read the first nibble byte by byte */
...@@ -303,7 +303,7 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, ...@@ -303,7 +303,7 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
aligned_len = num & CX2_INDIRECT_ADDR_MASK; aligned_len = num & CX2_INDIRECT_ADDR_MASK;
for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4)
*(u32*)buf = ipw_read32(priv, CX2_AUTOINC_DATA); *(u32*)buf = ipw_read32(priv, CX2_AUTOINC_DATA);
/* Copy the last nibble */ /* Copy the last nibble */
dif_len = num - aligned_len; dif_len = num - aligned_len;
_ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr);
...@@ -311,16 +311,16 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, ...@@ -311,16 +311,16 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
*buf = ipw_read8(priv, CX2_INDIRECT_DATA + i); *buf = ipw_read8(priv, CX2_INDIRECT_DATA + i);
} }
static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *buf, static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *buf,
int num) int num)
{ {
u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK; u32 aligned_addr = addr & CX2_INDIRECT_ADDR_MASK;
u32 dif_len = addr - aligned_addr; u32 dif_len = addr - aligned_addr;
u32 aligned_len; u32 aligned_len;
u32 i; u32 i;
IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num);
/* Write the first nibble byte by byte */ /* Write the first nibble byte by byte */
if (unlikely(dif_len)) { if (unlikely(dif_len)) {
/* Start writing at aligned_addr + dif_len */ /* Start writing at aligned_addr + dif_len */
...@@ -330,13 +330,13 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *buf, ...@@ -330,13 +330,13 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *buf,
num -= dif_len; num -= dif_len;
aligned_addr += 4; aligned_addr += 4;
} }
/* Write DWs through autoinc register */ /* Write DWs through autoinc register */
_ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr); _ipw_write32(priv, CX2_AUTOINC_ADDR, aligned_addr);
aligned_len = num & CX2_INDIRECT_ADDR_MASK; aligned_len = num & CX2_INDIRECT_ADDR_MASK;
for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4)
_ipw_write32(priv, CX2_AUTOINC_DATA, *(u32*)buf); _ipw_write32(priv, CX2_AUTOINC_DATA, *(u32*)buf);
/* Copy the last nibble */ /* Copy the last nibble */
dif_len = num - aligned_len; dif_len = num - aligned_len;
_ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr); _ipw_write32(priv, CX2_INDIRECT_ADDR, aligned_addr);
...@@ -344,7 +344,7 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *buf, ...@@ -344,7 +344,7 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 *buf,
_ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf); _ipw_write8(priv, CX2_INDIRECT_DATA + i, *buf);
} }
static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf,
int num) int num)
{ {
memcpy_toio((priv->hw_base + addr), buf, num); memcpy_toio((priv->hw_base + addr), buf, num);
...@@ -379,37 +379,37 @@ static inline void ipw_disable_interrupts(struct ipw_priv *priv) ...@@ -379,37 +379,37 @@ static inline void ipw_disable_interrupts(struct ipw_priv *priv)
static char *ipw_error_desc(u32 val) static char *ipw_error_desc(u32 val)
{ {
switch (val) { switch (val) {
case IPW_FW_ERROR_OK: case IPW_FW_ERROR_OK:
return "ERROR_OK"; return "ERROR_OK";
case IPW_FW_ERROR_FAIL: case IPW_FW_ERROR_FAIL:
return "ERROR_FAIL"; return "ERROR_FAIL";
case IPW_FW_ERROR_MEMORY_UNDERFLOW: case IPW_FW_ERROR_MEMORY_UNDERFLOW:
return "MEMORY_UNDERFLOW"; return "MEMORY_UNDERFLOW";
case IPW_FW_ERROR_MEMORY_OVERFLOW: case IPW_FW_ERROR_MEMORY_OVERFLOW:
return "MEMORY_OVERFLOW"; return "MEMORY_OVERFLOW";
case IPW_FW_ERROR_BAD_PARAM: case IPW_FW_ERROR_BAD_PARAM:
return "ERROR_BAD_PARAM"; return "ERROR_BAD_PARAM";
case IPW_FW_ERROR_BAD_CHECKSUM: case IPW_FW_ERROR_BAD_CHECKSUM:
return "ERROR_BAD_CHECKSUM"; return "ERROR_BAD_CHECKSUM";
case IPW_FW_ERROR_NMI_INTERRUPT: case IPW_FW_ERROR_NMI_INTERRUPT:
return "ERROR_NMI_INTERRUPT"; return "ERROR_NMI_INTERRUPT";
case IPW_FW_ERROR_BAD_DATABASE: case IPW_FW_ERROR_BAD_DATABASE:
return "ERROR_BAD_DATABASE"; return "ERROR_BAD_DATABASE";
case IPW_FW_ERROR_ALLOC_FAIL: case IPW_FW_ERROR_ALLOC_FAIL:
return "ERROR_ALLOC_FAIL"; return "ERROR_ALLOC_FAIL";
case IPW_FW_ERROR_DMA_UNDERRUN: case IPW_FW_ERROR_DMA_UNDERRUN:
return "ERROR_DMA_UNDERRUN"; return "ERROR_DMA_UNDERRUN";
case IPW_FW_ERROR_DMA_STATUS: case IPW_FW_ERROR_DMA_STATUS:
return "ERROR_DMA_STATUS"; return "ERROR_DMA_STATUS";
case IPW_FW_ERROR_DINOSTATUS_ERROR: case IPW_FW_ERROR_DINOSTATUS_ERROR:
return "ERROR_DINOSTATUS_ERROR"; return "ERROR_DINOSTATUS_ERROR";
case IPW_FW_ERROR_EEPROMSTATUS_ERROR: case IPW_FW_ERROR_EEPROMSTATUS_ERROR:
return "ERROR_EEPROMSTATUS_ERROR"; return "ERROR_EEPROMSTATUS_ERROR";
case IPW_FW_ERROR_SYSASSERT: case IPW_FW_ERROR_SYSASSERT:
return "ERROR_SYSASSERT"; return "ERROR_SYSASSERT";
case IPW_FW_ERROR_FATAL_ERROR: case IPW_FW_ERROR_FATAL_ERROR:
return "ERROR_FATALSTATUS_ERROR"; return "ERROR_FATALSTATUS_ERROR";
default: default:
return "UNKNOWNSTATUS_ERROR"; return "UNKNOWNSTATUS_ERROR";
} }
} }
...@@ -420,15 +420,15 @@ static void ipw_dump_nic_error_log(struct ipw_priv *priv) ...@@ -420,15 +420,15 @@ static void ipw_dump_nic_error_log(struct ipw_priv *priv)
base = ipw_read32(priv, IPWSTATUS_ERROR_LOG); base = ipw_read32(priv, IPWSTATUS_ERROR_LOG);
count = ipw_read_reg32(priv, base); count = ipw_read_reg32(priv, base);
if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
IPW_ERROR("Start IPW Error Log Dump:\n"); IPW_ERROR("Start IPW Error Log Dump:\n");
IPW_ERROR("Status: 0x%08X, Config: %08X\n", IPW_ERROR("Status: 0x%08X, Config: %08X\n",
priv->status, priv->config); priv->status, priv->config);
} }
for (i = ERROR_START_OFFSET; for (i = ERROR_START_OFFSET;
i <= count * ERROR_ELEM_SIZE; i <= count * ERROR_ELEM_SIZE;
i += ERROR_ELEM_SIZE) { i += ERROR_ELEM_SIZE) {
desc = ipw_read_reg32(priv, base + i); desc = ipw_read_reg32(priv, base + i);
time = ipw_read_reg32(priv, base + i + 1*sizeof(u32)); time = ipw_read_reg32(priv, base + i + 1*sizeof(u32));
...@@ -439,8 +439,8 @@ static void ipw_dump_nic_error_log(struct ipw_priv *priv) ...@@ -439,8 +439,8 @@ static void ipw_dump_nic_error_log(struct ipw_priv *priv)
idata = ipw_read_reg32(priv, base + i + 6*sizeof(u32)); idata = ipw_read_reg32(priv, base + i + 6*sizeof(u32));
IPW_ERROR( IPW_ERROR(
"%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", "%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n",
ipw_error_desc(desc), time, blink1, blink2, ipw_error_desc(desc), time, blink1, blink2,
ilink1, ilink2, idata); ilink1, ilink2, idata);
} }
} }
...@@ -451,12 +451,12 @@ static void ipw_dump_nic_event_log(struct ipw_priv *priv) ...@@ -451,12 +451,12 @@ static void ipw_dump_nic_event_log(struct ipw_priv *priv)
base = ipw_read32(priv, IPW_EVENT_LOG); base = ipw_read32(priv, IPW_EVENT_LOG);
count = ipw_read_reg32(priv, base); count = ipw_read_reg32(priv, base);
if (EVENT_START_OFFSET <= count * EVENT_ELEM_SIZE) if (EVENT_START_OFFSET <= count * EVENT_ELEM_SIZE)
IPW_ERROR("Start IPW Event Log Dump:\n"); IPW_ERROR("Start IPW Event Log Dump:\n");
for (i = EVENT_START_OFFSET; for (i = EVENT_START_OFFSET;
i <= count * EVENT_ELEM_SIZE; i <= count * EVENT_ELEM_SIZE;
i += EVENT_ELEM_SIZE) { i += EVENT_ELEM_SIZE) {
ev = ipw_read_reg32(priv, base + i); ev = ipw_read_reg32(priv, base + i);
time = ipw_read_reg32(priv, base + i + 1*sizeof(u32)); time = ipw_read_reg32(priv, base + i + 1*sizeof(u32));
...@@ -479,7 +479,7 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, ...@@ -479,7 +479,7 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val,
IPW_DEBUG_ORD("Invalid argument\n"); IPW_DEBUG_ORD("Invalid argument\n");
return -EINVAL; return -EINVAL;
} }
/* verify device ordinal tables have been initialized */ /* verify device ordinal tables have been initialized */
if (!priv->table0_addr || !priv->table1_addr || !priv->table2_addr) { if (!priv->table0_addr || !priv->table1_addr || !priv->table2_addr) {
IPW_DEBUG_ORD("Access ordinals before initialization\n"); IPW_DEBUG_ORD("Access ordinals before initialization\n");
...@@ -491,7 +491,7 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, ...@@ -491,7 +491,7 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val,
/* /*
* TABLE 0: Direct access to a table of 32 bit values * TABLE 0: Direct access to a table of 32 bit values
* *
* This is a very simple table with the data directly * This is a very simple table with the data directly
* read from the table * read from the table
*/ */
...@@ -523,15 +523,15 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, ...@@ -523,15 +523,15 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val,
case IPW_ORD_TABLE_1_MASK: case IPW_ORD_TABLE_1_MASK:
/* /*
* TABLE 1: Indirect access to a table of 32 bit values * TABLE 1: Indirect access to a table of 32 bit values
* *
* This is a fairly large table of u32 values each * This is a fairly large table of u32 values each
* representing starting addr for the data (which is * representing starting addr for the data (which is
* also a u32) * also a u32)
*/ */
/* remove the table id from the ordinal */ /* remove the table id from the ordinal */
ord &= IPW_ORD_TABLE_VALUE_MASK; ord &= IPW_ORD_TABLE_VALUE_MASK;
/* boundary check */ /* boundary check */
if (ord > priv->table1_len) { if (ord > priv->table1_len) {
IPW_DEBUG_ORD("ordinal value too long\n"); IPW_DEBUG_ORD("ordinal value too long\n");
...@@ -570,30 +570,30 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, ...@@ -570,30 +570,30 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val,
/* get the address of statistic */ /* get the address of statistic */
addr = ipw_read_reg32(priv, priv->table2_addr + (ord << 3)); addr = ipw_read_reg32(priv, priv->table2_addr + (ord << 3));
/* get the second DW of statistics ; /* get the second DW of statistics ;
* two 16-bit words - first is length, second is count */ * two 16-bit words - first is length, second is count */
field_info = ipw_read_reg32(priv, priv->table2_addr + (ord << 3) + sizeof(u32)); field_info = ipw_read_reg32(priv, priv->table2_addr + (ord << 3) + sizeof(u32));
/* get each entry length */ /* get each entry length */
field_len = *((u16 *)&field_info); field_len = *((u16 *)&field_info);
/* get number of entries */ /* get number of entries */
field_count = *(((u16 *)&field_info) + 1); field_count = *(((u16 *)&field_info) + 1);
/* abort if not enought memory */ /* abort if not enought memory */
total_len = field_len * field_count; total_len = field_len * field_count;
if (total_len > *len) { if (total_len > *len) {
*len = total_len; *len = total_len;
return -EINVAL; return -EINVAL;
} }
*len = total_len; *len = total_len;
if (!total_len) if (!total_len)
return 0; return 0;
IPW_DEBUG_ORD("addr = 0x%08x, total_len = %i, " IPW_DEBUG_ORD("addr = 0x%08x, total_len = %i, "
"field_info = 0x%08x\n", "field_info = 0x%08x\n",
addr, total_len, field_info); addr, total_len, field_info);
ipw_read_indirect(priv, addr, val, total_len); ipw_read_indirect(priv, addr, val, total_len);
break; break;
...@@ -604,14 +604,14 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, ...@@ -604,14 +604,14 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val,
} }
return 0; return 0;
} }
static void ipw_init_ordinals(struct ipw_priv *priv) static void ipw_init_ordinals(struct ipw_priv *priv)
{ {
priv->table0_addr = IPW_ORDINALS_TABLE_LOWER; priv->table0_addr = IPW_ORDINALS_TABLE_LOWER;
priv->table0_len = ipw_read32(priv, priv->table0_addr); priv->table0_len = ipw_read32(priv, priv->table0_addr);
IPW_DEBUG_ORD("table 0 offset at 0x%08x, len = %i\n", IPW_DEBUG_ORD("table 0 offset at 0x%08x, len = %i\n",
priv->table0_addr, priv->table0_len); priv->table0_addr, priv->table0_len);
...@@ -635,7 +635,7 @@ static void ipw_init_ordinals(struct ipw_priv *priv) ...@@ -635,7 +635,7 @@ static void ipw_init_ordinals(struct ipw_priv *priv)
* The following adds a new attribute to the sysfs representation * The following adds a new attribute to the sysfs representation
* of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/) * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/)
* used for controling the debug level. * used for controling the debug level.
* *
* See the level definitions in ipw for details. * See the level definitions in ipw for details.
*/ */
static ssize_t show_debug_level(struct device_driver *d, char *buf) static ssize_t show_debug_level(struct device_driver *d, char *buf)
...@@ -655,8 +655,8 @@ static ssize_t store_debug_level(struct device_driver *d, ...@@ -655,8 +655,8 @@ static ssize_t store_debug_level(struct device_driver *d,
val = simple_strtoul(p, &p, 16); val = simple_strtoul(p, &p, 16);
} else } else
val = simple_strtoul(p, &p, 10); val = simple_strtoul(p, &p, 10);
if (p == buf) if (p == buf)
printk(KERN_INFO DRV_NAME printk(KERN_INFO DRV_NAME
": %s is not in hex or decimal form.\n", buf); ": %s is not in hex or decimal form.\n", buf);
else else
ipw_debug_level = val; ipw_debug_level = val;
...@@ -664,7 +664,7 @@ static ssize_t store_debug_level(struct device_driver *d, ...@@ -664,7 +664,7 @@ static ssize_t store_debug_level(struct device_driver *d,
return strnlen(buf, count); return strnlen(buf, count);
} }
static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
show_debug_level, store_debug_level); show_debug_level, store_debug_level);
static ssize_t show_status(struct device *d, static ssize_t show_status(struct device *d,
...@@ -701,7 +701,7 @@ static ssize_t show_nic_type(struct device *d, ...@@ -701,7 +701,7 @@ static ssize_t show_nic_type(struct device *d,
case EEPROM_NIC_TYPE_HP: case EEPROM_NIC_TYPE_HP:
return sprintf(buf, "HP\n"); return sprintf(buf, "HP\n");
} }
return sprintf(buf, "UNKNOWN\n"); return sprintf(buf, "UNKNOWN\n");
} }
static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL);
...@@ -711,7 +711,7 @@ static ssize_t dump_error_log(struct device *d, ...@@ -711,7 +711,7 @@ static ssize_t dump_error_log(struct device *d,
{ {
char *p = (char *)buf; char *p = (char *)buf;
if (p[0] == '1') if (p[0] == '1')
ipw_dump_nic_error_log((struct ipw_priv*)d->driver_data); ipw_dump_nic_error_log((struct ipw_priv*)d->driver_data);
return strnlen(buf, count); return strnlen(buf, count);
...@@ -723,7 +723,7 @@ static ssize_t dump_event_log(struct device *d, ...@@ -723,7 +723,7 @@ static ssize_t dump_event_log(struct device *d,