hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/scsi/qedf/qedf_main.c
....@@ -31,6 +31,7 @@
3131 static void qedf_shutdown(struct pci_dev *pdev);
3232 static void qedf_schedule_recovery_handler(void *dev);
3333 static void qedf_recovery_handler(struct work_struct *work);
34
+static int qedf_suspend(struct pci_dev *pdev, pm_message_t state);
3435
3536 /*
3637 * Driver module parameters.
....@@ -2802,6 +2803,8 @@
28022803 struct qedf_ioreq *io_req;
28032804 struct qedf_rport *fcport;
28042805 u32 comp_type;
2806
+ u8 io_comp_type;
2807
+ unsigned long flags;
28052808
28062809 comp_type = (cqe->cqe_data >> FCOE_CQE_CQE_TYPE_SHIFT) &
28072810 FCOE_CQE_CQE_TYPE_MASK;
....@@ -2835,11 +2838,14 @@
28352838 return;
28362839 }
28372840
2841
+ spin_lock_irqsave(&fcport->rport_lock, flags);
2842
+ io_comp_type = io_req->cmd_type;
2843
+ spin_unlock_irqrestore(&fcport->rport_lock, flags);
28382844
28392845 switch (comp_type) {
28402846 case FCOE_GOOD_COMPLETION_CQE_TYPE:
28412847 atomic_inc(&fcport->free_sqes);
2842
- switch (io_req->cmd_type) {
2848
+ switch (io_comp_type) {
28432849 case QEDF_SCSI_CMD:
28442850 qedf_scsi_completion(qedf, cqe, io_req);
28452851 break;
....@@ -3042,9 +3048,8 @@
30423048 * addresses of our queues
30433049 */
30443050 if (!qedf->p_cpuq) {
3045
- status = -EINVAL;
30463051 QEDF_ERR(&qedf->dbg_ctx, "p_cpuq is NULL.\n");
3047
- goto mem_alloc_failure;
3052
+ return -EINVAL;
30483053 }
30493054
30503055 qedf->global_queues = kzalloc((sizeof(struct global_queue *)
....@@ -3273,6 +3278,7 @@
32733278 .probe = qedf_probe,
32743279 .remove = qedf_remove,
32753280 .shutdown = qedf_shutdown,
3281
+ .suspend = qedf_suspend,
32763282 };
32773283
32783284 static int __qedf_probe(struct pci_dev *pdev, int mode)
....@@ -3987,6 +3993,22 @@
39873993 __qedf_remove(pdev, QEDF_MODE_NORMAL);
39883994 }
39893995
3996
+static int qedf_suspend(struct pci_dev *pdev, pm_message_t state)
3997
+{
3998
+ struct qedf_ctx *qedf;
3999
+
4000
+ if (!pdev) {
4001
+ QEDF_ERR(NULL, "pdev is NULL.\n");
4002
+ return -ENODEV;
4003
+ }
4004
+
4005
+ qedf = pci_get_drvdata(pdev);
4006
+
4007
+ QEDF_ERR(&qedf->dbg_ctx, "%s: Device does not support suspend operation\n", __func__);
4008
+
4009
+ return -EPERM;
4010
+}
4011
+
39904012 /*
39914013 * Recovery handler code
39924014 */