aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/3w-sas.c5
-rw-r--r--drivers/scsi/53c700.c2
-rw-r--r--drivers/scsi/a100u2w.c8
-rw-r--r--drivers/scsi/aacraid/linit.c9
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c8
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c18
-rw-r--r--drivers/scsi/be2iscsi/be_main.c4
-rw-r--r--drivers/scsi/be2iscsi/be_mgmt.c11
-rw-r--r--drivers/scsi/bfa/bfad_bsg.c6
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_hwi.c49
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_io.c4
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_tgt.c44
-rw-r--r--drivers/scsi/bnx2i/bnx2i_hwi.c8
-rw-r--r--drivers/scsi/csiostor/csio_attr.c2
-rw-r--r--drivers/scsi/csiostor/csio_wr.c4
-rw-r--r--drivers/scsi/cxgbi/cxgb3i/cxgb3i.c9
-rw-r--r--drivers/scsi/cxgbi/cxgb4i/cxgb4i.c28
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c7
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.h5
-rw-r--r--drivers/scsi/cxlflash/main.c2
-rw-r--r--drivers/scsi/hisi_sas/hisi_sas_v3_hw.c12
-rw-r--r--drivers/scsi/isci/init.c14
-rw-r--r--drivers/scsi/libfc/fc_lport.c6
-rw-r--r--drivers/scsi/libfc/fc_rport.c1
-rw-r--r--drivers/scsi/libiscsi.c6
-rw-r--r--drivers/scsi/libsas/sas_expander.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_bsg.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c14
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c6
-rw-r--r--drivers/scsi/lpfc/lpfc_nvme.c16
-rw-r--r--drivers/scsi/lpfc/lpfc_nvme.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_nvmet.c8
-rw-r--r--drivers/scsi/lpfc/lpfc_nvmet.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c35
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c15
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_base.c28
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_fusion.c8
-rw-r--r--drivers/scsi/mesh.c5
-rw-r--r--drivers/scsi/mvumi.c9
-rw-r--r--drivers/scsi/pm8001/pm8001_sas.c6
-rw-r--r--drivers/scsi/qedf/qedf_main.c29
-rw-r--r--drivers/scsi/qedi/qedi_iscsi.c3
-rw-r--r--drivers/scsi/qedi/qedi_iscsi.h1
-rw-r--r--drivers/scsi/qedi/qedi_main.c39
-rw-r--r--drivers/scsi/qla1280.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_bsg.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_gs.c14
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c12
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_init.c4
-rw-r--r--drivers/scsi/qla4xxx/ql4_mbx.c18
-rw-r--r--drivers/scsi/qla4xxx/ql4_nx.c4
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c12
-rw-r--r--drivers/scsi/scsi_debug.c41
-rw-r--r--drivers/scsi/scsi_lib.c5
-rw-r--r--drivers/scsi/scsi_pm.c26
-rw-r--r--drivers/scsi/sd.c18
-rw-r--r--drivers/scsi/sd_zbc.c20
-rw-r--r--drivers/scsi/smartpqi/smartpqi_init.c34
-rw-r--r--drivers/scsi/ufs/ufs.h2
-rw-r--r--drivers/scsi/ufs/ufshcd.c12
64 files changed, 412 insertions, 329 deletions
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index e8f5f7c63190..cd096104bcec 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -646,8 +646,9 @@ static int twl_allocate_memory(TW_Device_Extension *tw_dev, int size, int which)
646 unsigned long *cpu_addr; 646 unsigned long *cpu_addr;
647 int retval = 1; 647 int retval = 1;
648 648
649 cpu_addr = dma_zalloc_coherent(&tw_dev->tw_pci_dev->dev, 649 cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev,
650 size * TW_Q_LENGTH, &dma_handle, GFP_KERNEL); 650 size * TW_Q_LENGTH, &dma_handle,
651 GFP_KERNEL);
651 if (!cpu_addr) { 652 if (!cpu_addr) {
652 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed"); 653 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed");
653 goto out; 654 goto out;
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 128d658d472a..16957d7ac414 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -295,7 +295,7 @@ NCR_700_detect(struct scsi_host_template *tpnt,
295 if(tpnt->sdev_attrs == NULL) 295 if(tpnt->sdev_attrs == NULL)
296 tpnt->sdev_attrs = NCR_700_dev_attrs; 296 tpnt->sdev_attrs = NCR_700_dev_attrs;
297 297
298 memory = dma_alloc_attrs(hostdata->dev, TOTAL_MEM_SIZE, &pScript, 298 memory = dma_alloc_attrs(dev, TOTAL_MEM_SIZE, &pScript,
299 GFP_KERNEL, DMA_ATTR_NON_CONSISTENT); 299 GFP_KERNEL, DMA_ATTR_NON_CONSISTENT);
300 if(memory == NULL) { 300 if(memory == NULL) {
301 printk(KERN_ERR "53c700: Failed to allocate memory for driver, detaching\n"); 301 printk(KERN_ERR "53c700: Failed to allocate memory for driver, detaching\n");
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index ff53fd0d12f2..66c514310f3c 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -1123,8 +1123,8 @@ static int inia100_probe_one(struct pci_dev *pdev,
1123 1123
1124 /* Get total memory needed for SCB */ 1124 /* Get total memory needed for SCB */
1125 sz = ORC_MAXQUEUE * sizeof(struct orc_scb); 1125 sz = ORC_MAXQUEUE * sizeof(struct orc_scb);
1126 host->scb_virt = dma_zalloc_coherent(&pdev->dev, sz, &host->scb_phys, 1126 host->scb_virt = dma_alloc_coherent(&pdev->dev, sz, &host->scb_phys,
1127 GFP_KERNEL); 1127 GFP_KERNEL);
1128 if (!host->scb_virt) { 1128 if (!host->scb_virt) {
1129 printk("inia100: SCB memory allocation error\n"); 1129 printk("inia100: SCB memory allocation error\n");
1130 goto out_host_put; 1130 goto out_host_put;
@@ -1132,8 +1132,8 @@ static int inia100_probe_one(struct pci_dev *pdev,
1132 1132
1133 /* Get total memory needed for ESCB */ 1133 /* Get total memory needed for ESCB */
1134 sz = ORC_MAXQUEUE * sizeof(struct orc_extended_scb); 1134 sz = ORC_MAXQUEUE * sizeof(struct orc_extended_scb);
1135 host->escb_virt = dma_zalloc_coherent(&pdev->dev, sz, &host->escb_phys, 1135 host->escb_virt = dma_alloc_coherent(&pdev->dev, sz, &host->escb_phys,
1136 GFP_KERNEL); 1136 GFP_KERNEL);
1137 if (!host->escb_virt) { 1137 if (!host->escb_virt) {
1138 printk("inia100: ESCB memory allocation error\n"); 1138 printk("inia100: ESCB memory allocation error\n");
1139 goto out_free_scb_array; 1139 goto out_free_scb_array;
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 634ddb90e7aa..7e56a11836c1 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1747,11 +1747,10 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1747 shost->max_sectors = (shost->sg_tablesize * 8) + 112; 1747 shost->max_sectors = (shost->sg_tablesize * 8) + 112;
1748 } 1748 }
1749 1749
1750 error = dma_set_max_seg_size(&pdev->dev, 1750 if (aac->adapter_info.options & AAC_OPT_NEW_COMM)
1751 (aac->adapter_info.options & AAC_OPT_NEW_COMM) ? 1751 shost->max_segment_size = shost->max_sectors << 9;
1752 (shost->max_sectors << 9) : 65536); 1752 else
1753 if (error) 1753 shost->max_segment_size = 65536;
1754 goto out_deinit;
1755 1754
1756 /* 1755 /*
1757 * Firmware printf works only with older firmware. 1756 * Firmware printf works only with older firmware.
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index f83f79b07b50..07efcb9b5b94 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -280,7 +280,7 @@ static ssize_t asd_show_dev_rev(struct device *dev,
280 return snprintf(buf, PAGE_SIZE, "%s\n", 280 return snprintf(buf, PAGE_SIZE, "%s\n",
281 asd_dev_rev[asd_ha->revision_id]); 281 asd_dev_rev[asd_ha->revision_id]);
282} 282}
283static DEVICE_ATTR(revision, S_IRUGO, asd_show_dev_rev, NULL); 283static DEVICE_ATTR(aic_revision, S_IRUGO, asd_show_dev_rev, NULL);
284 284
285static ssize_t asd_show_dev_bios_build(struct device *dev, 285static ssize_t asd_show_dev_bios_build(struct device *dev,
286 struct device_attribute *attr,char *buf) 286 struct device_attribute *attr,char *buf)
@@ -477,7 +477,7 @@ static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha)
477{ 477{
478 int err; 478 int err;
479 479
480 err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision); 480 err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision);
481 if (err) 481 if (err)
482 return err; 482 return err;
483 483
@@ -499,13 +499,13 @@ err_update_bios:
499err_biosb: 499err_biosb:
500 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); 500 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
501err_rev: 501err_rev:
502 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision); 502 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision);
503 return err; 503 return err;
504} 504}
505 505
506static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha) 506static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha)
507{ 507{
508 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision); 508 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision);
509 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); 509 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
510 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn); 510 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn);
511 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_update_bios); 511 device_remove_file(&asd_ha->pcidev->dev, &dev_attr_update_bios);
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 0f6751b0a633..57c6fa388bf6 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -587,8 +587,10 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb)
587 case ACB_ADAPTER_TYPE_B: { 587 case ACB_ADAPTER_TYPE_B: {
588 struct MessageUnit_B *reg; 588 struct MessageUnit_B *reg;
589 acb->roundup_ccbsize = roundup(sizeof(struct MessageUnit_B), 32); 589 acb->roundup_ccbsize = roundup(sizeof(struct MessageUnit_B), 32);
590 dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->roundup_ccbsize, 590 dma_coherent = dma_alloc_coherent(&pdev->dev,
591 &dma_coherent_handle, GFP_KERNEL); 591 acb->roundup_ccbsize,
592 &dma_coherent_handle,
593 GFP_KERNEL);
592 if (!dma_coherent) { 594 if (!dma_coherent) {
593 pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no); 595 pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no);
594 return false; 596 return false;
@@ -617,8 +619,10 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb)
617 struct MessageUnit_D *reg; 619 struct MessageUnit_D *reg;
618 620
619 acb->roundup_ccbsize = roundup(sizeof(struct MessageUnit_D), 32); 621 acb->roundup_ccbsize = roundup(sizeof(struct MessageUnit_D), 32);
620 dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->roundup_ccbsize, 622 dma_coherent = dma_alloc_coherent(&pdev->dev,
621 &dma_coherent_handle, GFP_KERNEL); 623 acb->roundup_ccbsize,
624 &dma_coherent_handle,
625 GFP_KERNEL);
622 if (!dma_coherent) { 626 if (!dma_coherent) {
623 pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no); 627 pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no);
624 return false; 628 return false;
@@ -659,8 +663,10 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb)
659 uint32_t completeQ_size; 663 uint32_t completeQ_size;
660 completeQ_size = sizeof(struct deliver_completeQ) * ARCMSR_MAX_HBE_DONEQUEUE + 128; 664 completeQ_size = sizeof(struct deliver_completeQ) * ARCMSR_MAX_HBE_DONEQUEUE + 128;
661 acb->roundup_ccbsize = roundup(completeQ_size, 32); 665 acb->roundup_ccbsize = roundup(completeQ_size, 32);
662 dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->roundup_ccbsize, 666 dma_coherent = dma_alloc_coherent(&pdev->dev,
663 &dma_coherent_handle, GFP_KERNEL); 667 acb->roundup_ccbsize,
668 &dma_coherent_handle,
669 GFP_KERNEL);
664 if (!dma_coherent){ 670 if (!dma_coherent){
665 pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no); 671 pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no);
666 return false; 672 return false;
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 39f3820572b4..74e260027c7d 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3321,8 +3321,8 @@ static int be_queue_alloc(struct beiscsi_hba *phba, struct be_queue_info *q,
3321 q->len = len; 3321 q->len = len;
3322 q->entry_size = entry_size; 3322 q->entry_size = entry_size;
3323 mem->size = len * entry_size; 3323 mem->size = len * entry_size;
3324 mem->va = dma_zalloc_coherent(&phba->pcidev->dev, mem->size, &mem->dma, 3324 mem->va = dma_alloc_coherent(&phba->pcidev->dev, mem->size, &mem->dma,
3325 GFP_KERNEL); 3325 GFP_KERNEL);
3326 if (!mem->va) 3326 if (!mem->va)
3327 return -ENOMEM; 3327 return -ENOMEM;
3328 return 0; 3328 return 0;
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index ca7b7bbc8371..d4febaadfaa3 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -293,8 +293,8 @@ static int beiscsi_prep_nemb_cmd(struct beiscsi_hba *phba,
293 struct be_dma_mem *cmd, 293 struct be_dma_mem *cmd,
294 u8 subsystem, u8 opcode, u32 size) 294 u8 subsystem, u8 opcode, u32 size)
295{ 295{
296 cmd->va = dma_zalloc_coherent(&phba->ctrl.pdev->dev, size, &cmd->dma, 296 cmd->va = dma_alloc_coherent(&phba->ctrl.pdev->dev, size, &cmd->dma,
297 GFP_KERNEL); 297 GFP_KERNEL);
298 if (!cmd->va) { 298 if (!cmd->va) {
299 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, 299 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
300 "BG_%d : Failed to allocate memory for if info\n"); 300 "BG_%d : Failed to allocate memory for if info\n");
@@ -1510,10 +1510,9 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba,
1510 return -EINVAL; 1510 return -EINVAL;
1511 1511
1512 nonemb_cmd.size = sizeof(union be_invldt_cmds_params); 1512 nonemb_cmd.size = sizeof(union be_invldt_cmds_params);
1513 nonemb_cmd.va = dma_zalloc_coherent(&phba->ctrl.pdev->dev, 1513 nonemb_cmd.va = dma_alloc_coherent(&phba->ctrl.pdev->dev,
1514 nonemb_cmd.size, 1514 nonemb_cmd.size, &nonemb_cmd.dma,
1515 &nonemb_cmd.dma, 1515 GFP_KERNEL);
1516 GFP_KERNEL);
1517 if (!nonemb_cmd.va) { 1516 if (!nonemb_cmd.va) {
1518 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_EH, 1517 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_EH,
1519 "BM_%d : invldt_cmds_params alloc failed\n"); 1518 "BM_%d : invldt_cmds_params alloc failed\n");
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index 5d163ca1b366..d8e6d7480f35 100644
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -3264,9 +3264,9 @@ bfad_fcxp_map_sg(struct bfad_s *bfad, void *payload_kbuf,
3264 /* Allocate dma coherent memory */ 3264 /* Allocate dma coherent memory */
3265 buf_info = buf_base; 3265 buf_info = buf_base;
3266 buf_info->size = payload_len; 3266 buf_info->size = payload_len;
3267 buf_info->virt = dma_zalloc_coherent(&bfad->pcidev->dev, 3267 buf_info->virt = dma_alloc_coherent(&bfad->pcidev->dev,
3268 buf_info->size, &buf_info->phys, 3268 buf_info->size, &buf_info->phys,
3269 GFP_KERNEL); 3269 GFP_KERNEL);
3270 if (!buf_info->virt) 3270 if (!buf_info->virt)
3271 goto out_free_mem; 3271 goto out_free_mem;
3272 3272
diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
index e8ae4d671d23..039328d9ef13 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
@@ -1857,10 +1857,10 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba)
1857 * entries. Hence the limit with one page is 8192 task context 1857 * entries. Hence the limit with one page is 8192 task context
1858 * entries. 1858 * entries.
1859 */ 1859 */
1860 hba->task_ctx_bd_tbl = dma_zalloc_coherent(&hba->pcidev->dev, 1860 hba->task_ctx_bd_tbl = dma_alloc_coherent(&hba->pcidev->dev,
1861 PAGE_SIZE, 1861 PAGE_SIZE,
1862 &hba->task_ctx_bd_dma, 1862 &hba->task_ctx_bd_dma,
1863 GFP_KERNEL); 1863 GFP_KERNEL);
1864 if (!hba->task_ctx_bd_tbl) { 1864 if (!hba->task_ctx_bd_tbl) {
1865 printk(KERN_ERR PFX "unable to allocate task context BDT\n"); 1865 printk(KERN_ERR PFX "unable to allocate task context BDT\n");
1866 rc = -1; 1866 rc = -1;
@@ -1894,10 +1894,10 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba)
1894 task_ctx_bdt = (struct regpair *)hba->task_ctx_bd_tbl; 1894 task_ctx_bdt = (struct regpair *)hba->task_ctx_bd_tbl;
1895 for (i = 0; i < task_ctx_arr_sz; i++) { 1895 for (i = 0; i < task_ctx_arr_sz; i++) {
1896 1896
1897 hba->task_ctx[i] = dma_zalloc_coherent(&hba->pcidev->dev, 1897 hba->task_ctx[i] = dma_alloc_coherent(&hba->pcidev->dev,
1898 PAGE_SIZE, 1898 PAGE_SIZE,
1899 &hba->task_ctx_dma[i], 1899 &hba->task_ctx_dma[i],
1900 GFP_KERNEL); 1900 GFP_KERNEL);
1901 if (!hba->task_ctx[i]) { 1901 if (!hba->task_ctx[i]) {
1902 printk(KERN_ERR PFX "unable to alloc task context\n"); 1902 printk(KERN_ERR PFX "unable to alloc task context\n");
1903 rc = -1; 1903 rc = -1;
@@ -2031,19 +2031,19 @@ static int bnx2fc_allocate_hash_table(struct bnx2fc_hba *hba)
2031 } 2031 }
2032 2032
2033 for (i = 0; i < segment_count; ++i) { 2033 for (i = 0; i < segment_count; ++i) {
2034 hba->hash_tbl_segments[i] = dma_zalloc_coherent(&hba->pcidev->dev, 2034 hba->hash_tbl_segments[i] = dma_alloc_coherent(&hba->pcidev->dev,
2035 BNX2FC_HASH_TBL_CHUNK_SIZE, 2035 BNX2FC_HASH_TBL_CHUNK_SIZE,
2036 &dma_segment_array[i], 2036 &dma_segment_array[i],
2037 GFP_KERNEL); 2037 GFP_KERNEL);
2038 if (!hba->hash_tbl_segments[i]) { 2038 if (!hba->hash_tbl_segments[i]) {
2039 printk(KERN_ERR PFX "hash segment alloc failed\n"); 2039 printk(KERN_ERR PFX "hash segment alloc failed\n");
2040 goto cleanup_dma; 2040 goto cleanup_dma;
2041 } 2041 }
2042 } 2042 }
2043 2043
2044 hba->hash_tbl_pbl = dma_zalloc_coherent(&hba->pcidev->dev, PAGE_SIZE, 2044 hba->hash_tbl_pbl = dma_alloc_coherent(&hba->pcidev->dev, PAGE_SIZE,
2045 &hba->hash_tbl_pbl_dma, 2045 &hba->hash_tbl_pbl_dma,
2046 GFP_KERNEL); 2046 GFP_KERNEL);
2047 if (!hba->hash_tbl_pbl) { 2047 if (!hba->hash_tbl_pbl) {
2048 printk(KERN_ERR PFX "hash table pbl alloc failed\n"); 2048 printk(KERN_ERR PFX "hash table pbl alloc failed\n");
2049 goto cleanup_dma; 2049 goto cleanup_dma;
@@ -2104,10 +2104,9 @@ int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba)
2104 return -ENOMEM; 2104 return -ENOMEM;
2105 2105
2106 mem_size = BNX2FC_NUM_MAX_SESS * sizeof(struct regpair); 2106 mem_size = BNX2FC_NUM_MAX_SESS * sizeof(struct regpair);
2107 hba->t2_hash_tbl_ptr = dma_zalloc_coherent(&hba->pcidev->dev, 2107 hba->t2_hash_tbl_ptr = dma_alloc_coherent(&hba->pcidev->dev, mem_size,
2108 mem_size, 2108 &hba->t2_hash_tbl_ptr_dma,
2109 &hba->t2_hash_tbl_ptr_dma, 2109 GFP_KERNEL);
2110 GFP_KERNEL);
2111 if (!hba->t2_hash_tbl_ptr) { 2110 if (!hba->t2_hash_tbl_ptr) {
2112 printk(KERN_ERR PFX "unable to allocate t2 hash table ptr\n"); 2111 printk(KERN_ERR PFX "unable to allocate t2 hash table ptr\n");
2113 bnx2fc_free_fw_resc(hba); 2112 bnx2fc_free_fw_resc(hba);
@@ -2116,9 +2115,9 @@ int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba)
2116 2115
2117 mem_size = BNX2FC_NUM_MAX_SESS * 2116 mem_size = BNX2FC_NUM_MAX_SESS *
2118 sizeof(struct fcoe_t2_hash_table_entry); 2117 sizeof(struct fcoe_t2_hash_table_entry);
2119 hba->t2_hash_tbl = dma_zalloc_coherent(&hba->pcidev->dev, mem_size, 2118 hba->t2_hash_tbl = dma_alloc_coherent(&hba->pcidev->dev, mem_size,
2120 &hba->t2_hash_tbl_dma, 2119 &hba->t2_hash_tbl_dma,
2121 GFP_KERNEL); 2120 GFP_KERNEL);
2122 if (!hba->t2_hash_tbl) { 2121 if (!hba->t2_hash_tbl) {
2123 printk(KERN_ERR PFX "unable to allocate t2 hash table\n"); 2122 printk(KERN_ERR PFX "unable to allocate t2 hash table\n");
2124 bnx2fc_free_fw_resc(hba); 2123 bnx2fc_free_fw_resc(hba);
@@ -2140,9 +2139,9 @@ int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba)
2140 return -ENOMEM; 2139 return -ENOMEM;
2141 } 2140 }
2142 2141
2143 hba->stats_buffer = dma_zalloc_coherent(&hba->pcidev->dev, PAGE_SIZE, 2142 hba->stats_buffer = dma_alloc_coherent(&hba->pcidev->dev, PAGE_SIZE,
2144 &hba->stats_buf_dma, 2143 &hba->stats_buf_dma,
2145 GFP_KERNEL); 2144 GFP_KERNEL);
2146 if (!hba->stats_buffer) { 2145 if (!hba->stats_buffer) {
2147 printk(KERN_ERR PFX "unable to alloc Stats Buffer\n"); 2146 printk(KERN_ERR PFX "unable to alloc Stats Buffer\n");
2148 bnx2fc_free_fw_resc(hba); 2147 bnx2fc_free_fw_resc(hba);
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 350257c13a5b..bc9f2a2365f4 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -240,6 +240,7 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba)
240 return NULL; 240 return NULL;
241 } 241 }
242 242
243 cmgr->hba = hba;
243 cmgr->free_list = kcalloc(arr_sz, sizeof(*cmgr->free_list), 244 cmgr->free_list = kcalloc(arr_sz, sizeof(*cmgr->free_list),
244 GFP_KERNEL); 245 GFP_KERNEL);
245 if (!cmgr->free_list) { 246 if (!cmgr->free_list) {
@@ -256,7 +257,6 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba)
256 goto mem_err; 257 goto mem_err;
257 } 258 }
258 259
259 cmgr->hba = hba;
260 cmgr->cmds = (struct bnx2fc_cmd **)(cmgr + 1); 260 cmgr->cmds = (struct bnx2fc_cmd **)(cmgr + 1);
261 261
262 for (i = 0; i < arr_sz; i++) { 262 for (i = 0; i < arr_sz; i++) {
@@ -295,7 +295,7 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba)
295 295
296 /* Allocate pool of io_bdts - one for each bnx2fc_cmd */ 296 /* Allocate pool of io_bdts - one for each bnx2fc_cmd */
297 mem_size = num_ios * sizeof(struct io_bdt *); 297 mem_size = num_ios * sizeof(struct io_bdt *);
298 cmgr->io_bdt_pool = kmalloc(mem_size, GFP_KERNEL); 298 cmgr->io_bdt_pool = kzalloc(mem_size, GFP_KERNEL);
299 if (!cmgr->io_bdt_pool) { 299 if (!cmgr->io_bdt_pool) {
300 printk(KERN_ERR PFX "failed to alloc io_bdt_pool\n"); 300 printk(KERN_ERR PFX "failed to alloc io_bdt_pool\n");
301 goto mem_err; 301 goto mem_err;
diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
index e3d1c7c440c8..d735e87e416a 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
@@ -672,8 +672,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
672 tgt->sq_mem_size = (tgt->sq_mem_size + (CNIC_PAGE_SIZE - 1)) & 672 tgt->sq_mem_size = (tgt->sq_mem_size + (CNIC_PAGE_SIZE - 1)) &
673 CNIC_PAGE_MASK; 673 CNIC_PAGE_MASK;
674 674
675 tgt->sq = dma_zalloc_coherent(&hba->pcidev->dev, tgt->sq_mem_size, 675 tgt->sq = dma_alloc_coherent(&hba->pcidev->dev, tgt->sq_mem_size,
676 &tgt->sq_dma, GFP_KERNEL); 676 &tgt->sq_dma, GFP_KERNEL);
677 if (!tgt->sq) { 677 if (!tgt->sq) {
678 printk(KERN_ERR PFX "unable to allocate SQ memory %d\n", 678 printk(KERN_ERR PFX "unable to allocate SQ memory %d\n",
679 tgt->sq_mem_size); 679 tgt->sq_mem_size);
@@ -685,8 +685,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
685 tgt->cq_mem_size = (tgt->cq_mem_size + (CNIC_PAGE_SIZE - 1)) & 685 tgt->cq_mem_size = (tgt->cq_mem_size + (CNIC_PAGE_SIZE - 1)) &
686 CNIC_PAGE_MASK; 686 CNIC_PAGE_MASK;
687 687
688 tgt->cq = dma_zalloc_coherent(&hba->pcidev->dev, tgt->cq_mem_size, 688 tgt->cq = dma_alloc_coherent(&hba->pcidev->dev, tgt->cq_mem_size,
689 &tgt->cq_dma, GFP_KERNEL); 689 &tgt->cq_dma, GFP_KERNEL);
690 if (!tgt->cq) { 690 if (!tgt->cq) {
691 printk(KERN_ERR PFX "unable to allocate CQ memory %d\n", 691 printk(KERN_ERR PFX "unable to allocate CQ memory %d\n",
692 tgt->cq_mem_size); 692 tgt->cq_mem_size);
@@ -698,8 +698,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
698 tgt->rq_mem_size = (tgt->rq_mem_size + (CNIC_PAGE_SIZE - 1)) & 698 tgt->rq_mem_size = (tgt->rq_mem_size + (CNIC_PAGE_SIZE - 1)) &
699 CNIC_PAGE_MASK; 699 CNIC_PAGE_MASK;
700 700
701 tgt->rq = dma_zalloc_coherent(&hba->pcidev->dev, tgt->rq_mem_size, 701 tgt->rq = dma_alloc_coherent(&hba->pcidev->dev, tgt->rq_mem_size,
702 &tgt->rq_dma, GFP_KERNEL); 702 &tgt->rq_dma, GFP_KERNEL);
703 if (!tgt->rq) { 703 if (!tgt->rq) {
704 printk(KERN_ERR PFX "unable to allocate RQ memory %d\n", 704 printk(KERN_ERR PFX "unable to allocate RQ memory %d\n",
705 tgt->rq_mem_size); 705 tgt->rq_mem_size);
@@ -710,8 +710,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
710 tgt->rq_pbl_size = (tgt->rq_pbl_size + (CNIC_PAGE_SIZE - 1)) & 710 tgt->rq_pbl_size = (tgt->rq_pbl_size + (CNIC_PAGE_SIZE - 1)) &
711 CNIC_PAGE_MASK; 711 CNIC_PAGE_MASK;
712 712
713 tgt->rq_pbl = dma_zalloc_coherent(&hba->pcidev->dev, tgt->rq_pbl_size, 713 tgt->rq_pbl = dma_alloc_coherent(&hba->pcidev->dev, tgt->rq_pbl_size,
714 &tgt->rq_pbl_dma, GFP_KERNEL); 714 &tgt->rq_pbl_dma, GFP_KERNEL);
715 if (!tgt->rq_pbl) { 715 if (!tgt->rq_pbl) {
716 printk(KERN_ERR PFX "unable to allocate RQ PBL %d\n", 716 printk(KERN_ERR PFX "unable to allocate RQ PBL %d\n",
717 tgt->rq_pbl_size); 717 tgt->rq_pbl_size);
@@ -735,9 +735,9 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
735 tgt->xferq_mem_size = (tgt->xferq_mem_size + (CNIC_PAGE_SIZE - 1)) & 735 tgt->xferq_mem_size = (tgt->xferq_mem_size + (CNIC_PAGE_SIZE - 1)) &
736 CNIC_PAGE_MASK; 736 CNIC_PAGE_MASK;
737 737
738 tgt->xferq = dma_zalloc_coherent(&hba->pcidev->dev, 738 tgt->xferq = dma_alloc_coherent(&hba->pcidev->dev,
739 tgt->xferq_mem_size, &tgt->xferq_dma, 739 tgt->xferq_mem_size, &tgt->xferq_dma,
740 GFP_KERNEL); 740 GFP_KERNEL);
741 if (!tgt->xferq) { 741 if (!tgt->xferq) {
742 printk(KERN_ERR PFX "unable to allocate XFERQ %d\n", 742 printk(KERN_ERR PFX "unable to allocate XFERQ %d\n",
743 tgt->xferq_mem_size); 743 tgt->xferq_mem_size);
@@ -749,9 +749,9 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
749 tgt->confq_mem_size = (tgt->confq_mem_size + (CNIC_PAGE_SIZE - 1)) & 749 tgt->confq_mem_size = (tgt->confq_mem_size + (CNIC_PAGE_SIZE - 1)) &
750 CNIC_PAGE_MASK; 750 CNIC_PAGE_MASK;
751 751
752 tgt->confq = dma_zalloc_coherent(&hba->pcidev->dev, 752 tgt->confq = dma_alloc_coherent(&hba->pcidev->dev,
753 tgt->confq_mem_size, &tgt->confq_dma, 753 tgt->confq_mem_size, &tgt->confq_dma,
754 GFP_KERNEL); 754 GFP_KERNEL);
755 if (!tgt->confq) { 755 if (!tgt->confq) {
756 printk(KERN_ERR PFX "unable to allocate CONFQ %d\n", 756 printk(KERN_ERR PFX "unable to allocate CONFQ %d\n",
757 tgt->confq_mem_size); 757 tgt->confq_mem_size);
@@ -763,9 +763,9 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
763 tgt->confq_pbl_size = 763 tgt->confq_pbl_size =
764 (tgt->confq_pbl_size + (CNIC_PAGE_SIZE - 1)) & CNIC_PAGE_MASK; 764 (tgt->confq_pbl_size + (CNIC_PAGE_SIZE - 1)) & CNIC_PAGE_MASK;
765 765
766 tgt->confq_pbl = dma_zalloc_coherent(&hba->pcidev->dev, 766 tgt->confq_pbl = dma_alloc_coherent(&hba->pcidev->dev,
767 tgt->confq_pbl_size, 767 tgt->confq_pbl_size,
768 &tgt->confq_pbl_dma, GFP_KERNEL); 768 &tgt->confq_pbl_dma, GFP_KERNEL);
769 if (!tgt->confq_pbl) { 769 if (!tgt->confq_pbl) {
770 printk(KERN_ERR PFX "unable to allocate CONFQ PBL %d\n", 770 printk(KERN_ERR PFX "unable to allocate CONFQ PBL %d\n",
771 tgt->confq_pbl_size); 771 tgt->confq_pbl_size);
@@ -787,9 +787,9 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
787 /* Allocate and map ConnDB */ 787 /* Allocate and map ConnDB */
788 tgt->conn_db_mem_size = sizeof(struct fcoe_conn_db); 788 tgt->conn_db_mem_size = sizeof(struct fcoe_conn_db);
789 789
790 tgt->conn_db = dma_zalloc_coherent(&hba->pcidev->dev, 790 tgt->conn_db = dma_alloc_coherent(&hba->pcidev->dev,
791 tgt->conn_db_mem_size, 791 tgt->conn_db_mem_size,
792 &tgt->conn_db_dma, GFP_KERNEL); 792 &tgt->conn_db_dma, GFP_KERNEL);
793 if (!tgt->conn_db) { 793 if (!tgt->conn_db) {
794 printk(KERN_ERR PFX "unable to allocate conn_db %d\n", 794 printk(KERN_ERR PFX "unable to allocate conn_db %d\n",
795 tgt->conn_db_mem_size); 795 tgt->conn_db_mem_size);
@@ -802,8 +802,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
802 tgt->lcq_mem_size = (tgt->lcq_mem_size + (CNIC_PAGE_SIZE - 1)) & 802 tgt->lcq_mem_size = (tgt->lcq_mem_size + (CNIC_PAGE_SIZE - 1)) &
803 CNIC_PAGE_MASK; 803 CNIC_PAGE_MASK;
804 804
805 tgt->lcq = dma_zalloc_coherent(&hba->pcidev->dev, tgt->lcq_mem_size, 805 tgt->lcq = dma_alloc_coherent(&hba->pcidev->dev, tgt->lcq_mem_size,
806 &tgt->lcq_dma, GFP_KERNEL); 806 &tgt->lcq_dma, GFP_KERNEL);
807 807
808 if (!tgt->lcq) { 808 if (!tgt->lcq) {
809 printk(KERN_ERR PFX "unable to allocate lcq %d\n", 809 printk(KERN_ERR PFX "unable to allocate lcq %d\n",
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 91f5316aa3ab..fae6f71e677d 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -1070,8 +1070,8 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
1070 1070
1071 /* Allocate memory area for actual SQ element */ 1071 /* Allocate memory area for actual SQ element */
1072 ep->qp.sq_virt = 1072 ep->qp.sq_virt =
1073 dma_zalloc_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size, 1073 dma_alloc_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size,
1074 &ep->qp.sq_phys, GFP_KERNEL); 1074 &ep->qp.sq_phys, GFP_KERNEL);
1075 if (!ep->qp.sq_virt) { 1075 if (!ep->qp.sq_virt) {
1076 printk(KERN_ALERT "bnx2i: unable to alloc SQ BD memory %d\n", 1076 printk(KERN_ALERT "bnx2i: unable to alloc SQ BD memory %d\n",
1077 ep->qp.sq_mem_size); 1077 ep->qp.sq_mem_size);
@@ -1106,8 +1106,8 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
1106 1106
1107 /* Allocate memory area for actual CQ element */ 1107 /* Allocate memory area for actual CQ element */
1108 ep->qp.cq_virt = 1108 ep->qp.cq_virt =
1109 dma_zalloc_coherent(&hba->pcidev->dev, ep->qp.cq_mem_size, 1109 dma_alloc_coherent(&hba->pcidev->dev, ep->qp.cq_mem_size,
1110 &ep->qp.cq_phys, GFP_KERNEL); 1110 &ep->qp.cq_phys, GFP_KERNEL);
1111 if (!ep->qp.cq_virt) { 1111 if (!ep->qp.cq_virt) {
1112 printk(KERN_ALERT "bnx2i: unable to alloc CQ BD memory %d\n", 1112 printk(KERN_ALERT "bnx2i: unable to alloc CQ BD memory %d\n",
1113 ep->qp.cq_mem_size); 1113 ep->qp.cq_mem_size);
diff --git a/drivers/scsi/csiostor/csio_attr.c b/drivers/scsi/csiostor/csio_attr.c
index 8a004036e3d7..9bd2bd8dc2be 100644
--- a/drivers/scsi/csiostor/csio_attr.c
+++ b/drivers/scsi/csiostor/csio_attr.c
@@ -594,12 +594,12 @@ csio_vport_create(struct fc_vport *fc_vport, bool disable)
594 } 594 }
595 595
596 fc_vport_set_state(fc_vport, FC_VPORT_INITIALIZING); 596 fc_vport_set_state(fc_vport, FC_VPORT_INITIALIZING);
597 ln->fc_vport = fc_vport;
597 598
598 if (csio_fcoe_alloc_vnp(hw, ln)) 599 if (csio_fcoe_alloc_vnp(hw, ln))
599 goto error; 600 goto error;
600 601
601 *(struct csio_lnode **)fc_vport->dd_data = ln; 602 *(struct csio_lnode **)fc_vport->dd_data = ln;
602 ln->fc_vport = fc_vport;
603 if (!fc_vport->node_name) 603 if (!fc_vport->node_name)
604 fc_vport->node_name = wwn_to_u64(csio_ln_wwnn(ln)); 604 fc_vport->node_name = wwn_to_u64(csio_ln_wwnn(ln));
605 if (!fc_vport->port_name) 605 if (!fc_vport->port_name)
diff --git a/drivers/scsi/csiostor/csio_wr.c b/drivers/scsi/csiostor/csio_wr.c
index dc12933533d5..66bbd21819ae 100644
--- a/drivers/scsi/csiostor/csio_wr.c
+++ b/drivers/scsi/csiostor/csio_wr.c
@@ -233,8 +233,8 @@ csio_wr_alloc_q(struct csio_hw *hw, uint32_t qsize, uint32_t wrsize,
233 233
234 q = wrm->q_arr[free_idx]; 234 q = wrm->q_arr[free_idx];
235 235
236 q->vstart = dma_zalloc_coherent(&hw->pdev->dev, qsz, &q->pstart, 236 q->vstart = dma_alloc_coherent(&hw->pdev->dev, qsz, &q->pstart,
237 GFP_KERNEL); 237 GFP_KERNEL);
238 if (!q->vstart) { 238 if (!q->vstart) {
239 csio_err(hw, 239 csio_err(hw,
240 "Failed to allocate DMA memory for " 240 "Failed to allocate DMA memory for "
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index 8a20411699d9..75e1273a44b3 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -1144,7 +1144,7 @@ static void ddp_clear_map(struct cxgbi_device *cdev, struct cxgbi_ppm *ppm,
1144} 1144}
1145 1145
1146static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, 1146static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,
1147 unsigned int tid, int pg_idx, bool reply) 1147 unsigned int tid, int pg_idx)
1148{ 1148{
1149 struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0, 1149 struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0,
1150 GFP_KERNEL); 1150 GFP_KERNEL);
@@ -1160,7 +1160,7 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,
1160 req = (struct cpl_set_tcb_field *)skb->head; 1160 req = (struct cpl_set_tcb_field *)skb->head;
1161 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); 1161 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
1162 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); 1162 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid));
1163 req->reply = V_NO_REPLY(reply ? 0 : 1); 1163 req->reply = V_NO_REPLY(1);
1164 req->cpu_idx = 0; 1164 req->cpu_idx = 0;
1165 req->word = htons(31); 1165 req->word = htons(31);
1166 req->mask = cpu_to_be64(0xF0000000); 1166 req->mask = cpu_to_be64(0xF0000000);
@@ -1177,11 +1177,10 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,
1177 * @tid: connection id 1177 * @tid: connection id
1178 * @hcrc: header digest enabled 1178 * @hcrc: header digest enabled
1179 * @dcrc: data digest enabled 1179 * @dcrc: data digest enabled
1180 * @reply: request reply from h/w
1181 * set up the iscsi digest settings for a connection identified by tid 1180 * set up the iscsi digest settings for a connection identified by tid
1182 */ 1181 */
1183static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid, 1182static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid,
1184 int hcrc, int dcrc, int reply) 1183 int hcrc, int dcrc)
1185{ 1184{
1186 struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0, 1185 struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0,
1187 GFP_KERNEL); 1186 GFP_KERNEL);
@@ -1197,7 +1196,7 @@ static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid,
1197 req = (struct cpl_set_tcb_field *)skb->head; 1196 req = (struct cpl_set_tcb_field *)skb->head;
1198 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); 1197 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
1199 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); 1198 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid));
1200 req->reply = V_NO_REPLY(reply ? 0 : 1); 1199 req->reply = V_NO_REPLY(1);
1201 req->cpu_idx = 0; 1200 req->cpu_idx = 0;
1202 req->word = htons(31); 1201 req->word = htons(31);
1203 req->mask = cpu_to_be64(0x0F000000); 1202 req->mask = cpu_to_be64(0x0F000000);
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 49f8028ac524..d26f50af00ea 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -1548,16 +1548,22 @@ static void do_set_tcb_rpl(struct cxgbi_device *cdev, struct sk_buff *skb)
1548 struct cxgbi_sock *csk; 1548 struct cxgbi_sock *csk;
1549 1549
1550 csk = lookup_tid(t, tid); 1550 csk = lookup_tid(t, tid);
1551 if (!csk) 1551 if (!csk) {
1552 pr_err("can't find conn. for tid %u.\n", tid); 1552 pr_err("can't find conn. for tid %u.\n", tid);
1553 return;
1554 }
1553 1555
1554 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, 1556 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
1555 "csk 0x%p,%u,%lx,%u, status 0x%x.\n", 1557 "csk 0x%p,%u,%lx,%u, status 0x%x.\n",
1556 csk, csk->state, csk->flags, csk->tid, rpl->status); 1558 csk, csk->state, csk->flags, csk->tid, rpl->status);
1557 1559
1558 if (rpl->status != CPL_ERR_NONE) 1560 if (rpl->status != CPL_ERR_NONE) {
1559 pr_err("csk 0x%p,%u, SET_TCB_RPL status %u.\n", 1561 pr_err("csk 0x%p,%u, SET_TCB_RPL status %u.\n",
1560 csk, tid, rpl->status); 1562 csk, tid, rpl->status);
1563 csk->err = -EINVAL;
1564 }
1565
1566 complete(&csk->cmpl);
1561 1567
1562 __kfree_skb(skb); 1568 __kfree_skb(skb);
1563} 1569}
@@ -1983,7 +1989,7 @@ static int ddp_set_map(struct cxgbi_ppm *ppm, struct cxgbi_sock *csk,
1983} 1989}
1984 1990
1985static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, unsigned int tid, 1991static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, unsigned int tid,
1986 int pg_idx, bool reply) 1992 int pg_idx)
1987{ 1993{
1988 struct sk_buff *skb; 1994 struct sk_buff *skb;
1989 struct cpl_set_tcb_field *req; 1995 struct cpl_set_tcb_field *req;
@@ -1999,7 +2005,7 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, unsigned int tid,
1999 req = (struct cpl_set_tcb_field *)skb->head; 2005 req = (struct cpl_set_tcb_field *)skb->head;
2000 INIT_TP_WR(req, csk->tid); 2006 INIT_TP_WR(req, csk->tid);
2001 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, csk->tid)); 2007 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, csk->tid));
2002 req->reply_ctrl = htons(NO_REPLY_V(reply) | QUEUENO_V(csk->rss_qid)); 2008 req->reply_ctrl = htons(NO_REPLY_V(0) | QUEUENO_V(csk->rss_qid));
2003 req->word_cookie = htons(0); 2009 req->word_cookie = htons(0);
2004 req->mask = cpu_to_be64(0x3 << 8); 2010 req->mask = cpu_to_be64(0x3 << 8);
2005 req->val = cpu_to_be64(pg_idx << 8); 2011 req->val = cpu_to_be64(pg_idx << 8);
@@ -2008,12 +2014,15 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, unsigned int tid,
2008 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, 2014 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
2009 "csk 0x%p, tid 0x%x, pg_idx %u.\n", csk, csk->tid, pg_idx); 2015 "csk 0x%p, tid 0x%x, pg_idx %u.\n", csk, csk->tid, pg_idx);
2010 2016
2017 reinit_completion(&csk->cmpl);
2011 cxgb4_ofld_send(csk->cdev->ports[csk->port_id], skb); 2018 cxgb4_ofld_send(csk->cdev->ports[csk->port_id], skb);
2012 return 0; 2019 wait_for_completion(&csk->cmpl);
2020
2021 return csk->err;
2013} 2022}
2014 2023
2015static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid, 2024static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid,
2016 int hcrc, int dcrc, int reply) 2025 int hcrc, int dcrc)
2017{ 2026{
2018 struct sk_buff *skb; 2027 struct sk_buff *skb;
2019 struct cpl_set_tcb_field *req; 2028 struct cpl_set_tcb_field *req;
@@ -2031,7 +2040,7 @@ static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid,
2031 req = (struct cpl_set_tcb_field *)skb->head; 2040 req = (struct cpl_set_tcb_field *)skb->head;
2032 INIT_TP_WR(req, tid); 2041 INIT_TP_WR(req, tid);
2033 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); 2042 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid));
2034 req->reply_ctrl = htons(NO_REPLY_V(reply) | QUEUENO_V(csk->rss_qid)); 2043 req->reply_ctrl = htons(NO_REPLY_V(0) | QUEUENO_V(csk->rss_qid));
2035 req->word_cookie = htons(0); 2044 req->word_cookie = htons(0);
2036 req->mask = cpu_to_be64(0x3 << 4); 2045 req->mask = cpu_to_be64(0x3 << 4);
2037 req->val = cpu_to_be64(((hcrc ? ULP_CRC_HEADER : 0) | 2046 req->val = cpu_to_be64(((hcrc ? ULP_CRC_HEADER : 0) |
@@ -2041,8 +2050,11 @@ static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid,
2041 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, 2050 log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
2042 "csk 0x%p, tid 0x%x, crc %d,%d.\n", csk, csk->tid, hcrc, dcrc); 2051 "csk 0x%p, tid 0x%x, crc %d,%d.\n", csk, csk->tid, hcrc, dcrc);
2043 2052
2053 reinit_completion(&csk->cmpl);
2044 cxgb4_ofld_send(csk->cdev->ports[csk->port_id], skb); 2054 cxgb4_ofld_send(csk->cdev->ports[csk->port_id], skb);
2045 return 0; 2055 wait_for_completion(&csk->cmpl);
2056
2057 return csk->err;
2046} 2058}
2047 2059
2048static struct cxgbi_ppm *cdev2ppm(struct cxgbi_device *cdev) 2060static struct cxgbi_ppm *cdev2ppm(struct cxgbi_device *cdev)
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 75f876409fb9..245742557c03 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -573,6 +573,7 @@ static struct cxgbi_sock *cxgbi_sock_create(struct cxgbi_device *cdev)
573 skb_queue_head_init(&csk->receive_queue); 573 skb_queue_head_init(&csk->receive_queue);
574 skb_queue_head_init(&csk->write_queue); 574 skb_queue_head_init(&csk->write_queue);
575 timer_setup(&csk->retry_timer, NULL, 0); 575 timer_setup(&csk->retry_timer, NULL, 0);
576 init_completion(&csk->cmpl);
576 rwlock_init(&csk->callback_lock); 577 rwlock_init(&csk->callback_lock);
577 csk->cdev = cdev; 578 csk->cdev = cdev;
578 csk->flags = 0; 579 csk->flags = 0;
@@ -2251,14 +2252,14 @@ int cxgbi_set_conn_param(struct iscsi_cls_conn *cls_conn,
2251 if (!err && conn->hdrdgst_en) 2252 if (!err && conn->hdrdgst_en)
2252 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, 2253 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid,
2253 conn->hdrdgst_en, 2254 conn->hdrdgst_en,
2254 conn->datadgst_en, 0); 2255 conn->datadgst_en);
2255 break; 2256 break;
2256 case ISCSI_PARAM_DATADGST_EN: 2257 case ISCSI_PARAM_DATADGST_EN:
2257 err = iscsi_set_param(cls_conn, param, buf, buflen); 2258 err = iscsi_set_param(cls_conn, param, buf, buflen);
2258 if (!err && conn->datadgst_en) 2259 if (!err && conn->datadgst_en)
2259 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, 2260 err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid,
2260 conn->hdrdgst_en, 2261 conn->hdrdgst_en,
2261 conn->datadgst_en, 0); 2262 conn->datadgst_en);
2262 break; 2263 break;
2263 case ISCSI_PARAM_MAX_R2T: 2264 case ISCSI_PARAM_MAX_R2T:
2264 return iscsi_tcp_set_max_r2t(conn, buf); 2265 return iscsi_tcp_set_max_r2t(conn, buf);
@@ -2384,7 +2385,7 @@ int cxgbi_bind_conn(struct iscsi_cls_session *cls_session,
2384 2385
2385 ppm = csk->cdev->cdev2ppm(csk->cdev); 2386 ppm = csk->cdev->cdev2ppm(csk->cdev);
2386 err = csk->cdev->csk_ddp_setup_pgidx(csk, csk->tid, 2387 err = csk->cdev->csk_ddp_setup_pgidx(csk, csk->tid,
2387 ppm->tformat.pgsz_idx_dflt, 0); 2388 ppm->tformat.pgsz_idx_dflt);
2388 if (err < 0) 2389 if (err < 0)
2389 return err; 2390 return err;
2390 2391
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h
index 5d5d8b50d842..1917ff57651d 100644
--- a/drivers/scsi/cxgbi/libcxgbi.h
+++ b/drivers/scsi/cxgbi/libcxgbi.h
@@ -149,6 +149,7 @@ struct cxgbi_sock {
149 struct sk_buff_head receive_queue; 149 struct sk_buff_head receive_queue;
150 struct sk_buff_head write_queue; 150 struct sk_buff_head write_queue;
151 struct timer_list retry_timer; 151 struct timer_list retry_timer;
152 struct completion cmpl;
152 int err; 153 int err;
153 rwlock_t callback_lock; 154 rwlock_t callback_lock;
154 void *user_data; 155 void *user_data;
@@ -490,9 +491,9 @@ struct cxgbi_device {
490 struct cxgbi_ppm *, 491 struct cxgbi_ppm *,
491 struct cxgbi_task_tag_info *); 492 struct cxgbi_task_tag_info *);
492 int (*csk_ddp_setup_digest)(struct cxgbi_sock *, 493 int (*csk_ddp_setup_digest)(struct cxgbi_sock *,
493 unsigned int, int, int, int); 494 unsigned int, int, int);
494 int (*csk_ddp_setup_pgidx)(struct cxgbi_sock *, 495 int (*csk_ddp_setup_pgidx)(struct cxgbi_sock *,
495 unsigned int, int, bool); 496 unsigned int, int);
496 497
497 void (*csk_release_offload_resources)(struct cxgbi_sock *); 498 void (*csk_release_offload_resources)(struct cxgbi_sock *);
498 int (*csk_rx_pdu_ready)(struct cxgbi_sock *, struct sk_buff *); 499 int (*csk_rx_pdu_ready)(struct cxgbi_sock *, struct sk_buff *);
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index bfa13e3b191c..c8bad2c093b8 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -3687,6 +3687,7 @@ static int cxlflash_probe(struct pci_dev *pdev,
3687 host->max_cmd_len = CXLFLASH_MAX_CDB_LEN; 3687 host->max_cmd_len = CXLFLASH_MAX_CDB_LEN;
3688 3688
3689 cfg = shost_priv(host); 3689 cfg = shost_priv(host);
3690 cfg->state = STATE_PROBING;
3690 cfg->host = host; 3691 cfg->host = host;
3691 rc = alloc_mem(cfg); 3692 rc = alloc_mem(cfg);
3692 if (rc) { 3693 if (rc) {
@@ -3775,6 +3776,7 @@ out:
3775 return rc; 3776 return rc;
3776 3777
3777out_remove: 3778out_remove:
3779 cfg->state = STATE_PROBED;
3778 cxlflash_remove(pdev); 3780 cxlflash_remove(pdev);
3779 goto out; 3781 goto out;
3780} 3782}
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index e2420a810e99..c92b3822c408 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -2507,6 +2507,12 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2507 sha->sas_port[i] = &hisi_hba->port[i].sas_port; 2507 sha->sas_port[i] = &hisi_hba->port[i].sas_port;
2508 } 2508 }
2509 2509
2510 if (hisi_hba->prot_mask) {
2511 dev_info(dev, "Registering for DIF/DIX prot_mask=0x%x\n",
2512 prot_mask);
2513 scsi_host_set_prot(hisi_hba->shost, prot_mask);
2514 }
2515
2510 rc = scsi_add_host(shost, dev); 2516 rc = scsi_add_host(shost, dev);
2511 if (rc) 2517 if (rc)
2512 goto err_out_ha; 2518 goto err_out_ha;
@@ -2519,12 +2525,6 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2519 if (rc) 2525 if (rc)
2520 goto err_out_register_ha; 2526 goto err_out_register_ha;
2521 2527
2522 if (hisi_hba->prot_mask) {
2523 dev_info(dev, "Registering for DIF/DIX prot_mask=0x%x\n",
2524 prot_mask);
2525 scsi_host_set_prot(hisi_hba->shost, prot_mask);
2526 }
2527
2528 scsi_scan_host(shost); 2528 scsi_scan_host(shost);
2529 2529
2530 return 0; 2530 return 0;
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 68b90c4f79a3..1727d0c71b12 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -576,6 +576,13 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id)
576 shost->max_lun = ~0; 576 shost->max_lun = ~0;
577 shost->max_cmd_len = MAX_COMMAND_SIZE; 577 shost->max_cmd_len = MAX_COMMAND_SIZE;
578 578
579 /* turn on DIF support */
580 scsi_host_set_prot(shost,
581 SHOST_DIF_TYPE1_PROTECTION |
582 SHOST_DIF_TYPE2_PROTECTION |
583 SHOST_DIF_TYPE3_PROTECTION);
584 scsi_host_set_guard(shost, SHOST_DIX_GUARD_CRC);
585
579 err = scsi_add_host(shost, &pdev->dev); 586 err = scsi_add_host(shost, &pdev->dev);
580 if (err) 587 if (err)
581 goto err_shost; 588 goto err_shost;
@@ -663,13 +670,6 @@ static int isci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
663 goto err_host_alloc; 670 goto err_host_alloc;
664 } 671 }
665 pci_info->hosts[i] = h; 672 pci_info->hosts[i] = h;
666
667 /* turn on DIF support */
668 scsi_host_set_prot(to_shost(h),
669 SHOST_DIF_TYPE1_PROTECTION |
670 SHOST_DIF_TYPE2_PROTECTION |
671 SHOST_DIF_TYPE3_PROTECTION);
672 scsi_host_set_guard(to_shost(h), SHOST_DIX_GUARD_CRC);
673 } 673 }
674 674
675 err = isci_setup_interrupts(pdev); 675 err = isci_setup_interrupts(pdev);
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index be83590ed955..ff943f477d6f 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1726,14 +1726,14 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
1726 fc_frame_payload_op(fp) != ELS_LS_ACC) { 1726 fc_frame_payload_op(fp) != ELS_LS_ACC) {
1727 FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n"); 1727 FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n");
1728 fc_lport_error(lport, fp); 1728 fc_lport_error(lport, fp);
1729 goto err; 1729 goto out;
1730 } 1730 }
1731 1731
1732 flp = fc_frame_payload_get(fp, sizeof(*flp)); 1732 flp = fc_frame_payload_get(fp, sizeof(*flp));
1733 if (!flp) { 1733 if (!flp) {
1734 FC_LPORT_DBG(lport, "FLOGI bad response\n"); 1734 FC_LPORT_DBG(lport, "FLOGI bad response\n");
1735 fc_lport_error(lport, fp); 1735 fc_lport_error(lport, fp);
1736 goto err; 1736 goto out;
1737 } 1737 }
1738 1738
1739 mfs = ntohs(flp->fl_csp.sp_bb_data) & 1739 mfs = ntohs(flp->fl_csp.sp_bb_data) &
@@ -1743,7 +1743,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
1743 FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " 1743 FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, "
1744 "lport->mfs:%hu\n", mfs, lport->mfs); 1744 "lport->mfs:%hu\n", mfs, lport->mfs);
1745 fc_lport_error(lport, fp); 1745 fc_lport_error(lport, fp);
1746 goto err; 1746 goto out;
1747 } 1747 }
1748 1748
1749 if (mfs <= lport->mfs) { 1749 if (mfs <= lport->mfs) {
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 9192a1d9dec6..dfba4921b265 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -184,7 +184,6 @@ void fc_rport_destroy(struct kref *kref)
184 struct fc_rport_priv *rdata; 184 struct fc_rport_priv *rdata;
185 185
186 rdata = container_of(kref, struct fc_rport_priv, kref); 186 rdata = container_of(kref, struct fc_rport_priv, kref);
187 WARN_ON(!list_empty(&rdata->peers));
188 kfree_rcu(rdata, rcu); 187 kfree_rcu(rdata, rcu);
189} 188}
190EXPORT_SYMBOL(fc_rport_destroy); 189EXPORT_SYMBOL(fc_rport_destroy);
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index b8d325ce8754..120fc520f27a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1459,7 +1459,13 @@ static int iscsi_xmit_task(struct iscsi_conn *conn)
1459 if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) 1459 if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx))
1460 return -ENODATA; 1460 return -ENODATA;
1461 1461
1462 spin_lock_bh(&conn->session->back_lock);
1463 if (conn->task == NULL) {
1464 spin_unlock_bh(&conn->session->back_lock);
1465 return -ENODATA;
1466 }
1462 __iscsi_get_task(task); 1467 __iscsi_get_task(task);
1468 spin_unlock_bh(&conn->session->back_lock);
1463 spin_unlock_bh(&conn->session->frwd_lock); 1469 spin_unlock_bh(&conn->session->frwd_lock);
1464 rc = conn->session->tt->xmit_task(task); 1470 rc = conn->session->tt->xmit_task(task);
1465 spin_lock_bh(&conn->session->frwd_lock); 1471 spin_lock_bh(&conn->session->frwd_lock);
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 17eb4185f29d..f21c93bbb35c 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -828,6 +828,7 @@ static struct domain_device *sas_ex_discover_end_dev(
828 rphy = sas_end_device_alloc(phy->port); 828 rphy = sas_end_device_alloc(phy->port);
829 if (!rphy) 829 if (!rphy)
830 goto out_free; 830 goto out_free;
831 rphy->identify.phy_identifier = phy_id;
831 832
832 child->rphy = rphy; 833 child->rphy = rphy;
833 get_device(&rphy->dev); 834 get_device(&rphy->dev);
@@ -854,6 +855,7 @@ static struct domain_device *sas_ex_discover_end_dev(
854 855
855 child->rphy = rphy; 856 child->rphy = rphy;
856 get_device(&rphy->dev); 857 get_device(&rphy->dev);
858 rphy->identify.phy_identifier = phy_id;
857 sas_fill_in_rphy(child, rphy); 859 sas_fill_in_rphy(child, rphy);
858 860
859 list_add_tail(&child->disco_list_node, &parent->port->disco_list); 861 list_add_tail(&child->disco_list_node, &parent->port->disco_list);
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 8698af86485d..2dc564e59430 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -2730,8 +2730,8 @@ lpfc_bsg_dma_page_alloc(struct lpfc_hba *phba)
2730 INIT_LIST_HEAD(&dmabuf->list); 2730 INIT_LIST_HEAD(&dmabuf->list);
2731 2731
2732 /* now, allocate dma buffer */ 2732 /* now, allocate dma buffer */
2733 dmabuf->virt = dma_zalloc_coherent(&pcidev->dev, BSG_MBOX_SIZE, 2733 dmabuf->virt = dma_alloc_coherent(&pcidev->dev, BSG_MBOX_SIZE,
2734 &(dmabuf->phys), GFP_KERNEL); 2734 &(dmabuf->phys), GFP_KERNEL);
2735 2735
2736 if (!dmabuf->virt) { 2736 if (!dmabuf->virt) {
2737 kfree(dmabuf); 2737 kfree(dmabuf);
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index c1c36812c3d2..bede11e16349 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -6973,9 +6973,9 @@ lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba)
6973 if (!dmabuf) 6973 if (!dmabuf)
6974 return NULL; 6974 return NULL;
6975 6975
6976 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, 6976 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev,
6977 LPFC_HDR_TEMPLATE_SIZE, 6977 LPFC_HDR_TEMPLATE_SIZE,
6978 &dmabuf->phys, GFP_KERNEL); 6978 &dmabuf->phys, GFP_KERNEL);
6979 if (!dmabuf->virt) { 6979 if (!dmabuf->virt) {
6980 rpi_hdr = NULL; 6980 rpi_hdr = NULL;
6981 goto err_free_dmabuf; 6981 goto err_free_dmabuf;
@@ -7397,8 +7397,8 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)
7397 } 7397 }
7398 7398
7399 /* Allocate memory for SLI-2 structures */ 7399 /* Allocate memory for SLI-2 structures */
7400 phba->slim2p.virt = dma_zalloc_coherent(&pdev->dev, SLI2_SLIM_SIZE, 7400 phba->slim2p.virt = dma_alloc_coherent(&pdev->dev, SLI2_SLIM_SIZE,
7401 &phba->slim2p.phys, GFP_KERNEL); 7401 &phba->slim2p.phys, GFP_KERNEL);
7402 if (!phba->slim2p.virt) 7402 if (!phba->slim2p.virt)
7403 goto out_iounmap; 7403 goto out_iounmap;
7404 7404
@@ -7816,8 +7816,8 @@ lpfc_create_bootstrap_mbox(struct lpfc_hba *phba)
7816 * plus an alignment restriction of 16 bytes. 7816 * plus an alignment restriction of 16 bytes.
7817 */ 7817 */
7818 bmbx_size = sizeof(struct lpfc_bmbx_create) + (LPFC_ALIGN_16_BYTE - 1); 7818 bmbx_size = sizeof(struct lpfc_bmbx_create) + (LPFC_ALIGN_16_BYTE - 1);
7819 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, bmbx_size, 7819 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, bmbx_size,
7820 &dmabuf->phys, GFP_KERNEL); 7820 &dmabuf->phys, GFP_KERNEL);
7821 if (!dmabuf->virt) { 7821 if (!dmabuf->virt) {
7822 kfree(dmabuf); 7822 kfree(dmabuf);
7823 return -ENOMEM; 7823 return -ENOMEM;
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index f6a5083a621e..4d3b94317515 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -1827,9 +1827,9 @@ lpfc_sli4_config(struct lpfc_hba *phba, struct lpfcMboxq *mbox,
1827 * page, this is used as a priori size of SLI4_PAGE_SIZE for 1827 * page, this is used as a priori size of SLI4_PAGE_SIZE for
1828 * the later DMA memory free. 1828 * the later DMA memory free.
1829 */ 1829 */
1830 viraddr = dma_zalloc_coherent(&phba->pcidev->dev, 1830 viraddr = dma_alloc_coherent(&phba->pcidev->dev,
1831 SLI4_PAGE_SIZE, &phyaddr, 1831 SLI4_PAGE_SIZE, &phyaddr,
1832 GFP_KERNEL); 1832 GFP_KERNEL);
1833 /* In case of malloc fails, proceed with whatever we have */ 1833 /* In case of malloc fails, proceed with whatever we have */
1834 if (!viraddr) 1834 if (!viraddr)
1835 break; 1835 break;
diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
index 4c66b19e6199..8c9f79042228 100644
--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -297,7 +297,8 @@ lpfc_nvme_localport_delete(struct nvme_fc_local_port *localport)
297 lport); 297 lport);
298 298
299 /* release any threads waiting for the unreg to complete */ 299 /* release any threads waiting for the unreg to complete */
300 complete(&lport->lport_unreg_done); 300 if (lport->vport->localport)
301 complete(lport->lport_unreg_cmp);
301} 302}
302 303
303/* lpfc_nvme_remoteport_delete 304/* lpfc_nvme_remoteport_delete
@@ -2545,7 +2546,8 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport)
2545 */ 2546 */
2546void 2547void
2547lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, 2548lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport,
2548 struct lpfc_nvme_lport *lport) 2549 struct lpfc_nvme_lport *lport,
2550 struct completion *lport_unreg_cmp)
2549{ 2551{
2550#if (IS_ENABLED(CONFIG_NVME_FC)) 2552#if (IS_ENABLED(CONFIG_NVME_FC))
2551 u32 wait_tmo; 2553 u32 wait_tmo;
@@ -2557,8 +2559,7 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport,
2557 */ 2559 */
2558 wait_tmo = msecs_to_jiffies(LPFC_NVME_WAIT_TMO * 1000); 2560 wait_tmo = msecs_to_jiffies(LPFC_NVME_WAIT_TMO * 1000);
2559 while (true) { 2561 while (true) {
2560 ret = wait_for_completion_timeout(&lport->lport_unreg_done, 2562 ret = wait_for_completion_timeout(lport_unreg_cmp, wait_tmo);
2561 wait_tmo);
2562 if (unlikely(!ret)) { 2563 if (unlikely(!ret)) {
2563 lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_IOERR, 2564 lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_IOERR,
2564 "6176 Lport %p Localport %p wait " 2565 "6176 Lport %p Localport %p wait "
@@ -2592,12 +2593,12 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport)
2592 struct lpfc_nvme_lport *lport; 2593 struct lpfc_nvme_lport *lport;
2593 struct lpfc_nvme_ctrl_stat *cstat; 2594 struct lpfc_nvme_ctrl_stat *cstat;
2594 int ret; 2595 int ret;
2596 DECLARE_COMPLETION_ONSTACK(lport_unreg_cmp);
2595 2597
2596 if (vport->nvmei_support == 0) 2598 if (vport->nvmei_support == 0)
2597 return; 2599 return;
2598 2600
2599 localport = vport->localport; 2601 localport = vport->localport;
2600 vport->localport = NULL;
2601 lport = (struct lpfc_nvme_lport *)localport->private; 2602 lport = (struct lpfc_nvme_lport *)localport->private;
2602 cstat = lport->cstat; 2603 cstat = lport->cstat;
2603 2604
@@ -2608,13 +2609,14 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport)
2608 /* lport's rport list is clear. Unregister 2609 /* lport's rport list is clear. Unregister
2609 * lport and release resources. 2610 * lport and release resources.
2610 */ 2611 */
2611 init_completion(&lport->lport_unreg_done); 2612 lport->lport_unreg_cmp = &lport_unreg_cmp;
2612 ret = nvme_fc_unregister_localport(localport); 2613 ret = nvme_fc_unregister_localport(localport);
2613 2614
2614 /* Wait for completion. This either blocks 2615 /* Wait for completion. This either blocks
2615 * indefinitely or succeeds 2616 * indefinitely or succeeds
2616 */ 2617 */
2617 lpfc_nvme_lport_unreg_wait(vport, lport); 2618 lpfc_nvme_lport_unreg_wait(vport, lport, &lport_unreg_cmp);
2619 vport->localport = NULL;
2618 kfree(cstat); 2620 kfree(cstat);
2619 2621
2620 /* Regardless of the unregister upcall response, clear 2622 /* Regardless of the unregister upcall response, clear
diff --git a/drivers/scsi/lpfc/lpfc_nvme.h b/drivers/scsi/lpfc/lpfc_nvme.h
index cfd4719be25c..b234d0298994 100644
--- a/drivers/scsi/lpfc/lpfc_nvme.h
+++ b/drivers/scsi/lpfc/lpfc_nvme.h
@@ -50,7 +50,7 @@ struct lpfc_nvme_ctrl_stat {
50/* Declare nvme-based local and remote port definitions. */ 50/* Declare nvme-based local and remote port definitions. */
51struct lpfc_nvme_lport { 51struct lpfc_nvme_lport {
52 struct lpfc_vport *vport; 52 struct lpfc_vport *vport;
53 struct completion lport_unreg_done; 53 struct completion *lport_unreg_cmp;
54 /* Add stats counters here */ 54 /* Add stats counters here */
55 struct lpfc_nvme_ctrl_stat *cstat; 55 struct lpfc_nvme_ctrl_stat *cstat;
56 atomic_t fc4NvmeLsRequests; 56 atomic_t fc4NvmeLsRequests;
diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c
index 6245f442d784..95fee83090eb 100644
--- a/drivers/scsi/lpfc/lpfc_nvmet.c
+++ b/drivers/scsi/lpfc/lpfc_nvmet.c
@@ -1003,7 +1003,8 @@ lpfc_nvmet_targetport_delete(struct nvmet_fc_target_port *targetport)
1003 struct lpfc_nvmet_tgtport *tport = targetport->private; 1003 struct lpfc_nvmet_tgtport *tport = targetport->private;
1004 1004
1005 /* release any threads waiting for the unreg to complete */ 1005 /* release any threads waiting for the unreg to complete */
1006 complete(&tport->tport_unreg_done); 1006 if (tport->phba->targetport)
1007 complete(tport->tport_unreg_cmp);
1007} 1008}
1008 1009
1009static void 1010static void
@@ -1692,6 +1693,7 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba)
1692 struct lpfc_nvmet_tgtport *tgtp; 1693 struct lpfc_nvmet_tgtport *tgtp;
1693 struct lpfc_queue *wq; 1694 struct lpfc_queue *wq;
1694 uint32_t qidx; 1695 uint32_t qidx;
1696 DECLARE_COMPLETION_ONSTACK(tport_unreg_cmp);
1695 1697
1696 if (phba->nvmet_support == 0) 1698 if (phba->nvmet_support == 0)
1697 return; 1699 return;
@@ -1701,9 +1703,9 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba)
1701 wq = phba->sli4_hba.nvme_wq[qidx]; 1703 wq = phba->sli4_hba.nvme_wq[qidx];
1702 lpfc_nvmet_wqfull_flush(phba, wq, NULL); 1704 lpfc_nvmet_wqfull_flush(phba, wq, NULL);
1703 } 1705 }
1704 init_completion(&tgtp->tport_unreg_done); 1706 tgtp->tport_unreg_cmp = &tport_unreg_cmp;
1705 nvmet_fc_unregister_targetport(phba->targetport); 1707 nvmet_fc_unregister_targetport(phba->targetport);
1706 wait_for_completion_timeout(&tgtp->tport_unreg_done, 5); 1708 wait_for_completion_timeout(&tport_unreg_cmp, 5);
1707 lpfc_nvmet_cleanup_io_context(phba); 1709 lpfc_nvmet_cleanup_io_context(phba);
1708 } 1710 }
1709 phba->targetport = NULL; 1711 phba->targetport = NULL;
diff --git a/drivers/scsi/lpfc/lpfc_nvmet.h b/drivers/scsi/lpfc/lpfc_nvmet.h
index 1aaff63f1f41..0ec1082ce7ef 100644
--- a/drivers/scsi/lpfc/lpfc_nvmet.h
+++ b/drivers/scsi/lpfc/lpfc_nvmet.h
@@ -34,7 +34,7 @@
34/* Used for NVME Target */ 34/* Used for NVME Target */
35struct lpfc_nvmet_tgtport { 35struct lpfc_nvmet_tgtport {
36 struct lpfc_hba *phba; 36 struct lpfc_hba *phba;
37 struct completion tport_unreg_done; 37 struct completion *tport_unreg_cmp;
38 38
39 /* Stats counters - lpfc_nvmet_unsol_ls_buffer */ 39 /* Stats counters - lpfc_nvmet_unsol_ls_buffer */
40 atomic_t rcv_ls_req_in; 40 atomic_t rcv_ls_req_in;
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 30734caf77e1..2242e9b3ca12 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -5362,8 +5362,8 @@ lpfc_sli4_read_rev(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq,
5362 * mailbox command. 5362 * mailbox command.
5363 */ 5363 */
5364 dma_size = *vpd_size; 5364 dma_size = *vpd_size;
5365 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, dma_size, 5365 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, dma_size,
5366 &dmabuf->phys, GFP_KERNEL); 5366 &dmabuf->phys, GFP_KERNEL);
5367 if (!dmabuf->virt) { 5367 if (!dmabuf->virt) {
5368 kfree(dmabuf); 5368 kfree(dmabuf);
5369 return -ENOMEM; 5369 return -ENOMEM;
@@ -6300,10 +6300,9 @@ lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba,
6300 goto free_mem; 6300 goto free_mem;
6301 } 6301 }
6302 6302
6303 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, 6303 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev,
6304 LPFC_RAS_MAX_ENTRY_SIZE, 6304 LPFC_RAS_MAX_ENTRY_SIZE,
6305 &dmabuf->phys, 6305 &dmabuf->phys, GFP_KERNEL);
6306 GFP_KERNEL);
6307 if (!dmabuf->virt) { 6306 if (!dmabuf->virt) {
6308 kfree(dmabuf); 6307 kfree(dmabuf);
6309 rc = -ENOMEM; 6308 rc = -ENOMEM;
@@ -9408,6 +9407,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
9408 cmnd = CMD_XMIT_SEQUENCE64_CR; 9407 cmnd = CMD_XMIT_SEQUENCE64_CR;
9409 if (phba->link_flag & LS_LOOPBACK_MODE) 9408 if (phba->link_flag & LS_LOOPBACK_MODE)
9410 bf_set(wqe_xo, &wqe->xmit_sequence.wge_ctl, 1); 9409 bf_set(wqe_xo, &wqe->xmit_sequence.wge_ctl, 1);
9410 /* fall through */
9411 case CMD_XMIT_SEQUENCE64_CR: 9411 case CMD_XMIT_SEQUENCE64_CR:
9412 /* word3 iocb=io_tag32 wqe=reserved */ 9412 /* word3 iocb=io_tag32 wqe=reserved */
9413 wqe->xmit_sequence.rsvd3 = 0; 9413 wqe->xmit_sequence.rsvd3 = 0;
@@ -13529,6 +13529,7 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
13529 case FC_STATUS_RQ_BUF_LEN_EXCEEDED: 13529 case FC_STATUS_RQ_BUF_LEN_EXCEEDED:
13530 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 13530 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
13531 "2537 Receive Frame Truncated!!\n"); 13531 "2537 Receive Frame Truncated!!\n");
13532 /* fall through */
13532 case FC_STATUS_RQ_SUCCESS: 13533 case FC_STATUS_RQ_SUCCESS:
13533 spin_lock_irqsave(&phba->hbalock, iflags); 13534 spin_lock_irqsave(&phba->hbalock, iflags);
13534 lpfc_sli4_rq_release(hrq, drq); 13535 lpfc_sli4_rq_release(hrq, drq);
@@ -13938,7 +13939,7 @@ lpfc_sli4_nvmet_handle_rcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
13938 case FC_STATUS_RQ_BUF_LEN_EXCEEDED: 13939 case FC_STATUS_RQ_BUF_LEN_EXCEEDED:
13939 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 13940 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
13940 "6126 Receive Frame Truncated!!\n"); 13941 "6126 Receive Frame Truncated!!\n");
13941 /* Drop thru */ 13942 /* fall through */
13942 case FC_STATUS_RQ_SUCCESS: 13943 case FC_STATUS_RQ_SUCCESS:
13943 spin_lock_irqsave(&phba->hbalock, iflags); 13944 spin_lock_irqsave(&phba->hbalock, iflags);
13944 lpfc_sli4_rq_release(hrq, drq); 13945 lpfc_sli4_rq_release(hrq, drq);
@@ -14613,9 +14614,9 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32_t page_size,
14613 dmabuf = kzalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL); 14614 dmabuf = kzalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
14614 if (!dmabuf) 14615 if (!dmabuf)
14615 goto out_fail; 14616 goto out_fail;
14616 dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, 14617 dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev,
14617 hw_page_size, &dmabuf->phys, 14618 hw_page_size, &dmabuf->phys,
14618 GFP_KERNEL); 14619 GFP_KERNEL);
14619 if (!dmabuf->virt) { 14620 if (!dmabuf->virt) {
14620 kfree(dmabuf); 14621 kfree(dmabuf);
14621 goto out_fail; 14622 goto out_fail;
@@ -14850,7 +14851,7 @@ lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax)
14850 eq->entry_count); 14851 eq->entry_count);
14851 if (eq->entry_count < 256) 14852 if (eq->entry_count < 256)
14852 return -EINVAL; 14853 return -EINVAL;
14853 /* otherwise default to smallest count (drop through) */ 14854 /* fall through - otherwise default to smallest count */
14854 case 256: 14855 case 256:
14855 bf_set(lpfc_eq_context_count, &eq_create->u.request.context, 14856 bf_set(lpfc_eq_context_count, &eq_create->u.request.context,
14856 LPFC_EQ_CNT_256); 14857 LPFC_EQ_CNT_256);
@@ -14981,7 +14982,7 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq,
14981 LPFC_CQ_CNT_WORD7); 14982 LPFC_CQ_CNT_WORD7);
14982 break; 14983 break;
14983 } 14984 }
14984 /* Fall Thru */ 14985 /* fall through */
14985 default: 14986 default:
14986 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 14987 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
14987 "0361 Unsupported CQ count: " 14988 "0361 Unsupported CQ count: "
@@ -14992,7 +14993,7 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq,
14992 status = -EINVAL; 14993 status = -EINVAL;
14993 goto out; 14994 goto out;
14994 } 14995 }
14995 /* otherwise default to smallest count (drop through) */ 14996 /* fall through - otherwise default to smallest count */
14996 case 256: 14997 case 256:
14997 bf_set(lpfc_cq_context_count, &cq_create->u.request.context, 14998 bf_set(lpfc_cq_context_count, &cq_create->u.request.context,
14998 LPFC_CQ_CNT_256); 14999 LPFC_CQ_CNT_256);
@@ -15152,7 +15153,7 @@ lpfc_cq_create_set(struct lpfc_hba *phba, struct lpfc_queue **cqp,
15152 LPFC_CQ_CNT_WORD7); 15153 LPFC_CQ_CNT_WORD7);
15153 break; 15154 break;
15154 } 15155 }
15155 /* Fall Thru */ 15156 /* fall through */
15156 default: 15157 default:
15157 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 15158 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
15158 "3118 Bad CQ count. (%d)\n", 15159 "3118 Bad CQ count. (%d)\n",
@@ -15161,7 +15162,7 @@ lpfc_cq_create_set(struct lpfc_hba *phba, struct lpfc_queue **cqp,
15161 status = -EINVAL; 15162 status = -EINVAL;
15162 goto out; 15163 goto out;
15163 } 15164 }
15164 /* otherwise default to smallest (drop thru) */ 15165 /* fall through - otherwise default to smallest */
15165 case 256: 15166 case 256:
15166 bf_set(lpfc_mbx_cq_create_set_cqe_cnt, 15167 bf_set(lpfc_mbx_cq_create_set_cqe_cnt,
15167 &cq_set->u.request, LPFC_CQ_CNT_256); 15168 &cq_set->u.request, LPFC_CQ_CNT_256);
@@ -15433,7 +15434,7 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq,
15433 status = -EINVAL; 15434 status = -EINVAL;
15434 goto out; 15435 goto out;
15435 } 15436 }
15436 /* otherwise default to smallest count (drop through) */ 15437 /* fall through - otherwise default to smallest count */
15437 case 16: 15438 case 16:
15438 bf_set(lpfc_mq_context_ring_size, 15439 bf_set(lpfc_mq_context_ring_size,
15439 &mq_create_ext->u.request.context, 15440 &mq_create_ext->u.request.context,
@@ -15852,7 +15853,7 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
15852 status = -EINVAL; 15853 status = -EINVAL;
15853 goto out; 15854 goto out;
15854 } 15855 }
15855 /* otherwise default to smallest count (drop through) */ 15856 /* fall through - otherwise default to smallest count */
15856 case 512: 15857 case 512:
15857 bf_set(lpfc_rq_context_rqe_count, 15858 bf_set(lpfc_rq_context_rqe_count,
15858 &rq_create->u.request.context, 15859 &rq_create->u.request.context,
@@ -15989,7 +15990,7 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq,
15989 status = -EINVAL; 15990 status = -EINVAL;
15990 goto out; 15991 goto out;
15991 } 15992 }
15992 /* otherwise default to smallest count (drop through) */ 15993 /* fall through - otherwise default to smallest count */
15993 case 512: 15994 case 512:
15994 bf_set(lpfc_rq_context_rqe_count, 15995 bf_set(lpfc_rq_context_rqe_count,
15995 &rq_create->u.request.context, 15996 &rq_create->u.request.context,
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index e836392b75e8..f112458023ff 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -967,9 +967,10 @@ megaraid_alloc_cmd_packets(adapter_t *adapter)
967 * Allocate the common 16-byte aligned memory for the handshake 967 * Allocate the common 16-byte aligned memory for the handshake
968 * mailbox. 968 * mailbox.
969 */ 969 */
970 raid_dev->una_mbox64 = dma_zalloc_coherent(&adapter->pdev->dev, 970 raid_dev->una_mbox64 = dma_alloc_coherent(&adapter->pdev->dev,
971 sizeof(mbox64_t), &raid_dev->una_mbox64_dma, 971 sizeof(mbox64_t),
972 GFP_KERNEL); 972 &raid_dev->una_mbox64_dma,
973 GFP_KERNEL);
973 974
974 if (!raid_dev->una_mbox64) { 975 if (!raid_dev->una_mbox64) {
975 con_log(CL_ANN, (KERN_WARNING 976 con_log(CL_ANN, (KERN_WARNING
@@ -995,8 +996,8 @@ megaraid_alloc_cmd_packets(adapter_t *adapter)
995 align; 996 align;
996 997
997 // Allocate memory for commands issued internally 998 // Allocate memory for commands issued internally
998 adapter->ibuf = dma_zalloc_coherent(&pdev->dev, MBOX_IBUF_SIZE, 999 adapter->ibuf = dma_alloc_coherent(&pdev->dev, MBOX_IBUF_SIZE,
999 &adapter->ibuf_dma_h, GFP_KERNEL); 1000 &adapter->ibuf_dma_h, GFP_KERNEL);
1000 if (!adapter->ibuf) { 1001 if (!adapter->ibuf) {
1001 1002
1002 con_log(CL_ANN, (KERN_WARNING 1003 con_log(CL_ANN, (KERN_WARNING
@@ -2897,8 +2898,8 @@ megaraid_mbox_product_info(adapter_t *adapter)
2897 * Issue an ENQUIRY3 command to find out certain adapter parameters, 2898 * Issue an ENQUIRY3 command to find out certain adapter parameters,
2898 * e.g., max channels, max commands etc. 2899 * e.g., max channels, max commands etc.
2899 */ 2900 */
2900 pinfo = dma_zalloc_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t), 2901 pinfo = dma_alloc_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t),
2901 &pinfo_dma_h, GFP_KERNEL); 2902 &pinfo_dma_h, GFP_KERNEL);
2902 if (pinfo == NULL) { 2903 if (pinfo == NULL) {
2903 con_log(CL_ANN, (KERN_WARNING 2904 con_log(CL_ANN, (KERN_WARNING
2904 "megaraid: out of memory, %s %d\n", __func__, 2905 "megaraid: out of memory, %s %d\n", __func__,
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index f7bdd783360a..fcbff83c0097 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -2273,9 +2273,9 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
2273 sizeof(struct MR_LD_VF_AFFILIATION_111)); 2273 sizeof(struct MR_LD_VF_AFFILIATION_111));
2274 else { 2274 else {
2275 new_affiliation_111 = 2275 new_affiliation_111 =
2276 dma_zalloc_coherent(&instance->pdev->dev, 2276 dma_alloc_coherent(&instance->pdev->dev,
2277 sizeof(struct MR_LD_VF_AFFILIATION_111), 2277 sizeof(struct MR_LD_VF_AFFILIATION_111),
2278 &new_affiliation_111_h, GFP_KERNEL); 2278 &new_affiliation_111_h, GFP_KERNEL);
2279 if (!new_affiliation_111) { 2279 if (!new_affiliation_111) {
2280 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate " 2280 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
2281 "memory for new affiliation for scsi%d\n", 2281 "memory for new affiliation for scsi%d\n",
@@ -2380,10 +2380,9 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
2380 sizeof(struct MR_LD_VF_AFFILIATION)); 2380 sizeof(struct MR_LD_VF_AFFILIATION));
2381 else { 2381 else {
2382 new_affiliation = 2382 new_affiliation =
2383 dma_zalloc_coherent(&instance->pdev->dev, 2383 dma_alloc_coherent(&instance->pdev->dev,
2384 (MAX_LOGICAL_DRIVES + 1) * 2384 (MAX_LOGICAL_DRIVES + 1) * sizeof(struct MR_LD_VF_AFFILIATION),
2385 sizeof(struct MR_LD_VF_AFFILIATION), 2385 &new_affiliation_h, GFP_KERNEL);
2386 &new_affiliation_h, GFP_KERNEL);
2387 if (!new_affiliation) { 2386 if (!new_affiliation) {
2388 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate " 2387 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
2389 "memory for new affiliation for scsi%d\n", 2388 "memory for new affiliation for scsi%d\n",
@@ -2546,9 +2545,10 @@ int megasas_sriov_start_heartbeat(struct megasas_instance *instance,
2546 2545
2547 if (initial) { 2546 if (initial) {
2548 instance->hb_host_mem = 2547 instance->hb_host_mem =
2549 dma_zalloc_coherent(&instance->pdev->dev, 2548 dma_alloc_coherent(&instance->pdev->dev,
2550 sizeof(struct MR_CTRL_HB_HOST_MEM), 2549 sizeof(struct MR_CTRL_HB_HOST_MEM),
2551 &instance->hb_host_mem_h, GFP_KERNEL); 2550 &instance->hb_host_mem_h,
2551 GFP_KERNEL);
2552 if (!instance->hb_host_mem) { 2552 if (!instance->hb_host_mem) {
2553 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate" 2553 dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate"
2554 " memory for heartbeat host memory for scsi%d\n", 2554 " memory for heartbeat host memory for scsi%d\n",
@@ -5816,9 +5816,9 @@ megasas_get_seq_num(struct megasas_instance *instance,
5816 } 5816 }
5817 5817
5818 dcmd = &cmd->frame->dcmd; 5818 dcmd = &cmd->frame->dcmd;
5819 el_info = dma_zalloc_coherent(&instance->pdev->dev, 5819 el_info = dma_alloc_coherent(&instance->pdev->dev,
5820 sizeof(struct megasas_evt_log_info), &el_info_h, 5820 sizeof(struct megasas_evt_log_info),
5821 GFP_KERNEL); 5821 &el_info_h, GFP_KERNEL);
5822 if (!el_info) { 5822 if (!el_info) {
5823 megasas_return_cmd(instance, cmd); 5823 megasas_return_cmd(instance, cmd);
5824 return -ENOMEM; 5824 return -ENOMEM;
@@ -6236,7 +6236,7 @@ megasas_set_dma_mask(struct megasas_instance *instance)
6236 instance->consistent_mask_64bit = true; 6236 instance->consistent_mask_64bit = true;
6237 6237
6238 dev_info(&pdev->dev, "%s bit DMA mask and %s bit consistent mask\n", 6238 dev_info(&pdev->dev, "%s bit DMA mask and %s bit consistent mask\n",
6239 ((*pdev->dev.dma_mask == DMA_BIT_MASK(64)) ? "63" : "32"), 6239 ((*pdev->dev.dma_mask == DMA_BIT_MASK(63)) ? "63" : "32"),
6240 (instance->consistent_mask_64bit ? "63" : "32")); 6240 (instance->consistent_mask_64bit ? "63" : "32"));
6241 6241
6242 return 0; 6242 return 0;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 211c17c33aa0..647f48a28f85 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -175,7 +175,8 @@ megasas_clear_intr_fusion(struct megasas_instance *instance)
175 /* 175 /*
176 * Check if it is our interrupt 176 * Check if it is our interrupt
177 */ 177 */
178 status = readl(&regs->outbound_intr_status); 178 status = megasas_readl(instance,
179 &regs->outbound_intr_status);
179 180
180 if (status & 1) { 181 if (status & 1) {
181 writel(status, &regs->outbound_intr_status); 182 writel(status, &regs->outbound_intr_status);
@@ -689,8 +690,9 @@ megasas_alloc_rdpq_fusion(struct megasas_instance *instance)
689 array_size = sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) * 690 array_size = sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) *
690 MAX_MSIX_QUEUES_FUSION; 691 MAX_MSIX_QUEUES_FUSION;
691 692
692 fusion->rdpq_virt = dma_zalloc_coherent(&instance->pdev->dev, 693 fusion->rdpq_virt = dma_alloc_coherent(&instance->pdev->dev,
693 array_size, &fusion->rdpq_phys, GFP_KERNEL); 694 array_size, &fusion->rdpq_phys,
695 GFP_KERNEL);
694 if (!fusion->rdpq_virt) { 696 if (!fusion->rdpq_virt) {
695 dev_err(&instance->pdev->dev, 697 dev_err(&instance->pdev->dev,
696 "Failed from %s %d\n", __func__, __LINE__); 698 "Failed from %s %d\n", __func__, __LINE__);
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index f3e182eb0970..c9dc7740e9e7 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -1915,8 +1915,9 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match)
1915 /* We use the PCI APIs for now until the generic one gets fixed 1915 /* We use the PCI APIs for now until the generic one gets fixed
1916 * enough or until we get some macio-specific versions 1916 * enough or until we get some macio-specific versions
1917 */ 1917 */
1918 dma_cmd_space = dma_zalloc_coherent(&macio_get_pci_dev(mdev)->dev, 1918 dma_cmd_space = dma_alloc_coherent(&macio_get_pci_dev(mdev)->dev,
1919 ms->dma_cmd_size, &dma_cmd_bus, GFP_KERNEL); 1919 ms->dma_cmd_size, &dma_cmd_bus,
1920 GFP_KERNEL);
1920 if (dma_cmd_space == NULL) { 1921 if (dma_cmd_space == NULL) {
1921 printk(KERN_ERR "mesh: can't allocate DMA table\n"); 1922 printk(KERN_ERR "mesh: can't allocate DMA table\n");
1922 goto out_unmap; 1923 goto out_unmap;
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index dbe753fba486..36f64205ecfa 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -143,8 +143,9 @@ static struct mvumi_res *mvumi_alloc_mem_resource(struct mvumi_hba *mhba,
143 143
144 case RESOURCE_UNCACHED_MEMORY: 144 case RESOURCE_UNCACHED_MEMORY:
145 size = round_up(size, 8); 145 size = round_up(size, 8);
146 res->virt_addr = dma_zalloc_coherent(&mhba->pdev->dev, size, 146 res->virt_addr = dma_alloc_coherent(&mhba->pdev->dev, size,
147 &res->bus_addr, GFP_KERNEL); 147 &res->bus_addr,
148 GFP_KERNEL);
148 if (!res->virt_addr) { 149 if (!res->virt_addr) {
149 dev_err(&mhba->pdev->dev, 150 dev_err(&mhba->pdev->dev,
150 "unable to allocate consistent mem," 151 "unable to allocate consistent mem,"
@@ -246,8 +247,8 @@ static int mvumi_internal_cmd_sgl(struct mvumi_hba *mhba, struct mvumi_cmd *cmd,
246 if (size == 0) 247 if (size == 0)
247 return 0; 248 return 0;
248 249
249 virt_addr = dma_zalloc_coherent(&mhba->pdev->dev, size, &phy_addr, 250 virt_addr = dma_alloc_coherent(&mhba->pdev->dev, size, &phy_addr,
250 GFP_KERNEL); 251 GFP_KERNEL);
251 if (!virt_addr) 252 if (!virt_addr)
252 return -1; 253 return -1;
253 254
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index b3be49d41375..084f2fcced0a 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -116,8 +116,8 @@ int pm8001_mem_alloc(struct pci_dev *pdev, void **virt_addr,
116 u64 align_offset = 0; 116 u64 align_offset = 0;
117 if (align) 117 if (align)
118 align_offset = (dma_addr_t)align - 1; 118 align_offset = (dma_addr_t)align - 1;
119 mem_virt_alloc = dma_zalloc_coherent(&pdev->dev, mem_size + align, 119 mem_virt_alloc = dma_alloc_coherent(&pdev->dev, mem_size + align,
120 &mem_dma_handle, GFP_KERNEL); 120 &mem_dma_handle, GFP_KERNEL);
121 if (!mem_virt_alloc) { 121 if (!mem_virt_alloc) {
122 pm8001_printk("memory allocation error\n"); 122 pm8001_printk("memory allocation error\n");
123 return -1; 123 return -1;
@@ -657,7 +657,7 @@ static int pm8001_dev_found_notify(struct domain_device *dev)
657 if (dev->dev_type == SAS_SATA_DEV) { 657 if (dev->dev_type == SAS_SATA_DEV) {
658 pm8001_device->attached_phy = 658 pm8001_device->attached_phy =
659 dev->rphy->identify.phy_identifier; 659 dev->rphy->identify.phy_identifier;
660 flag = 1; /* directly sata*/ 660 flag = 1; /* directly sata */
661 } 661 }
662 } /*register this device to HBA*/ 662 } /*register this device to HBA*/
663 PM8001_DISC_DBG(pm8001_ha, pm8001_printk("Found device\n")); 663 PM8001_DISC_DBG(pm8001_ha, pm8001_printk("Found device\n"));
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index edcaf4b0cb0b..9bbc19fc190b 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -1050,16 +1050,17 @@ static int qedf_alloc_sq(struct qedf_ctx *qedf, struct qedf_rport *fcport)
1050 sizeof(void *); 1050 sizeof(void *);
1051 fcport->sq_pbl_size = fcport->sq_pbl_size + QEDF_PAGE_SIZE; 1051 fcport->sq_pbl_size = fcport->sq_pbl_size + QEDF_PAGE_SIZE;
1052 1052
1053 fcport->sq = dma_zalloc_coherent(&qedf->pdev->dev, 1053 fcport->sq = dma_alloc_coherent(&qedf->pdev->dev, fcport->sq_mem_size,
1054 fcport->sq_mem_size, &fcport->sq_dma, GFP_KERNEL); 1054 &fcport->sq_dma, GFP_KERNEL);
1055 if (!fcport->sq) { 1055 if (!fcport->sq) {
1056 QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate send queue.\n"); 1056 QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate send queue.\n");
1057 rval = 1; 1057 rval = 1;
1058 goto out; 1058 goto out;
1059 } 1059 }
1060 1060
1061 fcport->sq_pbl = dma_zalloc_coherent(&qedf->pdev->dev, 1061 fcport->sq_pbl = dma_alloc_coherent(&qedf->pdev->dev,
1062 fcport->sq_pbl_size, &fcport->sq_pbl_dma, GFP_KERNEL); 1062 fcport->sq_pbl_size,
1063 &fcport->sq_pbl_dma, GFP_KERNEL);
1063 if (!fcport->sq_pbl) { 1064 if (!fcport->sq_pbl) {
1064 QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate send queue PBL.\n"); 1065 QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate send queue PBL.\n");
1065 rval = 1; 1066 rval = 1;
@@ -2680,8 +2681,10 @@ static int qedf_alloc_bdq(struct qedf_ctx *qedf)
2680 } 2681 }
2681 2682
2682 /* Allocate list of PBL pages */ 2683 /* Allocate list of PBL pages */
2683 qedf->bdq_pbl_list = dma_zalloc_coherent(&qedf->pdev->dev, 2684 qedf->bdq_pbl_list = dma_alloc_coherent(&qedf->pdev->dev,
2684 QEDF_PAGE_SIZE, &qedf->bdq_pbl_list_dma, GFP_KERNEL); 2685 QEDF_PAGE_SIZE,
2686 &qedf->bdq_pbl_list_dma,
2687 GFP_KERNEL);
2685 if (!qedf->bdq_pbl_list) { 2688 if (!qedf->bdq_pbl_list) {
2686 QEDF_ERR(&(qedf->dbg_ctx), "Could not allocate list of PBL pages.\n"); 2689 QEDF_ERR(&(qedf->dbg_ctx), "Could not allocate list of PBL pages.\n");
2687 return -ENOMEM; 2690 return -ENOMEM;
@@ -2770,9 +2773,10 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
2770 ALIGN(qedf->global_queues[i]->cq_pbl_size, QEDF_PAGE_SIZE); 2773 ALIGN(qedf->global_queues[i]->cq_pbl_size, QEDF_PAGE_SIZE);
2771 2774
2772 qedf->global_queues[i]->cq = 2775 qedf->global_queues[i]->cq =
2773 dma_zalloc_coherent(&qedf->pdev->dev, 2776 dma_alloc_coherent(&qedf->pdev->dev,
2774 qedf->global_queues[i]->cq_mem_size, 2777 qedf->global_queues[i]->cq_mem_size,
2775 &qedf->global_queues[i]->cq_dma, GFP_KERNEL); 2778 &qedf->global_queues[i]->cq_dma,
2779 GFP_KERNEL);
2776 2780
2777 if (!qedf->global_queues[i]->cq) { 2781 if (!qedf->global_queues[i]->cq) {
2778 QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate cq.\n"); 2782 QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate cq.\n");
@@ -2781,9 +2785,10 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
2781 } 2785 }
2782 2786
2783 qedf->global_queues[i]->cq_pbl = 2787 qedf->global_queues[i]->cq_pbl =
2784 dma_zalloc_coherent(&qedf->pdev->dev, 2788 dma_alloc_coherent(&qedf->pdev->dev,
2785 qedf->global_queues[i]->cq_pbl_size, 2789 qedf->global_queues[i]->cq_pbl_size,
2786 &qedf->global_queues[i]->cq_pbl_dma, GFP_KERNEL); 2790 &qedf->global_queues[i]->cq_pbl_dma,
2791 GFP_KERNEL);
2787 2792
2788 if (!qedf->global_queues[i]->cq_pbl) { 2793 if (!qedf->global_queues[i]->cq_pbl) {
2789 QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate cq PBL.\n"); 2794 QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate cq PBL.\n");
diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c
index 4da660c1c431..6d6d6013e35b 100644
--- a/drivers/scsi/qedi/qedi_iscsi.c
+++ b/drivers/scsi/qedi/qedi_iscsi.c
@@ -953,6 +953,7 @@ static int qedi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
953 953
954 qedi_ep = ep->dd_data; 954 qedi_ep = ep->dd_data;
955 if (qedi_ep->state == EP_STATE_IDLE || 955 if (qedi_ep->state == EP_STATE_IDLE ||
956 qedi_ep->state == EP_STATE_OFLDCONN_NONE ||
956 qedi_ep->state == EP_STATE_OFLDCONN_FAILED) 957 qedi_ep->state == EP_STATE_OFLDCONN_FAILED)
957 return -1; 958 return -1;
958 959
@@ -1035,6 +1036,7 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep)
1035 1036
1036 switch (qedi_ep->state) { 1037 switch (qedi_ep->state) {
1037 case EP_STATE_OFLDCONN_START: 1038 case EP_STATE_OFLDCONN_START:
1039 case EP_STATE_OFLDCONN_NONE:
1038 goto ep_release_conn; 1040 goto ep_release_conn;
1039 case EP_STATE_OFLDCONN_FAILED: 1041 case EP_STATE_OFLDCONN_FAILED:
1040 break; 1042 break;
@@ -1225,6 +1227,7 @@ static int qedi_set_path(struct Scsi_Host *shost, struct iscsi_path *path_data)
1225 1227
1226 if (!is_valid_ether_addr(&path_data->mac_addr[0])) { 1228 if (!is_valid_ether_addr(&path_data->mac_addr[0])) {
1227 QEDI_NOTICE(&qedi->dbg_ctx, "dst mac NOT VALID\n"); 1229 QEDI_NOTICE(&qedi->dbg_ctx, "dst mac NOT VALID\n");
1230 qedi_ep->state = EP_STATE_OFLDCONN_NONE;
1228 ret = -EIO; 1231 ret = -EIO;
1229 goto set_path_exit; 1232 goto set_path_exit;
1230 } 1233 }
diff --git a/drivers/scsi/qedi/qedi_iscsi.h b/drivers/scsi/qedi/qedi_iscsi.h
index 11260776212f..892d70d54553 100644
--- a/drivers/scsi/qedi/qedi_iscsi.h
+++ b/drivers/scsi/qedi/qedi_iscsi.h
@@ -59,6 +59,7 @@ enum {
59 EP_STATE_OFLDCONN_FAILED = 0x2000, 59 EP_STATE_OFLDCONN_FAILED = 0x2000,
60 EP_STATE_CONNECT_FAILED = 0x4000, 60 EP_STATE_CONNECT_FAILED = 0x4000,
61 EP_STATE_DISCONN_TIMEDOUT = 0x8000, 61 EP_STATE_DISCONN_TIMEDOUT = 0x8000,
62 EP_STATE_OFLDCONN_NONE = 0x10000,
62}; 63};
63 64
64struct qedi_conn; 65struct qedi_conn;
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 5c53409a8cea..e74a62448ba4 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -1394,10 +1394,9 @@ static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)
1394{ 1394{
1395 struct qedi_nvm_iscsi_image nvm_image; 1395 struct qedi_nvm_iscsi_image nvm_image;
1396 1396
1397 qedi->iscsi_image = dma_zalloc_coherent(&qedi->pdev->dev, 1397 qedi->iscsi_image = dma_alloc_coherent(&qedi->pdev->dev,
1398 sizeof(nvm_image), 1398 sizeof(nvm_image),
1399 &qedi->nvm_buf_dma, 1399 &qedi->nvm_buf_dma, GFP_KERNEL);
1400 GFP_KERNEL);
1401 if (!qedi->iscsi_image) { 1400 if (!qedi->iscsi_image) {
1402 QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n"); 1401 QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");
1403 return -ENOMEM; 1402 return -ENOMEM;
@@ -1510,10 +1509,10 @@ static int qedi_alloc_bdq(struct qedi_ctx *qedi)
1510 } 1509 }
1511 1510
1512 /* Allocate list of PBL pages */ 1511 /* Allocate list of PBL pages */
1513 qedi->bdq_pbl_list = dma_zalloc_coherent(&qedi->pdev->dev, 1512 qedi->bdq_pbl_list = dma_alloc_coherent(&qedi->pdev->dev,
1514 QEDI_PAGE_SIZE, 1513 QEDI_PAGE_SIZE,
1515 &qedi->bdq_pbl_list_dma, 1514 &qedi->bdq_pbl_list_dma,
1516 GFP_KERNEL); 1515 GFP_KERNEL);
1517 if (!qedi->bdq_pbl_list) { 1516 if (!qedi->bdq_pbl_list) {
1518 QEDI_ERR(&qedi->dbg_ctx, 1517 QEDI_ERR(&qedi->dbg_ctx,
1519 "Could not allocate list of PBL pages.\n"); 1518 "Could not allocate list of PBL pages.\n");
@@ -1609,10 +1608,10 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
1609 (qedi->global_queues[i]->cq_pbl_size + 1608 (qedi->global_queues[i]->cq_pbl_size +
1610 (QEDI_PAGE_SIZE - 1)); 1609 (QEDI_PAGE_SIZE - 1));
1611 1610
1612 qedi->global_queues[i]->cq = dma_zalloc_coherent(&qedi->pdev->dev, 1611 qedi->global_queues[i]->cq = dma_alloc_coherent(&qedi->pdev->dev,
1613 qedi->global_queues[i]->cq_mem_size, 1612 qedi->global_queues[i]->cq_mem_size,
1614 &qedi->global_queues[i]->cq_dma, 1613 &qedi->global_queues[i]->cq_dma,
1615 GFP_KERNEL); 1614 GFP_KERNEL);
1616 1615
1617 if (!qedi->global_queues[i]->cq) { 1616 if (!qedi->global_queues[i]->cq) {
1618 QEDI_WARN(&qedi->dbg_ctx, 1617 QEDI_WARN(&qedi->dbg_ctx,
@@ -1620,10 +1619,10 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
1620 status = -ENOMEM; 1619 status = -ENOMEM;
1621 goto mem_alloc_failure; 1620 goto mem_alloc_failure;
1622 } 1621 }
1623 qedi->global_queues[i]->cq_pbl = dma_zalloc_coherent(&qedi->pdev->dev, 1622 qedi->global_queues[i]->cq_pbl = dma_alloc_coherent(&qedi->pdev->dev,
1624 qedi->global_queues[i]->cq_pbl_size, 1623 qedi->global_queues[i]->cq_pbl_size,
1625 &qedi->global_queues[i]->cq_pbl_dma, 1624 &qedi->global_queues[i]->cq_pbl_dma,
1626 GFP_KERNEL); 1625 GFP_KERNEL);
1627 1626
1628 if (!qedi->global_queues[i]->cq_pbl) { 1627 if (!qedi->global_queues[i]->cq_pbl) {
1629 QEDI_WARN(&qedi->dbg_ctx, 1628 QEDI_WARN(&qedi->dbg_ctx,
@@ -1691,16 +1690,16 @@ int qedi_alloc_sq(struct qedi_ctx *qedi, struct qedi_endpoint *ep)
1691 ep->sq_pbl_size = (ep->sq_mem_size / QEDI_PAGE_SIZE) * sizeof(void *); 1690 ep->sq_pbl_size = (ep->sq_mem_size / QEDI_PAGE_SIZE) * sizeof(void *);
1692 ep->sq_pbl_size = ep->sq_pbl_size + QEDI_PAGE_SIZE; 1691 ep->sq_pbl_size = ep->sq_pbl_size + QEDI_PAGE_SIZE;
1693 1692
1694 ep->sq = dma_zalloc_coherent(&qedi->pdev->dev, ep->sq_mem_size, 1693 ep->sq = dma_alloc_coherent(&qedi->pdev->dev, ep->sq_mem_size,
1695 &ep->sq_dma, GFP_KERNEL); 1694 &ep->sq_dma, GFP_KERNEL);
1696 if (!ep->sq) { 1695 if (!ep->sq) {
1697 QEDI_WARN(&qedi->dbg_ctx, 1696 QEDI_WARN(&qedi->dbg_ctx,
1698 "Could not allocate send queue.\n"); 1697 "Could not allocate send queue.\n");
1699 rval = -ENOMEM; 1698 rval = -ENOMEM;
1700 goto out; 1699 goto out;
1701 } 1700 }
1702 ep->sq_pbl = dma_zalloc_coherent(&qedi->pdev->dev, ep->sq_pbl_size, 1701 ep->sq_pbl = dma_alloc_coherent(&qedi->pdev->dev, ep->sq_pbl_size,
1703 &ep->sq_pbl_dma, GFP_KERNEL); 1702 &ep->sq_pbl_dma, GFP_KERNEL);
1704 if (!ep->sq_pbl) { 1703 if (!ep->sq_pbl) {
1705 QEDI_WARN(&qedi->dbg_ctx, 1704 QEDI_WARN(&qedi->dbg_ctx,
1706 "Could not allocate send queue PBL.\n"); 1705 "Could not allocate send queue PBL.\n");
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index a414f51302b7..6856dfdfa473 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -4248,7 +4248,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4248 ha->devnum = devnum; /* specifies microcode load address */ 4248 ha->devnum = devnum; /* specifies microcode load address */
4249 4249
4250#ifdef QLA_64BIT_PTR 4250#ifdef QLA_64BIT_PTR
4251 if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { 4251 if (dma_set_mask_and_coherent(&ha->pdev->dev, DMA_BIT_MASK(64))) {
4252 if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) { 4252 if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) {
4253 printk(KERN_WARNING "scsi(%li): Unable to set a " 4253 printk(KERN_WARNING "scsi(%li): Unable to set a "
4254 "suitable DMA mask - aborting\n", ha->host_no); 4254 "suitable DMA mask - aborting\n", ha->host_no);
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 00444dc79756..ac504a1ff0ff 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -2415,8 +2415,8 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
2415 if (qla2x00_chip_is_down(vha)) 2415 if (qla2x00_chip_is_down(vha))
2416 goto done; 2416 goto done;
2417 2417
2418 stats = dma_zalloc_coherent(&ha->pdev->dev, sizeof(*stats), 2418 stats = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stats), &stats_dma,
2419 &stats_dma, GFP_KERNEL); 2419 GFP_KERNEL);
2420 if (!stats) { 2420 if (!stats) {
2421 ql_log(ql_log_warn, vha, 0x707d, 2421 ql_log(ql_log_warn, vha, 0x707d,
2422 "Failed to allocate memory for stats.\n"); 2422 "Failed to allocate memory for stats.\n");
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 4a9fd8d944d6..17d42658ad9a 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2312,8 +2312,8 @@ qla2x00_get_priv_stats(struct bsg_job *bsg_job)
2312 if (!IS_FWI2_CAPABLE(ha)) 2312 if (!IS_FWI2_CAPABLE(ha))
2313 return -EPERM; 2313 return -EPERM;
2314 2314
2315 stats = dma_zalloc_coherent(&ha->pdev->dev, sizeof(*stats), 2315 stats = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stats), &stats_dma,
2316 &stats_dma, GFP_KERNEL); 2316 GFP_KERNEL);
2317 if (!stats) { 2317 if (!stats) {
2318 ql_log(ql_log_warn, vha, 0x70e2, 2318 ql_log(ql_log_warn, vha, 0x70e2,
2319 "Failed to allocate memory for stats.\n"); 2319 "Failed to allocate memory for stats.\n");
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 26b93c563f92..d1fc4958222a 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -4394,6 +4394,8 @@ typedef struct scsi_qla_host {
4394 uint16_t n2n_id; 4394 uint16_t n2n_id;
4395 struct list_head gpnid_list; 4395 struct list_head gpnid_list;
4396 struct fab_scan scan; 4396 struct fab_scan scan;
4397
4398 unsigned int irq_offset;
4397} scsi_qla_host_t; 4399} scsi_qla_host_t;
4398 4400
4399struct qla27xx_image_status { 4401struct qla27xx_image_status {
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index 90cfa394f942..cbc3bc49d4d1 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -4147,9 +4147,10 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp)
4147 return rval; 4147 return rval;
4148 } 4148 }
4149 4149
4150 sp->u.iocb_cmd.u.ctarg.req = dma_zalloc_coherent( 4150 sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
4151 &vha->hw->pdev->dev, sizeof(struct ct_sns_pkt), 4151 sizeof(struct ct_sns_pkt),
4152 &sp->u.iocb_cmd.u.ctarg.req_dma, GFP_KERNEL); 4152 &sp->u.iocb_cmd.u.ctarg.req_dma,
4153 GFP_KERNEL);
4153 sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt); 4154 sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
4154 if (!sp->u.iocb_cmd.u.ctarg.req) { 4155 if (!sp->u.iocb_cmd.u.ctarg.req) {
4155 ql_log(ql_log_warn, vha, 0xffff, 4156 ql_log(ql_log_warn, vha, 0xffff,
@@ -4165,9 +4166,10 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp)
4165 ((vha->hw->max_fibre_devices - 1) * 4166 ((vha->hw->max_fibre_devices - 1) *
4166 sizeof(struct ct_sns_gpn_ft_data)); 4167 sizeof(struct ct_sns_gpn_ft_data));
4167 4168
4168 sp->u.iocb_cmd.u.ctarg.rsp = dma_zalloc_coherent( 4169 sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
4169 &vha->hw->pdev->dev, rspsz, 4170 rspsz,
4170 &sp->u.iocb_cmd.u.ctarg.rsp_dma, GFP_KERNEL); 4171 &sp->u.iocb_cmd.u.ctarg.rsp_dma,
4172 GFP_KERNEL);
4171 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt); 4173 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
4172 if (!sp->u.iocb_cmd.u.ctarg.rsp) { 4174 if (!sp->u.iocb_cmd.u.ctarg.rsp) {
4173 ql_log(ql_log_warn, vha, 0xffff, 4175 ql_log(ql_log_warn, vha, 0xffff,
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 364bb52ed2a6..8d1acc802a67 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1785,13 +1785,13 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint32_t lun,
1785 1785
1786 /* Issue Marker IOCB */ 1786 /* Issue Marker IOCB */
1787 qla2x00_marker(vha, vha->hw->req_q_map[0], 1787 qla2x00_marker(vha, vha->hw->req_q_map[0],
1788 vha->hw->rsp_q_map[0], sp->fcport->loop_id, lun, 1788 vha->hw->rsp_q_map[0], fcport->loop_id, lun,
1789 flags == TCF_LUN_RESET ? MK_SYNC_ID_LUN : MK_SYNC_ID); 1789 flags == TCF_LUN_RESET ? MK_SYNC_ID_LUN : MK_SYNC_ID);
1790 } 1790 }
1791 1791
1792done_free_sp: 1792done_free_sp:
1793 sp->free(sp); 1793 sp->free(sp);
1794 sp->fcport->flags &= ~FCF_ASYNC_SENT; 1794 fcport->flags &= ~FCF_ASYNC_SENT;
1795done: 1795done:
1796 return rval; 1796 return rval;
1797} 1797}
@@ -3099,8 +3099,8 @@ qla2x00_alloc_offload_mem(scsi_qla_host_t *vha)
3099 FCE_SIZE, ha->fce, ha->fce_dma); 3099 FCE_SIZE, ha->fce, ha->fce_dma);
3100 3100
3101 /* Allocate memory for Fibre Channel Event Buffer. */ 3101 /* Allocate memory for Fibre Channel Event Buffer. */
3102 tc = dma_zalloc_coherent(&ha->pdev->dev, FCE_SIZE, &tc_dma, 3102 tc = dma_alloc_coherent(&ha->pdev->dev, FCE_SIZE, &tc_dma,
3103 GFP_KERNEL); 3103 GFP_KERNEL);
3104 if (!tc) { 3104 if (!tc) {
3105 ql_log(ql_log_warn, vha, 0x00be, 3105 ql_log(ql_log_warn, vha, 0x00be,
3106 "Unable to allocate (%d KB) for FCE.\n", 3106 "Unable to allocate (%d KB) for FCE.\n",
@@ -3131,8 +3131,8 @@ try_eft:
3131 EFT_SIZE, ha->eft, ha->eft_dma); 3131 EFT_SIZE, ha->eft, ha->eft_dma);
3132 3132
3133 /* Allocate memory for Extended Trace Buffer. */ 3133 /* Allocate memory for Extended Trace Buffer. */
3134 tc = dma_zalloc_coherent(&ha->pdev->dev, EFT_SIZE, &tc_dma, 3134 tc = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &tc_dma,
3135 GFP_KERNEL); 3135 GFP_KERNEL);
3136 if (!tc) { 3136 if (!tc) {
3137 ql_log(ql_log_warn, vha, 0x00c1, 3137 ql_log(ql_log_warn, vha, 0x00c1,
3138 "Unable to allocate (%d KB) for EFT.\n", 3138 "Unable to allocate (%d KB) for EFT.\n",
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 30d3090842f8..8507c43b918c 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -3446,6 +3446,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
3446 "Adjusted Max no of queues pairs: %d.\n", ha->max_qpairs); 3446 "Adjusted Max no of queues pairs: %d.\n", ha->max_qpairs);
3447 } 3447 }
3448 } 3448 }
3449 vha->irq_offset = desc.pre_vectors;
3449 ha->msix_entries = kcalloc(ha->msix_count, 3450 ha->msix_entries = kcalloc(ha->msix_count,
3450 sizeof(struct qla_msix_entry), 3451 sizeof(struct qla_msix_entry),
3451 GFP_KERNEL); 3452 GFP_KERNEL);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index ea69dafc9774..c6ef83d0d99b 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -6939,7 +6939,7 @@ static int qla2xxx_map_queues(struct Scsi_Host *shost)
6939 if (USER_CTRL_IRQ(vha->hw)) 6939 if (USER_CTRL_IRQ(vha->hw))
6940 rc = blk_mq_map_queues(qmap); 6940 rc = blk_mq_map_queues(qmap);
6941 else 6941 else
6942 rc = blk_mq_pci_map_queues(qmap, vha->hw->pdev, 0); 6942 rc = blk_mq_pci_map_queues(qmap, vha->hw->pdev, vha->irq_offset);
6943 return rc; 6943 return rc;
6944} 6944}
6945 6945
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 1ef74aa2d00a..2bf5e3e639e1 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -153,8 +153,8 @@ int qla4xxx_get_sys_info(struct scsi_qla_host *ha)
153 dma_addr_t sys_info_dma; 153 dma_addr_t sys_info_dma;
154 int status = QLA_ERROR; 154 int status = QLA_ERROR;
155 155
156 sys_info = dma_zalloc_coherent(&ha->pdev->dev, sizeof(*sys_info), 156 sys_info = dma_alloc_coherent(&ha->pdev->dev, sizeof(*sys_info),
157 &sys_info_dma, GFP_KERNEL); 157 &sys_info_dma, GFP_KERNEL);
158 if (sys_info == NULL) { 158 if (sys_info == NULL) {
159 DEBUG2(printk("scsi%ld: %s: Unable to allocate dma buffer.\n", 159 DEBUG2(printk("scsi%ld: %s: Unable to allocate dma buffer.\n",
160 ha->host_no, __func__)); 160 ha->host_no, __func__));
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 5d56904687b9..dac9a7013208 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -625,9 +625,9 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
625 uint32_t mbox_sts[MBOX_REG_COUNT]; 625 uint32_t mbox_sts[MBOX_REG_COUNT];
626 int status = QLA_ERROR; 626 int status = QLA_ERROR;
627 627
628 init_fw_cb = dma_zalloc_coherent(&ha->pdev->dev, 628 init_fw_cb = dma_alloc_coherent(&ha->pdev->dev,
629 sizeof(struct addr_ctrl_blk), 629 sizeof(struct addr_ctrl_blk),
630 &init_fw_cb_dma, GFP_KERNEL); 630 &init_fw_cb_dma, GFP_KERNEL);
631 if (init_fw_cb == NULL) { 631 if (init_fw_cb == NULL) {
632 DEBUG2(printk("scsi%ld: %s: Unable to alloc init_cb\n", 632 DEBUG2(printk("scsi%ld: %s: Unable to alloc init_cb\n",
633 ha->host_no, __func__)); 633 ha->host_no, __func__));
@@ -709,9 +709,9 @@ int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host * ha)
709 uint32_t mbox_cmd[MBOX_REG_COUNT]; 709 uint32_t mbox_cmd[MBOX_REG_COUNT];
710 uint32_t mbox_sts[MBOX_REG_COUNT]; 710 uint32_t mbox_sts[MBOX_REG_COUNT];
711 711
712 init_fw_cb = dma_zalloc_coherent(&ha->pdev->dev, 712 init_fw_cb = dma_alloc_coherent(&ha->pdev->dev,
713 sizeof(struct addr_ctrl_blk), 713 sizeof(struct addr_ctrl_blk),
714 &init_fw_cb_dma, GFP_KERNEL); 714 &init_fw_cb_dma, GFP_KERNEL);
715 if (init_fw_cb == NULL) { 715 if (init_fw_cb == NULL) {
716 printk("scsi%ld: %s: Unable to alloc init_cb\n", ha->host_no, 716 printk("scsi%ld: %s: Unable to alloc init_cb\n", ha->host_no,
717 __func__); 717 __func__);
@@ -1340,9 +1340,9 @@ int qla4xxx_about_firmware(struct scsi_qla_host *ha)
1340 uint32_t mbox_sts[MBOX_REG_COUNT]; 1340 uint32_t mbox_sts[MBOX_REG_COUNT];
1341 int status = QLA_ERROR; 1341 int status = QLA_ERROR;
1342 1342
1343 about_fw = dma_zalloc_coherent(&ha->pdev->dev, 1343 about_fw = dma_alloc_coherent(&ha->pdev->dev,
1344 sizeof(struct about_fw_info), 1344 sizeof(struct about_fw_info),
1345 &about_fw_dma, GFP_KERNEL); 1345 &about_fw_dma, GFP_KERNEL);
1346 if (!about_fw) { 1346 if (!about_fw) {
1347 DEBUG2(ql4_printk(KERN_ERR, ha, "%s: Unable to alloc memory " 1347 DEBUG2(ql4_printk(KERN_ERR, ha, "%s: Unable to alloc memory "
1348 "for about_fw\n", __func__)); 1348 "for about_fw\n", __func__));
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index d2b333d629be..5a31877c9d04 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -4052,8 +4052,8 @@ int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha)
4052 dma_addr_t sys_info_dma; 4052 dma_addr_t sys_info_dma;
4053 int status = QLA_ERROR; 4053 int status = QLA_ERROR;
4054 4054
4055 sys_info = dma_zalloc_coherent(&ha->pdev->dev, sizeof(*sys_info), 4055 sys_info = dma_alloc_coherent(&ha->pdev->dev, sizeof(*sys_info),
4056 &sys_info_dma, GFP_KERNEL); 4056 &sys_info_dma, GFP_KERNEL);
4057 if (sys_info == NULL) { 4057 if (sys_info == NULL) {
4058 DEBUG2(printk("scsi%ld: %s: Unable to allocate dma buffer.\n", 4058 DEBUG2(printk("scsi%ld: %s: Unable to allocate dma buffer.\n",
4059 ha->host_no, __func__)); 4059 ha->host_no, __func__));
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 949e186cc5d7..a77bfb224248 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -2704,9 +2704,9 @@ qla4xxx_iface_set_param(struct Scsi_Host *shost, void *data, uint32_t len)
2704 uint32_t rem = len; 2704 uint32_t rem = len;
2705 struct nlattr *attr; 2705 struct nlattr *attr;
2706 2706
2707 init_fw_cb = dma_zalloc_coherent(&ha->pdev->dev, 2707 init_fw_cb = dma_alloc_coherent(&ha->pdev->dev,
2708 sizeof(struct addr_ctrl_blk), 2708 sizeof(struct addr_ctrl_blk),
2709 &init_fw_cb_dma, GFP_KERNEL); 2709 &init_fw_cb_dma, GFP_KERNEL);
2710 if (!init_fw_cb) { 2710 if (!init_fw_cb) {
2711 ql4_printk(KERN_ERR, ha, "%s: Unable to alloc init_cb\n", 2711 ql4_printk(KERN_ERR, ha, "%s: Unable to alloc init_cb\n",
2712 __func__); 2712 __func__);
@@ -4206,8 +4206,8 @@ static int qla4xxx_mem_alloc(struct scsi_qla_host *ha)
4206 sizeof(struct shadow_regs) + 4206 sizeof(struct shadow_regs) +
4207 MEM_ALIGN_VALUE + 4207 MEM_ALIGN_VALUE +
4208 (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); 4208 (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
4209 ha->queues = dma_zalloc_coherent(&ha->pdev->dev, ha->queues_len, 4209 ha->queues = dma_alloc_coherent(&ha->pdev->dev, ha->queues_len,
4210 &ha->queues_dma, GFP_KERNEL); 4210 &ha->queues_dma, GFP_KERNEL);
4211 if (ha->queues == NULL) { 4211 if (ha->queues == NULL) {
4212 ql4_printk(KERN_WARNING, ha, 4212 ql4_printk(KERN_WARNING, ha,
4213 "Memory Allocation failed - queues.\n"); 4213 "Memory Allocation failed - queues.\n");
@@ -7232,6 +7232,8 @@ static int qla4xxx_sysfs_ddb_tgt_create(struct scsi_qla_host *ha,
7232 7232
7233 rc = qla4xxx_copy_from_fwddb_param(fnode_sess, fnode_conn, 7233 rc = qla4xxx_copy_from_fwddb_param(fnode_sess, fnode_conn,
7234 fw_ddb_entry); 7234 fw_ddb_entry);
7235 if (rc)
7236 goto free_sess;
7235 7237
7236 ql4_printk(KERN_INFO, ha, "%s: sysfs entry %s created\n", 7238 ql4_printk(KERN_INFO, ha, "%s: sysfs entry %s created\n",
7237 __func__, fnode_sess->dev.kobj.name); 7239 __func__, fnode_sess->dev.kobj.name);
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 661512bec3ac..e27f4df24021 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -62,7 +62,7 @@
62 62
63/* make sure inq_product_rev string corresponds to this version */ 63/* make sure inq_product_rev string corresponds to this version */
64#define SDEBUG_VERSION "0188" /* format to fit INQUIRY revision field */ 64#define SDEBUG_VERSION "0188" /* format to fit INQUIRY revision field */
65static const char *sdebug_version_date = "20180128"; 65static const char *sdebug_version_date = "20190125";
66 66
67#define MY_NAME "scsi_debug" 67#define MY_NAME "scsi_debug"
68 68
@@ -735,7 +735,7 @@ static inline bool scsi_debug_lbp(void)
735 (sdebug_lbpu || sdebug_lbpws || sdebug_lbpws10); 735 (sdebug_lbpu || sdebug_lbpws || sdebug_lbpws10);
736} 736}
737 737
738static void *fake_store(unsigned long long lba) 738static void *lba2fake_store(unsigned long long lba)
739{ 739{
740 lba = do_div(lba, sdebug_store_sectors); 740 lba = do_div(lba, sdebug_store_sectors);
741 741
@@ -2514,8 +2514,8 @@ static int do_device_access(struct scsi_cmnd *scmd, u32 sg_skip, u64 lba,
2514 return ret; 2514 return ret;
2515} 2515}
2516 2516
2517/* If fake_store(lba,num) compares equal to arr(num), then copy top half of 2517/* If lba2fake_store(lba,num) compares equal to arr(num), then copy top half of
2518 * arr into fake_store(lba,num) and return true. If comparison fails then 2518 * arr into lba2fake_store(lba,num) and return true. If comparison fails then
2519 * return false. */ 2519 * return false. */
2520static bool comp_write_worker(u64 lba, u32 num, const u8 *arr) 2520static bool comp_write_worker(u64 lba, u32 num, const u8 *arr)
2521{ 2521{
@@ -2643,7 +2643,7 @@ static int prot_verify_read(struct scsi_cmnd *SCpnt, sector_t start_sec,
2643 if (sdt->app_tag == cpu_to_be16(0xffff)) 2643 if (sdt->app_tag == cpu_to_be16(0xffff))
2644 continue; 2644 continue;
2645 2645
2646 ret = dif_verify(sdt, fake_store(sector), sector, ei_lba); 2646 ret = dif_verify(sdt, lba2fake_store(sector), sector, ei_lba);
2647 if (ret) { 2647 if (ret) {
2648 dif_errors++; 2648 dif_errors++;
2649 return ret; 2649 return ret;
@@ -3261,10 +3261,12 @@ err_out:
3261static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num, 3261static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num,
3262 u32 ei_lba, bool unmap, bool ndob) 3262 u32 ei_lba, bool unmap, bool ndob)
3263{ 3263{
3264 int ret;
3264 unsigned long iflags; 3265 unsigned long iflags;
3265 unsigned long long i; 3266 unsigned long long i;
3266 int ret; 3267 u32 lb_size = sdebug_sector_size;
3267 u64 lba_off; 3268 u64 block, lbaa;
3269 u8 *fs1p;
3268 3270
3269 ret = check_device_access_params(scp, lba, num); 3271 ret = check_device_access_params(scp, lba, num);
3270 if (ret) 3272 if (ret)
@@ -3276,31 +3278,30 @@ static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num,
3276 unmap_region(lba, num); 3278 unmap_region(lba, num);
3277 goto out; 3279 goto out;
3278 } 3280 }
3279 3281 lbaa = lba;
3280 lba_off = lba * sdebug_sector_size; 3282 block = do_div(lbaa, sdebug_store_sectors);
3281 /* if ndob then zero 1 logical block, else fetch 1 logical block */ 3283 /* if ndob then zero 1 logical block, else fetch 1 logical block */
3284 fs1p = fake_storep + (block * lb_size);
3282 if (ndob) { 3285 if (ndob) {
3283 memset(fake_storep + lba_off, 0, sdebug_sector_size); 3286 memset(fs1p, 0, lb_size);
3284 ret = 0; 3287 ret = 0;
3285 } else 3288 } else
3286 ret = fetch_to_dev_buffer(scp, fake_storep + lba_off, 3289 ret = fetch_to_dev_buffer(scp, fs1p, lb_size);
3287 sdebug_sector_size);
3288 3290
3289 if (-1 == ret) { 3291 if (-1 == ret) {
3290 write_unlock_irqrestore(&atomic_rw, iflags); 3292 write_unlock_irqrestore(&atomic_rw, iflags);
3291 return DID_ERROR << 16; 3293 return DID_ERROR << 16;
3292 } else if (sdebug_verbose && !ndob && (ret < sdebug_sector_size)) 3294 } else if (sdebug_verbose && !ndob && (ret < lb_size))
3293 sdev_printk(KERN_INFO, scp->device, 3295 sdev_printk(KERN_INFO, scp->device,
3294 "%s: %s: lb size=%u, IO sent=%d bytes\n", 3296 "%s: %s: lb size=%u, IO sent=%d bytes\n",
3295 my_name, "write same", 3297 my_name, "write same", lb_size, ret);
3296 sdebug_sector_size, ret);
3297 3298
3298 /* Copy first sector to remaining blocks */ 3299 /* Copy first sector to remaining blocks */
3299 for (i = 1 ; i < num ; i++) 3300 for (i = 1 ; i < num ; i++) {
3300 memcpy(fake_storep + ((lba + i) * sdebug_sector_size), 3301 lbaa = lba + i;
3301 fake_storep + lba_off, 3302 block = do_div(lbaa, sdebug_store_sectors);
3302 sdebug_sector_size); 3303 memmove(fake_storep + (block * lb_size), fs1p, lb_size);
3303 3304 }
3304 if (scsi_debug_lbp()) 3305 if (scsi_debug_lbp())
3305 map_region(lba, num); 3306 map_region(lba, num);
3306out: 3307out:
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index b13cc9288ba0..f8d51c3d5582 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -655,6 +655,7 @@ static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result)
655 set_host_byte(cmd, DID_OK); 655 set_host_byte(cmd, DID_OK);
656 return BLK_STS_TARGET; 656 return BLK_STS_TARGET;
657 case DID_NEXUS_FAILURE: 657 case DID_NEXUS_FAILURE:
658 set_host_byte(cmd, DID_OK);
658 return BLK_STS_NEXUS; 659 return BLK_STS_NEXUS;
659 case DID_ALLOC_FAILURE: 660 case DID_ALLOC_FAILURE:
660 set_host_byte(cmd, DID_OK); 661 set_host_byte(cmd, DID_OK);
@@ -1842,8 +1843,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
1842 blk_queue_segment_boundary(q, shost->dma_boundary); 1843 blk_queue_segment_boundary(q, shost->dma_boundary);
1843 dma_set_seg_boundary(dev, shost->dma_boundary); 1844 dma_set_seg_boundary(dev, shost->dma_boundary);
1844 1845
1845 blk_queue_max_segment_size(q, 1846 blk_queue_max_segment_size(q, shost->max_segment_size);
1846 min(shost->max_segment_size, dma_get_max_seg_size(dev))); 1847 dma_set_max_seg_size(dev, shost->max_segment_size);
1847 1848
1848 /* 1849 /*
1849 * Set a reasonable default alignment: The larger of 32-byte (dword), 1850 * Set a reasonable default alignment: The larger of 32-byte (dword),
diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
index a2b4179bfdf7..7639df91b110 100644
--- a/drivers/scsi/scsi_pm.c
+++ b/drivers/scsi/scsi_pm.c
@@ -80,8 +80,22 @@ static int scsi_dev_type_resume(struct device *dev,
80 80
81 if (err == 0) { 81 if (err == 0) {
82 pm_runtime_disable(dev); 82 pm_runtime_disable(dev);
83 pm_runtime_set_active(dev); 83 err = pm_runtime_set_active(dev);
84 pm_runtime_enable(dev); 84 pm_runtime_enable(dev);
85
86 /*
87 * Forcibly set runtime PM status of request queue to "active"
88 * to make sure we can again get requests from the queue
89 * (see also blk_pm_peek_request()).
90 *
91 * The resume hook will correct runtime PM status of the disk.
92 */
93 if (!err && scsi_is_sdev_device(dev)) {
94 struct scsi_device *sdev = to_scsi_device(dev);
95
96 if (sdev->request_queue->dev)
97 blk_set_runtime_active(sdev->request_queue);
98 }
85 } 99 }
86 100
87 return err; 101 return err;
@@ -140,16 +154,6 @@ static int scsi_bus_resume_common(struct device *dev,
140 else 154 else
141 fn = NULL; 155 fn = NULL;
142 156
143 /*
144 * Forcibly set runtime PM status of request queue to "active" to
145 * make sure we can again get requests from the queue (see also
146 * blk_pm_peek_request()).
147 *
148 * The resume hook will correct runtime PM status of the disk.
149 */
150 if (scsi_is_sdev_device(dev) && pm_runtime_suspended(dev))
151 blk_set_runtime_active(to_scsi_device(dev)->request_queue);
152
153 if (fn) { 157 if (fn) {
154 async_schedule_domain(fn, dev, &scsi_sd_pm_domain); 158 async_schedule_domain(fn, dev, &scsi_sd_pm_domain);
155 159
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a1a44f52e0e8..5464d467e23e 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -206,6 +206,12 @@ cache_type_store(struct device *dev, struct device_attribute *attr,
206 sp = buffer_data[0] & 0x80 ? 1 : 0; 206 sp = buffer_data[0] & 0x80 ? 1 : 0;
207 buffer_data[0] &= ~0x80; 207 buffer_data[0] &= ~0x80;
208 208
209 /*
210 * Ensure WP, DPOFUA, and RESERVED fields are cleared in
211 * received mode parameter buffer before doing MODE SELECT.
212 */
213 data.device_specific = 0;
214
209 if (scsi_mode_select(sdp, 1, sp, 8, buffer_data, len, SD_TIMEOUT, 215 if (scsi_mode_select(sdp, 1, sp, 8, buffer_data, len, SD_TIMEOUT,
210 SD_MAX_RETRIES, &data, &sshdr)) { 216 SD_MAX_RETRIES, &data, &sshdr)) {
211 if (scsi_sense_valid(&sshdr)) 217 if (scsi_sense_valid(&sshdr))
@@ -2945,9 +2951,6 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
2945 if (rot == 1) { 2951 if (rot == 1) {
2946 blk_queue_flag_set(QUEUE_FLAG_NONROT, q); 2952 blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
2947 blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q); 2953 blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q);
2948 } else {
2949 blk_queue_flag_clear(QUEUE_FLAG_NONROT, q);
2950 blk_queue_flag_set(QUEUE_FLAG_ADD_RANDOM, q);
2951 } 2954 }
2952 2955
2953 if (sdkp->device->type == TYPE_ZBC) { 2956 if (sdkp->device->type == TYPE_ZBC) {
@@ -3084,6 +3087,15 @@ static int sd_revalidate_disk(struct gendisk *disk)
3084 if (sdkp->media_present) { 3087 if (sdkp->media_present) {
3085 sd_read_capacity(sdkp, buffer); 3088 sd_read_capacity(sdkp, buffer);
3086 3089
3090 /*
3091 * set the default to rotational. All non-rotational devices
3092 * support the block characteristics VPD page, which will
3093 * cause this to be updated correctly and any device which
3094 * doesn't support it should be treated as rotational.
3095 */
3096 blk_queue_flag_clear(QUEUE_FLAG_NONROT, q);
3097 blk_queue_flag_set(QUEUE_FLAG_ADD_RANDOM, q);
3098
3087 if (scsi_device_supports_vpd(sdp)) { 3099 if (scsi_device_supports_vpd(sdp)) {
3088 sd_read_block_provisioning(sdkp); 3100 sd_read_block_provisioning(sdkp);
3089 sd_read_block_limits(sdkp); 3101 sd_read_block_limits(sdkp);
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 83365b29a4d8..a340af797a85 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -142,10 +142,12 @@ int sd_zbc_report_zones(struct gendisk *disk, sector_t sector,
142 return -EOPNOTSUPP; 142 return -EOPNOTSUPP;
143 143
144 /* 144 /*
145 * Get a reply buffer for the number of requested zones plus a header. 145 * Get a reply buffer for the number of requested zones plus a header,
146 * For ATA, buffers must be aligned to 512B. 146 * without exceeding the device maximum command size. For ATA disks,
147 * buffers must be aligned to 512B.
147 */ 148 */
148 buflen = roundup((nrz + 1) * 64, 512); 149 buflen = min(queue_max_hw_sectors(disk->queue) << 9,
150 roundup((nrz + 1) * 64, 512));
149 buf = kmalloc(buflen, gfp_mask); 151 buf = kmalloc(buflen, gfp_mask);
150 if (!buf) 152 if (!buf)
151 return -ENOMEM; 153 return -ENOMEM;
@@ -462,12 +464,16 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf)
462 sdkp->device->use_10_for_rw = 0; 464 sdkp->device->use_10_for_rw = 0;
463 465
464 /* 466 /*
465 * If something changed, revalidate the disk zone bitmaps once we have 467 * Revalidate the disk zone bitmaps once the block device capacity is
466 * the capacity, that is on the second revalidate execution during disk 468 * set on the second revalidate execution during disk scan and if
467 * scan and always during normal revalidate. 469 * something changed when executing a normal revalidate.
468 */ 470 */
469 if (sdkp->first_scan) 471 if (sdkp->first_scan) {
472 sdkp->zone_blocks = zone_blocks;
473 sdkp->nr_zones = nr_zones;
470 return 0; 474 return 0;
475 }
476
471 if (sdkp->zone_blocks != zone_blocks || 477 if (sdkp->zone_blocks != zone_blocks ||
472 sdkp->nr_zones != nr_zones || 478 sdkp->nr_zones != nr_zones ||
473 disk->queue->nr_zones != nr_zones) { 479 disk->queue->nr_zones != nr_zones) {
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index e2fa3f476227..f564af8949e8 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -323,7 +323,7 @@ static inline void pqi_device_remove_start(struct pqi_scsi_dev *device)
323static inline bool pqi_device_in_remove(struct pqi_ctrl_info *ctrl_info, 323static inline bool pqi_device_in_remove(struct pqi_ctrl_info *ctrl_info,
324 struct pqi_scsi_dev *device) 324 struct pqi_scsi_dev *device)
325{ 325{
326 return device->in_remove & !ctrl_info->in_shutdown; 326 return device->in_remove && !ctrl_info->in_shutdown;
327} 327}
328 328
329static inline void pqi_schedule_rescan_worker_with_delay( 329static inline void pqi_schedule_rescan_worker_with_delay(
@@ -3576,9 +3576,9 @@ static int pqi_alloc_operational_queues(struct pqi_ctrl_info *ctrl_info)
3576 alloc_length += PQI_EXTRA_SGL_MEMORY; 3576 alloc_length += PQI_EXTRA_SGL_MEMORY;
3577 3577
3578 ctrl_info->queue_memory_base = 3578 ctrl_info->queue_memory_base =
3579 dma_zalloc_coherent(&ctrl_info->pci_dev->dev, 3579 dma_alloc_coherent(&ctrl_info->pci_dev->dev, alloc_length,
3580 alloc_length, 3580 &ctrl_info->queue_memory_base_dma_handle,
3581 &ctrl_info->queue_memory_base_dma_handle, GFP_KERNEL); 3581 GFP_KERNEL);
3582 3582
3583 if (!ctrl_info->queue_memory_base) 3583 if (!ctrl_info->queue_memory_base)
3584 return -ENOMEM; 3584 return -ENOMEM;
@@ -3715,10 +3715,9 @@ static int pqi_alloc_admin_queues(struct pqi_ctrl_info *ctrl_info)
3715 PQI_QUEUE_ELEMENT_ARRAY_ALIGNMENT; 3715 PQI_QUEUE_ELEMENT_ARRAY_ALIGNMENT;
3716 3716
3717 ctrl_info->admin_queue_memory_base = 3717 ctrl_info->admin_queue_memory_base =
3718 dma_zalloc_coherent(&ctrl_info->pci_dev->dev, 3718 dma_alloc_coherent(&ctrl_info->pci_dev->dev, alloc_length,
3719 alloc_length, 3719 &ctrl_info->admin_queue_memory_base_dma_handle,
3720 &ctrl_info->admin_queue_memory_base_dma_handle, 3720 GFP_KERNEL);
3721 GFP_KERNEL);
3722 3721
3723 if (!ctrl_info->admin_queue_memory_base) 3722 if (!ctrl_info->admin_queue_memory_base)
3724 return -ENOMEM; 3723 return -ENOMEM;
@@ -4602,9 +4601,10 @@ static void pqi_free_all_io_requests(struct pqi_ctrl_info *ctrl_info)
4602 4601
4603static inline int pqi_alloc_error_buffer(struct pqi_ctrl_info *ctrl_info) 4602static inline int pqi_alloc_error_buffer(struct pqi_ctrl_info *ctrl_info)
4604{ 4603{
4605 ctrl_info->error_buffer = dma_zalloc_coherent(&ctrl_info->pci_dev->dev, 4604 ctrl_info->error_buffer = dma_alloc_coherent(&ctrl_info->pci_dev->dev,
4606 ctrl_info->error_buffer_length, 4605 ctrl_info->error_buffer_length,
4607 &ctrl_info->error_buffer_dma_handle, GFP_KERNEL); 4606 &ctrl_info->error_buffer_dma_handle,
4607 GFP_KERNEL);
4608 4608
4609 if (!ctrl_info->error_buffer) 4609 if (!ctrl_info->error_buffer)
4610 return -ENOMEM; 4610 return -ENOMEM;
@@ -7487,8 +7487,8 @@ static int pqi_ofa_alloc_mem(struct pqi_ctrl_info *ctrl_info,
7487 dma_addr_t dma_handle; 7487 dma_addr_t dma_handle;
7488 7488
7489 ctrl_info->pqi_ofa_chunk_virt_addr[i] = 7489 ctrl_info->pqi_ofa_chunk_virt_addr[i] =
7490 dma_zalloc_coherent(dev, chunk_size, &dma_handle, 7490 dma_alloc_coherent(dev, chunk_size, &dma_handle,
7491 GFP_KERNEL); 7491 GFP_KERNEL);
7492 7492
7493 if (!ctrl_info->pqi_ofa_chunk_virt_addr[i]) 7493 if (!ctrl_info->pqi_ofa_chunk_virt_addr[i])
7494 break; 7494 break;
@@ -7545,10 +7545,10 @@ static void pqi_ofa_setup_host_buffer(struct pqi_ctrl_info *ctrl_info,
7545 struct device *dev; 7545 struct device *dev;
7546 7546
7547 dev = &ctrl_info->pci_dev->dev; 7547 dev = &ctrl_info->pci_dev->dev;
7548 pqi_ofa_memory = dma_zalloc_coherent(dev, 7548 pqi_ofa_memory = dma_alloc_coherent(dev,
7549 PQI_OFA_MEMORY_DESCRIPTOR_LENGTH, 7549 PQI_OFA_MEMORY_DESCRIPTOR_LENGTH,
7550 &ctrl_info->pqi_ofa_mem_dma_handle, 7550 &ctrl_info->pqi_ofa_mem_dma_handle,
7551 GFP_KERNEL); 7551 GFP_KERNEL);
7552 7552
7553 if (!pqi_ofa_memory) 7553 if (!pqi_ofa_memory)
7554 return; 7554 return;
diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
index dd65fea07687..6d176815e6ce 100644
--- a/drivers/scsi/ufs/ufs.h
+++ b/drivers/scsi/ufs/ufs.h
@@ -195,7 +195,7 @@ enum ufs_desc_def_size {
195 QUERY_DESC_CONFIGURATION_DEF_SIZE = 0x90, 195 QUERY_DESC_CONFIGURATION_DEF_SIZE = 0x90,
196 QUERY_DESC_UNIT_DEF_SIZE = 0x23, 196 QUERY_DESC_UNIT_DEF_SIZE = 0x23,
197 QUERY_DESC_INTERCONNECT_DEF_SIZE = 0x06, 197 QUERY_DESC_INTERCONNECT_DEF_SIZE = 0x06,
198 QUERY_DESC_GEOMETRY_DEF_SIZE = 0x44, 198 QUERY_DESC_GEOMETRY_DEF_SIZE = 0x48,
199 QUERY_DESC_POWER_DEF_SIZE = 0x62, 199 QUERY_DESC_POWER_DEF_SIZE = 0x62,
200 QUERY_DESC_HEALTH_DEF_SIZE = 0x25, 200 QUERY_DESC_HEALTH_DEF_SIZE = 0x25,
201}; 201};
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 9ba7671b84f8..2ddf24466a62 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -108,13 +108,19 @@
108int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len, 108int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
109 const char *prefix) 109 const char *prefix)
110{ 110{
111 u8 *regs; 111 u32 *regs;
112 size_t pos;
113
114 if (offset % 4 != 0 || len % 4 != 0) /* keep readl happy */
115 return -EINVAL;
112 116
113 regs = kzalloc(len, GFP_KERNEL); 117 regs = kzalloc(len, GFP_KERNEL);
114 if (!regs) 118 if (!regs)
115 return -ENOMEM; 119 return -ENOMEM;
116 120
117 memcpy_fromio(regs, hba->mmio_base + offset, len); 121 for (pos = 0; pos < len; pos += 4)
122 regs[pos / 4] = ufshcd_readl(hba, offset + pos);
123
118 ufshcd_hex_dump(prefix, regs, len); 124 ufshcd_hex_dump(prefix, regs, len);
119 kfree(regs); 125 kfree(regs);
120 126
@@ -8001,6 +8007,8 @@ out:
8001 trace_ufshcd_system_resume(dev_name(hba->dev), ret, 8007 trace_ufshcd_system_resume(dev_name(hba->dev), ret,
8002 ktime_to_us(ktime_sub(ktime_get(), start)), 8008 ktime_to_us(ktime_sub(ktime_get(), start)),
8003 hba->curr_dev_pwr_mode, hba->uic_link_state); 8009 hba->curr_dev_pwr_mode, hba->uic_link_state);
8010 if (!ret)
8011 hba->is_sys_suspended = false;
8004 return ret; 8012 return ret;
8005} 8013}
8006EXPORT_SYMBOL(ufshcd_system_resume); 8014EXPORT_SYMBOL(ufshcd_system_resume);