Re: 2.6.22-rc3-mm1

Andrew Morton
2007-05-31T22:10:36Z

On Thu, 31 May 2007 16:13:38 +0100
Christoph Hellwig <hch@infradead.org> wrote:

> On Thu, May 31, 2007 at 08:35:13AM -0400, Jeff Garzik wrote:
> > Cornelia Huck wrote:
> > >On Thu, 31 May 2007 06:15:57 -0600,
> > >Matthew Wilcox <matthew@wil.cx> wrote:
> > >
> > >>On Thu, May 31, 2007 at 02:09:22PM +0200, Cornelia Huck wrote:
> > >>>I split those functions out into a new file. Builds on s390 and i386.
> > >>Why not just put #ifdef CONFIG_HAS_DMA / #endif around the pair of
> > >>functions? I don't see the need to add a new Kconfig symbol and a new
> > >>file for this.
> > >
> > >I prefer a new file over #ifdefs in c files. (New dma-dependent stuff
> > >would also have a place where it could go to.)
> > >
> > >But I'll do whatever ends up as consensus :)
> >
> > 50 lines isn't much need for a new file.
>
> The scsi core shouldn't know anything about dma mappings, so a separate
> file is a good idea just to keep the separation clean.

ok, let's go this way.

Cornelia, afaict your patch has no actual delendency upon Dan's
dma-mapping-prevent-dma-dependent-code-from-linking-on.patch, correct? If
so, I can merge it via James and then merge Dan's patch once James has
merged.

If there is a dependency then I guess I merge both into a single diff and
merge it all in one hit.

btw, this:

diff -puN include/scsi/scsi_cmnd.h~scsi-dont-build-scsi_dma_mapunmap-for-has_dma include/scsi/scsi_cmnd.h
--- a/include/scsi/scsi_cmnd.h~scsi-dont-build-scsi_dma_mapunmap-for-has_dma
+++ a/include/scsi/scsi_cmnd.h
@@ -135,8 +135,10 @@ extern void scsi_kunmap_atomic_sg(void *
extern struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *, gfp_t);
extern void scsi_free_sgtable(struct scatterlist *, int);

+#ifdef CONFIG_SCSI_DMA
extern int scsi_dma_map(struct scsi_cmnd *cmd);
extern void scsi_dma_unmap(struct scsi_cmnd *cmd);
+#endif

#define scsi_sg_count(cmd) ((cmd)->use_sg)
#define scsi_sglist(cmd) ((struct scatterlist *)(cmd)->request_buffer)

We don't really need the ifdefs here. If someone incorrectly calls these
functions then they'll get a link-time failure anyway. The downside of
removing these ifdefs is that they won't get a compile-time warning, but I
tend to think that this small cost is worth it.