From af6e8b42334c92b2dcbb93e79b0e7ba4f1d51bb4 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Tue, 28 Apr 2015 19:51:34 +0530 Subject: [PATCH] greybus: Explicitly mark structures as packed These structures are already marked as __packed, as these are enclosed within: #pragma pack(push, 1) #pragma pack(pop) Lets mark them __packed explicitly. Reviewed-by: Alex Elder Reviewed-by: Johan Hovold Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/greybus_manifest.h | 22 +++++++++------------- drivers/staging/greybus/svc_msg.h | 30 +++++++++++++----------------- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/drivers/staging/greybus/greybus_manifest.h b/drivers/staging/greybus/greybus_manifest.h index e855ada..90965766 100644 --- a/drivers/staging/greybus/greybus_manifest.h +++ b/drivers/staging/greybus/greybus_manifest.h @@ -13,8 +13,6 @@ #ifndef __GREYBUS_MANIFEST_H #define __GREYBUS_MANIFEST_H -#pragma pack(push, 1) - enum greybus_descriptor_type { GREYBUS_TYPE_INVALID = 0x00, GREYBUS_TYPE_INTERFACE = 0x01, @@ -77,7 +75,7 @@ struct greybus_descriptor_string { __u8 length; __u8 id; __u8 string[0]; -}; +} __packed; /* * An interface descriptor describes information about an interface as a whole, @@ -90,7 +88,7 @@ struct greybus_descriptor_interface { __u8 vendor_stringid; __u8 product_stringid; __le64 unique_id; -}; +} __packed; /* * An bundle descriptor defines an identification number and a class for @@ -114,7 +112,7 @@ struct greybus_descriptor_interface { struct greybus_descriptor_bundle { __u8 id; /* interface-relative id (0..) */ __u8 class; -}; +} __packed; /* * A CPort descriptor indicates the id of the bundle within the @@ -126,7 +124,7 @@ struct greybus_descriptor_cport { __u8 bundle; __le16 id; __u8 protocol_id; /* enum greybus_protocol */ -}; +} __packed; /* * A class descriptor defines functionality supplied by a module. @@ -134,12 +132,12 @@ struct greybus_descriptor_cport { */ struct greybus_descriptor_class { __u8 class; /* enum greybus_class_type */ -}; +} __packed; struct greybus_descriptor_header { __le16 size; __u8 type; /* enum greybus_descriptor_type */ -}; +} __packed; struct greybus_descriptor { struct greybus_descriptor_header header; @@ -150,19 +148,17 @@ struct greybus_descriptor { struct greybus_descriptor_cport cport; struct greybus_descriptor_class class; }; -}; +} __packed; struct greybus_manifest_header { __le16 size; __u8 version_major; __u8 version_minor; -}; +} __packed; struct greybus_manifest { struct greybus_manifest_header header; struct greybus_descriptor descriptors[0]; -}; - -#pragma pack(pop) +} __packed; #endif /* __GREYBUS_MANIFEST_H */ diff --git a/drivers/staging/greybus/svc_msg.h b/drivers/staging/greybus/svc_msg.h index cb7bb19..fadc1d7 100644 --- a/drivers/staging/greybus/svc_msg.h +++ b/drivers/staging/greybus/svc_msg.h @@ -13,8 +13,6 @@ #ifndef __SVC_MSG_H #define __SVC_MSG_H -#pragma pack(push, 1) - enum svc_function_id { SVC_FUNCTION_HANDSHAKE = 0x00, SVC_FUNCTION_UNIPRO_NETWORK_MANAGEMENT = 0x01, @@ -33,7 +31,7 @@ struct svc_msg_header { __u8 function_id; /* enum svc_function_id */ __u8 message_type; __le16 payload_length; -}; +} __packed; enum svc_function_handshake_type { SVC_HANDSHAKE_SVC_HELLO = 0x00, @@ -45,21 +43,21 @@ struct svc_function_handshake { __u8 version_major; __u8 version_minor; __u8 handshake_type; /* enum svc_function_handshake_type */ -}; +} __packed; struct svc_function_unipro_set_route { __u8 device_id; -}; +} __packed; struct svc_function_unipro_link_up { __u8 interface_id; /* Interface id within the Endo */ __u8 device_id; -}; +} __packed; struct svc_function_ap_id { __u8 interface_id; __u8 device_id; -}; +} __packed; enum svc_function_management_event { SVC_MANAGEMENT_AP_ID = 0x00, @@ -74,7 +72,7 @@ struct svc_function_unipro_management { struct svc_function_unipro_link_up link_up; struct svc_function_unipro_set_route set_route; }; -}; +} __packed; enum svc_function_hotplug_event { SVC_HOTPLUG_EVENT = 0x00, @@ -85,7 +83,7 @@ struct svc_function_hotplug { __u8 hotplug_event; /* enum svc_function_hotplug_event */ __u8 interface_id; /* Interface id within the Endo */ __u8 data[0]; -}; +} __packed; enum svc_function_power_type { SVC_POWER_BATTERY_STATUS = 0x00, @@ -104,10 +102,10 @@ struct svc_function_power_battery_status { __le16 charge_full; __le16 charge_now; __u8 status; /* enum svc_function_battery_status */ -}; +} __packed; struct svc_function_power_battery_status_request { -}; +} __packed; /* XXX * Each interface carries power, so it's possible these things @@ -121,7 +119,7 @@ struct svc_function_power { struct svc_function_power_battery_status status; struct svc_function_power_battery_status_request request; }; -}; +} __packed; enum svc_function_epm_command_type { SVC_EPM_ENABLE = 0x00, @@ -132,7 +130,7 @@ enum svc_function_epm_command_type { struct svc_function_epm { __u8 epm_command_type; /* enum svc_function_epm_command_type */ __u8 module_id; -}; +} __packed; enum svc_function_suspend_command_type { SVC_SUSPEND_FIXME_1 = 0x00, // FIXME @@ -143,7 +141,7 @@ enum svc_function_suspend_command_type { struct svc_function_suspend { __u8 suspend_command_type; /* enum function_suspend_command_type */ __u8 device_id; -}; +} __packed; struct svc_msg { struct svc_msg_header header; @@ -155,8 +153,6 @@ struct svc_msg { struct svc_function_epm epm; struct svc_function_suspend suspend; }; -}; - -#pragma pack(pop) +} __packed; #endif /* __SVC_MSG_H */ -- 2.7.4