Commit ab85c6a3 authored by Dean Anderson's avatar Dean Anderson Committed by Mauro Carvalho Chehab

V4L/DVB: s2255drv: code cleanup

removal of unused pipe array (of size one).
Signed-off-by: default avatarDean Anderson <dean@sensoray.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ff7e22df
...@@ -85,7 +85,6 @@ ...@@ -85,7 +85,6 @@
#define S2255_RESPONSE_STATUS cpu_to_le32(0x20) #define S2255_RESPONSE_STATUS cpu_to_le32(0x20)
#define S2255_USB_XFER_SIZE (16 * 1024) #define S2255_USB_XFER_SIZE (16 * 1024)
#define MAX_CHANNELS 4 #define MAX_CHANNELS 4
#define MAX_PIPE_BUFFERS 1
#define SYS_FRAMES 4 #define SYS_FRAMES 4
/* maximum size is PAL full size plus room for the marker header(s) */ /* maximum size is PAL full size plus room for the marker header(s) */
#define SYS_FRAMES_MAXSIZE (720*288*2*2 + 4096) #define SYS_FRAMES_MAXSIZE (720*288*2*2 + 4096)
...@@ -237,8 +236,8 @@ struct s2255_dev { ...@@ -237,8 +236,8 @@ struct s2255_dev {
struct video_device *vdev[MAX_CHANNELS]; struct video_device *vdev[MAX_CHANNELS];
struct timer_list timer; struct timer_list timer;
struct s2255_fw *fw_data; struct s2255_fw *fw_data;
struct s2255_pipeinfo pipes[MAX_PIPE_BUFFERS]; struct s2255_pipeinfo pipe;
struct s2255_bufferi buffer[MAX_CHANNELS]; struct s2255_bufferi buffer[MAX_CHANNELS];
struct s2255_mode mode[MAX_CHANNELS]; struct s2255_mode mode[MAX_CHANNELS];
/* jpeg compression */ /* jpeg compression */
struct v4l2_jpegcompression jc[MAX_CHANNELS]; struct v4l2_jpegcompression jc[MAX_CHANNELS];
...@@ -2334,25 +2333,21 @@ static int s2255_release_sys_buffers(struct s2255_dev *dev, ...@@ -2334,25 +2333,21 @@ static int s2255_release_sys_buffers(struct s2255_dev *dev,
static int s2255_board_init(struct s2255_dev *dev) static int s2255_board_init(struct s2255_dev *dev)
{ {
int j;
struct s2255_mode mode_def = DEF_MODEI_NTSC_CONT; struct s2255_mode mode_def = DEF_MODEI_NTSC_CONT;
int fw_ver; int fw_ver;
int j;
struct s2255_pipeinfo *pipe = &dev->pipe;
dprintk(4, "board init: %p", dev); dprintk(4, "board init: %p", dev);
memset(pipe, 0, sizeof(*pipe));
for (j = 0; j < MAX_PIPE_BUFFERS; j++) { pipe->dev = dev;
struct s2255_pipeinfo *pipe = &dev->pipes[j]; pipe->cur_transfer_size = S2255_USB_XFER_SIZE;
pipe->max_transfer_size = S2255_USB_XFER_SIZE;
memset(pipe, 0, sizeof(*pipe));
pipe->dev = dev; pipe->transfer_buffer = kzalloc(pipe->max_transfer_size,
pipe->cur_transfer_size = S2255_USB_XFER_SIZE; GFP_KERNEL);
pipe->max_transfer_size = S2255_USB_XFER_SIZE; if (pipe->transfer_buffer == NULL) {
dprintk(1, "out of memory!\n");
pipe->transfer_buffer = kzalloc(pipe->max_transfer_size, return -ENOMEM;
GFP_KERNEL);
if (pipe->transfer_buffer == NULL) {
dprintk(1, "out of memory!\n");
return -ENOMEM;
}
} }
/* query the firmware */ /* query the firmware */
fw_ver = s2255_get_fx2fw(dev); fw_ver = s2255_get_fx2fw(dev);
...@@ -2401,12 +2396,8 @@ static int s2255_board_shutdown(struct s2255_dev *dev) ...@@ -2401,12 +2396,8 @@ static int s2255_board_shutdown(struct s2255_dev *dev)
for (i = 0; i < MAX_CHANNELS; i++) for (i = 0; i < MAX_CHANNELS; i++)
s2255_release_sys_buffers(dev, i); s2255_release_sys_buffers(dev, i);
/* release transfer buffer */
/* release transfer buffers */ kfree(dev->pipe.transfer_buffer);
for (i = 0; i < MAX_PIPE_BUFFERS; i++) {
struct s2255_pipeinfo *pipe = &dev->pipes[i];
kfree(pipe->transfer_buffer);
}
return 0; return 0;
} }
...@@ -2472,35 +2463,30 @@ static int s2255_start_readpipe(struct s2255_dev *dev) ...@@ -2472,35 +2463,30 @@ static int s2255_start_readpipe(struct s2255_dev *dev)
{ {
int pipe; int pipe;
int retval; int retval;
int i; struct s2255_pipeinfo *pipe_info = &dev->pipe;
struct s2255_pipeinfo *pipe_info = dev->pipes;
pipe = usb_rcvbulkpipe(dev->udev, dev->read_endpoint); pipe = usb_rcvbulkpipe(dev->udev, dev->read_endpoint);
dprintk(2, "start pipe IN %d\n", dev->read_endpoint); dprintk(2, "start pipe IN %d\n", dev->read_endpoint);
pipe_info->state = 1;
for (i = 0; i < MAX_PIPE_BUFFERS; i++) { pipe_info->err_count = 0;
pipe_info->state = 1; pipe_info->stream_urb = usb_alloc_urb(0, GFP_KERNEL);
pipe_info->err_count = 0; if (!pipe_info->stream_urb) {
pipe_info->stream_urb = usb_alloc_urb(0, GFP_KERNEL); dev_err(&dev->udev->dev,
if (!pipe_info->stream_urb) { "ReadStream: Unable to alloc URB\n");
dev_err(&dev->udev->dev, return -ENOMEM;
"ReadStream: Unable to alloc URB\n");
return -ENOMEM;
}
/* transfer buffer allocated in board_init */
usb_fill_bulk_urb(pipe_info->stream_urb, dev->udev,
pipe,
pipe_info->transfer_buffer,
pipe_info->cur_transfer_size,
read_pipe_completion, pipe_info);
dprintk(4, "submitting URB %p\n", pipe_info->stream_urb);
retval = usb_submit_urb(pipe_info->stream_urb, GFP_KERNEL);
if (retval) {
printk(KERN_ERR "s2255: start read pipe failed\n");
return retval;
}
} }
/* transfer buffer allocated in board_init */
usb_fill_bulk_urb(pipe_info->stream_urb, dev->udev,
pipe,
pipe_info->transfer_buffer,
pipe_info->cur_transfer_size,
read_pipe_completion, pipe_info);
dprintk(4, "submitting URB %p\n", pipe_info->stream_urb);
retval = usb_submit_urb(pipe_info->stream_urb, GFP_KERNEL);
if (retval) {
printk(KERN_ERR "s2255: start read pipe failed\n");
return retval;
}
return 0; return 0;
} }
...@@ -2581,30 +2567,19 @@ static int s2255_stop_acquire(struct s2255_dev *dev, unsigned long chn) ...@@ -2581,30 +2567,19 @@ static int s2255_stop_acquire(struct s2255_dev *dev, unsigned long chn)
static void s2255_stop_readpipe(struct s2255_dev *dev) static void s2255_stop_readpipe(struct s2255_dev *dev)
{ {
int j; struct s2255_pipeinfo *pipe = &dev->pipe;
if (dev == NULL) { if (dev == NULL) {
s2255_dev_err(&dev->udev->dev, "invalid device\n"); s2255_dev_err(&dev->udev->dev, "invalid device\n");
return; return;
} }
dprintk(4, "stop read pipe\n"); pipe->state = 0;
for (j = 0; j < MAX_PIPE_BUFFERS; j++) { if (pipe->stream_urb) {
struct s2255_pipeinfo *pipe_info = &dev->pipes[j]; /* cancel urb */
if (pipe_info) { usb_kill_urb(pipe->stream_urb);
if (pipe_info->state == 0) usb_free_urb(pipe->stream_urb);
continue; pipe->stream_urb = NULL;
pipe_info->state = 0;
}
}
for (j = 0; j < MAX_PIPE_BUFFERS; j++) {
struct s2255_pipeinfo *pipe_info = &dev->pipes[j];
if (pipe_info->stream_urb) {
/* cancel urb */
usb_kill_urb(pipe_info->stream_urb);
usb_free_urb(pipe_info->stream_urb);
pipe_info->stream_urb = NULL;
}
} }
dprintk(2, "s2255 stop read pipe: %d\n", j); dprintk(4, "%s", __func__);
return; return;
} }
......
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