Commit 87ad567e authored by Devin Heitmueller's avatar Devin Heitmueller Committed by Mauro Carvalho Chehab

[media] staging: as102: Fix CodingStyle errors in file as102_fe.c

Fix Linux kernel coding style (whitespace and indentation) errors
in file as102_fe.c. No functional changes.
Signed-off-by: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: default avatarPiotr Chmura <chmooreck@poczta.onet.pl>
Signed-off-by: default avatarSylwester Nawrocki <snjw23@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 79848e9a
/*
* Abilis Systems Single DVB-T Receiver
* Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com>
* Copyright (C) 2010 Devin Heitmueller <dheitmueller@kernellabs.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -31,12 +32,14 @@ static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst,
static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst,
struct dvb_frontend_parameters *src);
static void as102_fe_release(struct dvb_frontend *fe) {
static void as102_fe_release(struct dvb_frontend *fe)
{
struct as102_dev_t *dev;
ENTER();
if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
dev = (struct as102_dev_t *) fe->tuner_priv;
if (dev == NULL)
return;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
......@@ -64,13 +67,15 @@ static void as102_fe_release(struct dvb_frontend *fe) {
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
static int as102_fe_init(struct dvb_frontend *fe) {
static int as102_fe_init(struct dvb_frontend *fe)
{
int ret = 0;
struct as102_dev_t *dev;
ENTER();
if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
dev = (struct as102_dev_t *) fe->tuner_priv;
if (dev == NULL)
return -ENODEV;
if (mutex_lock_interruptible(&dev->bus_adap.lock))
......@@ -90,14 +95,16 @@ static int as102_fe_init(struct dvb_frontend *fe) {
#endif
static int as102_fe_set_frontend(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params) {
struct dvb_frontend_parameters *params)
{
int ret = 0;
struct as102_dev_t *dev;
struct as10x_tune_args tune_args = { 0 };
ENTER();
if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
dev = (struct as102_dev_t *) fe->tuner_priv;
if (dev == NULL)
return -ENODEV;
if (mutex_lock_interruptible(&dev->bus_adap.lock))
......@@ -107,9 +114,8 @@ static int as102_fe_set_frontend(struct dvb_frontend *fe,
/* send abilis command: SET_TUNE */
ret = as10x_cmd_set_tune(&dev->bus_adap, &tune_args);
if(ret != 0) {
if (ret != 0)
dprintk(debug, "as10x_cmd_set_tune failed. (err = %d)\n", ret);
}
mutex_unlock(&dev->bus_adap.lock);
......@@ -117,7 +123,7 @@ static int as102_fe_set_frontend(struct dvb_frontend *fe,
return (ret < 0) ? -EINVAL : 0;
}
static int as102_fe_get_frontend(struct dvb_frontend* fe,
static int as102_fe_get_frontend(struct dvb_frontend *fe,
struct dvb_frontend_parameters *p) {
int ret = 0;
struct as102_dev_t *dev;
......@@ -125,7 +131,8 @@ static int as102_fe_get_frontend(struct dvb_frontend* fe,
ENTER();
if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
dev = (struct as102_dev_t *) fe->tuner_priv;
if (dev == NULL)
return -EINVAL;
if (mutex_lock_interruptible(&dev->bus_adap.lock))
......@@ -150,7 +157,8 @@ static int as102_fe_get_tune_settings(struct dvb_frontend *fe,
#if 0
dprintk(debug, "step_size = %d\n", settings->step_size);
dprintk(debug, "max_drift = %d\n", settings->max_drift);
dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, 1000);
dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms,
1000);
#endif
settings->min_delay_ms = 1000;
......@@ -160,14 +168,16 @@ static int as102_fe_get_tune_settings(struct dvb_frontend *fe,
}
static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) {
static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status)
{
int ret = 0;
struct as102_dev_t *dev;
struct as10x_tune_status tstate = { 0 };
ENTER();
if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
dev = (struct as102_dev_t *) fe->tuner_priv;
if (dev == NULL)
return -ENODEV;
if (mutex_lock_interruptible(&dev->bus_adap.lock))
......@@ -176,34 +186,30 @@ static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) {
/* send abilis command: GET_TUNE_STATUS */
ret = as10x_cmd_get_tune_status(&dev->bus_adap, &tstate);
if (ret < 0) {
dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n", ret);
dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n",
ret);
goto out;
}
dev->signal_strength = tstate.signal_strength;
dev->ber = tstate.BER;
switch(tstate.tune_state) {
switch (tstate.tune_state) {
case TUNE_STATUS_SIGNAL_DVB_OK:
*status = FE_HAS_SIGNAL |
FE_HAS_CARRIER;
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER;
break;
case TUNE_STATUS_STREAM_DETECTED:
*status = FE_HAS_SIGNAL |
FE_HAS_CARRIER |
FE_HAS_SYNC;
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC;
break;
case TUNE_STATUS_STREAM_TUNED:
*status = FE_HAS_SIGNAL |
FE_HAS_CARRIER |
FE_HAS_SYNC |
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC |
FE_HAS_LOCK;
break;
default:
*status = TUNE_STATUS_NOT_TUNED;
}
dprintk(debug, "tuner status: 0x%02x , strength %d , per: %d , ber: %d\n",
dprintk(debug, "tuner status: 0x%02x, strength %d, per: %d, ber: %d\n",
tstate.tune_state, tstate.signal_strength,
tstate.PER, tstate.BER);
......@@ -211,9 +217,12 @@ static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) {
if (as10x_cmd_get_demod_stats(&dev->bus_adap,
(struct as10x_demod_stats *) &dev->demod_stats) < 0) {
memset(&dev->demod_stats, 0, sizeof(dev->demod_stats));
dprintk(debug, "as10x_cmd_get_demod_stats failed (probably not tuned)\n");
dprintk(debug, "as10x_cmd_get_demod_stats failed "
"(probably not tuned)\n");
} else {
dprintk(debug, "demod status: fc: 0x%08x , bad fc: 0x%08x , bytes corrected: 0x%08x , MER: 0x%04x\n",
dprintk(debug,
"demod status: fc: 0x%08x, bad fc: 0x%08x, "
"bytes corrected: 0x%08x , MER: 0x%04x\n",
dev->demod_stats.frame_count,
dev->demod_stats.bad_frame_count,
dev->demod_stats.bytes_fixed_by_rs,
......@@ -236,12 +245,14 @@ static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) {
* - the accuracy equals ±2dB for a SNR range from 4dB to 30dB
* - the accuracy is >2dB for SNR values outside this range
*/
static int as102_fe_read_snr(struct dvb_frontend* fe, u16* snr) {
static int as102_fe_read_snr(struct dvb_frontend *fe, u16 *snr)
{
struct as102_dev_t *dev;
ENTER();
if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
dev = (struct as102_dev_t *) fe->tuner_priv;
if (dev == NULL)
return -ENODEV;
*snr = dev->demod_stats.mer;
......@@ -250,12 +261,14 @@ static int as102_fe_read_snr(struct dvb_frontend* fe, u16* snr) {
return 0;
}
static int as102_fe_read_ber(struct dvb_frontend* fe, u32* ber) {
static int as102_fe_read_ber(struct dvb_frontend *fe, u32 *ber)
{
struct as102_dev_t *dev;
ENTER();
if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
dev = (struct as102_dev_t *) fe->tuner_priv;
if (dev == NULL)
return -ENODEV;
*ber = dev->ber;
......@@ -264,12 +277,15 @@ static int as102_fe_read_ber(struct dvb_frontend* fe, u32* ber) {
return 0;
}
static int as102_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength) {
static int as102_fe_read_signal_strength(struct dvb_frontend *fe,
u16 *strength)
{
struct as102_dev_t *dev;
ENTER();
if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
dev = (struct as102_dev_t *) fe->tuner_priv;
if (dev == NULL)
return -ENODEV;
*strength = (((0xffff * 400) * dev->signal_strength + 41000) * 2);
......@@ -278,12 +294,14 @@ static int as102_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength)
return 0;
}
static int as102_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) {
static int as102_fe_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
{
struct as102_dev_t *dev;
ENTER();
if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
dev = (struct as102_dev_t *) fe->tuner_priv;
if (dev == NULL)
return -ENODEV;
if (dev->demod_stats.has_started)
......@@ -296,13 +314,15 @@ static int as102_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) {
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
static int as102_fe_ts_bus_ctrl(struct dvb_frontend* fe, int acquire) {
static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire)
{
struct as102_dev_t *dev;
int ret;
ENTER();
if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
dev = (struct as102_dev_t *) fe->tuner_priv;
if (dev == NULL)
return -ENODEV;
if (mutex_lock_interruptible(&dev->bus_adap.lock))
......@@ -362,8 +382,8 @@ static struct dvb_frontend_ops as102_fe_ops = {
#endif
};
int as102_dvb_unregister_fe(struct dvb_frontend *fe) {
int as102_dvb_unregister_fe(struct dvb_frontend *fe)
{
/* unregister frontend */
dvb_unregister_frontend(fe);
......@@ -374,11 +394,13 @@ int as102_dvb_unregister_fe(struct dvb_frontend *fe) {
return 0;
}
int as102_dvb_register_fe(struct as102_dev_t *as102_dev, struct dvb_frontend *dvb_fe) {
int as102_dvb_register_fe(struct as102_dev_t *as102_dev,
struct dvb_frontend *dvb_fe)
{
int errno;
struct dvb_adapter *dvb_adap;
if(as102_dev == NULL)
if (as102_dev == NULL)
return -EINVAL;
/* extract dvb_adapter */
......@@ -389,19 +411,20 @@ int as102_dvb_register_fe(struct as102_dev_t *as102_dev, struct dvb_frontend *dv
/* register dbvb frontend */
errno = dvb_register_frontend(dvb_adap, dvb_fe);
if(errno == 0)
if (errno == 0)
dvb_fe->tuner_priv = as102_dev;
return errno;
}
static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst,
struct as10x_tps *as10x_tps) {
struct as10x_tps *as10x_tps)
{
struct dvb_ofdm_parameters *fe_tps = &dst->u.ofdm;
/* extract consteallation */
switch(as10x_tps->constellation) {
switch (as10x_tps->constellation) {
case CONST_QPSK:
fe_tps->constellation = QPSK;
break;
......@@ -414,7 +437,7 @@ static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst,
}
/* extract hierarchy */
switch(as10x_tps->hierarchy) {
switch (as10x_tps->hierarchy) {
case HIER_NONE:
fe_tps->hierarchy_information = HIERARCHY_NONE;
break;
......@@ -430,7 +453,7 @@ static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst,
}
/* extract code rate HP */
switch(as10x_tps->code_rate_HP) {
switch (as10x_tps->code_rate_HP) {
case CODE_RATE_1_2:
fe_tps->code_rate_HP = FEC_1_2;
break;
......@@ -449,7 +472,7 @@ static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst,
}
/* extract code rate LP */
switch(as10x_tps->code_rate_LP) {
switch (as10x_tps->code_rate_LP) {
case CODE_RATE_1_2:
fe_tps->code_rate_LP = FEC_1_2;
break;
......@@ -468,7 +491,7 @@ static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst,
}
/* extract guard interval */
switch(as10x_tps->guard_interval) {
switch (as10x_tps->guard_interval) {
case GUARD_INT_1_32:
fe_tps->guard_interval = GUARD_INTERVAL_1_32;
break;
......@@ -484,7 +507,7 @@ static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst,
}
/* extract transmission mode */
switch(as10x_tps->transmission_mode) {
switch (as10x_tps->transmission_mode) {
case TRANS_MODE_2K:
fe_tps->transmission_mode = TRANSMISSION_MODE_2K;
break;
......@@ -494,10 +517,11 @@ static void as10x_fe_copy_tps_parameters(struct dvb_frontend_parameters *dst,
}
}
static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg) {
static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg)
{
uint8_t c;
switch(arg) {
switch (arg) {
case FEC_1_2:
c = CODE_RATE_1_2;
break;
......@@ -522,7 +546,8 @@ static uint8_t as102_fe_get_code_rate(fe_code_rate_t arg) {
}
static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
struct dvb_frontend_parameters *params) {
struct dvb_frontend_parameters *params)
{
/* set frequency */
tune_args->freq = params->frequency / 1000;
......@@ -530,7 +555,7 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
/* fix interleaving_mode */
tune_args->interleaving_mode = INTLV_NATIVE;
switch(params->u.ofdm.bandwidth) {
switch (params->u.ofdm.bandwidth) {
case BANDWIDTH_8_MHZ:
tune_args->bandwidth = BW_8_MHZ;
break;
......@@ -544,7 +569,7 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
tune_args->bandwidth = BW_8_MHZ;
}
switch(params->u.ofdm.guard_interval) {
switch (params->u.ofdm.guard_interval) {
case GUARD_INTERVAL_1_32:
tune_args->guard_interval = GUARD_INT_1_32;
break;
......@@ -563,7 +588,7 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
break;
}
switch(params->u.ofdm.constellation) {
switch (params->u.ofdm.constellation) {
case QPSK:
tune_args->constellation = CONST_QPSK;
break;
......@@ -578,7 +603,7 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
break;
}
switch(params->u.ofdm.transmission_mode) {
switch (params->u.ofdm.transmission_mode) {
case TRANSMISSION_MODE_2K:
tune_args->transmission_mode = TRANS_MODE_2K;
break;
......@@ -589,7 +614,7 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
tune_args->transmission_mode = TRANS_MODE_UNKNOWN;
}
switch(params->u.ofdm.hierarchy_information) {
switch (params->u.ofdm.hierarchy_information) {
case HIERARCHY_NONE:
tune_args->hierarchy = HIER_NONE;
break;
......@@ -635,11 +660,14 @@ static void as102_fe_copy_tune_parameters(struct as10x_tune_args *tune_args,
dprintk(debug, "\thierarchy: 0x%02x "
"selected: %s code_rate_%s: 0x%02x\n",
tune_args->hierarchy,
tune_args->hier_select == HIER_HIGH_PRIORITY ? "HP" : "LP",
tune_args->hier_select == HIER_HIGH_PRIORITY ? "HP" : "LP",
tune_args->hier_select == HIER_HIGH_PRIORITY ?
"HP" : "LP",
tune_args->hier_select == HIER_HIGH_PRIORITY ?
"HP" : "LP",
tune_args->code_rate);
} else {
tune_args->code_rate = as102_fe_get_code_rate(params->u.ofdm.code_rate_HP);
tune_args->code_rate =
as102_fe_get_code_rate(params->u.ofdm.code_rate_HP);
}
}
#endif
......
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