Skip to contentSkip to conversation

drivers/media/dvb/dvb-usb/dib0700: fix return values

PATCH In review Daniel Mack 6 participants 14 messages May 19, 2010 – May 29, 2010 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/media/dvb/dvb-usb/dib0700: fix return values

Propagte correct error values instead of returning -1 which just means -EPERM ("Permission denied")

While at it, also fix some coding style violations.

Cc Mauro Carvalho Chehab <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Devin Heitmueller <[email protected]>
---
 drivers/media/dvb/dvb-usb/dib0700_core.c |   47 ++++++++++++++---------------
 1 files changed, 23 insertions(+), 24 deletions(-)
drivers/media/dvb/dvb-usb/dib0700_core.c +23 -24
index d5e2c23..c73da6b 100644
@@ -111,23 +111,24 @@ int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_
 
 static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets)
 {
-    struct dib0700_state *st = d->priv;
-    u8 b[3];
-    int ret;
-
-    if (st->fw_version >= 0x10201) {
-	b[0] = REQUEST_SET_USB_XFER_LEN;
-	b[1] = (nb_ts_packets >> 8)&0xff;
-	b[2] = nb_ts_packets & 0xff;
-
-	deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
-
-	ret = dib0700_ctrl_wr(d, b, 3);
-    } else {
-	deb_info("this firmware does not allow to change the USB xfer len\n");
-	ret = -EIO;
-    }
-    return ret;
+	struct dib0700_state *st = d->priv;
+	u8 b[3];
+	int ret;
+
+	if (st->fw_version >= 0x10201) {
+		b[0] = REQUEST_SET_USB_XFER_LEN;
+		b[1] = (nb_ts_packets >> 8)&0xff;
+		b[2] = nb_ts_packets & 0xff;
+
+		deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
+
+		ret = dib0700_ctrl_wr(d, b, 3);
+	} else {
+		deb_info("this firmware does not allow to change the USB xfer len\n");
+		ret = -EIO;
+	}
+
+	return ret;
 }
 
 /*
@@ -642,7 +643,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 	i = dib0700_ctrl_wr(d, rc_setup, 3);
 	if (i<0) {
 		err("ir protocol setup failed");
-		return -1;
+		return i;
 	}
 
 	if (st->fw_version < 0x10200)
@@ -652,7 +653,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 	purb = usb_alloc_urb(0, GFP_KERNEL);
 	if (purb == NULL) {
 		err("rc usb alloc urb failed\n");
-		return -1;
+		return -ENOMEM;
 	}
 
 	purb->transfer_buffer = usb_buffer_alloc(d->udev, RC_MSG_SIZE_V1_20,
@@ -661,7 +662,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 	if (purb->transfer_buffer == NULL) {
 		err("rc usb_buffer_alloc() failed\n");
 		usb_free_urb(purb);
-		return -1;
+		return -ENOMEM;
 	}
 
 	purb->status = -EINPROGRESS;
@@ -670,12 +671,10 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 			  dib0700_rc_urb_completion, d);
 
 	ret = usb_submit_urb(purb, GFP_ATOMIC);
-	if (ret != 0) {
+	if (ret != 0)
 		err("rc submit urb failed\n");
-		return -1;
-	}
 
-	return 0;
+	return ret;
 }
 
 static int dib0700_probe(struct usb_interface *intf,
Signature · 1 line
1.7.1
#1 lore raw
Quoted 6 lines · Daniel Mack

Propagte correct error values instead of returning -1 which just means -EPERM ("Permission denied")

While at it, also fix some coding style violations.

Just minor nits. You decide if it is worth a resend ;)

Quoted 31 lines
Cc Mauro Carvalho Chehab <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Devin Heitmueller <[email protected]>
---
 drivers/media/dvb/dvb-usb/dib0700_core.c |   47 ++++++++++++++---------------
 1 files changed, 23 insertions(+), 24 deletions(-)
drivers/media/dvb/dvb-usb/dib0700_core.c +0 -14
index d5e2c23..c73da6b 100644
@@ -111,23 +111,24 @@ int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_
 
 static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets)
 {
-    struct dib0700_state *st = d->priv;
-    u8 b[3];
-    int ret;
-
-    if (st->fw_version >= 0x10201) {
-	b[0] = REQUEST_SET_USB_XFER_LEN;
-	b[1] = (nb_ts_packets >> 8)&0xff;
-	b[2] = nb_ts_packets & 0xff;
-
-	deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
-
-	ret = dib0700_ctrl_wr(d, b, 3);
-    } else {
-	deb_info("this firmware does not allow to change the USB xfer len\n");

drivers/media/dvb/dvb-usb/dib0700_core.c int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_ · line 120

Quoted 10 lines
drivers/media/dvb/dvb-usb/dib0700_core.c +7 -3
-	ret = -EIO;
-    }
-    return ret;
+	struct dib0700_state *st = d->priv;
+	u8 b[3];
+	int ret;
+
+	if (st->fw_version >= 0x10201) {
+		b[0] = REQUEST_SET_USB_XFER_LEN;
+		b[1] = (nb_ts_packets >> 8)&0xff;

Spaces around operators?

Quoted 15 lines
drivers/media/dvb/dvb-usb/dib0700_core.c +11 -0
+		b[2] = nb_ts_packets & 0xff;
+
+		deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
+
+		ret = dib0700_ctrl_wr(d, b, 3);
+	} else {
+		deb_info("this firmware does not allow to change the USB xfer len\n");
+		ret = -EIO;
+	}
+
+	return ret;
 }
 
 /*

drivers/media/dvb/dvb-usb/dib0700_core.c int dib0700_rc_setup(struct dvb_usb_device *d) · line 644

Quoted 2 lines
drivers/media/dvb/dvb-usb/dib0700_core.c +0 -0
@@ -642,7 +643,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 	i = dib0700_ctrl_wr(d, rc_setup, 3);
 	if (i<0) {

Spaces around operators?

Quoted 25 lines
drivers/media/dvb/dvb-usb/dib0700_core.c +3 -3
 		err("ir protocol setup failed");
-		return -1;
+		return i;
 	}
 
 	if (st->fw_version < 0x10200)
@@ -652,7 +653,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 	purb = usb_alloc_urb(0, GFP_KERNEL);
 	if (purb == NULL) {
 		err("rc usb alloc urb failed\n");
-		return -1;
+		return -ENOMEM;
 	}
 
 	purb->transfer_buffer = usb_buffer_alloc(d->udev, RC_MSG_SIZE_V1_20,
@@ -661,7 +662,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 	if (purb->transfer_buffer == NULL) {
 		err("rc usb_buffer_alloc() failed\n");
 		usb_free_urb(purb);
-		return -1;
+		return -ENOMEM;
 	}
 
 	purb->status = -EINPROGRESS;

drivers/media/dvb/dvb-usb/dib0700_core.c int dib0700_rc_setup(struct dvb_usb_device *d) · line 674

Quoted 5 lines
drivers/media/dvb/dvb-usb/dib0700_core.c +1 -1
@@ -670,12 +671,10 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 			  dib0700_rc_urb_completion, d);
 
 	ret = usb_submit_urb(purb, GFP_ATOMIC);
-	if (ret != 0) {
+	if (ret != 0)

if (ret)

Quoted 17 lines
drivers/media/dvb/dvb-usb/dib0700_core.c +1 -3
 		err("rc submit urb failed\n");
-		return -1;
-	}
 
-	return 0;
+	return ret;
 }
 
 static int dib0700_probe(struct usb_interface *intf,
Signature · 7 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw

PATCH 1/1 drivers/media/dvb/dvb-usb/dib0700: fix return values

Propagte correct error values instead of returning -1 which just means -EPERM ("Permission denied")

While at it, also fix some coding style violations.

Cc Mauro Carvalho Chehab <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Devin Heitmueller <[email protected]>
---
 drivers/media/dvb/dvb-usb/dib0700_core.c |   82 +++++++++++++++--------------
 1 files changed, 42 insertions(+), 40 deletions(-)
drivers/media/dvb/dvb-usb/dib0700_core.c +42 -40
index 4f961d2..45aec3a 100644
@@ -53,7 +53,7 @@ static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen)
 	int status;
 
 	deb_data(">>> ");
-	debug_dump(tx,txlen,deb_data);
+	debug_dump(tx, txlen, deb_data);
 
 	status = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev,0),
 		tx[0], USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, tx, txlen,
@@ -98,7 +98,7 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen
 		deb_info("ep 0 read error (status = %d)\n",status);
 
 	deb_data("<<< ");
-	debug_dump(rx,rxlen,deb_data);
+	debug_dump(rx, rxlen, deb_data);
 
 	return status; /* length in case of success */
 }
@@ -106,28 +106,29 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen
 int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val)
 {
 	u8 buf[3] = { REQUEST_SET_GPIO, gpio, ((gpio_dir & 0x01) << 7) | ((gpio_val & 0x01) << 6) };
-	return dib0700_ctrl_wr(d,buf,3);
+	return dib0700_ctrl_wr(d, buf, sizeof(buf));
 }
 
 static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets)
 {
-    struct dib0700_state *st = d->priv;
-    u8 b[3];
-    int ret;
-
-    if (st->fw_version >= 0x10201) {
-	b[0] = REQUEST_SET_USB_XFER_LEN;
-	b[1] = (nb_ts_packets >> 8)&0xff;
-	b[2] = nb_ts_packets & 0xff;
-
-	deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
-
-	ret = dib0700_ctrl_wr(d, b, 3);
-    } else {
-	deb_info("this firmware does not allow to change the USB xfer len\n");
-	ret = -EIO;
-    }
-    return ret;
+	struct dib0700_state *st = d->priv;
+	u8 b[3];
+	int ret;
+
+	if (st->fw_version >= 0x10201) {
+		b[0] = REQUEST_SET_USB_XFER_LEN;
+		b[1] = (nb_ts_packets >> 8) & 0xff;
+		b[2] = nb_ts_packets & 0xff;
+
+		deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
+
+		ret = dib0700_ctrl_wr(d, b, 3);
+	} else {
+		deb_info("this firmware does not allow to change the USB xfer len\n");
+		ret = -EIO;
+	}
+
+	return ret;
 }
 
 /*
@@ -178,7 +179,8 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg,
 			value = ((en_start << 7) | (en_stop << 6) |
 				 (msg[i].len & 0x3F)) << 8 | i2c_dest;
 			/* I2C ctrl + FE bus; */
