[PATCH 1/2] drm/edid: replace __attribute__((packed)) with __packed

Jani Nikula jani.nikula at intel.com
Thu Dec 14 10:20:25 UTC 2023


On Tue, 12 Dec 2023, Jani Nikula <jani.nikula at intel.com> wrote:
> __packed is preferred over __attribute__((packed)).
>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

Pushed both to drm-misc-next with Simon's irc r-b.

Thanks,
Jani.


> ---
>  include/drm/drm_edid.h | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> index 518d1b8106c7..54cc6f04a708 100644
> --- a/include/drm/drm_edid.h
> +++ b/include/drm/drm_edid.h
> @@ -46,7 +46,7 @@ struct est_timings {
>  	u8 t1;
>  	u8 t2;
>  	u8 mfg_rsvd;
> -} __attribute__((packed));
> +} __packed;
>  
>  /* 00=16:10, 01=4:3, 10=5:4, 11=16:9 */
>  #define EDID_TIMING_ASPECT_SHIFT 6
> @@ -59,7 +59,7 @@ struct est_timings {
>  struct std_timing {
>  	u8 hsize; /* need to multiply by 8 then add 248 */
>  	u8 vfreq_aspect;
> -} __attribute__((packed));
> +} __packed;
>  
>  #define DRM_EDID_PT_HSYNC_POSITIVE (1 << 1)
>  #define DRM_EDID_PT_VSYNC_POSITIVE (1 << 2)
> @@ -85,12 +85,12 @@ struct detailed_pixel_timing {
>  	u8 hborder;
>  	u8 vborder;
>  	u8 misc;
> -} __attribute__((packed));
> +} __packed;
>  
>  /* If it's not pixel timing, it'll be one of the below */
>  struct detailed_data_string {
>  	u8 str[13];
> -} __attribute__((packed));
> +} __packed;
>  
>  #define DRM_EDID_RANGE_OFFSET_MIN_VFREQ (1 << 0) /* 1.4 */
>  #define DRM_EDID_RANGE_OFFSET_MAX_VFREQ (1 << 1) /* 1.4 */
> @@ -120,7 +120,7 @@ struct detailed_data_monitor_range {
>  			__le16 m;
>  			u8 k;
>  			u8 j; /* need to divide by 2 */
> -		} __attribute__((packed)) gtf2;
> +		} __packed gtf2;
>  		struct {
>  			u8 version;
>  			u8 data1; /* high 6 bits: extra clock resolution */
> @@ -129,27 +129,27 @@ struct detailed_data_monitor_range {
>  			u8 flags; /* preferred aspect and blanking support */
>  			u8 supported_scalings;
>  			u8 preferred_refresh;
> -		} __attribute__((packed)) cvt;
> -	} __attribute__((packed)) formula;
> -} __attribute__((packed));
> +		} __packed cvt;
> +	} __packed formula;
> +} __packed;
>  
>  struct detailed_data_wpindex {
>  	u8 white_yx_lo; /* Lower 2 bits each */
>  	u8 white_x_hi;
>  	u8 white_y_hi;
>  	u8 gamma; /* need to divide by 100 then add 1 */
> -} __attribute__((packed));
> +} __packed;
>  
>  struct detailed_data_color_point {
>  	u8 windex1;
>  	u8 wpindex1[3];
>  	u8 windex2;
>  	u8 wpindex2[3];
> -} __attribute__((packed));
> +} __packed;
>  
>  struct cvt_timing {
>  	u8 code[3];
> -} __attribute__((packed));
> +} __packed;
>  
>  struct detailed_non_pixel {
>  	u8 pad1;
> @@ -163,8 +163,8 @@ struct detailed_non_pixel {
>  		struct detailed_data_wpindex color;
>  		struct std_timing timings[6];
>  		struct cvt_timing cvt[4];
> -	} __attribute__((packed)) data;
> -} __attribute__((packed));
> +	} __packed data;
> +} __packed;
>  
>  #define EDID_DETAIL_EST_TIMINGS 0xf7
>  #define EDID_DETAIL_CVT_3BYTE 0xf8
> @@ -181,8 +181,8 @@ struct detailed_timing {
>  	union {
>  		struct detailed_pixel_timing pixel_data;
>  		struct detailed_non_pixel other_data;
> -	} __attribute__((packed)) data;
> -} __attribute__((packed));
> +	} __packed data;
> +} __packed;
>  
>  #define DRM_EDID_INPUT_SERRATION_VSYNC (1 << 0)
>  #define DRM_EDID_INPUT_SYNC_ON_GREEN   (1 << 1)
> @@ -307,7 +307,7 @@ struct edid {
>  	u8 extensions;
>  	/* Checksum */
>  	u8 checksum;
> -} __attribute__((packed));
> +} __packed;
>  
>  #define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8))

-- 
Jani Nikula, Intel


More information about the dri-devel mailing list