public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tomas Henzl <thenzl@redhat.com>
To: 黃清隆 <ching2048@areca.com.tw>
Cc: james.bottomley@hansenpartnership.com,
	linux-scsi <linux-scsi@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	billion@areca.com.tw
Subject: Re: [PATCH 1/3] arcmsr: Support Areca new SATA Raid Adapter ARC1214/1224/1264/1284
Date: Mon, 26 Aug 2013 14:20:58 +0200	[thread overview]
Message-ID: <521B482A.80908@redhat.com> (raw)
In-Reply-To: <7A2818CC441F4BCE96D3B1E70CC3D76B@chingDT>

On 08/26/2013 06:14 AM, 黃清隆 wrote:
>  From: Ching <ching2048@areca.com.tw>
>
> Support Areca new SATA Raid adapter ARC1214/1224/1264/1284.
> Modify maximum outstanding command number, notify command complete with auto
> request sense
> Signed-off-by: Ching  <ching2048@areca.com.tw>

Hi Ching,
+static bool
+arcmsr_hbaD_get_config(struct AdapterControlBlock *acb)
+{
...
+	dma_coherent = dma_alloc_coherent(&pdev->dev, acb->uncache_size,
+	&dma_coherent_handle, GFP_KERNEL);
+	if (!dma_coherent) {
+		pr_notice("DMA allocation failed...\n");
+		return -ENOMEM;
You've declared the return value as a bool so the function should return false or true.
---------------------------------------
In arcmsr_alloc_ccb_pool
-	roundup_ccbsize = roundup(sizeof(struct CommandControlBlock) + (max_sg_entrys - 1) * sizeof(struct SG64ENTRY), 32);
-	acb->uncache_size = roundup_ccbsize * ARCMSR_MAX_FREECCB_NUM;
-	dma_coherent = dma_alloc_coherent(&pdev->dev, acb->uncache_size, &dma_coherent_handle, GFP_KERNEL);
-	if(!dma_coherent){
-		printk(KERN_NOTICE "arcmsr%d: dma_alloc_coherent got error\n", acb->host->host_no);
-		return -ENOMEM;
+	switch (acb->adapter_type) {
+	case ACB_ADAPTER_TYPE_A: {
+		roundup_ccbsize =
+		roundup(sizeof(struct CommandControlBlock) +
+		max_sg_entrys * sizeof(struct SG64ENTRY), 32);
+		acb->uncache_size = roundup_ccbsize *
+			ARCMSR_MAX_FREECCB_NUM;
+		dma_coherent = dma_alloc_coherent(&pdev->dev,
+			acb->uncache_size, &dma_coherent_handle,
+			GFP_KERNEL);
...
+	case ACB_ADAPTER_TYPE_B: {
+		roundup_ccbsize = roundup(sizeof(struct CommandControlBlock) +
+			(max_sg_entrys - 1) * sizeof(struct SG64ENTRY), 32);
+		acb->uncache_size = roundup_ccbsize *
+			ARCMSR_MAX_FREECCB_NUM;
+		dma_coherent = dma_alloc_coherent(&pdev->dev,
+			acb->uncache_size, &dma_coherent_handle,
+			GFP_KERNEL);
You've added a switch with  four almost identical
cases, what is the point of splitting the code this way?
-----------------------------------------
 struct AdapterControlBlock
+	void *dma_coherent;
+	dma_addr_t dma_coherent_handle;
+	dma_addr_t dma_coherent_handle2;
+	void *dma_coherent2;
why do you need these pairs? Is there an adapter which uses both
for example dma_coherent and dma_coherent2 at the same time?

Please include the patch into the message body next time, it makes the review easier.
Thanks, Tomas 
 


  parent reply	other threads:[~2013-08-26 12:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-26  4:14 [PATCH 1/3] arcmsr: Support Areca new SATA Raid Adapter ARC1214/1224/1264/1284 黃清隆
2013-08-26 10:18 ` James Bottomley
2013-08-26 12:20 ` Tomas Henzl [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-08-26  4:12 黃清隆

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=521B482A.80908@redhat.com \
    --to=thenzl@redhat.com \
    --cc=billion@areca.com.tw \
    --cc=ching2048@areca.com.tw \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-kernel@vger.kernel.org \
    --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