Commit d3911eaa authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB (5608): M920x: various whitespace cleanups

- 80-column cleanups
- spaces between operators
- tabbing style
Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent f8e0bd5d
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* Copyright (C) 2006 Aapo Tahkola (aet@rasterburn.org) * Copyright (C) 2006 Aapo Tahkola (aet@rasterburn.org)
* *
* This program is free software; you can redistribute it and/or modify it * 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 the Free * under the terms of the GNU General Public License as published by the
* Software Foundation, version 2. * Free Software Foundation, version 2.
* *
* see Documentation/dvb/README.dvb-usb for more information * see Documentation/dvb/README.dvb-usb for more information
*/ */
...@@ -61,7 +61,7 @@ static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = { ...@@ -61,7 +61,7 @@ static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = {
{ 0x0, 0x1e, KEY_VOLUMEUP }, { 0x0, 0x1e, KEY_VOLUMEUP },
}; };
static inline int m9206_read(struct usb_device *udev, u8 request, u16 value,\ static inline int m9206_read(struct usb_device *udev, u8 request, u16 value,
u16 index, void *data, int size) u16 index, void *data, int size)
{ {
int ret; int ret;
...@@ -102,7 +102,9 @@ static int m9206_init(struct dvb_usb_device *d, struct m9206_inits *rc_seq) ...@@ -102,7 +102,9 @@ static int m9206_init(struct dvb_usb_device *d, struct m9206_inits *rc_seq)
if (d->props.rc_query) { if (d->props.rc_query) {
deb_rc("Initialising remote control\n"); deb_rc("Initialising remote control\n");
while (rc_seq->address) { while (rc_seq->address) {
if ((ret = m9206_write(d->udev, M9206_CORE, rc_seq->data, rc_seq->address)) != 0) { if ((ret = m9206_write(d->udev, M9206_CORE,
rc_seq->data,
rc_seq->address)) != 0) {
deb_rc("Initialising remote control failed\n"); deb_rc("Initialising remote control failed\n");
return ret; return ret;
} }
...@@ -122,10 +124,12 @@ static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state) ...@@ -122,10 +124,12 @@ static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
int i, ret = 0; int i, ret = 0;
u8 rc_state[2]; u8 rc_state[2];
if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0) if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE,
rc_state, 1)) != 0)
goto unlock; goto unlock;
if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0) if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY,
rc_state + 1, 1)) != 0)
goto unlock; goto unlock;
for (i = 0; i < d->props.rc_key_map_size; i++) for (i = 0; i < d->props.rc_key_map_size; i++)
...@@ -160,7 +164,8 @@ static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state) ...@@ -160,7 +164,8 @@ static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
goto unlock; goto unlock;
default: default:
deb_rc("Unexpected rc state %02x\n", rc_state[0]); deb_rc("Unexpected rc state %02x\n",
rc_state[0]);
*state = REMOTE_NO_KEY_PRESSED; *state = REMOTE_NO_KEY_PRESSED;
goto unlock; goto unlock;
} }
...@@ -191,33 +196,46 @@ static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], ...@@ -191,33 +196,46 @@ static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
return -EAGAIN; return -EAGAIN;
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
if (msg[i].flags & (I2C_M_NO_RD_ACK|I2C_M_IGNORE_NAK|I2C_M_TEN) || if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK |
msg[i].len == 0) { I2C_M_TEN) || msg[i].len == 0) {
/* For a 0 byte message, I think sending the address to index 0x80|0x40 /* For a 0 byte message, I think sending the address
* would be the correct thing to do. However, zero byte messages are * to index 0x80|0x40 would be the correct thing to
* only used for probing, and since we don't know how to get the slave's * do. However, zero byte messages are only used for
* ack, we can't probe. */ * probing, and since we don't know how to get the
* slave's ack, we can't probe. */
ret = -ENOTSUPP; ret = -ENOTSUPP;
goto unlock; goto unlock;
} }
/* Send START & address/RW bit */ /* Send START & address/RW bit */
if (!(msg[i].flags & I2C_M_NOSTART)) { if (!(msg[i].flags & I2C_M_NOSTART)) {
if ((ret = m9206_write(d->udev, M9206_I2C, (msg[i].addr<<1)|(msg[i].flags&I2C_M_RD?0x01:0), 0x80)) != 0) if ((ret = m9206_write(d->udev, M9206_I2C,
(msg[i].addr << 1) |
(msg[i].flags & I2C_M_RD ? 0x01 : 0),
0x80)) != 0)
goto unlock; goto unlock;
/* Should check for ack here, if we knew how. */ /* Should check for ack here, if we knew how. */
} }
if (msg[i].flags & I2C_M_RD) { if (msg[i].flags & I2C_M_RD) {
for (j = 0; j < msg[i].len; j++) { for (j = 0; j < msg[i].len; j++) {
/* Last byte of transaction? Send STOP, otherwise send ACK. */ /* Last byte of transaction?
int stop = (i+1 == num && j+1 == msg[i].len)?0x40:0x01; * Send STOP, otherwise send ACK. */
if ((ret = m9206_read(d->udev, M9206_I2C, 0x0, 0x20|stop, &msg[i].buf[j], 1)) != 0) int stop = (i+1 == num && j+1 == msg[i].len)
? 0x40 : 0x01;
if ((ret = m9206_read(d->udev, M9206_I2C, 0x0,
0x20|stop,
&msg[i].buf[j], 1)) != 0)
goto unlock; goto unlock;
} }
} else { } else {
for (j = 0; j < msg[i].len; j++) { for (j = 0; j < msg[i].len; j++) {
/* Last byte of transaction? Then send STOP. */ /* Last byte of transaction? Then send STOP. */
int stop = (i+1 == num && j+1 == msg[i].len)?0x40:0x00; int stop = (i+1 == num && j+1 == msg[i].len)
if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0) ? 0x40 : 0x00;
if ((ret = m9206_write(d->udev, M9206_I2C,
msg[i].buf[j],
stop)) != 0)
goto unlock; goto unlock;
/* Should check for ack here too. */ /* Should check for ack here too. */
} }
...@@ -225,7 +243,7 @@ static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], ...@@ -225,7 +243,7 @@ static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
} }
ret = num; ret = num;
unlock: unlock:
mutex_unlock(&d->i2c_mutex); mutex_unlock(&d->i2c_mutex);
return ret; return ret;
...@@ -242,8 +260,8 @@ static struct i2c_algorithm m9206_i2c_algo = { ...@@ -242,8 +260,8 @@ static struct i2c_algorithm m9206_i2c_algo = {
}; };
static int m9206_set_filter(struct dvb_usb_adapter *adap, int type, int idx, static int m9206_set_filter(struct dvb_usb_adapter *adap,
int pid) int type, int idx, int pid)
{ {
int ret = 0; int ret = 0;
...@@ -252,10 +270,12 @@ static int m9206_set_filter(struct dvb_usb_adapter *adap, int type, int idx, ...@@ -252,10 +270,12 @@ static int m9206_set_filter(struct dvb_usb_adapter *adap, int type, int idx,
pid |= 0x8000; pid |= 0x8000;
if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0) if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, pid,
(type << 8) | (idx * 4) )) != 0)
return ret; return ret;
if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0) if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, 0,
(type << 8) | (idx * 4) )) != 0)
return ret; return ret;
return ret; return ret;
...@@ -288,7 +308,8 @@ static int m9206_update_filters(struct dvb_usb_adapter *adap) ...@@ -288,7 +308,8 @@ static int m9206_update_filters(struct dvb_usb_adapter *adap)
if (m->filters[i] == 0) if (m->filters[i] == 0)
continue; continue;
if ((ret = m9206_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0) if ((ret = m9206_set_filter(adap, 0x81, filter + 2,
m->filters[i])) != 0)
return ret; return ret;
filter++; filter++;
...@@ -310,8 +331,8 @@ static int m9206_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) ...@@ -310,8 +331,8 @@ static int m9206_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
return m9206_update_filters(adap); return m9206_update_filters(adap);
} }
static int m9206_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, static int m9206_pid_filter(struct dvb_usb_adapter *adap,
int onoff) int index, u16 pid, int onoff)
{ {
struct m9206_state *m = adap->dev->priv; struct m9206_state *m = adap->dev->priv;
...@@ -433,7 +454,8 @@ static int megasky_mt352_frontend_attach(struct dvb_usb_adapter *adap) ...@@ -433,7 +454,8 @@ static int megasky_mt352_frontend_attach(struct dvb_usb_adapter *adap)
{ {
deb_rc("megasky_frontend_attach!\n"); deb_rc("megasky_frontend_attach!\n");
if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config, &adap->dev->i2c_adap)) == NULL) if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config,
&adap->dev->i2c_adap)) == NULL)
return -EIO; return -EIO;
return 0; return 0;
...@@ -524,10 +546,13 @@ static int tvwalkertwin_0_tda10046_frontend_attach(struct dvb_usb_adapter *adap) ...@@ -524,10 +546,13 @@ static int tvwalkertwin_0_tda10046_frontend_attach(struct dvb_usb_adapter *adap)
{ {
deb_rc("tvwalkertwin_0_tda10046_frontend_attach!\n"); deb_rc("tvwalkertwin_0_tda10046_frontend_attach!\n");
if ((adap->fe = dvb_attach(tda10046_attach, &tvwalkertwin_0_tda10046_config, &adap->dev->i2c_adap)) == NULL) if ((adap->fe = dvb_attach(tda10046_attach,
&tvwalkertwin_0_tda10046_config,
&adap->dev->i2c_adap)) == NULL)
return -EIO; return -EIO;
deb_rc("Attached demod 0 at address %02x\n", tvwalkertwin_0_tda10046_config.demod_address); deb_rc("Attached demod 0 at address %02x\n",
tvwalkertwin_0_tda10046_config.demod_address);
return 0; return 0;
} }
...@@ -536,10 +561,13 @@ static int tvwalkertwin_1_tda10046_frontend_attach(struct dvb_usb_adapter *adap) ...@@ -536,10 +561,13 @@ static int tvwalkertwin_1_tda10046_frontend_attach(struct dvb_usb_adapter *adap)
{ {
deb_rc("tvwalkertwin_1_tda10046_frontend_attach!\n"); deb_rc("tvwalkertwin_1_tda10046_frontend_attach!\n");
if ((adap->fe = dvb_attach(tda10046_attach, &tvwalkertwin_1_tda10046_config, &adap->dev->i2c_adap)) == NULL) if ((adap->fe = dvb_attach(tda10046_attach,
&tvwalkertwin_1_tda10046_config,
&adap->dev->i2c_adap)) == NULL)
return -EIO; return -EIO;
deb_rc("Attached demod 1 at address %02x\n", tvwalkertwin_1_tda10046_config.demod_address); deb_rc("Attached demod 1 at address %02x\n",
tvwalkertwin_1_tda10046_config.demod_address);
return 0; return 0;
} }
...@@ -588,6 +616,7 @@ static struct dvb_usb_device_properties megasky_properties; ...@@ -588,6 +616,7 @@ static struct dvb_usb_device_properties megasky_properties;
static struct dvb_usb_device_properties digivox_mini_ii_properties; static struct dvb_usb_device_properties digivox_mini_ii_properties;
static struct dvb_usb_device_properties tvwalkertwin_properties; static struct dvb_usb_device_properties tvwalkertwin_properties;
static struct dvb_usb_device_properties dposh_properties; static struct dvb_usb_device_properties dposh_properties;
static struct m9206_inits megasky_rc_init []; static struct m9206_inits megasky_rc_init [];
static struct m9206_inits tvwalkertwin_rc_init []; static struct m9206_inits tvwalkertwin_rc_init [];
...@@ -614,7 +643,8 @@ static int m920x_probe(struct usb_interface *intf, ...@@ -614,7 +643,8 @@ static int m920x_probe(struct usb_interface *intf,
} }
if ((ret = dvb_usb_device_init(intf, if ((ret = dvb_usb_device_init(intf,
&digivox_mini_ii_properties, THIS_MODULE, &d)) == 0) { &digivox_mini_ii_properties,
THIS_MODULE, &d)) == 0) {
/* No remote control, so no rc_init_seq */ /* No remote control, so no rc_init_seq */
goto found; goto found;
} }
...@@ -626,7 +656,8 @@ static int m920x_probe(struct usb_interface *intf, ...@@ -626,7 +656,8 @@ static int m920x_probe(struct usb_interface *intf,
goto found; goto found;
} }
if ((ret = dvb_usb_device_init(intf, &dposh_properties, THIS_MODULE, &d)) == 0) { if ((ret = dvb_usb_device_init(intf, &dposh_properties,
THIS_MODULE, &d)) == 0) {
/* Remote controller not supported yet. */ /* Remote controller not supported yet. */
goto found; goto found;
} }
...@@ -786,8 +817,7 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = { ...@@ -786,8 +817,7 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = {
.identify_state = m920x_identify_state, .identify_state = m920x_identify_state,
.num_adapters = 2, .num_adapters = 2,
.adapter = { .adapter = {{
{
.caps = DVB_USB_ADAP_HAS_PID_FILTER | .caps = DVB_USB_ADAP_HAS_PID_FILTER |
DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
...@@ -807,9 +837,7 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = { ...@@ -807,9 +837,7 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = {
.buffersize = 512, .buffersize = 512,
} }
} }
}, }},{
},
{
.caps = DVB_USB_ADAP_HAS_PID_FILTER | .caps = DVB_USB_ADAP_HAS_PID_FILTER |
DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
...@@ -830,8 +858,7 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = { ...@@ -830,8 +858,7 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = {
} }
} }
}, },
} }},
},
.i2c_algo = &m9206_i2c_algo, .i2c_algo = &m9206_i2c_algo,
.num_device_descs = 1, .num_device_descs = 1,
...@@ -850,14 +877,12 @@ static struct dvb_usb_device_properties dposh_properties = { ...@@ -850,14 +877,12 @@ static struct dvb_usb_device_properties dposh_properties = {
.firmware = "dvb-usb-dposh-01.fw", .firmware = "dvb-usb-dposh-01.fw",
.download_firmware = m9206_firmware_download, .download_firmware = m9206_firmware_download,
/* Remote controller not supported yet. */
.size_of_priv = sizeof(struct m9206_state), .size_of_priv = sizeof(struct m9206_state),
.identify_state = m920x_identify_state, .identify_state = m920x_identify_state,
.num_adapters = 1, .num_adapters = 1,
.adapter = {{ .adapter = {{
/* Nardware pid filters don't work with this device/firmware. */ /* Hardware pid filters don't work with this device/firmware */
.frontend_attach = megasky_mt352_frontend_attach, .frontend_attach = megasky_mt352_frontend_attach,
.tuner_attach = megasky_qt1010_tuner_attach, .tuner_attach = megasky_qt1010_tuner_attach,
......
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