[media] davinci/dm644x_ccdc: fix compiler warning
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 4 Mar 2013 10:18:38 +0000 (07:18 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 19 Mar 2013 19:16:04 +0000 (16:16 -0300)
commit1de1951930d4450d1645a0a907b710f268af42c3
treefafa302bede6d683050882b14ad3c48766ede5c1
parentb12aed0ec518eb348ae0f6d196fd726c57670823
[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 <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/platform/davinci/dm644x_ccdc.c
drivers/media/platform/davinci/dm644x_ccdc_regs.h
include/media/davinci/dm644x_ccdc.h