[PATCH v2 1/3] media: atomisp: convert default struct values to use compound-literals with designated initializers.

Jeremy Sowden jeremy at azazel.net
Sat Dec 2 10:35:06 UTC 2017


On 2017-12-02, at 13:20:09 +0300, Dan Carpenter wrote:
> On Fri, Dec 01, 2017 at 05:19:37PM +0000, Jeremy Sowden wrote:
> > -#define DEFAULT_PIPE_INFO \
> > -{ \
> > -	{IA_CSS_BINARY_DEFAULT_FRAME_INFO},	/* output_info */ \
> > -	{IA_CSS_BINARY_DEFAULT_FRAME_INFO},	/* vf_output_info */ \
> > -	IA_CSS_BINARY_DEFAULT_FRAME_INFO,	/* raw_output_info */ \
> > -	{ 0, 0},				/* output system in res */ \
> > -	DEFAULT_SHADING_INFO,			/* shading_info */ \
> > -	DEFAULT_GRID_INFO,			/* grid_info */ \
> > -	0					/* num_invalid_frames */ \
> > -}
> > +#define DEFAULT_PIPE_INFO ( \
>
> Why does this have a ( now?  That can't compile can it??

It does.

> > +	(struct ia_css_pipe_info) { \
> > +		.output_info			= {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
> > +		.vf_output_info			= {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
> > +		.raw_output_info		= IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
> > +		.output_system_in_res_info	= { 0, 0 }, \
> > +		.shading_info			= DEFAULT_SHADING_INFO, \
> > +		.grid_info			= DEFAULT_GRID_INFO, \
> > +		.num_invalid_frames		= 0 \
> > +	} \
> > +)

Checkpatch got quite shouty, e.g.:

  ERROR: Macros with complex values should be enclosed in parentheses
  #826: FILE: drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_common_types.h:215:
  +#define DEFAULT_DVS_STAT_PUBLIC_DVS_GLOBAL_CFG \
  +(struct dvs_stat_public_dvs_global_cfg) { \
  +       .kappa          = 0, \
  +       .match_shift    = 0, \
  +       .ybin_mode      = 0, \
  +}

so I just wrapped all of them.

> We need to get better compile test coverage on this...  :/  There are
> some others as well.

I have run a test-compilation.  Some of the code doesn't get built
because it's #ifdeffed off.  I did try adding -DISP2401 (which enables
most of it), that that just causes unrelated compilation failures.

J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/attachments/20171202/e1016baa/attachment.asc>


More information about the devel mailing list