aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ufs/ufshcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ufs/ufshcd.c')
-rw-r--r--drivers/scsi/ufs/ufshcd.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 6a4fd00117ca..58f4ba6fe412 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -232,11 +232,11 @@ static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba)
232 * the host controller 232 * the host controller
233 * @reg_hcs - host controller status register value 233 * @reg_hcs - host controller status register value
234 * 234 *
235 * Returns 0 if device present, non-zero if no device detected 235 * Returns 1 if device present, 0 if no device detected
236 */ 236 */
237static inline int ufshcd_is_device_present(u32 reg_hcs) 237static inline int ufshcd_is_device_present(u32 reg_hcs)
238{ 238{
239 return (DEVICE_PRESENT & reg_hcs) ? 0 : -1; 239 return (DEVICE_PRESENT & reg_hcs) ? 1 : 0;
240} 240}
241 241
242/** 242/**
@@ -911,7 +911,7 @@ static int ufshcd_make_hba_operational(struct ufs_hba *hba)
911 911
912 /* check if device present */ 912 /* check if device present */
913 reg = readl((hba->mmio_base + REG_CONTROLLER_STATUS)); 913 reg = readl((hba->mmio_base + REG_CONTROLLER_STATUS));
914 if (ufshcd_is_device_present(reg)) { 914 if (!ufshcd_is_device_present(reg)) {
915 dev_err(&hba->pdev->dev, "cc: Device not present\n"); 915 dev_err(&hba->pdev->dev, "cc: Device not present\n");
916 err = -ENXIO; 916 err = -ENXIO;
917 goto out; 917 goto out;
@@ -1163,6 +1163,8 @@ static int ufshcd_task_req_compl(struct ufs_hba *hba, u32 index)
1163 if (task_result != UPIU_TASK_MANAGEMENT_FUNC_COMPL && 1163 if (task_result != UPIU_TASK_MANAGEMENT_FUNC_COMPL &&
1164 task_result != UPIU_TASK_MANAGEMENT_FUNC_SUCCEEDED) 1164 task_result != UPIU_TASK_MANAGEMENT_FUNC_SUCCEEDED)
1165 task_result = FAILED; 1165 task_result = FAILED;
1166 else
1167 task_result = SUCCESS;
1166 } else { 1168 } else {
1167 task_result = FAILED; 1169 task_result = FAILED;
1168 dev_err(&hba->pdev->dev, 1170 dev_err(&hba->pdev->dev,
@@ -1556,7 +1558,7 @@ ufshcd_issue_tm_cmd(struct ufs_hba *hba,
1556 goto out; 1558 goto out;
1557 } 1559 }
1558 clear_bit(free_slot, &hba->tm_condition); 1560 clear_bit(free_slot, &hba->tm_condition);
1559 return ufshcd_task_req_compl(hba, free_slot); 1561 err = ufshcd_task_req_compl(hba, free_slot);
1560out: 1562out:
1561 return err; 1563 return err;
1562} 1564}
@@ -1580,7 +1582,7 @@ static int ufshcd_device_reset(struct scsi_cmnd *cmd)
1580 tag = cmd->request->tag; 1582 tag = cmd->request->tag;
1581 1583
1582 err = ufshcd_issue_tm_cmd(hba, &hba->lrb[tag], UFS_LOGICAL_RESET); 1584 err = ufshcd_issue_tm_cmd(hba, &hba->lrb[tag], UFS_LOGICAL_RESET);
1583 if (err) 1585 if (err == FAILED)
1584 goto out; 1586 goto out;
1585 1587
1586 for (pos = 0; pos < hba->nutrs; pos++) { 1588 for (pos = 0; pos < hba->nutrs; pos++) {
@@ -1620,7 +1622,7 @@ static int ufshcd_host_reset(struct scsi_cmnd *cmd)
1620 if (hba->ufshcd_state == UFSHCD_STATE_RESET) 1622 if (hba->ufshcd_state == UFSHCD_STATE_RESET)
1621 return SUCCESS; 1623 return SUCCESS;
1622 1624
1623 return (ufshcd_do_reset(hba) == SUCCESS) ? SUCCESS : FAILED; 1625 return ufshcd_do_reset(hba);
1624} 1626}
1625 1627
1626/** 1628/**
@@ -1652,7 +1654,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
1652 spin_unlock_irqrestore(host->host_lock, flags); 1654 spin_unlock_irqrestore(host->host_lock, flags);
1653 1655
1654 err = ufshcd_issue_tm_cmd(hba, &hba->lrb[tag], UFS_ABORT_TASK); 1656 err = ufshcd_issue_tm_cmd(hba, &hba->lrb[tag], UFS_ABORT_TASK);
1655 if (err) 1657 if (err == FAILED)
1656 goto out; 1658 goto out;
1657 1659
1658 scsi_dma_unmap(cmd); 1660 scsi_dma_unmap(cmd);
@@ -1953,24 +1955,7 @@ static struct pci_driver ufshcd_pci_driver = {
1953#endif 1955#endif
1954}; 1956};
1955 1957
1956/** 1958module_pci_driver(ufshcd_pci_driver);
1957 * ufshcd_init - Driver registration routine
1958 */
1959static int __init ufshcd_init(void)
1960{
1961 return pci_register_driver(&ufshcd_pci_driver);
1962}
1963module_init(ufshcd_init);
1964
1965/**
1966 * ufshcd_exit - Driver exit clean-up routine
1967 */
1968static void __exit ufshcd_exit(void)
1969{
1970 pci_unregister_driver(&ufshcd_pci_driver);
1971}
1972module_exit(ufshcd_exit);
1973
1974 1959
1975MODULE_AUTHOR("Santosh Yaragnavi <santosh.sy@samsung.com>, " 1960MODULE_AUTHOR("Santosh Yaragnavi <santosh.sy@samsung.com>, "
1976 "Vinayak Holikatti <h.vinayak@samsung.com>"); 1961 "Vinayak Holikatti <h.vinayak@samsung.com>");