* [PATCH] bt8xx: unaligned access
@ 2008-05-21 0:32 Al Viro
2008-05-21 0:38 ` Harvey Harrison
0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2008-05-21 0:32 UTC (permalink / raw)
To: mchehab; +Cc: linux-kernel, torvalds
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
drivers/media/video/bt8xx/bttv-cards.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index f20a01c..8ef0424 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -34,6 +34,7 @@
#include <linux/firmware.h>
#include <net/checksum.h>
+#include <asm/unaligned.h>
#include <asm/io.h>
#include "bttvp.h"
@@ -3858,7 +3859,7 @@ static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256])
ee += i;
/* found a valid descriptor */
- type = be16_to_cpup((u16*)(ee+4));
+ type = get_unaligned_be16((__be16 *)(ee+4));
switch(type) {
/* 848 based */
@@ -3918,7 +3919,7 @@ static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256])
btv->c.nr, type);
break;
}
- serial = be32_to_cpup((u32*)(ee+6));
+ serial = get_unaligned_be32((__be32 *)(ee+6));
}
printk(KERN_INFO "bttv%d: osprey eeprom: card=%d '%s' serial=%u\n",
--
1.5.3.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] bt8xx: unaligned access
2008-05-21 0:32 [PATCH] bt8xx: unaligned access Al Viro
@ 2008-05-21 0:38 ` Harvey Harrison
2008-05-21 0:43 ` Al Viro
0 siblings, 1 reply; 4+ messages in thread
From: Harvey Harrison @ 2008-05-21 0:38 UTC (permalink / raw)
To: Al Viro; +Cc: mchehab, linux-kernel, torvalds
On Wed, 2008-05-21 at 01:32 +0100, Al Viro wrote:
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> drivers/media/video/bt8xx/bttv-cards.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
> index f20a01c..8ef0424 100644
> --- a/drivers/media/video/bt8xx/bttv-cards.c
> +++ b/drivers/media/video/bt8xx/bttv-cards.c
> @@ -34,6 +34,7 @@
> #include <linux/firmware.h>
> #include <net/checksum.h>
>
> +#include <asm/unaligned.h>
> #include <asm/io.h>
>
> #include "bttvp.h"
> @@ -3858,7 +3859,7 @@ static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256])
> ee += i;
>
> /* found a valid descriptor */
> - type = be16_to_cpup((u16*)(ee+4));
> + type = get_unaligned_be16((__be16 *)(ee+4));
The casts aren't strictly necessary here. Any reason to keep it?
>
> switch(type) {
> /* 848 based */
> @@ -3918,7 +3919,7 @@ static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256])
> btv->c.nr, type);
> break;
> }
> - serial = be32_to_cpup((u32*)(ee+6));
> + serial = get_unaligned_be32((__be32 *)(ee+6));
Ditto.
Cheers,
Harvey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bt8xx: unaligned access
2008-05-21 0:38 ` Harvey Harrison
@ 2008-05-21 0:43 ` Al Viro
2008-05-21 0:45 ` Harvey Harrison
0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2008-05-21 0:43 UTC (permalink / raw)
To: Harvey Harrison; +Cc: Al Viro, mchehab, linux-kernel, torvalds
On Tue, May 20, 2008 at 05:38:43PM -0700, Harvey Harrison wrote:
> > - type = be16_to_cpup((u16*)(ee+4));
> > + type = get_unaligned_be16((__be16 *)(ee+4));
>
> The casts aren't strictly necessary here. Any reason to keep it?
I'd rather have them explicit *and* make get_unaligned_* take the pointer
of right type, so that it'd eat things like void * and __be16 *, but warn
on int * et.al. One too many brainos seen in that area...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bt8xx: unaligned access
2008-05-21 0:43 ` Al Viro
@ 2008-05-21 0:45 ` Harvey Harrison
0 siblings, 0 replies; 4+ messages in thread
From: Harvey Harrison @ 2008-05-21 0:45 UTC (permalink / raw)
To: Al Viro; +Cc: Al Viro, mchehab, linux-kernel, torvalds
On Wed, 2008-05-21 at 01:43 +0100, Al Viro wrote:
> On Tue, May 20, 2008 at 05:38:43PM -0700, Harvey Harrison wrote:
> > > - type = be16_to_cpup((u16*)(ee+4));
> > > + type = get_unaligned_be16((__be16 *)(ee+4));
> >
> > The casts aren't strictly necessary here. Any reason to keep it?
>
> I'd rather have them explicit *and* make get_unaligned_* take the pointer
> of right type, so that it'd eat things like void * and __be16 *, but warn
> on int * et.al. One too many brainos seen in that area...
You want me to patch the unaligned guys to take typed pointers and
follow it through? Or do you mind?
Cheers,
Harvey
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-05-21 0:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21 0:32 [PATCH] bt8xx: unaligned access Al Viro
2008-05-21 0:38 ` Harvey Harrison
2008-05-21 0:43 ` Al Viro
2008-05-21 0:45 ` Harvey Harrison
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox