forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/net/wireless/intel/ipw2x00/ipw2200.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /******************************************************************************
23
34 Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved.
....@@ -8,21 +9,6 @@
89 By Gerald Combs <gerald@ethereal.com>
910 Copyright 1998 Gerald Combs
1011
11
- This program is free software; you can redistribute it and/or modify it
12
- under the terms of version 2 of the GNU General Public License as
13
- published by the Free Software Foundation.
14
-
15
- This program is distributed in the hope that it will be useful, but WITHOUT
16
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18
- more details.
19
-
20
- You should have received a copy of the GNU General Public License along with
21
- this program; if not, write to the Free Software Foundation, Inc., 59
22
- Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
-
24
- The full GNU General Public License is included in this distribution in the
25
- file called LICENSE.
2612
2713 Contact Information:
2814 Intel Linux Wireless <ilw@linux.intel.com>
....@@ -237,30 +223,30 @@
237223 int out, i, j, l;
238224 char c;
239225
240
- out = snprintf(buf, count, "%08X", ofs);
226
+ out = scnprintf(buf, count, "%08X", ofs);
241227
242228 for (l = 0, i = 0; i < 2; i++) {
243
- out += snprintf(buf + out, count - out, " ");
229
+ out += scnprintf(buf + out, count - out, " ");
244230 for (j = 0; j < 8 && l < len; j++, l++)
245
- out += snprintf(buf + out, count - out, "%02X ",
231
+ out += scnprintf(buf + out, count - out, "%02X ",
246232 data[(i * 8 + j)]);
247233 for (; j < 8; j++)
248
- out += snprintf(buf + out, count - out, " ");
234
+ out += scnprintf(buf + out, count - out, " ");
249235 }
250236
251
- out += snprintf(buf + out, count - out, " ");
237
+ out += scnprintf(buf + out, count - out, " ");
252238 for (l = 0, i = 0; i < 2; i++) {
253
- out += snprintf(buf + out, count - out, " ");
239
+ out += scnprintf(buf + out, count - out, " ");
254240 for (j = 0; j < 8 && l < len; j++, l++) {
255241 c = data[(i * 8 + j)];
256242 if (!isascii(c) || !isprint(c))
257243 c = '.';
258244
259
- out += snprintf(buf + out, count - out, "%c", c);
245
+ out += scnprintf(buf + out, count - out, "%c", c);
260246 }
261247
262248 for (; j < 8; j++)
263
- out += snprintf(buf + out, count - out, " ");
249
+ out += scnprintf(buf + out, count - out, " ");
264250 }
265251
266252 return out;
....@@ -1293,12 +1279,12 @@
12931279 log_len = log_size / sizeof(*log);
12941280 ipw_capture_event_log(priv, log_len, log);
12951281
1296
- len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len);
1282
+ len += scnprintf(buf + len, PAGE_SIZE - len, "%08X", log_len);
12971283 for (i = 0; i < log_len; i++)
1298
- len += snprintf(buf + len, PAGE_SIZE - len,
1284
+ len += scnprintf(buf + len, PAGE_SIZE - len,
12991285 "\n%08X%08X%08X",
13001286 log[i].time, log[i].event, log[i].data);
1301
- len += snprintf(buf + len, PAGE_SIZE - len, "\n");
1287
+ len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
13021288 kfree(log);
13031289 return len;
13041290 }
....@@ -1312,13 +1298,13 @@
13121298 u32 len = 0, i;
13131299 if (!priv->error)
13141300 return 0;
1315
- len += snprintf(buf + len, PAGE_SIZE - len,
1301
+ len += scnprintf(buf + len, PAGE_SIZE - len,
13161302 "%08lX%08X%08X%08X",
13171303 priv->error->jiffies,
13181304 priv->error->status,
13191305 priv->error->config, priv->error->elem_len);
13201306 for (i = 0; i < priv->error->elem_len; i++)
1321
- len += snprintf(buf + len, PAGE_SIZE - len,
1307
+ len += scnprintf(buf + len, PAGE_SIZE - len,
13221308 "\n%08X%08X%08X%08X%08X%08X%08X",
13231309 priv->error->elem[i].time,
13241310 priv->error->elem[i].desc,
....@@ -1328,15 +1314,15 @@
13281314 priv->error->elem[i].link2,
13291315 priv->error->elem[i].data);
13301316
1331
- len += snprintf(buf + len, PAGE_SIZE - len,
1317
+ len += scnprintf(buf + len, PAGE_SIZE - len,
13321318 "\n%08X", priv->error->log_len);
13331319 for (i = 0; i < priv->error->log_len; i++)
1334
- len += snprintf(buf + len, PAGE_SIZE - len,
1320
+ len += scnprintf(buf + len, PAGE_SIZE - len,
13351321 "\n%08X%08X%08X",
13361322 priv->error->log[i].time,
13371323 priv->error->log[i].event,
13381324 priv->error->log[i].data);
1339
- len += snprintf(buf + len, PAGE_SIZE - len, "\n");
1325
+ len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
13401326 return len;
13411327 }
13421328
....@@ -1364,7 +1350,7 @@
13641350 (i != priv->cmdlog_pos) && (len < PAGE_SIZE);
13651351 i = (i + 1) % priv->cmdlog_len) {
13661352 len +=
1367
- snprintf(buf + len, PAGE_SIZE - len,
1353
+ scnprintf(buf + len, PAGE_SIZE - len,
13681354 "\n%08lX%08X%08X%08X\n", priv->cmdlog[i].jiffies,
13691355 priv->cmdlog[i].retcode, priv->cmdlog[i].cmd.cmd,
13701356 priv->cmdlog[i].cmd.len);
....@@ -1372,9 +1358,9 @@
13721358 snprintk_buf(buf + len, PAGE_SIZE - len,
13731359 (u8 *) priv->cmdlog[i].cmd.param,
13741360 priv->cmdlog[i].cmd.len);
1375
- len += snprintf(buf + len, PAGE_SIZE - len, "\n");
1361
+ len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
13761362 }
1377
- len += snprintf(buf + len, PAGE_SIZE - len, "\n");
1363
+ len += scnprintf(buf + len, PAGE_SIZE - len, "\n");
13781364 return len;
13791365 }
13801366
....@@ -1959,12 +1945,11 @@
19591945 wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL);
19601946 }
19611947
1962
-static void ipw_irq_tasklet(unsigned long data)
1948
+static void ipw_irq_tasklet(struct tasklet_struct *t)
19631949 {
1964
- struct ipw_priv *priv = (struct ipw_priv *)data;
1950
+ struct ipw_priv *priv = from_tasklet(priv, t, irq_tasklet);
19651951 u32 inta, inta_mask, handled = 0;
19661952 unsigned long flags;
1967
- int rc = 0;
19681953
19691954 spin_lock_irqsave(&priv->irq_lock, flags);
19701955
....@@ -1994,7 +1979,7 @@
19941979
19951980 if (inta & IPW_INTA_BIT_TX_CMD_QUEUE) {
19961981 IPW_DEBUG_HC("Command completed.\n");
1997
- rc = ipw_queue_tx_reclaim(priv, &priv->txq_cmd, -1);
1982
+ ipw_queue_tx_reclaim(priv, &priv->txq_cmd, -1);
19981983 priv->status &= ~STATUS_HCMD_ACTIVE;
19991984 wake_up_interruptible(&priv->wait_command_queue);
20001985 handled |= IPW_INTA_BIT_TX_CMD_QUEUE;
....@@ -2002,25 +1987,25 @@
20021987
20031988 if (inta & IPW_INTA_BIT_TX_QUEUE_1) {
20041989 IPW_DEBUG_TX("TX_QUEUE_1\n");
2005
- rc = ipw_queue_tx_reclaim(priv, &priv->txq[0], 0);
1990
+ ipw_queue_tx_reclaim(priv, &priv->txq[0], 0);
20061991 handled |= IPW_INTA_BIT_TX_QUEUE_1;
20071992 }
20081993
20091994 if (inta & IPW_INTA_BIT_TX_QUEUE_2) {
20101995 IPW_DEBUG_TX("TX_QUEUE_2\n");
2011
- rc = ipw_queue_tx_reclaim(priv, &priv->txq[1], 1);
1996
+ ipw_queue_tx_reclaim(priv, &priv->txq[1], 1);
20121997 handled |= IPW_INTA_BIT_TX_QUEUE_2;
20131998 }
20141999
20152000 if (inta & IPW_INTA_BIT_TX_QUEUE_3) {
20162001 IPW_DEBUG_TX("TX_QUEUE_3\n");
2017
- rc = ipw_queue_tx_reclaim(priv, &priv->txq[2], 2);
2002
+ ipw_queue_tx_reclaim(priv, &priv->txq[2], 2);
20182003 handled |= IPW_INTA_BIT_TX_QUEUE_3;
20192004 }
20202005
20212006 if (inta & IPW_INTA_BIT_TX_QUEUE_4) {
20222007 IPW_DEBUG_TX("TX_QUEUE_4\n");
2023
- rc = ipw_queue_tx_reclaim(priv, &priv->txq[3], 3);
2008
+ ipw_queue_tx_reclaim(priv, &priv->txq[3], 3);
20242009 handled |= IPW_INTA_BIT_TX_QUEUE_4;
20252010 }
20262011
....@@ -2736,7 +2721,7 @@
27362721 /* Do not load eeprom data on fatal error or suspend */
27372722 ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 0);
27382723 } else {
2739
- IPW_DEBUG_INFO("Enabling FW initializationg of SRAM\n");
2724
+ IPW_DEBUG_INFO("Enabling FW initialization of SRAM\n");
27402725
27412726 /* Load eeprom data on fatal error or suspend */
27422727 ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 1);
....@@ -3013,7 +2998,7 @@
30132998 spin_unlock_irqrestore(&priv->ieee->lock, flags);
30142999 }
30153000
3016
-/**
3001
+/*
30173002 * Check that card is still alive.
30183003 * Reads debug register from domain0.
30193004 * If card is present, pre-defined value should
....@@ -3128,7 +3113,7 @@
31283113 mdelay(1);
31293114
31303115 /* write ucode */
3131
- /**
3116
+ /*
31323117 * @bug
31333118 * Do NOT set indirect address register once and then
31343119 * store data to indirect data register in the loop.
....@@ -3400,7 +3385,7 @@
34003385 __le32 boot_size;
34013386 __le32 ucode_size;
34023387 __le32 fw_size;
3403
- u8 data[0];
3388
+ u8 data[];
34043389 };
34053390
34063391 static int ipw_get_fw(struct ipw_priv *priv,
....@@ -3456,9 +3441,10 @@
34563441 /* In the reset function, these buffers may have been allocated
34573442 * to an SKB, so we need to unmap and free potential storage */
34583443 if (rxq->pool[i].skb != NULL) {
3459
- pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr,
3460
- IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
3461
- dev_kfree_skb(rxq->pool[i].skb);
3444
+ dma_unmap_single(&priv->pci_dev->dev,
3445
+ rxq->pool[i].dma_addr,
3446
+ IPW_RX_BUF_SIZE, DMA_FROM_DEVICE);
3447
+ dev_kfree_skb_irq(rxq->pool[i].skb);
34623448 rxq->pool[i].skb = NULL;
34633449 }
34643450 list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
....@@ -3680,7 +3666,7 @@
36803666 return rc;
36813667 }
36823668
3683
-/**
3669
+/*
36843670 * DMA services
36853671 *
36863672 * Theory of operation
....@@ -3703,11 +3689,11 @@
37033689 * we only utilize the first data transmit queue (queue1).
37043690 */
37053691
3706
-/**
3692
+/*
37073693 * Driver allocates buffers of this size for Rx
37083694 */
37093695
3710
-/**
3696
+/*
37113697 * ipw_rx_queue_space - Return number of free slots available in queue.
37123698 */
37133699 static int ipw_rx_queue_space(const struct ipw_rx_queue *q)
....@@ -3738,7 +3724,7 @@
37383724 return (++index == n_bd) ? 0 : index;
37393725 }
37403726
3741
-/**
3727
+/*
37423728 * Initialize common DMA queue structure
37433729 *
37443730 * @param q queue to init
....@@ -3784,13 +3770,12 @@
37843770 struct pci_dev *dev = priv->pci_dev;
37853771
37863772 q->txb = kmalloc_array(count, sizeof(q->txb[0]), GFP_KERNEL);
3787
- if (!q->txb) {
3788
- IPW_ERROR("vmalloc for auxiliary BD structures failed\n");
3773
+ if (!q->txb)
37893774 return -ENOMEM;
3790
- }
37913775
37923776 q->bd =
3793
- pci_alloc_consistent(dev, sizeof(q->bd[0]) * count, &q->q.dma_addr);
3777
+ dma_alloc_coherent(&dev->dev, sizeof(q->bd[0]) * count,
3778
+ &q->q.dma_addr, GFP_KERNEL);
37943779 if (!q->bd) {
37953780 IPW_ERROR("pci_alloc_consistent(%zd) failed\n",
37963781 sizeof(q->bd[0]) * count);
....@@ -3803,7 +3788,7 @@
38033788 return 0;
38043789 }
38053790
3806
-/**
3791
+/*
38073792 * Free one TFD, those at index [txq->q.last_used].
38083793 * Do NOT advance any indexes
38093794 *
....@@ -3826,15 +3811,16 @@
38263811 if (le32_to_cpu(bd->u.data.num_chunks) > NUM_TFD_CHUNKS) {
38273812 IPW_ERROR("Too many chunks: %i\n",
38283813 le32_to_cpu(bd->u.data.num_chunks));
3829
- /** @todo issue fatal error, it is quite serious situation */
3814
+ /* @todo issue fatal error, it is quite serious situation */
38303815 return;
38313816 }
38323817
38333818 /* unmap chunks if any */
38343819 for (i = 0; i < le32_to_cpu(bd->u.data.num_chunks); i++) {
3835
- pci_unmap_single(dev, le32_to_cpu(bd->u.data.chunk_ptr[i]),
3820
+ dma_unmap_single(&dev->dev,
3821
+ le32_to_cpu(bd->u.data.chunk_ptr[i]),
38363822 le16_to_cpu(bd->u.data.chunk_len[i]),
3837
- PCI_DMA_TODEVICE);
3823
+ DMA_TO_DEVICE);
38383824 if (txq->txb[txq->q.last_used]) {
38393825 libipw_txb_free(txq->txb[txq->q.last_used]);
38403826 txq->txb[txq->q.last_used] = NULL;
....@@ -3842,7 +3828,7 @@
38423828 }
38433829 }
38443830
3845
-/**
3831
+/*
38463832 * Deallocate DMA queue.
38473833 *
38483834 * Empty queue by removing and destroying all BD's.
....@@ -3866,15 +3852,15 @@
38663852 }
38673853
38683854 /* free buffers belonging to queue itself */
3869
- pci_free_consistent(dev, sizeof(txq->bd[0]) * q->n_bd, txq->bd,
3870
- q->dma_addr);
3855
+ dma_free_coherent(&dev->dev, sizeof(txq->bd[0]) * q->n_bd, txq->bd,
3856
+ q->dma_addr);
38713857 kfree(txq->txb);
38723858
38733859 /* 0 fill whole structure */
38743860 memset(txq, 0, sizeof(*txq));
38753861 }
38763862
3877
-/**
3863
+/*
38783864 * Destroy all DMA queues and structures
38793865 *
38803866 * @param priv
....@@ -4479,7 +4465,7 @@
44794465 }
44804466 }
44814467
4482
-/**
4468
+/*
44834469 * Handle host notification packet.
44844470 * Called from interrupt routine
44854471 */
....@@ -4939,7 +4925,7 @@
49394925 }
49404926 }
49414927
4942
-/**
4928
+/*
49434929 * Destroys all DMA structures and initialise them again
49444930 *
49454931 * @param priv
....@@ -4948,7 +4934,7 @@
49484934 static int ipw_queue_reset(struct ipw_priv *priv)
49494935 {
49504936 int rc = 0;
4951
- /** @todo customize queue sizes */
4937
+ /* @todo customize queue sizes */
49524938 int nTx = 64, nTxCmd = 8;
49534939 ipw_tx_queue_free(priv);
49544940 /* Tx CMD queue */
....@@ -5004,7 +4990,7 @@
50044990 return rc;
50054991 }
50064992
5007
-/**
4993
+/*
50084994 * Reclaim Tx queue entries no more used by NIC.
50094995 *
50104996 * When FW advances 'R' index, all entries between old and
....@@ -5212,8 +5198,8 @@
52125198 list_del(element);
52135199
52145200 rxb->dma_addr =
5215
- pci_map_single(priv->pci_dev, rxb->skb->data,
5216
- IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
5201
+ dma_map_single(&priv->pci_dev->dev, rxb->skb->data,
5202
+ IPW_RX_BUF_SIZE, DMA_FROM_DEVICE);
52175203
52185204 list_add_tail(&rxb->list, &rxq->rx_free);
52195205 rxq->free_count++;
....@@ -5246,8 +5232,9 @@
52465232
52475233 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
52485234 if (rxq->pool[i].skb != NULL) {
5249
- pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr,
5250
- IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
5235
+ dma_unmap_single(&priv->pci_dev->dev,
5236
+ rxq->pool[i].dma_addr,
5237
+ IPW_RX_BUF_SIZE, DMA_FROM_DEVICE);
52515238 dev_kfree_skb(rxq->pool[i].skb);
52525239 }
52535240 }
....@@ -5653,7 +5640,7 @@
56535640 }
56545641
56555642 mutex_lock(&priv->mutex);
5656
- if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) {
5643
+ if (priv->ieee->iw_mode == IW_MODE_ADHOC) {
56575644 IPW_DEBUG_MERGE("remove network %*pE\n",
56585645 priv->essid_len, priv->essid);
56595646 ipw_remove_current_network(priv);
....@@ -6803,9 +6790,6 @@
68036790 {
68046791 struct ipw_priv *priv = libipw_priv(dev);
68056792 struct iw_mlme *mlme = (struct iw_mlme *)extra;
6806
- __le16 reason;
6807
-
6808
- reason = cpu_to_le16(mlme->reason_code);
68096793
68106794 switch (mlme->cmd) {
68116795 case IW_MLME_DEAUTH:
....@@ -7059,23 +7043,22 @@
70597043 * off the network from the associated setting, adjust the QoS
70607044 * setting
70617045 */
7062
-static int ipw_qos_association_resp(struct ipw_priv *priv,
7046
+static void ipw_qos_association_resp(struct ipw_priv *priv,
70637047 struct libipw_network *network)
70647048 {
7065
- int ret = 0;
70667049 unsigned long flags;
70677050 u32 size = sizeof(struct libipw_qos_parameters);
70687051 int set_qos_param = 0;
70697052
70707053 if ((priv == NULL) || (network == NULL) ||
70717054 (priv->assoc_network == NULL))
7072
- return ret;
7055
+ return;
70737056
70747057 if (!(priv->status & STATUS_ASSOCIATED))
7075
- return ret;
7058
+ return;
70767059
70777060 if ((priv->ieee->iw_mode != IW_MODE_INFRA))
7078
- return ret;
7061
+ return;
70797062
70807063 spin_lock_irqsave(&priv->ieee->lock, flags);
70817064 if (network->flags & NETWORK_HAS_QOS_PARAMETERS) {
....@@ -7105,8 +7088,6 @@
71057088
71067089 if (set_qos_param == 1)
71077090 schedule_work(&priv->qos_activate);
7108
-
7109
- return ret;
71107091 }
71117092
71127093 static u32 ipw_qos_get_burst_duration(struct ipw_priv *priv)
....@@ -8266,12 +8247,12 @@
82668247 struct ipw_rx_mem_buffer *rxb;
82678248 struct ipw_rx_packet *pkt;
82688249 struct libipw_hdr_4addr *header;
8269
- u32 r, w, i;
8250
+ u32 r, i;
82708251 u8 network_packet;
82718252 u8 fill_rx = 0;
82728253
82738254 r = ipw_read32(priv, IPW_RX_READ_INDEX);
8274
- w = ipw_read32(priv, IPW_RX_WRITE_INDEX);
8255
+ ipw_read32(priv, IPW_RX_WRITE_INDEX);
82758256 i = priv->rxq->read;
82768257
82778258 if (ipw_rx_queue_space (priv->rxq) > (RX_QUEUE_SIZE / 2))
....@@ -8285,9 +8266,8 @@
82858266 }
82868267 priv->rxq->queue[i] = NULL;
82878268
8288
- pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr,
8289
- IPW_RX_BUF_SIZE,
8290
- PCI_DMA_FROMDEVICE);
8269
+ dma_sync_single_for_cpu(&priv->pci_dev->dev, rxb->dma_addr,
8270
+ IPW_RX_BUF_SIZE, DMA_FROM_DEVICE);
82918271
82928272 pkt = (struct ipw_rx_packet *)rxb->skb->data;
82938273 IPW_DEBUG_RX("Packet: type=%02X seq=%02X bits=%02X\n",
....@@ -8439,8 +8419,8 @@
84398419 rxb->skb = NULL;
84408420 }
84418421
8442
- pci_unmap_single(priv->pci_dev, rxb->dma_addr,
8443
- IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
8422
+ dma_unmap_single(&priv->pci_dev->dev, rxb->dma_addr,
8423
+ IPW_RX_BUF_SIZE, DMA_FROM_DEVICE);
84448424 list_add_tail(&rxb->list, &priv->rxq->rx_used);
84458425
84468426 i = (i + 1) % RX_QUEUE_SIZE;
....@@ -8465,7 +8445,7 @@
84658445 #define DEFAULT_SHORT_RETRY_LIMIT 7U
84668446 #define DEFAULT_LONG_RETRY_LIMIT 4U
84678447
8468
-/**
8448
+/*
84698449 * ipw_sw_reset
84708450 * @option: options to control different reset behaviour
84718451 * 0 = reset everything except the 'disable' module_param
....@@ -9625,24 +9605,24 @@
96259605 int level = IPW_POWER_LEVEL(priv->power_mode);
96269606 char *p = extra;
96279607
9628
- p += snprintf(p, MAX_WX_STRING, "Power save level: %d ", level);
9608
+ p += scnprintf(p, MAX_WX_STRING, "Power save level: %d ", level);
96299609
96309610 switch (level) {
96319611 case IPW_POWER_AC:
9632
- p += snprintf(p, MAX_WX_STRING - (p - extra), "(AC)");
9612
+ p += scnprintf(p, MAX_WX_STRING - (p - extra), "(AC)");
96339613 break;
96349614 case IPW_POWER_BATTERY:
9635
- p += snprintf(p, MAX_WX_STRING - (p - extra), "(BATTERY)");
9615
+ p += scnprintf(p, MAX_WX_STRING - (p - extra), "(BATTERY)");
96369616 break;
96379617 default:
9638
- p += snprintf(p, MAX_WX_STRING - (p - extra),
9618
+ p += scnprintf(p, MAX_WX_STRING - (p - extra),
96399619 "(Timeout %dms, Period %dms)",
96409620 timeout_duration[level - 1] / 1000,
96419621 period_duration[level - 1] / 1000);
96429622 }
96439623
96449624 if (!(priv->power_mode & IPW_POWER_ENABLED))
9645
- p += snprintf(p, MAX_WX_STRING - (p - extra), " OFF");
9625
+ p += scnprintf(p, MAX_WX_STRING - (p - extra), " OFF");
96469626
96479627 wrqu->data.length = p - extra + 1;
96489628
....@@ -10239,11 +10219,10 @@
1023910219 txb->fragments[i]->len - hdr_len);
1024010220
1024110221 tfd->u.data.chunk_ptr[i] =
10242
- cpu_to_le32(pci_map_single
10243
- (priv->pci_dev,
10244
- txb->fragments[i]->data + hdr_len,
10245
- txb->fragments[i]->len - hdr_len,
10246
- PCI_DMA_TODEVICE));
10222
+ cpu_to_le32(dma_map_single(&priv->pci_dev->dev,
10223
+ txb->fragments[i]->data + hdr_len,
10224
+ txb->fragments[i]->len - hdr_len,
10225
+ DMA_TO_DEVICE));
1024710226 tfd->u.data.chunk_len[i] =
1024810227 cpu_to_le16(txb->fragments[i]->len - hdr_len);
1024910228 }
....@@ -10273,10 +10252,10 @@
1027310252 dev_kfree_skb_any(txb->fragments[i]);
1027410253 txb->fragments[i] = skb;
1027510254 tfd->u.data.chunk_ptr[i] =
10276
- cpu_to_le32(pci_map_single
10277
- (priv->pci_dev, skb->data,
10278
- remaining_bytes,
10279
- PCI_DMA_TODEVICE));
10255
+ cpu_to_le32(dma_map_single(&priv->pci_dev->dev,
10256
+ skb->data,
10257
+ remaining_bytes,
10258
+ DMA_TO_DEVICE));
1028010259
1028110260 le32_add_cpu(&tfd->u.data.num_chunks, 1);
1028210261 }
....@@ -10660,10 +10639,8 @@
1066010639 mutex_unlock(&priv->mutex);
1066110640 }
1066210641
10663
-static int ipw_setup_deferred_work(struct ipw_priv *priv)
10642
+static void ipw_setup_deferred_work(struct ipw_priv *priv)
1066410643 {
10665
- int ret = 0;
10666
-
1066710644 init_waitqueue_head(&priv->wait_command_queue);
1066810645 init_waitqueue_head(&priv->wait_state);
1066910646
....@@ -10695,10 +10672,7 @@
1069510672 INIT_WORK(&priv->qos_activate, ipw_bg_qos_activate);
1069610673 #endif /* CONFIG_IPW2200_QOS */
1069710674
10698
- tasklet_init(&priv->irq_tasklet,
10699
- ipw_irq_tasklet, (unsigned long)priv);
10700
-
10701
- return ret;
10675
+ tasklet_setup(&priv->irq_tasklet, ipw_irq_tasklet);
1070210676 }
1070310677
1070410678 static void shim__set_security(struct net_device *dev,
....@@ -10723,11 +10697,8 @@
1072310697 }
1072410698
1072510699 if (sec->flags & SEC_ACTIVE_KEY) {
10726
- if (sec->active_key <= 3) {
10727
- priv->ieee->sec.active_key = sec->active_key;
10728
- priv->ieee->sec.flags |= SEC_ACTIVE_KEY;
10729
- } else
10730
- priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY;
10700
+ priv->ieee->sec.active_key = sec->active_key;
10701
+ priv->ieee->sec.flags |= SEC_ACTIVE_KEY;
1073110702 priv->status |= STATUS_SECURITY_UPDATED;
1073210703 } else
1073310704 priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY;
....@@ -11429,9 +11400,14 @@
1142911400 set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev);
1143011401
1143111402 /* With that information in place, we can now register the wiphy... */
11432
- if (wiphy_register(wdev->wiphy))
11433
- rc = -EIO;
11403
+ rc = wiphy_register(wdev->wiphy);
11404
+ if (rc)
11405
+ goto out;
11406
+
11407
+ return 0;
1143411408 out:
11409
+ kfree(priv->ieee->a_band.channels);
11410
+ kfree(priv->ieee->bg_band.channels);
1143511411 return rc;
1143611412 }
1143711413
....@@ -11649,9 +11625,9 @@
1164911625
1165011626 pci_set_master(pdev);
1165111627
11652
- err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
11628
+ err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
1165311629 if (!err)
11654
- err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
11630
+ err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
1165511631 if (err) {
1165611632 printk(KERN_WARNING DRV_NAME ": No suitable DMA available.\n");
1165711633 goto out_pci_disable_device;
....@@ -11682,11 +11658,7 @@
1168211658 IPW_DEBUG_INFO("pci_resource_len = 0x%08x\n", length);
1168311659 IPW_DEBUG_INFO("pci_resource_base = %p\n", base);
1168411660
11685
- err = ipw_setup_deferred_work(priv);
11686
- if (err) {
11687
- IPW_ERROR("Unable to setup deferred work\n");
11688
- goto out_iounmap;
11689
- }
11661
+ ipw_setup_deferred_work(priv);
1169011662
1169111663 ipw_sw_reset(priv, 1);
1169211664
....@@ -11871,10 +11843,9 @@
1187111843 free_firmware();
1187211844 }
1187311845
11874
-#ifdef CONFIG_PM
11875
-static int ipw_pci_suspend(struct pci_dev *pdev, pm_message_t state)
11846
+static int __maybe_unused ipw_pci_suspend(struct device *dev_d)
1187611847 {
11877
- struct ipw_priv *priv = pci_get_drvdata(pdev);
11848
+ struct ipw_priv *priv = dev_get_drvdata(dev_d);
1187811849 struct net_device *dev = priv->net_dev;
1187911850
1188011851 printk(KERN_INFO "%s: Going into suspend...\n", dev->name);
....@@ -11885,32 +11856,19 @@
1188511856 /* Remove the PRESENT state of the device */
1188611857 netif_device_detach(dev);
1188711858
11888
- pci_save_state(pdev);
11889
- pci_disable_device(pdev);
11890
- pci_set_power_state(pdev, pci_choose_state(pdev, state));
11891
-
1189211859 priv->suspend_at = ktime_get_boottime_seconds();
1189311860
1189411861 return 0;
1189511862 }
1189611863
11897
-static int ipw_pci_resume(struct pci_dev *pdev)
11864
+static int __maybe_unused ipw_pci_resume(struct device *dev_d)
1189811865 {
11866
+ struct pci_dev *pdev = to_pci_dev(dev_d);
1189911867 struct ipw_priv *priv = pci_get_drvdata(pdev);
1190011868 struct net_device *dev = priv->net_dev;
11901
- int err;
1190211869 u32 val;
1190311870
1190411871 printk(KERN_INFO "%s: Coming out of suspend...\n", dev->name);
11905
-
11906
- pci_set_power_state(pdev, PCI_D0);
11907
- err = pci_enable_device(pdev);
11908
- if (err) {
11909
- printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
11910
- dev->name);
11911
- return err;
11912
- }
11913
- pci_restore_state(pdev);
1191411872
1191511873 /*
1191611874 * Suspend/Resume resets the PCI configuration space, so we have to
....@@ -11933,7 +11891,6 @@
1193311891
1193411892 return 0;
1193511893 }
11936
-#endif
1193711894
1193811895 static void ipw_pci_shutdown(struct pci_dev *pdev)
1193911896 {
....@@ -11945,16 +11902,15 @@
1194511902 pci_disable_device(pdev);
1194611903 }
1194711904
11905
+static SIMPLE_DEV_PM_OPS(ipw_pci_pm_ops, ipw_pci_suspend, ipw_pci_resume);
11906
+
1194811907 /* driver initialization stuff */
1194911908 static struct pci_driver ipw_driver = {
1195011909 .name = DRV_NAME,
1195111910 .id_table = card_ids,
1195211911 .probe = ipw_pci_probe,
1195311912 .remove = ipw_pci_remove,
11954
-#ifdef CONFIG_PM
11955
- .suspend = ipw_pci_suspend,
11956
- .resume = ipw_pci_resume,
11957
-#endif
11913
+ .driver.pm = &ipw_pci_pm_ops,
1195811914 .shutdown = ipw_pci_shutdown,
1195911915 };
1196011916