| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2002 Intersil Americas Inc. |
|---|
| 3 | 4 | * Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org> |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 7 | | - * the Free Software Foundation; either version 2 of the License |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | | - * GNU General Public License for more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * You should have received a copy of the GNU General Public License |
|---|
| 15 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
|---|
| 16 | | - * |
|---|
| 17 | 5 | */ |
|---|
| 18 | 6 | |
|---|
| 19 | 7 | #include <linux/interrupt.h> |
|---|
| .. | .. |
|---|
| 38 | 26 | /* In this order: vendor, device, subvendor, subdevice, class, class_mask, |
|---|
| 39 | 27 | * driver_data |
|---|
| 40 | 28 | * If you have an update for this please contact prism54-devel@prism54.org |
|---|
| 41 | | - * The latest list can be found at http://wireless.kernel.org/en/users/Drivers/p54 */ |
|---|
| 29 | + * The latest list can be found at http://wireless.wiki.kernel.org/en/users/Drivers/p54 |
|---|
| 30 | + */ |
|---|
| 42 | 31 | static const struct pci_device_id prism54_id_tbl[] = { |
|---|
| 43 | 32 | /* Intersil PRISM Duette/Prism GT Wireless LAN adapter */ |
|---|
| 44 | 33 | { |
|---|
| .. | .. |
|---|
| 75 | 64 | |
|---|
| 76 | 65 | static int prism54_probe(struct pci_dev *, const struct pci_device_id *); |
|---|
| 77 | 66 | static void prism54_remove(struct pci_dev *); |
|---|
| 78 | | -static int prism54_suspend(struct pci_dev *, pm_message_t state); |
|---|
| 79 | | -static int prism54_resume(struct pci_dev *); |
|---|
| 67 | +static int __maybe_unused prism54_suspend(struct device *); |
|---|
| 68 | +static int __maybe_unused prism54_resume(struct device *); |
|---|
| 69 | + |
|---|
| 70 | +static SIMPLE_DEV_PM_OPS(prism54_pm_ops, prism54_suspend, prism54_resume); |
|---|
| 80 | 71 | |
|---|
| 81 | 72 | static struct pci_driver prism54_driver = { |
|---|
| 82 | 73 | .name = DRV_NAME, |
|---|
| 83 | 74 | .id_table = prism54_id_tbl, |
|---|
| 84 | 75 | .probe = prism54_probe, |
|---|
| 85 | 76 | .remove = prism54_remove, |
|---|
| 86 | | - .suspend = prism54_suspend, |
|---|
| 87 | | - .resume = prism54_resume, |
|---|
| 77 | + .driver.pm = &prism54_pm_ops, |
|---|
| 88 | 78 | }; |
|---|
| 89 | 79 | |
|---|
| 90 | 80 | /****************************************************************************** |
|---|
| .. | .. |
|---|
| 118 | 108 | } |
|---|
| 119 | 109 | |
|---|
| 120 | 110 | /* enable PCI DMA */ |
|---|
| 121 | | - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { |
|---|
| 111 | + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { |
|---|
| 122 | 112 | printk(KERN_ERR "%s: 32-bit PCI DMA not supported", DRV_NAME); |
|---|
| 123 | 113 | goto do_pci_disable_device; |
|---|
| 124 | 114 | } |
|---|
| .. | .. |
|---|
| 255 | 245 | pci_disable_device(pdev); |
|---|
| 256 | 246 | } |
|---|
| 257 | 247 | |
|---|
| 258 | | -static int |
|---|
| 259 | | -prism54_suspend(struct pci_dev *pdev, pm_message_t state) |
|---|
| 248 | +static int __maybe_unused |
|---|
| 249 | +prism54_suspend(struct device *dev) |
|---|
| 260 | 250 | { |
|---|
| 261 | | - struct net_device *ndev = pci_get_drvdata(pdev); |
|---|
| 251 | + struct net_device *ndev = dev_get_drvdata(dev); |
|---|
| 262 | 252 | islpci_private *priv = ndev ? netdev_priv(ndev) : NULL; |
|---|
| 263 | 253 | BUG_ON(!priv); |
|---|
| 264 | | - |
|---|
| 265 | | - |
|---|
| 266 | | - pci_save_state(pdev); |
|---|
| 267 | 254 | |
|---|
| 268 | 255 | /* tell the device not to trigger interrupts for now... */ |
|---|
| 269 | 256 | isl38xx_disable_interrupts(priv->device_base); |
|---|
| .. | .. |
|---|
| 278 | 265 | return 0; |
|---|
| 279 | 266 | } |
|---|
| 280 | 267 | |
|---|
| 281 | | -static int |
|---|
| 282 | | -prism54_resume(struct pci_dev *pdev) |
|---|
| 268 | +static int __maybe_unused |
|---|
| 269 | +prism54_resume(struct device *dev) |
|---|
| 283 | 270 | { |
|---|
| 284 | | - struct net_device *ndev = pci_get_drvdata(pdev); |
|---|
| 271 | + struct net_device *ndev = dev_get_drvdata(dev); |
|---|
| 285 | 272 | islpci_private *priv = ndev ? netdev_priv(ndev) : NULL; |
|---|
| 286 | | - int err; |
|---|
| 287 | 273 | |
|---|
| 288 | 274 | BUG_ON(!priv); |
|---|
| 289 | 275 | |
|---|
| 290 | 276 | printk(KERN_NOTICE "%s: got resume request\n", ndev->name); |
|---|
| 291 | | - |
|---|
| 292 | | - err = pci_enable_device(pdev); |
|---|
| 293 | | - if (err) { |
|---|
| 294 | | - printk(KERN_ERR "%s: pci_enable_device failed on resume\n", |
|---|
| 295 | | - ndev->name); |
|---|
| 296 | | - return err; |
|---|
| 297 | | - } |
|---|
| 298 | | - |
|---|
| 299 | | - pci_restore_state(pdev); |
|---|
| 300 | 277 | |
|---|
| 301 | 278 | /* alright let's go into the PREBOOT state */ |
|---|
| 302 | 279 | islpci_reset(priv, 1); |
|---|