.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * tifm_7xx1.c - TI FlashMedia driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2006 Alex Dubov <oakad@yahoo.com> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License version 2 as |
---|
8 | | - * published by the Free Software Foundation. |
---|
9 | | - * |
---|
10 | 6 | */ |
---|
11 | 7 | |
---|
12 | 8 | #include <linux/tifm.h> |
---|
.. | .. |
---|
194 | 190 | spin_unlock_irqrestore(&fm->lock, flags); |
---|
195 | 191 | } |
---|
196 | 192 | if (sock) |
---|
197 | | - tifm_free_device(&sock->dev); |
---|
| 193 | + put_device(&sock->dev); |
---|
198 | 194 | } |
---|
199 | 195 | spin_lock_irqsave(&fm->lock, flags); |
---|
200 | 196 | } |
---|
.. | .. |
---|
211 | 207 | spin_unlock_irqrestore(&fm->lock, flags); |
---|
212 | 208 | } |
---|
213 | 209 | |
---|
214 | | -#ifdef CONFIG_PM |
---|
215 | | - |
---|
216 | | -static int tifm_7xx1_suspend(struct pci_dev *dev, pm_message_t state) |
---|
| 210 | +static int __maybe_unused tifm_7xx1_suspend(struct device *dev_d) |
---|
217 | 211 | { |
---|
| 212 | + struct pci_dev *dev = to_pci_dev(dev_d); |
---|
218 | 213 | struct tifm_adapter *fm = pci_get_drvdata(dev); |
---|
219 | 214 | int cnt; |
---|
220 | 215 | |
---|
.. | .. |
---|
225 | 220 | tifm_7xx1_sock_power_off(fm->sockets[cnt]->addr); |
---|
226 | 221 | } |
---|
227 | 222 | |
---|
228 | | - pci_save_state(dev); |
---|
229 | | - pci_enable_wake(dev, pci_choose_state(dev, state), 0); |
---|
230 | | - pci_disable_device(dev); |
---|
231 | | - pci_set_power_state(dev, pci_choose_state(dev, state)); |
---|
| 223 | + device_wakeup_disable(dev_d); |
---|
232 | 224 | return 0; |
---|
233 | 225 | } |
---|
234 | 226 | |
---|
235 | | -static int tifm_7xx1_resume(struct pci_dev *dev) |
---|
| 227 | +static int __maybe_unused tifm_7xx1_resume(struct device *dev_d) |
---|
236 | 228 | { |
---|
| 229 | + struct pci_dev *dev = to_pci_dev(dev_d); |
---|
237 | 230 | struct tifm_adapter *fm = pci_get_drvdata(dev); |
---|
238 | 231 | int rc; |
---|
239 | 232 | unsigned long timeout; |
---|
.. | .. |
---|
246 | 239 | if (WARN_ON(fm->num_sockets > ARRAY_SIZE(new_ids))) |
---|
247 | 240 | return -ENXIO; |
---|
248 | 241 | |
---|
249 | | - pci_set_power_state(dev, PCI_D0); |
---|
250 | | - pci_restore_state(dev); |
---|
251 | | - rc = pci_enable_device(dev); |
---|
252 | | - if (rc) |
---|
253 | | - return rc; |
---|
254 | 242 | pci_set_master(dev); |
---|
255 | 243 | |
---|
256 | 244 | dev_dbg(&dev->dev, "resuming host\n"); |
---|
.. | .. |
---|
300 | 288 | |
---|
301 | 289 | return 0; |
---|
302 | 290 | } |
---|
303 | | - |
---|
304 | | -#else |
---|
305 | | - |
---|
306 | | -#define tifm_7xx1_suspend NULL |
---|
307 | | -#define tifm_7xx1_resume NULL |
---|
308 | | - |
---|
309 | | -#endif /* CONFIG_PM */ |
---|
310 | 291 | |
---|
311 | 292 | static int tifm_7xx1_dummy_has_ms_pif(struct tifm_adapter *fm, |
---|
312 | 293 | struct tifm_dev *sock) |
---|
.. | .. |
---|
403 | 384 | fm->eject = tifm_7xx1_dummy_eject; |
---|
404 | 385 | fm->has_ms_pif = tifm_7xx1_dummy_has_ms_pif; |
---|
405 | 386 | writel(TIFM_IRQ_SETALL, fm->addr + FM_CLEAR_INTERRUPT_ENABLE); |
---|
406 | | - mmiowb(); |
---|
407 | 387 | free_irq(dev->irq, fm); |
---|
408 | 388 | |
---|
409 | 389 | tifm_remove_adapter(fm); |
---|
.. | .. |
---|
429 | 409 | { } |
---|
430 | 410 | }; |
---|
431 | 411 | |
---|
| 412 | +static SIMPLE_DEV_PM_OPS(tifm_7xx1_pm_ops, tifm_7xx1_suspend, tifm_7xx1_resume); |
---|
| 413 | + |
---|
432 | 414 | static struct pci_driver tifm_7xx1_driver = { |
---|
433 | 415 | .name = DRIVER_NAME, |
---|
434 | 416 | .id_table = tifm_7xx1_pci_tbl, |
---|
435 | 417 | .probe = tifm_7xx1_probe, |
---|
436 | 418 | .remove = tifm_7xx1_remove, |
---|
437 | | - .suspend = tifm_7xx1_suspend, |
---|
438 | | - .resume = tifm_7xx1_resume, |
---|
| 419 | + .driver.pm = &tifm_7xx1_pm_ops, |
---|
439 | 420 | }; |
---|
440 | 421 | |
---|
441 | 422 | module_pci_driver(tifm_7xx1_driver); |
---|