* [PATCH] block: Turn bvec_k{un,}map_irq() into static inline functions
@ 2010-10-17 11:38 Geert Uytterhoeven
2010-10-17 18:06 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2010-10-17 11:38 UTC (permalink / raw)
To: Jens Axboe
Cc: Dan Carpenter, kernel-janitors, Linux Kernel Development, cbe-oss-dev
Convert bvec_k{un,}map_irq() from macros to static inline functions if
!CONFIG_HIGHMEM, so we can easier detect mistakes like the one fixed in
93055c31045a2d5599ec613a0c6cdcefc481a460 ("ps3disk: passing wrong variable to
bvec_kunmap_irq()")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Compile-tested on m68k only. Not on ppc64 with the old ps3disk.
include/linux/bio.h | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 5274103..fa5d49e 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -346,8 +346,15 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
}
#else
-#define bvec_kmap_irq(bvec, flags) (page_address((bvec)->bv_page) + (bvec)->bv_offset)
-#define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0)
+static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
+{
+ return page_address(bvec->bv_page) + bvec->bv_offset;
+}
+
+static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
+{
+ *flags = 0;
+}
#endif
static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
--
1.7.0.4
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] block: Turn bvec_k{un,}map_irq() into static inline functions
2010-10-17 11:38 [PATCH] block: Turn bvec_k{un,}map_irq() into static inline functions Geert Uytterhoeven
@ 2010-10-17 18:06 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2010-10-17 18:06 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Dan Carpenter, kernel-janitors, Linux Kernel Development, cbe-oss-dev
On 2010-10-17 13:38, Geert Uytterhoeven wrote:
> Convert bvec_k{un,}map_irq() from macros to static inline functions if
> !CONFIG_HIGHMEM, so we can easier detect mistakes like the one fixed in
> 93055c31045a2d5599ec613a0c6cdcefc481a460 ("ps3disk: passing wrong variable to
> bvec_kunmap_irq()")
Does this cause any warnings on the existing kernel? It's the same issue
we have with the kunmap_atomic() API, and they are generally used to map
structures etc as well. So char * isn't necessarily always a good
choice, and hence the "fix" there is to just check whether a page struct
is being passed in or not.
OK, so did a quick grep, and there's just the two users of it. So pretty
straight forward, I'll add your patch. Thanks!
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-17 18:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-17 11:38 [PATCH] block: Turn bvec_k{un,}map_irq() into static inline functions Geert Uytterhoeven
2010-10-17 18:06 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome