Commit c19bec50 authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Mauro Carvalho Chehab

[media] vivi: Constify structures

Most of *_ops and other structures in vivi.c were already declared const
but some have not. Constify and code/data will take less space:
    $ size drivers/media/platform/vivi.o
              text    data     bss     dec     hex filename
    before:  12569     248       8   12825    3219 drivers/media/platform/vivi.o
    after:   12308      20       8   12336    3030 drivers/media/platform/vivi.o
i.e. vivi.o is now ~500 bytes less.
Signed-off-by: Kirill Smelkov's avatarKirill Smelkov <kirr@navytux.spb.ru>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 0322bd39
...@@ -91,13 +91,13 @@ static const struct v4l2_fract ...@@ -91,13 +91,13 @@ static const struct v4l2_fract
------------------------------------------------------------------*/ ------------------------------------------------------------------*/
struct vivi_fmt { struct vivi_fmt {
char *name; const char *name;
u32 fourcc; /* v4l2 format id */ u32 fourcc; /* v4l2 format id */
u8 depth; u8 depth;
bool is_yuv; bool is_yuv;
}; };
static struct vivi_fmt formats[] = { static const struct vivi_fmt formats[] = {
{ {
.name = "4:2:2, packed, YUYV", .name = "4:2:2, packed, YUYV",
.fourcc = V4L2_PIX_FMT_YUYV, .fourcc = V4L2_PIX_FMT_YUYV,
...@@ -164,9 +164,9 @@ static struct vivi_fmt formats[] = { ...@@ -164,9 +164,9 @@ static struct vivi_fmt formats[] = {
}, },
}; };
static struct vivi_fmt *__get_format(u32 pixelformat) static const struct vivi_fmt *__get_format(u32 pixelformat)
{ {
struct vivi_fmt *fmt; const struct vivi_fmt *fmt;
unsigned int k; unsigned int k;
for (k = 0; k < ARRAY_SIZE(formats); k++) { for (k = 0; k < ARRAY_SIZE(formats); k++) {
...@@ -181,7 +181,7 @@ static struct vivi_fmt *__get_format(u32 pixelformat) ...@@ -181,7 +181,7 @@ static struct vivi_fmt *__get_format(u32 pixelformat)
return &formats[k]; return &formats[k];
} }
static struct vivi_fmt *get_format(struct v4l2_format *f) static const struct vivi_fmt *get_format(struct v4l2_format *f)
{ {
return __get_format(f->fmt.pix.pixelformat); return __get_format(f->fmt.pix.pixelformat);
} }
...@@ -191,7 +191,7 @@ struct vivi_buffer { ...@@ -191,7 +191,7 @@ struct vivi_buffer {
/* common v4l buffer stuff -- must be first */ /* common v4l buffer stuff -- must be first */
struct vb2_buffer vb; struct vb2_buffer vb;
struct list_head list; struct list_head list;
struct vivi_fmt *fmt; const struct vivi_fmt *fmt;
}; };
struct vivi_dmaqueue { struct vivi_dmaqueue {
...@@ -250,7 +250,7 @@ struct vivi_dev { ...@@ -250,7 +250,7 @@ struct vivi_dev {
int input; int input;
/* video capture */ /* video capture */
struct vivi_fmt *fmt; const struct vivi_fmt *fmt;
struct v4l2_fract timeperframe; struct v4l2_fract timeperframe;
unsigned int width, height; unsigned int width, height;
struct vb2_queue vb_vidq; struct vb2_queue vb_vidq;
...@@ -297,7 +297,7 @@ struct bar_std { ...@@ -297,7 +297,7 @@ struct bar_std {
/* Maximum number of bars are 10 - otherwise, the input print code /* Maximum number of bars are 10 - otherwise, the input print code
should be modified */ should be modified */
static struct bar_std bars[] = { static const struct bar_std bars[] = {
{ /* Standard ITU-R color bar sequence */ { /* Standard ITU-R color bar sequence */
{ COLOR_WHITE, COLOR_AMBER, COLOR_CYAN, COLOR_GREEN, { COLOR_WHITE, COLOR_AMBER, COLOR_CYAN, COLOR_GREEN,
COLOR_MAGENTA, COLOR_RED, COLOR_BLUE, COLOR_BLACK, COLOR_BLACK } COLOR_MAGENTA, COLOR_RED, COLOR_BLUE, COLOR_BLACK, COLOR_BLACK }
...@@ -926,7 +926,7 @@ static void vivi_unlock(struct vb2_queue *vq) ...@@ -926,7 +926,7 @@ static void vivi_unlock(struct vb2_queue *vq)
} }
static struct vb2_ops vivi_video_qops = { static const struct vb2_ops vivi_video_qops = {
.queue_setup = queue_setup, .queue_setup = queue_setup,
.buf_prepare = buffer_prepare, .buf_prepare = buffer_prepare,
.buf_queue = buffer_queue, .buf_queue = buffer_queue,
...@@ -957,7 +957,7 @@ static int vidioc_querycap(struct file *file, void *priv, ...@@ -957,7 +957,7 @@ static int vidioc_querycap(struct file *file, void *priv,
static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f) struct v4l2_fmtdesc *f)
{ {
struct vivi_fmt *fmt; const struct vivi_fmt *fmt;
if (f->index >= ARRAY_SIZE(formats)) if (f->index >= ARRAY_SIZE(formats))
return -EINVAL; return -EINVAL;
...@@ -993,7 +993,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, ...@@ -993,7 +993,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f) struct v4l2_format *f)
{ {
struct vivi_dev *dev = video_drvdata(file); struct vivi_dev *dev = video_drvdata(file);
struct vivi_fmt *fmt; const struct vivi_fmt *fmt;
fmt = get_format(f); fmt = get_format(f);
if (!fmt) { if (!fmt) {
...@@ -1102,7 +1102,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i) ...@@ -1102,7 +1102,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
static int vidioc_enum_frameintervals(struct file *file, void *priv, static int vidioc_enum_frameintervals(struct file *file, void *priv,
struct v4l2_frmivalenum *fival) struct v4l2_frmivalenum *fival)
{ {
struct vivi_fmt *fmt; const struct vivi_fmt *fmt;
if (fival->index) if (fival->index)
return -EINVAL; return -EINVAL;
...@@ -1330,7 +1330,7 @@ static const struct v4l2_ioctl_ops vivi_ioctl_ops = { ...@@ -1330,7 +1330,7 @@ static const struct v4l2_ioctl_ops vivi_ioctl_ops = {
.vidioc_unsubscribe_event = v4l2_event_unsubscribe, .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
}; };
static struct video_device vivi_template = { static const struct video_device vivi_template = {
.name = "vivi", .name = "vivi",
.fops = &vivi_fops, .fops = &vivi_fops,
.ioctl_ops = &vivi_ioctl_ops, .ioctl_ops = &vivi_ioctl_ops,
......
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