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>
This commit is contained in:
@@ -605,9 +605,9 @@ static void cx18_vbi_setup(struct cx18_stream *s)
|
||||
/* Lines per field */
|
||||
data[1] = (lines / 2) | ((lines / 2) << 16);
|
||||
/* bytes per line */
|
||||
data[2] = (raw ? vbi_active_samples
|
||||
: (cx->is_60hz ? vbi_hblank_samples_60Hz
|
||||
: vbi_hblank_samples_50Hz));
|
||||
data[2] = (raw ? VBI_ACTIVE_SAMPLES
|
||||
: (cx->is_60hz ? VBI_HBLANK_SAMPLES_60HZ
|
||||
: VBI_HBLANK_SAMPLES_50HZ));
|
||||
/* Every X number of frames a VBI interrupt arrives
|
||||
(frames as in 25 or 30 fps) */
|
||||
data[3] = 1;
|
||||
@@ -761,7 +761,7 @@ static void cx18_stream_configure_mdls(struct cx18_stream *s)
|
||||
s->bufs_per_mdl = 1;
|
||||
if (cx18_raw_vbi(s->cx)) {
|
||||
s->mdl_size = (s->cx->is_60hz ? 12 : 18)
|
||||
* 2 * vbi_active_samples;
|
||||
* 2 * VBI_ACTIVE_SAMPLES;
|
||||
} else {
|
||||
/*
|
||||
* See comment in cx18_vbi_setup() below about the
|
||||
@@ -769,8 +769,8 @@ static void cx18_stream_configure_mdls(struct cx18_stream *s)
|
||||
* the lines on which EAV RP codes toggle.
|
||||
*/
|
||||
s->mdl_size = s->cx->is_60hz
|
||||
? (21 - 4 + 1) * 2 * vbi_hblank_samples_60Hz
|
||||
: (23 - 2 + 1) * 2 * vbi_hblank_samples_50Hz;
|
||||
? (21 - 4 + 1) * 2 * VBI_HBLANK_SAMPLES_60HZ
|
||||
: (23 - 2 + 1) * 2 * VBI_HBLANK_SAMPLES_50HZ;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user