Commit cde4362f authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (10956): cx231xx: First series of manual CodingStyle fixes

This patch cleans up CodingStyle on the following source files:

There are still much more to be fixed on later patches
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 84b5dbf3
......@@ -70,7 +70,6 @@ static int cx231xx_isoc_audio_deinit(struct cx231xx *dev)
kfree(dev->adev.transfer_buffer[i]);
dev->adev.transfer_buffer[i] = NULL;
}
}
......@@ -108,8 +107,8 @@ static void cx231xx_audio_isocirq(struct urb *urb)
stride = runtime->frame_bits >> 3;
for (i = 0; i < urb->number_of_packets; i++) {
int length =
urb->iso_frame_desc[i].actual_length / stride;
int length = urb->iso_frame_desc[i].actual_length /
stride;
cp = (unsigned char *)urb->transfer_buffer +
urb->iso_frame_desc[i].offset;
......@@ -118,8 +117,9 @@ static void cx231xx_audio_isocirq(struct urb *urb)
oldptr = dev->adev.hwptr_done_capture;
if (oldptr + length >= runtime->buffer_size) {
unsigned int cnt =
runtime->buffer_size - oldptr;
unsigned int cnt;
cnt = runtime->buffer_size - oldptr;
memcpy(runtime->dma_area + oldptr * stride, cp,
cnt * stride);
memcpy(runtime->dma_area, cp + cnt * stride,
......@@ -132,16 +132,12 @@ static void cx231xx_audio_isocirq(struct urb *urb)
snd_pcm_stream_lock(substream);
dev->adev.hwptr_done_capture += length;
if (dev->adev.hwptr_done_capture >=
runtime->buffer_size)
dev->adev.hwptr_done_capture -=
runtime->buffer_size;
if (dev->adev.hwptr_done_capture >= runtime->buffer_size)
dev->adev.hwptr_done_capture -= runtime->buffer_size;
dev->adev.capture_transfer_done += length;
if (dev->adev.capture_transfer_done >=
runtime->period_size) {
dev->adev.capture_transfer_done -=
runtime->period_size;
if (dev->adev.capture_transfer_done >= runtime->period_size) {
dev->adev.capture_transfer_done -= runtime->period_size;
period_elapsed = 1;
}
snd_pcm_stream_unlock(substream);
......@@ -189,8 +185,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
urb->dev = dev->udev;
urb->context = dev;
urb->pipe =
usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr);
urb->pipe = usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr);
urb->transfer_flags = URB_ISO_ASAP;
urb->transfer_buffer = dev->adev.transfer_buffer[i];
urb->interval = 1;
......@@ -198,8 +193,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS;
urb->transfer_buffer_length = sb_size;
for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS;
j++, k += dev->adev.max_pkt_size) {
for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; j++, k += dev->adev.max_pkt_size) {
urb->iso_frame_desc[j].offset = k;
urb->iso_frame_desc[j].length = dev->adev.max_pkt_size;
}
......@@ -477,9 +471,8 @@ static int cx231xx_audio_init(struct cx231xx *dev)
"non standard usbaudio\n");
card = snd_card_new(index[devnr], "Cx231xx Audio", THIS_MODULE, 0);
if (card == NULL) {
if (card == NULL)
return -ENOMEM;
}
spin_lock_init(&adev->slock);
err = snd_pcm_new(card, "Cx231xx Audio", 0, 0, 1, &pcm);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -109,25 +109,27 @@ static inline int cx231xx_isoc_vbi_copy(struct cx231xx *dev, struct urb *urb)
buffer_size = urb->actual_length;
if (buffer_size > 0) {
bytes_parsed = 0;
if (dma_q->is_partial_line) {
/* Handle the case where we were working on a partial line */
/* Handle the case where we were working on a partial
line */
sav_eav = dma_q->last_sav;
} else {
/* Check for a SAV/EAV overlapping the buffer boundary */
sav_eav =
cx231xx_find_boundary_SAV_EAV(p_buffer,
/* Check for a SAV/EAV overlapping the
buffer boundary */
sav_eav = cx231xx_find_boundary_SAV_EAV(p_buffer,
dma_q->partial_buf,
&bytes_parsed);
}
sav_eav &= 0xF0;
/* Get the first line if we have some portion of an SAV/EAV from the last buffer
or a partial line */
/* Get the first line if we have some portion of an SAV/EAV from
the last buffer or a partial line */
if (sav_eav) {
bytes_parsed += cx231xx_get_vbi_line(dev, dma_q, sav_eav, /* SAV/EAV */
bytes_parsed += cx231xx_get_vbi_line(dev, dma_q,
sav_eav, /* SAV/EAV */
p_buffer + bytes_parsed, /* p_buffer */
buffer_size - bytes_parsed); /* buffer size */
}
......@@ -146,7 +148,8 @@ static inline int cx231xx_isoc_vbi_copy(struct cx231xx *dev, struct urb *urb)
sav_eav &= 0xF0;
if (sav_eav && (bytes_parsed < buffer_size)) {
bytes_parsed += cx231xx_get_vbi_line(dev, dma_q, sav_eav, /* SAV/EAV */
bytes_parsed += cx231xx_get_vbi_line(dev,
dma_q, sav_eav, /* SAV/EAV */
p_buffer + bytes_parsed, /* p_buffer */
buffer_size - bytes_parsed); /* buffer size */
}
......@@ -261,7 +264,7 @@ vbi_buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
buf->vb.state = VIDEOBUF_PREPARED;
return 0;
fail:
fail:
free_buffer(vq, buf);
return rc;
}
......@@ -285,12 +288,7 @@ static void vbi_buffer_release(struct videobuf_queue *vq,
{
struct cx231xx_buffer *buf =
container_of(vb, struct cx231xx_buffer, vb);
/*
struct cx231xx_fh *fh = vq->priv_data;
struct cx231xx *dev = (struct cx231xx *)fh->dev;
cx231xx_info(DRIVER_NAME "cx231xx: called vbi_buffer_release\n");
*/
free_buffer(vq, buf);
}
......@@ -387,7 +385,6 @@ void cx231xx_uninit_vbi_isoc(struct cx231xx *dev)
cx231xx_capture_start(dev, 0, Vbi);
}
EXPORT_SYMBOL_GPL(cx231xx_uninit_vbi_isoc);
/*
......@@ -395,8 +392,8 @@ EXPORT_SYMBOL_GPL(cx231xx_uninit_vbi_isoc);
*/
int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
int num_bufs, int max_pkt_size,
int (*isoc_copy) (struct cx231xx * dev,
struct urb * urb))
int (*isoc_copy) (struct cx231xx *dev,
struct urb *urb))
{
struct cx231xx_dmaqueue *dma_q = &dev->vbi_mode.vidq;
int i;
......@@ -427,8 +424,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
for (i = 0; i < 8; i++)
dma_q->partial_buf[i] = 0;
dev->vbi_mode.isoc_ctl.urb =
kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
dev->vbi_mode.isoc_ctl.urb = kzalloc(sizeof(void *) * num_bufs,
GFP_KERNEL);
if (!dev->vbi_mode.isoc_ctl.urb) {
cx231xx_errdev("cannot alloc memory for usb buffers\n");
return -ENOMEM;
......@@ -466,7 +463,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
cx231xx_err(DRIVER_NAME
": unable to allocate %i bytes for transfer"
" buffer %i%s\n", sb_size, i,
in_interrupt()? " while in int" : "");
in_interrupt() ? " while in int" : "");
cx231xx_uninit_vbi_isoc(dev);
return -ENOMEM;
}
......@@ -495,11 +492,10 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
return 0;
}
EXPORT_SYMBOL_GPL(cx231xx_init_vbi_isoc);
u32 cx231xx_get_vbi_line(struct cx231xx * dev, struct cx231xx_dmaqueue * dma_q,
u8 sav_eav, u8 * p_buffer, u32 buffer_size)
u32 cx231xx_get_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 sav_eav, u8 *p_buffer, u32 buffer_size)
{
u32 bytes_copied = 0;
int current_field = -1;
......@@ -550,15 +546,14 @@ static inline void vbi_buffer_filled(struct cx231xx *dev,
}
u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 * p_line, u32 length, int field_number)
u8 *p_line, u32 length, int field_number)
{
u32 bytes_to_copy;
struct cx231xx_buffer *buf;
u32 _line_size = dev->width * 2;
if (dma_q->current_field != field_number) {
if (dma_q->current_field != field_number)
cx231xx_reset_vbi_buffer(dev, dma_q);
}
/* get the buffer pointer */
buf = dev->vbi_mode.isoc_ctl.buf;
......@@ -651,7 +646,6 @@ void cx231xx_reset_vbi_buffer(struct cx231xx *dev,
buf = dev->vbi_mode.isoc_ctl.buf;
if (buf == NULL) {
/* first try to get the buffer */
get_next_vbi_buf(dma_q, &buf);
......@@ -664,7 +658,7 @@ void cx231xx_reset_vbi_buffer(struct cx231xx *dev,
}
int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 * p_buffer, u32 bytes_to_copy)
u8 *p_buffer, u32 bytes_to_copy)
{
u8 *p_out_buffer = NULL;
u32 current_line_bytes_copied = 0;
......@@ -675,9 +669,8 @@ int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
buf = dev->vbi_mode.isoc_ctl.buf;
if (buf == NULL) {
return -1;
}
if (buf == NULL)
return -EINVAL;
p_out_buffer = videobuf_to_vmalloc(&buf->vb);
......@@ -686,23 +679,22 @@ int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
_line_size - dma_q->bytes_left_in_line;
}
offset =
(dma_q->lines_completed * _line_size) + current_line_bytes_copied;
offset = (dma_q->lines_completed * _line_size) +
current_line_bytes_copied;
/* prepare destination address */
startwrite = p_out_buffer + offset;
lencopy =
dma_q->bytes_left_in_line >
bytes_to_copy ? bytes_to_copy : dma_q->bytes_left_in_line;
lencopy = dma_q->bytes_left_in_line > bytes_to_copy ?
bytes_to_copy : dma_q->bytes_left_in_line;
memcpy(startwrite, p_buffer, lencopy);
return 0;
}
u8 cx231xx_is_vbi_buffer_done(struct cx231xx * dev,
struct cx231xx_dmaqueue * dma_q)
u8 cx231xx_is_vbi_buffer_done(struct cx231xx *dev,
struct cx231xx_dmaqueue *dma_q)
{
u32 height = 0;
......
This diff is collapsed.
......@@ -140,8 +140,7 @@ struct cx231xx_usb_isoc_ctl {
int nfields;
/* isoc urb callback */
int (*isoc_copy) (struct cx231xx * dev, struct urb * urb);
int (*isoc_copy) (struct cx231xx *dev, struct urb *urb);
};
struct cx231xx_fmt {
......@@ -497,20 +496,19 @@ struct cx231xx {
char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */
/* helper funcs that call usb_control_msg */
int (*cx231xx_read_ctrl_reg) (struct cx231xx * dev, u8 req, u16 reg,
int (*cx231xx_read_ctrl_reg) (struct cx231xx *dev, u8 req, u16 reg,
char *buf, int len);
int (*cx231xx_write_ctrl_reg) (struct cx231xx * dev, u8 req, u16 reg,
int (*cx231xx_write_ctrl_reg) (struct cx231xx *dev, u8 req, u16 reg,
char *buf, int len);
int (*cx231xx_send_usb_command) (struct cx231xx_i2c * i2c_bus,
struct cx231xx_i2c_xfer_data *
req_data);
int (*cx231xx_gpio_i2c_read) (struct cx231xx * dev, u8 dev_addr,
u8 * buf, u8 len);
int (*cx231xx_gpio_i2c_write) (struct cx231xx * dev, u8 dev_addr,
u8 * buf, u8 len);
int (*cx231xx_send_usb_command) (struct cx231xx_i2c *i2c_bus,
struct cx231xx_i2c_xfer_data *req_data);
int (*cx231xx_gpio_i2c_read) (struct cx231xx *dev, u8 dev_addr,
u8 *buf, u8 len);
int (*cx231xx_gpio_i2c_write) (struct cx231xx *dev, u8 dev_addr,
u8 *buf, u8 len);
int (*cx231xx_set_analog_freq) (struct cx231xx * dev, u32 freq);
int (*cx231xx_reset_analog_tuner) (struct cx231xx * dev);
int (*cx231xx_set_analog_freq) (struct cx231xx *dev, u32 freq);
int (*cx231xx_reset_analog_tuner) (struct cx231xx *dev);
enum cx231xx_mode mode;
......@@ -562,7 +560,7 @@ int cx231xx_i2c_unregister(struct cx231xx_i2c *bus);
/* Internal block control functions */
int cx231xx_read_i2c_data(struct cx231xx *dev, u8 dev_addr,
u16 saddr, u8 saddr_len, u32 * data, u8 data_len);
u16 saddr, u8 saddr_len, u32 *data, u8 data_len);
int cx231xx_write_i2c_data(struct cx231xx *dev, u8 dev_addr,
u16 saddr, u8 saddr_len, u32 data, u8 data_len);
int cx231xx_reg_mask_write(struct cx231xx *dev, u8 dev_addr, u8 size,
......@@ -594,20 +592,20 @@ int cx231xx_tuner_pre_channel_change(struct cx231xx *dev);
int cx231xx_tuner_post_channel_change(struct cx231xx *dev);
/* video parser functions */
u8 cx231xx_find_next_SAV_EAV(u8 * p_buffer, u32 buffer_size,
u32 * p_bytes_used);
u8 cx231xx_find_boundary_SAV_EAV(u8 * p_buffer, u8 * partial_buf,
u32 * p_bytes_used);
u8 cx231xx_find_next_SAV_EAV(u8 *p_buffer, u32 buffer_size,
u32 *p_bytes_used);
u8 cx231xx_find_boundary_SAV_EAV(u8 *p_buffer, u8 *partial_buf,
u32 *p_bytes_used);
int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 * p_buffer, u32 bytes_to_copy);
u8 *p_buffer, u32 bytes_to_copy);
void cx231xx_reset_video_buffer(struct cx231xx *dev,
struct cx231xx_dmaqueue *dma_q);
u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q);
u32 cx231xx_copy_video_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 * p_line, u32 length, int field_number);
u8 *p_line, u32 length, int field_number);
u32 cx231xx_get_video_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 sav_eav, u8 * p_buffer, u32 buffer_size);
void cx231xx_swab(u16 * from, u16 * to, u16 len);
u8 sav_eav, u8 *p_buffer, u32 buffer_size);
void cx231xx_swab(u16 *from, u16 *to, u16 len);
/* Provided by cx231xx-core.c */
......@@ -624,15 +622,15 @@ int cx231xx_write_ctrl_reg(struct cx231xx *dev, u8 req, u16 reg,
char *buf, int len);
int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode);
int cx231xx_send_vendor_cmd(struct cx231xx *dev, VENDOR_REQUEST_IN * ven_req);
int cx231xx_send_vendor_cmd(struct cx231xx *dev, VENDOR_REQUEST_IN *ven_req);
int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus,
struct cx231xx_i2c_xfer_data *req_data);
/* Gpio related functions */
int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val,
int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val,
u8 len, u8 request, u8 direction);
int cx231xx_set_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val);
int cx231xx_get_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val);
int cx231xx_set_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val);
int cx231xx_get_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val);
int cx231xx_set_gpio_value(struct cx231xx *dev, int pin_number, int pin_value);
int cx231xx_set_gpio_direction(struct cx231xx *dev, int pin_number,
int pin_value);
......@@ -640,13 +638,13 @@ int cx231xx_set_gpio_direction(struct cx231xx *dev, int pin_number,
int cx231xx_gpio_i2c_start(struct cx231xx *dev);
int cx231xx_gpio_i2c_end(struct cx231xx *dev);
int cx231xx_gpio_i2c_write_byte(struct cx231xx *dev, u8 data);
int cx231xx_gpio_i2c_read_byte(struct cx231xx *dev, u8 * buf);
int cx231xx_gpio_i2c_read_byte(struct cx231xx *dev, u8 *buf);
int cx231xx_gpio_i2c_read_ack(struct cx231xx *dev);
int cx231xx_gpio_i2c_write_ack(struct cx231xx *dev);
int cx231xx_gpio_i2c_write_nak(struct cx231xx *dev);
int cx231xx_gpio_i2c_read(struct cx231xx *dev, u8 dev_addr, u8 * buf, u8 len);
int cx231xx_gpio_i2c_write(struct cx231xx *dev, u8 dev_addr, u8 * buf, u8 len);
int cx231xx_gpio_i2c_read(struct cx231xx *dev, u8 dev_addr, u8 *buf, u8 len);
int cx231xx_gpio_i2c_write(struct cx231xx *dev, u8 dev_addr, u8 *buf, u8 len);
/* audio related functions */
int cx231xx_set_audio_decoder_input(struct cx231xx *dev,
......@@ -658,8 +656,8 @@ int cx231xx_set_video_alternate(struct cx231xx *dev);
int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt);
int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
int num_bufs, int max_pkt_size,
int (*isoc_copy) (struct cx231xx * dev,
struct urb * urb));
int (*isoc_copy) (struct cx231xx *dev,
struct urb *urb));
void cx231xx_uninit_isoc(struct cx231xx *dev);
int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode);
int cx231xx_gpio_set(struct cx231xx *dev, struct cx231xx_reg_seq *gpio);
......
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