linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] TPM: Switch to __packed instead of __attribute__((packed))
@ 2012-11-21 20:56 Jason Gunthorpe
  2012-11-21 22:50 ` Peter Huewe
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2012-11-21 20:56 UTC (permalink / raw)
  To: Peter H?we; +Cc: Peter.Huewe, key, linux-kernel, tpmdd-devel

This seems to be preferred these days.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
 drivers/char/tpm/tpm.h |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

As discussed with Peter.

diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index c20fa8d..7d05ced 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -157,13 +157,13 @@ struct tpm_input_header {
 	__be16	tag;
 	__be32	length;
 	__be32	ordinal;
-}__attribute__((packed));
+} __packed;
 
 struct tpm_output_header {
 	__be16	tag;
 	__be32	length;
 	__be32	return_code;
-}__attribute__((packed));
+} __packed;
 
 struct	stclear_flags_t {
 	__be16	tag;
@@ -172,14 +172,14 @@ struct	stclear_flags_t {
 	u8	physicalPresence;
 	u8	physicalPresenceLock;
 	u8	bGlobalLock;
-}__attribute__((packed));
+} __packed;
 
 struct	tpm_version_t {
 	u8	Major;
 	u8	Minor;
 	u8	revMajor;
 	u8	revMinor;
-}__attribute__((packed));
+} __packed;
 
 struct	tpm_version_1_2_t {
 	__be16	tag;
@@ -187,20 +187,20 @@ struct	tpm_version_1_2_t {
 	u8	Minor;
 	u8	revMajor;
 	u8	revMinor;
-}__attribute__((packed));
+} __packed;
 
 struct	timeout_t {
 	__be32	a;
 	__be32	b;
 	__be32	c;
 	__be32	d;
-}__attribute__((packed));
+} __packed;
 
 struct duration_t {
 	__be32	tpm_short;
 	__be32	tpm_medium;
 	__be32	tpm_long;
-}__attribute__((packed));
+} __packed;
 
 struct permanent_flags_t {
 	__be16	tag;
@@ -224,7 +224,7 @@ struct permanent_flags_t {
 	u8	tpmEstablished;
 	u8	maintenanceDone;
 	u8	disableFullDALogicInfo;
-}__attribute__((packed));
+} __packed;
 
 typedef union {
 	struct	permanent_flags_t perm_flags;
@@ -242,12 +242,12 @@ struct	tpm_getcap_params_in {
 	__be32	cap;
 	__be32	subcap_size;
 	__be32	subcap;
-}__attribute__((packed));
+} __packed;
 
 struct	tpm_getcap_params_out {
 	__be32	cap_size;
 	cap_t	cap;
-}__attribute__((packed));
+} __packed;
 
 struct	tpm_readpubek_params_out {
 	u8	algorithm[4];
@@ -258,7 +258,7 @@ struct	tpm_readpubek_params_out {
 	__be32	keysize;
 	u8	modulus[256];
 	u8	checksum[20];
-}__attribute__((packed));
+} __packed;
 
 typedef union {
 	struct	tpm_input_header in;
@@ -268,16 +268,16 @@ typedef union {
 #define TPM_DIGEST_SIZE 20
 struct tpm_pcrread_out {
 	u8	pcr_result[TPM_DIGEST_SIZE];
-}__attribute__((packed));
+} __packed;
 
 struct tpm_pcrread_in {
 	__be32	pcr_idx;
-}__attribute__((packed));
+} __packed;
 
 struct tpm_pcrextend_in {
 	__be32	pcr_idx;
 	u8	hash[TPM_DIGEST_SIZE];
-}__attribute__((packed));
+} __packed;
 
 /* 128 bytes is an arbitrary cap. This could be as large as TPM_BUFSIZE - 18
  * bytes, but 128 is still a relatively large number of random bytes and
@@ -288,11 +288,11 @@ struct tpm_pcrextend_in {
 struct tpm_getrandom_out {
 	__be32 rng_data_len;
 	u8     rng_data[TPM_MAX_RNG_DATA];
-}__attribute__((packed));
+} __packed;
 
 struct tpm_getrandom_in {
 	__be32 num_bytes;
-}__attribute__((packed));
+} __packed;
 
 struct tpm_startup_in {
 	__be16	startup_type;
@@ -314,7 +314,7 @@ typedef union {
 struct tpm_cmd_t {
 	tpm_cmd_header	header;
 	tpm_cmd_params	params;
-}__attribute__((packed));
+} __packed;
 
 ssize_t	tpm_getcap(struct device *, __be32, cap_t *, const char *);
 
-- 
1.7.5.4


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

* Re: [PATCH] TPM: Switch to __packed instead of __attribute__((packed))
  2012-11-21 20:56 [PATCH] TPM: Switch to __packed instead of __attribute__((packed)) Jason Gunthorpe
@ 2012-11-21 22:50 ` Peter Huewe
  2012-11-26 20:23   ` Kent Yoder
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Huewe @ 2012-11-21 22:50 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Peter.Huewe, key, linux-kernel, tpmdd-devel

Am Mittwoch, 21. November 2012, 21:56:45 schrieb Jason Gunthorpe:
> This seems to be preferred these days.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Looks good to me
Reviewed-by: Peter Huewe <peterhuewe@gmx.de>

Thanks,
Peter

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

* Re: [PATCH] TPM: Switch to __packed instead of __attribute__((packed))
  2012-11-21 22:50 ` Peter Huewe
