LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] fix the broken annotations in fsldma
@ 2008-03-29 3:10 Al Viro
2008-03-29 14:02 ` Josh Boyer
0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2008-03-29 3:10 UTC (permalink / raw)
To: torvalds; +Cc: wei.zhang, linux-kernel
a) every bitwise declaration will give a unique type; use typedefs.
b) no need to bother with the stuff pointed to by iomem pointers, unless
it's accessed directly. noderef will force us to use helpers anyway.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
drivers/dma/fsldma.h | 47 +++++++++++++++++++++++++++--------------------
1 files changed, 27 insertions(+), 20 deletions(-)
diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h
index fddd6ae..6faf07b 100644
--- a/drivers/dma/fsldma.h
+++ b/drivers/dma/fsldma.h
@@ -75,12 +75,15 @@
#define FSL_DMA_DGSR_EOSI 0x02
#define FSL_DMA_DGSR_EOLSI 0x01
+typedef u64 __bitwise v64;
+typedef u32 __bitwise v32;
+
struct fsl_dma_ld_hw {
- u64 __bitwise src_addr;
- u64 __bitwise dst_addr;
- u64 __bitwise next_ln_addr;
- u32 __bitwise count;
- u32 __bitwise reserve;
+ v64 src_addr;
+ v64 dst_addr;
+ v64 next_ln_addr;
+ v32 count;
+ v32 reserve;
} __attribute__((aligned(32)));
struct fsl_desc_sw {
@@ -92,13 +95,13 @@ struct fsl_desc_sw {
} __attribute__((aligned(32)));
struct fsl_dma_chan_regs {
- u32 __bitwise mr; /* 0x00 - Mode Register */
- u32 __bitwise sr; /* 0x04 - Status Register */
- u64 __bitwise cdar; /* 0x08 - Current descriptor address register */
- u64 __bitwise sar; /* 0x10 - Source Address Register */
- u64 __bitwise dar; /* 0x18 - Destination Address Register */
- u32 __bitwise bcr; /* 0x20 - Byte Count Register */
- u64 __bitwise ndar; /* 0x24 - Next Descriptor Address Register */
+ u32 mr; /* 0x00 - Mode Register */
+ u32 sr; /* 0x04 - Status Register */
+ u64 cdar; /* 0x08 - Current descriptor address register */
+ u64 sar; /* 0x10 - Source Address Register */
+ u64 dar; /* 0x18 - Destination Address Register */
+ u32 bcr; /* 0x20 - Byte Count Register */
+ u64 ndar; /* 0x24 - Next Descriptor Address Register */
};
struct fsl_dma_chan;
@@ -151,25 +154,27 @@ struct fsl_dma_chan {
#ifndef __powerpc64__
static u64 in_be64(const u64 __iomem *addr)
{
- return ((u64)in_be32((u32 *)addr) << 32) | (in_be32((u32 *)addr + 1));
+ return ((u64)in_be32((u32 __iomem *)addr) << 32) |
+ (in_be32((u32 __iomem *)addr + 1));
}
static void out_be64(u64 __iomem *addr, u64 val)
{
- out_be32((u32 *)addr, val >> 32);
- out_be32((u32 *)addr + 1, (u32)val);
+ out_be32((u32 __iomem *)addr, val >> 32);
+ out_be32((u32 __iomem *)addr + 1, (u32)val);
}
/* There is no asm instructions for 64 bits reverse loads and stores */
static u64 in_le64(const u64 __iomem *addr)
{
- return ((u64)in_le32((u32 *)addr + 1) << 32) | (in_le32((u32 *)addr));
+ return ((u64)in_le32((u32 __iomem *)addr + 1) << 32) |
+ (in_le32((u32 __iomem *)addr));
}
static void out_le64(u64 __iomem *addr, u64 val)
{
- out_le32((u32 *)addr + 1, val >> 32);
- out_le32((u32 *)addr, (u32)val);
+ out_le32((u32 __iomem *)addr + 1, val >> 32);
+ out_le32((u32 __iomem *)addr, (u32)val);
}
#endif
@@ -182,9 +187,11 @@ static void out_le64(u64 __iomem *addr, u64 val)
#define DMA_TO_CPU(fsl_chan, d, width) \
(((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \
- be##width##_to_cpu(d) : le##width##_to_cpu(d))
+ be##width##_to_cpu((__force __be##width)(v##width)d) : \
+ le##width##_to_cpu((__force __le##width)(v##width)d))
#define CPU_TO_DMA(fsl_chan, c, width) \
(((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \
- cpu_to_be##width(c) : cpu_to_le##width(c))
+ (__force v##width)cpu_to_be##width(c) : \
+ (__force v##width)cpu_to_le##width(c))
#endif /* __DMA_FSLDMA_H */
--
1.5.3.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fix the broken annotations in fsldma
2008-03-29 3:10 [PATCH] fix the broken annotations in fsldma Al Viro
@ 2008-03-29 14:02 ` Josh Boyer
2008-03-29 18:38 ` Al Viro
0 siblings, 1 reply; 4+ messages in thread
From: Josh Boyer @ 2008-03-29 14:02 UTC (permalink / raw)
To: Al Viro; +Cc: torvalds, wei.zhang, linux-kernel
On Sat, 2008-03-29 at 03:10 +0000, Al Viro wrote:
> a) every bitwise declaration will give a unique type; use typedefs.
> b) no need to bother with the stuff pointed to by iomem pointers, unless
> it's accessed directly. noderef will force us to use helpers anyway.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> drivers/dma/fsldma.h | 47 +++++++++++++++++++++++++++--------------------
> 1 files changed, 27 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h
> index fddd6ae..6faf07b 100644
> --- a/drivers/dma/fsldma.h
> +++ b/drivers/dma/fsldma.h
> @@ -75,12 +75,15 @@
> #define FSL_DMA_DGSR_EOSI 0x02
> #define FSL_DMA_DGSR_EOLSI 0x01
>
> +typedef u64 __bitwise v64;
> +typedef u32 __bitwise v32;
> +
> struct fsl_dma_ld_hw {
> - u64 __bitwise src_addr;
> - u64 __bitwise dst_addr;
> - u64 __bitwise next_ln_addr;
> - u32 __bitwise count;
> - u32 __bitwise reserve;
> + v64 src_addr;
> + v64 dst_addr;
> + v64 next_ln_addr;
> + v32 count;
> + v32 reserve;
> } __attribute__((aligned(32)));
>
> struct fsl_desc_sw {
> @@ -92,13 +95,13 @@ struct fsl_desc_sw {
> } __attribute__((aligned(32)));
>
> struct fsl_dma_chan_regs {
> - u32 __bitwise mr; /* 0x00 - Mode Register */
> - u32 __bitwise sr; /* 0x04 - Status Register */
> - u64 __bitwise cdar; /* 0x08 - Current descriptor address register */
> - u64 __bitwise sar; /* 0x10 - Source Address Register */
> - u64 __bitwise dar; /* 0x18 - Destination Address Register */
> - u32 __bitwise bcr; /* 0x20 - Byte Count Register */
> - u64 __bitwise ndar; /* 0x24 - Next Descriptor Address Register */
> + u32 mr; /* 0x00 - Mode Register */
> + u32 sr; /* 0x04 - Status Register */
> + u64 cdar; /* 0x08 - Current descriptor address register */
> + u64 sar; /* 0x10 - Source Address Register */
> + u64 dar; /* 0x18 - Destination Address Register */
> + u32 bcr; /* 0x20 - Byte Count Register */
> + u64 ndar; /* 0x24 - Next Descriptor Address Register */
> };
Did you forget to do the s/u{32,64}/v{32,64}/ conversion for this
struct, or am I just a moron?
josh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fix the broken annotations in fsldma
2008-03-29 14:02 ` Josh Boyer
@ 2008-03-29 18:38 ` Al Viro
2008-03-31 2:12 ` Zhang Wei
0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2008-03-29 18:38 UTC (permalink / raw)
To: Josh Boyer; +Cc: Al Viro, torvalds, wei.zhang, linux-kernel
On Sat, Mar 29, 2008 at 09:02:02AM -0500, Josh Boyer wrote:
> On Sat, 2008-03-29 at 03:10 +0000, Al Viro wrote:
> > a) every bitwise declaration will give a unique type; use typedefs.
> > b) no need to bother with the stuff pointed to by iomem pointers, unless
> > it's accessed directly. noderef will force us to use helpers anyway.
> Did you forget to do the s/u{32,64}/v{32,64}/ conversion for this
> struct, or am I just a moron?
See (b) above.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] fix the broken annotations in fsldma
2008-03-29 18:38 ` Al Viro
@ 2008-03-31 2:12 ` Zhang Wei
0 siblings, 0 replies; 4+ messages in thread
From: Zhang Wei @ 2008-03-31 2:12 UTC (permalink / raw)
To: Al Viro, Josh Boyer; +Cc: Al Viro, torvalds, linux-kernel
Hi,
> -----Original Message-----
> From: Al Viro [mailto:viro@ftp.linux.org.uk] On Behalf Of Al Viro
>
> On Sat, Mar 29, 2008 at 09:02:02AM -0500, Josh Boyer wrote:
> > On Sat, 2008-03-29 at 03:10 +0000, Al Viro wrote:
> > > a) every bitwise declaration will give a unique type; use
> typedefs.
> > > b) no need to bother with the stuff pointed to by iomem
> pointers, unless
> > > it's accessed directly. noderef will force us to use
> helpers anyway.
>
> > Did you forget to do the s/u{32,64}/v{32,64}/ conversion for this
> > struct, or am I just a moron?
>
> See (b) above.
>
Do you mean if we do it with a known 'force' casting, we do not need the
compiler check's help?
Thanks!
Wei.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-31 2:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-29 3:10 [PATCH] fix the broken annotations in fsldma Al Viro
2008-03-29 14:02 ` Josh Boyer
2008-03-29 18:38 ` Al Viro
2008-03-31 2:12 ` Zhang Wei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).