Skip to contentSkip to conversation

staging: ft1000: convert pack pragma to __packed__ attribute

PATCH Superseded Giedrius Statkevičius 2 participants 2 messages Jun 22, 2015 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: ft1000: convert pack pragma to __packed__ attribute

Convert a Microsoft compiler specific directive "#pragma pack(1)" to a GCC equivalent __attribute__ ((__packed__)). Also, by doing this we save ourselves from trouble if any other struct definitions are added after the #pragma because it will be applied to all of the definitions following it.

---
 drivers/staging/ft1000/ft1000-usb/ft1000_download.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/ft1000/ft1000-usb/ft1000_download.c +1 -2
index 5def347..345c256 100644
@@ -95,7 +95,6 @@ struct dsp_file_hdr {
 	long              nDspImages;          /* Number of DSP images in file. */
 };
 
-#pragma pack(1)
 struct dsp_image_info {
 	long              coff_date;           /* Date/time when DSP Coff image was built. */
 	long              begin_offset;        /* Offset in file where image begins. */
@@ -105,7 +104,7 @@ struct dsp_image_info {
 	long              version;             /* Embedded version # of DSP code. */
 	unsigned short    checksum;            /* DSP File checksum */
 	unsigned short    pad1;
-};
+} __attribute__ ((__packed__));
 
 
 /* checks if the doorbell register is cleared */
Signature · 5 lines
2.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/
#1 lore raw
Quoted 5 lines · Giedrius Statkevičius

Convert a Microsoft compiler specific directive "#pragma pack(1)" to a GCC equivalent __attribute__ ((__packed__)). Also, by doing this we save ourselves from trouble if any other struct definitions are added after the #pragma because it will be applied to all of the definitions following it.

[]

drivers/staging/ft1000/ft1000-usb/ft1000_download.c

Quoted 1 line
drivers/staging/ft1000/ft1000-usb/ft1000_download.c +0 -0

[]

Quoted 9 lines
drivers/staging/ft1000/ft1000-usb/ft1000_download.c +0 -1
@@ -95,7 +95,6 @@ struct dsp_file_hdr {
 	long              nDspImages;          /* Number of DSP images in file. */
 };
 
-#pragma pack(1)
 struct dsp_image_info {
 	long              coff_date;           /* Date/time when DSP Coff image was built. */
 	long              begin_offset;        /* Offset in file where image begins. */

drivers/staging/ft1000/ft1000-usb/ft1000_download.c struct dsp_image_info { · line 107

Quoted 5 lines
drivers/staging/ft1000/ft1000-usb/ft1000_download.c +1 -1
@@ -105,7 +104,7 @@ struct dsp_image_info {
 	long              version;             /* Embedded version # of DSP code. */
 	unsigned short    checksum;            /* DSP File checksum */
 	unsigned short    pad1;
-};
+} __attribute__ ((__packed__));

__packed

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/