public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] i2c: align i2c_device_id
@ 2008-05-19 13:18 Jiri Slaby
       [not found] ` <1211203124-3096-1-git-send-email-jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  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-PUYAD+kWke1g9hUCZPvPmw
  Cc: Jiri Slaby, i2c-GZX6beZjE8VD60Wz+7aTrA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Align i2c_device_id.driver_data to 8 bytes to not fail on crossbuilds.

(Added in d2653e92732bd3911feff6bee5e23dbf959381db.)

Signed-off-by: Jiri Slaby <jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.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


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] i2c: align i2c_device_id
       [not found] ` <1211203124-3096-1-git-send-email-jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2008-05-19 13:40   ` Sam Ravnborg
  0 siblings, 0 replies; 5+ messages in thread
From: Sam Ravnborg @ 2008-05-19 13:40 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: i2c-GZX6beZjE8VD60Wz+7aTrA, linux-kernel-u79uwXL29TY76Z2rM5mHXA

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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.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

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ 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
       [not found] ` <1211203124-3096-1-git-send-email-jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 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
     [not found] ` <1211203124-3096-1-git-send-email-jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
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