* [PATCH 1/1] i2c: align i2c_device_id
@ 2008-05-19 13:18 Jiri Slaby
2008-05-19 13:40 ` Sam Ravnborg
2008-05-19 19:00 ` Jean Delvare
0 siblings, 2 replies; 5+ messages in thread
From: Jiri Slaby @ 2008-05-19 13:18 UTC (permalink / raw)
To: khali; +Cc: i2c, linux-kernel, Jiri Slaby
Align i2c_device_id.driver_data to 8 bytes to not fail on crossbuilds.
(Added in d2653e92732bd3911feff6bee5e23dbf959381db.)
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Jean Delvare <khali@linux-fr.org>
---
include/linux/mod_devicetable.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index a37db57..1fd03e7 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -384,7 +384,8 @@ struct virtio_device_id {
struct i2c_device_id {
char name[I2C_NAME_SIZE];
- kernel_ulong_t driver_data; /* Data private to the driver */
+ kernel_ulong_t driver_data /* Data private to the driver */
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
};
--
1.5.4.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] i2c: align i2c_device_id
2008-05-19 13:18 [PATCH 1/1] i2c: align i2c_device_id Jiri Slaby
@ 2008-05-19 13:40 ` Sam Ravnborg
2008-05-19 19:00 ` Jean Delvare
1 sibling, 0 replies; 5+ messages in thread
From: Sam Ravnborg @ 2008-05-19 13:40 UTC (permalink / raw)
To: Jiri Slaby; +Cc: khali, i2c, linux-kernel
On Mon, May 19, 2008 at 03:18:44PM +0200, Jiri Slaby wrote:
> Align i2c_device_id.driver_data to 8 bytes to not fail on crossbuilds.
>
> (Added in d2653e92732bd3911feff6bee5e23dbf959381db.)
>
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> Cc: Jean Delvare <khali@linux-fr.org>
> ---
> include/linux/mod_devicetable.h | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index a37db57..1fd03e7 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -384,7 +384,8 @@ struct virtio_device_id {
>
> struct i2c_device_id {
> char name[I2C_NAME_SIZE];
> - kernel_ulong_t driver_data; /* Data private to the driver */
> + kernel_ulong_t driver_data /* Data private to the driver */
> + __attribute__((aligned(sizeof(kernel_ulong_t))));
> };
Thanks Jiri.
Sam
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] i2c: align i2c_device_id
2008-05-19 13:18 [PATCH 1/1] i2c: align i2c_device_id Jiri Slaby
2008-05-19 13:40 ` Sam Ravnborg
@ 2008-05-19 19:00 ` Jean Delvare
2008-05-19 19:20 ` Jiri Slaby
1 sibling, 1 reply; 5+ messages in thread
From: Jean Delvare @ 2008-05-19 19:00 UTC (permalink / raw)
To: Jiri Slaby; +Cc: i2c, linux-kernel
Hi Jiri,
On Mon, 19 May 2008 15:18:44 +0200, Jiri Slaby wrote:
> Align i2c_device_id.driver_data to 8 bytes to not fail on crossbuilds.
>
> (Added in d2653e92732bd3911feff6bee5e23dbf959381db.)
>
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> Cc: Jean Delvare <khali@linux-fr.org>
> ---
> include/linux/mod_devicetable.h | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index a37db57..1fd03e7 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -384,7 +384,8 @@ struct virtio_device_id {
>
> struct i2c_device_id {
> char name[I2C_NAME_SIZE];
> - kernel_ulong_t driver_data; /* Data private to the driver */
> + kernel_ulong_t driver_data /* Data private to the driver */
> + __attribute__((aligned(sizeof(kernel_ulong_t))));
> };
>
Thanks for this patch, it's in my i2c tree now and will be sent to
Linus by the end of the week. I wasn't aware of this possible alignment
issue, sorry.
--
Jean Delvare
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] i2c: align i2c_device_id
2008-05-19 19:00 ` Jean Delvare
@ 2008-05-19 19:20 ` Jiri Slaby
2008-05-20 4:25 ` [i2c] " Trent Piepho
0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2008-05-19 19:20 UTC (permalink / raw)
To: Jean Delvare; +Cc: i2c, linux-kernel
On 05/19/2008 09:00 PM, Jean Delvare wrote:
> Hi Jiri,
Hi.
> Thanks for this patch, it's in my i2c tree now and will be sent to
> Linus by the end of the week. I wasn't aware of this possible alignment
> issue, sorry.
To be honest, neither I was until I hit it while testing hid bus (where I did
the same mistake). Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [i2c] [PATCH 1/1] i2c: align i2c_device_id
2008-05-19 19:20 ` Jiri Slaby
@ 2008-05-20 4:25 ` Trent Piepho
0 siblings, 0 replies; 5+ messages in thread
From: Trent Piepho @ 2008-05-20 4:25 UTC (permalink / raw)
To: Jiri Slaby; +Cc: Jean Delvare, i2c, linux-kernel
On Mon, 19 May 2008, Jiri Slaby wrote:
> On 05/19/2008 09:00 PM, Jean Delvare wrote:
> > Thanks for this patch, it's in my i2c tree now and will be sent to
> > Linus by the end of the week. I wasn't aware of this possible alignment
> > issue, sorry.
>
> To be honest, neither I was until I hit it while testing hid bus (where I did
> the same mistake). Thanks.
Is there any more information about this? Items in a structure should be
aligned to the alignment required by their type. Usually sizeof(x) ==
alignof(x), but not always.
I guess in this case the structures are used as a cross-platform binary on
disk representation, and so the alignment of the build host must match the
alignment of the target?
Maybe it would be better to include the alignment attribute in the
definition of kernel_ulong_t?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-05-20 4:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-19 13:18 [PATCH 1/1] i2c: align i2c_device_id Jiri Slaby
2008-05-19 13:40 ` Sam Ravnborg
2008-05-19 19:00 ` Jean Delvare
2008-05-19 19:20 ` Jiri Slaby
2008-05-20 4:25 ` [i2c] " Trent Piepho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox