[PATCH 04/12] mtd: move mtd_oob_mode_t to shared kernel/user space
Artem Bityutskiy
dedekind1 at gmail.com
Sun Sep 11 08:28:34 EDT 2011
On Sun, 2011-09-11 at 14:57 +0300, Artem Bityutskiy wrote:
> On Tue, 2011-08-30 at 18:45 -0700, Brian Norris wrote:
> > - mtd_oob_mode_t mode = ops->mode;
> > + uint8_t mode = ops->mode;
>
> ...
> > struct mtd_oob_ops {
> > - mtd_oob_mode_t mode;
> > + uint8_t mode;
> > size_t len;
> > size_t retlen;
> > size_t ooblen;
>
> It is good to use __u8 in ioctls for this field.
>
> But for internal usage there is no need to make it uint8_t, just use
> 'int' instead. All modern CPUs will anyway reserve 32 bits for this.
>
> And unnecessary usage of the 8-bits restriction only imposes more
> unnecessary limitations to the compiler/CPU. Using 'int' is instead
> making CPU/compiler use the native integer type.
I've actually amended your patch and used 'unsigned int mode' instead,
and pushed to my three. Please, complain and send new versions if you do
not like that.
> BTW, you may also re-arrange this data structure and make it 8-bytes
> smaller on 64-bit architectures. Indeed, it has 'size_t' and 'uint8_t *'
> fields, which are 64-bits, and it has one 'uint32_t ooboffs;',
> which is 32-bits and is also padded. If you put 'int mode' and 'uint32_t
> ooboffs' together, you'll save 2 paddings. But this is optional.
Did not do this, though.
Thanks!
--
Best Regards,
Artem Bityutskiy
More information about the linux-mtd
mailing list