[Fwd: Re: [PATCH] 2/2 mtd: Add support for the Dreamcast VMU flash]
Adrian McMenamin
adrian at newgolddream.dyndns.info
Thu Mar 20 16:11:01 EDT 2008
On Thu, 2008-03-20 at 13:31 +0100, Jörn Engel wrote:
> On Thu, 20 March 2008 12:56:42 -0000, Adrian McMenamin wrote:
> > On Thu, March 20, 2008 11:20 am, Jörn Engel wrote:
> > > On Thu, 20 March 2008 11:56:54 -0000, Adrian McMenamin wrote:
> > >> >> +
> > >> >> + ((unsigned long *)sendbuf)[0] = cpu_to_be32(MAPLE_FUNC_MEMCARD);
> > >> >> + ((unsigned long *)sendbuf)[1] = cpu_to_be32(partition << 24 | num);
> > > So why do you use void* for data you actually dereference?
> >
> > Because for other devices data can be passed as 16 bit structures as well
> > as 32 bit ones.
>
> Hogwash! If you ever deal with 16bit structures here you have a bug.
> cpu_to_be32() only makes sense when actually dealing with __be32.
> Either your variable is and should be called __be32, or it isn't and you
> have a bug right in front of you.
You don't seem to have grasped that this is one type of device on a
proprietary bus which has other (types of) devices. I keep the code
consistent so that the API runs the same across the different devices -
makes the code easier to understand and maintain.
And given that this is also the variable that points to the memory block
that also includes the 8 bit based date that gets read in for block
writes I it makes perfect sense to have this as a void*.
More information about the linux-mtd
mailing list