提交 7d275bf8 编写于 作者: M Mauro Carvalho Chehab

[media] tuner-core: CodingStyle cleanups

Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 e2f63d9b
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define UNSET (-1U) #define UNSET (-1U)
#define PREFIX t->i2c->driver->driver.name #define PREFIX (t->i2c->driver->driver.name)
/* /*
* Driver modprobe parameters * Driver modprobe parameters
...@@ -55,7 +55,7 @@ static char pal[] = "--"; ...@@ -55,7 +55,7 @@ static char pal[] = "--";
static char secam[] = "--"; static char secam[] = "--";
static char ntsc[] = "-"; static char ntsc[] = "-";
module_param_named(debug,tuner_debug, int, 0644); module_param_named(debug, tuner_debug, int, 0644);
module_param_array(tv_range, int, NULL, 0644); module_param_array(tv_range, int, NULL, 0644);
module_param_array(radio_range, int, NULL, 0644); module_param_array(radio_range, int, NULL, 0644);
module_param_string(pal, pal, sizeof(pal), 0644); module_param_string(pal, pal, sizeof(pal), 0644);
...@@ -252,7 +252,7 @@ static void set_type(struct i2c_client *c, unsigned int type, ...@@ -252,7 +252,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
int tune_now = 1; int tune_now = 1;
if (type == UNSET || type == TUNER_ABSENT) { if (type == UNSET || type == TUNER_ABSENT) {
tuner_dbg ("tuner 0x%02x: Tuner type absent\n",c->addr); tuner_dbg("tuner 0x%02x: Tuner type absent\n", c->addr);
return; return;
} }
...@@ -422,7 +422,7 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup) ...@@ -422,7 +422,7 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
{ {
struct tuner *t = to_tuner(i2c_get_clientdata(c)); struct tuner *t = to_tuner(i2c_get_clientdata(c));
if ( (t->type == UNSET && ((tun_setup->addr == ADDR_UNSET) && if ((t->type == UNSET && ((tun_setup->addr == ADDR_UNSET) &&
(t->mode_mask & tun_setup->mode_mask))) || (t->mode_mask & tun_setup->mode_mask))) ||
(tun_setup->addr == c->addr)) { (tun_setup->addr == c->addr)) {
set_type(c, tun_setup->type, tun_setup->mode_mask, set_type(c, tun_setup->type, tun_setup->mode_mask,
...@@ -449,7 +449,8 @@ static int tuner_s_type_addr(struct v4l2_subdev *sd, struct tuner_setup *type) ...@@ -449,7 +449,8 @@ static int tuner_s_type_addr(struct v4l2_subdev *sd, struct tuner_setup *type)
return 0; return 0;
} }
static int tuner_s_config(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *cfg) static int tuner_s_config(struct v4l2_subdev *sd,
const struct v4l2_priv_tun_config *cfg)
{ {
struct tuner *t = to_tuner(sd); struct tuner *t = to_tuner(sd);
struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops; struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
...@@ -601,13 +602,12 @@ static int tuner_probe(struct i2c_client *client, ...@@ -601,13 +602,12 @@ static int tuner_probe(struct i2c_client *client,
/* Should be just before return */ /* Should be just before return */
register_client: register_client:
/* Sets a default mode */ /* Sets a default mode */
if (t->mode_mask & T_ANALOG_TV) { if (t->mode_mask & T_ANALOG_TV)
t->mode = V4L2_TUNER_ANALOG_TV; t->mode = V4L2_TUNER_ANALOG_TV;
} else if (t->mode_mask & T_RADIO) { else if (t->mode_mask & T_RADIO)
t->mode = V4L2_TUNER_RADIO; t->mode = V4L2_TUNER_RADIO;
} else { else
t->mode = V4L2_TUNER_DIGITAL_TV; t->mode = V4L2_TUNER_DIGITAL_TV;
}
set_type(client, t->type, t->mode_mask, t->config, t->fe.callback); set_type(client, t->type, t->mode_mask, t->config, t->fe.callback);
list_add_tail(&t->list, &tuner_list); list_add_tail(&t->list, &tuner_list);
...@@ -649,15 +649,15 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) ...@@ -649,15 +649,15 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
}; };
if (t->type == UNSET) { if (t->type == UNSET) {
tuner_warn ("tuner type not set\n"); tuner_warn("tuner type not set\n");
return; return;
} }
if (NULL == analog_ops->set_params) { if (NULL == analog_ops->set_params) {
tuner_warn ("Tuner has no way to set tv freq\n"); tuner_warn("Tuner has no way to set tv freq\n");
return; return;
} }
if (freq < tv_range[0] * 16 || freq > tv_range[1] * 16) { if (freq < tv_range[0] * 16 || freq > tv_range[1] * 16) {
tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n", tuner_dbg("TV freq (%d.%02d) out of range (%d-%d)\n",
freq / 16, freq % 16 * 100 / 16, tv_range[0], freq / 16, freq % 16 * 100 / 16, tv_range[0],
tv_range[1]); tv_range[1]);
/* V4L2 spec: if the freq is not possible then the closest /* V4L2 spec: if the freq is not possible then the closest
...@@ -682,31 +682,31 @@ static int tuner_fixup_std(struct tuner *t) ...@@ -682,31 +682,31 @@ static int tuner_fixup_std(struct tuner *t)
if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) { if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) {
switch (pal[0]) { switch (pal[0]) {
case '6': case '6':
tuner_dbg ("insmod fixup: PAL => PAL-60\n"); tuner_dbg("insmod fixup: PAL => PAL-60\n");
t->std = V4L2_STD_PAL_60; t->std = V4L2_STD_PAL_60;
break; break;
case 'b': case 'b':
case 'B': case 'B':
case 'g': case 'g':
case 'G': case 'G':
tuner_dbg ("insmod fixup: PAL => PAL-BG\n"); tuner_dbg("insmod fixup: PAL => PAL-BG\n");
t->std = V4L2_STD_PAL_BG; t->std = V4L2_STD_PAL_BG;
break; break;
case 'i': case 'i':
case 'I': case 'I':
tuner_dbg ("insmod fixup: PAL => PAL-I\n"); tuner_dbg("insmod fixup: PAL => PAL-I\n");
t->std = V4L2_STD_PAL_I; t->std = V4L2_STD_PAL_I;
break; break;
case 'd': case 'd':
case 'D': case 'D':
case 'k': case 'k':
case 'K': case 'K':
tuner_dbg ("insmod fixup: PAL => PAL-DK\n"); tuner_dbg("insmod fixup: PAL => PAL-DK\n");
t->std = V4L2_STD_PAL_DK; t->std = V4L2_STD_PAL_DK;
break; break;
case 'M': case 'M':
case 'm': case 'm':
tuner_dbg ("insmod fixup: PAL => PAL-M\n"); tuner_dbg("insmod fixup: PAL => PAL-M\n");
t->std = V4L2_STD_PAL_M; t->std = V4L2_STD_PAL_M;
break; break;
case 'N': case 'N':
...@@ -715,7 +715,7 @@ static int tuner_fixup_std(struct tuner *t) ...@@ -715,7 +715,7 @@ static int tuner_fixup_std(struct tuner *t)
tuner_dbg("insmod fixup: PAL => PAL-Nc\n"); tuner_dbg("insmod fixup: PAL => PAL-Nc\n");
t->std = V4L2_STD_PAL_Nc; t->std = V4L2_STD_PAL_Nc;
} else { } else {
tuner_dbg ("insmod fixup: PAL => PAL-N\n"); tuner_dbg("insmod fixup: PAL => PAL-N\n");
t->std = V4L2_STD_PAL_N; t->std = V4L2_STD_PAL_N;
} }
break; break;
...@@ -723,7 +723,7 @@ static int tuner_fixup_std(struct tuner *t) ...@@ -723,7 +723,7 @@ static int tuner_fixup_std(struct tuner *t)
/* default parameter, do nothing */ /* default parameter, do nothing */
break; break;
default: default:
tuner_warn ("pal= argument not recognised\n"); tuner_warn("pal= argument not recognised\n");
break; break;
} }
} }
...@@ -736,22 +736,24 @@ static int tuner_fixup_std(struct tuner *t) ...@@ -736,22 +736,24 @@ static int tuner_fixup_std(struct tuner *t)
case 'h': case 'h':
case 'H': case 'H':
tuner_dbg("insmod fixup: SECAM => SECAM-BGH\n"); tuner_dbg("insmod fixup: SECAM => SECAM-BGH\n");
t->std = V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H; t->std = V4L2_STD_SECAM_B |
V4L2_STD_SECAM_G |
V4L2_STD_SECAM_H;
break; break;
case 'd': case 'd':
case 'D': case 'D':
case 'k': case 'k':
case 'K': case 'K':
tuner_dbg ("insmod fixup: SECAM => SECAM-DK\n"); tuner_dbg("insmod fixup: SECAM => SECAM-DK\n");
t->std = V4L2_STD_SECAM_DK; t->std = V4L2_STD_SECAM_DK;
break; break;
case 'l': case 'l':
case 'L': case 'L':
if ((secam[1]=='C')||(secam[1]=='c')) { if ((secam[1] == 'C') || (secam[1] == 'c')) {
tuner_dbg ("insmod fixup: SECAM => SECAM-L'\n"); tuner_dbg("insmod fixup: SECAM => SECAM-L'\n");
t->std = V4L2_STD_SECAM_LC; t->std = V4L2_STD_SECAM_LC;
} else { } else {
tuner_dbg ("insmod fixup: SECAM => SECAM-L\n"); tuner_dbg("insmod fixup: SECAM => SECAM-L\n");
t->std = V4L2_STD_SECAM_L; t->std = V4L2_STD_SECAM_L;
} }
break; break;
...@@ -759,7 +761,7 @@ static int tuner_fixup_std(struct tuner *t) ...@@ -759,7 +761,7 @@ static int tuner_fixup_std(struct tuner *t)
/* default parameter, do nothing */ /* default parameter, do nothing */
break; break;
default: default:
tuner_warn ("secam= argument not recognised\n"); tuner_warn("secam= argument not recognised\n");
break; break;
} }
} }
...@@ -808,15 +810,15 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) ...@@ -808,15 +810,15 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
}; };
if (t->type == UNSET) { if (t->type == UNSET) {
tuner_warn ("tuner type not set\n"); tuner_warn("tuner type not set\n");
return; return;
} }
if (NULL == analog_ops->set_params) { if (NULL == analog_ops->set_params) {
tuner_warn ("tuner has no way to set radio frequency\n"); tuner_warn("tuner has no way to set radio frequency\n");
return; return;
} }
if (freq < radio_range[0] * 16000 || freq > radio_range[1] * 16000) { if (freq < radio_range[0] * 16000 || freq > radio_range[1] * 16000) {
tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n", tuner_dbg("radio freq (%d.%02d) out of range (%d-%d)\n",
freq / 16000, freq % 16000 * 100 / 16000, freq / 16000, freq % 16000 * 100 / 16000,
radio_range[0], radio_range[1]); radio_range[0], radio_range[1]);
/* V4L2 spec: if the freq is not possible then the closest /* V4L2 spec: if the freq is not possible then the closest
...@@ -848,9 +850,9 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) ...@@ -848,9 +850,9 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
*/ */
static inline int check_mode(struct tuner *t, enum v4l2_tuner_type mode) static inline int check_mode(struct tuner *t, enum v4l2_tuner_type mode)
{ {
if ((1 << mode & t->mode_mask) == 0) { if ((1 << mode & t->mode_mask) == 0)
return -EINVAL; return -EINVAL;
}
return 0; return 0;
} }
...@@ -913,7 +915,7 @@ static void set_freq(struct i2c_client *c, unsigned long freq) ...@@ -913,7 +915,7 @@ static void set_freq(struct i2c_client *c, unsigned long freq)
set_tv_freq(c, freq); set_tv_freq(c, freq);
break; break;
default: default:
tuner_dbg("freq set: unknown mode: 0x%04x!\n",t->mode); tuner_dbg("freq set: unknown mode: 0x%04x!\n", t->mode);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册