From 032293970b98fd37c508a70c4742389d0ef890ab Mon Sep 17 00:00:00 2001 From: hgchu Date: Fri, 12 Jan 2018 10:18:20 +0900 Subject: [PATCH] scsi: ufs: identify nexus type Change-Id: I67e722d443fbf576b7f0a5e1f10bcd84fdae71d8 Signed-off-by: hgchu --- drivers/scsi/ufs/ufshcd-pci.c | 5 ++++- drivers/scsi/ufs/ufshcd.c | 8 ++++++-- drivers/scsi/ufs/ufshcd.h | 7 ++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c index 925b0ec7ec54..631653407ec6 100644 --- a/drivers/scsi/ufs/ufshcd-pci.c +++ b/drivers/scsi/ufs/ufshcd-pci.c @@ -134,7 +134,10 @@ static void ufshcd_pci_remove(struct pci_dev *pdev) pm_runtime_forbid(&pdev->dev); pm_runtime_get_noresume(&pdev->dev); + + disable_irq(pdev->irq); ufshcd_remove(hba); + pci_set_drvdata(pdev, NULL); ufshcd_dealloc_host(hba); } @@ -198,7 +201,7 @@ static const struct dev_pm_ops ufshcd_pci_pm_ops = { ufshcd_pci_runtime_idle) }; -static const struct pci_device_id ufshcd_pci_tbl[] = { +static DEFINE_PCI_DEVICE_TABLE(ufshcd_pci_tbl) = { { PCI_VENDOR_ID_SAMSUNG, 0xC00C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VDEVICE(INTEL, 0x9DFA), (kernel_ulong_t)&ufs_intel_cnl_hba_vops }, { } /* terminate list */ diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 004f96c9f1a3..090c1a27cc0b 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2396,7 +2396,8 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) /* issue command to the controller */ spin_lock_irqsave(hba->host->host_lock, flags); - ufshcd_vops_setup_xfer_req(hba, tag, (lrbp->cmd ? true : false)); + if (hba->vops && hba->vops->set_nexus_t_xfer_req) + hba->vops->set_nexus_t_xfer_req(hba, tag, lrbp->cmd); ufshcd_send_command(hba, tag); out_unlock: spin_unlock_irqrestore(hba->host->host_lock, flags); @@ -2612,7 +2613,8 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, /* Make sure descriptors are ready before ringing the doorbell */ wmb(); spin_lock_irqsave(hba->host->host_lock, flags); - ufshcd_vops_setup_xfer_req(hba, tag, (lrbp->cmd ? true : false)); + if (hba->vops && hba->vops->set_nexus_t_xfer_req) + hba->vops->set_nexus_t_xfer_req(hba, tag, lrbp->cmd); ufshcd_send_command(hba, tag); spin_unlock_irqrestore(hba->host->host_lock, flags); @@ -5554,6 +5556,8 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id, ufshcd_vops_setup_task_mgmt(hba, free_slot, tm_function); /* send command to the controller */ + if (hba->vops && hba->vops->set_nexus_t_task_mgmt) + hba->vops->set_nexus_t_task_mgmt(hba, free_slot, tm_function); __set_bit(free_slot, &hba->outstanding_tasks); /* Make sure descriptors are ready before ringing the task doorbell */ diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 9c08f82795a2..d824d6796947 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -323,8 +323,9 @@ struct ufs_hba_variant_ops { enum ufs_notify_change_status status, struct ufs_pa_layer_attr *, struct ufs_pa_layer_attr *); - void (*setup_xfer_req)(struct ufs_hba *, int, bool); - void (*setup_task_mgmt)(struct ufs_hba *, int, u8); + void (*set_nexus_t_xfer_req)(struct ufs_hba *, + int, struct scsi_cmnd *); + void (*set_nexus_t_task_mgmt)(struct ufs_hba *, int, u8); void (*hibern8_notify)(struct ufs_hba *, u8, bool); int (*apply_dev_quirks)(struct ufs_hba *); int (*suspend)(struct ufs_hba *, enum ufs_pm_op); @@ -546,7 +547,7 @@ struct ufs_hba { int nutrs; int nutmrs; u32 ufs_version; - struct ufs_hba_variant_ops *vops; + const struct ufs_hba_variant_ops *vops; void *priv; unsigned int irq; bool is_irq_enabled; -- 2.20.1