-			index = ((gen_mode<<6)&0xC0) | ((bus_mode<<4)&0x30);
+			index = ((gen_mode << 6) & 0xC0) |
+				((bus_mode << 4) & 0x30);
 
 			result = usb_control_msg(d->udev,
 						 usb_rcvctrlpipe(d->udev, 0),
@@ -198,11 +200,12 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg,
 		} else {
 			/* Write request */
 			buf[0] = REQUEST_NEW_I2C_WRITE;
-			buf[1] = (msg[i].addr << 1);
+			buf[1] = msg[i].addr << 1;
 			buf[2] = (en_start << 7) | (en_stop << 6) |
 				(msg[i].len & 0x3F);
 			/* I2C ctrl + FE bus; */
-			buf[3] = ((gen_mode<<6)&0xC0) | ((bus_mode<<4)&0x30);
+			buf[3] = ((gen_mode << 6) & 0xC0) |
+				 ((bus_mode << 4) & 0x30);
 			/* The Actual i2c payload */
 			memcpy(&buf[4], msg[i].buf, msg[i].len);
 
@@ -240,7 +243,7 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap,
 
 	for (i = 0; i < num; i++) {
 		/* fill in the address */
-		buf[1] = (msg[i].addr << 1);
+		buf[1] = msg[i].addr << 1;
 		/* fill the buffer */
 		memcpy(&buf[2], msg[i].buf, msg[i].len);
 
@@ -368,7 +371,8 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw
 	u8 buf[260];
 
 	while ((ret = dvb_usb_get_hexline(fw, &hx, &pos)) > 0) {
-		deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",hx.addr, hx.len, hx.chk);
+		deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",
+				hx.addr, hx.len, hx.chk);
 
 		buf[0] = hx.len;
 		buf[1] = (hx.addr >> 8) & 0xff;
@@ -408,16 +412,16 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw
 				  REQUEST_GET_VERSION,
 				  USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
 				  b, sizeof(b), USB_CTRL_GET_TIMEOUT);
-	fw_version = (b[8] << 24)  | (b[9] << 16)  | (b[10] << 8) | b[11];
+	fw_version = (b[8] << 24) | (b[9] << 16) | (b[10] << 8) | b[11];
 
 	/* set the buffer size - DVB-USB is allocating URB buffers
 	 * only after the firwmare download was successful */
 	for (i = 0; i < dib0700_device_count; i++) {
 		for (adap_num = 0; adap_num < dib0700_devices[i].num_adapters;
 				adap_num++) {
-			if (fw_version >= 0x10201)
+			if (fw_version >= 0x10201) {
 				dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = 188*nb_packet_buffer_size;
-			else {
+			} else {
 				/* for fw version older than 1.20.1,
 				 * the buffersize has to be n times 512 */
 				dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = ((188*nb_packet_buffer_size+188/2)/512)*512;
@@ -453,7 +457,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
 	if (st->disable_streaming_master_mode == 1)
 		b[2] = 0x00;
 	else
-		b[2] = (0x01 << 4); /* Master mode */
+		b[2] = 0x01 << 4; /* Master mode */
 
 	b[3] = 0x00;
 
@@ -466,7 +470,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
 
 	b[2] |= st->channel_state;
 
-	deb_info("data for streaming: %x %x\n",b[1],b[2]);
+	deb_info("data for streaming: %x %x\n", b[1], b[2]);
 
 	return dib0700_ctrl_wr(adap->dev, b, 4);
 }
@@ -631,7 +635,7 @@ resubmit:
 int dib0700_rc_setup(struct dvb_usb_device *d)
 {
 	struct dib0700_state *st = d->priv;
-	u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0};
+	u8 rc_setup[3] = { REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0 };
 	struct urb *purb;
 	int ret;
 	int i;
@@ -640,10 +644,10 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 		return 0;
 
 	/* Set the IR mode */
-	i = dib0700_ctrl_wr(d, rc_setup, 3);
-	if (i<0) {
+	i = dib0700_ctrl_wr(d, rc_setup, sizeof(rc_setup));
+	if (i < 0) {
 		err("ir protocol setup failed");
-		return -1;
+		return i;
 	}
 
 	if (st->fw_version < 0x10200)
@@ -653,14 +657,14 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 	purb = usb_alloc_urb(0, GFP_KERNEL);
 	if (purb == NULL) {
 		err("rc usb alloc urb failed\n");
-		return -1;
+		return -ENOMEM;
 	}
 
 	purb->transfer_buffer = kzalloc(RC_MSG_SIZE_V1_20, GFP_KERNEL);
 	if (purb->transfer_buffer == NULL) {
 		err("rc kzalloc failed\n");
 		usb_free_urb(purb);
-		return -1;
+		return -ENOMEM;
 	}
 
 	purb->status = -EINPROGRESS;
@@ -669,12 +673,10 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 			  dib0700_rc_urb_completion, d);
 
 	ret = usb_submit_urb(purb, GFP_ATOMIC);
-	if (ret != 0) {
+	if (ret)
 		err("rc submit urb failed\n");
-		return -1;
-	}
 
-	return 0;
+	return ret;
 }
 
 static int dib0700_probe(struct usb_interface *intf,
Signature · 1 line
1.7.1
#3 lore raw
Quoted 223 lines · Daniel Mack

Propagte correct error values instead of returning -1 which just means -EPERM ("Permission denied")

While at it, also fix some coding style violations.

Cc Mauro Carvalho Chehab <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Devin Heitmueller <[email protected]>

---
 drivers/media/dvb/dvb-usb/dib0700_core.c |   82 +++++++++++++++--------------

 1 files changed, 42 insertions(+), 40 deletions(-)
drivers/media/dvb/dvb-usb/dib0700_core.c +2 -2
index 4f961d2..45aec3a 100644
@@ -53,7 +53,7 @@ static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen)
        int status;
 
        deb_data(">>> ");
-       debug_dump(tx,txlen,deb_data);
+       debug_dump(tx, txlen, deb_data);
 
        status = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev,0),
                tx[0], USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, tx, txlen,
@@ -98,7 +98,7 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen
                deb_info("ep 0 read error (status = %d)\n",status);
 
        deb_data("<<< ");
-       debug_dump(rx,rxlen,deb_data);
+       debug_dump(rx, rxlen, deb_data);
 

       return status; /* length in case of success */ }

drivers/media/dvb/dvb-usb/dib0700_core.c +19 -18
@@ -106,28 +106,29 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen
  int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val)
  {
        u8 buf[3] = { REQUEST_SET_GPIO, gpio, ((gpio_dir & 0x01) << 7) | ((gpio_val & 0x01) << 6) };
-       return dib0700_ctrl_wr(d,buf,3);
+       return dib0700_ctrl_wr(d, buf, sizeof(buf));
  }
 
  static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets)
  {
-    struct dib0700_state *st = d->priv;
-    u8 b[3];
-    int ret;
-
-    if (st->fw_version >= 0x10201) {
-       b[0] = REQUEST_SET_USB_XFER_LEN;
-       b[1] = (nb_ts_packets >> 8)&0xff;
-       b[2] = nb_ts_packets & 0xff;
-
-       deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
-
-       ret = dib0700_ctrl_wr(d, b, 3);
-    } else {
-       deb_info("this firmware does not allow to change the USB xfer len\n");
-       ret = -EIO;
-    }
-    return ret;
+       struct dib0700_state *st = d->priv;
+       u8 b[3];
+       int ret;
+
+       if (st->fw_version >= 0x10201) {
+               b[0] = REQUEST_SET_USB_XFER_LEN;
+               b[1] = (nb_ts_packets >> 8) & 0xff;
+               b[2] = nb_ts_packets & 0xff;
+
+               deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
+
+               ret = dib0700_ctrl_wr(d, b, 3);
+       } else {
+               deb_info("this firmware does not allow to change the USB xfer len\n");
+               ret = -EIO;
+       }
+
+       return ret;
  }
 
  /*
@@ -178,7 +179,8 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg,

                       value = ((en_start << 7) | (en_stop << 6) | (msg[i].len & 0x3F)) << 8 | i2c_dest; /* I2C ctrl + FE bus; */
