diff options
author | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-05-21 12:08:18 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-05-25 16:50:13 -0400 |
commit | 859ae7f01237dfb024951a759087790e4d4232e1 (patch) | |
tree | 4b504608289d55c957a165386cc3040a16d90a92 /drivers/media/tuners/xc5000.c | |
parent | f6fef8634163cc86f9aa193db360ffce26821bf3 (diff) |
[media] xc5000: get rid of positive error codes
Errors should also be negative and should follow the Kernel
standards.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/tuners/xc5000.c')
-rw-r--r-- | drivers/media/tuners/xc5000.c | 104 |
1 files changed, 48 insertions, 56 deletions
diff --git a/drivers/media/tuners/xc5000.c b/drivers/media/tuners/xc5000.c index 5cd09a681b6a..94278cc5f3ef 100644 --- a/drivers/media/tuners/xc5000.c +++ b/drivers/media/tuners/xc5000.c | |||
@@ -75,13 +75,6 @@ struct xc5000_priv { | |||
75 | #define XC_RF_MODE_AIR 0 | 75 | #define XC_RF_MODE_AIR 0 |
76 | #define XC_RF_MODE_CABLE 1 | 76 | #define XC_RF_MODE_CABLE 1 |
77 | 77 | ||
78 | /* Result codes */ | ||
79 | #define XC_RESULT_SUCCESS 0 | ||
80 | #define XC_RESULT_RESET_FAILURE 1 | ||
81 | #define XC_RESULT_I2C_WRITE_FAILURE 2 | ||
82 | #define XC_RESULT_I2C_READ_FAILURE 3 | ||
83 | #define XC_RESULT_OUT_OF_RANGE 5 | ||
84 | |||
85 | /* Product id */ | 78 | /* Product id */ |
86 | #define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000 | 79 | #define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000 |
87 | #define XC_PRODUCT_ID_FW_LOADED 0x1388 | 80 | #define XC_PRODUCT_ID_FW_LOADED 0x1388 |
@@ -258,9 +251,9 @@ static int xc_send_i2c_data(struct xc5000_priv *priv, u8 *buf, int len) | |||
258 | 251 | ||
259 | if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { | 252 | if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { |
260 | printk(KERN_ERR "xc5000: I2C write failed (len=%i)\n", len); | 253 | printk(KERN_ERR "xc5000: I2C write failed (len=%i)\n", len); |
261 | return XC_RESULT_I2C_WRITE_FAILURE; | 254 | return -EREMOTEIO; |
262 | } | 255 | } |
263 | return XC_RESULT_SUCCESS; | 256 | return 0; |
264 | } | 257 | } |
265 | 258 | ||
266 | #if 0 | 259 | #if 0 |
@@ -297,7 +290,7 @@ static int xc5000_readreg(struct xc5000_priv *priv, u16 reg, u16 *val) | |||
297 | } | 290 | } |
298 | 291 | ||
299 | *val = (bval[0] << 8) | bval[1]; | 292 | *val = (bval[0] << 8) | bval[1]; |
300 | return XC_RESULT_SUCCESS; | 293 | return 0; |
301 | } | 294 | } |
302 | 295 | ||
303 | static void xc_wait(int wait_ms) | 296 | static void xc_wait(int wait_ms) |
@@ -320,13 +313,13 @@ static int xc5000_TunerReset(struct dvb_frontend *fe) | |||
320 | XC5000_TUNER_RESET, 0); | 313 | XC5000_TUNER_RESET, 0); |
321 | if (ret) { | 314 | if (ret) { |
322 | printk(KERN_ERR "xc5000: reset failed\n"); | 315 | printk(KERN_ERR "xc5000: reset failed\n"); |
323 | return XC_RESULT_RESET_FAILURE; | 316 | return ret; |
324 | } | 317 | } |
325 | } else { | 318 | } else { |
326 | printk(KERN_ERR "xc5000: no tuner reset callback function, fatal\n"); | 319 | printk(KERN_ERR "xc5000: no tuner reset callback function, fatal\n"); |
327 | return XC_RESULT_RESET_FAILURE; | 320 | return -EINVAL; |
328 | } | 321 | } |
329 | return XC_RESULT_SUCCESS; | 322 | return 0; |
330 | } | 323 | } |
331 | 324 | ||
332 | static int xc_write_reg(struct xc5000_priv *priv, u16 regAddr, u16 i2cData) | 325 | static int xc_write_reg(struct xc5000_priv *priv, u16 regAddr, u16 i2cData) |
@@ -340,11 +333,11 @@ static int xc_write_reg(struct xc5000_priv *priv, u16 regAddr, u16 i2cData) | |||
340 | buf[2] = (i2cData >> 8) & 0xFF; | 333 | buf[2] = (i2cData >> 8) & 0xFF; |
341 | buf[3] = i2cData & 0xFF; | 334 | buf[3] = i2cData & 0xFF; |
342 | result = xc_send_i2c_data(priv, buf, 4); | 335 | result = xc_send_i2c_data(priv, buf, 4); |
343 | if (result == XC_RESULT_SUCCESS) { | 336 | if (result == 0) { |
344 | /* wait for busy flag to clear */ | 337 | /* wait for busy flag to clear */ |
345 | while ((WatchDogTimer > 0) && (result == XC_RESULT_SUCCESS)) { | 338 | while ((WatchDogTimer > 0) && (result == 0)) { |
346 | result = xc5000_readreg(priv, XREG_BUSY, (u16 *)buf); | 339 | result = xc5000_readreg(priv, XREG_BUSY, (u16 *)buf); |
347 | if (result == XC_RESULT_SUCCESS) { | 340 | if (result == 0) { |
348 | if ((buf[0] == 0) && (buf[1] == 0)) { | 341 | if ((buf[0] == 0) && (buf[1] == 0)) { |
349 | /* busy flag cleared */ | 342 | /* busy flag cleared */ |
350 | break; | 343 | break; |
@@ -356,7 +349,7 @@ static int xc_write_reg(struct xc5000_priv *priv, u16 regAddr, u16 i2cData) | |||
356 | } | 349 | } |
357 | } | 350 | } |
358 | if (WatchDogTimer <= 0) | 351 | if (WatchDogTimer <= 0) |
359 | result = XC_RESULT_I2C_WRITE_FAILURE; | 352 | result = -EREMOTEIO; |
360 | 353 | ||
361 | return result; | 354 | return result; |
362 | } | 355 | } |
@@ -377,7 +370,7 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) | |||
377 | /* RESET command */ | 370 | /* RESET command */ |
378 | result = xc5000_TunerReset(fe); | 371 | result = xc5000_TunerReset(fe); |
379 | index += 2; | 372 | index += 2; |
380 | if (result != XC_RESULT_SUCCESS) | 373 | if (result != 0) |
381 | return result; | 374 | return result; |
382 | } else if (len & 0x8000) { | 375 | } else if (len & 0x8000) { |
383 | /* WAIT command */ | 376 | /* WAIT command */ |
@@ -404,7 +397,7 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) | |||
404 | result = xc_send_i2c_data(priv, buf, | 397 | result = xc_send_i2c_data(priv, buf, |
405 | nbytes_to_send); | 398 | nbytes_to_send); |
406 | 399 | ||
407 | if (result != XC_RESULT_SUCCESS) | 400 | if (result != 0) |
408 | return result; | 401 | return result; |
409 | 402 | ||
410 | pos += nbytes_to_send - 2; | 403 | pos += nbytes_to_send - 2; |
@@ -412,7 +405,7 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) | |||
412 | index += len; | 405 | index += len; |
413 | } | 406 | } |
414 | } | 407 | } |
415 | return XC_RESULT_SUCCESS; | 408 | return 0; |
416 | } | 409 | } |
417 | 410 | ||
418 | static int xc_initialize(struct xc5000_priv *priv) | 411 | static int xc_initialize(struct xc5000_priv *priv) |
@@ -437,7 +430,7 @@ static int xc_SetTVStandard(struct xc5000_priv *priv, | |||
437 | } | 430 | } |
438 | 431 | ||
439 | ret = xc_write_reg(priv, XREG_VIDEO_MODE, VideoMode); | 432 | ret = xc_write_reg(priv, XREG_VIDEO_MODE, VideoMode); |
440 | if (ret == XC_RESULT_SUCCESS) | 433 | if (ret == 0) |
441 | ret = xc_write_reg(priv, XREG_AUDIO_MODE, AudioMode); | 434 | ret = xc_write_reg(priv, XREG_AUDIO_MODE, AudioMode); |
442 | 435 | ||
443 | return ret; | 436 | return ret; |
@@ -467,7 +460,7 @@ static int xc_set_RF_frequency(struct xc5000_priv *priv, u32 freq_hz) | |||
467 | 460 | ||
468 | if ((freq_hz > xc5000_tuner_ops.info.frequency_max) || | 461 | if ((freq_hz > xc5000_tuner_ops.info.frequency_max) || |
469 | (freq_hz < xc5000_tuner_ops.info.frequency_min)) | 462 | (freq_hz < xc5000_tuner_ops.info.frequency_min)) |
470 | return XC_RESULT_OUT_OF_RANGE; | 463 | return -EINVAL; |
471 | 464 | ||
472 | freq_code = (u16)(freq_hz / 15625); | 465 | freq_code = (u16)(freq_hz / 15625); |
473 | 466 | ||
@@ -500,7 +493,7 @@ static int xc_get_frequency_error(struct xc5000_priv *priv, u32 *freq_error_hz) | |||
500 | u32 tmp; | 493 | u32 tmp; |
501 | 494 | ||
502 | result = xc5000_readreg(priv, XREG_FREQ_ERROR, ®Data); | 495 | result = xc5000_readreg(priv, XREG_FREQ_ERROR, ®Data); |
503 | if (result != XC_RESULT_SUCCESS) | 496 | if (result != 0) |
504 | return result; | 497 | return result; |
505 | 498 | ||
506 | tmp = (u32)regData; | 499 | tmp = (u32)regData; |
@@ -521,7 +514,7 @@ static int xc_get_version(struct xc5000_priv *priv, | |||
521 | int result; | 514 | int result; |
522 | 515 | ||
523 | result = xc5000_readreg(priv, XREG_VERSION, &data); | 516 | result = xc5000_readreg(priv, XREG_VERSION, &data); |
524 | if (result != XC_RESULT_SUCCESS) | 517 | if (result != 0) |
525 | return result; | 518 | return result; |
526 | 519 | ||
527 | (*hw_majorversion) = (data >> 12) & 0x0F; | 520 | (*hw_majorversion) = (data >> 12) & 0x0F; |
@@ -543,7 +536,7 @@ static int xc_get_hsync_freq(struct xc5000_priv *priv, u32 *hsync_freq_hz) | |||
543 | int result; | 536 | int result; |
544 | 537 | ||
545 | result = xc5000_readreg(priv, XREG_HSYNC_FREQ, ®Data); | 538 | result = xc5000_readreg(priv, XREG_HSYNC_FREQ, ®Data); |
546 | if (result != XC_RESULT_SUCCESS) | 539 | if (result != 0) |
547 | return result; | 540 | return result; |
548 | 541 | ||
549 | (*hsync_freq_hz) = ((regData & 0x0fff) * 763)/100; | 542 | (*hsync_freq_hz) = ((regData & 0x0fff) * 763)/100; |
@@ -593,7 +586,7 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode) | |||
593 | 586 | ||
594 | dprintk(1, "%s(%u)\n", __func__, freq_hz); | 587 | dprintk(1, "%s(%u)\n", __func__, freq_hz); |
595 | 588 | ||
596 | if (xc_set_RF_frequency(priv, freq_hz) != XC_RESULT_SUCCESS) | 589 | if (xc_set_RF_frequency(priv, freq_hz) != 0) |
597 | return 0; | 590 | return 0; |
598 | 591 | ||
599 | if (mode == XC_TUNE_ANALOG) { | 592 | if (mode == XC_TUNE_ANALOG) { |
@@ -607,7 +600,7 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode) | |||
607 | static int xc_set_xtal(struct dvb_frontend *fe) | 600 | static int xc_set_xtal(struct dvb_frontend *fe) |
608 | { | 601 | { |
609 | struct xc5000_priv *priv = fe->tuner_priv; | 602 | struct xc5000_priv *priv = fe->tuner_priv; |
610 | int ret = XC_RESULT_SUCCESS; | 603 | int ret = 0; |
611 | 604 | ||
612 | switch (priv->chip_id) { | 605 | switch (priv->chip_id) { |
613 | default: | 606 | default: |
@@ -649,23 +642,22 @@ static int xc5000_fwupload(struct dvb_frontend *fe) | |||
649 | priv->i2c_props.adap->dev.parent); | 642 | priv->i2c_props.adap->dev.parent); |
650 | if (ret) { | 643 | if (ret) { |
651 | printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n"); | 644 | printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n"); |
652 | ret = XC_RESULT_RESET_FAILURE; | ||
653 | goto out; | 645 | goto out; |
654 | } else { | 646 | } else { |
655 | printk(KERN_DEBUG "xc5000: firmware read %Zu bytes.\n", | 647 | printk(KERN_DEBUG "xc5000: firmware read %Zu bytes.\n", |
656 | fw->size); | 648 | fw->size); |
657 | ret = XC_RESULT_SUCCESS; | 649 | ret = 0; |
658 | } | 650 | } |
659 | 651 | ||
660 | if (fw->size != desired_fw->size) { | 652 | if (fw->size != desired_fw->size) { |
661 | printk(KERN_ERR "xc5000: firmware incorrect size\n"); | 653 | printk(KERN_ERR "xc5000: firmware incorrect size\n"); |
662 | ret = XC_RESULT_RESET_FAILURE; | 654 | ret = -EINVAL; |
663 | } else { | 655 | } else { |
664 | printk(KERN_INFO "xc5000: firmware uploading...\n"); | 656 | printk(KERN_INFO "xc5000: firmware uploading...\n"); |
665 | ret = xc_load_i2c_sequence(fe, fw->data); | 657 | ret = xc_load_i2c_sequence(fe, fw->data); |
666 | if (XC_RESULT_SUCCESS == ret) | 658 | if (0 == ret) |
667 | ret = xc_set_xtal(fe); | 659 | ret = xc_set_xtal(fe); |
668 | if (XC_RESULT_SUCCESS == ret) | 660 | if (0 == ret) |
669 | printk(KERN_INFO "xc5000: firmware upload complete...\n"); | 661 | printk(KERN_INFO "xc5000: firmware upload complete...\n"); |
670 | else | 662 | else |
671 | printk(KERN_ERR "xc5000: firmware upload failed...\n"); | 663 | printk(KERN_ERR "xc5000: firmware upload failed...\n"); |
@@ -744,7 +736,7 @@ static int xc5000_set_params(struct dvb_frontend *fe) | |||
744 | u32 freq = fe->dtv_property_cache.frequency; | 736 | u32 freq = fe->dtv_property_cache.frequency; |
745 | u32 delsys = fe->dtv_property_cache.delivery_system; | 737 | u32 delsys = fe->dtv_property_cache.delivery_system; |
746 | 738 | ||
747 | if (xc_load_fw_and_init_tuner(fe, 0) != XC_RESULT_SUCCESS) { | 739 | if (xc_load_fw_and_init_tuner(fe, 0) != 0) { |
748 | dprintk(1, "Unable to load firmware and init tuner\n"); | 740 | dprintk(1, "Unable to load firmware and init tuner\n"); |
749 | return -EINVAL; | 741 | return -EINVAL; |
750 | } | 742 | } |
@@ -821,7 +813,7 @@ static int xc5000_set_params(struct dvb_frontend *fe) | |||
821 | __func__, freq, priv->freq_hz); | 813 | __func__, freq, priv->freq_hz); |
822 | 814 | ||
823 | ret = xc_SetSignalSource(priv, priv->rf_mode); | 815 | ret = xc_SetSignalSource(priv, priv->rf_mode); |
824 | if (ret != XC_RESULT_SUCCESS) { | 816 | if (ret != 0) { |
825 | printk(KERN_ERR | 817 | printk(KERN_ERR |
826 | "xc5000: xc_SetSignalSource(%d) failed\n", | 818 | "xc5000: xc_SetSignalSource(%d) failed\n", |
827 | priv->rf_mode); | 819 | priv->rf_mode); |
@@ -831,13 +823,13 @@ static int xc5000_set_params(struct dvb_frontend *fe) | |||
831 | ret = xc_SetTVStandard(priv, | 823 | ret = xc_SetTVStandard(priv, |
832 | XC5000_Standard[priv->video_standard].VideoMode, | 824 | XC5000_Standard[priv->video_standard].VideoMode, |
833 | XC5000_Standard[priv->video_standard].AudioMode, 0); | 825 | XC5000_Standard[priv->video_standard].AudioMode, 0); |
834 | if (ret != XC_RESULT_SUCCESS) { | 826 | if (ret != 0) { |
835 | printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n"); | 827 | printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n"); |
836 | return -EREMOTEIO; | 828 | return -EREMOTEIO; |
837 | } | 829 | } |
838 | 830 | ||
839 | ret = xc_set_IF_frequency(priv, priv->if_khz); | 831 | ret = xc_set_IF_frequency(priv, priv->if_khz); |
840 | if (ret != XC_RESULT_SUCCESS) { | 832 | if (ret != 0) { |
841 | printk(KERN_ERR "xc5000: xc_Set_IF_frequency(%d) failed\n", | 833 | printk(KERN_ERR "xc5000: xc_Set_IF_frequency(%d) failed\n", |
842 | priv->if_khz); | 834 | priv->if_khz); |
843 | return -EIO; | 835 | return -EIO; |
@@ -862,15 +854,15 @@ static int xc5000_is_firmware_loaded(struct dvb_frontend *fe) | |||
862 | u16 id; | 854 | u16 id; |
863 | 855 | ||
864 | ret = xc5000_readreg(priv, XREG_PRODUCT_ID, &id); | 856 | ret = xc5000_readreg(priv, XREG_PRODUCT_ID, &id); |
865 | if (ret == XC_RESULT_SUCCESS) { | 857 | if (ret == 0) { |
866 | if (id == XC_PRODUCT_ID_FW_NOT_LOADED) | 858 | if (id == XC_PRODUCT_ID_FW_NOT_LOADED) |
867 | ret = XC_RESULT_RESET_FAILURE; | 859 | ret = -ENOENT; |
868 | else | 860 | else |
869 | ret = XC_RESULT_SUCCESS; | 861 | ret = 0; |
870 | } | 862 | } |
871 | 863 | ||
872 | dprintk(1, "%s() returns %s id = 0x%x\n", __func__, | 864 | dprintk(1, "%s() returns %s id = 0x%x\n", __func__, |
873 | ret == XC_RESULT_SUCCESS ? "True" : "False", id); | 865 | ret == 0 ? "True" : "False", id); |
874 | return ret; | 866 | return ret; |
875 | } | 867 | } |
876 | 868 | ||
@@ -937,7 +929,7 @@ static int xc5000_set_tv_freq(struct dvb_frontend *fe, | |||
937 | 929 | ||
938 | tune_channel: | 930 | tune_channel: |
939 | ret = xc_SetSignalSource(priv, priv->rf_mode); | 931 | ret = xc_SetSignalSource(priv, priv->rf_mode); |
940 | if (ret != XC_RESULT_SUCCESS) { | 932 | if (ret != 0) { |
941 | printk(KERN_ERR | 933 | printk(KERN_ERR |
942 | "xc5000: xc_SetSignalSource(%d) failed\n", | 934 | "xc5000: xc_SetSignalSource(%d) failed\n", |
943 | priv->rf_mode); | 935 | priv->rf_mode); |
@@ -947,7 +939,7 @@ tune_channel: | |||
947 | ret = xc_SetTVStandard(priv, | 939 | ret = xc_SetTVStandard(priv, |
948 | XC5000_Standard[priv->video_standard].VideoMode, | 940 | XC5000_Standard[priv->video_standard].VideoMode, |
949 | XC5000_Standard[priv->video_standard].AudioMode, 0); | 941 | XC5000_Standard[priv->video_standard].AudioMode, 0); |
950 | if (ret != XC_RESULT_SUCCESS) { | 942 | if (ret != 0) { |
951 | printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n"); | 943 | printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n"); |
952 | return -EREMOTEIO; | 944 | return -EREMOTEIO; |
953 | } | 945 | } |
@@ -966,7 +958,7 @@ tune_channel: | |||
966 | /* PLL is unlocked, force reload of the firmware */ | 958 | /* PLL is unlocked, force reload of the firmware */ |
967 | dprintk(1, "xc5000: PLL not locked (0x%x). Reloading...\n", | 959 | dprintk(1, "xc5000: PLL not locked (0x%x). Reloading...\n", |
968 | pll_lock_status); | 960 | pll_lock_status); |
969 | if (xc_load_fw_and_init_tuner(fe, 1) != XC_RESULT_SUCCESS) { | 961 | if (xc_load_fw_and_init_tuner(fe, 1) != 0) { |
970 | printk(KERN_ERR "xc5000: Unable to reload fw\n"); | 962 | printk(KERN_ERR "xc5000: Unable to reload fw\n"); |
971 | return -EREMOTEIO; | 963 | return -EREMOTEIO; |
972 | } | 964 | } |
@@ -1011,13 +1003,13 @@ static int xc5000_set_radio_freq(struct dvb_frontend *fe, | |||
1011 | ret = xc_SetTVStandard(priv, XC5000_Standard[radio_input].VideoMode, | 1003 | ret = xc_SetTVStandard(priv, XC5000_Standard[radio_input].VideoMode, |
1012 | XC5000_Standard[radio_input].AudioMode, radio_input); | 1004 | XC5000_Standard[radio_input].AudioMode, radio_input); |
1013 | 1005 | ||
1014 | if (ret != XC_RESULT_SUCCESS) { | 1006 | if (ret != 0) { |
1015 | printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n"); | 1007 | printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n"); |
1016 | return -EREMOTEIO; | 1008 | return -EREMOTEIO; |
1017 | } | 1009 | } |
1018 | 1010 | ||
1019 | ret = xc_SetSignalSource(priv, priv->rf_mode); | 1011 | ret = xc_SetSignalSource(priv, priv->rf_mode); |
1020 | if (ret != XC_RESULT_SUCCESS) { | 1012 | if (ret != 0) { |
1021 | printk(KERN_ERR | 1013 | printk(KERN_ERR |
1022 | "xc5000: xc_SetSignalSource(%d) failed\n", | 1014 | "xc5000: xc_SetSignalSource(%d) failed\n", |
1023 | priv->rf_mode); | 1015 | priv->rf_mode); |
@@ -1044,7 +1036,7 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe, | |||
1044 | if (priv->i2c_props.adap == NULL) | 1036 | if (priv->i2c_props.adap == NULL) |
1045 | return -EINVAL; | 1037 | return -EINVAL; |
1046 | 1038 | ||
1047 | if (xc_load_fw_and_init_tuner(fe, 0) != XC_RESULT_SUCCESS) { | 1039 | if (xc_load_fw_and_init_tuner(fe, 0) != 0) { |
1048 | dprintk(1, "Unable to load firmware and init tuner\n"); | 1040 | dprintk(1, "Unable to load firmware and init tuner\n"); |
1049 | return -EINVAL; | 1041 | return -EINVAL; |
1050 | } | 1042 | } |
@@ -1105,23 +1097,23 @@ static int xc5000_get_status(struct dvb_frontend *fe, u32 *status) | |||
1105 | static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force) | 1097 | static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force) |
1106 | { | 1098 | { |
1107 | struct xc5000_priv *priv = fe->tuner_priv; | 1099 | struct xc5000_priv *priv = fe->tuner_priv; |
1108 | int ret = XC_RESULT_SUCCESS; | 1100 | int ret = 0; |
1109 | u16 pll_lock_status; | 1101 | u16 pll_lock_status; |
1110 | u16 fw_ck; | 1102 | u16 fw_ck; |
1111 | 1103 | ||
1112 | if (force || xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { | 1104 | if (force || xc5000_is_firmware_loaded(fe) != 0) { |
1113 | 1105 | ||
1114 | fw_retry: | 1106 | fw_retry: |
1115 | 1107 | ||
1116 | ret = xc5000_fwupload(fe); | 1108 | ret = xc5000_fwupload(fe); |
1117 | if (ret != XC_RESULT_SUCCESS) | 1109 | if (ret != 0) |
1118 | return ret; | 1110 | return ret; |
1119 | 1111 | ||
1120 | msleep(20); | 1112 | msleep(20); |
1121 | 1113 | ||
1122 | if (priv->fw_checksum_supported) { | 1114 | if (priv->fw_checksum_supported) { |
1123 | if (xc5000_readreg(priv, XREG_FW_CHECKSUM, &fw_ck) | 1115 | if (xc5000_readreg(priv, XREG_FW_CHECKSUM, &fw_ck) |
1124 | != XC_RESULT_SUCCESS) { | 1116 | != 0) { |
1125 | dprintk(1, "%s() FW checksum reading failed.\n", | 1117 | dprintk(1, "%s() FW checksum reading failed.\n", |
1126 | __func__); | 1118 | __func__); |
1127 | goto fw_retry; | 1119 | goto fw_retry; |
@@ -1137,7 +1129,7 @@ fw_retry: | |||
1137 | /* Start the tuner self-calibration process */ | 1129 | /* Start the tuner self-calibration process */ |
1138 | ret |= xc_initialize(priv); | 1130 | ret |= xc_initialize(priv); |
1139 | 1131 | ||
1140 | if (ret != XC_RESULT_SUCCESS) | 1132 | if (ret != 0) |
1141 | goto fw_retry; | 1133 | goto fw_retry; |
1142 | 1134 | ||
1143 | /* Wait for calibration to complete. | 1135 | /* Wait for calibration to complete. |
@@ -1148,7 +1140,7 @@ fw_retry: | |||
1148 | xc_wait(100); | 1140 | xc_wait(100); |
1149 | 1141 | ||
1150 | if (priv->init_status_supported) { | 1142 | if (priv->init_status_supported) { |
1151 | if (xc5000_readreg(priv, XREG_INIT_STATUS, &fw_ck) != XC_RESULT_SUCCESS) { | 1143 | if (xc5000_readreg(priv, XREG_INIT_STATUS, &fw_ck) != 0) { |
1152 | dprintk(1, "%s() FW failed reading init status.\n", | 1144 | dprintk(1, "%s() FW failed reading init status.\n", |
1153 | __func__); | 1145 | __func__); |
1154 | goto fw_retry; | 1146 | goto fw_retry; |
@@ -1191,13 +1183,13 @@ static int xc5000_sleep(struct dvb_frontend *fe) | |||
1191 | was removed in newer versions of the firmware. The "supported" | 1183 | was removed in newer versions of the firmware. The "supported" |
1192 | way to sleep the tuner is to pull the reset pin low for 10ms */ | 1184 | way to sleep the tuner is to pull the reset pin low for 10ms */ |
1193 | ret = xc5000_TunerReset(fe); | 1185 | ret = xc5000_TunerReset(fe); |
1194 | if (ret != XC_RESULT_SUCCESS) { | 1186 | if (ret != 0) { |
1195 | printk(KERN_ERR | 1187 | printk(KERN_ERR |
1196 | "xc5000: %s() unable to shutdown tuner\n", | 1188 | "xc5000: %s() unable to shutdown tuner\n", |
1197 | __func__); | 1189 | __func__); |
1198 | return -EREMOTEIO; | 1190 | return -EREMOTEIO; |
1199 | } else | 1191 | } else |
1200 | return XC_RESULT_SUCCESS; | 1192 | return 0; |
1201 | } | 1193 | } |
1202 | 1194 | ||
1203 | static int xc5000_init(struct dvb_frontend *fe) | 1195 | static int xc5000_init(struct dvb_frontend *fe) |
@@ -1205,7 +1197,7 @@ static int xc5000_init(struct dvb_frontend *fe) | |||
1205 | struct xc5000_priv *priv = fe->tuner_priv; | 1197 | struct xc5000_priv *priv = fe->tuner_priv; |
1206 | dprintk(1, "%s()\n", __func__); | 1198 | dprintk(1, "%s()\n", __func__); |
1207 | 1199 | ||
1208 | if (xc_load_fw_and_init_tuner(fe, 0) != XC_RESULT_SUCCESS) { | 1200 | if (xc_load_fw_and_init_tuner(fe, 0) != 0) { |
1209 | printk(KERN_ERR "xc5000: Unable to initialise tuner\n"); | 1201 | printk(KERN_ERR "xc5000: Unable to initialise tuner\n"); |
1210 | return -EREMOTEIO; | 1202 | return -EREMOTEIO; |
1211 | } | 1203 | } |
@@ -1327,7 +1319,7 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, | |||
1327 | /* Check if firmware has been loaded. It is possible that another | 1319 | /* Check if firmware has been loaded. It is possible that another |
1328 | instance of the driver has loaded the firmware. | 1320 | instance of the driver has loaded the firmware. |
1329 | */ | 1321 | */ |
1330 | if (xc5000_readreg(priv, XREG_PRODUCT_ID, &id) != XC_RESULT_SUCCESS) | 1322 | if (xc5000_readreg(priv, XREG_PRODUCT_ID, &id) != 0) |
1331 | goto fail; | 1323 | goto fail; |
1332 | 1324 | ||
1333 | switch (id) { | 1325 | switch (id) { |