aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-10-06 10:21:02 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-10-06 10:21:02 -0400
commit20eb13a77ebcba4341095c453c33dacba44519f9 (patch)
treedec9585131db7306747fcdedfdfb0d36da559a83
parent6f0fdc498e30ce34da559f43e359c4b517cb5b8b (diff)
[media] mt2063: properly handle return error codes
Fix a series of warnings when compiled with W=1: drivers/media/tuners/mt2063.c: In function 'mt2063_setreg': drivers/media/tuners/mt2063.c:290:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] ... drivers/media/tuners/mt2063.c:2013:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] drivers/media/tuners/mt2063.c:2271:14: warning: no previous prototype for 'tuner_MT2063_SoftwareShutdown' [-Wmissing-prototypes] drivers/media/tuners/mt2063.c:2286:14: warning: no previous prototype for 'tuner_MT2063_ClearPowerMaskBits' [-Wmissing-prototypes] Several of those warnings are real bugs: the error status code used to be unsigned, but they're assigned to negative error codes. Fix it by using unsigned int. While here, comment the two power management functions, while we don't add a code there to properly handle tuner suspend/resume. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/tuners/mt2063.c36
-rw-r--r--drivers/media/tuners/mt2063.h4
2 files changed, 18 insertions, 22 deletions
diff --git a/drivers/media/tuners/mt2063.c b/drivers/media/tuners/mt2063.c
index 620c4fad7181..2e1a02e360ff 100644
--- a/drivers/media/tuners/mt2063.c
+++ b/drivers/media/tuners/mt2063.c
@@ -245,7 +245,7 @@ struct mt2063_state {
245/* 245/*
246 * mt2063_write - Write data into the I2C bus 246 * mt2063_write - Write data into the I2C bus
247 */ 247 */
248static u32 mt2063_write(struct mt2063_state *state, u8 reg, u8 *data, u32 len) 248static int mt2063_write(struct mt2063_state *state, u8 reg, u8 *data, u32 len)
249{ 249{
250 struct dvb_frontend *fe = state->frontend; 250 struct dvb_frontend *fe = state->frontend;
251 int ret; 251 int ret;
@@ -277,9 +277,9 @@ static u32 mt2063_write(struct mt2063_state *state, u8 reg, u8 *data, u32 len)
277/* 277/*
278 * mt2063_write - Write register data into the I2C bus, caching the value 278 * mt2063_write - Write register data into the I2C bus, caching the value
279 */ 279 */
280static u32 mt2063_setreg(struct mt2063_state *state, u8 reg, u8 val) 280static int mt2063_setreg(struct mt2063_state *state, u8 reg, u8 val)
281{ 281{
282 u32 status; 282 int status;
283 283
284 dprintk(2, "\n"); 284 dprintk(2, "\n");
285 285
@@ -298,10 +298,10 @@ static u32 mt2063_setreg(struct mt2063_state *state, u8 reg, u8 val)
298/* 298/*
299 * mt2063_read - Read data from the I2C bus 299 * mt2063_read - Read data from the I2C bus
300 */ 300 */
301static u32 mt2063_read(struct mt2063_state *state, 301static int mt2063_read(struct mt2063_state *state,
302 u8 subAddress, u8 *pData, u32 cnt) 302 u8 subAddress, u8 *pData, u32 cnt)
303{ 303{
304 u32 status = 0; /* Status to be returned */ 304 int status = 0; /* Status to be returned */
305 struct dvb_frontend *fe = state->frontend; 305 struct dvb_frontend *fe = state->frontend;
306 u32 i = 0; 306 u32 i = 0;
307 307
@@ -816,7 +816,7 @@ static u32 IsSpurInBand(struct MT2063_AvoidSpursData_t *pAS_Info,
816 */ 816 */
817static u32 MT2063_AvoidSpurs(struct MT2063_AvoidSpursData_t *pAS_Info) 817static u32 MT2063_AvoidSpurs(struct MT2063_AvoidSpursData_t *pAS_Info)
818{ 818{
819 u32 status = 0; 819 int status = 0;
820 u32 fm, fp; /* restricted range on LO's */ 820 u32 fm, fp; /* restricted range on LO's */
821 pAS_Info->bSpurAvoided = 0; 821 pAS_Info->bSpurAvoided = 0;
822 pAS_Info->nSpursFound = 0; 822 pAS_Info->nSpursFound = 0;
@@ -935,14 +935,14 @@ static u32 MT2063_AvoidSpurs(struct MT2063_AvoidSpursData_t *pAS_Info)
935 * 935 *
936 * This function returns 0, if no lock, 1 if locked and a value < 1 if error 936 * This function returns 0, if no lock, 1 if locked and a value < 1 if error
937 */ 937 */
938static unsigned int mt2063_lockStatus(struct mt2063_state *state) 938static int mt2063_lockStatus(struct mt2063_state *state)
939{ 939{
940 const u32 nMaxWait = 100; /* wait a maximum of 100 msec */ 940 const u32 nMaxWait = 100; /* wait a maximum of 100 msec */
941 const u32 nPollRate = 2; /* poll status bits every 2 ms */ 941 const u32 nPollRate = 2; /* poll status bits every 2 ms */
942 const u32 nMaxLoops = nMaxWait / nPollRate; 942 const u32 nMaxLoops = nMaxWait / nPollRate;
943 const u8 LO1LK = 0x80; 943 const u8 LO1LK = 0x80;
944 u8 LO2LK = 0x08; 944 u8 LO2LK = 0x08;
945 u32 status; 945 int status;
946 u32 nDelays = 0; 946 u32 nDelays = 0;
947 947
948 dprintk(2, "\n"); 948 dprintk(2, "\n");
@@ -1069,7 +1069,7 @@ static u32 mt2063_get_dnc_output_enable(struct mt2063_state *state,
1069static u32 mt2063_set_dnc_output_enable(struct mt2063_state *state, 1069static u32 mt2063_set_dnc_output_enable(struct mt2063_state *state,
1070 enum MT2063_DNC_Output_Enable nValue) 1070 enum MT2063_DNC_Output_Enable nValue)
1071{ 1071{
1072 u32 status = 0; /* Status to be returned */ 1072 int status = 0; /* Status to be returned */
1073 u8 val = 0; 1073 u8 val = 0;
1074 1074
1075 dprintk(2, "\n"); 1075 dprintk(2, "\n");
@@ -1203,7 +1203,7 @@ static u32 mt2063_set_dnc_output_enable(struct mt2063_state *state,
1203static u32 MT2063_SetReceiverMode(struct mt2063_state *state, 1203static u32 MT2063_SetReceiverMode(struct mt2063_state *state,
1204 enum mt2063_delivery_sys Mode) 1204 enum mt2063_delivery_sys Mode)
1205{ 1205{
1206 u32 status = 0; /* Status to be returned */ 1206 int status = 0; /* Status to be returned */
1207 u8 val; 1207 u8 val;
1208 u32 longval; 1208 u32 longval;
1209 1209
@@ -1345,7 +1345,7 @@ static u32 MT2063_SetReceiverMode(struct mt2063_state *state,
1345static u32 MT2063_ClearPowerMaskBits(struct mt2063_state *state, 1345static u32 MT2063_ClearPowerMaskBits(struct mt2063_state *state,
1346 enum MT2063_Mask_Bits Bits) 1346 enum MT2063_Mask_Bits Bits)
1347{ 1347{
1348 u32 status = 0; 1348 int status = 0;
1349 1349
1350 dprintk(2, "\n"); 1350 dprintk(2, "\n");
1351 Bits = (enum MT2063_Mask_Bits)(Bits & MT2063_ALL_SD); /* Only valid bits for this tuner */ 1351 Bits = (enum MT2063_Mask_Bits)(Bits & MT2063_ALL_SD); /* Only valid bits for this tuner */
@@ -1374,7 +1374,7 @@ static u32 MT2063_ClearPowerMaskBits(struct mt2063_state *state,
1374 */ 1374 */
1375static u32 MT2063_SoftwareShutdown(struct mt2063_state *state, u8 Shutdown) 1375static u32 MT2063_SoftwareShutdown(struct mt2063_state *state, u8 Shutdown)
1376{ 1376{
1377 u32 status; 1377 int status;
1378 1378
1379 dprintk(2, "\n"); 1379 dprintk(2, "\n");
1380 if (Shutdown == 1) 1380 if (Shutdown == 1)
@@ -1540,7 +1540,7 @@ static u32 FindClearTuneFilter(struct mt2063_state *state, u32 f_in)
1540static u32 MT2063_Tune(struct mt2063_state *state, u32 f_in) 1540static u32 MT2063_Tune(struct mt2063_state *state, u32 f_in)
1541{ /* RF input center frequency */ 1541{ /* RF input center frequency */
1542 1542
1543 u32 status = 0; 1543 int status = 0;
1544 u32 LO1; /* 1st LO register value */ 1544 u32 LO1; /* 1st LO register value */
1545 u32 Num1; /* Numerator for LO1 reg. value */ 1545 u32 Num1; /* Numerator for LO1 reg. value */
1546 u32 f_IF1; /* 1st IF requested */ 1546 u32 f_IF1; /* 1st IF requested */
@@ -1803,7 +1803,7 @@ static const u8 MT2063B3_defaults[] = {
1803 1803
1804static int mt2063_init(struct dvb_frontend *fe) 1804static int mt2063_init(struct dvb_frontend *fe)
1805{ 1805{
1806 u32 status; 1806 int status;
1807 struct mt2063_state *state = fe->tuner_priv; 1807 struct mt2063_state *state = fe->tuner_priv;
1808 u8 all_resets = 0xF0; /* reset/load bits */ 1808 u8 all_resets = 0xF0; /* reset/load bits */
1809 const u8 *def = NULL; 1809 const u8 *def = NULL;
@@ -2264,11 +2264,12 @@ struct dvb_frontend *mt2063_attach(struct dvb_frontend *fe,
2264} 2264}
2265EXPORT_SYMBOL_GPL(mt2063_attach); 2265EXPORT_SYMBOL_GPL(mt2063_attach);
2266 2266
2267#if 0
2267/* 2268/*
2268 * Ancillary routines visible outside mt2063 2269 * Ancillary routines visible outside mt2063
2269 * FIXME: Remove them in favor of using standard tuner callbacks 2270 * FIXME: Remove them in favor of using standard tuner callbacks
2270 */ 2271 */
2271unsigned int tuner_MT2063_SoftwareShutdown(struct dvb_frontend *fe) 2272static int tuner_MT2063_SoftwareShutdown(struct dvb_frontend *fe)
2272{ 2273{
2273 struct mt2063_state *state = fe->tuner_priv; 2274 struct mt2063_state *state = fe->tuner_priv;
2274 int err = 0; 2275 int err = 0;
@@ -2281,9 +2282,8 @@ unsigned int tuner_MT2063_SoftwareShutdown(struct dvb_frontend *fe)
2281 2282
2282 return err; 2283 return err;
2283} 2284}
2284EXPORT_SYMBOL_GPL(tuner_MT2063_SoftwareShutdown);
2285 2285
2286unsigned int tuner_MT2063_ClearPowerMaskBits(struct dvb_frontend *fe) 2286static int tuner_MT2063_ClearPowerMaskBits(struct dvb_frontend *fe)
2287{ 2287{
2288 struct mt2063_state *state = fe->tuner_priv; 2288 struct mt2063_state *state = fe->tuner_priv;
2289 int err = 0; 2289 int err = 0;
@@ -2296,7 +2296,7 @@ unsigned int tuner_MT2063_ClearPowerMaskBits(struct dvb_frontend *fe)
2296 2296
2297 return err; 2297 return err;
2298} 2298}
2299EXPORT_SYMBOL_GPL(tuner_MT2063_ClearPowerMaskBits); 2299#endif
2300 2300
2301MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 2301MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
2302MODULE_DESCRIPTION("MT2063 Silicon tuner"); 2302MODULE_DESCRIPTION("MT2063 Silicon tuner");
diff --git a/drivers/media/tuners/mt2063.h b/drivers/media/tuners/mt2063.h
index 3f5cfd93713f..ab24170c1571 100644
--- a/drivers/media/tuners/mt2063.h
+++ b/drivers/media/tuners/mt2063.h
@@ -23,10 +23,6 @@ static inline struct dvb_frontend *mt2063_attach(struct dvb_frontend *fe,
23 return NULL; 23 return NULL;
24} 24}
25 25
26/* FIXME: Should use the standard DVB attachment interfaces */
27unsigned int tuner_MT2063_SoftwareShutdown(struct dvb_frontend *fe);
28unsigned int tuner_MT2063_ClearPowerMaskBits(struct dvb_frontend *fe);
29
30#endif /* CONFIG_DVB_MT2063 */ 26#endif /* CONFIG_DVB_MT2063 */
31 27
32#endif /* __MT2063_H__ */ 28#endif /* __MT2063_H__ */