@ 2012-11-26 20:23   ` Kent Yoder
  2012-11-26 20:30     ` Jason Gunthorpe
  0 siblings, 1 reply; 4+ messages in thread
From: Kent Yoder @ 2012-11-26 20:23 UTC (permalink / raw)
  To: Peter Huewe; +Cc: Jason Gunthorpe, Peter.Huewe, linux-kernel, tpmdd-devel

On Wed, Nov 21, 2012 at 11:50:24PM +0100, Peter Huewe wrote:
> Am Mittwoch, 21. November 2012, 21:56:45 schrieb Jason Gunthorpe:
> > This seems to be preferred these days.
> > 
> > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> 
> Looks good to me
> Reviewed-by: Peter Huewe <peterhuewe@gmx.de>

Applied. I also rolled in an update to tpm_acpi.c to this commit:

diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c
index 56051d0..64420b3 100644
--- a/drivers/char/tpm/tpm_acpi.c
+++ b/drivers/char/tpm/tpm_acpi.c
@@ -33,13 +33,13 @@ struct acpi_tcpa {
 	u16 platform_class;
 	union {
 		struct client_hdr {
-			u32 log_max_len __attribute__ ((packed));
-			u64 log_start_addr __attribute__ ((packed));
+			u32 log_max_len __packed;
+			u64 log_start_addr __packed;
 		} client;
 		struct server_hdr {
 			u16 reserved;
-			u64 log_max_len __attribute__ ((packed));
-			u64 log_start_addr __attribute__ ((packed));
+			u64 log_max_len __packed;
+			u64 log_start_addr __packed;
 		} server;
 	};
 };

Thanks,
Kent

> Thanks,
> Peter
> 


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

* Re: [PATCH] TPM: Switch to __packed instead of __attribute__((packed))
  2012-11-26 20:23   ` Kent Yoder
@ 2012-11-26 20:30     ` Jason Gunthorpe
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2012-11-26 20:30 UTC (permalink / raw)
  To: Kent Yoder; +Cc: Peter Huewe, Peter.Huewe, linux-kernel, tpmdd-devel

On Mon, Nov 26, 2012 at 02:23:56PM -0600, Kent Yoder wrote:
> On Wed, Nov 21, 2012 at 11:50:24PM +0100, Peter Huewe wrote:
> > Am Mittwoch, 21. November 2012, 21:56:45 schrieb Jason Gunthorpe:
> > > This seems to be preferred these days.
> > > 
> > > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> > 
> > Looks good to me
> > Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
> 
> Applied. I also rolled in an update to tpm_acpi.c to this commit:
> 
> diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c
> index 56051d0..64420b3 100644
> +++ b/drivers/char/tpm/tpm_acpi.c
> @@ -33,13 +33,13 @@ struct acpi_tcpa {
>  	u16 platform_class;
>  	union {
>  		struct client_hdr {
> -			u32 log_max_len __attribute__ ((packed));
> -			u64 log_start_addr __attribute__ ((packed));
> +			u32 log_max_len __packed;
> +			u64 log_start_addr __packed;
>  		} client;
>  		struct server_hdr {
>  			u16 reserved;
> -			u64 log_max_len __attribute__ ((packed));
> -			u64 log_start_addr __attribute__ ((packed));
> +			u64 log_max_len __packed;
> +			u64 log_start_addr __packed;
>  		} server;
>  	};
>  };

Thanks, I looked at those as well, but I couldn't grok the
intent. What does __packed on a member even do??

Certainly client_hdr should be moved to the struct, maybe server_hdr
too?

Jason

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

end of thread, other threads:[~2012-11-26 20:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-21 20:56 [PATCH] TPM: Switch to __packed instead of __attribute__((packed)) Jason Gunthorpe
2012-11-21 22:50 ` Peter Huewe
2012-11-26 20:23   ` Kent Yoder
2012-11-26 20:30     ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).