-                       index = ((gen_mode<<6)&0xC0) | ((bus_mode<<4)&0x30);
+                       index = ((gen_mode << 6) & 0xC0) |
+                               ((bus_mode << 4) & 0x30);

                       result = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0),

drivers/media/dvb/dvb-usb/dib0700_core.c +1 -1
@@ -198,11 +200,12 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg,
                } else {
                        /* Write request */
                        buf[0] = REQUEST_NEW_I2C_WRITE;
-                       buf[1] = (msg[i].addr << 1);
+                       buf[1] = msg[i].addr << 1;

                       buf[2] = (en_start << 7) | (en_stop << 6) | (msg[i].len & 0x3F);
                       /* I2C ctrl + FE bus; */
-                       buf[3] = ((gen_mode<<6)&0xC0) | ((bus_mode<<4)&0x30);
+                       buf[3] = ((gen_mode << 6) & 0xC0) |
+                                ((bus_mode << 4) & 0x30);
                       /* The Actual i2c payload */ memcpy(&buf[4], msg[i].buf, msg[i].len);

drivers/media/dvb/dvb-usb/dib0700_core.c +6 -5
@@ -240,7 +243,7 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap,
 
        for (i = 0; i < num; i++) {
                /* fill in the address */
-               buf[1] = (msg[i].addr << 1);
+               buf[1] = msg[i].addr << 1;
                /* fill the buffer */
                memcpy(&buf[2], msg[i].buf, msg[i].len);
 
@@ -368,7 +371,8 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw
        u8 buf[260];
 
        while ((ret = dvb_usb_get_hexline(fw, &hx, &pos)) > 0) {
-               deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",hx.addr, hx.len, hx.chk);
+               deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",
+                               hx.addr, hx.len, hx.chk);
 
                buf[0] = hx.len;
                buf[1] = (hx.addr >> 8) & 0xff;
@@ -408,16 +412,16 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw
                                  REQUEST_GET_VERSION,
                                  USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
                                  b, sizeof(b), USB_CTRL_GET_TIMEOUT);
-       fw_version = (b[8] << 24)  | (b[9] << 16)  | (b[10] << 8) | b[11];
+       fw_version = (b[8] << 24) | (b[9] << 16) | (b[10] << 8) | b[11];
 
        /* set the buffer size - DVB-USB is allocating URB buffers
         * only after the firwmare download was successful */
        for (i = 0; i < dib0700_device_count; i++) {
                for (adap_num = 0; adap_num < dib0700_devices[i].num_adapters;
                                adap_num++) {
-                       if (fw_version >= 0x10201)
+                       if (fw_version >= 0x10201) {
                                dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = 188*nb_packet_buffer_size;
-                       else {
+                       } else {
                                /* for fw version older than 1.20.1,
                                 * the buffersize has to be n times 512 */
                                dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = ((188*nb_packet_buffer_size+188/2)/512)*512;
@@ -453,7 +457,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
        if (st->disable_streaming_master_mode == 1)
                b[2] = 0x00;

       else
-               b[2] = (0x01 << 4); /* Master mode */
+               b[2] = 0x01 << 4; /* Master mode */

       b[3] = 0x00;

drivers/media/dvb/dvb-usb/dib0700_core.c +9 -12
@@ -466,7 +470,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
 
        b[2] |= st->channel_state;
 
-       deb_info("data for streaming: %x %x\n",b[1],b[2]);
+       deb_info("data for streaming: %x %x\n", b[1], b[2]);
 
        return dib0700_ctrl_wr(adap->dev, b, 4);
  }
@@ -631,7 +635,7 @@ resubmit:
  int dib0700_rc_setup(struct dvb_usb_device *d)
  {
        struct dib0700_state *st = d->priv;
-       u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0};
+       u8 rc_setup[3] = { REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0 };
        struct urb *purb;
        int ret;
        int i;
@@ -640,10 +644,10 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
                return 0;
 
        /* Set the IR mode */
-       i = dib0700_ctrl_wr(d, rc_setup, 3);
-       if (i<0) {
+       i = dib0700_ctrl_wr(d, rc_setup, sizeof(rc_setup));
+       if (i < 0) {
                err("ir protocol setup failed");
-               return -1;
+               return i;
        }
 
        if (st->fw_version < 0x10200)
@@ -653,14 +657,14 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
        purb = usb_alloc_urb(0, GFP_KERNEL);
        if (purb == NULL) {
                err("rc usb alloc urb failed\n");
-               return -1;
+               return -ENOMEM;
        }
 
        purb->transfer_buffer = kzalloc(RC_MSG_SIZE_V1_20, GFP_KERNEL);
        if (purb->transfer_buffer == NULL) {
                err("rc kzalloc failed\n");
                usb_free_urb(purb);
-               return -1;
+               return -ENOMEM;
        }
 
        purb->status = -EINPROGRESS;
@@ -669,12 +673,10 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
                          dib0700_rc_urb_completion, d);
 
        ret = usb_submit_urb(purb, GFP_ATOMIC);
-       if (ret != 0) {
+       if (ret)
                err("rc submit urb failed\n");
-               return -1;
-       }
 
-       return 0;
+       return ret;
  }
 
  static int dib0700_probe(struct usb_interface *intf,
--
Quoted 1 line

1.7.1

Hello Daniel,

I am not against any of these changes in principle, but you should not be mixing functional changes with codingstyle fixes. It results in a situation where as a reviewer I have to scrutinize every line *very* closely to determine whether it's an actual change or just a codingstyle fix.

In other words, split this into two patches.

Thanks,

Devin

Signature · 2 lines
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com
#4 lore raw

PATCH 1/2 drivers/media/dvb/dvb-usb/dib0700: fix return values

Propagte correct error values instead of returning -1 which just means -EPERM ("Permission denied")

Cc Wolfram Sang <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Devin Heitmueller <[email protected]>
---
 drivers/media/dvb/dvb-usb/dib0700_core.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
drivers/media/dvb/dvb-usb/dib0700_core.c +7 -9
index 4f961d2..d2dabac 100644
@@ -640,10 +640,10 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 		return 0;
 
 	/* Set the IR mode */
-	i = dib0700_ctrl_wr(d, rc_setup, 3);
-	if (i<0) {
+	i = dib0700_ctrl_wr(d, rc_setup, sizeof(rc_setup));
+	if (i < 0) {
 		err("ir protocol setup failed");
-		return -1;
+		return i;
 	}
 
 	if (st->fw_version < 0x10200)
@@ -653,14 +653,14 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 	purb = usb_alloc_urb(0, GFP_KERNEL);
 	if (purb == NULL) {
 		err("rc usb alloc urb failed\n");
-		return -1;
+		return -ENOMEM;
 	}
 
 	purb->transfer_buffer = kzalloc(RC_MSG_SIZE_V1_20, GFP_KERNEL);
 	if (purb->transfer_buffer == NULL) {
 		err("rc kzalloc failed\n");
 		usb_free_urb(purb);
-		return -1;
+		return -ENOMEM;
 	}
 
 	purb->status = -EINPROGRESS;
@@ -669,12 +669,10 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
 			  dib0700_rc_urb_completion, d);
 
 	ret = usb_submit_urb(purb, GFP_ATOMIC);
-	if (ret != 0) {
+	if (ret)
 		err("rc submit urb failed\n");
-		return -1;
-	}
 
-	return 0;
+	return ret;
 }
 
 static int dib0700_probe(struct usb_interface *intf,
Signature · 1 line
1.7.1
#6 lore raw

PATCH 2/2 drivers/media/dvb/dvb-usb/dib0700: CodingStyle fixes

In reply to Devin Heitmueller
Cc Wolfram Sang <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Devin Heitmueller <[email protected]>
---
 drivers/media/dvb/dvb-usb/dib0700_core.c |   66 ++++++++++++++++--------------
 1 files changed, 35 insertions(+), 31 deletions(-)
drivers/media/dvb/dvb-usb/dib0700_core.c +35 -31
index d2dabac..45aec3a 100644
@@ -53,7 +53,7 @@ static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen)
 	int status;
 
 	deb_data(">>> ");
-	debug_dump(tx,txlen,deb_data);
+	debug_dump(tx, txlen, deb_data);
 
 	status = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev,0),
 		tx[0], USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, tx, txlen,
@@ -98,7 +98,7 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen
 		deb_info("ep 0 read error (status = %d)\n",status);
 
 	deb_data("<<< ");
-	debug_dump(rx,rxlen,deb_data);
+	debug_dump(rx, rxlen, deb_data);
 
 	return status; /* length in case of success */
 }
@@ -106,28 +106,29 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen
 int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val)
 {
 	u8 buf[3] = { REQUEST_SET_GPIO, gpio, ((gpio_dir & 0x01) << 7) | ((gpio_val & 0x01) << 6) };
-	return dib0700_ctrl_wr(d,buf,3);
+	return dib0700_ctrl_wr(d, buf, sizeof(buf));
 }
 
 static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets)
 {
-    struct dib0700_state *st = d->priv;
-    u8 b[3];
-    int ret;
-
-    if (st->fw_version >= 0x10201) {
-	b[0] = REQUEST_SET_USB_XFER_LEN;
-	b[1] = (nb_ts_packets >> 8)&0xff;
-	b[2] = nb_ts_packets & 0xff;
-
-	deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
-
-	ret = dib0700_ctrl_wr(d, b, 3);
-    } else {
-	deb_info("this firmware does not allow to change the USB xfer len\n");
-	ret = -EIO;
-    }
-    return ret;
+	struct dib0700_state *st = d->priv;
+	u8 b[3];
+	int ret;
+
+	if (st->fw_version >= 0x10201) {
+		b[0] = REQUEST_SET_USB_XFER_LEN;
+		b[1] = (nb_ts_packets >> 8) & 0xff;
+		b[2] = nb_ts_packets & 0xff;
+
+		deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
+
+		ret = dib0700_ctrl_wr(d, b, 3);
+	} else {
+		deb_info("this firmware does not allow to change the USB xfer len\n");
+		ret = -EIO;
+	}
+
+	return ret;
 }
 
 /*
@@ -178,7 +179,8 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg,
 			value = ((en_start << 7) | (en_stop << 6) |
 				 (msg[i].len & 0x3F)) << 8 | i2c_dest;
 			/* I2C ctrl + FE bus; */
