.. | .. |
---|
69 | 69 | static void qedi_recovery_handler(struct work_struct *work); |
---|
70 | 70 | static void qedi_schedule_hw_err_handler(void *dev, |
---|
71 | 71 | enum qed_hw_err_type err_type); |
---|
| 72 | +static int qedi_suspend(struct pci_dev *pdev, pm_message_t state); |
---|
72 | 73 | |
---|
73 | 74 | static int qedi_iscsi_event_cb(void *context, u8 fw_event_code, void *fw_handle) |
---|
74 | 75 | { |
---|
.. | .. |
---|
1980 | 1981 | struct qedi_percpu_s *p = this_cpu_ptr(&qedi_percpu); |
---|
1981 | 1982 | struct qedi_work *work, *tmp; |
---|
1982 | 1983 | struct task_struct *thread; |
---|
| 1984 | + unsigned long flags; |
---|
1983 | 1985 | |
---|
1984 | | - spin_lock_bh(&p->p_work_lock); |
---|
| 1986 | + spin_lock_irqsave(&p->p_work_lock, flags); |
---|
1985 | 1987 | thread = p->iothread; |
---|
1986 | 1988 | p->iothread = NULL; |
---|
1987 | 1989 | |
---|
.. | .. |
---|
1992 | 1994 | kfree(work); |
---|
1993 | 1995 | } |
---|
1994 | 1996 | |
---|
1995 | | - spin_unlock_bh(&p->p_work_lock); |
---|
| 1997 | + spin_unlock_irqrestore(&p->p_work_lock, flags); |
---|
1996 | 1998 | if (thread) |
---|
1997 | 1999 | kthread_stop(thread); |
---|
1998 | 2000 | return 0; |
---|
.. | .. |
---|
2456 | 2458 | qedi_ops->ll2->stop(qedi->cdev); |
---|
2457 | 2459 | } |
---|
2458 | 2460 | |
---|
| 2461 | + cancel_delayed_work_sync(&qedi->recovery_work); |
---|
| 2462 | + cancel_delayed_work_sync(&qedi->board_disable_work); |
---|
| 2463 | + |
---|
2459 | 2464 | qedi_free_iscsi_pf_param(qedi); |
---|
2460 | 2465 | |
---|
2461 | 2466 | rval = qedi_ops->common->update_drv_state(qedi->cdev, false); |
---|
.. | .. |
---|
2512 | 2517 | if (test_and_set_bit(QEDI_IN_SHUTDOWN, &qedi->flags)) |
---|
2513 | 2518 | return; |
---|
2514 | 2519 | __qedi_remove(pdev, QEDI_MODE_SHUTDOWN); |
---|
| 2520 | +} |
---|
| 2521 | + |
---|
| 2522 | +static int qedi_suspend(struct pci_dev *pdev, pm_message_t state) |
---|
| 2523 | +{ |
---|
| 2524 | + struct qedi_ctx *qedi; |
---|
| 2525 | + |
---|
| 2526 | + if (!pdev) { |
---|
| 2527 | + QEDI_ERR(NULL, "pdev is NULL.\n"); |
---|
| 2528 | + return -ENODEV; |
---|
| 2529 | + } |
---|
| 2530 | + |
---|
| 2531 | + qedi = pci_get_drvdata(pdev); |
---|
| 2532 | + |
---|
| 2533 | + QEDI_ERR(&qedi->dbg_ctx, "%s: Device does not support suspend operation\n", __func__); |
---|
| 2534 | + |
---|
| 2535 | + return -EPERM; |
---|
2515 | 2536 | } |
---|
2516 | 2537 | |
---|
2517 | 2538 | static int __qedi_probe(struct pci_dev *pdev, int mode) |
---|
.. | .. |
---|
2872 | 2893 | .remove = qedi_remove, |
---|
2873 | 2894 | .shutdown = qedi_shutdown, |
---|
2874 | 2895 | .err_handler = &qedi_err_handler, |
---|
| 2896 | + .suspend = qedi_suspend, |
---|
2875 | 2897 | }; |
---|
2876 | 2898 | |
---|
2877 | 2899 | static int __init qedi_init(void) |
---|