From: "jack_wang" <jack_wang@usish.com>
To: jack_wang <jack_wang@usish.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>
Subject: [PATCH Resend 3/3] pm8001:fix for allocate proper tag for per ccb fix error out and cleanup code
Date: Fri, 30 Oct 2009 21:54:33 +0800 [thread overview]
Message-ID: <200910302154282658976@usish.com> (raw)
In-Reply-To: 200910292014.28787.eike@sf-mail.de
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: 0003-fixes-for-tag-alloc-error-goto-and-printk-cleanup.patch --]
[-- Type: application/octet-stream, Size: 5776 bytes --]
From 58e8312a46484de077c9aec8e10bb95f794ca684 Mon Sep 17 00:00:00 2001
From: Jack Wang <jack_wang@usish.com>
Date: Fri, 30 Oct 2009 17:30:56 +0800
Subject: [PATCH 3/3] fixes for tag alloc,error goto and printk cleanup
Alloc right size for bitmap tag,fix error goto and cleanup print message and
undocable commemts.
Signed-off-by: Lindar Liu <lindar_liu@usish.com>
Signed-off-by: Jack Wang <jack_wang@usish.com>
---
drivers/scsi/pm8001/pm8001_init.c | 11 +++++++----
drivers/scsi/pm8001/pm8001_sas.c | 34 +++++++++++++++-------------------
2 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 811b5d3..42ebe72 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -203,9 +203,9 @@ static int __devinit pm8001_alloc(struct pm8001_hba_info *pm8001_ha)
for (i = 0; i < pm8001_ha->chip->n_phy; i++)
pm8001_phy_init(pm8001_ha, i);
- pm8001_ha->tags = kmalloc(sizeof(*pm8001_ha->tags)*PM8001_MAX_DEVICES,
- GFP_KERNEL);
-
+ pm8001_ha->tags = kzalloc(PM8001_MAX_CCB, GFP_KERNEL);
+ if (!pm8001_ha->tags)
+ goto err_out;
/* MPI Memory region 1 for AAP Event Log for fw */
pm8001_ha->memoryMap.region[AAP1].num_elements = 1;
pm8001_ha->memoryMap.region[AAP1].element_size = PM8001_EVENT_LOG_SIZE;
@@ -287,6 +287,9 @@ static int __devinit pm8001_alloc(struct pm8001_hba_info *pm8001_ha)
pm8001_ha->ccb_info[i].ccb_dma_handle =
pm8001_ha->memoryMap.region[CCB_MEM].phys_addr +
i * sizeof(struct pm8001_ccb_info);
+ pm8001_ha->ccb_info[i].task = NULL;
+ pm8001_ha->ccb_info[i].ccb_tag = 0xffffffff;
+ pm8001_ha->ccb_info[i].device = NULL;
++pm8001_ha->tags_num;
}
pm8001_ha->flags = PM8001F_INIT_TIME;
@@ -578,7 +581,7 @@ static u32 pm8001_request_irq(struct pm8001_hba_info *pm8001_ha)
{
struct pci_dev *pdev;
irq_handler_t irq_handler = pm8001_interrupt;
- u32 rc;
+ int rc;
pdev = pm8001_ha->pdev;
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 1e840fd..752acad 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -330,15 +330,12 @@ int pm8001_slave_configure(struct scsi_device *sdev)
return 0;
}
/**
- * pm8001_task_exec -execute the task which come from upper level, send the
- * command or data to DMA area and then increase CI,for queuecommand(ssp),
- * it is from upper layer and for smp command,it is from libsas,
- * for ata command it is from libata.
+ * pm8001_task_exec - queue the task(ssp, smp && ata) to the hardware.
* @task: the task to be execute.
* @num: if can_queue great than 1, the task can be queued up. for SMP task,
* we always execute one one time.
* @gfp_flags: gfp_flags.
- * @is tmf: if it is task management task.
+ * @is_tmf: if it is task management task.
* @tmf: the task management IU
*/
#define DEV_IS_GONE(pm8001_dev) \
@@ -379,7 +376,7 @@ static int pm8001_task_exec(struct sas_task *task, const int num,
pm8001_printk("device %016llx not "
"ready.\n", SAS_ADDR(dev->sas_addr)));
}
- rc = SAS_PHY_DOWN;
+ rc = SAS_PHY_DOWN;
goto out_done;
}
rc = pm8001_tag_alloc(pm8001_ha, &tag);
@@ -395,14 +392,14 @@ static int pm8001_task_exec(struct sas_task *task, const int num,
t->data_dir);
if (!n_elem) {
rc = -ENOMEM;
- goto err_out;
+ goto err_out_tag;
}
}
} else {
n_elem = t->num_scatter;
}
- t->lldd_task = NULL;
+ t->lldd_task = ccb;
ccb->n_elem = n_elem;
ccb->ccb_tag = tag;
ccb->task = t;
@@ -435,7 +432,6 @@ static int pm8001_task_exec(struct sas_task *task, const int num,
pm8001_printk("rc is %x\n", rc));
goto err_out_tag;
}
- t->lldd_task = ccb;
/* TODO: select normal or high priority */
spin_lock(&t->task_state_lock);
t->task_state_flags |= SAS_TASK_AT_INITIATOR;
@@ -737,9 +733,9 @@ static int pm8001_exec_internal_tmf_task(struct domain_device *dev,
res = -EMSGSIZE;
break;
} else {
- PM8001_IO_DBG(pm8001_ha,
- pm8001_printk(" Task to dev %016llx response: 0x%x"
- "status 0x%x\n",
+ PM8001_EH_DBG(pm8001_ha,
+ pm8001_printk(" Task to dev %016llx response:"
+ "0x%x status 0x%x\n",
SAS_ADDR(dev->sas_addr),
task->task_status.resp,
task->task_status.stat));
@@ -760,7 +756,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,
u32 task_tag)
{
int res, retry;
- u32 rc, ccb_tag;
+ u32 ccb_tag;
struct pm8001_ccb_info *ccb;
struct sas_task *task = NULL;
@@ -777,9 +773,9 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,
task->timer.expires = jiffies + PM8001_TASK_TIMEOUT*HZ;
add_timer(&task->timer);
- rc = pm8001_tag_alloc(pm8001_ha, &ccb_tag);
- if (rc)
- return rc;
+ res = pm8001_tag_alloc(pm8001_ha, &ccb_tag);
+ if (res)
+ return res;
ccb = &pm8001_ha->ccb_info[ccb_tag];
ccb->device = pm8001_dev;
ccb->ccb_tag = ccb_tag;
@@ -812,7 +808,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,
break;
} else {
- PM8001_IO_DBG(pm8001_ha,
+ PM8001_EH_DBG(pm8001_ha,
pm8001_printk(" Task to dev %016llx response: "
"0x%x status 0x%x\n",
SAS_ADDR(dev->sas_addr),
@@ -1027,8 +1023,8 @@ int pm8001_abort_task(struct sas_task *task)
}
device_id = pm8001_dev->device_id;
PM8001_EH_DBG(pm8001_ha,
- pm8001_printk("abort io to device_id = %d\n", device_id));
- tmf_task.tmf = TMF_ABORT_TASK;
+ pm8001_printk("abort io to deviceid= %d\n", device_id));
+ tmf_task.tmf = TMF_ABORT_TASK;
tmf_task.tag_of_task_to_be_managed = tag;
rc = pm8001_issue_ssp_tmf(dev, lun.scsi_lun, &tmf_task);
rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev,
--
1.6.4.msysgit.0
next prev parent reply other threads:[~2009-10-30 13:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-21 0:22 [PATCH] Add new driver for LSI 3ware 9750 adam radford
2009-10-21 15:27 ` Rolf Eike Beer
2009-10-23 11:21 ` Matthew Wilcox
2009-10-29 19:14 ` Rolf Eike Beer
2009-10-29 20:08 ` James Bottomley
2009-10-30 13:54 ` jack_wang [this message]
2009-10-23 13:53 ` Bartlomiej Zolnierkiewicz
2009-11-05 14:45 ` Bartlomiej Zolnierkiewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200910302154282658976@usish.com \
--to=jack_wang@usish.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox