| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /****************************************************************************** |
|---|
| 2 | 3 | |
|---|
| 3 | 4 | Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved. |
|---|
| 4 | 5 | |
|---|
| 5 | | - This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - under the terms of version 2 of the GNU General Public License as |
|---|
| 7 | | - published by the Free Software Foundation. |
|---|
| 8 | | - |
|---|
| 9 | | - This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 10 | | - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 11 | | - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 12 | | - more details. |
|---|
| 13 | | - |
|---|
| 14 | | - You should have received a copy of the GNU General Public License along with |
|---|
| 15 | | - this program; if not, write to the Free Software Foundation, Inc., 59 |
|---|
| 16 | | - Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 17 | | - |
|---|
| 18 | | - The full GNU General Public License is included in this distribution in the |
|---|
| 19 | | - file called LICENSE. |
|---|
| 20 | 6 | |
|---|
| 21 | 7 | Contact Information: |
|---|
| 22 | 8 | Intel Linux Wireless <ilw@linux.intel.com> |
|---|
| .. | .. |
|---|
| 215 | 201 | #define IPW_DEBUG(level, message...) \ |
|---|
| 216 | 202 | do { \ |
|---|
| 217 | 203 | if (ipw2100_debug_level & (level)) { \ |
|---|
| 218 | | - printk(KERN_DEBUG "ipw2100: %c %s ", \ |
|---|
| 219 | | - in_interrupt() ? 'I' : 'U', __func__); \ |
|---|
| 204 | + printk(KERN_DEBUG "ipw2100: %s ", __func__); \ |
|---|
| 220 | 205 | printk(message); \ |
|---|
| 221 | 206 | } \ |
|---|
| 222 | 207 | } while (0) |
|---|
| .. | .. |
|---|
| 643 | 628 | int out, i, j, l; |
|---|
| 644 | 629 | char c; |
|---|
| 645 | 630 | |
|---|
| 646 | | - out = snprintf(buf, count, "%08X", ofs); |
|---|
| 631 | + out = scnprintf(buf, count, "%08X", ofs); |
|---|
| 647 | 632 | |
|---|
| 648 | 633 | for (l = 0, i = 0; i < 2; i++) { |
|---|
| 649 | | - out += snprintf(buf + out, count - out, " "); |
|---|
| 634 | + out += scnprintf(buf + out, count - out, " "); |
|---|
| 650 | 635 | for (j = 0; j < 8 && l < len; j++, l++) |
|---|
| 651 | | - out += snprintf(buf + out, count - out, "%02X ", |
|---|
| 636 | + out += scnprintf(buf + out, count - out, "%02X ", |
|---|
| 652 | 637 | data[(i * 8 + j)]); |
|---|
| 653 | 638 | for (; j < 8; j++) |
|---|
| 654 | | - out += snprintf(buf + out, count - out, " "); |
|---|
| 639 | + out += scnprintf(buf + out, count - out, " "); |
|---|
| 655 | 640 | } |
|---|
| 656 | 641 | |
|---|
| 657 | | - out += snprintf(buf + out, count - out, " "); |
|---|
| 642 | + out += scnprintf(buf + out, count - out, " "); |
|---|
| 658 | 643 | for (l = 0, i = 0; i < 2; i++) { |
|---|
| 659 | | - out += snprintf(buf + out, count - out, " "); |
|---|
| 644 | + out += scnprintf(buf + out, count - out, " "); |
|---|
| 660 | 645 | for (j = 0; j < 8 && l < len; j++, l++) { |
|---|
| 661 | 646 | c = data[(i * 8 + j)]; |
|---|
| 662 | 647 | if (!isascii(c) || !isprint(c)) |
|---|
| 663 | 648 | c = '.'; |
|---|
| 664 | 649 | |
|---|
| 665 | | - out += snprintf(buf + out, count - out, "%c", c); |
|---|
| 650 | + out += scnprintf(buf + out, count - out, "%c", c); |
|---|
| 666 | 651 | } |
|---|
| 667 | 652 | |
|---|
| 668 | 653 | for (; j < 8; j++) |
|---|
| 669 | | - out += snprintf(buf + out, count - out, " "); |
|---|
| 654 | + out += scnprintf(buf + out, count - out, " "); |
|---|
| 670 | 655 | } |
|---|
| 671 | 656 | |
|---|
| 672 | 657 | return buf; |
|---|
| .. | .. |
|---|
| 1744 | 1729 | /* the ipw2100 hardware really doesn't want power management delays |
|---|
| 1745 | 1730 | * longer than 175usec |
|---|
| 1746 | 1731 | */ |
|---|
| 1747 | | - pm_qos_update_request(&ipw2100_pm_qos_req, 175); |
|---|
| 1732 | + cpu_latency_qos_update_request(&ipw2100_pm_qos_req, 175); |
|---|
| 1748 | 1733 | |
|---|
| 1749 | 1734 | /* If the interrupt is enabled, turn it off... */ |
|---|
| 1750 | 1735 | spin_lock_irqsave(&priv->low_lock, flags); |
|---|
| .. | .. |
|---|
| 1889 | 1874 | ipw2100_disable_interrupts(priv); |
|---|
| 1890 | 1875 | spin_unlock_irqrestore(&priv->low_lock, flags); |
|---|
| 1891 | 1876 | |
|---|
| 1892 | | - pm_qos_update_request(&ipw2100_pm_qos_req, PM_QOS_DEFAULT_VALUE); |
|---|
| 1877 | + cpu_latency_qos_update_request(&ipw2100_pm_qos_req, |
|---|
| 1878 | + PM_QOS_DEFAULT_VALUE); |
|---|
| 1893 | 1879 | |
|---|
| 1894 | 1880 | /* We have to signal any supplicant if we are disassociating */ |
|---|
| 1895 | 1881 | if (associated) |
|---|
| .. | .. |
|---|
| 2308 | 2294 | return -ENOMEM; |
|---|
| 2309 | 2295 | |
|---|
| 2310 | 2296 | packet->rxp = (struct ipw2100_rx *)packet->skb->data; |
|---|
| 2311 | | - packet->dma_addr = pci_map_single(priv->pci_dev, packet->skb->data, |
|---|
| 2297 | + packet->dma_addr = dma_map_single(&priv->pci_dev->dev, |
|---|
| 2298 | + packet->skb->data, |
|---|
| 2312 | 2299 | sizeof(struct ipw2100_rx), |
|---|
| 2313 | | - PCI_DMA_FROMDEVICE); |
|---|
| 2314 | | - if (pci_dma_mapping_error(priv->pci_dev, packet->dma_addr)) { |
|---|
| 2300 | + DMA_FROM_DEVICE); |
|---|
| 2301 | + if (dma_mapping_error(&priv->pci_dev->dev, packet->dma_addr)) { |
|---|
| 2315 | 2302 | dev_kfree_skb(packet->skb); |
|---|
| 2316 | 2303 | return -ENOMEM; |
|---|
| 2317 | 2304 | } |
|---|
| .. | .. |
|---|
| 2492 | 2479 | return; |
|---|
| 2493 | 2480 | } |
|---|
| 2494 | 2481 | |
|---|
| 2495 | | - pci_unmap_single(priv->pci_dev, |
|---|
| 2496 | | - packet->dma_addr, |
|---|
| 2497 | | - sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE); |
|---|
| 2482 | + dma_unmap_single(&priv->pci_dev->dev, packet->dma_addr, |
|---|
| 2483 | + sizeof(struct ipw2100_rx), DMA_FROM_DEVICE); |
|---|
| 2498 | 2484 | |
|---|
| 2499 | 2485 | skb_put(packet->skb, status->frame_size); |
|---|
| 2500 | 2486 | |
|---|
| .. | .. |
|---|
| 2576 | 2562 | return; |
|---|
| 2577 | 2563 | } |
|---|
| 2578 | 2564 | |
|---|
| 2579 | | - pci_unmap_single(priv->pci_dev, packet->dma_addr, |
|---|
| 2580 | | - sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE); |
|---|
| 2565 | + dma_unmap_single(&priv->pci_dev->dev, packet->dma_addr, |
|---|
| 2566 | + sizeof(struct ipw2100_rx), DMA_FROM_DEVICE); |
|---|
| 2581 | 2567 | memmove(packet->skb->data + sizeof(struct ipw_rt_hdr), |
|---|
| 2582 | 2568 | packet->skb->data, status->frame_size); |
|---|
| 2583 | 2569 | |
|---|
| .. | .. |
|---|
| 2702 | 2688 | |
|---|
| 2703 | 2689 | /* Sync the DMA for the RX buffer so CPU is sure to get |
|---|
| 2704 | 2690 | * the correct values */ |
|---|
| 2705 | | - pci_dma_sync_single_for_cpu(priv->pci_dev, packet->dma_addr, |
|---|
| 2706 | | - sizeof(struct ipw2100_rx), |
|---|
| 2707 | | - PCI_DMA_FROMDEVICE); |
|---|
| 2691 | + dma_sync_single_for_cpu(&priv->pci_dev->dev, packet->dma_addr, |
|---|
| 2692 | + sizeof(struct ipw2100_rx), |
|---|
| 2693 | + DMA_FROM_DEVICE); |
|---|
| 2708 | 2694 | |
|---|
| 2709 | 2695 | if (unlikely(ipw2100_corruption_check(priv, i))) { |
|---|
| 2710 | 2696 | ipw2100_corruption_detected(priv, i); |
|---|
| .. | .. |
|---|
| 2936 | 2922 | (packet->index + 1 + i) % txq->entries, |
|---|
| 2937 | 2923 | tbd->host_addr, tbd->buf_length); |
|---|
| 2938 | 2924 | |
|---|
| 2939 | | - pci_unmap_single(priv->pci_dev, |
|---|
| 2940 | | - tbd->host_addr, |
|---|
| 2941 | | - tbd->buf_length, PCI_DMA_TODEVICE); |
|---|
| 2925 | + dma_unmap_single(&priv->pci_dev->dev, tbd->host_addr, |
|---|
| 2926 | + tbd->buf_length, DMA_TO_DEVICE); |
|---|
| 2942 | 2927 | } |
|---|
| 2943 | 2928 | |
|---|
| 2944 | 2929 | libipw_txb_free(packet->info.d_struct.txb); |
|---|
| .. | .. |
|---|
| 3178 | 3163 | tbd->buf_length = packet->info.d_struct.txb-> |
|---|
| 3179 | 3164 | fragments[i]->len - LIBIPW_3ADDR_LEN; |
|---|
| 3180 | 3165 | |
|---|
| 3181 | | - tbd->host_addr = pci_map_single(priv->pci_dev, |
|---|
| 3166 | + tbd->host_addr = dma_map_single(&priv->pci_dev->dev, |
|---|
| 3182 | 3167 | packet->info.d_struct. |
|---|
| 3183 | | - txb->fragments[i]-> |
|---|
| 3184 | | - data + |
|---|
| 3168 | + txb->fragments[i]->data + |
|---|
| 3185 | 3169 | LIBIPW_3ADDR_LEN, |
|---|
| 3186 | 3170 | tbd->buf_length, |
|---|
| 3187 | | - PCI_DMA_TODEVICE); |
|---|
| 3188 | | - if (pci_dma_mapping_error(priv->pci_dev, |
|---|
| 3189 | | - tbd->host_addr)) { |
|---|
| 3171 | + DMA_TO_DEVICE); |
|---|
| 3172 | + if (dma_mapping_error(&priv->pci_dev->dev, tbd->host_addr)) { |
|---|
| 3190 | 3173 | IPW_DEBUG_TX("dma mapping error\n"); |
|---|
| 3191 | 3174 | break; |
|---|
| 3192 | 3175 | } |
|---|
| .. | .. |
|---|
| 3195 | 3178 | txq->next, tbd->host_addr, |
|---|
| 3196 | 3179 | tbd->buf_length); |
|---|
| 3197 | 3180 | |
|---|
| 3198 | | - pci_dma_sync_single_for_device(priv->pci_dev, |
|---|
| 3199 | | - tbd->host_addr, |
|---|
| 3200 | | - tbd->buf_length, |
|---|
| 3201 | | - PCI_DMA_TODEVICE); |
|---|
| 3181 | + dma_sync_single_for_device(&priv->pci_dev->dev, |
|---|
| 3182 | + tbd->host_addr, |
|---|
| 3183 | + tbd->buf_length, |
|---|
| 3184 | + DMA_TO_DEVICE); |
|---|
| 3202 | 3185 | |
|---|
| 3203 | 3186 | txq->next++; |
|---|
| 3204 | 3187 | txq->next %= txq->entries; |
|---|
| .. | .. |
|---|
| 3220 | 3203 | } |
|---|
| 3221 | 3204 | } |
|---|
| 3222 | 3205 | |
|---|
| 3223 | | -static void ipw2100_irq_tasklet(unsigned long data) |
|---|
| 3206 | +static void ipw2100_irq_tasklet(struct tasklet_struct *t) |
|---|
| 3224 | 3207 | { |
|---|
| 3225 | | - struct ipw2100_priv *priv = (struct ipw2100_priv *)data; |
|---|
| 3208 | + struct ipw2100_priv *priv = from_tasklet(priv, t, irq_tasklet); |
|---|
| 3226 | 3209 | struct net_device *dev = priv->net_dev; |
|---|
| 3227 | 3210 | unsigned long flags; |
|---|
| 3228 | 3211 | u32 inta, tmp; |
|---|
| .. | .. |
|---|
| 3453 | 3436 | return -ENOMEM; |
|---|
| 3454 | 3437 | |
|---|
| 3455 | 3438 | for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { |
|---|
| 3456 | | - v = pci_zalloc_consistent(priv->pci_dev, |
|---|
| 3457 | | - sizeof(struct ipw2100_cmd_header), |
|---|
| 3458 | | - &p); |
|---|
| 3439 | + v = dma_alloc_coherent(&priv->pci_dev->dev, |
|---|
| 3440 | + sizeof(struct ipw2100_cmd_header), &p, |
|---|
| 3441 | + GFP_KERNEL); |
|---|
| 3459 | 3442 | if (!v) { |
|---|
| 3460 | 3443 | printk(KERN_ERR DRV_NAME ": " |
|---|
| 3461 | 3444 | "%s: PCI alloc failed for msg " |
|---|
| .. | .. |
|---|
| 3474 | 3457 | return 0; |
|---|
| 3475 | 3458 | |
|---|
| 3476 | 3459 | for (j = 0; j < i; j++) { |
|---|
| 3477 | | - pci_free_consistent(priv->pci_dev, |
|---|
| 3478 | | - sizeof(struct ipw2100_cmd_header), |
|---|
| 3479 | | - priv->msg_buffers[j].info.c_struct.cmd, |
|---|
| 3480 | | - priv->msg_buffers[j].info.c_struct. |
|---|
| 3481 | | - cmd_phys); |
|---|
| 3460 | + dma_free_coherent(&priv->pci_dev->dev, |
|---|
| 3461 | + sizeof(struct ipw2100_cmd_header), |
|---|
| 3462 | + priv->msg_buffers[j].info.c_struct.cmd, |
|---|
| 3463 | + priv->msg_buffers[j].info.c_struct.cmd_phys); |
|---|
| 3482 | 3464 | } |
|---|
| 3483 | 3465 | |
|---|
| 3484 | 3466 | kfree(priv->msg_buffers); |
|---|
| .. | .. |
|---|
| 3509 | 3491 | return; |
|---|
| 3510 | 3492 | |
|---|
| 3511 | 3493 | for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { |
|---|
| 3512 | | - pci_free_consistent(priv->pci_dev, |
|---|
| 3513 | | - sizeof(struct ipw2100_cmd_header), |
|---|
| 3514 | | - priv->msg_buffers[i].info.c_struct.cmd, |
|---|
| 3515 | | - priv->msg_buffers[i].info.c_struct. |
|---|
| 3516 | | - cmd_phys); |
|---|
| 3494 | + dma_free_coherent(&priv->pci_dev->dev, |
|---|
| 3495 | + sizeof(struct ipw2100_cmd_header), |
|---|
| 3496 | + priv->msg_buffers[i].info.c_struct.cmd, |
|---|
| 3497 | + priv->msg_buffers[i].info.c_struct.cmd_phys); |
|---|
| 3517 | 3498 | } |
|---|
| 3518 | 3499 | |
|---|
| 3519 | 3500 | kfree(priv->msg_buffers); |
|---|
| .. | .. |
|---|
| 4336 | 4317 | IPW_DEBUG_INFO("enter\n"); |
|---|
| 4337 | 4318 | |
|---|
| 4338 | 4319 | q->size = entries * sizeof(struct ipw2100_status); |
|---|
| 4339 | | - q->drv = pci_zalloc_consistent(priv->pci_dev, q->size, &q->nic); |
|---|
| 4320 | + q->drv = dma_alloc_coherent(&priv->pci_dev->dev, q->size, &q->nic, |
|---|
| 4321 | + GFP_KERNEL); |
|---|
| 4340 | 4322 | if (!q->drv) { |
|---|
| 4341 | 4323 | IPW_DEBUG_WARNING("Can not allocate status queue.\n"); |
|---|
| 4342 | 4324 | return -ENOMEM; |
|---|
| .. | .. |
|---|
| 4352 | 4334 | IPW_DEBUG_INFO("enter\n"); |
|---|
| 4353 | 4335 | |
|---|
| 4354 | 4336 | if (priv->status_queue.drv) { |
|---|
| 4355 | | - pci_free_consistent(priv->pci_dev, priv->status_queue.size, |
|---|
| 4356 | | - priv->status_queue.drv, |
|---|
| 4357 | | - priv->status_queue.nic); |
|---|
| 4337 | + dma_free_coherent(&priv->pci_dev->dev, |
|---|
| 4338 | + priv->status_queue.size, |
|---|
| 4339 | + priv->status_queue.drv, |
|---|
| 4340 | + priv->status_queue.nic); |
|---|
| 4358 | 4341 | priv->status_queue.drv = NULL; |
|---|
| 4359 | 4342 | } |
|---|
| 4360 | 4343 | |
|---|
| .. | .. |
|---|
| 4370 | 4353 | |
|---|
| 4371 | 4354 | q->entries = entries; |
|---|
| 4372 | 4355 | q->size = entries * sizeof(struct ipw2100_bd); |
|---|
| 4373 | | - q->drv = pci_zalloc_consistent(priv->pci_dev, q->size, &q->nic); |
|---|
| 4356 | + q->drv = dma_alloc_coherent(&priv->pci_dev->dev, q->size, &q->nic, |
|---|
| 4357 | + GFP_KERNEL); |
|---|
| 4374 | 4358 | if (!q->drv) { |
|---|
| 4375 | 4359 | IPW_DEBUG_INFO |
|---|
| 4376 | 4360 | ("can't allocate shared memory for buffer descriptors\n"); |
|---|
| .. | .. |
|---|
| 4390 | 4374 | return; |
|---|
| 4391 | 4375 | |
|---|
| 4392 | 4376 | if (q->drv) { |
|---|
| 4393 | | - pci_free_consistent(priv->pci_dev, q->size, q->drv, q->nic); |
|---|
| 4377 | + dma_free_coherent(&priv->pci_dev->dev, q->size, q->drv, |
|---|
| 4378 | + q->nic); |
|---|
| 4394 | 4379 | q->drv = NULL; |
|---|
| 4395 | 4380 | } |
|---|
| 4396 | 4381 | |
|---|
| .. | .. |
|---|
| 4428 | 4413 | |
|---|
| 4429 | 4414 | static int ipw2100_tx_allocate(struct ipw2100_priv *priv) |
|---|
| 4430 | 4415 | { |
|---|
| 4431 | | - int i, j, err = -EINVAL; |
|---|
| 4416 | + int i, j, err; |
|---|
| 4432 | 4417 | void *v; |
|---|
| 4433 | 4418 | dma_addr_t p; |
|---|
| 4434 | 4419 | |
|---|
| .. | .. |
|---|
| 4443 | 4428 | |
|---|
| 4444 | 4429 | priv->tx_buffers = kmalloc_array(TX_PENDED_QUEUE_LENGTH, |
|---|
| 4445 | 4430 | sizeof(struct ipw2100_tx_packet), |
|---|
| 4446 | | - GFP_ATOMIC); |
|---|
| 4431 | + GFP_KERNEL); |
|---|
| 4447 | 4432 | if (!priv->tx_buffers) { |
|---|
| 4448 | 4433 | bd_queue_free(priv, &priv->tx_queue); |
|---|
| 4449 | 4434 | return -ENOMEM; |
|---|
| 4450 | 4435 | } |
|---|
| 4451 | 4436 | |
|---|
| 4452 | 4437 | for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { |
|---|
| 4453 | | - v = pci_alloc_consistent(priv->pci_dev, |
|---|
| 4454 | | - sizeof(struct ipw2100_data_header), |
|---|
| 4455 | | - &p); |
|---|
| 4438 | + v = dma_alloc_coherent(&priv->pci_dev->dev, |
|---|
| 4439 | + sizeof(struct ipw2100_data_header), &p, |
|---|
| 4440 | + GFP_KERNEL); |
|---|
| 4456 | 4441 | if (!v) { |
|---|
| 4457 | 4442 | printk(KERN_ERR DRV_NAME |
|---|
| 4458 | 4443 | ": %s: PCI alloc failed for tx " "buffers.\n", |
|---|
| .. | .. |
|---|
| 4472 | 4457 | return 0; |
|---|
| 4473 | 4458 | |
|---|
| 4474 | 4459 | for (j = 0; j < i; j++) { |
|---|
| 4475 | | - pci_free_consistent(priv->pci_dev, |
|---|
| 4476 | | - sizeof(struct ipw2100_data_header), |
|---|
| 4477 | | - priv->tx_buffers[j].info.d_struct.data, |
|---|
| 4478 | | - priv->tx_buffers[j].info.d_struct. |
|---|
| 4479 | | - data_phys); |
|---|
| 4460 | + dma_free_coherent(&priv->pci_dev->dev, |
|---|
| 4461 | + sizeof(struct ipw2100_data_header), |
|---|
| 4462 | + priv->tx_buffers[j].info.d_struct.data, |
|---|
| 4463 | + priv->tx_buffers[j].info.d_struct.data_phys); |
|---|
| 4480 | 4464 | } |
|---|
| 4481 | 4465 | |
|---|
| 4482 | 4466 | kfree(priv->tx_buffers); |
|---|
| .. | .. |
|---|
| 4553 | 4537 | priv->tx_buffers[i].info.d_struct.txb = NULL; |
|---|
| 4554 | 4538 | } |
|---|
| 4555 | 4539 | if (priv->tx_buffers[i].info.d_struct.data) |
|---|
| 4556 | | - pci_free_consistent(priv->pci_dev, |
|---|
| 4557 | | - sizeof(struct ipw2100_data_header), |
|---|
| 4558 | | - priv->tx_buffers[i].info.d_struct. |
|---|
| 4559 | | - data, |
|---|
| 4560 | | - priv->tx_buffers[i].info.d_struct. |
|---|
| 4561 | | - data_phys); |
|---|
| 4540 | + dma_free_coherent(&priv->pci_dev->dev, |
|---|
| 4541 | + sizeof(struct ipw2100_data_header), |
|---|
| 4542 | + priv->tx_buffers[i].info.d_struct.data, |
|---|
| 4543 | + priv->tx_buffers[i].info.d_struct.data_phys); |
|---|
| 4562 | 4544 | } |
|---|
| 4563 | 4545 | |
|---|
| 4564 | 4546 | kfree(priv->tx_buffers); |
|---|
| .. | .. |
|---|
| 4621 | 4603 | return 0; |
|---|
| 4622 | 4604 | |
|---|
| 4623 | 4605 | for (j = 0; j < i; j++) { |
|---|
| 4624 | | - pci_unmap_single(priv->pci_dev, priv->rx_buffers[j].dma_addr, |
|---|
| 4606 | + dma_unmap_single(&priv->pci_dev->dev, |
|---|
| 4607 | + priv->rx_buffers[j].dma_addr, |
|---|
| 4625 | 4608 | sizeof(struct ipw2100_rx_packet), |
|---|
| 4626 | | - PCI_DMA_FROMDEVICE); |
|---|
| 4609 | + DMA_FROM_DEVICE); |
|---|
| 4627 | 4610 | dev_kfree_skb(priv->rx_buffers[j].skb); |
|---|
| 4628 | 4611 | } |
|---|
| 4629 | 4612 | |
|---|
| .. | .. |
|---|
| 4675 | 4658 | |
|---|
| 4676 | 4659 | for (i = 0; i < RX_QUEUE_LENGTH; i++) { |
|---|
| 4677 | 4660 | if (priv->rx_buffers[i].rxp) { |
|---|
| 4678 | | - pci_unmap_single(priv->pci_dev, |
|---|
| 4661 | + dma_unmap_single(&priv->pci_dev->dev, |
|---|
| 4679 | 4662 | priv->rx_buffers[i].dma_addr, |
|---|
| 4680 | 4663 | sizeof(struct ipw2100_rx), |
|---|
| 4681 | | - PCI_DMA_FROMDEVICE); |
|---|
| 4664 | + DMA_FROM_DEVICE); |
|---|
| 4682 | 4665 | dev_kfree_skb(priv->rx_buffers[i].skb); |
|---|
| 4683 | 4666 | } |
|---|
| 4684 | 4667 | } |
|---|
| .. | .. |
|---|
| 5580 | 5563 | struct libipw_security *sec) |
|---|
| 5581 | 5564 | { |
|---|
| 5582 | 5565 | struct ipw2100_priv *priv = libipw_priv(dev); |
|---|
| 5583 | | - int i, force_update = 0; |
|---|
| 5566 | + int i; |
|---|
| 5584 | 5567 | |
|---|
| 5585 | 5568 | mutex_lock(&priv->action_mutex); |
|---|
| 5586 | 5569 | if (!(priv->status & STATUS_INITIALIZED)) |
|---|
| .. | .. |
|---|
| 5604 | 5587 | |
|---|
| 5605 | 5588 | if ((sec->flags & SEC_ACTIVE_KEY) && |
|---|
| 5606 | 5589 | priv->ieee->sec.active_key != sec->active_key) { |
|---|
| 5607 | | - if (sec->active_key <= 3) { |
|---|
| 5608 | | - priv->ieee->sec.active_key = sec->active_key; |
|---|
| 5609 | | - priv->ieee->sec.flags |= SEC_ACTIVE_KEY; |
|---|
| 5610 | | - } else |
|---|
| 5611 | | - priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; |
|---|
| 5612 | | - |
|---|
| 5590 | + priv->ieee->sec.active_key = sec->active_key; |
|---|
| 5591 | + priv->ieee->sec.flags |= SEC_ACTIVE_KEY; |
|---|
| 5613 | 5592 | priv->status |= STATUS_SECURITY_UPDATED; |
|---|
| 5614 | 5593 | } |
|---|
| 5615 | 5594 | |
|---|
| .. | .. |
|---|
| 5624 | 5603 | priv->ieee->sec.flags |= SEC_ENABLED; |
|---|
| 5625 | 5604 | priv->ieee->sec.enabled = sec->enabled; |
|---|
| 5626 | 5605 | priv->status |= STATUS_SECURITY_UPDATED; |
|---|
| 5627 | | - force_update = 1; |
|---|
| 5628 | 5606 | } |
|---|
| 5629 | 5607 | |
|---|
| 5630 | 5608 | if (sec->flags & SEC_ENCRYPT) |
|---|
| .. | .. |
|---|
| 5853 | 5831 | /* |
|---|
| 5854 | 5832 | * TODO: Fix this function... its just wrong |
|---|
| 5855 | 5833 | */ |
|---|
| 5856 | | -static void ipw2100_tx_timeout(struct net_device *dev) |
|---|
| 5834 | +static void ipw2100_tx_timeout(struct net_device *dev, unsigned int txqueue) |
|---|
| 5857 | 5835 | { |
|---|
| 5858 | 5836 | struct ipw2100_priv *priv = libipw_priv(dev); |
|---|
| 5859 | 5837 | |
|---|
| .. | .. |
|---|
| 6026 | 6004 | spin_unlock_irqrestore(&priv->low_lock, flags); |
|---|
| 6027 | 6005 | } |
|---|
| 6028 | 6006 | |
|---|
| 6029 | | -static void ipw2100_irq_tasklet(unsigned long data); |
|---|
| 6007 | +static void ipw2100_irq_tasklet(struct tasklet_struct *t); |
|---|
| 6030 | 6008 | |
|---|
| 6031 | 6009 | static const struct net_device_ops ipw2100_netdev_ops = { |
|---|
| 6032 | 6010 | .ndo_open = ipw2100_open, |
|---|
| .. | .. |
|---|
| 6156 | 6134 | INIT_DELAYED_WORK(&priv->rf_kill, ipw2100_rf_kill); |
|---|
| 6157 | 6135 | INIT_DELAYED_WORK(&priv->scan_event, ipw2100_scan_event); |
|---|
| 6158 | 6136 | |
|---|
| 6159 | | - tasklet_init(&priv->irq_tasklet, |
|---|
| 6160 | | - ipw2100_irq_tasklet, (unsigned long)priv); |
|---|
| 6137 | + tasklet_setup(&priv->irq_tasklet, ipw2100_irq_tasklet); |
|---|
| 6161 | 6138 | |
|---|
| 6162 | 6139 | /* NOTE: We do not start the deferred work for status checks yet */ |
|---|
| 6163 | 6140 | priv->stop_rf_kill = 1; |
|---|
| .. | .. |
|---|
| 6187 | 6164 | ioaddr = pci_iomap(pci_dev, 0, 0); |
|---|
| 6188 | 6165 | if (!ioaddr) { |
|---|
| 6189 | 6166 | printk(KERN_WARNING DRV_NAME |
|---|
| 6190 | | - "Error calling ioremap_nocache.\n"); |
|---|
| 6167 | + "Error calling ioremap.\n"); |
|---|
| 6191 | 6168 | err = -EIO; |
|---|
| 6192 | 6169 | goto fail; |
|---|
| 6193 | 6170 | } |
|---|
| .. | .. |
|---|
| 6214 | 6191 | pci_set_master(pci_dev); |
|---|
| 6215 | 6192 | pci_set_drvdata(pci_dev, priv); |
|---|
| 6216 | 6193 | |
|---|
| 6217 | | - err = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)); |
|---|
| 6194 | + err = dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32)); |
|---|
| 6218 | 6195 | if (err) { |
|---|
| 6219 | 6196 | printk(KERN_WARNING DRV_NAME |
|---|
| 6220 | 6197 | "Error calling pci_set_dma_mask.\n"); |
|---|
| .. | .. |
|---|
| 6415 | 6392 | IPW_DEBUG_INFO("exit\n"); |
|---|
| 6416 | 6393 | } |
|---|
| 6417 | 6394 | |
|---|
| 6418 | | -#ifdef CONFIG_PM |
|---|
| 6419 | | -static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) |
|---|
| 6395 | +static int __maybe_unused ipw2100_suspend(struct device *dev_d) |
|---|
| 6420 | 6396 | { |
|---|
| 6421 | | - struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); |
|---|
| 6397 | + struct ipw2100_priv *priv = dev_get_drvdata(dev_d); |
|---|
| 6422 | 6398 | struct net_device *dev = priv->net_dev; |
|---|
| 6423 | 6399 | |
|---|
| 6424 | 6400 | IPW_DEBUG_INFO("%s: Going into suspend...\n", dev->name); |
|---|
| .. | .. |
|---|
| 6432 | 6408 | /* Remove the PRESENT state of the device */ |
|---|
| 6433 | 6409 | netif_device_detach(dev); |
|---|
| 6434 | 6410 | |
|---|
| 6435 | | - pci_save_state(pci_dev); |
|---|
| 6436 | | - pci_disable_device(pci_dev); |
|---|
| 6437 | | - pci_set_power_state(pci_dev, PCI_D3hot); |
|---|
| 6438 | | - |
|---|
| 6439 | 6411 | priv->suspend_at = ktime_get_boottime_seconds(); |
|---|
| 6440 | 6412 | |
|---|
| 6441 | 6413 | mutex_unlock(&priv->action_mutex); |
|---|
| .. | .. |
|---|
| 6443 | 6415 | return 0; |
|---|
| 6444 | 6416 | } |
|---|
| 6445 | 6417 | |
|---|
| 6446 | | -static int ipw2100_resume(struct pci_dev *pci_dev) |
|---|
| 6418 | +static int __maybe_unused ipw2100_resume(struct device *dev_d) |
|---|
| 6447 | 6419 | { |
|---|
| 6420 | + struct pci_dev *pci_dev = to_pci_dev(dev_d); |
|---|
| 6448 | 6421 | struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); |
|---|
| 6449 | 6422 | struct net_device *dev = priv->net_dev; |
|---|
| 6450 | | - int err; |
|---|
| 6451 | 6423 | u32 val; |
|---|
| 6452 | 6424 | |
|---|
| 6453 | 6425 | if (IPW2100_PM_DISABLED) |
|---|
| .. | .. |
|---|
| 6456 | 6428 | mutex_lock(&priv->action_mutex); |
|---|
| 6457 | 6429 | |
|---|
| 6458 | 6430 | IPW_DEBUG_INFO("%s: Coming out of suspend...\n", dev->name); |
|---|
| 6459 | | - |
|---|
| 6460 | | - pci_set_power_state(pci_dev, PCI_D0); |
|---|
| 6461 | | - err = pci_enable_device(pci_dev); |
|---|
| 6462 | | - if (err) { |
|---|
| 6463 | | - printk(KERN_ERR "%s: pci_enable_device failed on resume\n", |
|---|
| 6464 | | - dev->name); |
|---|
| 6465 | | - mutex_unlock(&priv->action_mutex); |
|---|
| 6466 | | - return err; |
|---|
| 6467 | | - } |
|---|
| 6468 | | - pci_restore_state(pci_dev); |
|---|
| 6469 | 6431 | |
|---|
| 6470 | 6432 | /* |
|---|
| 6471 | 6433 | * Suspend/Resume resets the PCI configuration space, so we have to |
|---|
| .. | .. |
|---|
| 6491 | 6453 | |
|---|
| 6492 | 6454 | return 0; |
|---|
| 6493 | 6455 | } |
|---|
| 6494 | | -#endif |
|---|
| 6495 | 6456 | |
|---|
| 6496 | 6457 | static void ipw2100_shutdown(struct pci_dev *pci_dev) |
|---|
| 6497 | 6458 | { |
|---|
| .. | .. |
|---|
| 6557 | 6518 | |
|---|
| 6558 | 6519 | MODULE_DEVICE_TABLE(pci, ipw2100_pci_id_table); |
|---|
| 6559 | 6520 | |
|---|
| 6521 | +static SIMPLE_DEV_PM_OPS(ipw2100_pm_ops, ipw2100_suspend, ipw2100_resume); |
|---|
| 6522 | + |
|---|
| 6560 | 6523 | static struct pci_driver ipw2100_pci_driver = { |
|---|
| 6561 | 6524 | .name = DRV_NAME, |
|---|
| 6562 | 6525 | .id_table = ipw2100_pci_id_table, |
|---|
| 6563 | 6526 | .probe = ipw2100_pci_init_one, |
|---|
| 6564 | 6527 | .remove = ipw2100_pci_remove_one, |
|---|
| 6565 | | -#ifdef CONFIG_PM |
|---|
| 6566 | | - .suspend = ipw2100_suspend, |
|---|
| 6567 | | - .resume = ipw2100_resume, |
|---|
| 6568 | | -#endif |
|---|
| 6528 | + .driver.pm = &ipw2100_pm_ops, |
|---|
| 6569 | 6529 | .shutdown = ipw2100_shutdown, |
|---|
| 6570 | 6530 | }; |
|---|
| 6571 | 6531 | |
|---|
| .. | .. |
|---|
| 6585 | 6545 | printk(KERN_INFO DRV_NAME ": %s, %s\n", DRV_DESCRIPTION, DRV_VERSION); |
|---|
| 6586 | 6546 | printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT); |
|---|
| 6587 | 6547 | |
|---|
| 6588 | | - pm_qos_add_request(&ipw2100_pm_qos_req, PM_QOS_CPU_DMA_LATENCY, |
|---|
| 6589 | | - PM_QOS_DEFAULT_VALUE); |
|---|
| 6548 | + cpu_latency_qos_add_request(&ipw2100_pm_qos_req, PM_QOS_DEFAULT_VALUE); |
|---|
| 6590 | 6549 | |
|---|
| 6591 | 6550 | ret = pci_register_driver(&ipw2100_pci_driver); |
|---|
| 6592 | 6551 | if (ret) |
|---|
| .. | .. |
|---|
| 6613 | 6572 | &driver_attr_debug_level); |
|---|
| 6614 | 6573 | #endif |
|---|
| 6615 | 6574 | pci_unregister_driver(&ipw2100_pci_driver); |
|---|
| 6616 | | - pm_qos_remove_request(&ipw2100_pm_qos_req); |
|---|
| 6575 | + cpu_latency_qos_remove_request(&ipw2100_pm_qos_req); |
|---|
| 6617 | 6576 | } |
|---|
| 6618 | 6577 | |
|---|
| 6619 | 6578 | module_init(ipw2100_init); |
|---|
| .. | .. |
|---|
| 8371 | 8330 | if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) { |
|---|
| 8372 | 8331 | printk(KERN_WARNING DRV_NAME ": Firmware image not compatible " |
|---|
| 8373 | 8332 | "(detected version id of %u). " |
|---|
| 8374 | | - "See Documentation/networking/README.ipw2100\n", |
|---|
| 8333 | + "See Documentation/networking/device_drivers/wifi/intel/ipw2100.rst\n", |
|---|
| 8375 | 8334 | h->version); |
|---|
| 8376 | 8335 | return 1; |
|---|
| 8377 | 8336 | } |
|---|