]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scsi: pm8001: Improve pm80XX_send_abort_all()
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Sun, 20 Feb 2022 03:18:09 +0000 (12:18 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 23 Feb 2022 02:31:21 +0000 (21:31 -0500)
Both pm8001_send_abort_all() and pm80xx_send_abort_all() are called only
for a non null device with the NCQ_READ_LOG_FLAG set, so remove the device
check on entry of these functions. Furthermore, setting the
NCQ_ABORT_ALL_FLAG device id flag and clearing the NCQ_READ_LOG_FLAG is
always done before calling these functions. Move these operations inside
the functions.

Link: https://lore.kernel.org/r/20220220031810.738362-31-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/pm8001/pm8001_hwi.c
drivers/scsi/pm8001/pm80xx_hwi.c

index 1569aa483af5aea4589751d4de529003e0b016cf..048ff41852c957e8ade467b57076142ae65a35ed 100644 (file)
@@ -1748,15 +1748,13 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha,
                struct pm8001_device *pm8001_ha_dev)
 {
        struct pm8001_ccb_info *ccb;
-       struct sas_task *task = NULL;
+       struct sas_task *task;
        struct task_abort_req task_abort;
        u32 opc = OPC_INB_SATA_ABORT;
        int ret;
 
-       if (!pm8001_ha_dev) {
-               pm8001_dbg(pm8001_ha, FAIL, "dev is null\n");
-               return;
-       }
+       pm8001_ha_dev->id |= NCQ_ABORT_ALL_FLAG;
+       pm8001_ha_dev->id &= ~NCQ_READ_LOG_FLAG;
 
        task = sas_alloc_slow_task(GFP_ATOMIC);
        if (!task) {
@@ -2358,11 +2356,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
                        ts->stat = SAS_SAM_STAT_GOOD;
                        /* check if response is for SEND READ LOG */
                        if (pm8001_dev &&
-                               (pm8001_dev->id & NCQ_READ_LOG_FLAG)) {
-                               /* set new bit for abort_all */
-                               pm8001_dev->id |= NCQ_ABORT_ALL_FLAG;
-                               /* clear bit for read log */
-                               pm8001_dev->id = pm8001_dev->id & 0x7FFFFFFF;
+                           (pm8001_dev->id & NCQ_READ_LOG_FLAG)) {
                                pm8001_send_abort_all(pm8001_ha, pm8001_dev);
                                /* Free the tag */
                                pm8001_tag_free(pm8001_ha, tag);
index b5e1aaa0fd58d4f13d8d8e1bcf30385adc9330b4..9bb31f66db853767a492c3ec95131771eeb624ea 100644 (file)
@@ -1761,23 +1761,19 @@ static void pm80xx_send_abort_all(struct pm8001_hba_info *pm8001_ha,
                struct pm8001_device *pm8001_ha_dev)
 {
        struct pm8001_ccb_info *ccb;
-       struct sas_task *task = NULL;
+       struct sas_task *task;
        struct task_abort_req task_abort;
        u32 opc = OPC_INB_SATA_ABORT;
        int ret;
 
-       if (!pm8001_ha_dev) {
-               pm8001_dbg(pm8001_ha, FAIL, "dev is null\n");
-               return;
-       }
+       pm8001_ha_dev->id |= NCQ_ABORT_ALL_FLAG;
+       pm8001_ha_dev->id &= ~NCQ_READ_LOG_FLAG;
 
        task = sas_alloc_slow_task(GFP_ATOMIC);
-
        if (!task) {
                pm8001_dbg(pm8001_ha, FAIL, "cannot allocate task\n");
                return;
        }
-
        task->task_done = pm8001_task_done;
 
        ccb = pm8001_ccb_alloc(pm8001_ha, pm8001_ha_dev, task);
@@ -2446,11 +2442,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha,
                        ts->stat = SAS_SAM_STAT_GOOD;
                        /* check if response is for SEND READ LOG */
                        if (pm8001_dev &&
-                               (pm8001_dev->id & NCQ_READ_LOG_FLAG)) {
-                               /* set new bit for abort_all */
-                               pm8001_dev->id |= NCQ_ABORT_ALL_FLAG;
-                               /* clear bit for read log */
-                               pm8001_dev->id = pm8001_dev->id & 0x7FFFFFFF;
+                           (pm8001_dev->id & NCQ_READ_LOG_FLAG)) {
                                pm80xx_send_abort_all(pm8001_ha, pm8001_dev);
                                /* Free the tag */
                                pm8001_tag_free(pm8001_ha, tag);