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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



See comments below:

On Mon, May 24, 2010 at 6:57 AM, Daniel Mack <daniel@xxxxxxxx> wrote:

<snip />
> @@ -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);

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

> +       } 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
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux