Commit 5f12491c authored by Trent Piepho's avatar Trent Piepho Committed by Mauro Carvalho Chehab

V4L/DVB (5570): V4l1-compat: misc fixes for pixelformat function

Mark the palette2pixelformat lookup table as const

pixelformat is unsigned, adjust the palette2pixelformat table and
pixelformat_to_palette()

palette_to_pixelformat() is a pure function

pixelformat_to_palette() is a const function
Signed-off-by: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 452c0fb4
...@@ -127,7 +127,7 @@ set_v4l_control(struct inode *inode, ...@@ -127,7 +127,7 @@ set_v4l_control(struct inode *inode,
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
static int palette2pixelformat[] = { const static unsigned int palette2pixelformat[] = {
[VIDEO_PALETTE_GREY] = V4L2_PIX_FMT_GREY, [VIDEO_PALETTE_GREY] = V4L2_PIX_FMT_GREY,
[VIDEO_PALETTE_RGB555] = V4L2_PIX_FMT_RGB555, [VIDEO_PALETTE_RGB555] = V4L2_PIX_FMT_RGB555,
[VIDEO_PALETTE_RGB565] = V4L2_PIX_FMT_RGB565, [VIDEO_PALETTE_RGB565] = V4L2_PIX_FMT_RGB565,
...@@ -145,7 +145,7 @@ static int palette2pixelformat[] = { ...@@ -145,7 +145,7 @@ static int palette2pixelformat[] = {
[VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P, [VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P,
}; };
static unsigned int static unsigned int __attribute_pure__
palette_to_pixelformat(unsigned int palette) palette_to_pixelformat(unsigned int palette)
{ {
if (palette < ARRAY_SIZE(palette2pixelformat)) if (palette < ARRAY_SIZE(palette2pixelformat))
...@@ -154,8 +154,8 @@ palette_to_pixelformat(unsigned int palette) ...@@ -154,8 +154,8 @@ palette_to_pixelformat(unsigned int palette)
return 0; return 0;
} }
static unsigned int static unsigned int __attribute_const__
pixelformat_to_palette(int pixelformat) pixelformat_to_palette(unsigned int pixelformat)
{ {
int palette = 0; int palette = 0;
switch (pixelformat) switch (pixelformat)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment