public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <mzyngier@freesurf.fr>
To: Christoph Hellwig <hch@infradead.org>
Cc: James.Bottomley@steeleye.com, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] aha1740 update
Date: Thu, 03 Jul 2003 17:29:42 +0200	[thread overview]
Message-ID: <wrpadbviq6x.fsf@hina.wild-wind.fr.eu.org> (raw)
In-Reply-To: <20030703161335.A4558@infradead.org> (Christoph Hellwig's message of "Thu, 3 Jul 2003 16:13:36 +0100")

>>>>> "Christoph" == Christoph Hellwig <hch@infradead.org> writes:

Christoph> aha1740 is a newstyle driver and doesn't need a release
Christoph> method so this is bogus.

Ok, I was getting confused with all the different merge that occured
in this driver for the last few week.

Anyway, here is the latest patch, including fix for the very nice
locking bug Adrian just found.

Regards,

        M.

--- ../vanilla/linux-2.5/drivers/scsi/aha1740.c	2003-07-01 18:51:30.000000000 +0200
+++ linux-2.5/drivers/scsi/aha1740.c	2003-07-03 17:21:31.000000000 +0200
@@ -375,7 +375,7 @@
 #endif
 
 	/* locate an available ecb */
-	spin_lock_irqsave(&SCpnt->device->host->host_lock, flags);
+	spin_lock_irqsave(SCpnt->device->host->host_lock, flags);
 	ecbno = host->last_ecb_used + 1; /* An optimization */
 	if (ecbno >= AHA1740_ECBS)
 		ecbno = 0;
@@ -394,7 +394,7 @@
 						    doubles as reserved flag */
 
 	host->last_ecb_used = ecbno;    
-	spin_unlock_irqrestore(&SCpnt->device->host->host_lock, flags);
+	spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags);
 
 #ifdef DEBUG
 	printk("Sending command (%d %x)...", ecbno, done);
@@ -491,7 +491,7 @@
 		unsigned int base = SCpnt->device->host->io_port;
 		DEB(printk("aha1740[%d] critical section\n",ecbno));
 
-		spin_lock_irqsave(&SCpnt->device->host->host_lock, flags);
+		spin_lock_irqsave(SCpnt->device->host->host_lock, flags);
 		for (loopcnt = 0; ; loopcnt++) {
 			if (inb(G2STAT(base)) & G2STAT_MBXOUT) break;
 			if (loopcnt == LOOPCNT_WARN) {
@@ -511,7 +511,7 @@
 				panic("aha1740.c: attn wait failed!\n");
 		}
 		outb(ATTN_START | (target & 7), ATTN(base)); /* Start it up */
-		spin_unlock_irqrestore(&SCpnt->device->host->host_lock, flags);
+		spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags);
 		DEB(printk("aha1740[%d] request queued.\n",ecbno));
 	} else
 		printk(KERN_ALERT "aha1740_queuecommand: done can't be NULL\n");
@@ -594,7 +594,7 @@
 	if (!request_region(slotbase, SLOTSIZE, "aha1740")) /* See if in use */
 		return -EBUSY;
 	if (!aha1740_test_port(slotbase))
-		goto err_release;
+		goto err_release_region;
 	aha1740_getconfig(slotbase,&irq_level,&translation);
 	if ((inb(G2STAT(slotbase)) &
 	     (G2STAT_MBXOUT|G2STAT_BUSY)) != G2STAT_MBXOUT) {
@@ -609,7 +609,7 @@
 	shpnt = scsi_host_alloc(&aha1740_template,
 			      sizeof(struct aha1740_hostdata));
 	if(shpnt == NULL)
-		goto err_release;
+		goto err_release_region;
 
 	shpnt->base = 0;
 	shpnt->io_port = slotbase;
@@ -625,21 +625,26 @@
 	if (!host->ecb_dma_addr) {
 		printk (KERN_ERR "aha1740_probe: Couldn't map ECB, giving up\n");
 		scsi_unregister (shpnt);
-		goto err_release;
+		goto err_host_put;
 	}
 	
 	DEB(printk("aha1740_probe: enable interrupt channel %d\n",irq_level));
 	if (request_irq(irq_level,aha1740_intr_handle,0,"aha1740",shpnt)) {
 		printk(KERN_ERR "aha1740_probe: Unable to allocate IRQ %d.\n",
 		       irq_level);
-		goto err_release;
+		goto err_unmap;
 	}
 
 	eisa_set_drvdata (edev, shpnt);
 	scsi_add_host (shpnt, dev);
 	return 0;
 
- err_release:
+ err_unmap:
+	dma_unmap_single (&edev->dev, host->ecb_dma_addr,
+			  sizeof (host->ecb), DMA_BIDIRECTIONAL);
+ err_host_put:
+	scsi_host_put (shpnt);
+ err_release_region:
 	release_region(slotbase, SLOTSIZE);
 
 	return -ENODEV;

-- 
Places change, faces change. Life is so very strange.

  reply	other threads:[~2003-07-03 15:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-01 18:09 [PATCH] aha1740 update Marc Zyngier
2003-07-03 15:13 ` Christoph Hellwig
2003-07-03 15:29   ` Marc Zyngier [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-06-03 12:26 Marc Zyngier

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=wrpadbviq6x.fsf@hina.wild-wind.fr.eu.org \
    --to=mzyngier@freesurf.fr \
    --cc=James.Bottomley@steeleye.com \
    --cc=hch@infradead.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