V4L/DVB (9261): xc5000: Checkpatch compliance

xc5000: Checkpatch compliance

Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Steven Toth 2008-10-16 20:29:38 -03:00 committed by Mauro Carvalho Chehab
parent 93504abfeb
commit 8f3cd53006
2 changed files with 41 additions and 40 deletions

View File

@ -43,7 +43,7 @@ MODULE_PARM_DESC(init_fw, "Load firmware during driver initialization.");
static DEFINE_MUTEX(xc5000_list_mutex); static DEFINE_MUTEX(xc5000_list_mutex);
static LIST_HEAD(hybrid_tuner_instance_list); static LIST_HEAD(hybrid_tuner_instance_list);
#define dprintk(level,fmt, arg...) if (debug >= level) \ #define dprintk(level, fmt, arg...) if (debug >= level) \
printk(KERN_INFO "%s: " fmt, "xc5000", ## arg) printk(KERN_INFO "%s: " fmt, "xc5000", ## arg)
#define XC5000_DEFAULT_FIRMWARE "dvb-fe-xc5000-1.1.fw" #define XC5000_DEFAULT_FIRMWARE "dvb-fe-xc5000-1.1.fw"
@ -138,11 +138,11 @@ struct xc5000_priv {
immediately the length of the following transaction. immediately the length of the following transaction.
*/ */
typedef struct { struct XC_TV_STANDARD {
char *Name; char *Name;
u16 AudioMode; u16 AudioMode;
u16 VideoMode; u16 VideoMode;
} XC_TV_STANDARD; };
/* Tuner standards */ /* Tuner standards */
#define MN_NTSC_PAL_BTSC 0 #define MN_NTSC_PAL_BTSC 0
@ -169,7 +169,7 @@ typedef struct {
#define FM_Radio_INPUT2 21 #define FM_Radio_INPUT2 21
#define FM_Radio_INPUT1 22 #define FM_Radio_INPUT1 22
static XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = { static struct XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = {
{"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020}, {"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020},
{"M/N-NTSC/PAL-A2", 0x0600, 0x8020}, {"M/N-NTSC/PAL-A2", 0x0600, 0x8020},
{"M/N-NTSC/PAL-EIAJ", 0x0440, 0x8020}, {"M/N-NTSC/PAL-EIAJ", 0x0440, 0x8020},
@ -183,7 +183,7 @@ static XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = {
{"D/K-PAL-NICAM", 0x0E80, 0x8009}, {"D/K-PAL-NICAM", 0x0E80, 0x8009},
{"D/K-PAL-MONO", 0x1478, 0x8009}, {"D/K-PAL-MONO", 0x1478, 0x8009},
{"D/K-SECAM-A2 DK1", 0x1200, 0x8009}, {"D/K-SECAM-A2 DK1", 0x1200, 0x8009},
{"D/K-SECAM-A2 L/DK3",0x0E00, 0x8009}, {"D/K-SECAM-A2 L/DK3", 0x0E00, 0x8009},
{"D/K-SECAM-A2 MONO", 0x1478, 0x8009}, {"D/K-SECAM-A2 MONO", 0x1478, 0x8009},
{"L-SECAM-NICAM", 0x8E82, 0x0009}, {"L-SECAM-NICAM", 0x8E82, 0x0009},
{"L'-SECAM-NICAM", 0x8E82, 0x4009}, {"L'-SECAM-NICAM", 0x8E82, 0x4009},
@ -307,9 +307,10 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence)
unsigned int len, pos, index; unsigned int len, pos, index;
u8 buf[XC_MAX_I2C_WRITE_LENGTH]; u8 buf[XC_MAX_I2C_WRITE_LENGTH];
index=0; index = 0;
while ((i2c_sequence[index]!=0xFF) || (i2c_sequence[index+1]!=0xFF)) { while ((i2c_sequence[index] != 0xFF) ||
len = i2c_sequence[index]* 256 + i2c_sequence[index+1]; (i2c_sequence[index + 1] != 0xFF)) {
len = i2c_sequence[index] * 256 + i2c_sequence[index+1];
if (len == 0x0000) { if (len == 0x0000) {
/* RESET command */ /* RESET command */
result = xc_reset(fe); result = xc_reset(fe);
@ -329,15 +330,17 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence)
buf[1] = i2c_sequence[index + 1]; buf[1] = i2c_sequence[index + 1];
pos = 2; pos = 2;
while (pos < len) { while (pos < len) {
if ((len - pos) > XC_MAX_I2C_WRITE_LENGTH - 2) { if ((len - pos) > XC_MAX_I2C_WRITE_LENGTH - 2)
nbytes_to_send = XC_MAX_I2C_WRITE_LENGTH; nbytes_to_send =
} else { XC_MAX_I2C_WRITE_LENGTH;
else
nbytes_to_send = (len - pos + 2); nbytes_to_send = (len - pos + 2);
for (i = 2; i < nbytes_to_send; i++) {
buf[i] = i2c_sequence[index + pos +
i - 2];
} }
for (i=2; i<nbytes_to_send; i++) { result = xc_send_i2c_data(priv, buf,
buf[i] = i2c_sequence[index + pos + i - 2]; nbytes_to_send);
}
result = xc_send_i2c_data(priv, buf, nbytes_to_send);
if (result != XC_RESULT_SUCCESS) if (result != XC_RESULT_SUCCESS)
return result; return result;
@ -386,8 +389,7 @@ static int xc_SetSignalSource(struct xc5000_priv *priv, u16 rf_mode)
dprintk(1, "%s(%d) Source = %s\n", __func__, rf_mode, dprintk(1, "%s(%d) Source = %s\n", __func__, rf_mode,
rf_mode == XC_RF_MODE_AIR ? "ANTENNA" : "CABLE"); rf_mode == XC_RF_MODE_AIR ? "ANTENNA" : "CABLE");
if ((rf_mode != XC_RF_MODE_AIR) && (rf_mode != XC_RF_MODE_CABLE)) if ((rf_mode != XC_RF_MODE_AIR) && (rf_mode != XC_RF_MODE_CABLE)) {
{
rf_mode = XC_RF_MODE_CABLE; rf_mode = XC_RF_MODE_CABLE;
printk(KERN_ERR printk(KERN_ERR
"%s(), Invalid mode, defaulting to CABLE", "%s(), Invalid mode, defaulting to CABLE",
@ -560,13 +562,13 @@ static int xc5000_readregs(struct xc5000_priv *priv, u8 *buf, u8 len)
.flags = I2C_M_RD, .buf = buf, .len = len }; .flags = I2C_M_RD, .buf = buf, .len = 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 read failed (len=%i)\n",(int)len); printk(KERN_ERR "xc5000 I2C read failed (len=%i)\n", (int)len);
return -EREMOTEIO; return -EREMOTEIO;
} }
return 0; return 0;
} }
static int xc5000_fwupload(struct dvb_frontend* fe) static int xc5000_fwupload(struct dvb_frontend *fe)
{ {
struct xc5000_priv *priv = fe->tuner_priv; struct xc5000_priv *priv = fe->tuner_priv;
const struct firmware *fw; const struct firmware *fw;
@ -576,7 +578,8 @@ static int xc5000_fwupload(struct dvb_frontend* fe)
printk(KERN_INFO "xc5000: waiting for firmware upload (%s)...\n", printk(KERN_INFO "xc5000: waiting for firmware upload (%s)...\n",
XC5000_DEFAULT_FIRMWARE); XC5000_DEFAULT_FIRMWARE);
ret = request_firmware(&fw, XC5000_DEFAULT_FIRMWARE, &priv->i2c_props.adap->dev); ret = request_firmware(&fw, XC5000_DEFAULT_FIRMWARE,
&priv->i2c_props.adap->dev);
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; ret = XC_RESULT_RESET_FAILURE;
@ -592,7 +595,7 @@ static int xc5000_fwupload(struct dvb_frontend* fe)
ret = XC_RESULT_RESET_FAILURE; ret = XC_RESULT_RESET_FAILURE;
} else { } else {
printk(KERN_INFO "xc5000: firmware upload\n"); printk(KERN_INFO "xc5000: firmware upload\n");
ret = xc_load_i2c_sequence(fe, fw->data ); ret = xc_load_i2c_sequence(fe, fw->data);
} }
out: out:
@ -651,7 +654,7 @@ static int xc5000_set_params(struct dvb_frontend *fe,
dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency);
switch(params->u.vsb.modulation) { switch (params->u.vsb.modulation) {
case VSB_8: case VSB_8:
case VSB_16: case VSB_16:
dprintk(1, "%s() VSB modulation\n", __func__); dprintk(1, "%s() VSB modulation\n", __func__);
@ -748,42 +751,42 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe,
/* FIX ME: Some video standards may have several possible audio /* FIX ME: Some video standards may have several possible audio
standards. We simply default to one of them here. standards. We simply default to one of them here.
*/ */
if(params->std & V4L2_STD_MN) { if (params->std & V4L2_STD_MN) {
/* default to BTSC audio standard */ /* default to BTSC audio standard */
priv->video_standard = MN_NTSC_PAL_BTSC; priv->video_standard = MN_NTSC_PAL_BTSC;
goto tune_channel; goto tune_channel;
} }
if(params->std & V4L2_STD_PAL_BG) { if (params->std & V4L2_STD_PAL_BG) {
/* default to NICAM audio standard */ /* default to NICAM audio standard */
priv->video_standard = BG_PAL_NICAM; priv->video_standard = BG_PAL_NICAM;
goto tune_channel; goto tune_channel;
} }
if(params->std & V4L2_STD_PAL_I) { if (params->std & V4L2_STD_PAL_I) {
/* default to NICAM audio standard */ /* default to NICAM audio standard */
priv->video_standard = I_PAL_NICAM; priv->video_standard = I_PAL_NICAM;
goto tune_channel; goto tune_channel;
} }
if(params->std & V4L2_STD_PAL_DK) { if (params->std & V4L2_STD_PAL_DK) {
/* default to NICAM audio standard */ /* default to NICAM audio standard */
priv->video_standard = DK_PAL_NICAM; priv->video_standard = DK_PAL_NICAM;
goto tune_channel; goto tune_channel;
} }
if(params->std & V4L2_STD_SECAM_DK) { if (params->std & V4L2_STD_SECAM_DK) {
/* default to A2 DK1 audio standard */ /* default to A2 DK1 audio standard */
priv->video_standard = DK_SECAM_A2DK1; priv->video_standard = DK_SECAM_A2DK1;
goto tune_channel; goto tune_channel;
} }
if(params->std & V4L2_STD_SECAM_L) { if (params->std & V4L2_STD_SECAM_L) {
priv->video_standard = L_SECAM_NICAM; priv->video_standard = L_SECAM_NICAM;
goto tune_channel; goto tune_channel;
} }
if(params->std & V4L2_STD_SECAM_LC) { if (params->std & V4L2_STD_SECAM_LC) {
priv->video_standard = LC_SECAM_NICAM; priv->video_standard = LC_SECAM_NICAM;
goto tune_channel; goto tune_channel;
} }
@ -791,7 +794,7 @@ static int xc5000_set_analog_params(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 != XC_RESULT_SUCCESS) {
printk(KERN_ERR printk(KERN_ERR
"xc5000: xc_SetSignalSource(%d) failed\n", "xc5000: xc_SetSignalSource(%d) failed\n",
priv->rf_mode); priv->rf_mode);
return -EREMOTEIO; return -EREMOTEIO;
@ -863,7 +866,7 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe)
* I2C transactions until calibration is complete. This way we * I2C transactions until calibration is complete. This way we
* don't have to rely on clock stretching working. * don't have to rely on clock stretching working.
*/ */
xc_wait( 100 ); xc_wait(100);
/* Default to "CABLE" mode */ /* Default to "CABLE" mode */
ret |= xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE); ret |= xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE);
@ -885,15 +888,13 @@ static int xc5000_sleep(struct dvb_frontend *fe)
*/ */
ret = xc_shutdown(priv); ret = xc_shutdown(priv);
if(ret != XC_RESULT_SUCCESS) { if (ret != XC_RESULT_SUCCESS) {
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 XC_RESULT_SUCCESS;
}
} }
static int xc5000_init(struct dvb_frontend *fe) static int xc5000_init(struct dvb_frontend *fe)
@ -989,7 +990,7 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
if (xc5000_readreg(priv, XREG_PRODUCT_ID, &id) != 0) if (xc5000_readreg(priv, XREG_PRODUCT_ID, &id) != 0)
goto fail; goto fail;
switch(id) { switch (id) {
case XC_PRODUCT_ID_FW_LOADED: case XC_PRODUCT_ID_FW_LOADED:
printk(KERN_INFO printk(KERN_INFO
"xc5000: Successfully identified at address 0x%02x\n", "xc5000: Successfully identified at address 0x%02x\n",

View File

@ -45,17 +45,17 @@ struct xc5000_config {
#if defined(CONFIG_MEDIA_TUNER_XC5000) || \ #if defined(CONFIG_MEDIA_TUNER_XC5000) || \
(defined(CONFIG_MEDIA_TUNER_XC5000_MODULE) && defined(MODULE)) (defined(CONFIG_MEDIA_TUNER_XC5000_MODULE) && defined(MODULE))
extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, extern struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c, struct i2c_adapter *i2c,
struct xc5000_config *cfg); struct xc5000_config *cfg);
#else #else
static inline struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, static inline struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c, struct i2c_adapter *i2c,
struct xc5000_config *cfg) struct xc5000_config *cfg)
{ {
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL; return NULL;
} }
#endif // CONFIG_MEDIA_TUNER_XC5000 #endif
#endif // __XC5000_H__ #endif