All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Matthew Wilcox <matthew@wil.cx>, parisc-linux@thepuffingroup.com
Subject: Re: [parisc-linux] ZONE_DMA
Date: Mon, 1 Jan 2001 19:18:48 +0000	[thread overview]
Message-ID: <20010101191848.B25603@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <E14DACv-0001Bg-00@the-village.bc.nu>; from alan@lxorguk.ukuu.org.uk on Mon, Jan 01, 2001 at 07:01:19PM +0000

On Mon, Jan 01, 2001 at 07:01:19PM +0000, Alan Cox wrote:
> > But if we have none, then all GFP_DMA allocations will fail.  Which
> > includes the scsi midlayers.  Ooh, I just noticed that scsi_scan.c
> > is broken...  expect a patch RSN.
> 
> SCSI may need fixing, but do you want to do it right 8)

I don't think I have time to do that :-)

Here's a patch which makes it slightly better.  Justifications:
 * changed GFP_DMA to GFP_KERNEL | GFP_DMA since GFP_DMA alone is nonsense.
 * got rid of the ?: since it's pure obfuscation in this case.
 * changed &scsi_result0[0] to scsi_result0.  again, sheer obfuscation.

just peering at this little bit makes me realise how large the scsi
problems must be :-)

It compiles.  I promise no more.

Index: drivers/scsi/scsi_scan.c
===================================================================
RCS file: /var/cvs/linux/drivers/scsi/scsi_scan.c,v
retrieving revision 1.1.1.1
diff -u -p -u -r1.1.1.1 scsi_scan.c
--- drivers/scsi/scsi_scan.c	2000/09/19 15:01:34	1.1.1.1
+++ drivers/scsi/scsi_scan.c	2001/01/01 19:09:43
@@ -288,8 +288,11 @@ void scan_scsis(struct Scsi_Host *shpnt,
 		scsi_initialize_queue(SDpnt, shpnt);
 		SDpnt->request_queue.queuedata = (void *) SDpnt;
 		/* Make sure we have something that is valid for DMA purposes */
-		scsi_result = ((!shpnt->unchecked_isa_dma)
-			       ? &scsi_result0[0] : kmalloc(512, GFP_DMA));
+		if (shpnt->unchecked_isa_dma) {
+			scsi_result = kmalloc(512, GFP_KERNEL | GFP_DMA);
+		} else {
+			scsi_result = scsi_result0;
+		}
 	}
 
 	if (scsi_result == NULL) {
@@ -411,7 +414,7 @@ void scan_scsis(struct Scsi_Host *shpnt,
 		}		/* for channel ends */
 	}			/* if/else hardcoded */
 
-      leave:
+ leave:
 
 	{			/* Unchain SRpnt from host_queue */
 		Scsi_Device *prev, *next;
@@ -438,7 +441,7 @@ void scan_scsis(struct Scsi_Host *shpnt,
 	}
 
 	/* If we allocated a buffer so we could do DMA, free it now */
-	if (scsi_result != &scsi_result0[0] && scsi_result != NULL) {
+	if (scsi_result != scsi_result0 && scsi_result != NULL) {
 		kfree(scsi_result);
 	} {
 		Scsi_Device *sdev;

-- 
Revolutions do not require corporate support.

  reply	other threads:[~2001-01-01 19:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-01 17:43 [parisc-linux] ZONE_DMA Matthew Wilcox
2001-01-01 18:09 ` Alan Cox
2001-01-01 18:24   ` Matthew Wilcox
2001-01-01 18:32     ` Alan Cox
2001-01-01 18:55       ` Matthew Wilcox
2001-01-01 19:01         ` Alan Cox
2001-01-01 19:18           ` Matthew Wilcox [this message]
2001-01-02  0:59   ` Grant Grundler
2001-01-02  1:21     ` Matthew Wilcox
2001-01-02  6:46       ` Grant Grundler

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=20010101191848.B25603@parcelfarce.linux.theplanet.co.uk \
    --to=matthew@wil.cx \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=parisc-linux@thepuffingroup.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.