-			index = ((gen_mode<<6)&0xC0) | ((bus_mode<<4)&0x30);
+			index = ((gen_mode << 6) & 0xC0) |
+				((bus_mode << 4) & 0x30);
 
 			result = usb_control_msg(d->udev,
 						 usb_rcvctrlpipe(d->udev, 0),
@@ -198,11 +200,12 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg,
 		} else {
 			/* Write request */
 			buf[0] = REQUEST_NEW_I2C_WRITE;
-			buf[1] = (msg[i].addr << 1);
+			buf[1] = msg[i].addr << 1;
 			buf[2] = (en_start << 7) | (en_stop << 6) |
 				(msg[i].len & 0x3F);
 			/* I2C ctrl + FE bus; */
-			buf[3] = ((gen_mode<<6)&0xC0) | ((bus_mode<<4)&0x30);
+			buf[3] = ((gen_mode << 6) & 0xC0) |
+				 ((bus_mode << 4) & 0x30);
 			/* The Actual i2c payload */
 			memcpy(&buf[4], msg[i].buf, msg[i].len);
 
@@ -240,7 +243,7 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap,
 
 	for (i = 0; i < num; i++) {
 		/* fill in the address */
-		buf[1] = (msg[i].addr << 1);
+		buf[1] = msg[i].addr << 1;
 		/* fill the buffer */
 		memcpy(&buf[2], msg[i].buf, msg[i].len);
 
@@ -368,7 +371,8 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw
 	u8 buf[260];
 
 	while ((ret = dvb_usb_get_hexline(fw, &hx, &pos)) > 0) {
-		deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",hx.addr, hx.len, hx.chk);
+		deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",
+				hx.addr, hx.len, hx.chk);
 
 		buf[0] = hx.len;
 		buf[1] = (hx.addr >> 8) & 0xff;
@@ -408,16 +412,16 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw
 				  REQUEST_GET_VERSION,
 				  USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
 				  b, sizeof(b), USB_CTRL_GET_TIMEOUT);
-	fw_version = (b[8] << 24)  | (b[9] << 16)  | (b[10] << 8) | b[11];
+	fw_version = (b[8] << 24) | (b[9] << 16) | (b[10] << 8) | b[11];
 
 	/* set the buffer size - DVB-USB is allocating URB buffers
 	 * only after the firwmare download was successful */
 	for (i = 0; i < dib0700_device_count; i++) {
 		for (adap_num = 0; adap_num < dib0700_devices[i].num_adapters;
 				adap_num++) {
-			if (fw_version >= 0x10201)
+			if (fw_version >= 0x10201) {
 				dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = 188*nb_packet_buffer_size;
-			else {
+			} else {
 				/* for fw version older than 1.20.1,
 				 * the buffersize has to be n times 512 */
 				dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = ((188*nb_packet_buffer_size+188/2)/512)*512;
@@ -453,7 +457,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
 	if (st->disable_streaming_master_mode == 1)
 		b[2] = 0x00;
 	else
-		b[2] = (0x01 << 4); /* Master mode */
+		b[2] = 0x01 << 4; /* Master mode */
 
 	b[3] = 0x00;
 
@@ -466,7 +470,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
 
 	b[2] |= st->channel_state;
 
-	deb_info("data for streaming: %x %x\n",b[1],b[2]);
+	deb_info("data for streaming: %x %x\n", b[1], b[2]);
 
 	return dib0700_ctrl_wr(adap->dev, b, 4);
 }
@@ -631,7 +635,7 @@ resubmit:
 int dib0700_rc_setup(struct dvb_usb_device *d)
 {
 	struct dib0700_state *st = d->priv;
-	u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0};
+	u8 rc_setup[3] = { REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0 };
 	struct urb *purb;
 	int ret;
 	int i;
Signature · 1 line
1.7.1
Acked-by on v1 2/2
#7 lore raw

Re: [PATCH 2/2] drivers/media/dvb/dvb-usb/dib0700: CodingStyle fixes

Quoted 7 lines · Daniel Mack
Cc Wolfram Sang <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Devin Heitmueller <[email protected]>

Looks correct to me and definately more readable:

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Acked-by on v1 1/2
#5 lore raw
In reply to Daniel Mack
Quoted 10 lines · Daniel Mack

Propagte correct error values instead of returning -1 which just means -EPERM ("Permission denied")

Cc Wolfram Sang <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Devin Heitmueller <[email protected]>

I am no specialist for this driver, but as I am on cc and it looks good to me (no big changes, after all):

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#8 lore raw

Re: [PATCH 2/2] drivers/media/dvb/dvb-usb/dib0700: CodingStyle fixes

In reply to Daniel Mack

See comments below:

On Mon, May 24, 2010 at 6:57 AM, Daniel Mack <[email protected]> wrote:

<snip />

Quoted 29 lines
drivers/media/dvb/dvb-usb/dib0700_core.c +3 -18
@@ -106,28 +106,29 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen
  int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val)
  {
        u8 buf[3] = { REQUEST_SET_GPIO, gpio, ((gpio_dir & 0x01) << 7) | ((gpio_val & 0x01) << 6) };
-       return dib0700_ctrl_wr(d,buf,3);
+       return dib0700_ctrl_wr(d, buf, sizeof(buf));
  }
 
  static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets)
  {
-    struct dib0700_state *st = d->priv;
-    u8 b[3];
-    int ret;
-
-    if (st->fw_version >= 0x10201) {
-       b[0] = REQUEST_SET_USB_XFER_LEN;
-       b[1] = (nb_ts_packets >> 8)&0xff;
-       b[2] = nb_ts_packets & 0xff;
-
-       deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
-
-       ret = dib0700_ctrl_wr(d, b, 3);
-    } else {
-       deb_info("this firmware does not allow to change the USB xfer len\n");
-       ret = -EIO;
-    }
-    return ret;
+       struct dib0700_state *st = d->priv;
+       u8 b[3];

drivers/media/dvb/dvb-usb/dib0700_core.c int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen · line 125

Quoted 10 lines
drivers/media/dvb/dvb-usb/dib0700_core.c +10 -0
+       int ret;
+
+       if (st->fw_version >= 0x10201) {
+               b[0] = REQUEST_SET_USB_XFER_LEN;
+               b[1] = (nb_ts_packets >> 8) & 0xff;
+               b[2] = nb_ts_packets & 0xff;
+
+               deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
+
+               ret = dib0700_ctrl_wr(d, b, 3);

sizeof(b) would be better than the hard-coded value of 3 above.

drivers/media/dvb/dvb-usb/dib0700_core.c int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen · line 134

Quoted 9 lines
drivers/media/dvb/dvb-usb/dib0700_core.c +6 -0
+       } else {
+               deb_info("this firmware does not allow to change the USB xfer len\n");
+               ret = -EIO;
+       }
+
+       return ret;
  }
 
  /*

<snip />

Everything else looks good.

Regards,

David Ellingsworth

#9 lore raw

PATCH 1/1 drivers/media/dvb/dvb-usb/dib0700: CodingStyle fixes

Cc Wolfram Sang <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Devin Heitmueller <[email protected]>
---
 drivers/media/dvb/dvb-usb/dib0700_core.c |   66 ++++++++++++++++--------------
 1 files changed, 35 insertions(+), 31 deletions(-)
drivers/media/dvb/dvb-usb/dib0700_core.c +35 -31
index d2dabac..7deade7 100644
@@ -53,7 +53,7 @@ static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen)
 	int status;
 
 	deb_data(">>> ");
-	debug_dump(tx,txlen,deb_data);
+	debug_dump(tx, txlen, deb_data);
 
 	status = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev,0),
 		tx[0], USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, tx, txlen,
@@ -98,7 +98,7 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen
 		deb_info("ep 0 read error (status = %d)\n",status);
 
 	deb_data("<<< ");
-	debug_dump(rx,rxlen,deb_data);
+	debug_dump(rx, rxlen, deb_data);
 
 	return status; /* length in case of success */
 }
@@ -106,28 +106,29 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen
 int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val)
 {
 	u8 buf[3] = { REQUEST_SET_GPIO, gpio, ((gpio_dir & 0x01) << 7) | ((gpio_val & 0x01) << 6) };
-	return dib0700_ctrl_wr(d,buf,3);
+	return dib0700_ctrl_wr(d, buf, sizeof(buf));
 }
 
 static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets)
 {
-    struct dib0700_state *st = d->priv;
-    u8 b[3];
-    int ret;
-
-    if (st->fw_version >= 0x10201) {
-	b[0] = REQUEST_SET_USB_XFER_LEN;
-	b[1] = (nb_ts_packets >> 8)&0xff;
-	b[2] = nb_ts_packets & 0xff;
-
-	deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
-
-	ret = dib0700_ctrl_wr(d, b, 3);
-    } else {
-	deb_info("this firmware does not allow to change the USB xfer len\n");
-	ret = -EIO;
-    }
-    return ret;
+	struct dib0700_state *st = d->priv;
+	u8 b[3];
+	int ret;
+
+	if (st->fw_version >= 0x10201) {
+		b[0] = REQUEST_SET_USB_XFER_LEN;
+		b[1] = (nb_ts_packets >> 8) & 0xff;
+		b[2] = nb_ts_packets & 0xff;
+
+		deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
+
+		ret = dib0700_ctrl_wr(d, b, sizeof(b));
+	} else {
+		deb_info("this firmware does not allow to change the USB xfer len\n");
+		ret = -EIO;
+	}
+
+	return ret;
 }
 
 /*
@@ -178,7 +179,8 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg,
 			value = ((en_start << 7) | (en_stop << 6) |
 				 (msg[i].len & 0x3F)) << 8 | i2c_dest;
 			/* I2C ctrl + FE bus; */
