aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/atlx/atl2.c22
-rw-r--r--drivers/net/bonding/bond_alb.h2
-rw-r--r--drivers/net/irda/via-ircc.c94
-rw-r--r--drivers/net/mlx4/eq.c4
-rw-r--r--drivers/net/mlx4/mcg.c7
-rw-r--r--drivers/net/phy/phy_device.c8
-rw-r--r--drivers/net/starfire.c6
-rw-r--r--drivers/net/usb/Kconfig15
-rw-r--r--drivers/net/usb/Makefile1
-rw-r--r--drivers/net/usb/cdc_eem.c2
-rw-r--r--drivers/net/usb/cdc_ether.c23
-rw-r--r--drivers/net/usb/cdc_ncm.c2
-rw-r--r--drivers/net/usb/cdc_subset.c8
-rw-r--r--drivers/net/usb/gl620a.c2
-rw-r--r--drivers/net/usb/lg-vl600.c346
-rw-r--r--drivers/net/usb/net1080.c2
-rw-r--r--drivers/net/usb/plusb.c2
-rw-r--r--drivers/net/usb/rndis_host.c2
-rw-r--r--drivers/net/usb/usbnet.c13
-rw-r--r--drivers/net/usb/zaurus.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/hif_usb.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/mac.c25
-rw-r--r--drivers/net/wireless/ath/ath9k/mac.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c16
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c6
-rw-r--r--drivers/net/wireless/ath/carl9170/carl9170.h1
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c1
-rw-r--r--drivers/net/wireless/ath/carl9170/tx.c7
-rw-r--r--drivers/net/wireless/ath/regd_common.h1
-rw-r--r--drivers/net/wireless/b43/dma.c2
-rw-r--r--drivers/net/wireless/b43/dma.h2
-rw-r--r--drivers/net/wireless/iwlegacy/Kconfig9
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945-hw.h2
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-hw.h3
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-tx.c10
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.c27
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-eeprom.c7
-rw-r--r--drivers/net/wireless/iwlegacy/iwl3945-base.c11
-rw-r--r--drivers/net/wireless/iwlegacy/iwl4965-base.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rxon.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.h2
-rw-r--r--drivers/net/wireless/mwl8k.c9
-rw-r--r--drivers/net/wireless/p54/p54usb.c2
-rw-r--r--drivers/net/wireless/p54/txrx.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c10
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c6
-rw-r--r--drivers/net/wireless/rtlwifi/efuse.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c2
-rw-r--r--drivers/net/wireless/rtlwifi/usb.c2
-rw-r--r--drivers/net/wireless/wl12xx/sdio.c2
-rw-r--r--drivers/net/wireless/wl12xx/spi.c2
-rw-r--r--drivers/net/wireless/wl12xx/testmode.c5
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c20
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.h1
57 files changed, 608 insertions, 200 deletions
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index e637e9f28fd4..937ef1afa5db 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -1996,13 +1996,15 @@ static int atl2_set_eeprom(struct net_device *netdev,
1996 if (!eeprom_buff) 1996 if (!eeprom_buff)
1997 return -ENOMEM; 1997 return -ENOMEM;
1998 1998
1999 ptr = (u32 *)eeprom_buff; 1999 ptr = eeprom_buff;
2000 2000
2001 if (eeprom->offset & 3) { 2001 if (eeprom->offset & 3) {
2002 /* need read/modify/write of first changed EEPROM word */ 2002 /* need read/modify/write of first changed EEPROM word */
2003 /* only the second byte of the word is being modified */ 2003 /* only the second byte of the word is being modified */
2004 if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) 2004 if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) {
2005 return -EIO; 2005 ret_val = -EIO;
2006 goto out;
2007 }
2006 ptr++; 2008 ptr++;
2007 } 2009 }
2008 if (((eeprom->offset + eeprom->len) & 3)) { 2010 if (((eeprom->offset + eeprom->len) & 3)) {
@@ -2011,18 +2013,22 @@ static int atl2_set_eeprom(struct net_device *netdev,
2011 * only the first byte of the word is being modified 2013 * only the first byte of the word is being modified
2012 */ 2014 */
2013 if (!atl2_read_eeprom(hw, last_dword * 4, 2015 if (!atl2_read_eeprom(hw, last_dword * 4,
2014 &(eeprom_buff[last_dword - first_dword]))) 2016 &(eeprom_buff[last_dword - first_dword]))) {
2015 return -EIO; 2017 ret_val = -EIO;
2018 goto out;
2019 }
2016 } 2020 }
2017 2021
2018 /* Device's eeprom is always little-endian, word addressable */ 2022 /* Device's eeprom is always little-endian, word addressable */
2019 memcpy(ptr, bytes, eeprom->len); 2023 memcpy(ptr, bytes, eeprom->len);
2020 2024
2021 for (i = 0; i < last_dword - first_dword + 1; i++) { 2025 for (i = 0; i < last_dword - first_dword + 1; i++) {
2022 if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) 2026 if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) {
2023 return -EIO; 2027 ret_val = -EIO;
2028 goto out;
2029 }
2024 } 2030 }
2025 2031 out:
2026 kfree(eeprom_buff); 2032 kfree(eeprom_buff);
2027 return ret_val; 2033 return ret_val;
2028} 2034}
diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h
index 118c28aa471e..4b3e35878406 100644
--- a/drivers/net/bonding/bond_alb.h
+++ b/drivers/net/bonding/bond_alb.h
@@ -74,7 +74,7 @@ struct tlb_client_info {
74 * packets to a Client that the Hash function 74 * packets to a Client that the Hash function
75 * gave this entry index. 75 * gave this entry index.
76 */ 76 */
77 u32 tx_bytes; /* Each Client acumulates the BytesTx that 77 u32 tx_bytes; /* Each Client accumulates the BytesTx that
78 * were tranmitted to it, and after each 78 * were tranmitted to it, and after each
79 * CallBack the LoadHistory is devided 79 * CallBack the LoadHistory is devided
80 * by the balance interval 80 * by the balance interval
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c
index 67c0ad42d818..186cd28a61cc 100644
--- a/drivers/net/irda/via-ircc.c
+++ b/drivers/net/irda/via-ircc.c
@@ -75,15 +75,9 @@ static int dongle_id = 0; /* default: probe */
75/* We can't guess the type of connected dongle, user *must* supply it. */ 75/* We can't guess the type of connected dongle, user *must* supply it. */
76module_param(dongle_id, int, 0); 76module_param(dongle_id, int, 0);
77 77
78/* FIXME : we should not need this, because instances should be automatically
79 * managed by the PCI layer. Especially that we seem to only be using the
80 * first entry. Jean II */
81/* Max 4 instances for now */
82static struct via_ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL };
83
84/* Some prototypes */ 78/* Some prototypes */
85static int via_ircc_open(int i, chipio_t * info, unsigned int id); 79static int via_ircc_open(struct pci_dev *pdev, chipio_t * info,
86static int via_ircc_close(struct via_ircc_cb *self); 80 unsigned int id);
87static int via_ircc_dma_receive(struct via_ircc_cb *self); 81static int via_ircc_dma_receive(struct via_ircc_cb *self);
88static int via_ircc_dma_receive_complete(struct via_ircc_cb *self, 82static int via_ircc_dma_receive_complete(struct via_ircc_cb *self,
89 int iobase); 83 int iobase);
@@ -215,7 +209,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
215 pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0)); 209 pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0));
216 pci_write_config_byte(pcidev,0x5a,0xc0); 210 pci_write_config_byte(pcidev,0x5a,0xc0);
217 WriteLPCReg(0x28, 0x70 ); 211 WriteLPCReg(0x28, 0x70 );
218 if (via_ircc_open(0, &info,0x3076) == 0) 212 if (via_ircc_open(pcidev, &info, 0x3076) == 0)
219 rc=0; 213 rc=0;
220 } else 214 } else
221 rc = -ENODEV; //IR not turn on 215 rc = -ENODEV; //IR not turn on
@@ -254,7 +248,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
254 info.irq=FirIRQ; 248 info.irq=FirIRQ;
255 info.dma=FirDRQ1; 249 info.dma=FirDRQ1;
256 info.dma2=FirDRQ0; 250 info.dma2=FirDRQ0;
257 if (via_ircc_open(0, &info,0x3096) == 0) 251 if (via_ircc_open(pcidev, &info, 0x3096) == 0)
258 rc=0; 252 rc=0;
259 } else 253 } else
260 rc = -ENODEV; //IR not turn on !!!!! 254 rc = -ENODEV; //IR not turn on !!!!!
@@ -264,48 +258,10 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
264 return rc; 258 return rc;
265} 259}
266 260
267/*
268 * Function via_ircc_clean ()
269 *
270 * Close all configured chips
271 *
272 */
273static void via_ircc_clean(void)
274{
275 int i;
276
277 IRDA_DEBUG(3, "%s()\n", __func__);
278
279 for (i=0; i < ARRAY_SIZE(dev_self); i++) {
280 if (dev_self[i])
281 via_ircc_close(dev_self[i]);
282 }
283}
284
285static void __devexit via_remove_one (struct pci_dev *pdev)
286{
287 IRDA_DEBUG(3, "%s()\n", __func__);
288
289 /* FIXME : This is ugly. We should use pci_get_drvdata(pdev);
290 * to get our driver instance and call directly via_ircc_close().
291 * See vlsi_ir for details...
292 * Jean II */
293 via_ircc_clean();
294
295 /* FIXME : This should be in via_ircc_close(), because here we may
296 * theoritically disable still configured devices :-( - Jean II */
297 pci_disable_device(pdev);
298}
299
300static void __exit via_ircc_cleanup(void) 261static void __exit via_ircc_cleanup(void)
301{ 262{
302 IRDA_DEBUG(3, "%s()\n", __func__); 263 IRDA_DEBUG(3, "%s()\n", __func__);
303 264
304 /* FIXME : This should be redundant, as pci_unregister_driver()
305 * should call via_remove_one() on each device.
306 * Jean II */
307 via_ircc_clean();
308
309 /* Cleanup all instances of the driver */ 265 /* Cleanup all instances of the driver */
310 pci_unregister_driver (&via_driver); 266 pci_unregister_driver (&via_driver);
311} 267}
@@ -324,12 +280,13 @@ static const struct net_device_ops via_ircc_fir_ops = {
324}; 280};
325 281
326/* 282/*
327 * Function via_ircc_open (iobase, irq) 283 * Function via_ircc_open(pdev, iobase, irq)
328 * 284 *
329 * Open driver instance 285 * Open driver instance
330 * 286 *
331 */ 287 */
332static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) 288static __devinit int via_ircc_open(struct pci_dev *pdev, chipio_t * info,
289 unsigned int id)
333{ 290{
334 struct net_device *dev; 291 struct net_device *dev;
335 struct via_ircc_cb *self; 292 struct via_ircc_cb *self;
@@ -337,9 +294,6 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
337 294
338 IRDA_DEBUG(3, "%s()\n", __func__); 295 IRDA_DEBUG(3, "%s()\n", __func__);
339 296
340 if (i >= ARRAY_SIZE(dev_self))
341 return -ENOMEM;
342
343 /* Allocate new instance of the driver */ 297 /* Allocate new instance of the driver */
344 dev = alloc_irdadev(sizeof(struct via_ircc_cb)); 298 dev = alloc_irdadev(sizeof(struct via_ircc_cb));
345 if (dev == NULL) 299 if (dev == NULL)
@@ -349,13 +303,8 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
349 self->netdev = dev; 303 self->netdev = dev;
350 spin_lock_init(&self->lock); 304 spin_lock_init(&self->lock);
351 305
352 /* FIXME : We should store our driver instance in the PCI layer, 306 pci_set_drvdata(pdev, self);
353 * using pci_set_drvdata(), not in this array. 307
354 * See vlsi_ir for details... - Jean II */
355 /* FIXME : 'i' is always 0 (see via_init_one()) :-( - Jean II */
356 /* Need to store self somewhere */
357 dev_self[i] = self;
358 self->index = i;
359 /* Initialize Resource */ 308 /* Initialize Resource */
360 self->io.cfg_base = info->cfg_base; 309 self->io.cfg_base = info->cfg_base;
361 self->io.fir_base = info->fir_base; 310 self->io.fir_base = info->fir_base;
@@ -414,7 +363,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
414 363
415 /* Allocate memory if needed */ 364 /* Allocate memory if needed */
416 self->rx_buff.head = 365 self->rx_buff.head =
417 dma_alloc_coherent(NULL, self->rx_buff.truesize, 366 dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize,
418 &self->rx_buff_dma, GFP_KERNEL); 367 &self->rx_buff_dma, GFP_KERNEL);
419 if (self->rx_buff.head == NULL) { 368 if (self->rx_buff.head == NULL) {
420 err = -ENOMEM; 369 err = -ENOMEM;
@@ -423,7 +372,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
423 memset(self->rx_buff.head, 0, self->rx_buff.truesize); 372 memset(self->rx_buff.head, 0, self->rx_buff.truesize);
424 373
425 self->tx_buff.head = 374 self->tx_buff.head =
426 dma_alloc_coherent(NULL, self->tx_buff.truesize, 375 dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize,
427 &self->tx_buff_dma, GFP_KERNEL); 376 &self->tx_buff_dma, GFP_KERNEL);
428 if (self->tx_buff.head == NULL) { 377 if (self->tx_buff.head == NULL) {
429 err = -ENOMEM; 378 err = -ENOMEM;
@@ -455,33 +404,32 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
455 via_hw_init(self); 404 via_hw_init(self);
456 return 0; 405 return 0;
457 err_out4: 406 err_out4:
458 dma_free_coherent(NULL, self->tx_buff.truesize, 407 dma_free_coherent(&pdev->dev, self->tx_buff.truesize,
459 self->tx_buff.head, self->tx_buff_dma); 408 self->tx_buff.head, self->tx_buff_dma);
460 err_out3: 409 err_out3:
461 dma_free_coherent(NULL, self->rx_buff.truesize, 410 dma_free_coherent(&pdev->dev, self->rx_buff.truesize,
462 self->rx_buff.head, self->rx_buff_dma); 411 self->rx_buff.head, self->rx_buff_dma);
463 err_out2: 412 err_out2:
464 release_region(self->io.fir_base, self->io.fir_ext); 413 release_region(self->io.fir_base, self->io.fir_ext);
465 err_out1: 414 err_out1:
415 pci_set_drvdata(pdev, NULL);
466 free_netdev(dev); 416 free_netdev(dev);
467 dev_self[i] = NULL;
468 return err; 417 return err;
469} 418}
470 419
471/* 420/*
472 * Function via_ircc_close (self) 421 * Function via_remove_one(pdev)
473 * 422 *
474 * Close driver instance 423 * Close driver instance
475 * 424 *
476 */ 425 */
477static int via_ircc_close(struct via_ircc_cb *self) 426static void __devexit via_remove_one(struct pci_dev *pdev)
478{ 427{
428 struct via_ircc_cb *self = pci_get_drvdata(pdev);
479 int iobase; 429 int iobase;
480 430
481 IRDA_DEBUG(3, "%s()\n", __func__); 431 IRDA_DEBUG(3, "%s()\n", __func__);
482 432
483 IRDA_ASSERT(self != NULL, return -1;);
484
485 iobase = self->io.fir_base; 433 iobase = self->io.fir_base;
486 434
487 ResetChip(iobase, 5); //hardware reset. 435 ResetChip(iobase, 5); //hardware reset.
@@ -493,16 +441,16 @@ static int via_ircc_close(struct via_ircc_cb *self)
493 __func__, self->io.fir_base); 441 __func__, self->io.fir_base);
494 release_region(self->io.fir_base, self->io.fir_ext); 442 release_region(self->io.fir_base, self->io.fir_ext);
495 if (self->tx_buff.head) 443 if (self->tx_buff.head)
496 dma_free_coherent(NULL, self->tx_buff.truesize, 444 dma_free_coherent(&pdev->dev, self->tx_buff.truesize,
497 self->tx_buff.head, self->tx_buff_dma); 445 self->tx_buff.head, self->tx_buff_dma);
498 if (self->rx_buff.head) 446 if (self->rx_buff.head)
499 dma_free_coherent(NULL, self->rx_buff.truesize, 447 dma_free_coherent(&pdev->dev, self->rx_buff.truesize,
500 self->rx_buff.head, self->rx_buff_dma); 448 self->rx_buff.head, self->rx_buff_dma);
501 dev_self[self->index] = NULL; 449 pci_set_drvdata(pdev, NULL);
502 450
503 free_netdev(self->netdev); 451 free_netdev(self->netdev);
504 452
505 return 0; 453 pci_disable_device(pdev);
506} 454}
507 455
508/* 456/*
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
index 506cfd0372ec..1ad1f6029af8 100644
--- a/drivers/net/mlx4/eq.c
+++ b/drivers/net/mlx4/eq.c
@@ -603,7 +603,9 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
603 } 603 }
604 604
605 for (i = 0; i < dev->caps.num_comp_vectors; ++i) { 605 for (i = 0; i < dev->caps.num_comp_vectors; ++i) {
606 err = mlx4_create_eq(dev, dev->caps.num_cqs + MLX4_NUM_SPARE_EQE, 606 err = mlx4_create_eq(dev, dev->caps.num_cqs -
607 dev->caps.reserved_cqs +
608 MLX4_NUM_SPARE_EQE,
607 (dev->flags & MLX4_FLAG_MSI_X) ? i : 0, 609 (dev->flags & MLX4_FLAG_MSI_X) ? i : 0,
608 &priv->eq_table.eq[i]); 610 &priv->eq_table.eq[i]);
609 if (err) { 611 if (err) {
diff --git a/drivers/net/mlx4/mcg.c b/drivers/net/mlx4/mcg.c
index e71372aa9cc4..c6d336aed2d9 100644
--- a/drivers/net/mlx4/mcg.c
+++ b/drivers/net/mlx4/mcg.c
@@ -111,7 +111,7 @@ static int new_steering_entry(struct mlx4_dev *dev, u8 vep_num, u8 port,
111 u32 members_count; 111 u32 members_count;
112 struct mlx4_steer_index *new_entry; 112 struct mlx4_steer_index *new_entry;
113 struct mlx4_promisc_qp *pqp; 113 struct mlx4_promisc_qp *pqp;
114 struct mlx4_promisc_qp *dqp; 114 struct mlx4_promisc_qp *dqp = NULL;
115 u32 prot; 115 u32 prot;
116 int err; 116 int err;
117 u8 pf_num; 117 u8 pf_num;
@@ -184,7 +184,7 @@ out_mailbox:
184out_alloc: 184out_alloc:
185 if (dqp) { 185 if (dqp) {
186 list_del(&dqp->list); 186 list_del(&dqp->list);
187 kfree(&dqp); 187 kfree(dqp);
188 } 188 }
189 list_del(&new_entry->list); 189 list_del(&new_entry->list);
190 kfree(new_entry); 190 kfree(new_entry);
@@ -469,7 +469,6 @@ static int remove_promisc_qp(struct mlx4_dev *dev, u8 vep_num, u8 port,
469 469
470 /*remove from list of promisc qps */ 470 /*remove from list of promisc qps */
471 list_del(&pqp->list); 471 list_del(&pqp->list);
472 kfree(pqp);
473 472
474 /* set the default entry not to include the removed one */ 473 /* set the default entry not to include the removed one */
475 mailbox = mlx4_alloc_cmd_mailbox(dev); 474 mailbox = mlx4_alloc_cmd_mailbox(dev);
@@ -528,6 +527,8 @@ out_mailbox:
528out_list: 527out_list:
529 if (back_to_list) 528 if (back_to_list)
530 list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]); 529 list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]);
530 else
531 kfree(pqp);
531out_mutex: 532out_mutex:
532 mutex_unlock(&priv->mcg_table.mutex); 533 mutex_unlock(&priv->mcg_table.mutex);
533 return err; 534 return err;
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 993c52c82aeb..e870c0698bbe 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -442,11 +442,11 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
442 u32 flags, phy_interface_t interface) 442 u32 flags, phy_interface_t interface)
443{ 443{
444 struct device *d = &phydev->dev; 444 struct device *d = &phydev->dev;
445 int err;
445 446
446 /* Assume that if there is no driver, that it doesn't 447 /* Assume that if there is no driver, that it doesn't
447 * exist, and we should use the genphy driver. */ 448 * exist, and we should use the genphy driver. */
448 if (NULL == d->driver) { 449 if (NULL == d->driver) {
449 int err;
450 d->driver = &genphy_driver.driver; 450 d->driver = &genphy_driver.driver;
451 451
452 err = d->driver->probe(d); 452 err = d->driver->probe(d);
@@ -474,7 +474,11 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
474 /* Do initial configuration here, now that 474 /* Do initial configuration here, now that
475 * we have certain key parameters 475 * we have certain key parameters
476 * (dev_flags and interface) */ 476 * (dev_flags and interface) */
477 return phy_init_hw(phydev); 477 err = phy_init_hw(phydev);
478 if (err)
479 phy_detach(phydev);
480
481 return err;
478} 482}
479 483
480/** 484/**
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index a4f2bd52e546..36045f3b0327 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -144,11 +144,7 @@ static int full_duplex[MAX_UNITS] = {0, };
144/* Time in jiffies before concluding the transmitter is hung. */ 144/* Time in jiffies before concluding the transmitter is hung. */
145#define TX_TIMEOUT (2 * HZ) 145#define TX_TIMEOUT (2 * HZ)
146 146
147/* 147#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
148 * This SUCKS.
149 * We need a much better method to determine if dma_addr_t is 64-bit.
150 */
151#if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__alpha__) || (defined(CONFIG_MIPS) && ((defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) || defined(CONFIG_64BIT))) || (defined(__powerpc64__) || defined(CONFIG_PHYS_64BIT))
152/* 64-bit dma_addr_t */ 148/* 64-bit dma_addr_t */
153#define ADDR_64BITS /* This chip uses 64 bit addresses. */ 149#define ADDR_64BITS /* This chip uses 64 bit addresses. */
154#define netdrv_addr_t __le64 150#define netdrv_addr_t __le64
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 6f600cced6e1..3ec22c307797 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -433,4 +433,19 @@ config USB_SIERRA_NET
433 To compile this driver as a module, choose M here: the 433 To compile this driver as a module, choose M here: the
434 module will be called sierra_net. 434 module will be called sierra_net.
435 435
436config USB_VL600
437 tristate "LG VL600 modem dongle"
438 depends on USB_NET_CDCETHER
439 select USB_ACM
440 help
441 Select this if you want to use an LG Electronics 4G/LTE usb modem
442 called VL600. This driver only handles the ethernet
443 interface exposed by the modem firmware. To establish a connection
444 you will first need a userspace program that sends the right
445 command to the modem through its CDC ACM port, and most
446 likely also a DHCP client. See this thread about using the
447 4G modem from Verizon:
448
449 http://ubuntuforums.org/showpost.php?p=10589647&postcount=17
450
436endmenu 451endmenu
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index cac170301187..c7ec8a5f0a90 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -27,4 +27,5 @@ obj-$(CONFIG_USB_IPHETH) += ipheth.o
27obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o 27obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o
28obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o 28obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o
29obj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o 29obj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o
30obj-$(CONFIG_USB_VL600) += lg-vl600.o
30 31
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
index 5f3b97668e63..8f128541656d 100644
--- a/drivers/net/usb/cdc_eem.c
+++ b/drivers/net/usb/cdc_eem.c
@@ -340,7 +340,7 @@ next:
340 340
341static const struct driver_info eem_info = { 341static const struct driver_info eem_info = {
342 .description = "CDC EEM Device", 342 .description = "CDC EEM Device",
343 .flags = FLAG_ETHER, 343 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
344 .bind = eem_bind, 344 .bind = eem_bind,
345 .rx_fixup = eem_rx_fixup, 345 .rx_fixup = eem_rx_fixup,
346 .tx_fixup = eem_tx_fixup, 346 .tx_fixup = eem_tx_fixup,
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 9a60e415d76b..341f7056a800 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -378,7 +378,7 @@ static void dumpspeed(struct usbnet *dev, __le32 *speeds)
378 __le32_to_cpu(speeds[1]) / 1000); 378 __le32_to_cpu(speeds[1]) / 1000);
379} 379}
380 380
381static void cdc_status(struct usbnet *dev, struct urb *urb) 381void usbnet_cdc_status(struct usbnet *dev, struct urb *urb)
382{ 382{
383 struct usb_cdc_notification *event; 383 struct usb_cdc_notification *event;
384 384
@@ -418,8 +418,9 @@ static void cdc_status(struct usbnet *dev, struct urb *urb)
418 break; 418 break;
419 } 419 }
420} 420}
421EXPORT_SYMBOL_GPL(usbnet_cdc_status);
421 422
422static int cdc_bind(struct usbnet *dev, struct usb_interface *intf) 423int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
423{ 424{
424 int status; 425 int status;
425 struct cdc_state *info = (void *) &dev->data; 426 struct cdc_state *info = (void *) &dev->data;
@@ -441,6 +442,7 @@ static int cdc_bind(struct usbnet *dev, struct usb_interface *intf)
441 */ 442 */
442 return 0; 443 return 0;
443} 444}
445EXPORT_SYMBOL_GPL(usbnet_cdc_bind);
444 446
445static int cdc_manage_power(struct usbnet *dev, int on) 447static int cdc_manage_power(struct usbnet *dev, int on)
446{ 448{
@@ -450,20 +452,20 @@ static int cdc_manage_power(struct usbnet *dev, int on)
450 452
451static const struct driver_info cdc_info = { 453static const struct driver_info cdc_info = {
452 .description = "CDC Ethernet Device", 454 .description = "CDC Ethernet Device",
453 .flags = FLAG_ETHER, 455 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
454 // .check_connect = cdc_check_connect, 456 // .check_connect = cdc_check_connect,
455 .bind = cdc_bind, 457 .bind = usbnet_cdc_bind,
456 .unbind = usbnet_cdc_unbind, 458 .unbind = usbnet_cdc_unbind,
457 .status = cdc_status, 459 .status = usbnet_cdc_status,
458 .manage_power = cdc_manage_power, 460 .manage_power = cdc_manage_power,
459}; 461};
460 462
461static const struct driver_info mbm_info = { 463static const struct driver_info mbm_info = {
462 .description = "Mobile Broadband Network Device", 464 .description = "Mobile Broadband Network Device",
463 .flags = FLAG_WWAN, 465 .flags = FLAG_WWAN,
464 .bind = cdc_bind, 466 .bind = usbnet_cdc_bind,
465 .unbind = usbnet_cdc_unbind, 467 .unbind = usbnet_cdc_unbind,
466 .status = cdc_status, 468 .status = usbnet_cdc_status,
467 .manage_power = cdc_manage_power, 469 .manage_power = cdc_manage_power,
468}; 470};
469 471
@@ -560,6 +562,13 @@ static const struct usb_device_id products [] = {
560 .driver_info = 0, 562 .driver_info = 0,
561}, 563},
562 564
565/* LG Electronics VL600 wants additional headers on every frame */
566{
567 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
568 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
569 .driver_info = 0,
570},
571
563/* 572/*
564 * WHITELIST!!! 573 * WHITELIST!!!
565 * 574 *
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 7113168473cf..967371f04454 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1237,7 +1237,7 @@ static int cdc_ncm_manage_power(struct usbnet *dev, int status)
1237 1237
1238static const struct driver_info cdc_ncm_info = { 1238static const struct driver_info cdc_ncm_info = {
1239 .description = "CDC NCM", 1239 .description = "CDC NCM",
1240 .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET, 1240 .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET,
1241 .bind = cdc_ncm_bind, 1241 .bind = cdc_ncm_bind,
1242 .unbind = cdc_ncm_unbind, 1242 .unbind = cdc_ncm_unbind,
1243 .check_connect = cdc_ncm_check_connect, 1243 .check_connect = cdc_ncm_check_connect,
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c
index ca39ace0b0eb..fc5f13d47ad9 100644
--- a/drivers/net/usb/cdc_subset.c
+++ b/drivers/net/usb/cdc_subset.c
@@ -89,6 +89,7 @@ static int always_connected (struct usbnet *dev)
89 89
90static const struct driver_info ali_m5632_info = { 90static const struct driver_info ali_m5632_info = {
91 .description = "ALi M5632", 91 .description = "ALi M5632",
92 .flags = FLAG_POINTTOPOINT,
92}; 93};
93 94
94#endif 95#endif
@@ -110,6 +111,7 @@ static const struct driver_info ali_m5632_info = {
110 111
111static const struct driver_info an2720_info = { 112static const struct driver_info an2720_info = {
112 .description = "AnchorChips/Cypress 2720", 113 .description = "AnchorChips/Cypress 2720",
114 .flags = FLAG_POINTTOPOINT,
113 // no reset available! 115 // no reset available!
114 // no check_connect available! 116 // no check_connect available!
115 117
@@ -132,6 +134,7 @@ static const struct driver_info an2720_info = {
132 134
133static const struct driver_info belkin_info = { 135static const struct driver_info belkin_info = {
134 .description = "Belkin, eTEK, or compatible", 136 .description = "Belkin, eTEK, or compatible",
137 .flags = FLAG_POINTTOPOINT,
135}; 138};
136 139
137#endif /* CONFIG_USB_BELKIN */ 140#endif /* CONFIG_USB_BELKIN */
@@ -157,6 +160,7 @@ static const struct driver_info belkin_info = {
157static const struct driver_info epson2888_info = { 160static const struct driver_info epson2888_info = {
158 .description = "Epson USB Device", 161 .description = "Epson USB Device",
159 .check_connect = always_connected, 162 .check_connect = always_connected,
163 .flags = FLAG_POINTTOPOINT,
160 164
161 .in = 4, .out = 3, 165 .in = 4, .out = 3,
162}; 166};
@@ -173,6 +177,7 @@ static const struct driver_info epson2888_info = {
173#define HAVE_HARDWARE 177#define HAVE_HARDWARE
174static const struct driver_info kc2190_info = { 178static const struct driver_info kc2190_info = {
175 .description = "KC Technology KC-190", 179 .description = "KC Technology KC-190",
180 .flags = FLAG_POINTTOPOINT,
176}; 181};
177#endif /* CONFIG_USB_KC2190 */ 182#endif /* CONFIG_USB_KC2190 */
178 183
@@ -200,16 +205,19 @@ static const struct driver_info kc2190_info = {
200static const struct driver_info linuxdev_info = { 205static const struct driver_info linuxdev_info = {
201 .description = "Linux Device", 206 .description = "Linux Device",
202 .check_connect = always_connected, 207 .check_connect = always_connected,
208 .flags = FLAG_POINTTOPOINT,
203}; 209};
204 210
205static const struct driver_info yopy_info = { 211static const struct driver_info yopy_info = {
206 .description = "Yopy", 212 .description = "Yopy",
207 .check_connect = always_connected, 213 .check_connect = always_connected,
214 .flags = FLAG_POINTTOPOINT,
208}; 215};
209 216
210static const struct driver_info blob_info = { 217static const struct driver_info blob_info = {
211 .description = "Boot Loader OBject", 218 .description = "Boot Loader OBject",
212 .check_connect = always_connected, 219 .check_connect = always_connected,
220 .flags = FLAG_POINTTOPOINT,
213}; 221};
214 222
215#endif /* CONFIG_USB_ARMLINUX */ 223#endif /* CONFIG_USB_ARMLINUX */
diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c
index dcd57c37ef73..c4cfd1dea881 100644
--- a/drivers/net/usb/gl620a.c
+++ b/drivers/net/usb/gl620a.c
@@ -193,7 +193,7 @@ static int genelink_bind(struct usbnet *dev, struct usb_interface *intf)
193 193
194static const struct driver_info genelink_info = { 194static const struct driver_info genelink_info = {
195 .description = "Genesys GeneLink", 195 .description = "Genesys GeneLink",
196 .flags = FLAG_FRAMING_GL | FLAG_NO_SETINT, 196 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_GL | FLAG_NO_SETINT,
197 .bind = genelink_bind, 197 .bind = genelink_bind,
198 .rx_fixup = genelink_rx_fixup, 198 .rx_fixup = genelink_rx_fixup,
199 .tx_fixup = genelink_tx_fixup, 199 .tx_fixup = genelink_tx_fixup,
diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c
new file mode 100644
index 000000000000..1d83ccfd7277
--- /dev/null
+++ b/drivers/net/usb/lg-vl600.c
@@ -0,0 +1,346 @@
1/*
2 * Ethernet interface part of the LG VL600 LTE modem (4G dongle)
3 *
4 * Copyright (C) 2011 Intel Corporation
5 * Author: Andrzej Zaborowski <balrogg@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/etherdevice.h>
22#include <linux/ethtool.h>
23#include <linux/mii.h>
24#include <linux/usb.h>
25#include <linux/usb/cdc.h>
26#include <linux/usb/usbnet.h>
27#include <linux/if_ether.h>
28#include <linux/if_arp.h>
29#include <linux/inetdevice.h>
30
31/*
32 * The device has a CDC ACM port for modem control (it claims to be
33 * CDC ACM anyway) and a CDC Ethernet port for actual network data.
34 * It will however ignore data on both ports that is not encapsulated
35 * in a specific way, any data returned is also encapsulated the same
36 * way. The headers don't seem to follow any popular standard.
37 *
38 * This driver adds and strips these headers from the ethernet frames
39 * sent/received from the CDC Ethernet port. The proprietary header
40 * replaces the standard ethernet header in a packet so only actual
41 * ethernet frames are allowed. The headers allow some form of
42 * multiplexing by using non standard values of the .h_proto field.
43 * Windows/Mac drivers do send a couple of such frames to the device
44 * during initialisation, with protocol set to 0x0906 or 0x0b06 and (what
45 * seems to be) a flag in the .dummy_flags. This doesn't seem necessary
46 * for modem operation but can possibly be used for GPS or other funcitons.
47 */
48
49struct vl600_frame_hdr {
50 __le32 len;
51 __le32 serial;
52 __le32 pkt_cnt;
53 __le32 dummy_flags;
54 __le32 dummy;
55 __le32 magic;
56} __attribute__((packed));
57
58struct vl600_pkt_hdr {
59 __le32 dummy[2];
60 __le32 len;
61 __be16 h_proto;
62} __attribute__((packed));
63
64struct vl600_state {
65 struct sk_buff *current_rx_buf;
66};
67
68static int vl600_bind(struct usbnet *dev, struct usb_interface *intf)
69{
70 int ret;
71 struct vl600_state *s = kzalloc(sizeof(struct vl600_state), GFP_KERNEL);
72
73 if (!s)
74 return -ENOMEM;
75
76 ret = usbnet_cdc_bind(dev, intf);
77 if (ret) {
78 kfree(s);
79 return ret;
80 }
81
82 dev->driver_priv = s;
83
84 /* ARP packets don't go through, but they're also of no use. The
85 * subnet has only two hosts anyway: us and the gateway / DHCP
86 * server (probably simulated by modem firmware or network operator)
87 * whose address changes everytime we connect to the intarwebz and
88 * who doesn't bother answering ARP requests either. So hardware
89 * addresses have no meaning, the destination and the source of every
90 * packet depend only on whether it is on the IN or OUT endpoint. */
91 dev->net->flags |= IFF_NOARP;
92
93 return ret;
94}
95
96static void vl600_unbind(struct usbnet *dev, struct usb_interface *intf)
97{
98 struct vl600_state *s = dev->driver_priv;
99
100 if (s->current_rx_buf)
101 dev_kfree_skb(s->current_rx_buf);
102
103 kfree(s);
104
105 return usbnet_cdc_unbind(dev, intf);
106}
107
108static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
109{
110 struct vl600_frame_hdr *frame;
111 struct vl600_pkt_hdr *packet;
112 struct ethhdr *ethhdr;
113 int packet_len, count;
114 struct sk_buff *buf = skb;
115 struct sk_buff *clone;
116 struct vl600_state *s = dev->driver_priv;
117
118 /* Frame lengths are generally 4B multiplies but every couple of
119 * hours there's an odd number of bytes sized yet correct frame,
120 * so don't require this. */
121
122 /* Allow a packet (or multiple packets batched together) to be
123 * split across many frames. We don't allow a new batch to
124 * begin in the same frame another one is ending however, and no
125 * leading or trailing pad bytes. */
126 if (s->current_rx_buf) {
127 frame = (struct vl600_frame_hdr *) s->current_rx_buf->data;
128 if (skb->len + s->current_rx_buf->len >
129 le32_to_cpup(&frame->len)) {
130 netif_err(dev, ifup, dev->net, "Fragment too long\n");
131 dev->net->stats.rx_length_errors++;
132 goto error;
133 }
134
135 buf = s->current_rx_buf;
136 memcpy(skb_put(buf, skb->len), skb->data, skb->len);
137 } else if (skb->len < 4) {
138 netif_err(dev, ifup, dev->net, "Frame too short\n");
139 dev->net->stats.rx_length_errors++;
140 goto error;
141 }
142
143 frame = (struct vl600_frame_hdr *) buf->data;
144 /* NOTE: Should check that frame->magic == 0x53544448?
145 * Otherwise if we receive garbage at the beginning of the frame
146 * we may end up allocating a huge buffer and saving all the
147 * future incoming data into it. */
148
149 if (buf->len < sizeof(*frame) ||
150 buf->len != le32_to_cpup(&frame->len)) {
151 /* Save this fragment for later assembly */
152 if (s->current_rx_buf)
153 return 0;
154
155 s->current_rx_buf = skb_copy_expand(skb, 0,
156 le32_to_cpup(&frame->len), GFP_ATOMIC);
157 if (!s->current_rx_buf) {
158 netif_err(dev, ifup, dev->net, "Reserving %i bytes "
159 "for packet assembly failed.\n",
160 le32_to_cpup(&frame->len));
161 dev->net->stats.rx_errors++;
162 }
163
164 return 0;
165 }
166
167 count = le32_to_cpup(&frame->pkt_cnt);
168
169 skb_pull(buf, sizeof(*frame));
170
171 while (count--) {
172 if (buf->len < sizeof(*packet)) {
173 netif_err(dev, ifup, dev->net, "Packet too short\n");
174 goto error;
175 }
176
177 packet = (struct vl600_pkt_hdr *) buf->data;
178 packet_len = sizeof(*packet) + le32_to_cpup(&packet->len);
179 if (packet_len > buf->len) {
180 netif_err(dev, ifup, dev->net,
181 "Bad packet length stored in header\n");
182 goto error;
183 }
184
185 /* Packet header is same size as the ethernet header
186 * (sizeof(*packet) == sizeof(*ethhdr)), additionally
187 * the h_proto field is in the same place so we just leave it
188 * alone and fill in the remaining fields.
189 */
190 ethhdr = (struct ethhdr *) skb->data;
191 if (be16_to_cpup(&ethhdr->h_proto) == ETH_P_ARP &&
192 buf->len > 0x26) {
193 /* Copy the addresses from packet contents */
194 memcpy(ethhdr->h_source,
195 &buf->data[sizeof(*ethhdr) + 0x8],
196 ETH_ALEN);
197 memcpy(ethhdr->h_dest,
198 &buf->data[sizeof(*ethhdr) + 0x12],
199 ETH_ALEN);
200 } else {
201 memset(ethhdr->h_source, 0, ETH_ALEN);
202 memcpy(ethhdr->h_dest, dev->net->dev_addr, ETH_ALEN);
203 }
204
205 if (count) {
206 /* Not the last packet in this batch */
207 clone = skb_clone(buf, GFP_ATOMIC);
208 if (!clone)
209 goto error;
210
211 skb_trim(clone, packet_len);
212 usbnet_skb_return(dev, clone);
213
214 skb_pull(buf, (packet_len + 3) & ~3);
215 } else {
216 skb_trim(buf, packet_len);
217
218 if (s->current_rx_buf) {
219 usbnet_skb_return(dev, buf);
220 s->current_rx_buf = NULL;
221 return 0;
222 }
223
224 return 1;
225 }
226 }
227
228error:
229 if (s->current_rx_buf) {
230 dev_kfree_skb_any(s->current_rx_buf);
231 s->current_rx_buf = NULL;
232 }
233 dev->net->stats.rx_errors++;
234 return 0;
235}
236
237static struct sk_buff *vl600_tx_fixup(struct usbnet *dev,
238 struct sk_buff *skb, gfp_t flags)
239{
240 struct sk_buff *ret;
241 struct vl600_frame_hdr *frame;
242 struct vl600_pkt_hdr *packet;
243 static uint32_t serial = 1;
244 int orig_len = skb->len - sizeof(struct ethhdr);
245 int full_len = (skb->len + sizeof(struct vl600_frame_hdr) + 3) & ~3;
246
247 frame = (struct vl600_frame_hdr *) skb->data;
248 if (skb->len > sizeof(*frame) && skb->len == le32_to_cpup(&frame->len))
249 return skb; /* Already encapsulated? */
250
251 if (skb->len < sizeof(struct ethhdr))
252 /* Drop, device can only deal with ethernet packets */
253 return NULL;
254
255 if (!skb_cloned(skb)) {
256 int headroom = skb_headroom(skb);
257 int tailroom = skb_tailroom(skb);
258
259 if (tailroom >= full_len - skb->len - sizeof(*frame) &&
260 headroom >= sizeof(*frame))
261 /* There's enough head and tail room */
262 goto encapsulate;
263
264 if (headroom + tailroom + skb->len >= full_len) {
265 /* There's enough total room, just readjust */
266 skb->data = memmove(skb->head + sizeof(*frame),
267 skb->data, skb->len);
268 skb_set_tail_pointer(skb, skb->len);
269 goto encapsulate;
270 }
271 }
272
273 /* Alloc a new skb with the required size */
274 ret = skb_copy_expand(skb, sizeof(struct vl600_frame_hdr), full_len -
275 skb->len - sizeof(struct vl600_frame_hdr), flags);
276 dev_kfree_skb_any(skb);
277 if (!ret)
278 return ret;
279 skb = ret;
280
281encapsulate:
282 /* Packet header is same size as ethernet packet header
283 * (sizeof(*packet) == sizeof(struct ethhdr)), additionally the
284 * h_proto field is in the same place so we just leave it alone and
285 * overwrite the remaining fields.
286 */
287 packet = (struct vl600_pkt_hdr *) skb->data;
288 memset(&packet->dummy, 0, sizeof(packet->dummy));
289 packet->len = cpu_to_le32(orig_len);
290
291 frame = (struct vl600_frame_hdr *) skb_push(skb, sizeof(*frame));
292 memset(frame, 0, sizeof(*frame));
293 frame->len = cpu_to_le32(full_len);
294 frame->serial = cpu_to_le32(serial++);
295 frame->pkt_cnt = cpu_to_le32(1);
296
297 if (skb->len < full_len) /* Pad */
298 skb_put(skb, full_len - skb->len);
299
300 return skb;
301}
302
303static const struct driver_info vl600_info = {
304 .description = "LG VL600 modem",
305 .flags = FLAG_ETHER | FLAG_RX_ASSEMBLE,
306 .bind = vl600_bind,
307 .unbind = vl600_unbind,
308 .status = usbnet_cdc_status,
309 .rx_fixup = vl600_rx_fixup,
310 .tx_fixup = vl600_tx_fixup,
311};
312
313static const struct usb_device_id products[] = {
314 {
315 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
316 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
317 .driver_info = (unsigned long) &vl600_info,
318 },
319 {}, /* End */
320};
321MODULE_DEVICE_TABLE(usb, products);
322
323static struct usb_driver lg_vl600_driver = {
324 .name = "lg-vl600",
325 .id_table = products,
326 .probe = usbnet_probe,
327 .disconnect = usbnet_disconnect,
328 .suspend = usbnet_suspend,
329 .resume = usbnet_resume,
330};
331
332static int __init vl600_init(void)
333{
334 return usb_register(&lg_vl600_driver);
335}
336module_init(vl600_init);
337
338static void __exit vl600_exit(void)
339{
340 usb_deregister(&lg_vl600_driver);
341}
342module_exit(vl600_exit);
343
344MODULE_AUTHOR("Anrzej Zaborowski");
345MODULE_DESCRIPTION("LG-VL600 modem's ethernet link");
346MODULE_LICENSE("GPL");
diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c
index ba72a7281cb0..01db4602a39e 100644
--- a/drivers/net/usb/net1080.c
+++ b/drivers/net/usb/net1080.c
@@ -560,7 +560,7 @@ static int net1080_bind(struct usbnet *dev, struct usb_interface *intf)
560 560
561static const struct driver_info net1080_info = { 561static const struct driver_info net1080_info = {
562 .description = "NetChip TurboCONNECT", 562 .description = "NetChip TurboCONNECT",
563 .flags = FLAG_FRAMING_NC, 563 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_NC,
564 .bind = net1080_bind, 564 .bind = net1080_bind,
565 .reset = net1080_reset, 565 .reset = net1080_reset,
566 .check_connect = net1080_check_connect, 566 .check_connect = net1080_check_connect,
diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c
index 08ad269f6b4e..823c53751307 100644
--- a/drivers/net/usb/plusb.c
+++ b/drivers/net/usb/plusb.c
@@ -96,7 +96,7 @@ static int pl_reset(struct usbnet *dev)
96 96
97static const struct driver_info prolific_info = { 97static const struct driver_info prolific_info = {
98 .description = "Prolific PL-2301/PL-2302", 98 .description = "Prolific PL-2301/PL-2302",
99 .flags = FLAG_NO_SETINT, 99 .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT,
100 /* some PL-2302 versions seem to fail usb_set_interface() */ 100 /* some PL-2302 versions seem to fail usb_set_interface() */
101 .reset = pl_reset, 101 .reset = pl_reset,
102}; 102};
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index dd8a4adf48ca..5994a25c56ac 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -573,7 +573,7 @@ EXPORT_SYMBOL_GPL(rndis_tx_fixup);
573 573
574static const struct driver_info rndis_info = { 574static const struct driver_info rndis_info = {
575 .description = "RNDIS device", 575 .description = "RNDIS device",
576 .flags = FLAG_ETHER | FLAG_FRAMING_RN | FLAG_NO_SETINT, 576 .flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT,
577 .bind = rndis_bind, 577 .bind = rndis_bind,
578 .unbind = rndis_unbind, 578 .unbind = rndis_unbind,
579 .status = rndis_status, 579 .status = rndis_status,
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 95c41d56631c..069c1cf0fdf7 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -387,8 +387,12 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
387static inline void rx_process (struct usbnet *dev, struct sk_buff *skb) 387static inline void rx_process (struct usbnet *dev, struct sk_buff *skb)
388{ 388{
389 if (dev->driver_info->rx_fixup && 389 if (dev->driver_info->rx_fixup &&
390 !dev->driver_info->rx_fixup (dev, skb)) 390 !dev->driver_info->rx_fixup (dev, skb)) {
391 goto error; 391 /* With RX_ASSEMBLE, rx_fixup() must update counters */
392 if (!(dev->driver_info->flags & FLAG_RX_ASSEMBLE))
393 dev->net->stats.rx_errors++;
394 goto done;
395 }
392 // else network stack removes extra byte if we forced a short packet 396 // else network stack removes extra byte if we forced a short packet
393 397
394 if (skb->len) { 398 if (skb->len) {
@@ -401,8 +405,8 @@ static inline void rx_process (struct usbnet *dev, struct sk_buff *skb)
401 } 405 }
402 406
403 netif_dbg(dev, rx_err, dev->net, "drop\n"); 407 netif_dbg(dev, rx_err, dev->net, "drop\n");
404error:
405 dev->net->stats.rx_errors++; 408 dev->net->stats.rx_errors++;
409done:
406 skb_queue_tail(&dev->done, skb); 410 skb_queue_tail(&dev->done, skb);
407} 411}
408 412
@@ -1376,7 +1380,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1376 // else "eth%d" when there's reasonable doubt. userspace 1380 // else "eth%d" when there's reasonable doubt. userspace
1377 // can rename the link if it knows better. 1381 // can rename the link if it knows better.
1378 if ((dev->driver_info->flags & FLAG_ETHER) != 0 && 1382 if ((dev->driver_info->flags & FLAG_ETHER) != 0 &&
1379 (net->dev_addr [0] & 0x02) == 0) 1383 ((dev->driver_info->flags & FLAG_POINTTOPOINT) == 0 ||
1384 (net->dev_addr [0] & 0x02) == 0))
1380 strcpy (net->name, "eth%d"); 1385 strcpy (net->name, "eth%d");
1381 /* WLAN devices should always be named "wlan%d" */ 1386 /* WLAN devices should always be named "wlan%d" */
1382 if ((dev->driver_info->flags & FLAG_WLAN) != 0) 1387 if ((dev->driver_info->flags & FLAG_WLAN) != 0)
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
index 3eb0b167b5b4..241756e0e86f 100644
--- a/drivers/net/usb/zaurus.c
+++ b/drivers/net/usb/zaurus.c
@@ -102,7 +102,7 @@ static int always_connected (struct usbnet *dev)
102 102
103static const struct driver_info zaurus_sl5x00_info = { 103static const struct driver_info zaurus_sl5x00_info = {
104 .description = "Sharp Zaurus SL-5x00", 104 .description = "Sharp Zaurus SL-5x00",
105 .flags = FLAG_FRAMING_Z, 105 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
106 .check_connect = always_connected, 106 .check_connect = always_connected,
107 .bind = zaurus_bind, 107 .bind = zaurus_bind,
108 .unbind = usbnet_cdc_unbind, 108 .unbind = usbnet_cdc_unbind,
@@ -112,7 +112,7 @@ static const struct driver_info zaurus_sl5x00_info = {
112 112
113static const struct driver_info zaurus_pxa_info = { 113static const struct driver_info zaurus_pxa_info = {
114 .description = "Sharp Zaurus, PXA-2xx based", 114 .description = "Sharp Zaurus, PXA-2xx based",
115 .flags = FLAG_FRAMING_Z, 115 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
116 .check_connect = always_connected, 116 .check_connect = always_connected,
117 .bind = zaurus_bind, 117 .bind = zaurus_bind,
118 .unbind = usbnet_cdc_unbind, 118 .unbind = usbnet_cdc_unbind,
@@ -122,7 +122,7 @@ static const struct driver_info zaurus_pxa_info = {
122 122
123static const struct driver_info olympus_mxl_info = { 123static const struct driver_info olympus_mxl_info = {
124 .description = "Olympus R1000", 124 .description = "Olympus R1000",
125 .flags = FLAG_FRAMING_Z, 125 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
126 .check_connect = always_connected, 126 .check_connect = always_connected,
127 .bind = zaurus_bind, 127 .bind = zaurus_bind,
128 .unbind = usbnet_cdc_unbind, 128 .unbind = usbnet_cdc_unbind,
@@ -258,7 +258,7 @@ bad_desc:
258 258
259static const struct driver_info bogus_mdlm_info = { 259static const struct driver_info bogus_mdlm_info = {
260 .description = "pseudo-MDLM (BLAN) device", 260 .description = "pseudo-MDLM (BLAN) device",
261 .flags = FLAG_FRAMING_Z, 261 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
262 .check_connect = always_connected, 262 .check_connect = always_connected,
263 .tx_fixup = zaurus_tx_fixup, 263 .tx_fixup = zaurus_tx_fixup,
264 .bind = blan_mdlm_bind, 264 .bind = blan_mdlm_bind,
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index f1b8af64569c..2d10239ce829 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -1040,7 +1040,7 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface,
1040 } 1040 }
1041 1041
1042 ret = ath9k_htc_hw_init(hif_dev->htc_handle, 1042 ret = ath9k_htc_hw_init(hif_dev->htc_handle,
1043 &hif_dev->udev->dev, hif_dev->device_id, 1043 &interface->dev, hif_dev->device_id,
1044 hif_dev->udev->product, id->driver_info); 1044 hif_dev->udev->product, id->driver_info);
1045 if (ret) { 1045 if (ret) {
1046 ret = -EINVAL; 1046 ret = -EINVAL;
@@ -1158,7 +1158,7 @@ fail_resume:
1158#endif 1158#endif
1159 1159
1160static struct usb_driver ath9k_hif_usb_driver = { 1160static struct usb_driver ath9k_hif_usb_driver = {
1161 .name = "ath9k_hif_usb", 1161 .name = KBUILD_MODNAME,
1162 .probe = ath9k_hif_usb_probe, 1162 .probe = ath9k_hif_usb_probe,
1163 .disconnect = ath9k_hif_usb_disconnect, 1163 .disconnect = ath9k_hif_usb_disconnect,
1164#ifdef CONFIG_PM 1164#ifdef CONFIG_PM
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 338b07502f1a..c95bc5cc1a1f 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1254,15 +1254,6 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1254 ah->txchainmask = common->tx_chainmask; 1254 ah->txchainmask = common->tx_chainmask;
1255 ah->rxchainmask = common->rx_chainmask; 1255 ah->rxchainmask = common->rx_chainmask;
1256 1256
1257 if ((common->bus_ops->ath_bus_type != ATH_USB) && !ah->chip_fullsleep) {
1258 ath9k_hw_abortpcurecv(ah);
1259 if (!ath9k_hw_stopdmarecv(ah)) {
1260 ath_dbg(common, ATH_DBG_XMIT,
1261 "Failed to stop receive dma\n");
1262 bChannelChange = false;
1263 }
1264 }
1265
1266 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) 1257 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
1267 return -EIO; 1258 return -EIO;
1268 1259
@@ -2546,6 +2537,7 @@ static struct {
2546 { AR_SREV_VERSION_9287, "9287" }, 2537 { AR_SREV_VERSION_9287, "9287" },
2547 { AR_SREV_VERSION_9271, "9271" }, 2538 { AR_SREV_VERSION_9271, "9271" },
2548 { AR_SREV_VERSION_9300, "9300" }, 2539 { AR_SREV_VERSION_9300, "9300" },
2540 { AR_SREV_VERSION_9485, "9485" },
2549}; 2541};
2550 2542
2551/* For devices with external radios */ 2543/* For devices with external radios */
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index 562257ac52cf..edc1cbbfecaf 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -751,28 +751,47 @@ void ath9k_hw_abortpcurecv(struct ath_hw *ah)
751} 751}
752EXPORT_SYMBOL(ath9k_hw_abortpcurecv); 752EXPORT_SYMBOL(ath9k_hw_abortpcurecv);
753 753
754bool ath9k_hw_stopdmarecv(struct ath_hw *ah) 754bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset)
755{ 755{
756#define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */ 756#define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
757#define AH_RX_TIME_QUANTUM 100 /* usec */ 757#define AH_RX_TIME_QUANTUM 100 /* usec */
758 struct ath_common *common = ath9k_hw_common(ah); 758 struct ath_common *common = ath9k_hw_common(ah);
759 u32 mac_status, last_mac_status = 0;
759 int i; 760 int i;
760 761
762 /* Enable access to the DMA observation bus */
763 REG_WRITE(ah, AR_MACMISC,
764 ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) |
765 (AR_MACMISC_MISC_OBS_BUS_1 <<
766 AR_MACMISC_MISC_OBS_BUS_MSB_S)));
767
761 REG_WRITE(ah, AR_CR, AR_CR_RXD); 768 REG_WRITE(ah, AR_CR, AR_CR_RXD);
762 769
763 /* Wait for rx enable bit to go low */ 770 /* Wait for rx enable bit to go low */
764 for (i = AH_RX_STOP_DMA_TIMEOUT / AH_TIME_QUANTUM; i != 0; i--) { 771 for (i = AH_RX_STOP_DMA_TIMEOUT / AH_TIME_QUANTUM; i != 0; i--) {
765 if ((REG_READ(ah, AR_CR) & AR_CR_RXE) == 0) 772 if ((REG_READ(ah, AR_CR) & AR_CR_RXE) == 0)
766 break; 773 break;
774
775 if (!AR_SREV_9300_20_OR_LATER(ah)) {
776 mac_status = REG_READ(ah, AR_DMADBG_7) & 0x7f0;
777 if (mac_status == 0x1c0 && mac_status == last_mac_status) {
778 *reset = true;
779 break;
780 }
781
782 last_mac_status = mac_status;
783 }
784
767 udelay(AH_TIME_QUANTUM); 785 udelay(AH_TIME_QUANTUM);
768 } 786 }
769 787
770 if (i == 0) { 788 if (i == 0) {
771 ath_err(common, 789 ath_err(common,
772 "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x\n", 790 "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x DMADBG_7=0x%08x\n",
773 AH_RX_STOP_DMA_TIMEOUT / 1000, 791 AH_RX_STOP_DMA_TIMEOUT / 1000,
774 REG_READ(ah, AR_CR), 792 REG_READ(ah, AR_CR),
775 REG_READ(ah, AR_DIAG_SW)); 793 REG_READ(ah, AR_DIAG_SW),
794 REG_READ(ah, AR_DMADBG_7));
776 return false; 795 return false;
777 } else { 796 } else {
778 return true; 797 return true;
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
index b2b2ff852c32..c2a59386fb9c 100644
--- a/drivers/net/wireless/ath/ath9k/mac.h
+++ b/drivers/net/wireless/ath/ath9k/mac.h
@@ -695,7 +695,7 @@ bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set);
695void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp); 695void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp);
696void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning); 696void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning);
697void ath9k_hw_abortpcurecv(struct ath_hw *ah); 697void ath9k_hw_abortpcurecv(struct ath_hw *ah);
698bool ath9k_hw_stopdmarecv(struct ath_hw *ah); 698bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset);
699int ath9k_hw_beaconq_setup(struct ath_hw *ah); 699int ath9k_hw_beaconq_setup(struct ath_hw *ah);
700 700
701/* Interrupt Handling */ 701/* Interrupt Handling */
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 524825720a09..17d04ff8d678 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1048,6 +1048,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
1048 "Starting driver with initial channel: %d MHz\n", 1048 "Starting driver with initial channel: %d MHz\n",
1049 curchan->center_freq); 1049 curchan->center_freq);
1050 1050
1051 ath9k_ps_wakeup(sc);
1052
1051 mutex_lock(&sc->mutex); 1053 mutex_lock(&sc->mutex);
1052 1054
1053 /* setup initial channel */ 1055 /* setup initial channel */
@@ -1143,6 +1145,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
1143mutex_unlock: 1145mutex_unlock:
1144 mutex_unlock(&sc->mutex); 1146 mutex_unlock(&sc->mutex);
1145 1147
1148 ath9k_ps_restore(sc);
1149
1146 return r; 1150 return r;
1147} 1151}
1148 1152
@@ -1372,7 +1376,6 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw,
1372 1376
1373 ath9k_calculate_iter_data(hw, vif, &iter_data); 1377 ath9k_calculate_iter_data(hw, vif, &iter_data);
1374 1378
1375 ath9k_ps_wakeup(sc);
1376 /* Set BSSID mask. */ 1379 /* Set BSSID mask. */
1377 memcpy(common->bssidmask, iter_data.mask, ETH_ALEN); 1380 memcpy(common->bssidmask, iter_data.mask, ETH_ALEN);
1378 ath_hw_setbssidmask(common); 1381 ath_hw_setbssidmask(common);
@@ -1407,7 +1410,6 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw,
1407 } 1410 }
1408 1411
1409 ath9k_hw_set_interrupts(ah, ah->imask); 1412 ath9k_hw_set_interrupts(ah, ah->imask);
1410 ath9k_ps_restore(sc);
1411 1413
1412 /* Set up ANI */ 1414 /* Set up ANI */
1413 if ((iter_data.naps + iter_data.nadhocs) > 0) { 1415 if ((iter_data.naps + iter_data.nadhocs) > 0) {
@@ -1453,6 +1455,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
1453 struct ath_vif *avp = (void *)vif->drv_priv; 1455 struct ath_vif *avp = (void *)vif->drv_priv;
1454 int ret = 0; 1456 int ret = 0;
1455 1457
1458 ath9k_ps_wakeup(sc);
1456 mutex_lock(&sc->mutex); 1459 mutex_lock(&sc->mutex);
1457 1460
1458 switch (vif->type) { 1461 switch (vif->type) {
@@ -1499,6 +1502,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
1499 ath9k_do_vif_add_setup(hw, vif); 1502 ath9k_do_vif_add_setup(hw, vif);
1500out: 1503out:
1501 mutex_unlock(&sc->mutex); 1504 mutex_unlock(&sc->mutex);
1505 ath9k_ps_restore(sc);
1502 return ret; 1506 return ret;
1503} 1507}
1504 1508
@@ -1513,6 +1517,7 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
1513 1517
1514 ath_dbg(common, ATH_DBG_CONFIG, "Change Interface\n"); 1518 ath_dbg(common, ATH_DBG_CONFIG, "Change Interface\n");
1515 mutex_lock(&sc->mutex); 1519 mutex_lock(&sc->mutex);
1520 ath9k_ps_wakeup(sc);
1516 1521
1517 /* See if new interface type is valid. */ 1522 /* See if new interface type is valid. */
1518 if ((new_type == NL80211_IFTYPE_ADHOC) && 1523 if ((new_type == NL80211_IFTYPE_ADHOC) &&
@@ -1542,6 +1547,7 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
1542 1547
1543 ath9k_do_vif_add_setup(hw, vif); 1548 ath9k_do_vif_add_setup(hw, vif);
1544out: 1549out:
1550 ath9k_ps_restore(sc);
1545 mutex_unlock(&sc->mutex); 1551 mutex_unlock(&sc->mutex);
1546 return ret; 1552 return ret;
1547} 1553}
@@ -1554,6 +1560,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
1554 1560
1555 ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n"); 1561 ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n");
1556 1562
1563 ath9k_ps_wakeup(sc);
1557 mutex_lock(&sc->mutex); 1564 mutex_lock(&sc->mutex);
1558 1565
1559 sc->nvifs--; 1566 sc->nvifs--;
@@ -1565,6 +1572,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
1565 ath9k_calculate_summary_state(hw, NULL); 1572 ath9k_calculate_summary_state(hw, NULL);
1566 1573
1567 mutex_unlock(&sc->mutex); 1574 mutex_unlock(&sc->mutex);
1575 ath9k_ps_restore(sc);
1568} 1576}
1569 1577
1570static void ath9k_enable_ps(struct ath_softc *sc) 1578static void ath9k_enable_ps(struct ath_softc *sc)
@@ -1805,6 +1813,7 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue,
1805 1813
1806 txq = sc->tx.txq_map[queue]; 1814 txq = sc->tx.txq_map[queue];
1807 1815
1816 ath9k_ps_wakeup(sc);
1808 mutex_lock(&sc->mutex); 1817 mutex_lock(&sc->mutex);
1809 1818
1810 memset(&qi, 0, sizeof(struct ath9k_tx_queue_info)); 1819 memset(&qi, 0, sizeof(struct ath9k_tx_queue_info));
@@ -1828,6 +1837,7 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue,
1828 ath_beaconq_config(sc); 1837 ath_beaconq_config(sc);
1829 1838
1830 mutex_unlock(&sc->mutex); 1839 mutex_unlock(&sc->mutex);
1840 ath9k_ps_restore(sc);
1831 1841
1832 return ret; 1842 return ret;
1833} 1843}
@@ -1890,6 +1900,7 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
1890 int slottime; 1900 int slottime;
1891 int error; 1901 int error;
1892 1902
1903 ath9k_ps_wakeup(sc);
1893 mutex_lock(&sc->mutex); 1904 mutex_lock(&sc->mutex);
1894 1905
1895 if (changed & BSS_CHANGED_BSSID) { 1906 if (changed & BSS_CHANGED_BSSID) {
@@ -1990,6 +2001,7 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
1990 } 2001 }
1991 2002
1992 mutex_unlock(&sc->mutex); 2003 mutex_unlock(&sc->mutex);
2004 ath9k_ps_restore(sc);
1993} 2005}
1994 2006
1995static u64 ath9k_get_tsf(struct ieee80211_hw *hw) 2007static u64 ath9k_get_tsf(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index a9c3f4672aa0..b29c80def35e 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -486,12 +486,12 @@ start_recv:
486bool ath_stoprecv(struct ath_softc *sc) 486bool ath_stoprecv(struct ath_softc *sc)
487{ 487{
488 struct ath_hw *ah = sc->sc_ah; 488 struct ath_hw *ah = sc->sc_ah;
489 bool stopped; 489 bool stopped, reset = false;
490 490
491 spin_lock_bh(&sc->rx.rxbuflock); 491 spin_lock_bh(&sc->rx.rxbuflock);
492 ath9k_hw_abortpcurecv(ah); 492 ath9k_hw_abortpcurecv(ah);
493 ath9k_hw_setrxfilter(ah, 0); 493 ath9k_hw_setrxfilter(ah, 0);
494 stopped = ath9k_hw_stopdmarecv(ah); 494 stopped = ath9k_hw_stopdmarecv(ah, &reset);
495 495
496 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) 496 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
497 ath_edma_stop_recv(sc); 497 ath_edma_stop_recv(sc);
@@ -506,7 +506,7 @@ bool ath_stoprecv(struct ath_softc *sc)
506 "confusing the DMA engine when we start RX up\n"); 506 "confusing the DMA engine when we start RX up\n");
507 ATH_DBG_WARN_ON_ONCE(!stopped); 507 ATH_DBG_WARN_ON_ONCE(!stopped);
508 } 508 }
509 return stopped; 509 return stopped && !reset;
510} 510}
511 511
512void ath_flushrecv(struct ath_softc *sc) 512void ath_flushrecv(struct ath_softc *sc)
diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h
index c6a5fae634a0..9cad061cc1d2 100644
--- a/drivers/net/wireless/ath/carl9170/carl9170.h
+++ b/drivers/net/wireless/ath/carl9170/carl9170.h
@@ -443,6 +443,7 @@ struct carl9170_ba_stats {
443 u8 ampdu_len; 443 u8 ampdu_len;
444 u8 ampdu_ack_len; 444 u8 ampdu_ack_len;
445 bool clear; 445 bool clear;
446 bool req;
446}; 447};
447 448
448struct carl9170_sta_info { 449struct carl9170_sta_info {
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index ede3d7e5a048..89fe60accf85 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -1355,6 +1355,7 @@ static int carl9170_op_ampdu_action(struct ieee80211_hw *hw,
1355 tid_info = rcu_dereference(sta_info->agg[tid]); 1355 tid_info = rcu_dereference(sta_info->agg[tid]);
1356 1356
1357 sta_info->stats[tid].clear = true; 1357 sta_info->stats[tid].clear = true;
1358 sta_info->stats[tid].req = false;
1358 1359
1359 if (tid_info) { 1360 if (tid_info) {
1360 bitmap_zero(tid_info->bitmap, CARL9170_BAW_SIZE); 1361 bitmap_zero(tid_info->bitmap, CARL9170_BAW_SIZE);
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c
index 0ef70b6fc512..cb70ed7ec5cc 100644
--- a/drivers/net/wireless/ath/carl9170/tx.c
+++ b/drivers/net/wireless/ath/carl9170/tx.c
@@ -383,6 +383,7 @@ static void carl9170_tx_status_process_ampdu(struct ar9170 *ar,
383 383
384 if (sta_info->stats[tid].clear) { 384 if (sta_info->stats[tid].clear) {
385 sta_info->stats[tid].clear = false; 385 sta_info->stats[tid].clear = false;
386 sta_info->stats[tid].req = false;
386 sta_info->stats[tid].ampdu_len = 0; 387 sta_info->stats[tid].ampdu_len = 0;
387 sta_info->stats[tid].ampdu_ack_len = 0; 388 sta_info->stats[tid].ampdu_ack_len = 0;
388 } 389 }
@@ -391,10 +392,16 @@ static void carl9170_tx_status_process_ampdu(struct ar9170 *ar,
391 if (txinfo->status.rates[0].count == 1) 392 if (txinfo->status.rates[0].count == 1)
392 sta_info->stats[tid].ampdu_ack_len++; 393 sta_info->stats[tid].ampdu_ack_len++;
393 394
395 if (!(txinfo->flags & IEEE80211_TX_STAT_ACK))
396 sta_info->stats[tid].req = true;
397
394 if (super->f.mac_control & cpu_to_le16(AR9170_TX_MAC_IMM_BA)) { 398 if (super->f.mac_control & cpu_to_le16(AR9170_TX_MAC_IMM_BA)) {
395 super->s.rix = sta_info->stats[tid].ampdu_len; 399 super->s.rix = sta_info->stats[tid].ampdu_len;
396 super->s.cnt = sta_info->stats[tid].ampdu_ack_len; 400 super->s.cnt = sta_info->stats[tid].ampdu_ack_len;
397 txinfo->flags |= IEEE80211_TX_STAT_AMPDU; 401 txinfo->flags |= IEEE80211_TX_STAT_AMPDU;
402 if (sta_info->stats[tid].req)
403 txinfo->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
404
398 sta_info->stats[tid].clear = true; 405 sta_info->stats[tid].clear = true;
399 } 406 }
400 spin_unlock_bh(&tid_info->lock); 407 spin_unlock_bh(&tid_info->lock);
diff --git a/drivers/net/wireless/ath/regd_common.h b/drivers/net/wireless/ath/regd_common.h
index 248c670fdfbe..5c2cfe694152 100644
--- a/drivers/net/wireless/ath/regd_common.h
+++ b/drivers/net/wireless/ath/regd_common.h
@@ -195,6 +195,7 @@ static struct reg_dmn_pair_mapping regDomainPairs[] = {
195 {APL9_WORLD, CTL_ETSI, CTL_ETSI}, 195 {APL9_WORLD, CTL_ETSI, CTL_ETSI},
196 196
197 {APL3_FCCA, CTL_FCC, CTL_FCC}, 197 {APL3_FCCA, CTL_FCC, CTL_FCC},
198 {APL7_FCCA, CTL_FCC, CTL_FCC},
198 {APL1_ETSIC, CTL_FCC, CTL_ETSI}, 199 {APL1_ETSIC, CTL_FCC, CTL_ETSI},
199 {APL2_ETSIC, CTL_FCC, CTL_ETSI}, 200 {APL2_ETSIC, CTL_FCC, CTL_ETSI},
200 {APL2_APLD, CTL_FCC, NO_CTL}, 201 {APL2_APLD, CTL_FCC, NO_CTL},
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 3d5566e7af0a..ff0f5ba14b2c 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1536,7 +1536,7 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1536 dmaaddr = meta->dmaaddr; 1536 dmaaddr = meta->dmaaddr;
1537 goto drop_recycle_buffer; 1537 goto drop_recycle_buffer;
1538 } 1538 }
1539 if (unlikely(len > ring->rx_buffersize)) { 1539 if (unlikely(len + ring->frameoffset > ring->rx_buffersize)) {
1540 /* The data did not fit into one descriptor buffer 1540 /* The data did not fit into one descriptor buffer
1541 * and is split over multiple buffers. 1541 * and is split over multiple buffers.
1542 * This should never happen, as we try to allocate buffers 1542 * This should never happen, as we try to allocate buffers
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h
index a01c2100f166..e8a80a1251bf 100644
--- a/drivers/net/wireless/b43/dma.h
+++ b/drivers/net/wireless/b43/dma.h
@@ -163,7 +163,7 @@ struct b43_dmadesc_generic {
163/* DMA engine tuning knobs */ 163/* DMA engine tuning knobs */
164#define B43_TXRING_SLOTS 256 164#define B43_TXRING_SLOTS 256
165#define B43_RXRING_SLOTS 64 165#define B43_RXRING_SLOTS 64
166#define B43_DMA0_RX_BUFFERSIZE IEEE80211_MAX_FRAME_LEN 166#define B43_DMA0_RX_BUFFERSIZE (B43_DMA0_RX_FRAMEOFFSET + IEEE80211_MAX_FRAME_LEN)
167 167
168/* Pointer poison */ 168/* Pointer poison */
169#define B43_DMA_PTR_POISON ((void *)ERR_PTR(-ENOMEM)) 169#define B43_DMA_PTR_POISON ((void *)ERR_PTR(-ENOMEM))
diff --git a/drivers/net/wireless/iwlegacy/Kconfig b/drivers/net/wireless/iwlegacy/Kconfig
index 2a45dd44cc12..aef65cd47661 100644
--- a/drivers/net/wireless/iwlegacy/Kconfig
+++ b/drivers/net/wireless/iwlegacy/Kconfig
@@ -1,6 +1,5 @@
1config IWLWIFI_LEGACY 1config IWLWIFI_LEGACY
2 tristate "Intel Wireless Wifi legacy devices" 2 tristate
3 depends on PCI && MAC80211
4 select FW_LOADER 3 select FW_LOADER
5 select NEW_LEDS 4 select NEW_LEDS
6 select LEDS_CLASS 5 select LEDS_CLASS
@@ -65,7 +64,8 @@ endmenu
65 64
66config IWL4965 65config IWL4965
67 tristate "Intel Wireless WiFi 4965AGN (iwl4965)" 66 tristate "Intel Wireless WiFi 4965AGN (iwl4965)"
68 depends on IWLWIFI_LEGACY 67 depends on PCI && MAC80211
68 select IWLWIFI_LEGACY
69 ---help--- 69 ---help---
70 This option enables support for 70 This option enables support for
71 71
@@ -92,7 +92,8 @@ config IWL4965
92 92
93config IWL3945 93config IWL3945
94 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection (iwl3945)" 94 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection (iwl3945)"
95 depends on IWLWIFI_LEGACY 95 depends on PCI && MAC80211
96 select IWLWIFI_LEGACY
96 ---help--- 97 ---help---
97 Select to build the driver supporting the: 98 Select to build the driver supporting the:
98 99
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
index 779d3cb86e2c..5c3a68d3af12 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
@@ -74,8 +74,6 @@
74/* RSSI to dBm */ 74/* RSSI to dBm */
75#define IWL39_RSSI_OFFSET 95 75#define IWL39_RSSI_OFFSET 95
76 76
77#define IWL_DEFAULT_TX_POWER 0x0F
78
79/* 77/*
80 * EEPROM related constants, enums, and structures. 78 * EEPROM related constants, enums, and structures.
81 */ 79 */
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
index 08b189c8472d..fc6fa2886d9c 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
@@ -804,9 +804,6 @@ struct iwl4965_scd_bc_tbl {
804 804
805#define IWL4965_DEFAULT_TX_RETRY 15 805#define IWL4965_DEFAULT_TX_RETRY 15
806 806
807/* Limit range of txpower output target to be between these values */
808#define IWL4965_TX_POWER_TARGET_POWER_MIN (0) /* 0 dBm: 1 milliwatt */
809
810/* EEPROM */ 807/* EEPROM */
811#define IWL4965_FIRST_AMPDU_QUEUE 10 808#define IWL4965_FIRST_AMPDU_QUEUE 10
812 809
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
index 5c40502f869a..fbec88d48f1b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
@@ -1127,12 +1127,16 @@ int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
1127 q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1127 q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) {
1128 1128
1129 tx_info = &txq->txb[txq->q.read_ptr]; 1129 tx_info = &txq->txb[txq->q.read_ptr];
1130 iwl4965_tx_status(priv, tx_info, 1130
1131 txq_id >= IWL4965_FIRST_AMPDU_QUEUE); 1131 if (WARN_ON_ONCE(tx_info->skb == NULL))
1132 continue;
1132 1133
1133 hdr = (struct ieee80211_hdr *)tx_info->skb->data; 1134 hdr = (struct ieee80211_hdr *)tx_info->skb->data;
1134 if (hdr && ieee80211_is_data_qos(hdr->frame_control)) 1135 if (ieee80211_is_data_qos(hdr->frame_control))
1135 nfreed++; 1136 nfreed++;
1137
1138 iwl4965_tx_status(priv, tx_info,
1139 txq_id >= IWL4965_FIRST_AMPDU_QUEUE);
1136 tx_info->skb = NULL; 1140 tx_info->skb = NULL;
1137 1141
1138 priv->cfg->ops->lib->txq_free_tfd(priv, txq); 1142 priv->cfg->ops->lib->txq_free_tfd(priv, txq);
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index d418b647be80..2b08efb3b658 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -160,6 +160,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
160 struct ieee80211_channel *geo_ch; 160 struct ieee80211_channel *geo_ch;
161 struct ieee80211_rate *rates; 161 struct ieee80211_rate *rates;
162 int i = 0; 162 int i = 0;
163 s8 max_tx_power = 0;
163 164
164 if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates || 165 if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
165 priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) { 166 priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
@@ -235,8 +236,8 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
235 236
236 geo_ch->flags |= ch->ht40_extension_channel; 237 geo_ch->flags |= ch->ht40_extension_channel;
237 238
238 if (ch->max_power_avg > priv->tx_power_device_lmt) 239 if (ch->max_power_avg > max_tx_power)
239 priv->tx_power_device_lmt = ch->max_power_avg; 240 max_tx_power = ch->max_power_avg;
240 } else { 241 } else {
241 geo_ch->flags |= IEEE80211_CHAN_DISABLED; 242 geo_ch->flags |= IEEE80211_CHAN_DISABLED;
242 } 243 }
@@ -249,6 +250,10 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
249 geo_ch->flags); 250 geo_ch->flags);
250 } 251 }
251 252
253 priv->tx_power_device_lmt = max_tx_power;
254 priv->tx_power_user_lmt = max_tx_power;
255 priv->tx_power_next = max_tx_power;
256
252 if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && 257 if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
253 priv->cfg->sku & IWL_SKU_A) { 258 priv->cfg->sku & IWL_SKU_A) {
254 IWL_INFO(priv, "Incorrectly detected BG card as ABG. " 259 IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
@@ -1124,11 +1129,11 @@ int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
1124 if (!priv->cfg->ops->lib->send_tx_power) 1129 if (!priv->cfg->ops->lib->send_tx_power)
1125 return -EOPNOTSUPP; 1130 return -EOPNOTSUPP;
1126 1131
1127 if (tx_power < IWL4965_TX_POWER_TARGET_POWER_MIN) { 1132 /* 0 dBm mean 1 milliwatt */
1133 if (tx_power < 0) {
1128 IWL_WARN(priv, 1134 IWL_WARN(priv,
1129 "Requested user TXPOWER %d below lower limit %d.\n", 1135 "Requested user TXPOWER %d below 1 mW.\n",
1130 tx_power, 1136 tx_power);
1131 IWL4965_TX_POWER_TARGET_POWER_MIN);
1132 return -EINVAL; 1137 return -EINVAL;
1133 } 1138 }
1134 1139
@@ -1805,6 +1810,15 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw,
1805 1810
1806 mutex_lock(&priv->mutex); 1811 mutex_lock(&priv->mutex);
1807 1812
1813 if (!ctx->vif || !iwl_legacy_is_ready_rf(priv)) {
1814 /*
1815 * Huh? But wait ... this can maybe happen when
1816 * we're in the middle of a firmware restart!
1817 */
1818 err = -EBUSY;
1819 goto out;
1820 }
1821
1808 interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes; 1822 interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes;
1809 1823
1810 if (!(interface_modes & BIT(newtype))) { 1824 if (!(interface_modes & BIT(newtype))) {
@@ -1832,6 +1846,7 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw,
1832 /* success */ 1846 /* success */
1833 iwl_legacy_teardown_interface(priv, vif, true); 1847 iwl_legacy_teardown_interface(priv, vif, true);
1834 vif->type = newtype; 1848 vif->type = newtype;
1849 vif->p2p = newp2p;
1835 err = iwl_legacy_setup_interface(priv, ctx); 1850 err = iwl_legacy_setup_interface(priv, ctx);
1836 WARN_ON(err); 1851 WARN_ON(err);
1837 /* 1852 /*
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
index 04c5648027df..cb346d1a9ffa 100644
--- a/drivers/net/wireless/iwlegacy/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
@@ -471,13 +471,6 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv)
471 flags & EEPROM_CHANNEL_RADAR)) 471 flags & EEPROM_CHANNEL_RADAR))
472 ? "" : "not "); 472 ? "" : "not ");
473 473
474 /* Set the tx_power_user_lmt to the highest power
475 * supported by any channel */
476 if (eeprom_ch_info[ch].max_power_avg >
477 priv->tx_power_user_lmt)
478 priv->tx_power_user_lmt =
479 eeprom_ch_info[ch].max_power_avg;
480
481 ch_info++; 474 ch_info++;
482 } 475 }
483 } 476 }
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index ab87e1b73529..cc7ebcee60e5 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -93,6 +93,7 @@ MODULE_LICENSE("GPL");
93struct iwl_mod_params iwl3945_mod_params = { 93struct iwl_mod_params iwl3945_mod_params = {
94 .sw_crypto = 1, 94 .sw_crypto = 1,
95 .restart_fw = 1, 95 .restart_fw = 1,
96 .disable_hw_scan = 1,
96 /* the rest are 0 by default */ 97 /* the rest are 0 by default */
97}; 98};
98 99
@@ -3824,10 +3825,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv)
3824 priv->force_reset[IWL_FW_RESET].reset_duration = 3825 priv->force_reset[IWL_FW_RESET].reset_duration =
3825 IWL_DELAY_NEXT_FORCE_FW_RELOAD; 3826 IWL_DELAY_NEXT_FORCE_FW_RELOAD;
3826 3827
3827
3828 priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER;
3829 priv->tx_power_next = IWL_DEFAULT_TX_POWER;
3830
3831 if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { 3828 if (eeprom->version < EEPROM_3945_EEPROM_VERSION) {
3832 IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", 3829 IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n",
3833 eeprom->version); 3830 eeprom->version);
@@ -3960,8 +3957,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3960 * "the hard way", rather than using device's scan. 3957 * "the hard way", rather than using device's scan.
3961 */ 3958 */
3962 if (iwl3945_mod_params.disable_hw_scan) { 3959 if (iwl3945_mod_params.disable_hw_scan) {
3963 dev_printk(KERN_DEBUG, &(pdev->dev), 3960 IWL_DEBUG_INFO(priv, "Disabling hw_scan\n");
3964 "sw scan support is deprecated\n");
3965 iwl3945_hw_ops.hw_scan = NULL; 3961 iwl3945_hw_ops.hw_scan = NULL;
3966 } 3962 }
3967 3963
@@ -4280,8 +4276,7 @@ MODULE_PARM_DESC(swcrypto,
4280 "using software crypto (default 1 [software])"); 4276 "using software crypto (default 1 [software])");
4281module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan, 4277module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan,
4282 int, S_IRUGO); 4278 int, S_IRUGO);
4283MODULE_PARM_DESC(disable_hw_scan, 4279MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 1)");
4284 "disable hardware scanning (default 0) (deprecated)");
4285#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 4280#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
4286module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR); 4281module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR);
4287MODULE_PARM_DESC(debug, "debug output mask"); 4282MODULE_PARM_DESC(debug, "debug output mask");
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index 91b3d8b9d7a5..d484c3678163 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -3140,12 +3140,6 @@ static int iwl4965_init_drv(struct iwl_priv *priv)
3140 3140
3141 iwl_legacy_init_scan_params(priv); 3141 iwl_legacy_init_scan_params(priv);
3142 3142
3143 /* Set the tx_power_user_lmt to the lowest power level
3144 * this value will get overwritten by channel max power avg
3145 * from eeprom */
3146 priv->tx_power_user_lmt = IWL4965_TX_POWER_TARGET_POWER_MIN;
3147 priv->tx_power_next = IWL4965_TX_POWER_TARGET_POWER_MIN;
3148
3149 ret = iwl_legacy_init_channel_map(priv); 3143 ret = iwl_legacy_init_channel_map(priv);
3150 if (ret) { 3144 if (ret) {
3151 IWL_ERR(priv, "initializing regulatory failed: %d\n", ret); 3145 IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 3ea31b659d1a..22e045b5bcee 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -530,6 +530,9 @@ static struct iwl_ht_params iwl5000_ht_params = {
530struct iwl_cfg iwl5300_agn_cfg = { 530struct iwl_cfg iwl5300_agn_cfg = {
531 .name = "Intel(R) Ultimate N WiFi Link 5300 AGN", 531 .name = "Intel(R) Ultimate N WiFi Link 5300 AGN",
532 IWL_DEVICE_5000, 532 IWL_DEVICE_5000,
533 /* at least EEPROM 0x11A has wrong info */
534 .valid_tx_ant = ANT_ABC, /* .cfg overwrite */
535 .valid_rx_ant = ANT_ABC, /* .cfg overwrite */
533 .ht_params = &iwl5000_ht_params, 536 .ht_params = &iwl5000_ht_params,
534}; 537};
535 538
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index dfdbea6e8f99..fbbde0712fa5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -335,7 +335,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
335 struct ieee80211_channel *channel = conf->channel; 335 struct ieee80211_channel *channel = conf->channel;
336 const struct iwl_channel_info *ch_info; 336 const struct iwl_channel_info *ch_info;
337 int ret = 0; 337 int ret = 0;
338 bool ht_changed[NUM_IWL_RXON_CTX] = {};
339 338
340 IWL_DEBUG_MAC80211(priv, "changed %#x", changed); 339 IWL_DEBUG_MAC80211(priv, "changed %#x", changed);
341 340
@@ -383,10 +382,8 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
383 382
384 for_each_context(priv, ctx) { 383 for_each_context(priv, ctx) {
385 /* Configure HT40 channels */ 384 /* Configure HT40 channels */
386 if (ctx->ht.enabled != conf_is_ht(conf)) { 385 if (ctx->ht.enabled != conf_is_ht(conf))
387 ctx->ht.enabled = conf_is_ht(conf); 386 ctx->ht.enabled = conf_is_ht(conf);
388 ht_changed[ctx->ctxid] = true;
389 }
390 387
391 if (ctx->ht.enabled) { 388 if (ctx->ht.enabled) {
392 if (conf_is_ht40_minus(conf)) { 389 if (conf_is_ht40_minus(conf)) {
@@ -455,8 +452,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
455 if (!memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) 452 if (!memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))
456 continue; 453 continue;
457 iwlagn_commit_rxon(priv, ctx); 454 iwlagn_commit_rxon(priv, ctx);
458 if (ht_changed[ctx->ctxid])
459 iwlagn_update_qos(priv, ctx);
460 } 455 }
461 out: 456 out:
462 mutex_unlock(&priv->mutex); 457 mutex_unlock(&priv->mutex);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index a709d05c5868..2dd7d54a796f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -1224,12 +1224,16 @@ int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
1224 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1224 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
1225 1225
1226 tx_info = &txq->txb[txq->q.read_ptr]; 1226 tx_info = &txq->txb[txq->q.read_ptr];
1227 iwlagn_tx_status(priv, tx_info, 1227
1228 txq_id >= IWLAGN_FIRST_AMPDU_QUEUE); 1228 if (WARN_ON_ONCE(tx_info->skb == NULL))
1229 continue;
1229 1230
1230 hdr = (struct ieee80211_hdr *)tx_info->skb->data; 1231 hdr = (struct ieee80211_hdr *)tx_info->skb->data;
1231 if (hdr && ieee80211_is_data_qos(hdr->frame_control)) 1232 if (ieee80211_is_data_qos(hdr->frame_control))
1232 nfreed++; 1233 nfreed++;
1234
1235 iwlagn_tx_status(priv, tx_info,
1236 txq_id >= IWLAGN_FIRST_AMPDU_QUEUE);
1233 tx_info->skb = NULL; 1237 tx_info->skb = NULL;
1234 1238
1235 if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl) 1239 if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl)
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index 98aa8af01192..20b66469d68f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -241,7 +241,7 @@ struct iwl_eeprom_enhanced_txpwr {
241 241
242/* 6x00 Specific */ 242/* 6x00 Specific */
243#define EEPROM_6000_TX_POWER_VERSION (4) 243#define EEPROM_6000_TX_POWER_VERSION (4)
244#define EEPROM_6000_EEPROM_VERSION (0x434) 244#define EEPROM_6000_EEPROM_VERSION (0x423)
245 245
246/* 6x50 Specific */ 246/* 6x50 Specific */
247#define EEPROM_6050_TX_POWER_VERSION (4) 247#define EEPROM_6050_TX_POWER_VERSION (4)
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index 36952274950e..c1ceb4b23971 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -137,6 +137,7 @@ struct mwl8k_tx_queue {
137struct mwl8k_priv { 137struct mwl8k_priv {
138 struct ieee80211_hw *hw; 138 struct ieee80211_hw *hw;
139 struct pci_dev *pdev; 139 struct pci_dev *pdev;
140 int irq;
140 141
141 struct mwl8k_device_info *device_info; 142 struct mwl8k_device_info *device_info;
142 143
@@ -3761,9 +3762,11 @@ static int mwl8k_start(struct ieee80211_hw *hw)
3761 rc = request_irq(priv->pdev->irq, mwl8k_interrupt, 3762 rc = request_irq(priv->pdev->irq, mwl8k_interrupt,
3762 IRQF_SHARED, MWL8K_NAME, hw); 3763 IRQF_SHARED, MWL8K_NAME, hw);
3763 if (rc) { 3764 if (rc) {
3765 priv->irq = -1;
3764 wiphy_err(hw->wiphy, "failed to register IRQ handler\n"); 3766 wiphy_err(hw->wiphy, "failed to register IRQ handler\n");
3765 return -EIO; 3767 return -EIO;
3766 } 3768 }
3769 priv->irq = priv->pdev->irq;
3767 3770
3768 /* Enable TX reclaim and RX tasklets. */ 3771 /* Enable TX reclaim and RX tasklets. */
3769 tasklet_enable(&priv->poll_tx_task); 3772 tasklet_enable(&priv->poll_tx_task);
@@ -3800,6 +3803,7 @@ static int mwl8k_start(struct ieee80211_hw *hw)
3800 if (rc) { 3803 if (rc) {
3801 iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); 3804 iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK);
3802 free_irq(priv->pdev->irq, hw); 3805 free_irq(priv->pdev->irq, hw);
3806 priv->irq = -1;
3803 tasklet_disable(&priv->poll_tx_task); 3807 tasklet_disable(&priv->poll_tx_task);
3804 tasklet_disable(&priv->poll_rx_task); 3808 tasklet_disable(&priv->poll_rx_task);
3805 } 3809 }
@@ -3818,7 +3822,10 @@ static void mwl8k_stop(struct ieee80211_hw *hw)
3818 3822
3819 /* Disable interrupts */ 3823 /* Disable interrupts */
3820 iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); 3824 iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK);
3821 free_irq(priv->pdev->irq, hw); 3825 if (priv->irq != -1) {
3826 free_irq(priv->pdev->irq, hw);
3827 priv->irq = -1;
3828 }
3822 3829
3823 /* Stop finalize join worker */ 3830 /* Stop finalize join worker */
3824 cancel_work_sync(&priv->finalize_join_worker); 3831 cancel_work_sync(&priv->finalize_join_worker);
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index 9b344a921e74..e18358725b69 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -56,6 +56,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
56 {USB_DEVICE(0x0846, 0x4210)}, /* Netgear WG121 the second ? */ 56 {USB_DEVICE(0x0846, 0x4210)}, /* Netgear WG121 the second ? */
57 {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ 57 {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */
58 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ 58 {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */
59 {USB_DEVICE(0x0bf8, 0x1007)}, /* Fujitsu E-5400 USB */
59 {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ 60 {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */
60 {USB_DEVICE(0x0db0, 0x6826)}, /* MSI UB54G (MS-6826) */ 61 {USB_DEVICE(0x0db0, 0x6826)}, /* MSI UB54G (MS-6826) */
61 {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ 62 {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */
@@ -68,6 +69,7 @@ static struct usb_device_id p54u_table[] __devinitdata = {
68 {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ 69 {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */
69 {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */ 70 {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */
70 {USB_DEVICE(0x2001, 0x3703)}, /* DLink DWL-G122 */ 71 {USB_DEVICE(0x2001, 0x3703)}, /* DLink DWL-G122 */
72 {USB_DEVICE(0x2001, 0x3762)}, /* Conceptronic C54U */
71 {USB_DEVICE(0x5041, 0x2234)}, /* Linksys WUSB54G */ 73 {USB_DEVICE(0x5041, 0x2234)}, /* Linksys WUSB54G */
72 {USB_DEVICE(0x5041, 0x2235)}, /* Linksys WUSB54G Portable */ 74 {USB_DEVICE(0x5041, 0x2235)}, /* Linksys WUSB54G Portable */
73 75
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c
index 7834c26c2954..042842e704de 100644
--- a/drivers/net/wireless/p54/txrx.c
+++ b/drivers/net/wireless/p54/txrx.c
@@ -703,7 +703,7 @@ void p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb)
703 struct p54_tx_info *p54info; 703 struct p54_tx_info *p54info;
704 struct p54_hdr *hdr; 704 struct p54_hdr *hdr;
705 struct p54_tx_data *txhdr; 705 struct p54_tx_data *txhdr;
706 unsigned int padding, len, extra_len; 706 unsigned int padding, len, extra_len = 0;
707 int i, j, ridx; 707 int i, j, ridx;
708 u16 hdr_flags = 0, aid = 0; 708 u16 hdr_flags = 0, aid = 0;
709 u8 rate, queue = 0, crypt_offset = 0; 709 u8 rate, queue = 0, crypt_offset = 0;
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 4e368657a83c..37509d019910 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -730,8 +730,12 @@ static struct usb_device_id rt2800usb_device_table[] = {
730 { USB_DEVICE(0x050d, 0x8053), USB_DEVICE_DATA(&rt2800usb_ops) }, 730 { USB_DEVICE(0x050d, 0x8053), USB_DEVICE_DATA(&rt2800usb_ops) },
731 { USB_DEVICE(0x050d, 0x805c), USB_DEVICE_DATA(&rt2800usb_ops) }, 731 { USB_DEVICE(0x050d, 0x805c), USB_DEVICE_DATA(&rt2800usb_ops) },
732 { USB_DEVICE(0x050d, 0x815c), USB_DEVICE_DATA(&rt2800usb_ops) }, 732 { USB_DEVICE(0x050d, 0x815c), USB_DEVICE_DATA(&rt2800usb_ops) },
733 { USB_DEVICE(0x050d, 0x825b), USB_DEVICE_DATA(&rt2800usb_ops) },
734 { USB_DEVICE(0x050d, 0x935a), USB_DEVICE_DATA(&rt2800usb_ops) },
735 { USB_DEVICE(0x050d, 0x935b), USB_DEVICE_DATA(&rt2800usb_ops) },
733 /* Buffalo */ 736 /* Buffalo */
734 { USB_DEVICE(0x0411, 0x00e8), USB_DEVICE_DATA(&rt2800usb_ops) }, 737 { USB_DEVICE(0x0411, 0x00e8), USB_DEVICE_DATA(&rt2800usb_ops) },
738 { USB_DEVICE(0x0411, 0x016f), USB_DEVICE_DATA(&rt2800usb_ops) },
735 /* Conceptronic */ 739 /* Conceptronic */
736 { USB_DEVICE(0x14b2, 0x3c06), USB_DEVICE_DATA(&rt2800usb_ops) }, 740 { USB_DEVICE(0x14b2, 0x3c06), USB_DEVICE_DATA(&rt2800usb_ops) },
737 { USB_DEVICE(0x14b2, 0x3c07), USB_DEVICE_DATA(&rt2800usb_ops) }, 741 { USB_DEVICE(0x14b2, 0x3c07), USB_DEVICE_DATA(&rt2800usb_ops) },
@@ -818,6 +822,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
818 /* Pegatron */ 822 /* Pegatron */
819 { USB_DEVICE(0x1d4d, 0x000c), USB_DEVICE_DATA(&rt2800usb_ops) }, 823 { USB_DEVICE(0x1d4d, 0x000c), USB_DEVICE_DATA(&rt2800usb_ops) },
820 { USB_DEVICE(0x1d4d, 0x000e), USB_DEVICE_DATA(&rt2800usb_ops) }, 824 { USB_DEVICE(0x1d4d, 0x000e), USB_DEVICE_DATA(&rt2800usb_ops) },
825 { USB_DEVICE(0x1d4d, 0x0011), USB_DEVICE_DATA(&rt2800usb_ops) },
821 /* Philips */ 826 /* Philips */
822 { USB_DEVICE(0x0471, 0x200f), USB_DEVICE_DATA(&rt2800usb_ops) }, 827 { USB_DEVICE(0x0471, 0x200f), USB_DEVICE_DATA(&rt2800usb_ops) },
823 /* Planex */ 828 /* Planex */
@@ -899,6 +904,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
899 { USB_DEVICE(0x148f, 0x3572), USB_DEVICE_DATA(&rt2800usb_ops) }, 904 { USB_DEVICE(0x148f, 0x3572), USB_DEVICE_DATA(&rt2800usb_ops) },
900 /* Sitecom */ 905 /* Sitecom */
901 { USB_DEVICE(0x0df6, 0x0041), USB_DEVICE_DATA(&rt2800usb_ops) }, 906 { USB_DEVICE(0x0df6, 0x0041), USB_DEVICE_DATA(&rt2800usb_ops) },
907 /* Toshiba */
908 { USB_DEVICE(0x0930, 0x0a07), USB_DEVICE_DATA(&rt2800usb_ops) },
902 /* Zinwell */ 909 /* Zinwell */
903 { USB_DEVICE(0x5a57, 0x0284), USB_DEVICE_DATA(&rt2800usb_ops) }, 910 { USB_DEVICE(0x5a57, 0x0284), USB_DEVICE_DATA(&rt2800usb_ops) },
904#endif 911#endif
@@ -961,7 +968,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
961 { USB_DEVICE(0x05a6, 0x0101), USB_DEVICE_DATA(&rt2800usb_ops) }, 968 { USB_DEVICE(0x05a6, 0x0101), USB_DEVICE_DATA(&rt2800usb_ops) },
962 { USB_DEVICE(0x1d4d, 0x0002), USB_DEVICE_DATA(&rt2800usb_ops) }, 969 { USB_DEVICE(0x1d4d, 0x0002), USB_DEVICE_DATA(&rt2800usb_ops) },
963 { USB_DEVICE(0x1d4d, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) }, 970 { USB_DEVICE(0x1d4d, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) },
964 { USB_DEVICE(0x1d4d, 0x0011), USB_DEVICE_DATA(&rt2800usb_ops) },
965 /* Planex */ 971 /* Planex */
966 { USB_DEVICE(0x2019, 0x5201), USB_DEVICE_DATA(&rt2800usb_ops) }, 972 { USB_DEVICE(0x2019, 0x5201), USB_DEVICE_DATA(&rt2800usb_ops) },
967 { USB_DEVICE(0x2019, 0xab24), USB_DEVICE_DATA(&rt2800usb_ops) }, 973 { USB_DEVICE(0x2019, 0xab24), USB_DEVICE_DATA(&rt2800usb_ops) },
@@ -975,8 +981,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
975 /* Sweex */ 981 /* Sweex */
976 { USB_DEVICE(0x177f, 0x0153), USB_DEVICE_DATA(&rt2800usb_ops) }, 982 { USB_DEVICE(0x177f, 0x0153), USB_DEVICE_DATA(&rt2800usb_ops) },
977 { USB_DEVICE(0x177f, 0x0313), USB_DEVICE_DATA(&rt2800usb_ops) }, 983 { USB_DEVICE(0x177f, 0x0313), USB_DEVICE_DATA(&rt2800usb_ops) },
978 /* Toshiba */
979 { USB_DEVICE(0x0930, 0x0a07), USB_DEVICE_DATA(&rt2800usb_ops) },
980 /* Zyxel */ 984 /* Zyxel */
981 { USB_DEVICE(0x0586, 0x341a), USB_DEVICE_DATA(&rt2800usb_ops) }, 985 { USB_DEVICE(0x0586, 0x341a), USB_DEVICE_DATA(&rt2800usb_ops) },
982#endif 986#endif
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 9de9dbe94399..84eb6ad36377 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1062,8 +1062,10 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
1062 * Stop all work. 1062 * Stop all work.
1063 */ 1063 */
1064 cancel_work_sync(&rt2x00dev->intf_work); 1064 cancel_work_sync(&rt2x00dev->intf_work);
1065 cancel_work_sync(&rt2x00dev->rxdone_work); 1065 if (rt2x00_is_usb(rt2x00dev)) {
1066 cancel_work_sync(&rt2x00dev->txdone_work); 1066 cancel_work_sync(&rt2x00dev->rxdone_work);
1067 cancel_work_sync(&rt2x00dev->txdone_work);
1068 }
1067 destroy_workqueue(rt2x00dev->workqueue); 1069 destroy_workqueue(rt2x00dev->workqueue);
1068 1070
1069 /* 1071 /*
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c
index f74a8701c67d..590f14f45a89 100644
--- a/drivers/net/wireless/rtlwifi/efuse.c
+++ b/drivers/net/wireless/rtlwifi/efuse.c
@@ -685,7 +685,7 @@ static int efuse_pg_packet_read(struct ieee80211_hw *hw, u8 offset, u8 *data)
685 685
686 u8 efuse_data, word_cnts = 0; 686 u8 efuse_data, word_cnts = 0;
687 u16 efuse_addr = 0; 687 u16 efuse_addr = 0;
688 u8 hworden; 688 u8 hworden = 0;
689 u8 tmpdata[8]; 689 u8 tmpdata[8];
690 690
691 if (data == NULL) 691 if (data == NULL)
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
index 5ef91374b230..28a6ce3bc239 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
@@ -303,7 +303,7 @@ static void _rtl92c_fill_h2c_command(struct ieee80211_hw *hw,
303 u16 box_reg, box_extreg; 303 u16 box_reg, box_extreg;
304 u8 u1b_tmp; 304 u8 u1b_tmp;
305 bool isfw_read = false; 305 bool isfw_read = false;
306 u8 buf_index; 306 u8 buf_index = 0;
307 bool bwrite_sucess = false; 307 bool bwrite_sucess = false;
308 u8 wait_h2c_limmit = 100; 308 u8 wait_h2c_limmit = 100;
309 u8 wait_writeh2c_limmit = 100; 309 u8 wait_writeh2c_limmit = 100;
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index a4b2613d6a8c..f5d85735d642 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -246,7 +246,7 @@ static void _rtl_usb_io_handler_init(struct device *dev,
246 246
247static void _rtl_usb_io_handler_release(struct ieee80211_hw *hw) 247static void _rtl_usb_io_handler_release(struct ieee80211_hw *hw)
248{ 248{
249 struct rtl_priv *rtlpriv = rtl_priv(hw); 249 struct rtl_priv __maybe_unused *rtlpriv = rtl_priv(hw);
250 250
251 mutex_destroy(&rtlpriv->io.bb_mutex); 251 mutex_destroy(&rtlpriv->io.bb_mutex);
252} 252}
diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c
index 5b9dbeafec06..b1c7d031c391 100644
--- a/drivers/net/wireless/wl12xx/sdio.c
+++ b/drivers/net/wireless/wl12xx/sdio.c
@@ -340,7 +340,7 @@ module_init(wl1271_init);
340module_exit(wl1271_exit); 340module_exit(wl1271_exit);
341 341
342MODULE_LICENSE("GPL"); 342MODULE_LICENSE("GPL");
343MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>"); 343MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
344MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>"); 344MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
345MODULE_FIRMWARE(WL1271_FW_NAME); 345MODULE_FIRMWARE(WL1271_FW_NAME);
346MODULE_FIRMWARE(WL1271_AP_FW_NAME); 346MODULE_FIRMWARE(WL1271_AP_FW_NAME);
diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
index 18cf01719ae0..ffc745b17f4d 100644
--- a/drivers/net/wireless/wl12xx/spi.c
+++ b/drivers/net/wireless/wl12xx/spi.c
@@ -487,7 +487,7 @@ module_init(wl1271_init);
487module_exit(wl1271_exit); 487module_exit(wl1271_exit);
488 488
489MODULE_LICENSE("GPL"); 489MODULE_LICENSE("GPL");
490MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>"); 490MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
491MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>"); 491MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
492MODULE_FIRMWARE(WL1271_FW_NAME); 492MODULE_FIRMWARE(WL1271_FW_NAME);
493MODULE_FIRMWARE(WL1271_AP_FW_NAME); 493MODULE_FIRMWARE(WL1271_AP_FW_NAME);
diff --git a/drivers/net/wireless/wl12xx/testmode.c b/drivers/net/wireless/wl12xx/testmode.c
index e64403b6896d..6ec06a4a4c6d 100644
--- a/drivers/net/wireless/wl12xx/testmode.c
+++ b/drivers/net/wireless/wl12xx/testmode.c
@@ -204,7 +204,10 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[])
204 204
205 kfree(wl->nvs); 205 kfree(wl->nvs);
206 206
207 wl->nvs = kzalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL); 207 if (len != sizeof(struct wl1271_nvs_file))
208 return -EINVAL;
209
210 wl->nvs = kzalloc(len, GFP_KERNEL);
208 if (!wl->nvs) { 211 if (!wl->nvs) {
209 wl1271_error("could not allocate memory for the nvs file"); 212 wl1271_error("could not allocate memory for the nvs file");
210 ret = -ENOMEM; 213 ret = -ENOMEM;
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index 58236e6d0921..ab607bbd6291 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -643,7 +643,7 @@ static void rx_urb_complete(struct urb *urb)
643 usb = urb->context; 643 usb = urb->context;
644 rx = &usb->rx; 644 rx = &usb->rx;
645 645
646 zd_usb_reset_rx_idle_timer(usb); 646 tasklet_schedule(&rx->reset_timer_tasklet);
647 647
648 if (length%rx->usb_packet_size > rx->usb_packet_size-4) { 648 if (length%rx->usb_packet_size > rx->usb_packet_size-4) {
649 /* If there is an old first fragment, we don't care. */ 649 /* If there is an old first fragment, we don't care. */
@@ -812,6 +812,7 @@ void zd_usb_disable_rx(struct zd_usb *usb)
812 __zd_usb_disable_rx(usb); 812 __zd_usb_disable_rx(usb);
813 mutex_unlock(&rx->setup_mutex); 813 mutex_unlock(&rx->setup_mutex);
814 814
815 tasklet_kill(&rx->reset_timer_tasklet);
815 cancel_delayed_work_sync(&rx->idle_work); 816 cancel_delayed_work_sync(&rx->idle_work);
816} 817}
817 818
@@ -1106,6 +1107,13 @@ static void zd_rx_idle_timer_handler(struct work_struct *work)
1106 zd_usb_reset_rx(usb); 1107 zd_usb_reset_rx(usb);
1107} 1108}
1108 1109
1110static void zd_usb_reset_rx_idle_timer_tasklet(unsigned long param)
1111{
1112 struct zd_usb *usb = (struct zd_usb *)param;
1113
1114 zd_usb_reset_rx_idle_timer(usb);
1115}
1116
1109void zd_usb_reset_rx_idle_timer(struct zd_usb *usb) 1117void zd_usb_reset_rx_idle_timer(struct zd_usb *usb)
1110{ 1118{
1111 struct zd_usb_rx *rx = &usb->rx; 1119 struct zd_usb_rx *rx = &usb->rx;
@@ -1127,6 +1135,7 @@ static inline void init_usb_interrupt(struct zd_usb *usb)
1127static inline void init_usb_rx(struct zd_usb *usb) 1135static inline void init_usb_rx(struct zd_usb *usb)
1128{ 1136{
1129 struct zd_usb_rx *rx = &usb->rx; 1137 struct zd_usb_rx *rx = &usb->rx;
1138
1130 spin_lock_init(&rx->lock); 1139 spin_lock_init(&rx->lock);
1131 mutex_init(&rx->setup_mutex); 1140 mutex_init(&rx->setup_mutex);
1132 if (interface_to_usbdev(usb->intf)->speed == USB_SPEED_HIGH) { 1141 if (interface_to_usbdev(usb->intf)->speed == USB_SPEED_HIGH) {
@@ -1136,11 +1145,14 @@ static inline void init_usb_rx(struct zd_usb *usb)
1136 } 1145 }
1137 ZD_ASSERT(rx->fragment_length == 0); 1146 ZD_ASSERT(rx->fragment_length == 0);
1138 INIT_DELAYED_WORK(&rx->idle_work, zd_rx_idle_timer_handler); 1147 INIT_DELAYED_WORK(&rx->idle_work, zd_rx_idle_timer_handler);
1148 rx->reset_timer_tasklet.func = zd_usb_reset_rx_idle_timer_tasklet;
1149 rx->reset_timer_tasklet.data = (unsigned long)usb;
1139} 1150}
1140 1151
1141static inline void init_usb_tx(struct zd_usb *usb) 1152static inline void init_usb_tx(struct zd_usb *usb)
1142{ 1153{
1143 struct zd_usb_tx *tx = &usb->tx; 1154 struct zd_usb_tx *tx = &usb->tx;
1155
1144 spin_lock_init(&tx->lock); 1156 spin_lock_init(&tx->lock);
1145 atomic_set(&tx->enabled, 0); 1157 atomic_set(&tx->enabled, 0);
1146 tx->stopped = 0; 1158 tx->stopped = 0;
@@ -1671,6 +1683,10 @@ static void iowrite16v_urb_complete(struct urb *urb)
1671 1683
1672 if (urb->status && !usb->cmd_error) 1684 if (urb->status && !usb->cmd_error)
1673 usb->cmd_error = urb->status; 1685 usb->cmd_error = urb->status;
1686
1687 if (!usb->cmd_error &&
1688 urb->actual_length != urb->transfer_buffer_length)
1689 usb->cmd_error = -EIO;
1674} 1690}
1675 1691
1676static int zd_submit_waiting_urb(struct zd_usb *usb, bool last) 1692static int zd_submit_waiting_urb(struct zd_usb *usb, bool last)
@@ -1805,7 +1821,7 @@ int zd_usb_iowrite16v_async(struct zd_usb *usb, const struct zd_ioreq16 *ioreqs,
1805 usb_fill_int_urb(urb, udev, usb_sndintpipe(udev, EP_REGS_OUT), 1821 usb_fill_int_urb(urb, udev, usb_sndintpipe(udev, EP_REGS_OUT),
1806 req, req_len, iowrite16v_urb_complete, usb, 1822 req, req_len, iowrite16v_urb_complete, usb,
1807 ep->desc.bInterval); 1823 ep->desc.bInterval);
1808 urb->transfer_flags |= URB_FREE_BUFFER | URB_SHORT_NOT_OK; 1824 urb->transfer_flags |= URB_FREE_BUFFER;
1809 1825
1810 /* Submit previous URB */ 1826 /* Submit previous URB */
1811 r = zd_submit_waiting_urb(usb, false); 1827 r = zd_submit_waiting_urb(usb, false);
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.h b/drivers/net/wireless/zd1211rw/zd_usb.h
index b3df2c8116cc..325d0f989257 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.h
+++ b/drivers/net/wireless/zd1211rw/zd_usb.h
@@ -183,6 +183,7 @@ struct zd_usb_rx {
183 spinlock_t lock; 183 spinlock_t lock;
184 struct mutex setup_mutex; 184 struct mutex setup_mutex;
185 struct delayed_work idle_work; 185 struct delayed_work idle_work;
186 struct tasklet_struct reset_timer_tasklet;
186 u8 fragment[2 * USB_MAX_RX_SIZE]; 187 u8 fragment[2 * USB_MAX_RX_SIZE];
187 unsigned int fragment_length; 188 unsigned int fragment_length;
188 unsigned int usb_packet_size; 189 unsigned int usb_packet_size;