diff options
author | Dean Anderson <dean@sensoray.com> | 2010-04-08 22:39:12 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:57:22 -0400 |
commit | ab85c6a33c7168cc42ce12ac3335c2f12d5a8d22 (patch) | |
tree | 37532e9d83be5afddb442e5a1815ef5e853d7cd6 /drivers/media/video/s2255drv.c | |
parent | ff7e22dfa1b8c291f154db990ff686adbe334448 (diff) |
V4L/DVB: s2255drv: code cleanup
removal of unused pipe array (of size one).
Signed-off-by: Dean Anderson <dean@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/s2255drv.c')
-rw-r--r-- | drivers/media/video/s2255drv.c | 113 |
1 files changed, 44 insertions, 69 deletions
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 1d8c6b4364dd..91f7e9538f6e 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
@@ -85,7 +85,6 @@ | |||
85 | #define S2255_RESPONSE_STATUS cpu_to_le32(0x20) | 85 | #define S2255_RESPONSE_STATUS cpu_to_le32(0x20) |
86 | #define S2255_USB_XFER_SIZE (16 * 1024) | 86 | #define S2255_USB_XFER_SIZE (16 * 1024) |
87 | #define MAX_CHANNELS 4 | 87 | #define MAX_CHANNELS 4 |
88 | #define MAX_PIPE_BUFFERS 1 | ||
89 | #define SYS_FRAMES 4 | 88 | #define SYS_FRAMES 4 |
90 | /* maximum size is PAL full size plus room for the marker header(s) */ | 89 | /* maximum size is PAL full size plus room for the marker header(s) */ |
91 | #define SYS_FRAMES_MAXSIZE (720*288*2*2 + 4096) | 90 | #define SYS_FRAMES_MAXSIZE (720*288*2*2 + 4096) |
@@ -237,8 +236,8 @@ struct s2255_dev { | |||
237 | struct video_device *vdev[MAX_CHANNELS]; | 236 | struct video_device *vdev[MAX_CHANNELS]; |
238 | struct timer_list timer; | 237 | struct timer_list timer; |
239 | struct s2255_fw *fw_data; | 238 | struct s2255_fw *fw_data; |
240 | struct s2255_pipeinfo pipes[MAX_PIPE_BUFFERS]; | 239 | struct s2255_pipeinfo pipe; |
241 | struct s2255_bufferi buffer[MAX_CHANNELS]; | 240 | struct s2255_bufferi buffer[MAX_CHANNELS]; |
242 | struct s2255_mode mode[MAX_CHANNELS]; | 241 | struct s2255_mode mode[MAX_CHANNELS]; |
243 | /* jpeg compression */ | 242 | /* jpeg compression */ |
244 | struct v4l2_jpegcompression jc[MAX_CHANNELS]; | 243 | struct v4l2_jpegcompression jc[MAX_CHANNELS]; |
@@ -2334,25 +2333,21 @@ static int s2255_release_sys_buffers(struct s2255_dev *dev, | |||
2334 | 2333 | ||
2335 | static int s2255_board_init(struct s2255_dev *dev) | 2334 | static int s2255_board_init(struct s2255_dev *dev) |
2336 | { | 2335 | { |
2337 | int j; | ||
2338 | struct s2255_mode mode_def = DEF_MODEI_NTSC_CONT; | 2336 | struct s2255_mode mode_def = DEF_MODEI_NTSC_CONT; |
2339 | int fw_ver; | 2337 | int fw_ver; |
2338 | int j; | ||
2339 | struct s2255_pipeinfo *pipe = &dev->pipe; | ||
2340 | dprintk(4, "board init: %p", dev); | 2340 | dprintk(4, "board init: %p", dev); |
2341 | 2341 | memset(pipe, 0, sizeof(*pipe)); | |
2342 | for (j = 0; j < MAX_PIPE_BUFFERS; j++) { | 2342 | pipe->dev = dev; |
2343 | struct s2255_pipeinfo *pipe = &dev->pipes[j]; | 2343 | pipe->cur_transfer_size = S2255_USB_XFER_SIZE; |
2344 | 2344 | pipe->max_transfer_size = S2255_USB_XFER_SIZE; | |
2345 | memset(pipe, 0, sizeof(*pipe)); | 2345 | |
2346 | pipe->dev = dev; | 2346 | pipe->transfer_buffer = kzalloc(pipe->max_transfer_size, |
2347 | pipe->cur_transfer_size = S2255_USB_XFER_SIZE; | 2347 | GFP_KERNEL); |
2348 | pipe->max_transfer_size = S2255_USB_XFER_SIZE; | 2348 | if (pipe->transfer_buffer == NULL) { |
2349 | 2349 | dprintk(1, "out of memory!\n"); | |
2350 | pipe->transfer_buffer = kzalloc(pipe->max_transfer_size, | 2350 | return -ENOMEM; |
2351 | GFP_KERNEL); | ||
2352 | if (pipe->transfer_buffer == NULL) { | ||
2353 | dprintk(1, "out of memory!\n"); | ||
2354 | return -ENOMEM; | ||
2355 | } | ||
2356 | } | 2351 | } |
2357 | /* query the firmware */ | 2352 | /* query the firmware */ |
2358 | fw_ver = s2255_get_fx2fw(dev); | 2353 | fw_ver = s2255_get_fx2fw(dev); |
@@ -2401,12 +2396,8 @@ static int s2255_board_shutdown(struct s2255_dev *dev) | |||
2401 | 2396 | ||
2402 | for (i = 0; i < MAX_CHANNELS; i++) | 2397 | for (i = 0; i < MAX_CHANNELS; i++) |
2403 | s2255_release_sys_buffers(dev, i); | 2398 | s2255_release_sys_buffers(dev, i); |
2404 | 2399 | /* release transfer buffer */ | |
2405 | /* release transfer buffers */ | 2400 | kfree(dev->pipe.transfer_buffer); |
2406 | for (i = 0; i < MAX_PIPE_BUFFERS; i++) { | ||
2407 | struct s2255_pipeinfo *pipe = &dev->pipes[i]; | ||
2408 | kfree(pipe->transfer_buffer); | ||
2409 | } | ||
2410 | return 0; | 2401 | return 0; |
2411 | } | 2402 | } |
2412 | 2403 | ||
@@ -2472,35 +2463,30 @@ static int s2255_start_readpipe(struct s2255_dev *dev) | |||
2472 | { | 2463 | { |
2473 | int pipe; | 2464 | int pipe; |
2474 | int retval; | 2465 | int retval; |
2475 | int i; | 2466 | struct s2255_pipeinfo *pipe_info = &dev->pipe; |
2476 | struct s2255_pipeinfo *pipe_info = dev->pipes; | ||
2477 | pipe = usb_rcvbulkpipe(dev->udev, dev->read_endpoint); | 2467 | pipe = usb_rcvbulkpipe(dev->udev, dev->read_endpoint); |
2478 | dprintk(2, "start pipe IN %d\n", dev->read_endpoint); | 2468 | dprintk(2, "start pipe IN %d\n", dev->read_endpoint); |
2479 | 2469 | pipe_info->state = 1; | |
2480 | for (i = 0; i < MAX_PIPE_BUFFERS; i++) { | 2470 | pipe_info->err_count = 0; |
2481 | pipe_info->state = 1; | 2471 | pipe_info->stream_urb = usb_alloc_urb(0, GFP_KERNEL); |
2482 | pipe_info->err_count = 0; | 2472 | if (!pipe_info->stream_urb) { |
2483 | pipe_info->stream_urb = usb_alloc_urb(0, GFP_KERNEL); | 2473 | dev_err(&dev->udev->dev, |
2484 | if (!pipe_info->stream_urb) { | 2474 | "ReadStream: Unable to alloc URB\n"); |
2485 | dev_err(&dev->udev->dev, | 2475 | return -ENOMEM; |
2486 | "ReadStream: Unable to alloc URB\n"); | ||
2487 | return -ENOMEM; | ||
2488 | } | ||
2489 | /* transfer buffer allocated in board_init */ | ||
2490 | usb_fill_bulk_urb(pipe_info->stream_urb, dev->udev, | ||
2491 | pipe, | ||
2492 | pipe_info->transfer_buffer, | ||
2493 | pipe_info->cur_transfer_size, | ||
2494 | read_pipe_completion, pipe_info); | ||
2495 | |||
2496 | dprintk(4, "submitting URB %p\n", pipe_info->stream_urb); | ||
2497 | retval = usb_submit_urb(pipe_info->stream_urb, GFP_KERNEL); | ||
2498 | if (retval) { | ||
2499 | printk(KERN_ERR "s2255: start read pipe failed\n"); | ||
2500 | return retval; | ||
2501 | } | ||
2502 | } | 2476 | } |
2477 | /* transfer buffer allocated in board_init */ | ||
2478 | usb_fill_bulk_urb(pipe_info->stream_urb, dev->udev, | ||
2479 | pipe, | ||
2480 | pipe_info->transfer_buffer, | ||
2481 | pipe_info->cur_transfer_size, | ||
2482 | read_pipe_completion, pipe_info); | ||
2503 | 2483 | ||
2484 | dprintk(4, "submitting URB %p\n", pipe_info->stream_urb); | ||
2485 | retval = usb_submit_urb(pipe_info->stream_urb, GFP_KERNEL); | ||
2486 | if (retval) { | ||
2487 | printk(KERN_ERR "s2255: start read pipe failed\n"); | ||
2488 | return retval; | ||
2489 | } | ||
2504 | return 0; | 2490 | return 0; |
2505 | } | 2491 | } |
2506 | 2492 | ||
@@ -2581,30 +2567,19 @@ static int s2255_stop_acquire(struct s2255_dev *dev, unsigned long chn) | |||
2581 | 2567 | ||
2582 | static void s2255_stop_readpipe(struct s2255_dev *dev) | 2568 | static void s2255_stop_readpipe(struct s2255_dev *dev) |
2583 | { | 2569 | { |
2584 | int j; | 2570 | struct s2255_pipeinfo *pipe = &dev->pipe; |
2585 | if (dev == NULL) { | 2571 | if (dev == NULL) { |
2586 | s2255_dev_err(&dev->udev->dev, "invalid device\n"); | 2572 | s2255_dev_err(&dev->udev->dev, "invalid device\n"); |
2587 | return; | 2573 | return; |
2588 | } | 2574 | } |
2589 | dprintk(4, "stop read pipe\n"); | 2575 | pipe->state = 0; |
2590 | for (j = 0; j < MAX_PIPE_BUFFERS; j++) { | 2576 | if (pipe->stream_urb) { |
2591 | struct s2255_pipeinfo *pipe_info = &dev->pipes[j]; | 2577 | /* cancel urb */ |
2592 | if (pipe_info) { | 2578 | usb_kill_urb(pipe->stream_urb); |
2593 | if (pipe_info->state == 0) | 2579 | usb_free_urb(pipe->stream_urb); |
2594 | continue; | 2580 | pipe->stream_urb = NULL; |
2595 | pipe_info->state = 0; | ||
2596 | } | ||
2597 | } | ||
2598 | for (j = 0; j < MAX_PIPE_BUFFERS; j++) { | ||
2599 | struct s2255_pipeinfo *pipe_info = &dev->pipes[j]; | ||
2600 | if (pipe_info->stream_urb) { | ||
2601 | /* cancel urb */ | ||
2602 | usb_kill_urb(pipe_info->stream_urb); | ||
2603 | usb_free_urb(pipe_info->stream_urb); | ||
2604 | pipe_info->stream_urb = NULL; | ||
2605 | } | ||
2606 | } | 2581 | } |
2607 | dprintk(2, "s2255 stop read pipe: %d\n", j); | 2582 | dprintk(4, "%s", __func__); |
2608 | return; | 2583 | return; |
2609 | } | 2584 | } |
2610 | 2585 | ||