-			index = ((gen_mode<<6)&0xC0) | ((bus_mode<<4)&0x30);
+			index = ((gen_mode << 6) & 0xC0) |
+				((bus_mode << 4) & 0x30);
 
 			result = usb_control_msg(d->udev,
 						 usb_rcvctrlpipe(d->udev, 0),
@@ -198,11 +200,12 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg,
 		} else {
 			/* Write request */
 			buf[0] = REQUEST_NEW_I2C_WRITE;
-			buf[1] = (msg[i].addr << 1);
+			buf[1] = msg[i].addr << 1;
 			buf[2] = (en_start << 7) | (en_stop << 6) |
 				(msg[i].len & 0x3F);
 			/* I2C ctrl + FE bus; */
-			buf[3] = ((gen_mode<<6)&0xC0) | ((bus_mode<<4)&0x30);
+			buf[3] = ((gen_mode << 6) & 0xC0) |
+				 ((bus_mode << 4) & 0x30);
 			/* The Actual i2c payload */
 			memcpy(&buf[4], msg[i].buf, msg[i].len);
 
@@ -240,7 +243,7 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap,
 
 	for (i = 0; i < num; i++) {
 		/* fill in the address */
-		buf[1] = (msg[i].addr << 1);
+		buf[1] = msg[i].addr << 1;
 		/* fill the buffer */
 		memcpy(&buf[2], msg[i].buf, msg[i].len);
 
@@ -368,7 +371,8 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw
 	u8 buf[260];
 
 	while ((ret = dvb_usb_get_hexline(fw, &hx, &pos)) > 0) {
-		deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",hx.addr, hx.len, hx.chk);
+		deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",
+				hx.addr, hx.len, hx.chk);
 
 		buf[0] = hx.len;
 		buf[1] = (hx.addr >> 8) & 0xff;
@@ -408,16 +412,16 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw
 				  REQUEST_GET_VERSION,
 				  USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
 				  b, sizeof(b), USB_CTRL_GET_TIMEOUT);
-	fw_version = (b[8] << 24)  | (b[9] << 16)  | (b[10] << 8) | b[11];
+	fw_version = (b[8] << 24) | (b[9] << 16) | (b[10] << 8) | b[11];
 
 	/* set the buffer size - DVB-USB is allocating URB buffers
 	 * only after the firwmare download was successful */
 	for (i = 0; i < dib0700_device_count; i++) {
 		for (adap_num = 0; adap_num < dib0700_devices[i].num_adapters;
 				adap_num++) {
-			if (fw_version >= 0x10201)
+			if (fw_version >= 0x10201) {
 				dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = 188*nb_packet_buffer_size;
-			else {
+			} else {
 				/* for fw version older than 1.20.1,
 				 * the buffersize has to be n times 512 */
 				dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = ((188*nb_packet_buffer_size+188/2)/512)*512;
@@ -453,7 +457,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
 	if (st->disable_streaming_master_mode == 1)
 		b[2] = 0x00;
 	else
-		b[2] = (0x01 << 4); /* Master mode */
+		b[2] = 0x01 << 4; /* Master mode */
 
 	b[3] = 0x00;
 
@@ -466,7 +470,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
 
 	b[2] |= st->channel_state;
 
-	deb_info("data for streaming: %x %x\n",b[1],b[2]);
+	deb_info("data for streaming: %x %x\n", b[1], b[2]);
 
 	return dib0700_ctrl_wr(adap->dev, b, 4);
 }
@@ -631,7 +635,7 @@ resubmit:
 int dib0700_rc_setup(struct dvb_usb_device *d)
 {
 	struct dib0700_state *st = d->priv;
-	u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0};
+	u8 rc_setup[3] = { REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0 };
 	struct urb *purb;
 	int ret;
 	int i;
Signature · 1 line
1.7.1
#11 lore raw

Re: [PATCH] drivers/media/dvb/dvb-usb/dib0700: CodingStyle fixes

Quoted 10 lines · Dmitry Torokhov
Quoted 7 lines · Daniel Mack
Cc Wolfram Sang <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Devin Heitmueller <[email protected]>

Not sure how I got on the list but chnages look good to me.

get_maintainer.pl :)

Daniel

#12 lore raw

Re: [PATCH] drivers/media/dvb/dvb-usb/dib0700: CodingStyle fixes

Em Mon, 24 May 2010 18:02:15 +0200
Daniel Mack <[email protected]> escreveu:

Quoted 10 lines · Dmitry Torokhov
Quoted 9 lines · Daniel Mack
Quoted 7 lines
Cc Wolfram Sang <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Jiri Slaby <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Devin Heitmueller <[email protected]>
Quoted 3 lines
Quoted 1 line

Not sure how I got on the list but chnages look good to me.

get_maintainer.pl :)

It did a very bad work in this case... It selected a random set of people, but it forgot to add the email of the low level driver...
This driver is maintained by Patrick (c/c). My name is also ok (as I am the subsystem maintainer), but instead of c/c me, you can just copy [email protected], since I work directly with the patchwork queue associated with the public ML.

Patrick,

Could you please review this patch and another one sent by Daniel at the ML?

Signature · 2 lines
Cheers,
Mauro
#13 lore raw

Re: [PATCH] drivers/media/dvb/dvb-usb/dib0700: CodingStyle fixes

Patrick,

Em Sat, 29 May 2010 00:53:14 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:

Quoted 3 lines

Patrick,

Could you please review this patch and another one sent by Daniel at the ML?

I think that those are the relevant changesets:

May,24 2010: [1/2] drivers/media/dvb/dvb-usb/dib0700: fix return values             http://patchwork.kernel.org/patch/101858
May,24 2010: [2/2] drivers/media/dvb/dvb-usb/dib0700: CodingStyle fixes             http://patchwork.kernel.org/patch/101859
May,24 2010: drivers/media/dvb/dvb-usb/dib0700: CodingStyle fixes                   http://patchwork.kernel.org/patch/101888

I haven't check if 101888 superseeds 101859.

Signature · 2 lines
Cheers,
Mauro