diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-06-28 05:45:25 +0200 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-28 05:45:25 +0200 |
commit | 30b4d6565e4d57c6d03600c7822411c7cac19638 (patch) | |
tree | 57244f2a9694de61b373631841fc493bbdf43022 /drivers | |
parent | Merge /spare/repo/netdev-2.6 branch 'ieee80211' (diff) | |
parent | [PATCH] wireless-device-attr-fixes-2 (diff) | |
download | linux-30b4d6565e4d57c6d03600c7822411c7cac19638.tar.xz linux-30b4d6565e4d57c6d03600c7822411c7cac19638.zip |
Merge /spare/repo/netdev-2.6 branch 'ieee80211'
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/Kconfig | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ipw2100.c | 126 | ||||
-rw-r--r-- | drivers/net/wireless/ipw2100.h | 91 | ||||
-rw-r--r-- | drivers/net/wireless/ipw2200.c | 169 |
4 files changed, 155 insertions, 234 deletions
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index a4a7e8a41775..ff5b1b1de2fa 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig @@ -192,9 +192,8 @@ config IPW_DEBUG config IPW2200 tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection" - depends on NET_RADIO && PCI + depends on IEEE80211 && PCI select FW_LOADER - select IEEE80211 ---help--- A driver for the Intel PRO/Wireless 2200BG and 2915ABG Network Connection adapters. diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index d296d464946f..189ad7b2cec9 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -146,6 +146,7 @@ that only one external action is invoked at a time. #include <linux/netdevice.h> #include <linux/ethtool.h> #include <linux/pci.h> +#include <linux/dma-mapping.h> #include <linux/proc_fs.h> #include <linux/skbuff.h> #include <asm/uaccess.h> @@ -493,7 +494,7 @@ int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, *len = IPW_ORD_TAB_1_ENTRY_SIZE; IPW_DEBUG_WARNING(DRV_NAME - ": ordinal buffer length too small, need %d\n", + ": ordinal buffer length too small, need %zd\n", IPW_ORD_TAB_1_ENTRY_SIZE); return -EINVAL; @@ -915,18 +916,16 @@ static int sw_reset_and_clock(struct ipw2100_priv *priv) if (i == 10000) return -EIO; /* TODO: better error value */ -//#if CONFIG_IPW2100_D0ENABLED /* set D0 standby bit */ read_register(priv->net_dev, IPW_REG_GP_CNTRL, &r); write_register(priv->net_dev, IPW_REG_GP_CNTRL, r | IPW_AUX_HOST_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); -//#endif return 0; } /********************************************************************* - Procedure : ipw2100_ipw2100_download_firmware + Procedure : ipw2100_download_firmware Purpose : Initiaze adapter after power on. The sequence is: 1. assert s/w reset first! @@ -1117,7 +1116,6 @@ static inline int rf_kill_active(struct ipw2100_priv *priv) { #define MAX_RF_KILL_CHECKS 5 #define RF_KILL_CHECK_DELAY 40 -#define RF_KILL_CHECK_THRESHOLD 3 unsigned short value = 0; u32 reg = 0; @@ -1194,7 +1192,6 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv) */ static int ipw2100_start_adapter(struct ipw2100_priv *priv) { -#define IPW_WAIT_FW_INIT_COMPLETE_DELAY (40 * HZ / 1000) int i; u32 inta, inta_mask, gpio; @@ -1231,7 +1228,7 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv) i = 5000; do { set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(IPW_WAIT_FW_INIT_COMPLETE_DELAY); + schedule_timeout(40 * HZ / 1000); /* Todo... wait for sync command ... */ read_register(priv->net_dev, IPW_REG_INTA, &inta); @@ -1696,7 +1693,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred) } else priv->status |= STATUS_POWERED; - /* Load the firmeware, start the clocks, etc. */ + /* Load the firmware, start the clocks, etc. */ if (ipw2100_start_adapter(priv)) { IPW_DEBUG_ERROR("%s: Failed to start the firmware.\n", priv->net_dev->name); @@ -2302,7 +2299,7 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv, #endif IPW_DEBUG_INFO(DRV_NAME ": PCI latency error detected at " - "0x%04X.\n", i * sizeof(struct ipw2100_status)); + "0x%04zX.\n", i * sizeof(struct ipw2100_status)); #ifdef ACPI_CSTATE_LIMIT_DEFINED IPW_DEBUG_INFO(DRV_NAME ": Disabling C3 transitions.\n"); @@ -2398,7 +2395,7 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i, /* Make a copy of the frame so we can dump it to the logs if * ieee80211_rx fails */ memcpy(packet_data, packet->skb->data, - min(status->frame_size, IPW_RX_NIC_BUFFER_LENGTH)); + min_t(u32, status->frame_size, IPW_RX_NIC_BUFFER_LENGTH)); #endif if (!ieee80211_rx(priv->ieee, packet->skb, stats)) { @@ -2730,21 +2727,21 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv) { int i = txq->oldest; IPW_DEBUG_TX( - "TX%d V=%p P=%p T=%p L=%d\n", i, + "TX%d V=%p P=%04X T=%04X L=%d\n", i, &txq->drv[i], - (void*)txq->nic + i * sizeof(struct ipw2100_bd), - (void*)txq->drv[i].host_addr, + (u32)(txq->nic + i * sizeof(struct ipw2100_bd)), + txq->drv[i].host_addr, txq->drv[i].buf_length); if (packet->type == DATA) { i = (i + 1) % txq->entries; IPW_DEBUG_TX( - "TX%d V=%p P=%p T=%p L=%d\n", i, + "TX%d V=%p P=%04X T=%04X L=%d\n", i, &txq->drv[i], - (void*)txq->nic + i * - sizeof(struct ipw2100_bd), - (void*)txq->drv[i].host_addr, + (u32)(txq->nic + i * + sizeof(struct ipw2100_bd)), + (u32)txq->drv[i].host_addr, txq->drv[i].buf_length); } } @@ -3383,7 +3380,8 @@ static void ipw2100_msg_free(struct ipw2100_priv *priv) priv->msg_buffers = NULL; } -static ssize_t show_pci(struct device *d, char *buf) +static ssize_t show_pci(struct device *d, struct device_attribute *attr, + char *buf) { struct pci_dev *pci_dev = container_of(d, struct pci_dev, dev); char *out = buf; @@ -3403,23 +3401,26 @@ static ssize_t show_pci(struct device *d, char *buf) } static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL); -static ssize_t show_cfg(struct device *d, char *buf) +static ssize_t show_cfg(struct device *d, struct device_attribute *attr, + char *buf) { - struct ipw2100_priv *p = (struct ipw2100_priv *)d->driver_data; + struct ipw2100_priv *p = d->driver_data; return sprintf(buf, "0x%08x\n", (int)p->config); } static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); -static ssize_t show_status(struct device *d, char *buf) +static ssize_t show_status(struct device *d, struct device_attribute *attr, + char *buf) { - struct ipw2100_priv *p = (struct ipw2100_priv *)d->driver_data; + struct ipw2100_priv *p = d->driver_data; return sprintf(buf, "0x%08x\n", (int)p->status); } static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); -static ssize_t show_capability(struct device *d, char *buf) +static ssize_t show_capability(struct device *d, struct device_attribute *attr, + char *buf) { - struct ipw2100_priv *p = (struct ipw2100_priv *)d->driver_data; + struct ipw2100_priv *p = d->driver_data; return sprintf(buf, "0x%08x\n", (int)p->capability); } static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL); @@ -3602,7 +3603,8 @@ const struct { }; -static ssize_t show_registers(struct device *d, char *buf) +static ssize_t show_registers(struct device *d, struct device_attribute *attr, + char *buf) { int i; struct ipw2100_priv *priv = dev_get_drvdata(d); @@ -3623,7 +3625,8 @@ static ssize_t show_registers(struct device *d, char *buf) static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL); -static ssize_t show_hardware(struct device *d, char *buf) +static ssize_t show_hardware(struct device *d, struct device_attribute *attr, + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); struct net_device *dev = priv->net_dev; @@ -3663,7 +3666,8 @@ static ssize_t show_hardware(struct device *d, char *buf) static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL); -static ssize_t show_memory(struct device *d, char *buf) +static ssize_t show_memory(struct device *d, struct device_attribute *attr, + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); struct net_device *dev = priv->net_dev; @@ -3716,7 +3720,8 @@ static ssize_t show_memory(struct device *d, char *buf) return len; } -static ssize_t store_memory(struct device *d, const char *buf, size_t count) +static ssize_t store_memory(struct device *d, struct device_attribute *attr, + const char *buf, size_t count) { struct ipw2100_priv *priv = dev_get_drvdata(d); struct net_device *dev = priv->net_dev; @@ -3752,7 +3757,8 @@ static ssize_t store_memory(struct device *d, const char *buf, size_t count) static DEVICE_ATTR(memory, S_IWUSR|S_IRUGO, show_memory, store_memory); -static ssize_t show_ordinals(struct device *d, char *buf) +static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); u32 val = 0; @@ -3786,7 +3792,8 @@ static ssize_t show_ordinals(struct device *d, char *buf) static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL); -static ssize_t show_stats(struct device *d, char *buf) +static ssize_t show_stats(struct device *d, struct device_attribute *attr, + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); char * out = buf; @@ -3851,7 +3858,8 @@ int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) return 0; } -static ssize_t show_internals(struct device *d, char *buf) +static ssize_t show_internals(struct device *d, struct device_attribute *attr, + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); int len = 0; @@ -3902,7 +3910,8 @@ static ssize_t show_internals(struct device *d, char *buf) static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL); -static ssize_t show_bssinfo(struct device *d, char *buf) +static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); char essid[IW_ESSID_MAX_SIZE + 1]; @@ -3945,8 +3954,6 @@ static ssize_t show_bssinfo(struct device *d, char *buf) static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL); - - #ifdef CONFIG_IPW_DEBUG static ssize_t show_debug_level(struct device_driver *d, char *buf) { @@ -3979,7 +3986,8 @@ static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, #endif /* CONFIG_IPW_DEBUG */ -static ssize_t show_fatal_error(struct device *d, char *buf) +static ssize_t show_fatal_error(struct device *d, + struct device_attribute *attr, char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); char *out = buf; @@ -4004,8 +4012,8 @@ static ssize_t show_fatal_error(struct device *d, char *buf) return out - buf; } -static ssize_t store_fatal_error(struct device *d, const char *buf, - size_t count) +static ssize_t store_fatal_error(struct device *d, + struct device_attribute *attr, const char *buf, size_t count) { struct ipw2100_priv *priv = dev_get_drvdata(d); schedule_reset(priv); @@ -4014,13 +4022,15 @@ static ssize_t store_fatal_error(struct device *d, const char *buf, static DEVICE_ATTR(fatal_error, S_IWUSR|S_IRUGO, show_fatal_error, store_fatal_error); -static ssize_t show_scan_age(struct device *d, char *buf) +static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, + char *buf) { struct ipw2100_priv *priv = dev_get_drvdata(d); return sprintf(buf, "%d\n", priv->ieee->scan_age); } -static ssize_t store_scan_age(struct device *d, const char *buf, size_t count) +static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, + const char *buf, size_t count) { struct ipw2100_priv *priv = dev_get_drvdata(d); struct net_device *dev = priv->net_dev; @@ -4056,7 +4066,8 @@ static ssize_t store_scan_age(struct device *d, const char *buf, size_t count) static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); -static ssize_t show_rf_kill(struct device *d, char *buf) +static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, + char *buf) { /* 0 - RF kill not enabled 1 - SW based RF kill active (sysfs) @@ -4100,7 +4111,8 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) return 1; } -static ssize_t store_rf_kill(struct device *d, const char *buf, size_t count) +static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, + const char *buf, size_t count) { struct ipw2100_priv *priv = dev_get_drvdata(d); ipw_radio_kill_sw(priv, buf[0] == '1'); @@ -4212,7 +4224,7 @@ static void bd_queue_initialize( { IPW_DEBUG_INFO("enter\n"); - IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, q->nic); + IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, (u32)q->nic); write_register(priv->net_dev, base, q->nic); write_register(priv->net_dev, size, q->entries); @@ -5308,7 +5320,7 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv, .host_command = WEP_KEY_INDEX, .host_command_sequence = 0, .host_command_length = 4, - .host_command_parameters[0] = idx, + .host_command_parameters = { idx }, }; int err; @@ -6425,10 +6437,6 @@ static struct net_device *ipw2100_alloc_device( return dev; } - - -#define PCI_DMA_32BIT 0x00000000ffffffffULL - static int ipw2100_pci_init_one(struct pci_dev *pci_dev, const struct pci_device_id *ent) { @@ -6482,7 +6490,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, pci_set_master(pci_dev); pci_set_drvdata(pci_dev, priv); - err = pci_set_dma_mask(pci_dev, PCI_DMA_32BIT); + err = pci_set_dma_mask(pci_dev, DMA_32BIT_MASK); if (err) { printk(KERN_WARNING DRV_NAME "Error calling pci_set_dma_mask.\n"); @@ -6504,7 +6512,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, if ((val & 0x0000ff00) != 0) pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff); - pci_set_power_state(pci_dev, 0); + pci_set_power_state(pci_dev, PCI_D0); if (!ipw2100_hw_is_adapter_in_system(dev)) { printk(KERN_WARNING DRV_NAME @@ -6707,17 +6715,9 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) /* Remove the PRESENT state of the device */ netif_device_detach(dev); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) - pci_save_state(pci_dev, priv->pm_state); -#else pci_save_state(pci_dev); -#endif pci_disable_device (pci_dev); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) - pci_set_power_state(pci_dev, state); -#else pci_set_power_state(pci_dev, PCI_D3hot); -#endif up(&priv->action_sem); @@ -6738,17 +6738,9 @@ static int ipw2100_resume(struct pci_dev *pci_dev) IPW_DEBUG_INFO("%s: Coming out of suspend...\n", dev->name); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) - pci_set_power_state(pci_dev, 0); -#else pci_set_power_state(pci_dev, PCI_D0); -#endif pci_enable_device(pci_dev); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) - pci_restore_state(pci_dev, priv->pm_state); -#else pci_restore_state(pci_dev); -#endif /* * Suspend/Resume resets the PCI configuration space, so we have to @@ -8056,7 +8048,7 @@ static iw_handler ipw2100_wx_handlers[] = ipw2100_wx_set_wap, /* SIOCSIWAP */ ipw2100_wx_get_wap, /* SIOCGIWAP */ NULL, /* -- hole -- */ - NULL, /* SIOCGIWAPLIST -- depricated */ + NULL, /* SIOCGIWAPLIST -- deprecated */ ipw2100_wx_set_scan, /* SIOCSIWSCAN */ ipw2100_wx_get_scan, /* SIOCGIWSCAN */ ipw2100_wx_set_essid, /* SIOCSIWESSID */ @@ -8431,7 +8423,7 @@ int ipw2100_get_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw) priv->net_dev->name, fw_name); return rc; } - IPW_DEBUG_INFO("firmware data %p size %d\n", fw->fw_entry->data, + IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data, fw->fw_entry->size); ipw2100_mod_firmware_load(fw); diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index bb31fa03f69f..95a05b554c1a 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h @@ -44,30 +44,6 @@ #include <linux/workqueue.h> -#ifndef IRQ_NONE -typedef void irqreturn_t; -#define IRQ_NONE -#define IRQ_HANDLED -#define IRQ_RETVAL(x) -#endif - -#if WIRELESS_EXT < 17 -#define IW_QUAL_QUAL_INVALID 0x10 -#define IW_QUAL_LEVEL_INVALID 0x20 -#define IW_QUAL_NOISE_INVALID 0x40 -#endif - -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) ) -#define pci_dma_sync_single_for_cpu pci_dma_sync_single -#define pci_dma_sync_single_for_device pci_dma_sync_single -#endif - -#ifndef HAVE_FREE_NETDEV -#define free_netdev(x) kfree(x) -#endif - - - struct ipw2100_priv; struct ipw2100_tx_packet; struct ipw2100_rx_packet; @@ -167,15 +143,6 @@ enum { IPW_DEBUG_ENABLED = 0 }; #define IPW_DEBUG_STATE(f, a...) IPW_DEBUG(IPW_DL_STATE | IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) #define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) - -#define VERIFY(f) \ -{ \ - int status = 0; \ - status = f; \ - if(status) \ - return status; \ -} - enum { IPW_HW_STATE_DISABLED = 1, IPW_HW_STATE_ENABLED = 0 @@ -210,8 +177,6 @@ struct bd_status { } info; } __attribute__ ((packed)); -#define IPW_BUFDESC_LAST_FRAG 0 - struct ipw2100_bd { u32 host_addr; u32 buf_length; @@ -355,7 +320,7 @@ struct ipw2100_data_header { u16 fragment_size; } __attribute__ ((packed)); -// Host command data structure +/* Host command data structure */ struct host_command { u32 host_command; // COMMAND ID u32 host_command1; // COMMAND ID @@ -648,9 +613,6 @@ struct ipw2100_priv { struct semaphore adapter_sem; wait_queue_head_t wait_command_queue; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) - u32 pm_state[PM_STATE_SIZE]; -#endif }; @@ -701,7 +663,7 @@ struct ipw2100_priv { #define MSDU_TX_RATES 62 -// Rogue AP Detection +/* Rogue AP Detection */ #define SET_STATION_STAT_BITS 64 #define CLEAR_STATIONS_STAT_BITS 65 #define LEAP_ROGUE_MODE 66 //TODO tbw replaced by CFG_LEAP_ROGUE_AP @@ -711,25 +673,16 @@ struct ipw2100_priv { -// system configuration bit mask: -//#define IPW_CFG_ANTENNA_SETTING 0x03 -//#define IPW_CFG_ANTENNA_A 0x01 -//#define IPW_CFG_ANTENNA_B 0x02 +/* system configuration bit mask: */ #define IPW_CFG_MONITOR 0x00004 -//#define IPW_CFG_TX_STATUS_ENABLE 0x00008 #define IPW_CFG_PREAMBLE_AUTO 0x00010 #define IPW_CFG_IBSS_AUTO_START 0x00020 -//#define IPW_CFG_KERBEROS_ENABLE 0x00040 #define IPW_CFG_LOOPBACK 0x00100 -//#define IPW_CFG_WNMP_PING_PASS 0x00200 -//#define IPW_CFG_DEBUG_ENABLE 0x00400 #define IPW_CFG_ANSWER_BCSSID_PROBE 0x00800 -//#define IPW_CFG_BT_PRIORITY 0x01000 #define IPW_CFG_BT_SIDEBAND_SIGNAL 0x02000 #define IPW_CFG_802_1x_ENABLE 0x04000 #define IPW_CFG_BSS_MASK 0x08000 #define IPW_CFG_IBSS_MASK 0x10000 -//#define IPW_CFG_DYNAMIC_CW 0x10000 #define IPW_SCAN_NOASSOCIATE (1<<0) #define IPW_SCAN_MIXED_CELL (1<<1) @@ -761,41 +714,6 @@ struct ipw2100_priv { #define IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX \ (IPW_MEM_SRAM_HOST_INTERRUPT_AREA_LOWER_BOUND) - -#if 0 -#define IPW_MEM_HOST_SHARED_TX_QUEUE_0_BD_BASE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x00) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_0_BD_SIZE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x04) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_1_BD_BASE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x08) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_1_BD_SIZE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x0c) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_2_BD_BASE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x10) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_2_BD_SIZE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x14) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_3_BD_BASE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x18) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_3_BD_SIZE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x1c) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_0_READ_INDEX (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x80) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_1_READ_INDEX (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x84) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_2_READ_INDEX (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x88) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_3_READ_INDEX (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x8c) - -#define IPW_MEM_HOST_SHARED_TX_QUEUE_BD_BASE(QueueNum) \ - (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + (QueueNum<<3)) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_BD_SIZE(QueueNum) \ - (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x0004+(QueueNum<<3)) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_READ_INDEX(QueueNum) \ - (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x0080+(QueueNum<<2)) - -#define IPW_MEM_HOST_SHARED_TX_QUEUE_0_WRITE_INDEX \ - (IPW_MEM_SRAM_HOST_INTERRUPT_AREA_LOWER_BOUND + 0x00) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_1_WRITE_INDEX \ - (IPW_MEM_SRAM_HOST_INTERRUPT_AREA_LOWER_BOUND + 0x04) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_2_WRITE_INDEX \ - (IPW_MEM_SRAM_HOST_INTERRUPT_AREA_LOWER_BOUND + 0x08) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_3_WRITE_INDEX \ - (IPW_MEM_SRAM_HOST_INTERRUPT_AREA_LOWER_BOUND + 0x0c) -#define IPW_MEM_HOST_SHARED_SLAVE_MODE_INT_REGISTER \ - (IPW_MEM_SRAM_HOST_INTERRUPT_AREA_LOWER_BOUND + 0x78) - -#endif - #define IPW_MEM_HOST_SHARED_ORDINALS_TABLE_1 (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x180) #define IPW_MEM_HOST_SHARED_ORDINALS_TABLE_2 (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x184) @@ -913,7 +831,7 @@ struct ipw2100_rx { } rx_data; } __attribute__ ((packed)); -// Bit 0-7 are for 802.11b tx rates - . Bit 5-7 are reserved +/* Bit 0-7 are for 802.11b tx rates - . Bit 5-7 are reserved */ #define TX_RATE_1_MBIT 0x0001 #define TX_RATE_2_MBIT 0x0002 #define TX_RATE_5_5_MBIT 0x0004 @@ -1193,7 +1111,6 @@ typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW IPW_ORD_UCODE_VERSION, // Ucode Version IPW_ORD_HW_RF_SWITCH_STATE = 214, // HW RF Kill Switch State } ORDINALTABLE1; -//ENDOF TABLE1 // ordinal table 2 // Variable length data: diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 69733465354b..16cfd907e715 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -241,8 +241,8 @@ 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_write32(priv, CX2_INDIRECT_ADDR, reg & CX2_INDIRECT_ADDR_MASK); _ipw_write8(priv, CX2_INDIRECT_DATA, value); - IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", - (unsigned)(priv->hw_base + CX2_INDIRECT_DATA), + IPW_DEBUG_IO(" reg = 0x%8lX : value = 0x%8X\n", + (unsigned long)(priv->hw_base + CX2_INDIRECT_DATA), value); } @@ -508,7 +508,7 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, /* verify we have enough room to store the value */ if (*len < sizeof(u32)) { IPW_DEBUG_ORD("ordinal buffer length too small, " - "need %d\n", sizeof(u32)); + "need %zd\n", sizeof(u32)); return -EINVAL; } @@ -541,7 +541,7 @@ static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, /* verify we have enough room to store the value */ if (*len < sizeof(u32)) { IPW_DEBUG_ORD("ordinal buffer length too small, " - "need %d\n", sizeof(u32)); + "need %zd\n", sizeof(u32)); return -EINVAL; } @@ -642,8 +642,8 @@ static ssize_t show_debug_level(struct device_driver *d, char *buf) { return sprintf(buf, "0x%08X\n", ipw_debug_level); } -static ssize_t store_debug_level(struct device_driver *d, const char *buf, - size_t count) +static ssize_t store_debug_level(struct device_driver *d, + const char *buf, size_t count) { char *p = (char *)buf; u32 val; @@ -667,23 +667,26 @@ static ssize_t store_debug_level(struct device_driver *d, const char *buf, static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, store_debug_level); -static ssize_t show_status(struct device *d, char *buf) +static ssize_t show_status(struct device *d, + struct device_attribute *attr, char *buf) { - struct ipw_priv *p = (struct ipw_priv *)d->driver_data; + struct ipw_priv *p = d->driver_data; return sprintf(buf, "0x%08x\n", (int)p->status); } static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); -static ssize_t show_cfg(struct device *d, char *buf) +static ssize_t show_cfg(struct device *d, struct device_attribute *attr, + char *buf) { - struct ipw_priv *p = (struct ipw_priv *)d->driver_data; + struct ipw_priv *p = d->driver_data; return sprintf(buf, "0x%08x\n", (int)p->config); } static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); -static ssize_t show_nic_type(struct device *d, char *buf) +static ssize_t show_nic_type(struct device *d, + struct device_attribute *attr, char *buf) { - struct ipw_priv *p = (struct ipw_priv *)d->driver_data; + struct ipw_priv *p = d->driver_data; u8 type = p->eeprom[EEPROM_NIC_TYPE]; switch (type) { @@ -703,8 +706,8 @@ static ssize_t show_nic_type(struct device *d, char *buf) } static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); -static ssize_t dump_error_log(struct device *d, const char *buf, - size_t count) +static ssize_t dump_error_log(struct device *d, + struct device_attribute *attr, const char *buf, size_t count) { char *p = (char *)buf; @@ -715,8 +718,8 @@ static ssize_t dump_error_log(struct device *d, const char *buf, } static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, dump_error_log); -static ssize_t dump_event_log(struct device *d, const char *buf, - size_t count) +static ssize_t dump_event_log(struct device *d, + struct device_attribute *attr, const char *buf, size_t count) { char *p = (char *)buf; @@ -727,10 +730,11 @@ static ssize_t dump_event_log(struct device *d, const char *buf, } static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log); -static ssize_t show_ucode_version(struct device *d, char *buf) +static ssize_t show_ucode_version(struct device *d, + struct device_attribute *attr, char *buf) { u32 len = sizeof(u32), tmp = 0; - struct ipw_priv *p = (struct ipw_priv*)d->driver_data; + struct ipw_priv *p = d->driver_data; if(ipw_get_ordinal(p, IPW_ORD_STAT_UCODE_VERSION, &tmp, &len)) return 0; @@ -739,10 +743,11 @@ static ssize_t show_ucode_version(struct device *d, char *buf) } static DEVICE_ATTR(ucode_version, S_IWUSR|S_IRUGO, show_ucode_version, NULL); -static ssize_t show_rtc(struct device *d, char *buf) +static ssize_t show_rtc(struct device *d, struct device_attribute *attr, + char *buf) { u32 len = sizeof(u32), tmp = 0; - struct ipw_priv *p = (struct ipw_priv*)d->driver_data; + struct ipw_priv *p = d->driver_data; if(ipw_get_ordinal(p, IPW_ORD_STAT_RTC, &tmp, &len)) return 0; @@ -755,35 +760,38 @@ static DEVICE_ATTR(rtc, S_IWUSR|S_IRUGO, show_rtc, NULL); * Add a device attribute to view/control the delay between eeprom * operations. */ -static ssize_t show_eeprom_delay(struct device *d, char *buf) +static ssize_t show_eeprom_delay(struct device *d, + struct device_attribute *attr, char *buf) { int n = ((struct ipw_priv*)d->driver_data)->eeprom_delay; return sprintf(buf, "%i\n", n); } -static ssize_t store_eeprom_delay(struct device *d, const char *buf, - size_t count) +static ssize_t store_eeprom_delay(struct device *d, + struct device_attribute *attr, const char *buf, + size_t count) { - struct ipw_priv *p = (struct ipw_priv*)d->driver_data; + struct ipw_priv *p = d->driver_data; sscanf(buf, "%i", &p->eeprom_delay); return strnlen(buf, count); } static DEVICE_ATTR(eeprom_delay, S_IWUSR|S_IRUGO, show_eeprom_delay,store_eeprom_delay); -static ssize_t show_command_event_reg(struct device *d, char *buf) +static ssize_t show_command_event_reg(struct device *d, + struct device_attribute *attr, char *buf) { u32 reg = 0; - struct ipw_priv *p = (struct ipw_priv *)d->driver_data; + struct ipw_priv *p = d->driver_data; reg = ipw_read_reg32(p, CX2_INTERNAL_CMD_EVENT); return sprintf(buf, "0x%08x\n", reg); } -static ssize_t store_command_event_reg(struct device *d, - const char *buf, - size_t count) +static ssize_t store_command_event_reg(struct device *d, + struct device_attribute *attr, const char *buf, + size_t count) { u32 reg; - struct ipw_priv *p = (struct ipw_priv *)d->driver_data; + struct ipw_priv *p = d->driver_data; sscanf(buf, "%x", ®); ipw_write_reg32(p, CX2_INTERNAL_CMD_EVENT, reg); @@ -792,20 +800,21 @@ static ssize_t store_command_event_reg(struct device *d, static DEVICE_ATTR(command_event_reg, S_IWUSR|S_IRUGO, show_command_event_reg,store_command_event_reg); -static ssize_t show_mem_gpio_reg(struct device *d, char *buf) +static ssize_t show_mem_gpio_reg(struct device *d, + struct device_attribute *attr, char *buf) { u32 reg = 0; - struct ipw_priv *p = (struct ipw_priv *)d->driver_data; + struct ipw_priv *p = d->driver_data; reg = ipw_read_reg32(p, 0x301100); return sprintf(buf, "0x%08x\n", reg); } -static ssize_t store_mem_gpio_reg(struct device *d, - const char *buf, - size_t count) +static ssize_t store_mem_gpio_reg(struct device *d, + struct device_attribute *attr, const char *buf, + size_t count) { u32 reg; - struct ipw_priv *p = (struct ipw_priv *)d->driver_data; + struct ipw_priv *p = d->driver_data; sscanf(buf, "%x", ®); ipw_write_reg32(p, 0x301100, reg); @@ -814,10 +823,11 @@ static ssize_t store_mem_gpio_reg(struct device *d, static DEVICE_ATTR(mem_gpio_reg, S_IWUSR|S_IRUGO, show_mem_gpio_reg,store_mem_gpio_reg); -static ssize_t show_indirect_dword(struct device *d, char *buf) +static ssize_t show_indirect_dword(struct device *d, + struct device_attribute *attr, char *buf) { u32 reg = 0; - struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; + struct ipw_priv *priv = d->driver_data; if (priv->status & STATUS_INDIRECT_DWORD) reg = ipw_read_reg32(priv, priv->indirect_dword); else @@ -825,11 +835,11 @@ static ssize_t show_indirect_dword(struct device *d, char *buf) return sprintf(buf, "0x%08x\n", reg); } -static ssize_t store_indirect_dword(struct device *d, - const char *buf, - size_t count) +static ssize_t store_indirect_dword(struct device *d, + struct device_attribute *attr, const char *buf, + size_t count) { - struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; + struct ipw_priv *priv = d->driver_data; sscanf(buf, "%x", &priv->indirect_dword); priv->status |= STATUS_INDIRECT_DWORD; @@ -838,10 +848,11 @@ static ssize_t store_indirect_dword(struct device *d, static DEVICE_ATTR(indirect_dword, S_IWUSR|S_IRUGO, show_indirect_dword,store_indirect_dword); -static ssize_t show_indirect_byte(struct device *d, char *buf) +static ssize_t show_indirect_byte(struct device *d, + struct device_attribute *attr, char *buf) { u8 reg = 0; - struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; + struct ipw_priv *priv = d->driver_data; if (priv->status & STATUS_INDIRECT_BYTE) reg = ipw_read_reg8(priv, priv->indirect_byte); else @@ -849,11 +860,11 @@ static ssize_t show_indirect_byte(struct device *d, char *buf) return sprintf(buf, "0x%02x\n", reg); } -static ssize_t store_indirect_byte(struct device *d, - const char *buf, - size_t count) +static ssize_t store_indirect_byte(struct device *d, + struct device_attribute *attr, const char *buf, + size_t count) { - struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; + struct ipw_priv *priv = d->driver_data; sscanf(buf, "%x", &priv->indirect_byte); priv->status |= STATUS_INDIRECT_BYTE; @@ -862,10 +873,11 @@ static ssize_t store_indirect_byte(struct device *d, static DEVICE_ATTR(indirect_byte, S_IWUSR|S_IRUGO, show_indirect_byte, store_indirect_byte); -static ssize_t show_direct_dword(struct device *d, char *buf) +static ssize_t show_direct_dword(struct device *d, + struct device_attribute *attr, char *buf) { u32 reg = 0; - struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; + struct ipw_priv *priv = d->driver_data; if (priv->status & STATUS_DIRECT_DWORD) reg = ipw_read32(priv, priv->direct_dword); @@ -874,11 +886,11 @@ static ssize_t show_direct_dword(struct device *d, char *buf) return sprintf(buf, "0x%08x\n", reg); } -static ssize_t store_direct_dword(struct device *d, - const char *buf, - size_t count) +static ssize_t store_direct_dword(struct device *d, + struct device_attribute *attr, const char *buf, + size_t count) { - struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; + struct ipw_priv *priv = d->driver_data; sscanf(buf, "%x", &priv->direct_dword); priv->status |= STATUS_DIRECT_DWORD; @@ -898,13 +910,14 @@ static inline int rf_kill_active(struct ipw_priv *priv) return (priv->status & STATUS_RF_KILL_HW) ? 1 : 0; } -static ssize_t show_rf_kill(struct device *d, char *buf) +static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, + char *buf) { /* 0 - RF kill not enabled 1 - SW based RF kill active (sysfs) 2 - HW based RF kill active 3 - Both HW and SW baed RF kill active */ - struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; + struct ipw_priv *priv = d->driver_data; int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | (rf_kill_active(priv) ? 0x2 : 0x0); return sprintf(buf, "%i\n", val); @@ -943,9 +956,10 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) return 1; } -static ssize_t store_rf_kill(struct device *d, const char *buf, size_t count) +static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, + const char *buf, size_t count) { - struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; + struct ipw_priv *priv = d->driver_data; ipw_radio_kill_sw(priv, buf[0] == '1'); @@ -1740,7 +1754,7 @@ static int ipw_fw_dma_write_command_block(struct ipw_priv *priv, int index, stru u32 address = CX2_SHARED_SRAM_DMA_CONTROL + (sizeof(struct command_block) * index); IPW_DEBUG_FW(">> :\n"); - ipw_write_indirect(priv, address, (u8*)cb, sizeof(struct command_block)); + ipw_write_indirect(priv, address, (u8*)cb, (int)sizeof(struct command_block)); IPW_DEBUG_FW("<< :\n"); return 0; @@ -2342,7 +2356,7 @@ static int ipw_get_fw(struct ipw_priv *priv, return -EINVAL; } - IPW_DEBUG_INFO("Loading firmware '%s' file v%d.%d (%d bytes)\n", + IPW_DEBUG_INFO("Loading firmware '%s' file v%d.%d (%zd bytes)\n", name, IPW_FW_MAJOR(header->version), IPW_FW_MINOR(header->version), @@ -2697,7 +2711,7 @@ static int ipw_queue_tx_init(struct ipw_priv *priv, q->bd = pci_alloc_consistent(dev,sizeof(q->bd[0])*count, &q->q.dma_addr); if (!q->bd) { - IPW_ERROR("pci_alloc_consistent(%d) failed\n", + IPW_ERROR("pci_alloc_consistent(%zd) failed\n", sizeof(q->bd[0]) * count); kfree(q->txb); q->txb = NULL; @@ -3466,8 +3480,8 @@ static inline void ipw_rx_notification(struct ipw_priv* priv, x->channel_num); } else { IPW_DEBUG_SCAN("Scan result of wrong size %d " - "(should be %d)\n", - notif->size,sizeof(*x)); + "(should be %zd)\n", + notif->size, sizeof(*x)); } break; } @@ -3482,8 +3496,8 @@ static inline void ipw_rx_notification(struct ipw_priv* priv, x->status); } else { IPW_ERROR("Scan completed of wrong size %d " - "(should be %d)\n", - notif->size,sizeof(*x)); + "(should be %zd)\n", + notif->size, sizeof(*x)); } priv->status &= ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); @@ -3515,7 +3529,7 @@ static inline void ipw_rx_notification(struct ipw_priv* priv, IPW_ERROR("Frag length: %d\n", x->frag_length); } else { IPW_ERROR("Frag length of wrong size %d " - "(should be %d)\n", + "(should be %zd)\n", notif->size, sizeof(*x)); } break; @@ -3532,8 +3546,8 @@ static inline void ipw_rx_notification(struct ipw_priv* priv, memcpy(&priv->last_link_deterioration, x, sizeof(*x)); } else { IPW_ERROR("Link Deterioration of wrong size %d " - "(should be %d)\n", - notif->size,sizeof(*x)); + "(should be %zd)\n", + notif->size, sizeof(*x)); } break; } @@ -3552,7 +3566,7 @@ static inline void ipw_rx_notification(struct ipw_priv* priv, struct notif_beacon_state *x = ¬if->u.beacon_state; if (notif->size != sizeof(*x)) { IPW_ERROR("Beacon state of wrong size %d (should " - "be %d)\n", notif->size, sizeof(*x)); + "be %zd)\n", notif->size, sizeof(*x)); break; } @@ -3602,8 +3616,8 @@ static inline void ipw_rx_notification(struct ipw_priv* priv, break; } - IPW_ERROR("TGi Tx Key of wrong size %d (should be %d)\n", - notif->size,sizeof(*x)); + IPW_ERROR("TGi Tx Key of wrong size %d (should be %zd)\n", + notif->size, sizeof(*x)); break; } @@ -3616,8 +3630,8 @@ static inline void ipw_rx_notification(struct ipw_priv* priv, break; } - IPW_ERROR("Calibration of wrong size %d (should be %d)\n", - notif->size,sizeof(*x)); + IPW_ERROR("Calibration of wrong size %d (should be %zd)\n", + notif->size, sizeof(*x)); break; } @@ -3628,7 +3642,7 @@ static inline void ipw_rx_notification(struct ipw_priv* priv, break; } - IPW_ERROR("Noise stat is wrong size %d (should be %d)\n", + IPW_ERROR("Noise stat is wrong size %d (should be %zd)\n", notif->size, sizeof(u32)); break; } @@ -4823,7 +4837,7 @@ static inline void ipw_handle_data_packet(struct ipw_priv *priv, } /* Advance skb->data to the start of the actual payload */ - skb_reserve(rxb->skb, (u32)&pkt->u.frame.data[0] - (u32)pkt); + skb_reserve(rxb->skb, offsetof(struct ipw_rx_packet, u.frame.data)); /* Set the size of the skb to the size of the frame */ skb_put(rxb->skb, pkt->u.frame.length); @@ -6979,10 +6993,9 @@ static int ipw_pci_probe(struct pci_dev *pdev, pci_set_master(pdev); -#define PCI_DMA_32BIT 0x00000000ffffffffULL - err = pci_set_dma_mask(pdev, PCI_DMA_32BIT); + err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); if (!err) - err = pci_set_consistent_dma_mask(pdev, PCI_DMA_32BIT); + err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); if (err) { printk(KERN_WARNING DRV_NAME ": No suitable DMA available.\n"); goto out_pci_disable_device; |