media: af9015: correct some coding style issues

Correct coding style issues reported mostly by checkpatch.pl.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Antti Palosaari 2018-03-13 19:27:57 -04:00 committed by Mauro Carvalho Chehab
parent 8b79c7ab11
commit b2d109f24a
1 changed files with 88 additions and 84 deletions

View File

@ -72,7 +72,7 @@ static int af9015_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
goto error; goto error;
} }
/* buffer overflow check */ /* Buffer overflow check */
if ((write && (req->data_len > BUF_LEN - REQ_HDR_LEN)) || if ((write && (req->data_len > BUF_LEN - REQ_HDR_LEN)) ||
(!write && (req->data_len > BUF_LEN - ACK_HDR_LEN))) { (!write && (req->data_len > BUF_LEN - ACK_HDR_LEN))) {
dev_err(&intf->dev, "too much data, cmd %u, len %u\n", dev_err(&intf->dev, "too much data, cmd %u, len %u\n",
@ -81,8 +81,10 @@ static int af9015_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
goto error; goto error;
} }
/* write receives seq + status = 2 bytes /*
read receives seq + status + data = 2 + N bytes */ * Write receives seq + status = 2 bytes
* Read receives seq + status + data = 2 + N bytes
*/
wlen = REQ_HDR_LEN; wlen = REQ_HDR_LEN;
rlen = ACK_HDR_LEN; rlen = ACK_HDR_LEN;
if (write) { if (write) {
@ -96,8 +98,8 @@ static int af9015_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
if (req->cmd == DOWNLOAD_FIRMWARE || req->cmd == RECONNECT_USB) if (req->cmd == DOWNLOAD_FIRMWARE || req->cmd == RECONNECT_USB)
rlen = 0; rlen = 0;
ret = dvb_usbv2_generic_rw_locked(d, ret = dvb_usbv2_generic_rw_locked(d, state->buf, wlen,
state->buf, wlen, state->buf, rlen); state->buf, rlen);
if (ret) if (ret)
goto error; goto error;
@ -155,26 +157,27 @@ static int af9015_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
struct req_t req; struct req_t req;
/* /*
The bus lock is needed because there is two tuners both using same I2C-address. * I2C multiplexing:
Due to that the only way to select correct tuner is use demodulator I2C-gate. * There could be two tuners, both using same I2C address. Demodulator
* I2C-gate is only possibility to select correct tuner.
................................................ *
. AF9015 includes integrated AF9013 demodulator. * ...........................................
. ____________ ____________ . ____________ * . AF9015 integrates AF9013 demodulator .
.| uC | | demod | . | tuner | * . ____________ ____________ . ____________
.|------------| |------------| . |------------| * .| USB IF | | demod |. | tuner |
.| AF9015 | | AF9013/5 | . | MXL5003 | * .|------------| |------------|. |------------|
.| |--+----I2C-------|-----/ -----|-.-----I2C-------| | * .| AF9015 | | AF9013 |. | MXL5003 |
.| | | | addr 0x38 | . | addr 0xc6 | * .| |--+--I2C-----|-----/ -----|.----I2C-----| |
.|____________| | |____________| . |____________| * .| | | | addr 0x1c |. | addr 0x63 |
.................|.............................. * .|____________| | |____________|. |____________|
| ____________ ____________ * .................|.........................
| | demod | | tuner | * | ____________ ____________
| |------------| |------------| * | | demod | | tuner |
| | AF9013 | | MXL5003 | * | |------------| |------------|
+----I2C-------|-----/ -----|-------I2C-------| | * | | AF9013 | | MXL5003 |
| addr 0x3a | | addr 0xc6 | * +--I2C-----|-----/ -----|-----I2C-----| |
|____________| |____________| * | addr 0x1d | | addr 0x63 |
* |____________| |____________|
*/ */
if (msg[0].len == 0 || msg[0].flags & I2C_M_RD) { if (msg[0].len == 0 || msg[0].flags & I2C_M_RD) {
@ -522,14 +525,14 @@ static int af9015_read_config(struct dvb_usb_device *d)
if (ret) if (ret)
dev_err(&intf->dev, "eeprom read failed %d\n", ret); dev_err(&intf->dev, "eeprom read failed %d\n", ret);
/* AverMedia AVerTV Volar Black HD (A850) device have bad EEPROM /*
content :-( Override some wrong values here. Ditto for the * AverMedia AVerTV Volar Black HD (A850) device have bad EEPROM
AVerTV Red HD+ (A850T) device. */ * content :-( Override some wrong values here. Ditto for the
* AVerTV Red HD+ (A850T) device.
*/
if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA && if (le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_AVERMEDIA &&
((le16_to_cpu(d->udev->descriptor.idProduct) == ((le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_AVERMEDIA_A850) ||
USB_PID_AVERMEDIA_A850) || (le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_AVERMEDIA_A850T))) {
(le16_to_cpu(d->udev->descriptor.idProduct) ==
USB_PID_AVERMEDIA_A850T))) {
dev_dbg(&intf->dev, "AverMedia A850: overriding config\n"); dev_dbg(&intf->dev, "AverMedia A850: overriding config\n");
/* disable dual mode */ /* disable dual mode */
state->dual_mode = 0; state->dual_mode = 0;
@ -567,7 +570,7 @@ static int af9015_streaming_ctrl(struct dvb_frontend *fe, int onoff)
dev_dbg(&intf->dev, "adap id %d, onoff %d\n", adap_id, onoff); dev_dbg(&intf->dev, "adap id %d, onoff %d\n", adap_id, onoff);
if (state->usb_ts_if_configured[adap_id] == false) { if (!state->usb_ts_if_configured[adap_id]) {
dev_dbg(&intf->dev, "set usb and ts interface\n"); dev_dbg(&intf->dev, "set usb and ts interface\n");
/* USB IF stream settings */ /* USB IF stream settings */
@ -665,6 +668,7 @@ static int af9015_streaming_ctrl(struct dvb_frontend *fe, int onoff)
static int af9015_get_adapter_count(struct dvb_usb_device *d) static int af9015_get_adapter_count(struct dvb_usb_device *d)
{ {
struct af9015_state *state = d_to_priv(d); struct af9015_state *state = d_to_priv(d);
return state->dual_mode + 1; return state->dual_mode + 1;
} }
@ -905,19 +909,12 @@ static int af9015_af9013_frontend_attach(struct dvb_usb_adapter *adap)
* those "critical" paths to keep AF9015 happy. * those "critical" paths to keep AF9015 happy.
*/ */
if (adap->fe[0]) { if (adap->fe[0]) {
state->set_frontend[adap->id] = state->set_frontend[adap->id] = adap->fe[0]->ops.set_frontend;
adap->fe[0]->ops.set_frontend; adap->fe[0]->ops.set_frontend = af9015_af9013_set_frontend;
adap->fe[0]->ops.set_frontend = state->read_status[adap->id] = adap->fe[0]->ops.read_status;
af9015_af9013_set_frontend; adap->fe[0]->ops.read_status = af9015_af9013_read_status;
state->read_status[adap->id] =
adap->fe[0]->ops.read_status;
adap->fe[0]->ops.read_status =
af9015_af9013_read_status;
state->init[adap->id] = adap->fe[0]->ops.init; state->init[adap->id] = adap->fe[0]->ops.init;
adap->fe[0]->ops.init = af9015_af9013_init; adap->fe[0]->ops.init = af9015_af9013_init;
state->sleep[adap->id] = adap->fe[0]->ops.sleep; state->sleep[adap->id] = adap->fe[0]->ops.sleep;
adap->fe[0]->ops.sleep = af9015_af9013_sleep; adap->fe[0]->ops.sleep = af9015_af9013_sleep;
} }
@ -1192,6 +1189,7 @@ static int af9015_rc_query(struct dvb_usb_device *d)
/* Only process key if canary killed */ /* Only process key if canary killed */
if (buf[16] != 0xff && buf[0] != 0x01) { if (buf[16] != 0xff && buf[0] != 0x01) {
enum rc_proto proto; enum rc_proto proto;
dev_dbg(&intf->dev, "key pressed %*ph\n", 4, buf + 12); dev_dbg(&intf->dev, "key pressed %*ph\n", 4, buf + 12);
/* Reset the canary */ /* Reset the canary */
@ -1267,19 +1265,23 @@ static int af9015_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
/* try to load remote based USB iManufacturer string */ /* try to load remote based USB iManufacturer string */
if (!rc->map_name && vid == USB_VID_AFATECH) { if (!rc->map_name && vid == USB_VID_AFATECH) {
/* Check USB manufacturer and product strings and try /*
to determine correct remote in case of chip vendor * Check USB manufacturer and product strings and try
reference IDs are used. * to determine correct remote in case of chip vendor
DO NOT ADD ANYTHING NEW HERE. Use hashes instead. */ * reference IDs are used.
* DO NOT ADD ANYTHING NEW HERE. Use hashes instead.
*/
char manufacturer[10]; char manufacturer[10];
memset(manufacturer, 0, sizeof(manufacturer)); memset(manufacturer, 0, sizeof(manufacturer));
usb_string(d->udev, d->udev->descriptor.iManufacturer, usb_string(d->udev, d->udev->descriptor.iManufacturer,
manufacturer, sizeof(manufacturer)); manufacturer, sizeof(manufacturer));
if (!strcmp("MSI", manufacturer)) { if (!strcmp("MSI", manufacturer)) {
/* iManufacturer 1 MSI /*
iProduct 2 MSI K-VOX */ * iManufacturer 1 MSI
rc->map_name = af9015_rc_setup_match( * iProduct 2 MSI K-VOX
AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3, */
rc->map_name = af9015_rc_setup_match(AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3,
af9015_rc_setup_modparam); af9015_rc_setup_modparam);
} }
} }
@ -1409,8 +1411,10 @@ static void af9015_disconnect(struct dvb_usb_device *d)
regmap_exit(state->regmap); regmap_exit(state->regmap);
} }
/* interface 0 is used by DVB-T receiver and /*
interface 1 is for remote controller (HID) */ * Interface 0 is used by DVB-T receiver and
* interface 1 is for remote controller (HID)
*/
static const struct dvb_usb_device_properties af9015_props = { static const struct dvb_usb_device_properties af9015_props = {
.driver_name = KBUILD_MODNAME, .driver_name = KBUILD_MODNAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,