diff mbox series

[2/5] staging: imgu: Fix struct ipu3_uapi_awb_fr_config_s alignment

Message ID 20190220111953.7886-3-sakari.ailus@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Fix most ImgU driver compiler / checker warnings | expand

Commit Message

Sakari Ailus Feb. 20, 2019, 11:19 a.m. UTC
struct ipu3_uapi_awb_fr_config_s is labelled as to be aligned to 32 bytes
but that's not the case in the ISP parameter struct of the driver, struct
ipu3_uapi_acc_param which is packed.

Also there is no need for the alignment as the struct is only handled by the
driver. Remove the alignment from the struct.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/staging/media/ipu3/include/intel-ipu3.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jacopo Mondi May 27, 2019, 4:39 p.m. UTC | #1
Hi Sakari,
  what is the status of this patch?

When using the IPU3 header in libcamera we're hitting this very issue:

error: ‘ipu3_uapi_acc_param::awb_fr’ offset 36756 in ‘ipu3_uapi_acc_param’ isn’t aligned to 32
[-Werror=packed-not-aligned]

(Note that the warning is only reported in gcc8.3.0 from my testing not
by clang or older versions of gcc (5.4.0))

On Wed, Feb 20, 2019 at 01:19:50PM +0200, Sakari Ailus wrote:
> struct ipu3_uapi_awb_fr_config_s is labelled as to be aligned to 32 bytes
> but that's not the case in the ISP parameter struct of the driver, struct
> ipu3_uapi_acc_param which is packed.
>
> Also there is no need for the alignment as the struct is only handled by the
> driver. Remove the alignment from the struct.

Maybe I got mislead, but I thought memory access in the IPU3 DMA
engine should be 32 bytes aligned? Doesn't this apply here? Can we
safely drop the __aligned attribute?

I tend to think so, as all other members of 'struct
ipu3_uapi_acc_param' are not aligned.

With this confirmed:
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
   j

>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  drivers/staging/media/ipu3/include/intel-ipu3.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/ipu3/include/intel-ipu3.h b/drivers/staging/media/ipu3/include/intel-ipu3.h
> index cbb62643172be..4cdb4c791ecec 100644
> --- a/drivers/staging/media/ipu3/include/intel-ipu3.h
> +++ b/drivers/staging/media/ipu3/include/intel-ipu3.h
> @@ -450,7 +450,7 @@ struct ipu3_uapi_awb_fr_config_s {
>  	__u32 bayer_sign;
>  	__u8 bayer_nf;
>  	__u8 reserved2[3];
> -} __aligned(32) __packed;
> +} __packed;
>
>  /**
>   * struct ipu3_uapi_4a_config - 4A config
> --
> 2.11.0
>
diff mbox series

Patch

diff --git a/drivers/staging/media/ipu3/include/intel-ipu3.h b/drivers/staging/media/ipu3/include/intel-ipu3.h
index cbb62643172be..4cdb4c791ecec 100644
--- a/drivers/staging/media/ipu3/include/intel-ipu3.h
+++ b/drivers/staging/media/ipu3/include/intel-ipu3.h
@@ -450,7 +450,7 @@  struct ipu3_uapi_awb_fr_config_s {
 	__u32 bayer_sign;
 	__u8 bayer_nf;
 	__u8 reserved2[3];
-} __aligned(32) __packed;
+} __packed;
 
 /**
  * struct ipu3_uapi_4a_config - 4A config