From fd7a516efbcdabf5d7b9307ca9fe48b511b7d123 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Wed, 2 Nov 2005 01:53:16 +0100 Subject: [PATCH 1/9] [PATCH] fix NET_RADIO=n, IEEE80211=y compile This patch fixes the following compile error with CONFIG_NET_RADIO=n and CONFIG_IEEE80211=y: LD .tmp_vmlinux1 net/built-in.o: In function `ieee80211_rx': : undefined reference to `wireless_spy_update' make: *** [.tmp_vmlinux1] Error 1 Signed-off-by: Adrian Bunk Signed-off-by: John W. Linville --- net/ieee80211/ieee80211_rx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index ce694cf5c160..00eb780836d8 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c @@ -370,6 +370,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, /* Put this code here so that we avoid duplicating it in all * Rx paths. - Jean II */ #ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ +#ifdef CONFIG_NET_RADIO /* If spy monitoring on */ if (ieee->spy_data.spy_number > 0) { struct iw_quality wstats; @@ -396,6 +397,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, /* Update spy records */ wireless_spy_update(ieee->dev, hdr->addr2, &wstats); } +#endif /* CONFIG_NET_RADIO */ #endif /* IW_WIRELESS_SPY */ #ifdef NOT_YET From 8e3babcd69ec0fde874838e276eb0b211c6a5647 Mon Sep 17 00:00:00 2001 From: Jay Vosburgh Date: Fri, 4 Nov 2005 18:45:45 -0800 Subject: [PATCH 2/9] [PATCH] bonding: fix feature consolidation This should resolve http://bugzilla.kernel.org/show_bug.cgi?id=5519 The current feature computation loses bits that it doesn't know about, resulting in an inability to add VLANs and possibly other havoc. Rewrote function to preserve bits it doesn't know about, remove an unneeded state variable, and simplify the code. Signed-off-by: Jay Vosburgh Signed-off-by: John W. Linville --- drivers/net/bonding/bond_main.c | 32 +++++++++++--------------------- drivers/net/bonding/bonding.h | 7 ++----- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 8032126fd589..94cec3cf2a13 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1604,35 +1604,27 @@ static int bond_sethwaddr(struct net_device *bond_dev, struct net_device *slave_ (NETIF_F_SG|NETIF_F_IP_CSUM|NETIF_F_NO_CSUM|NETIF_F_HW_CSUM) /* - * Compute the features available to the bonding device by - * intersection of all of the slave devices' BOND_INTERSECT_FEATURES. - * Call this after attaching or detaching a slave to update the - * bond's features. + * Compute the common dev->feature set available to all slaves. Some + * feature bits are managed elsewhere, so preserve feature bits set on + * master device that are not part of the examined set. */ static int bond_compute_features(struct bonding *bond) { - int i; + unsigned long features = BOND_INTERSECT_FEATURES; struct slave *slave; struct net_device *bond_dev = bond->dev; - int features = bond->bond_features; + int i; - bond_for_each_slave(bond, slave, i) { - struct net_device * slave_dev = slave->dev; - if (i == 0) { - features |= BOND_INTERSECT_FEATURES; - } - features &= - ~(~slave_dev->features & BOND_INTERSECT_FEATURES); - } + bond_for_each_slave(bond, slave, i) + features &= (slave->dev->features & BOND_INTERSECT_FEATURES); - /* turn off NETIF_F_SG if we need a csum and h/w can't do it */ if ((features & NETIF_F_SG) && - !(features & (NETIF_F_IP_CSUM | - NETIF_F_NO_CSUM | - NETIF_F_HW_CSUM))) { + !(features & (NETIF_F_IP_CSUM | + NETIF_F_NO_CSUM | + NETIF_F_HW_CSUM))) features &= ~NETIF_F_SG; - } + features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES); bond_dev->features = features; return 0; @@ -4561,8 +4553,6 @@ static int __init bond_init(struct net_device *bond_dev, struct bond_params *par NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER); - bond->bond_features = bond_dev->features; - #ifdef CONFIG_PROC_FS bond_create_proc_entry(bond); #endif diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index bbf9da8af624..1433e91db0f7 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h @@ -40,8 +40,8 @@ #include "bond_3ad.h" #include "bond_alb.h" -#define DRV_VERSION "2.6.4" -#define DRV_RELDATE "September 26, 2005" +#define DRV_VERSION "2.6.5" +#define DRV_RELDATE "November 4, 2005" #define DRV_NAME "bonding" #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" @@ -211,9 +211,6 @@ struct bonding { struct bond_params params; struct list_head vlan_list; struct vlan_group *vlgrp; - /* the features the bonding device supports, independently - * of any slaves */ - int bond_features; }; /** From 48888cc6120ff945675ef79a3ba2955afa0f5124 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sat, 5 Nov 2005 20:01:47 +0100 Subject: [PATCH 3/9] [PATCH] kill include/linux/eeprom.h This patch kills include/linux/eeprom.h . Rationale: - it was only used by one single driver - even this driver didn't do anything useful with it - most of this file are non-inline and non-static functions (sic) This removes include/linux/eeprom.h and cleans drivers/net/ns83820.c up. If you think eeprom.h should be used more extensively, please consider: - the code has to be moved from the header file to a .c file - the currently empty write function has to be implemented - ns83820.c or any other driver should actually use it Noone did any of these during the more than 3 years eeprom.h already exists... Signed-off-by: Adrian Bunk Signed-off-by: John W. Linville --- drivers/net/ns83820.c | 13 +--- include/linux/eeprom.h | 136 ----------------------------------------- 2 files changed, 2 insertions(+), 147 deletions(-) delete mode 100644 include/linux/eeprom.h diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index a3c3fc9c0d8a..f857ae94d261 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c @@ -110,7 +110,6 @@ #include #include /* for iph */ #include /* for IPPROTO_... */ -#include #include #include #include @@ -445,7 +444,6 @@ struct ns83820 { u32 MEAR_cache; u32 IMR_cache; - struct eeprom ee; unsigned linkstate; @@ -1558,15 +1556,13 @@ static void ns83820_getmac(struct ns83820 *dev, u8 *mac) unsigned i; for (i=0; i<3; i++) { u32 data; -#if 0 /* I've left this in as an example of how to use eeprom.h */ - data = eeprom_readw(&dev->ee, 0xa + 2 - i); -#else + /* Read from the perfect match memory: this is loaded by * the chip from the EEPROM via the EELOAD self test. */ writel(i*2, dev->base + RFCR); data = readl(dev->base + RFDR); -#endif + *mac++ = data; *mac++ = data >> 8; } @@ -1851,8 +1847,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ spin_lock_init(&dev->misc_lock); dev->pci_dev = pci_dev; - dev->ee.cache = &dev->MEAR_cache; - dev->ee.lock = &dev->misc_lock; SET_MODULE_OWNER(ndev); SET_NETDEV_DEV(ndev, &pci_dev->dev); @@ -1887,9 +1881,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ dev->IMR_cache = 0; - setup_ee_mem_bitbanger(&dev->ee, dev->base + MEAR, 3, 2, 1, 0, - 0); - err = request_irq(pci_dev->irq, ns83820_irq, SA_SHIRQ, DRV_NAME, ndev); if (err) { diff --git a/include/linux/eeprom.h b/include/linux/eeprom.h deleted file mode 100644 index 38afd9da1dfe..000000000000 --- a/include/linux/eeprom.h +++ /dev/null @@ -1,136 +0,0 @@ -/* credit winbond-840.c - */ -#include -struct eeprom_ops { - void (*set_cs)(void *ee); - void (*clear_cs)(void *ee); -}; - -#define EEPOL_EEDI 0x01 -#define EEPOL_EEDO 0x02 -#define EEPOL_EECLK 0x04 -#define EEPOL_EESEL 0x08 - -struct eeprom { - void *dev; - struct eeprom_ops *ops; - - void __iomem * addr; - - unsigned ee_addr_bits; - - unsigned eesel; - unsigned eeclk; - unsigned eedo; - unsigned eedi; - unsigned polarity; - unsigned ee_state; - - spinlock_t *lock; - u32 *cache; -}; - - -u8 eeprom_readb(struct eeprom *ee, unsigned address); -void eeprom_read(struct eeprom *ee, unsigned address, u8 *bytes, - unsigned count); -void eeprom_writeb(struct eeprom *ee, unsigned address, u8 data); -void eeprom_write(struct eeprom *ee, unsigned address, u8 *bytes, - unsigned count); - -/* The EEPROM commands include the alway-set leading bit. */ -enum EEPROM_Cmds { - EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6), -}; - -void setup_ee_mem_bitbanger(struct eeprom *ee, void __iomem *memaddr, int eesel_bit, int eeclk_bit, int eedo_bit, int eedi_bit, unsigned polarity) -{ - ee->addr = memaddr; - ee->eesel = 1 << eesel_bit; - ee->eeclk = 1 << eeclk_bit; - ee->eedo = 1 << eedo_bit; - ee->eedi = 1 << eedi_bit; - - ee->polarity = polarity; - - *ee->cache = readl(ee->addr); -} - -/* foo. put this in a .c file */ -static inline void eeprom_update(struct eeprom *ee, u32 mask, int pol) -{ - unsigned long flags; - u32 data; - - spin_lock_irqsave(ee->lock, flags); - data = *ee->cache; - - data &= ~mask; - if (pol) - data |= mask; - - *ee->cache = data; -//printk("update: %08x\n", data); - writel(data, ee->addr); - spin_unlock_irqrestore(ee->lock, flags); -} - -void eeprom_clk_lo(struct eeprom *ee) -{ - int pol = !!(ee->polarity & EEPOL_EECLK); - - eeprom_update(ee, ee->eeclk, pol); - udelay(2); -} - -void eeprom_clk_hi(struct eeprom *ee) -{ - int pol = !!(ee->polarity & EEPOL_EECLK); - - eeprom_update(ee, ee->eeclk, !pol); - udelay(2); -} - -void eeprom_send_addr(struct eeprom *ee, unsigned address) -{ - int pol = !!(ee->polarity & EEPOL_EEDI); - unsigned i; - address |= 6 << 6; - - /* Shift the read command bits out. */ - for (i=0; i<11; i++) { - eeprom_update(ee, ee->eedi, ((address >> 10) & 1) ^ pol); - address <<= 1; - eeprom_clk_hi(ee); - eeprom_clk_lo(ee); - } - eeprom_update(ee, ee->eedi, pol); -} - -u16 eeprom_readw(struct eeprom *ee, unsigned address) -{ - unsigned i; - u16 res = 0; - - eeprom_clk_lo(ee); - eeprom_update(ee, ee->eesel, 1 ^ !!(ee->polarity & EEPOL_EESEL)); - eeprom_send_addr(ee, address); - - for (i=0; i<16; i++) { - u32 data; - eeprom_clk_hi(ee); - res <<= 1; - data = readl(ee->addr); -//printk("eeprom_readw: %08x\n", data); - res |= !!(data & ee->eedo) ^ !!(ee->polarity & EEPOL_EEDO); - eeprom_clk_lo(ee); - } - eeprom_update(ee, ee->eesel, 0 ^ !!(ee->polarity & EEPOL_EESEL)); - - return res; -} - - -void eeprom_writeb(struct eeprom *ee, unsigned address, u8 data) -{ -} From ac1f60db6a62c8605b551497c8002ba267ea1f4a Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 6 Nov 2005 01:46:47 +0100 Subject: [PATCH 4/9] [PATCH] drivers/net/s2io.c: make functions static This patch makes needlessly global functions static. Signed-off-by: Adrian Bunk Signed-off-by: John W. Linville --- drivers/net/s2io.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 9c4935407f26..9848892643fc 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c @@ -1532,7 +1532,7 @@ static int init_nic(struct s2io_nic *nic) #define LINK_UP_DOWN_INTERRUPT 1 #define MAC_RMAC_ERR_TIMER 2 -int s2io_link_fault_indication(nic_t *nic) +static int s2io_link_fault_indication(nic_t *nic) { if (nic->intr_type != INTA) return MAC_RMAC_ERR_TIMER; @@ -1864,7 +1864,7 @@ static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag) * */ -void fix_mac_address(nic_t * sp) +static void fix_mac_address(nic_t * sp) { XENA_dev_config_t __iomem *bar0 = sp->bar0; u64 val64; @@ -2162,7 +2162,7 @@ int fill_rxd_3buf(nic_t *nic, RxD_t *rxdp, struct sk_buff *skb) * SUCCESS on success or an appropriate -ve value on failure. */ -int fill_rx_buffers(struct s2io_nic *nic, int ring_no) +static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) { struct net_device *dev = nic->dev; struct sk_buff *skb; @@ -2833,7 +2833,7 @@ static void alarm_intr_handler(struct s2io_nic *nic) * SUCCESS on success and FAILURE on failure. */ -int wait_for_cmd_complete(nic_t * sp) +static int wait_for_cmd_complete(nic_t * sp) { XENA_dev_config_t __iomem *bar0 = sp->bar0; int ret = FAILURE, cnt = 0; @@ -3079,7 +3079,7 @@ int s2io_set_swapper(nic_t * sp) return SUCCESS; } -int wait_for_msix_trans(nic_t *nic, int i) +static int wait_for_msix_trans(nic_t *nic, int i) { XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; u64 val64; @@ -3118,7 +3118,7 @@ void restore_xmsi_data(nic_t *nic) } } -void store_xmsi_data(nic_t *nic) +static void store_xmsi_data(nic_t *nic) { XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; u64 val64, addr, data; @@ -3290,7 +3290,7 @@ int s2io_enable_msi_x(nic_t *nic) * file on failure. */ -int s2io_open(struct net_device *dev) +static int s2io_open(struct net_device *dev) { nic_t *sp = dev->priv; int err = 0; @@ -3420,7 +3420,7 @@ hw_init_failed: * file on failure. */ -int s2io_close(struct net_device *dev) +static int s2io_close(struct net_device *dev) { nic_t *sp = dev->priv; int i; @@ -3469,7 +3469,7 @@ int s2io_close(struct net_device *dev) * 0 on success & 1 on failure. */ -int s2io_xmit(struct sk_buff *skb, struct net_device *dev) +static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) { nic_t *sp = dev->priv; u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off; @@ -3915,7 +3915,7 @@ static void s2io_updt_stats(nic_t *sp) * pointer to the updated net_device_stats structure. */ -struct net_device_stats *s2io_get_stats(struct net_device *dev) +static struct net_device_stats *s2io_get_stats(struct net_device *dev) { nic_t *sp = dev->priv; mac_info_t *mac_control; @@ -5108,19 +5108,20 @@ static void s2io_get_ethtool_stats(struct net_device *dev, tmp_stats[i++] = stat_info->sw_stat.double_ecc_errs; } -int s2io_ethtool_get_regs_len(struct net_device *dev) +static int s2io_ethtool_get_regs_len(struct net_device *dev) { return (XENA_REG_SPACE); } -u32 s2io_ethtool_get_rx_csum(struct net_device * dev) +static u32 s2io_ethtool_get_rx_csum(struct net_device * dev) { nic_t *sp = dev->priv; return (sp->rx_csum); } -int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) + +static int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) { nic_t *sp = dev->priv; @@ -5131,17 +5132,19 @@ int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) return 0; } -int s2io_get_eeprom_len(struct net_device *dev) + +static int s2io_get_eeprom_len(struct net_device *dev) { return (XENA_EEPROM_SPACE); } -int s2io_ethtool_self_test_count(struct net_device *dev) +static int s2io_ethtool_self_test_count(struct net_device *dev) { return (S2IO_TEST_LEN); } -void s2io_ethtool_get_strings(struct net_device *dev, - u32 stringset, u8 * data) + +static void s2io_ethtool_get_strings(struct net_device *dev, + u32 stringset, u8 * data) { switch (stringset) { case ETH_SS_TEST: @@ -5157,7 +5160,7 @@ static int s2io_ethtool_get_stats_count(struct net_device *dev) return (S2IO_STAT_LEN); } -int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) +static int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) { if (data) dev->features |= NETIF_F_IP_CSUM; @@ -5210,7 +5213,7 @@ static struct ethtool_ops netdev_ethtool_ops = { * function always return EOPNOTSUPPORTED */ -int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +static int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { return -EOPNOTSUPP; } @@ -5226,7 +5229,7 @@ int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) * file on failure. */ -int s2io_change_mtu(struct net_device *dev, int new_mtu) +static int s2io_change_mtu(struct net_device *dev, int new_mtu) { nic_t *sp = dev->priv; From de7fe963b123365a27f82330689806226a48d088 Mon Sep 17 00:00:00 2001 From: Roger While Date: Mon, 7 Nov 2005 20:57:58 +0100 Subject: [PATCH 5/9] [PATCH] prism54 : Unused variable / extraneous udelay In isl_38xx.c : The variable "counter" is defined and incremented but never used except if the driver is hand-compiled setting VERBOSE > SHOW_ERROR_MESSAGES. Move the definition and the increment to within the #if VERBOSE .. block. Remove extraneous udelay's. These are not required when triggering the device. Signed-off-by: Roger While Signed-off-by: John W. Linville --- drivers/net/wireless/prism54/isl_38xx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c index adc7499136dc..866c476933c3 100644 --- a/drivers/net/wireless/prism54/isl_38xx.c +++ b/drivers/net/wireless/prism54/isl_38xx.c @@ -112,9 +112,10 @@ isl38xx_handle_wakeup(isl38xx_control_block *control_block, void isl38xx_trigger_device(int asleep, void __iomem *device_base) { - u32 reg, counter = 0; + u32 reg; #if VERBOSE > SHOW_ERROR_MESSAGES + u32 counter = 0; struct timeval current_time; DEBUG(SHOW_FUNCTION_CALLS, "isl38xx trigger device\n"); #endif @@ -131,7 +132,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) current_time.tv_sec, (long)current_time.tv_usec, readl(device_base + ISL38XX_CTRL_STAT_REG)); #endif - udelay(ISL38XX_WRITEIO_DELAY); reg = readl(device_base + ISL38XX_INT_IDENT_REG); if (reg == 0xabadface) { @@ -145,7 +145,9 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) while (reg = readl(device_base + ISL38XX_CTRL_STAT_REG), (reg & ISL38XX_CTRL_STAT_SLEEPMODE) == 0) { udelay(ISL38XX_WRITEIO_DELAY); +#if VERBOSE > SHOW_ERROR_MESSAGES counter++; +#endif } #if VERBOSE > SHOW_ERROR_MESSAGES @@ -153,10 +155,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) "%08li.%08li Device register read %08x\n", current_time.tv_sec, (long)current_time.tv_usec, readl(device_base + ISL38XX_CTRL_STAT_REG)); -#endif - udelay(ISL38XX_WRITEIO_DELAY); - -#if VERBOSE > SHOW_ERROR_MESSAGES do_gettimeofday(¤t_time); DEBUG(SHOW_TRACING, "%08li.%08li Device asleep counter %i\n", @@ -171,7 +169,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) /* perform another read on the Device Status Register */ reg = readl(device_base + ISL38XX_CTRL_STAT_REG); - udelay(ISL38XX_WRITEIO_DELAY); #if VERBOSE > SHOW_ERROR_MESSAGES do_gettimeofday(¤t_time); @@ -187,7 +184,6 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_UPDATE, ISL38XX_DEV_INT_REG); - udelay(ISL38XX_WRITEIO_DELAY); } } From 0b47939fe616a5e0dd279d98d1eb372e4acc1c09 Mon Sep 17 00:00:00 2001 From: Roger While Date: Mon, 7 Nov 2005 20:58:21 +0100 Subject: [PATCH 6/9] [PATCH] prism54 : Transmit stats updated in wrong place Move update of the transmit statistics to the correct place. This would be just before starting transmission rather than (potentially long) afterward. Signed-off-by: Roger While Signed-off-by: John W. Linville --- drivers/net/wireless/prism54/islpci_eth.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c index 3b49efa37ee5..56d97833edad 100644 --- a/drivers/net/wireless/prism54/islpci_eth.c +++ b/drivers/net/wireless/prism54/islpci_eth.c @@ -227,17 +227,17 @@ islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) priv->data_low_tx_full = 1; } + /* set the transmission time */ + ndev->trans_start = jiffies; + priv->statistics.tx_packets++; + priv->statistics.tx_bytes += skb->len; + /* trigger the device */ islpci_trigger(priv); /* unlock the driver code */ spin_unlock_irqrestore(&priv->slock, flags); - /* set the transmission time */ - ndev->trans_start = jiffies; - priv->statistics.tx_packets++; - priv->statistics.tx_bytes += skb->len; - return 0; drop_free: From 097688ef4710648db335c3c4fa243751f60b330a Mon Sep 17 00:00:00 2001 From: Luiz Fernando Capitulino Date: Mon, 7 Nov 2005 18:14:12 -0200 Subject: [PATCH 7/9] [PATCH] Fix sparse warning in e100 driver. The patch below fixes the following sparse warnings: drivers/net/e100.c:1481:13: warning: Using plain integer as NULL pointer drivers/net/e100.c:1767:27: warning: Using plain integer as NULL pointer drivers/net/e100.c:1847:27: warning: Using plain integer as NULL pointer Signed-off-by: Luiz Capitulino Signed-off-by: John W. Linville --- drivers/net/e100.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/e100.c b/drivers/net/e100.c index eb169a8e8773..7a6aeae2c9fa 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -1478,7 +1478,7 @@ static inline int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) if(pci_dma_mapping_error(rx->dma_addr)) { dev_kfree_skb_any(rx->skb); - rx->skb = 0; + rx->skb = NULL; rx->dma_addr = 0; return -ENOMEM; } @@ -1764,7 +1764,7 @@ static int e100_up(struct nic *nic) if((err = e100_hw_init(nic))) goto err_clean_cbs; e100_set_multicast_list(nic->netdev); - e100_start_receiver(nic, 0); + e100_start_receiver(nic, NULL); mod_timer(&nic->watchdog, jiffies); if((err = request_irq(nic->pdev->irq, e100_intr, SA_SHIRQ, nic->netdev->name, nic->netdev))) @@ -1844,7 +1844,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode) mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, BMCR_LOOPBACK); - e100_start_receiver(nic, 0); + e100_start_receiver(nic, NULL); if(!(skb = dev_alloc_skb(ETH_DATA_LEN))) { err = -ENOMEM; From f36be62115aabd50b4eda0f06f07ab5fae2e9cfd Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 8 Nov 2005 00:41:48 +0300 Subject: [PATCH 8/9] [PATCH] atmel: memset correct range Specify the correct range when calling memset in atmel_get_range. Do this by specifying the size of the structure, rather than the size of the pointer. Signed-off-by: Alexey Dobriyan Signed-off-by: John W. Linville --- drivers/net/wireless/atmel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 1fbe027d26b6..a3e23527fe7f 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c @@ -2217,7 +2217,7 @@ static int atmel_get_range(struct net_device *dev, int k,i,j; dwrq->length = sizeof(struct iw_range); - memset(range, 0, sizeof(range)); + memset(range, 0, sizeof(struct iw_range)); range->min_nwid = 0x0000; range->max_nwid = 0x0000; range->num_channels = 0; From b69a3aa85cb7bda2eb6c5932a62c1337d0d6612c Mon Sep 17 00:00:00 2001 From: Panagiotis Issaris Date: Tue, 8 Nov 2005 00:03:15 +0100 Subject: [PATCH 9/9] [PATCH] wireless net: Conversions of kmalloc/memset to kzalloc More conversions of kmalloc/memset to kzalloc Signed-off-by: Panagiotis Issaris Signed-off-by: John W. Linville --- drivers/net/wireless/airo.c | 36 +++++++++++-------------------- drivers/net/wireless/airo_cs.c | 6 ++---- drivers/net/wireless/atmel_cs.c | 6 ++---- drivers/net/wireless/ipw2100.c | 4 +--- drivers/net/wireless/wavelan_cs.c | 3 +-- drivers/net/wireless/wl3501_cs.c | 3 +-- 6 files changed, 19 insertions(+), 39 deletions(-) diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 849ac88bcccc..58ca585caa59 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -4533,9 +4533,8 @@ static int proc_status_open( struct inode *inode, struct file *file ) { StatusRid status_rid; int i; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); data = (struct proc_data *)file->private_data; if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { kfree (file->private_data); @@ -4613,9 +4612,8 @@ static int proc_stats_rid_open( struct inode *inode, int i, j; u32 *vals = stats.vals; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); data = (struct proc_data *)file->private_data; if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) { kfree (file->private_data); @@ -4879,20 +4877,18 @@ static int proc_config_open( struct inode *inode, struct file *file ) { struct airo_info *ai = dev->priv; int i; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); data = (struct proc_data *)file->private_data; if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { kfree (file->private_data); return -ENOMEM; } - if ((data->wbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { + if ((data->wbuffer = kzalloc( 2048, GFP_KERNEL )) == NULL) { kfree (data->rbuffer); kfree (file->private_data); return -ENOMEM; } - memset( data->wbuffer, 0, 2048 ); data->maxwritelen = 2048; data->on_close = proc_config_on_close; @@ -5153,24 +5149,21 @@ static int proc_wepkey_open( struct inode *inode, struct file *file ) { int j=0; int rc; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); memset(&wkr, 0, sizeof(wkr)); data = (struct proc_data *)file->private_data; - if ((data->rbuffer = kmalloc( 180, GFP_KERNEL )) == NULL) { + if ((data->rbuffer = kzalloc( 180, GFP_KERNEL )) == NULL) { kfree (file->private_data); return -ENOMEM; } - memset(data->rbuffer, 0, 180); data->writelen = 0; data->maxwritelen = 80; - if ((data->wbuffer = kmalloc( 80, GFP_KERNEL )) == NULL) { + if ((data->wbuffer = kzalloc( 80, GFP_KERNEL )) == NULL) { kfree (data->rbuffer); kfree (file->private_data); return -ENOMEM; } - memset( data->wbuffer, 0, 80 ); data->on_close = proc_wepkey_on_close; ptr = data->rbuffer; @@ -5201,9 +5194,8 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) { char *ptr; SsidRid SSID_rid; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); data = (struct proc_data *)file->private_data; if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { kfree (file->private_data); @@ -5211,12 +5203,11 @@ static int proc_SSID_open( struct inode *inode, struct file *file ) { } data->writelen = 0; data->maxwritelen = 33*3; - if ((data->wbuffer = kmalloc( 33*3, GFP_KERNEL )) == NULL) { + if ((data->wbuffer = kzalloc( 33*3, GFP_KERNEL )) == NULL) { kfree (data->rbuffer); kfree (file->private_data); return -ENOMEM; } - memset( data->wbuffer, 0, 33*3 ); data->on_close = proc_SSID_on_close; readSsidRid(ai, &SSID_rid); @@ -5245,9 +5236,8 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { char *ptr; APListRid APList_rid; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); data = (struct proc_data *)file->private_data; if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { kfree (file->private_data); @@ -5255,12 +5245,11 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { } data->writelen = 0; data->maxwritelen = 4*6*3; - if ((data->wbuffer = kmalloc( data->maxwritelen, GFP_KERNEL )) == NULL) { + if ((data->wbuffer = kzalloc( data->maxwritelen, GFP_KERNEL )) == NULL) { kfree (data->rbuffer); kfree (file->private_data); return -ENOMEM; } - memset( data->wbuffer, 0, data->maxwritelen ); data->on_close = proc_APList_on_close; readAPListRid(ai, &APList_rid); @@ -5295,9 +5284,8 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) { /* If doLoseSync is not 1, we won't do a Lose Sync */ int doLoseSync = -1; - if ((file->private_data = kmalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) + if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) return -ENOMEM; - memset(file->private_data, 0, sizeof(struct proc_data)); data = (struct proc_data *)file->private_data; if ((data->rbuffer = kmalloc( 1024, GFP_KERNEL )) == NULL) { kfree (file->private_data); diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 784de9109113..fee458fd7a4a 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -172,12 +172,11 @@ static dev_link_t *airo_attach(void) DEBUG(0, "airo_attach()\n"); /* Initialize the dev_link_t structure */ - link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); + link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); if (!link) { printk(KERN_ERR "airo_cs: no memory for new device\n"); return NULL; } - memset(link, 0, sizeof(struct dev_link_t)); /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; @@ -196,13 +195,12 @@ static dev_link_t *airo_attach(void) link->conf.IntType = INT_MEMORY_AND_IO; /* Allocate space for private device-specific data */ - local = kmalloc(sizeof(local_info_t), GFP_KERNEL); + local = kzalloc(sizeof(local_info_t), GFP_KERNEL); if (!local) { printk(KERN_ERR "airo_cs: no memory for new device\n"); kfree (link); return NULL; } - memset(local, 0, sizeof(local_info_t)); link->priv = local; /* Register with Card Services */ diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 195cb36619e8..1bd13146c644 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -180,12 +180,11 @@ static dev_link_t *atmel_attach(void) DEBUG(0, "atmel_attach()\n"); /* Initialize the dev_link_t structure */ - link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); + link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); if (!link) { printk(KERN_ERR "atmel_cs: no memory for new device\n"); return NULL; } - memset(link, 0, sizeof(struct dev_link_t)); /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; @@ -204,13 +203,12 @@ static dev_link_t *atmel_attach(void) link->conf.IntType = INT_MEMORY_AND_IO; /* Allocate space for private device-specific data */ - local = kmalloc(sizeof(local_info_t), GFP_KERNEL); + local = kzalloc(sizeof(local_info_t), GFP_KERNEL); if (!local) { printk(KERN_ERR "atmel_cs: no memory for new device\n"); kfree (link); return NULL; } - memset(local, 0, sizeof(local_info_t)); link->priv = local; /* Register with Card Services */ diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index ad7f8cd76db9..4f19ac7d63a8 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -6065,13 +6065,11 @@ static int ipw2100_wpa_set_encryption(struct net_device *dev, ieee80211_crypt_delayed_deinit(ieee, crypt); - new_crypt = (struct ieee80211_crypt_data *) - kmalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); + new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), GFP_KERNEL); if (new_crypt == NULL) { ret = -ENOMEM; goto done; } - memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); new_crypt->ops = ops; if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 4b3c98f5c564..c822cad3333f 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c @@ -4608,9 +4608,8 @@ wavelan_attach(void) #endif /* Initialize the dev_link_t structure */ - link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); + link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL); if (!link) return NULL; - memset(link, 0, sizeof(struct dev_link_t)); /* The io structure describes IO port mapping */ link->io.NumPorts1 = 8; diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 3f8c27f0871b..978fdc606781 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -1965,10 +1965,9 @@ static dev_link_t *wl3501_attach(void) int ret; /* Initialize the dev_link_t structure */ - link = kmalloc(sizeof(*link), GFP_KERNEL); + link = kzalloc(sizeof(*link), GFP_KERNEL); if (!link) goto out; - memset(link, 0, sizeof(struct dev_link_t)); /* The io structure describes IO port mapping */ link->io.NumPorts1 = 16;