aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-06-24 07:40:51 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-06-24 07:50:24 -0400
commit318de7911feddb452a92c43fe67cc01dc3878daf (patch)
treebd4934e9d945c3afcd30548c15f321eed4e32960
parent21ed20340a789f893d410bd961c206445a333040 (diff)
cx18: use macros instead of static const vars
Gcc 6.1 now complains about unused vars: drivers/media/pci/cx18/cx18-driver.h:497:18: warning: 'vbi_hblank_samples_50Hz' defined but not used [-Wunused-const-variable=] static const u32 vbi_hblank_samples_50Hz = 284; /* 4 byte EAV + 280 anc/fill */ ^~~~~~~~~~~~~~~~~~~~~~~ drivers/media/pci/cx18/cx18-driver.h:496:18: warning: 'vbi_hblank_samples_60Hz' defined but not used [-Wunused-const-variable=] static const u32 vbi_hblank_samples_60Hz = 272; /* 4 byte EAV + 268 anc/fill */ ^~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/media/pci/cx18/cx18-cards.c:25:0: drivers/media/pci/cx18/cx18-driver.h:497:18: warning: 'vbi_hblank_samples_50Hz' defined but not used [-Wunused-const-variable=] static const u32 vbi_hblank_samples_50Hz = 284; /* 4 byte EAV + 280 anc/fill */ ^~~~~~~~~~~~~~~~~~~~~~~ drivers/media/pci/cx18/cx18-driver.h:496:18: warning: 'vbi_hblank_samples_60Hz' defined but not used [-Wunused-const-variable=] static const u32 vbi_hblank_samples_60Hz = 272; /* 4 byte EAV + 268 anc/fill */ ^~~~~~~~~~~~~~~~~~~~~~~ drivers/media/pci/cx18/cx18-driver.h:495:18: warning: 'vbi_active_samples' defined but not used [-Wunused-const-variable=] static const u32 vbi_active_samples = 1444; /* 4 byte SAV + 720 Y + 720 U/V */ ^~~~~~~~~~~~~~~~~~ In this specific case, this is somewhat intentional, as those values are actually used in parts of the driver. The code assumes that gcc optimizer it and not actually create any var, but convert it to immediate access at the routines. Yet, as we want to shut up gcc warnings, let's use #define, with is the standard way to store values that will use assembler's immediate access code. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/pci/cx18/cx18-driver.c2
-rw-r--r--drivers/media/pci/cx18/cx18-driver.h6
-rw-r--r--drivers/media/pci/cx18/cx18-ioctl.c2
-rw-r--r--drivers/media/pci/cx18/cx18-streams.c12
-rw-r--r--drivers/media/pci/cx18/cx18-vbi.c6
5 files changed, 14 insertions, 14 deletions
diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c
index 260e462d91b4..2f23b26b16c0 100644
--- a/drivers/media/pci/cx18/cx18-driver.c
+++ b/drivers/media/pci/cx18/cx18-driver.c
@@ -560,7 +560,7 @@ static void cx18_process_options(struct cx18 *cx)
560 cx->stream_buf_size[CX18_ENC_STREAM_TYPE_MPG] = enc_mpg_bufsize; 560 cx->stream_buf_size[CX18_ENC_STREAM_TYPE_MPG] = enc_mpg_bufsize;
561 cx->stream_buf_size[CX18_ENC_STREAM_TYPE_IDX] = enc_idx_bufsize; 561 cx->stream_buf_size[CX18_ENC_STREAM_TYPE_IDX] = enc_idx_bufsize;
562 cx->stream_buf_size[CX18_ENC_STREAM_TYPE_YUV] = enc_yuv_bufsize; 562 cx->stream_buf_size[CX18_ENC_STREAM_TYPE_YUV] = enc_yuv_bufsize;
563 cx->stream_buf_size[CX18_ENC_STREAM_TYPE_VBI] = vbi_active_samples * 36; 563 cx->stream_buf_size[CX18_ENC_STREAM_TYPE_VBI] = VBI_ACTIVE_SAMPLES * 36;
564 cx->stream_buf_size[CX18_ENC_STREAM_TYPE_PCM] = enc_pcm_bufsize; 564 cx->stream_buf_size[CX18_ENC_STREAM_TYPE_PCM] = enc_pcm_bufsize;
565 cx->stream_buf_size[CX18_ENC_STREAM_TYPE_RAD] = 0; /* control no data */ 565 cx->stream_buf_size[CX18_ENC_STREAM_TYPE_RAD] = 0; /* control no data */
566 566
diff --git a/drivers/media/pci/cx18/cx18-driver.h b/drivers/media/pci/cx18/cx18-driver.h
index 47ce80fa73b9..ef308a10e870 100644
--- a/drivers/media/pci/cx18/cx18-driver.h
+++ b/drivers/media/pci/cx18/cx18-driver.h
@@ -492,9 +492,9 @@ struct cx18_card;
492 * (1/15.625 kHz) * 2 * 13.5 MHz = 1728 samples/line = 492 * (1/15.625 kHz) * 2 * 13.5 MHz = 1728 samples/line =
493 * 4 bytes SAV + 280 bytes anc data + 4 bytes SAV + 1440 active samples 493 * 4 bytes SAV + 280 bytes anc data + 4 bytes SAV + 1440 active samples
494 */ 494 */
495static const u32 vbi_active_samples = 1444; /* 4 byte SAV + 720 Y + 720 U/V */ 495#define VBI_ACTIVE_SAMPLES 1444 /* 4 byte SAV + 720 Y + 720 U/V */
496static const u32 vbi_hblank_samples_60Hz = 272; /* 4 byte EAV + 268 anc/fill */ 496#define VBI_HBLANK_SAMPLES_60HZ 272 /* 4 byte EAV + 268 anc/fill */
497static const u32 vbi_hblank_samples_50Hz = 284; /* 4 byte EAV + 280 anc/fill */ 497#define VBI_HBLANK_SAMPLES_50HZ 284 /* 4 byte EAV + 280 anc/fill */
498 498
499#define CX18_VBI_FRAMES 32 499#define CX18_VBI_FRAMES 32
500 500
diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c
index eeb741c7db1b..fecca2a63891 100644
--- a/drivers/media/pci/cx18/cx18-ioctl.c
+++ b/drivers/media/pci/cx18/cx18-ioctl.c
@@ -177,7 +177,7 @@ static int cx18_g_fmt_vbi_cap(struct file *file, void *fh,
177 177
178 vbifmt->sampling_rate = 27000000; 178 vbifmt->sampling_rate = 27000000;
179 vbifmt->offset = 248; /* FIXME - slightly wrong for both 50 & 60 Hz */ 179 vbifmt->offset = 248; /* FIXME - slightly wrong for both 50 & 60 Hz */
180 vbifmt->samples_per_line = vbi_active_samples - 4; 180 vbifmt->samples_per_line = VBI_ACTIVE_SAMPLES - 4;
181 vbifmt->sample_format = V4L2_PIX_FMT_GREY; 181 vbifmt->sample_format = V4L2_PIX_FMT_GREY;
182 vbifmt->start[0] = cx->vbi.start[0]; 182 vbifmt->start[0] = cx->vbi.start[0];
183 vbifmt->start[1] = cx->vbi.start[1]; 183 vbifmt->start[1] = cx->vbi.start[1];
diff --git a/drivers/media/pci/cx18/cx18-streams.c b/drivers/media/pci/cx18/cx18-streams.c
index c9860845264f..f3802ec1b383 100644
--- a/drivers/media/pci/cx18/cx18-streams.c
+++ b/drivers/media/pci/cx18/cx18-streams.c
@@ -605,9 +605,9 @@ static void cx18_vbi_setup(struct cx18_stream *s)
605 /* Lines per field */ 605 /* Lines per field */
606 data[1] = (lines / 2) | ((lines / 2) << 16); 606 data[1] = (lines / 2) | ((lines / 2) << 16);
607 /* bytes per line */ 607 /* bytes per line */
608 data[2] = (raw ? vbi_active_samples 608 data[2] = (raw ? VBI_ACTIVE_SAMPLES
609 : (cx->is_60hz ? vbi_hblank_samples_60Hz 609 : (cx->is_60hz ? VBI_HBLANK_SAMPLES_60HZ
610 : vbi_hblank_samples_50Hz)); 610 : VBI_HBLANK_SAMPLES_50HZ));
611 /* Every X number of frames a VBI interrupt arrives 611 /* Every X number of frames a VBI interrupt arrives
612 (frames as in 25 or 30 fps) */ 612 (frames as in 25 or 30 fps) */
613 data[3] = 1; 613 data[3] = 1;
@@ -761,7 +761,7 @@ static void cx18_stream_configure_mdls(struct cx18_stream *s)
761 s->bufs_per_mdl = 1; 761 s->bufs_per_mdl = 1;
762 if (cx18_raw_vbi(s->cx)) { 762 if (cx18_raw_vbi(s->cx)) {
763 s->mdl_size = (s->cx->is_60hz ? 12 : 18) 763 s->mdl_size = (s->cx->is_60hz ? 12 : 18)
764 * 2 * vbi_active_samples; 764 * 2 * VBI_ACTIVE_SAMPLES;
765 } else { 765 } else {
766 /* 766 /*
767 * See comment in cx18_vbi_setup() below about the 767 * See comment in cx18_vbi_setup() below about the
@@ -769,8 +769,8 @@ static void cx18_stream_configure_mdls(struct cx18_stream *s)
769 * the lines on which EAV RP codes toggle. 769 * the lines on which EAV RP codes toggle.
770 */ 770 */
771 s->mdl_size = s->cx->is_60hz 771 s->mdl_size = s->cx->is_60hz
772 ? (21 - 4 + 1) * 2 * vbi_hblank_samples_60Hz 772 ? (21 - 4 + 1) * 2 * VBI_HBLANK_SAMPLES_60HZ
773 : (23 - 2 + 1) * 2 * vbi_hblank_samples_50Hz; 773 : (23 - 2 + 1) * 2 * VBI_HBLANK_SAMPLES_50HZ;
774 } 774 }
775 break; 775 break;
776 default: 776 default:
diff --git a/drivers/media/pci/cx18/cx18-vbi.c b/drivers/media/pci/cx18/cx18-vbi.c
index add99642f1e2..43360cbcf24b 100644
--- a/drivers/media/pci/cx18/cx18-vbi.c
+++ b/drivers/media/pci/cx18/cx18-vbi.c
@@ -108,7 +108,7 @@ static void copy_vbi_data(struct cx18 *cx, int lines, u32 pts_stamp)
108/* FIXME - this function ignores the input size. */ 108/* FIXME - this function ignores the input size. */
109static u32 compress_raw_buf(struct cx18 *cx, u8 *buf, u32 size, u32 hdr_size) 109static u32 compress_raw_buf(struct cx18 *cx, u8 *buf, u32 size, u32 hdr_size)
110{ 110{
111 u32 line_size = vbi_active_samples; 111 u32 line_size = VBI_ACTIVE_SAMPLES;
112 u32 lines = cx->vbi.count * 2; 112 u32 lines = cx->vbi.count * 2;
113 u8 *q = buf; 113 u8 *q = buf;
114 u8 *p; 114 u8 *p;
@@ -145,8 +145,8 @@ static u32 compress_sliced_buf(struct cx18 *cx, u8 *buf, u32 size,
145 struct v4l2_decode_vbi_line vbi; 145 struct v4l2_decode_vbi_line vbi;
146 int i; 146 int i;
147 u32 line = 0; 147 u32 line = 0;
148 u32 line_size = cx->is_60hz ? vbi_hblank_samples_60Hz 148 u32 line_size = cx->is_60hz ? VBI_HBLANK_SAMPLES_60HZ
149 : vbi_hblank_samples_50Hz; 149 : VBI_HBLANK_SAMPLES_50HZ;
150 150
151 /* find the first valid line */ 151 /* find the first valid line */
152 for (i = hdr_size, buf += hdr_size; i < size; i++, buf++) { 152 for (i = hdr_size, buf += hdr_size; i < size; i++, buf++) {