From: Greg KH <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
To: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Cc: Andreas Werner <andreas.werner-csrFAY9JiS4@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
johannes.thumshirn-csrFAY9JiS4@public.gmane.org
Subject: Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Date: Thu, 16 Oct 2014 11:34:14 +0200 [thread overview]
Message-ID: <20141016093414.GA25214@kroah.com> (raw)
In-Reply-To: <20141016085835.GA1273@katana>
On Thu, Oct 16, 2014 at 10:58:35AM +0200, Wolfram Sang wrote:
> > +struct eeprom_data {
> > + uint8_t eeprod_id;
> > +
> > + uint8_t revision[3];
> > + uint32_t serialnr;
> > + uint8_t board_model;
> > + char hw_name[6];
> > +
> > + uint8_t reserved;
> > +
> > + __be16 prod_date;
> > + __be16 rep_date;
> > +
> > + uint8_t reserved2[4];
> > +};
>
> And what if the compiler reorders?
It's not allowed to reorder, but it can add padding wherever it wants
to, which if this is a on-device structure, can cause problems. Use
__packed to prevent that.
thanks,
greg k-h
WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <gregkh@linuxfoundation.org>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Andreas Werner <andreas.werner@men.de>,
linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
johannes.thumshirn@men.de
Subject: Re: [PATCH 1/2] drivers/misc/eeprom/men_eeprod: Introduce MEN Board Information EEPROM driver
Date: Thu, 16 Oct 2014 11:34:14 +0200 [thread overview]
Message-ID: <20141016093414.GA25214@kroah.com> (raw)
In-Reply-To: <20141016085835.GA1273@katana>
On Thu, Oct 16, 2014 at 10:58:35AM +0200, Wolfram Sang wrote:
> > +struct eeprom_data {
> > + uint8_t eeprod_id;
> > +
> > + uint8_t revision[3];
> > + uint32_t serialnr;
> > + uint8_t board_model;
> > + char hw_name[6];
> > +
> > + uint8_t reserved;
> > +
> > + __be16 prod_date;
> > + __be16 rep_date;
> > +
> > + uint8_t reserved2[4];
> > +};
>
> And what if the compiler reorders?
It's not allowed to reorder, but it can add padding wherever it wants
to, which if this is a on-device structure, can cause problems. Use
__packed to prevent that.
thanks,
greg k-h
next prev parent reply other threads:[~2014-10-16 9:34 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-16 8:14 [PATCH 0/2] Introduce MEN Board Information EEPROM driver Andreas Werner
2014-10-16 8:14 ` Andreas Werner
2014-10-16 8:15 ` [PATCH 1/2] drivers/misc/eeprom/men_eeprod: " Andreas Werner
2014-10-16 8:15 ` Andreas Werner
[not found] ` <d169930cfe45d4c05c79f7dd00471d732441529d.1413416105.git.andreas.werner-csrFAY9JiS4@public.gmane.org>
2014-10-16 8:44 ` Greg KH
2014-10-16 8:44 ` Greg KH
2014-10-16 10:11 ` Andreas Werner
2014-10-16 10:11 ` Andreas Werner
2014-10-16 8:58 ` Wolfram Sang
2014-10-16 8:58 ` Wolfram Sang
2014-10-16 9:34 ` Greg KH [this message]
2014-10-16 9:34 ` Greg KH
[not found] ` <20141016093414.GA25214-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2014-10-16 9:48 ` Wolfram Sang
2014-10-16 9:48 ` Wolfram Sang
2014-10-16 10:21 ` Andreas Werner
2014-10-16 10:21 ` Andreas Werner
2014-10-16 9:59 ` Wolfram Sang
2014-10-16 11:44 ` Andreas Werner
2014-10-16 11:44 ` Andreas Werner
2014-10-20 8:18 ` Wolfram Sang
2014-10-20 8:18 ` Wolfram Sang
2014-10-20 8:24 ` Wolfram Sang
2014-10-20 10:04 ` Andreas Werner
2014-10-20 10:04 ` Andreas Werner
2014-10-20 8:33 ` Andreas Werner
2014-10-20 8:33 ` Andreas Werner
2014-10-20 9:11 ` Greg KH
[not found] ` <20141020091141.GA15332-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2014-10-20 10:09 ` Andreas Werner
2014-10-20 10:09 ` Andreas Werner
2014-10-21 6:57 ` Igor Grinberg
2014-10-21 6:57 ` Igor Grinberg
2014-10-16 8:15 ` [PATCH 2/2] Documentation/ABI/testing/men_eeprod: Added sysfs description for men_eeprod Andreas Werner
2014-10-16 8:15 ` Andreas Werner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141016093414.GA25214@kroah.com \
--to=gregkh-hqyy1w1ycw8ekmwlsbkhg0b+6bgklq7r@public.gmane.org \
--cc=andreas.werner-csrFAY9JiS4@public.gmane.org \
--cc=johannes.thumshirn-csrFAY9JiS4@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.