aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill Smelkov <kirr@navytux.spb.ru>2012-12-26 10:23:26 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-12-28 10:32:51 -0500
commitc19bec500168108bf28710fae304523679ffb40f (patch)
tree42303a26e767c6d4512d3587d97a3383d6f3b72d
parent0322bd3980b3ebf7dde8474e22614cb443d6479a (diff)
[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 <kirr@navytux.spb.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/platform/vivi.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/media/platform/vivi.c b/drivers/media/platform/vivi.c
index ec6508909f02..8a33a712f480 100644
--- a/drivers/media/platform/vivi.c
+++ b/drivers/media/platform/vivi.c
@@ -91,13 +91,13 @@ static const struct v4l2_fract
91 ------------------------------------------------------------------*/ 91 ------------------------------------------------------------------*/
92 92
93struct vivi_fmt { 93struct vivi_fmt {
94 char *name; 94 const char *name;
95 u32 fourcc; /* v4l2 format id */ 95 u32 fourcc; /* v4l2 format id */
96 u8 depth; 96 u8 depth;
97 bool is_yuv; 97 bool is_yuv;
98}; 98};
99 99
100static struct vivi_fmt formats[] = { 100static const struct vivi_fmt formats[] = {
101 { 101 {
102 .name = "4:2:2, packed, YUYV", 102 .name = "4:2:2, packed, YUYV",
103 .fourcc = V4L2_PIX_FMT_YUYV, 103 .fourcc = V4L2_PIX_FMT_YUYV,
@@ -164,9 +164,9 @@ static struct vivi_fmt formats[] = {
164 }, 164 },
165}; 165};
166 166
167static struct vivi_fmt *__get_format(u32 pixelformat) 167static const struct vivi_fmt *__get_format(u32 pixelformat)
168{ 168{
169 struct vivi_fmt *fmt; 169 const struct vivi_fmt *fmt;
170 unsigned int k; 170 unsigned int k;
171 171
172 for (k = 0; k < ARRAY_SIZE(formats); k++) { 172 for (k = 0; k < ARRAY_SIZE(formats); k++) {
@@ -181,7 +181,7 @@ static struct vivi_fmt *__get_format(u32 pixelformat)
181 return &formats[k]; 181 return &formats[k];
182} 182}
183 183
184static struct vivi_fmt *get_format(struct v4l2_format *f) 184static const struct vivi_fmt *get_format(struct v4l2_format *f)
185{ 185{
186 return __get_format(f->fmt.pix.pixelformat); 186 return __get_format(f->fmt.pix.pixelformat);
187} 187}
@@ -191,7 +191,7 @@ struct vivi_buffer {
191 /* common v4l buffer stuff -- must be first */ 191 /* common v4l buffer stuff -- must be first */
192 struct vb2_buffer vb; 192 struct vb2_buffer vb;
193 struct list_head list; 193 struct list_head list;
194 struct vivi_fmt *fmt; 194 const struct vivi_fmt *fmt;
195}; 195};
196 196
197struct vivi_dmaqueue { 197struct vivi_dmaqueue {
@@ -250,7 +250,7 @@ struct vivi_dev {
250 int input; 250 int input;
251 251
252 /* video capture */ 252 /* video capture */
253 struct vivi_fmt *fmt; 253 const struct vivi_fmt *fmt;
254 struct v4l2_fract timeperframe; 254 struct v4l2_fract timeperframe;
255 unsigned int width, height; 255 unsigned int width, height;
256 struct vb2_queue vb_vidq; 256 struct vb2_queue vb_vidq;
@@ -297,7 +297,7 @@ struct bar_std {
297 297
298/* Maximum number of bars are 10 - otherwise, the input print code 298/* Maximum number of bars are 10 - otherwise, the input print code
299 should be modified */ 299 should be modified */
300static struct bar_std bars[] = { 300static const struct bar_std bars[] = {
301 { /* Standard ITU-R color bar sequence */ 301 { /* Standard ITU-R color bar sequence */
302 { COLOR_WHITE, COLOR_AMBER, COLOR_CYAN, COLOR_GREEN, 302 { COLOR_WHITE, COLOR_AMBER, COLOR_CYAN, COLOR_GREEN,
303 COLOR_MAGENTA, COLOR_RED, COLOR_BLUE, COLOR_BLACK, COLOR_BLACK } 303 COLOR_MAGENTA, COLOR_RED, COLOR_BLUE, COLOR_BLACK, COLOR_BLACK }
@@ -926,7 +926,7 @@ static void vivi_unlock(struct vb2_queue *vq)
926} 926}
927 927
928 928
929static struct vb2_ops vivi_video_qops = { 929static const struct vb2_ops vivi_video_qops = {
930 .queue_setup = queue_setup, 930 .queue_setup = queue_setup,
931 .buf_prepare = buffer_prepare, 931 .buf_prepare = buffer_prepare,
932 .buf_queue = buffer_queue, 932 .buf_queue = buffer_queue,
@@ -957,7 +957,7 @@ static int vidioc_querycap(struct file *file, void *priv,
957static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, 957static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
958 struct v4l2_fmtdesc *f) 958 struct v4l2_fmtdesc *f)
959{ 959{
960 struct vivi_fmt *fmt; 960 const struct vivi_fmt *fmt;
961 961
962 if (f->index >= ARRAY_SIZE(formats)) 962 if (f->index >= ARRAY_SIZE(formats))
963 return -EINVAL; 963 return -EINVAL;
@@ -993,7 +993,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
993 struct v4l2_format *f) 993 struct v4l2_format *f)
994{ 994{
995 struct vivi_dev *dev = video_drvdata(file); 995 struct vivi_dev *dev = video_drvdata(file);
996 struct vivi_fmt *fmt; 996 const struct vivi_fmt *fmt;
997 997
998 fmt = get_format(f); 998 fmt = get_format(f);
999 if (!fmt) { 999 if (!fmt) {
@@ -1102,7 +1102,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
1102static int vidioc_enum_frameintervals(struct file *file, void *priv, 1102static int vidioc_enum_frameintervals(struct file *file, void *priv,
1103 struct v4l2_frmivalenum *fival) 1103 struct v4l2_frmivalenum *fival)
1104{ 1104{
1105 struct vivi_fmt *fmt; 1105 const struct vivi_fmt *fmt;
1106 1106
1107 if (fival->index) 1107 if (fival->index)
1108 return -EINVAL; 1108 return -EINVAL;
@@ -1330,7 +1330,7 @@ static const struct v4l2_ioctl_ops vivi_ioctl_ops = {
1330 .vidioc_unsubscribe_event = v4l2_event_unsubscribe, 1330 .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
1331}; 1331};
1332 1332
1333static struct video_device vivi_template = { 1333static const struct video_device vivi_template = {
1334 .name = "vivi", 1334 .name = "vivi",
1335 .fops = &vivi_fops, 1335 .fops = &vivi_fops,
1336 .ioctl_ops = &vivi_ioctl_ops, 1336 .ioctl_ops = &vivi_ioctl_ops,