[Intel-gfx] [PATCH 7/9] drm/i915/gvt: Constify formats

Rikard Falkeborn rikard.falkeborn at gmail.com
Sun Dec 12 13:21:08 UTC 2021


On Fri, Dec 10, 2021 at 08:20:22AM +0000, Wang, Zhi A wrote:
> On 12/4/2021 12:55 PM, Rikard Falkeborn wrote:
> > These are never modified, so make them const to allow the compiler to
> > put them in read-only memory. WHile at it, make the description const
> > char* since it is never modified.
> >
> > Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com>
> > ---
> >   drivers/gpu/drm/i915/gvt/fb_decoder.c | 24 ++++++++++++------------
> >   1 file changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.c b/drivers/gpu/drm/i915/gvt/fb_decoder.c
> > index 11a8baba6822..3c8736ae8fed 100644
> > --- a/drivers/gpu/drm/i915/gvt/fb_decoder.c
> > +++ b/drivers/gpu/drm/i915/gvt/fb_decoder.c
> > @@ -40,12 +40,12 @@
> >   
> >   #define PRIMARY_FORMAT_NUM	16
> >   struct pixel_format {
> > -	int	drm_format;	/* Pixel format in DRM definition */
> > -	int	bpp;		/* Bits per pixel, 0 indicates invalid */
> > -	char	*desc;		/* The description */
> > +	int		drm_format;	/* Pixel format in DRM definition */
> > +	int		bpp;		/* Bits per pixel, 0 indicates invalid */
> > +	const char	*desc;		/* The description */
> >   };
> Thanks so much for this. According to the code of i915, we prefer using 
> one space as seperator.
> >   

Thanks for reviewing. Just to clarify, is this how you want it to look:

struct pixel_format {
	int drm_format;     /* Pixel format in DRM definition */
	int bpp;            /* Bits per pixel, 0 indicates invalid */
	char *desc;         /* The description */
};

Rikard


More information about the Intel-gfx mailing list