[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070328161420.3c8f9688.akpm@linux-foundation.org>
Date: Wed, 28 Mar 2007 16:14:20 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Zach Brown <zach.brown@...cle.com>
Cc: Ken Chen <kenchen@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [patch] cache pipe buf page address for non-highmem arch
On Tue, 27 Mar 2007 15:57:53 -0700
Zach Brown <zach.brown@...cle.com> wrote:
> > +#define pipe_kmap_atomic(page, type) pipe_kmap(page)
> > +#define pipe_kunmap(page) do { } while (0)
> > +#define pipe_kunmap_atomic(page, type) do { } while (0)
>
> Please don't drop arguments in stubs. It can let completely broken
> code compile, like:
>
> pipe_kunmap(SOME_COMPLETE_NONSENSE);
>
> Static inlines with empty bodies are the gold standard.
>
yup.
<fiddle, fiddle>
Does this look OK?
#ifdef CONFIG_HIGHMEM
static inline void *pipe_kmap(struct page *page)
{
return kmap(page);
}
static inline void pipe_kunmap(struct page *page)
{
kunmap(page);
}
static inline void *pipe_kmap_atomic(struct page *page, enum km_type type)
{
return kmap_atomic(page, type);
}
static inline void pipe_kunmap_atomic(void *addr, enum km_type type)
{
kunmap_atomic(addr, type);
}
#else /* CONFIG_HIGHMEM */
static inline void *pipe_kmap(struct page *page)
{
return (void *)page->private;
}
static inline void pipe_kunmap(struct page *page)
{
}
static inline void *pipe_kmap_atomic(struct page *page, enum km_type type)
{
return (void *)page->private;
}
static inline void pipe_kunmap_atomic(struct page *page, enum km_type type)
{
}
#endif
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists