Commit 859ae7f0 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] xc5000: get rid of positive error codes

Errors should also be negative and should follow the Kernel
standards.
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent f6fef863
...@@ -75,13 +75,6 @@ struct xc5000_priv { ...@@ -75,13 +75,6 @@ struct xc5000_priv {
#define XC_RF_MODE_AIR 0 #define XC_RF_MODE_AIR 0
#define XC_RF_MODE_CABLE 1 #define XC_RF_MODE_CABLE 1
/* Result codes */
#define XC_RESULT_SUCCESS 0
#define XC_RESULT_RESET_FAILURE 1
#define XC_RESULT_I2C_WRITE_FAILURE 2
#define XC_RESULT_I2C_READ_FAILURE 3
#define XC_RESULT_OUT_OF_RANGE 5
/* Product id */ /* Product id */
#define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000 #define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000
#define XC_PRODUCT_ID_FW_LOADED 0x1388 #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,9 +251,9 @@ static int xc_send_i2c_data(struct xc5000_priv *priv, u8 *buf, int len)
if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) { if (i2c_transfer(priv->i2c_props.adap, &msg, 1) != 1) {
printk(KERN_ERR "xc5000: I2C write failed (len=%i)\n", len); printk(KERN_ERR "xc5000: I2C write failed (len=%i)\n", len);
return XC_RESULT_I2C_WRITE_FAILURE; return -EREMOTEIO;
} }
return XC_RESULT_SUCCESS; return 0;
} }
#if 0 #if 0
...@@ -297,7 +290,7 @@ static int xc5000_readreg(struct xc5000_priv *priv, u16 reg, u16 *val) ...@@ -297,7 +290,7 @@ static int xc5000_readreg(struct xc5000_priv *priv, u16 reg, u16 *val)
} }
*val = (bval[0] << 8) | bval[1]; *val = (bval[0] << 8) | bval[1];
return XC_RESULT_SUCCESS; return 0;
} }
static void xc_wait(int wait_ms) static void xc_wait(int wait_ms)
...@@ -320,13 +313,13 @@ static int xc5000_TunerReset(struct dvb_frontend *fe) ...@@ -320,13 +313,13 @@ static int xc5000_TunerReset(struct dvb_frontend *fe)
XC5000_TUNER_RESET, 0); XC5000_TUNER_RESET, 0);
if (ret) { if (ret) {
printk(KERN_ERR "xc5000: reset failed\n"); printk(KERN_ERR "xc5000: reset failed\n");
return XC_RESULT_RESET_FAILURE; return ret;
} }
} else { } else {
printk(KERN_ERR "xc5000: no tuner reset callback function, fatal\n"); printk(KERN_ERR "xc5000: no tuner reset callback function, fatal\n");
return XC_RESULT_RESET_FAILURE; return -EINVAL;
} }
return XC_RESULT_SUCCESS; return 0;
} }
static int xc_write_reg(struct xc5000_priv *priv, u16 regAddr, u16 i2cData) 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,11 +333,11 @@ static int xc_write_reg(struct xc5000_priv *priv, u16 regAddr, u16 i2cData)
buf[2] = (i2cData >> 8) & 0xFF; buf[2] = (i2cData >> 8) & 0xFF;
buf[3] = i2cData & 0xFF; buf[3] = i2cData & 0xFF;
result = xc_send_i2c_data(priv, buf, 4); result = xc_send_i2c_data(priv, buf, 4);
if (result == XC_RESULT_SUCCESS) { if (result == 0) {
/* wait for busy flag to clear */ /* wait for busy flag to clear */
while ((WatchDogTimer > 0) && (result == XC_RESULT_SUCCESS)) { while ((WatchDogTimer > 0) && (result == 0)) {
result = xc5000_readreg(priv, XREG_BUSY, (u16 *)buf); result = xc5000_readreg(priv, XREG_BUSY, (u16 *)buf);
if (result == XC_RESULT_SUCCESS) { if (result == 0) {
if ((buf[0] == 0) && (buf[1] == 0)) { if ((buf[0] == 0) && (buf[1] == 0)) {
/* busy flag cleared */ /* busy flag cleared */
break; break;
...@@ -356,7 +349,7 @@ static int xc_write_reg(struct xc5000_priv *priv, u16 regAddr, u16 i2cData) ...@@ -356,7 +349,7 @@ static int xc_write_reg(struct xc5000_priv *priv, u16 regAddr, u16 i2cData)
} }
} }
if (WatchDogTimer <= 0) if (WatchDogTimer <= 0)
result = XC_RESULT_I2C_WRITE_FAILURE; result = -EREMOTEIO;
return result; return result;
} }
...@@ -377,7 +370,7 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) ...@@ -377,7 +370,7 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence)
/* RESET command */ /* RESET command */
result = xc5000_TunerReset(fe); result = xc5000_TunerReset(fe);
index += 2; index += 2;
if (result != XC_RESULT_SUCCESS) if (result != 0)
return result; return result;
} else if (len & 0x8000) { } else if (len & 0x8000) {
/* WAIT command */ /* WAIT command */
...@@ -404,7 +397,7 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) ...@@ -404,7 +397,7 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence)
result = xc_send_i2c_data(priv, buf, result = xc_send_i2c_data(priv, buf,
nbytes_to_send); nbytes_to_send);
if (result != XC_RESULT_SUCCESS) if (result != 0)
return result; return result;
pos += nbytes_to_send - 2; pos += nbytes_to_send - 2;
...@@ -412,7 +405,7 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) ...@@ -412,7 +405,7 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence)
index += len; index += len;
} }
} }
return XC_RESULT_SUCCESS; return 0;
} }
static int xc_initialize(struct xc5000_priv *priv) static int xc_initialize(struct xc5000_priv *priv)
...@@ -437,7 +430,7 @@ static int xc_SetTVStandard(struct xc5000_priv *priv, ...@@ -437,7 +430,7 @@ static int xc_SetTVStandard(struct xc5000_priv *priv,
} }
ret = xc_write_reg(priv, XREG_VIDEO_MODE, VideoMode); ret = xc_write_reg(priv, XREG_VIDEO_MODE, VideoMode);
if (ret == XC_RESULT_SUCCESS) if (ret == 0)
ret = xc_write_reg(priv, XREG_AUDIO_MODE, AudioMode); ret = xc_write_reg(priv, XREG_AUDIO_MODE, AudioMode);
return ret; return ret;
...@@ -467,7 +460,7 @@ static int xc_set_RF_frequency(struct xc5000_priv *priv, u32 freq_hz) ...@@ -467,7 +460,7 @@ static int xc_set_RF_frequency(struct xc5000_priv *priv, u32 freq_hz)
if ((freq_hz > xc5000_tuner_ops.info.frequency_max) || if ((freq_hz > xc5000_tuner_ops.info.frequency_max) ||
(freq_hz < xc5000_tuner_ops.info.frequency_min)) (freq_hz < xc5000_tuner_ops.info.frequency_min))
return XC_RESULT_OUT_OF_RANGE; return -EINVAL;
freq_code = (u16)(freq_hz / 15625); freq_code = (u16)(freq_hz / 15625);
...@@ -500,7 +493,7 @@ static int xc_get_frequency_error(struct xc5000_priv *priv, u32 *freq_error_hz) ...@@ -500,7 +493,7 @@ static int xc_get_frequency_error(struct xc5000_priv *priv, u32 *freq_error_hz)
u32 tmp; u32 tmp;
result = xc5000_readreg(priv, XREG_FREQ_ERROR, &regData); result = xc5000_readreg(priv, XREG_FREQ_ERROR, &regData);
if (result != XC_RESULT_SUCCESS) if (result != 0)
return result; return result;
tmp = (u32)regData; tmp = (u32)regData;
...@@ -521,7 +514,7 @@ static int xc_get_version(struct xc5000_priv *priv, ...@@ -521,7 +514,7 @@ static int xc_get_version(struct xc5000_priv *priv,
int result; int result;
result = xc5000_readreg(priv, XREG_VERSION, &data); result = xc5000_readreg(priv, XREG_VERSION, &data);
if (result != XC_RESULT_SUCCESS) if (result != 0)
return result; return result;
(*hw_majorversion) = (data >> 12) & 0x0F; (*hw_majorversion) = (data >> 12) & 0x0F;
...@@ -543,7 +536,7 @@ static int xc_get_hsync_freq(struct xc5000_priv *priv, u32 *hsync_freq_hz) ...@@ -543,7 +536,7 @@ static int xc_get_hsync_freq(struct xc5000_priv *priv, u32 *hsync_freq_hz)
int result; int result;
result = xc5000_readreg(priv, XREG_HSYNC_FREQ, &regData); result = xc5000_readreg(priv, XREG_HSYNC_FREQ, &regData);
if (result != XC_RESULT_SUCCESS) if (result != 0)
return result; return result;
(*hsync_freq_hz) = ((regData & 0x0fff) * 763)/100; (*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,7 +586,7 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode)
dprintk(1, "%s(%u)\n", __func__, freq_hz); dprintk(1, "%s(%u)\n", __func__, freq_hz);
if (xc_set_RF_frequency(priv, freq_hz) != XC_RESULT_SUCCESS) if (xc_set_RF_frequency(priv, freq_hz) != 0)
return 0; return 0;
if (mode == XC_TUNE_ANALOG) { if (mode == XC_TUNE_ANALOG) {
...@@ -607,7 +600,7 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode) ...@@ -607,7 +600,7 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode)
static int xc_set_xtal(struct dvb_frontend *fe) static int xc_set_xtal(struct dvb_frontend *fe)
{ {
struct xc5000_priv *priv = fe->tuner_priv; struct xc5000_priv *priv = fe->tuner_priv;
int ret = XC_RESULT_SUCCESS; int ret = 0;
switch (priv->chip_id) { switch (priv->chip_id) {
default: default:
...@@ -649,23 +642,22 @@ static int xc5000_fwupload(struct dvb_frontend *fe) ...@@ -649,23 +642,22 @@ static int xc5000_fwupload(struct dvb_frontend *fe)
priv->i2c_props.adap->dev.parent); priv->i2c_props.adap->dev.parent);
if (ret) { if (ret) {
printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n"); printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n");
ret = XC_RESULT_RESET_FAILURE;
goto out; goto out;
} else { } else {
printk(KERN_DEBUG "xc5000: firmware read %Zu bytes.\n", printk(KERN_DEBUG "xc5000: firmware read %Zu bytes.\n",
fw->size); fw->size);
ret = XC_RESULT_SUCCESS; ret = 0;
} }
if (fw->size != desired_fw->size) { if (fw->size != desired_fw->size) {
printk(KERN_ERR "xc5000: firmware incorrect size\n"); printk(KERN_ERR "xc5000: firmware incorrect size\n");
ret = XC_RESULT_RESET_FAILURE; ret = -EINVAL;
} else { } else {
printk(KERN_INFO "xc5000: firmware uploading...\n"); printk(KERN_INFO "xc5000: firmware uploading...\n");
ret = xc_load_i2c_sequence(fe, fw->data); ret = xc_load_i2c_sequence(fe, fw->data);
if (XC_RESULT_SUCCESS == ret) if (0 == ret)
ret = xc_set_xtal(fe); ret = xc_set_xtal(fe);
if (XC_RESULT_SUCCESS == ret) if (0 == ret)
printk(KERN_INFO "xc5000: firmware upload complete...\n"); printk(KERN_INFO "xc5000: firmware upload complete...\n");
else else
printk(KERN_ERR "xc5000: firmware upload failed...\n"); printk(KERN_ERR "xc5000: firmware upload failed...\n");
...@@ -744,7 +736,7 @@ static int xc5000_set_params(struct dvb_frontend *fe) ...@@ -744,7 +736,7 @@ static int xc5000_set_params(struct dvb_frontend *fe)
u32 freq = fe->dtv_property_cache.frequency; u32 freq = fe->dtv_property_cache.frequency;
u32 delsys = fe->dtv_property_cache.delivery_system; u32 delsys = fe->dtv_property_cache.delivery_system;
if (xc_load_fw_and_init_tuner(fe, 0) != XC_RESULT_SUCCESS) { if (xc_load_fw_and_init_tuner(fe, 0) != 0) {
dprintk(1, "Unable to load firmware and init tuner\n"); dprintk(1, "Unable to load firmware and init tuner\n");
return -EINVAL; return -EINVAL;
} }
...@@ -821,7 +813,7 @@ static int xc5000_set_params(struct dvb_frontend *fe) ...@@ -821,7 +813,7 @@ static int xc5000_set_params(struct dvb_frontend *fe)
__func__, freq, priv->freq_hz); __func__, freq, priv->freq_hz);
ret = xc_SetSignalSource(priv, priv->rf_mode); ret = xc_SetSignalSource(priv, priv->rf_mode);
if (ret != XC_RESULT_SUCCESS) { if (ret != 0) {
printk(KERN_ERR printk(KERN_ERR
"xc5000: xc_SetSignalSource(%d) failed\n", "xc5000: xc_SetSignalSource(%d) failed\n",
priv->rf_mode); priv->rf_mode);
...@@ -831,13 +823,13 @@ static int xc5000_set_params(struct dvb_frontend *fe) ...@@ -831,13 +823,13 @@ static int xc5000_set_params(struct dvb_frontend *fe)
ret = xc_SetTVStandard(priv, ret = xc_SetTVStandard(priv,
XC5000_Standard[priv->video_standard].VideoMode, XC5000_Standard[priv->video_standard].VideoMode,
XC5000_Standard[priv->video_standard].AudioMode, 0); XC5000_Standard[priv->video_standard].AudioMode, 0);
if (ret != XC_RESULT_SUCCESS) { if (ret != 0) {
printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n"); printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n");
return -EREMOTEIO; return -EREMOTEIO;
} }
ret = xc_set_IF_frequency(priv, priv->if_khz); ret = xc_set_IF_frequency(priv, priv->if_khz);
if (ret != XC_RESULT_SUCCESS) { if (ret != 0) {
printk(KERN_ERR "xc5000: xc_Set_IF_frequency(%d) failed\n", printk(KERN_ERR "xc5000: xc_Set_IF_frequency(%d) failed\n",
priv->if_khz); priv->if_khz);
return -EIO; return -EIO;
...@@ -862,15 +854,15 @@ static int xc5000_is_firmware_loaded(struct dvb_frontend *fe) ...@@ -862,15 +854,15 @@ static int xc5000_is_firmware_loaded(struct dvb_frontend *fe)
u16 id; u16 id;
ret = xc5000_readreg(priv, XREG_PRODUCT_ID, &id); ret = xc5000_readreg(priv, XREG_PRODUCT_ID, &id);
if (ret == XC_RESULT_SUCCESS) { if (ret == 0) {
if (id == XC_PRODUCT_ID_FW_NOT_LOADED) if (id == XC_PRODUCT_ID_FW_NOT_LOADED)
ret = XC_RESULT_RESET_FAILURE; ret = -ENOENT;
else else
ret = XC_RESULT_SUCCESS; ret = 0;
} }
dprintk(1, "%s() returns %s id = 0x%x\n", __func__, dprintk(1, "%s() returns %s id = 0x%x\n", __func__,
ret == XC_RESULT_SUCCESS ? "True" : "False", id); ret == 0 ? "True" : "False", id);
return ret; return ret;
} }
...@@ -937,7 +929,7 @@ static int xc5000_set_tv_freq(struct dvb_frontend *fe, ...@@ -937,7 +929,7 @@ static int xc5000_set_tv_freq(struct dvb_frontend *fe,
tune_channel: tune_channel:
ret = xc_SetSignalSource(priv, priv->rf_mode); ret = xc_SetSignalSource(priv, priv->rf_mode);
if (ret != XC_RESULT_SUCCESS) { if (ret != 0) {
printk(KERN_ERR printk(KERN_ERR
"xc5000: xc_SetSignalSource(%d) failed\n", "xc5000: xc_SetSignalSource(%d) failed\n",
priv->rf_mode); priv->rf_mode);
...@@ -947,7 +939,7 @@ static int xc5000_set_tv_freq(struct dvb_frontend *fe, ...@@ -947,7 +939,7 @@ static int xc5000_set_tv_freq(struct dvb_frontend *fe,
ret = xc_SetTVStandard(priv, ret = xc_SetTVStandard(priv,
XC5000_Standard[priv->video_standard].VideoMode, XC5000_Standard[priv->video_standard].VideoMode,
XC5000_Standard[priv->video_standard].AudioMode, 0); XC5000_Standard[priv->video_standard].AudioMode, 0);
if (ret != XC_RESULT_SUCCESS) { if (ret != 0) {
printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n"); printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n");
return -EREMOTEIO; return -EREMOTEIO;
} }
...@@ -966,7 +958,7 @@ static int xc5000_set_tv_freq(struct dvb_frontend *fe, ...@@ -966,7 +958,7 @@ static int xc5000_set_tv_freq(struct dvb_frontend *fe,
/* PLL is unlocked, force reload of the firmware */ /* PLL is unlocked, force reload of the firmware */
dprintk(1, "xc5000: PLL not locked (0x%x). Reloading...\n", dprintk(1, "xc5000: PLL not locked (0x%x). Reloading...\n",
pll_lock_status); pll_lock_status);
if (xc_load_fw_and_init_tuner(fe, 1) != XC_RESULT_SUCCESS) { if (xc_load_fw_and_init_tuner(fe, 1) != 0) {
printk(KERN_ERR "xc5000: Unable to reload fw\n"); printk(KERN_ERR "xc5000: Unable to reload fw\n");
return -EREMOTEIO; return -EREMOTEIO;
} }
...@@ -1011,13 +1003,13 @@ static int xc5000_set_radio_freq(struct dvb_frontend *fe, ...@@ -1011,13 +1003,13 @@ static int xc5000_set_radio_freq(struct dvb_frontend *fe,
ret = xc_SetTVStandard(priv, XC5000_Standard[radio_input].VideoMode, ret = xc_SetTVStandard(priv, XC5000_Standard[radio_input].VideoMode,
XC5000_Standard[radio_input].AudioMode, radio_input); XC5000_Standard[radio_input].AudioMode, radio_input);
if (ret != XC_RESULT_SUCCESS) { if (ret != 0) {
printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n"); printk(KERN_ERR "xc5000: xc_SetTVStandard failed\n");
return -EREMOTEIO; return -EREMOTEIO;
} }
ret = xc_SetSignalSource(priv, priv->rf_mode); ret = xc_SetSignalSource(priv, priv->rf_mode);
if (ret != XC_RESULT_SUCCESS) { if (ret != 0) {
printk(KERN_ERR printk(KERN_ERR
"xc5000: xc_SetSignalSource(%d) failed\n", "xc5000: xc_SetSignalSource(%d) failed\n",
priv->rf_mode); priv->rf_mode);
...@@ -1044,7 +1036,7 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe, ...@@ -1044,7 +1036,7 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe,
if (priv->i2c_props.adap == NULL) if (priv->i2c_props.adap == NULL)
return -EINVAL; return -EINVAL;
if (xc_load_fw_and_init_tuner(fe, 0) != XC_RESULT_SUCCESS) { if (xc_load_fw_and_init_tuner(fe, 0) != 0) {
dprintk(1, "Unable to load firmware and init tuner\n"); dprintk(1, "Unable to load firmware and init tuner\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1105,23 +1097,23 @@ static int xc5000_get_status(struct dvb_frontend *fe, u32 *status) ...@@ -1105,23 +1097,23 @@ static int xc5000_get_status(struct dvb_frontend *fe, u32 *status)
static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force) static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force)
{ {
struct xc5000_priv *priv = fe->tuner_priv; struct xc5000_priv *priv = fe->tuner_priv;
int ret = XC_RESULT_SUCCESS; int ret = 0;
u16 pll_lock_status; u16 pll_lock_status;
u16 fw_ck; u16 fw_ck;
if (force || xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { if (force || xc5000_is_firmware_loaded(fe) != 0) {
fw_retry: fw_retry:
ret = xc5000_fwupload(fe); ret = xc5000_fwupload(fe);
if (ret != XC_RESULT_SUCCESS) if (ret != 0)
return ret; return ret;
msleep(20); msleep(20);
if (priv->fw_checksum_supported) { if (priv->fw_checksum_supported) {
if (xc5000_readreg(priv, XREG_FW_CHECKSUM, &fw_ck) if (xc5000_readreg(priv, XREG_FW_CHECKSUM, &fw_ck)
!= XC_RESULT_SUCCESS) { != 0) {
dprintk(1, "%s() FW checksum reading failed.\n", dprintk(1, "%s() FW checksum reading failed.\n",
__func__); __func__);
goto fw_retry; goto fw_retry;
...@@ -1137,7 +1129,7 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force) ...@@ -1137,7 +1129,7 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force)
/* Start the tuner self-calibration process */ /* Start the tuner self-calibration process */
ret |= xc_initialize(priv); ret |= xc_initialize(priv);
if (ret != XC_RESULT_SUCCESS) if (ret != 0)
goto fw_retry; goto fw_retry;
/* Wait for calibration to complete. /* Wait for calibration to complete.
...@@ -1148,7 +1140,7 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force) ...@@ -1148,7 +1140,7 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force)
xc_wait(100); xc_wait(100);
if (priv->init_status_supported) { if (priv->init_status_supported) {
if (xc5000_readreg(priv, XREG_INIT_STATUS, &fw_ck) != XC_RESULT_SUCCESS) { if (xc5000_readreg(priv, XREG_INIT_STATUS, &fw_ck) != 0) {
dprintk(1, "%s() FW failed reading init status.\n", dprintk(1, "%s() FW failed reading init status.\n",
__func__); __func__);
goto fw_retry; goto fw_retry;
...@@ -1191,13 +1183,13 @@ static int xc5000_sleep(struct dvb_frontend *fe) ...@@ -1191,13 +1183,13 @@ static int xc5000_sleep(struct dvb_frontend *fe)
was removed in newer versions of the firmware. The "supported" was removed in newer versions of the firmware. The "supported"
way to sleep the tuner is to pull the reset pin low for 10ms */ way to sleep the tuner is to pull the reset pin low for 10ms */
ret = xc5000_TunerReset(fe); ret = xc5000_TunerReset(fe);
if (ret != XC_RESULT_SUCCESS) { if (ret != 0) {
printk(KERN_ERR printk(KERN_ERR
"xc5000: %s() unable to shutdown tuner\n", "xc5000: %s() unable to shutdown tuner\n",
__func__); __func__);
return -EREMOTEIO; return -EREMOTEIO;
} else } else
return XC_RESULT_SUCCESS; return 0;
} }
static int xc5000_init(struct dvb_frontend *fe) static int xc5000_init(struct dvb_frontend *fe)
...@@ -1205,7 +1197,7 @@ static int xc5000_init(struct dvb_frontend *fe) ...@@ -1205,7 +1197,7 @@ static int xc5000_init(struct dvb_frontend *fe)
struct xc5000_priv *priv = fe->tuner_priv; struct xc5000_priv *priv = fe->tuner_priv;
dprintk(1, "%s()\n", __func__); dprintk(1, "%s()\n", __func__);
if (xc_load_fw_and_init_tuner(fe, 0) != XC_RESULT_SUCCESS) { if (xc_load_fw_and_init_tuner(fe, 0) != 0) {
printk(KERN_ERR "xc5000: Unable to initialise tuner\n"); printk(KERN_ERR "xc5000: Unable to initialise tuner\n");
return -EREMOTEIO; return -EREMOTEIO;
} }
...@@ -1327,7 +1319,7 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, ...@@ -1327,7 +1319,7 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
/* Check if firmware has been loaded. It is possible that another /* Check if firmware has been loaded. It is possible that another
instance of the driver has loaded the firmware. instance of the driver has loaded the firmware.
*/ */
if (xc5000_readreg(priv, XREG_PRODUCT_ID, &id) != XC_RESULT_SUCCESS) if (xc5000_readreg(priv, XREG_PRODUCT_ID, &id) != 0)
goto fail; goto fail;
switch (id) { switch (id) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment