mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
[media] davinci/dm644x_ccdc: fix compiler warning
drivers/media/platform/davinci/dm644x_ccdc.c: In function ‘validate_ccdc_param’: drivers/media/platform/davinci/dm644x_ccdc.c:233:32: warning: comparison between ‘enum ccdc_gama_width’ and ‘enum ccdc_data_size’ [-Wenum-compare] It took a bit of work, see this thread of an earlier attempt to fix this: https://patchwork.kernel.org/patch/1923091/ I've chosen not to follow the suggestions in that thread since gamma_width is really a different property from data_size. What you really want is to know if gamma_width fits inside data_size and for that you need to translate each enum into a maximum bit number so you can safely compare the two. So I put in two static inline translation functions instead, keeping the rest of the code the same (except for fixing the 'gama' typo). Signed-off-by: Hans Verkuil <[email protected]> Acked-by: Lad, Prabhakar <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
This commit is contained in:
parent
b12aed0ec5
commit
1de1951930
3 changed files with 27 additions and 12 deletions
|
|
@ -38,17 +38,23 @@ enum ccdc_sample_line {
|
|||
CCDC_SAMPLE_16LINES
|
||||
};
|
||||
|
||||
/* enum for Alaw gama width */
|
||||
enum ccdc_gama_width {
|
||||
CCDC_GAMMA_BITS_15_6,
|
||||
/* enum for Alaw gamma width */
|
||||
enum ccdc_gamma_width {
|
||||
CCDC_GAMMA_BITS_15_6, /* use bits 15-6 for gamma */
|
||||
CCDC_GAMMA_BITS_14_5,
|
||||
CCDC_GAMMA_BITS_13_4,
|
||||
CCDC_GAMMA_BITS_12_3,
|
||||
CCDC_GAMMA_BITS_11_2,
|
||||
CCDC_GAMMA_BITS_10_1,
|
||||
CCDC_GAMMA_BITS_09_0
|
||||
CCDC_GAMMA_BITS_09_0 /* use bits 9-0 for gamma */
|
||||
};
|
||||
|
||||
/* returns the highest bit used for the gamma */
|
||||
static inline u8 ccdc_gamma_width_max_bit(enum ccdc_gamma_width width)
|
||||
{
|
||||
return 15 - width;
|
||||
}
|
||||
|
||||
enum ccdc_data_size {
|
||||
CCDC_DATA_16BITS,
|
||||
CCDC_DATA_15BITS,
|
||||
|
|
@ -60,12 +66,18 @@ enum ccdc_data_size {
|
|||
CCDC_DATA_8BITS
|
||||
};
|
||||
|
||||
/* returns the highest bit used for this data size */
|
||||
static inline u8 ccdc_data_size_max_bit(enum ccdc_data_size sz)
|
||||
{
|
||||
return sz == CCDC_DATA_8BITS ? 7 : 15 - sz;
|
||||
}
|
||||
|
||||
/* structure for ALaw */
|
||||
struct ccdc_a_law {
|
||||
/* Enable/disable A-Law */
|
||||
unsigned char enable;
|
||||
/* Gama Width Input */
|
||||
enum ccdc_gama_width gama_wd;
|
||||
/* Gamma Width Input */
|
||||
enum ccdc_gamma_width gamma_wd;
|
||||
};
|
||||
|
||||
/* structure for Black Clamping */
|
||||
|
|
|
|||
Loading…
Reference in a new issue