scsi: ufs: identify nexus type
authorhgchu <hg.chu@samsung.com>
Fri, 12 Jan 2018 01:18:20 +0000 (10:18 +0900)
committerJaeHun Jung <jh0801.jung@samsung.com>
Tue, 8 May 2018 08:20:13 +0000 (17:20 +0900)
Change-Id: I67e722d443fbf576b7f0a5e1f10bcd84fdae71d8
Signed-off-by: hgchu <hg.chu@samsung.com>
drivers/scsi/ufs/ufshcd-pci.c
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h

index 925b0ec7ec54d26d3490b91210c7424678360f42..631653407ec634bfb5a01fa28e2c21b533fa287b 100644 (file)
@@ -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 */
index 004f96c9f1a3367e5b2093f55e9eb01febd2e0d2..090c1a27cc0bc073e4d8a428b5ba305140b76aa5 100644 (file)
@@ -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 */
index 9c08f82795a2a4144744259f4e0f6161376e57c2..d824d679694798e30aa270e5dbc1ae234baaad9e 100644 (file)
@@ -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;