Commit b4d6046e authored by Olivier Grenie's avatar Olivier Grenie Committed by Mauro Carvalho Chehab

[media] DiBxxxx: Codingstype updates

This patchs fix several conding-style violations.
Signed-off-by: default avatarOlivier Grenie <olivier.grenie@dibcom.fr>
Signed-off-by: default avatarPatrick Boettcher <patrick.boettcher@dibcom.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent be9bae10
......@@ -347,7 +347,8 @@ int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz)
b[6] = (u8) (divider >> 8);
b[7] = (u8) (divider & 0xff);
deb_info("setting I2C speed: %04x %04x %04x (%d kHz).", (b[2] << 8) | (b[3]), (b[4] << 8) | b[5], (b[6] << 8) | b[7], scl_kHz);
deb_info("setting I2C speed: %04x %04x %04x (%d kHz).",
(b[2] << 8) | (b[3]), (b[4] << 8) | b[5], (b[6] << 8) | b[7], scl_kHz);
return dib0700_ctrl_wr(d, b, 8);
}
......@@ -484,14 +485,14 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
deb_info("modifying (%d) streaming state for %d\n", onoff, adap->id);
st->channel_state &= ~0x3;
if ((adap->stream.props.endpoint != 2) && (adap->stream.props.endpoint != 3)) {
if ((adap->stream.props.endpoint != 2)
&& (adap->stream.props.endpoint != 3)) {
deb_info("the endpoint number (%i) is not correct, use the adapter id instead", adap->stream.props.endpoint);
if (onoff)
st->channel_state |= 1 << (adap->id);
else
st->channel_state |= 1 << ~(adap->id);
}
else {
} else {
if (onoff)
st->channel_state |= 1 << (adap->stream.props.endpoint-2);
else
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -39,7 +39,7 @@ struct dib7000p_config {
u16 diversity_delay;
u8 default_i2c_addr;
u8 enMpegOutput : 1;
u8 enMpegOutput:1;
};
#define DEFAULT_DIB7000P_I2C_ADDRESS 18
......
This diff is collapsed.
......@@ -52,7 +52,7 @@ extern void dib8000_pwm_agc_reset(struct dvb_frontend *fe);
extern s32 dib8000_get_adc_power(struct dvb_frontend *fe, u8 mode);
extern int dib8000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_frontend *fe_slave);
extern int dib8000_remove_slave_frontend(struct dvb_frontend *fe);
extern struct dvb_frontend * dib8000_get_slave_frontend(struct dvb_frontend *fe, int slave_index);
extern struct dvb_frontend *dib8000_get_slave_frontend(struct dvb_frontend *fe, int slave_index);
#else
static inline struct dvb_frontend *dib8000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg)
{
......@@ -126,9 +126,10 @@ int dib8000_remove_slave_frontend(struct dvb_frontend *fe)
return -ENODEV;
}
static inline struct dvb_frontend * dib8000_get_slave_frontend(struct dvb_frontend *fe, int slave_index) {
static inline struct dvb_frontend *dib8000_get_slave_frontend(struct dvb_frontend *fe, int slave_index)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL;
return NULL;
}
#endif
......
This diff is collapsed.
......@@ -38,7 +38,7 @@ extern int dib9000_fw_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 ono
extern int dib9000_firmware_post_pll_init(struct dvb_frontend *fe);
extern int dib9000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_frontend *fe_slave);
extern int dib9000_remove_slave_frontend(struct dvb_frontend *fe);
extern struct dvb_frontend * dib9000_get_slave_frontend(struct dvb_frontend *fe, int slave_index);
extern struct dvb_frontend *dib9000_get_slave_frontend(struct dvb_frontend *fe, int slave_index);
extern struct i2c_adapter *dib9000_get_component_bus_interface(struct dvb_frontend *fe);
extern int dib9000_set_i2c_adapter(struct dvb_frontend *fe, struct i2c_adapter *i2c);
extern int dib9000_fw_set_component_bus_speed(struct dvb_frontend *fe, u16 speed);
......@@ -103,7 +103,8 @@ int dib9000_remove_slave_frontend(struct dvb_frontend *fe)
return -ENODEV;
}
static inline struct dvb_frontend * dib9000_get_slave_frontend(struct dvb_frontend *fe, int slave_index) {
static inline struct dvb_frontend *dib9000_get_slave_frontend(struct dvb_frontend *fe, int slave_index)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL;
}
......
......@@ -26,8 +26,8 @@ static u16 dibx000_read_word(struct dibx000_i2c_master *mst, u16 reg)
u8 wb[2] = { reg >> 8, reg & 0xff };
u8 rb[2];
struct i2c_msg msg[2] = {
{.addr = mst->i2c_addr,.flags = 0,.buf = wb,.len = 2},
{.addr = mst->i2c_addr,.flags = I2C_M_RD,.buf = rb,.len = 2},
{.addr = mst->i2c_addr, .flags = 0, .buf = wb, .len = 2},
{.addr = mst->i2c_addr, .flags = I2C_M_RD, .buf = rb, .len = 2},
};
if (i2c_transfer(mst->i2c_adap, msg, 2) != 2)
......@@ -38,10 +38,11 @@ static u16 dibx000_read_word(struct dibx000_i2c_master *mst, u16 reg)
static int dibx000_is_i2c_done(struct dibx000_i2c_master *mst)
{
int i = 100; // max_i2c_polls;
int i = 100;
u16 status;
while (((status = dibx000_read_word(mst, mst->base_reg + 2)) & 0x0100) == 0 && --i > 0);
while (((status = dibx000_read_word(mst, mst->base_reg + 2)) & 0x0100) == 0 && --i > 0)
;
/* i2c timed out */
if (i == 0)
......@@ -63,7 +64,7 @@ static int dibx000_master_i2c_write(struct dibx000_i2c_master *mst, struct i2c_m
const u8 *b = msg->buf;
while (txlen) {
dibx000_read_word(mst, mst->base_reg + 2); // reset fifo ptr
dibx000_read_word(mst, mst->base_reg + 2);
len = txlen > 8 ? 8 : txlen;
for (i = 0; i < len; i += 2) {
......@@ -72,14 +73,14 @@ static int dibx000_master_i2c_write(struct dibx000_i2c_master *mst, struct i2c_m
data |= *b++;
dibx000_write_word(mst, mst->base_reg, data);
}
da = (((u8) (msg->addr)) << 9) | // addr
(1 << 8) | // master
(1 << 7) | // rq
(0 << 6) | // stop
(0 << 5) | // start
((len & 0x7) << 2) | // nb 8 bytes == 0 here
(0 << 1) | // rw
(0 << 0); // irqen
da = (((u8) (msg->addr)) << 9) |
(1 << 8) |
(1 << 7) |
(0 << 6) |
(0 << 5) |
((len & 0x7) << 2) |
(0 << 1) |
(0 << 0);
if (txlen == msg->len)
da |= 1 << 5; /* start */
......@@ -105,14 +106,14 @@ static int dibx000_master_i2c_read(struct dibx000_i2c_master *mst, struct i2c_ms
while (rxlen) {
len = rxlen > 8 ? 8 : rxlen;
da = (((u8) (msg->addr)) << 9) | // addr
(1 << 8) | // master
(1 << 7) | // rq
(0 << 6) | // stop
(0 << 5) | // start
((len & 0x7) << 2) | // nb
(1 << 1) | // rw
(0 << 0); // irqen
da = (((u8) (msg->addr)) << 9) |
(1 << 8) |
(1 << 7) |
(0 << 6) |
(0 << 5) |
((len & 0x7) << 2) |
(1 << 1) |
(0 << 0);
if (rxlen == msg->len)
da |= 1 << 5; /* start */
......@@ -174,15 +175,12 @@ static int dibx000_i2c_master_xfer_gpio12(struct i2c_adapter *i2c_adap, struct i
int ret = 0;
dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_GPIO_1_2);
for (msg_index = 0; msg_index<num; msg_index++) {
if (msg[msg_index].flags & I2C_M_RD)
{
for (msg_index = 0; msg_index < num; msg_index++) {
if (msg[msg_index].flags & I2C_M_RD) {
ret = dibx000_master_i2c_read(mst, &msg[msg_index]);
if (ret != 0)
return 0;
}
else
{
} else {
ret = dibx000_master_i2c_write(mst, &msg[msg_index], 1);
if (ret != 0)
return 0;
......@@ -199,15 +197,12 @@ static int dibx000_i2c_master_xfer_gpio34(struct i2c_adapter *i2c_adap, struct i
int ret = 0;
dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_GPIO_3_4);
for (msg_index = 0; msg_index<num; msg_index++) {
if (msg[msg_index].flags & I2C_M_RD)
{
for (msg_index = 0; msg_index < num; msg_index++) {
if (msg[msg_index].flags & I2C_M_RD) {
ret = dibx000_master_i2c_read(mst, &msg[msg_index]);
if (ret != 0)
return 0;
}
else
{
} else {
ret = dibx000_master_i2c_write(mst, &msg[msg_index], 1);
if (ret != 0)
return 0;
......
......@@ -18,7 +18,7 @@ struct dibx000_i2c_master {
enum dibx000_i2c_interface selected_interface;
// struct i2c_adapter tuner_i2c_adap;
/* struct i2c_adapter tuner_i2c_adap; */
struct i2c_adapter gated_tuner_i2c_adap;
struct i2c_adapter master_i2c_adap_gpio12;
struct i2c_adapter master_i2c_adap_gpio34;
......@@ -50,7 +50,7 @@ extern u32 systime(void);
#define BAND_FM 0x10
#define BAND_CBAND 0x20
#define BAND_OF_FREQUENCY(freq_kHz) ( (freq_kHz) <= 170000 ? BAND_CBAND : \
#define BAND_OF_FREQUENCY(freq_kHz) ((freq_kHz) <= 170000 ? BAND_CBAND : \
(freq_kHz) <= 115000 ? BAND_FM : \
(freq_kHz) <= 250000 ? BAND_VHF : \
(freq_kHz) <= 863000 ? BAND_UHF : \
......@@ -140,9 +140,9 @@ enum dibx000_adc_states {
DIBX000_VBG_DISABLE,
};
#define BANDWIDTH_TO_KHZ(v) ( (v) == BANDWIDTH_8_MHZ ? 8000 : \
#define BANDWIDTH_TO_KHZ(v) ((v) == BANDWIDTH_8_MHZ ? 8000 : \
(v) == BANDWIDTH_7_MHZ ? 7000 : \
(v) == BANDWIDTH_6_MHZ ? 6000 : 8000 )
(v) == BANDWIDTH_6_MHZ ? 6000 : 8000)
#define BANDWIDTH_TO_INDEX(v) ( \
(v) == 8000 ? BANDWIDTH_8_MHZ : \
......@@ -223,7 +223,7 @@ struct dvb_frontend_parametersContext {
#define FE_CALLBACK_TIME_NEVER 0xffffffff
#define ABS(x) ((x<0)?(-x):(x))
#define ABS(x) ((x < 0) ? (-x) : (x))
#define DATA_BUS_ACCESS_MODE_8BIT 0x01
#define DATA_BUS_ACCESS_MODE_16BIT 0x02
......
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