V4L/DVB (7856): cx18/: possible cleanups
authorAdrian Bunk <bunk@kernel.org>
Mon, 5 May 2008 21:25:22 +0000 (18:25 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 14 May 2008 05:54:09 +0000 (02:54 -0300)
This patch contains the following possible cleanups:
- cx18-i2c.c should #include "cx18-i2c.h" for getting the prototypes of
  it's global functions
- make the following needlessly global functions static:
  - cx18-fileops.c:cx18_claim_stream()
  - cx18-fileops.c:cx18_release_stream()
  - cx18-queue.c:cx18_queue_move()
- remove the following unused functions:
  - cx18-driver.c:cx18_waitq()
  - cx18-queue.c:cx18_buf_copy_from_user()

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/cx18/cx18-driver.c
drivers/media/video/cx18/cx18-driver.h
drivers/media/video/cx18/cx18-fileops.c
drivers/media/video/cx18/cx18-fileops.h
drivers/media/video/cx18/cx18-i2c.c
drivers/media/video/cx18/cx18-queue.c
drivers/media/video/cx18/cx18-queue.h

index 9453223a3dea1997bd1beeda1f980bbea4a9db54..3e9979eff3e05d8f868870aecdb60bc6c7e77b5e 100644 (file)
@@ -164,16 +164,6 @@ MODULE_LICENSE("GPL");
 
 MODULE_VERSION(CX18_VERSION);
 
-int cx18_waitq(wait_queue_head_t *waitq)
-{
-       DEFINE_WAIT(wait);
-
-       prepare_to_wait(waitq, &wait, TASK_INTERRUPTIBLE);
-       schedule();
-       finish_wait(waitq, &wait);
-       return signal_pending(current) ? -EINTR : 0;
-}
-
 /* Generic utility functions */
 int cx18_msleep_timeout(unsigned int msecs, int intr)
 {
index 2ee939193bb7361783c23e3c7bb4e3cfa2f9ccec..a2a6c58d12fe55ffcb3b1d7be1aebb85603d62b1 100644 (file)
@@ -444,9 +444,6 @@ extern spinlock_t cx18_cards_lock;
 /* Return non-zero if a signal is pending */
 int cx18_msleep_timeout(unsigned int msecs, int intr);
 
-/* Wait on queue, returns -EINTR if interrupted */
-int cx18_waitq(wait_queue_head_t *waitq);
-
 /* Read Hauppauge eeprom */
 struct tveeprom; /* forward reference */
 void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv);
index 69303065a2948f45b8f4ff01195a098d73250a9a..91eff6e671a77d037f99ef229a097c6a2db35fc4 100644 (file)
@@ -39,7 +39,7 @@
    associated VBI streams are also automatically claimed.
    Possible error returns: -EBUSY if someone else has claimed
    the stream or 0 on success. */
-int cx18_claim_stream(struct cx18_open_id *id, int type)
+static int cx18_claim_stream(struct cx18_open_id *id, int type)
 {
        struct cx18 *cx = id->cx;
        struct cx18_stream *s = &cx->streams[type];
@@ -87,7 +87,7 @@ int cx18_claim_stream(struct cx18_open_id *id, int type)
 
 /* This function releases a previously claimed stream. It will take into
    account associated VBI streams. */
-void cx18_release_stream(struct cx18_stream *s)
+static void cx18_release_stream(struct cx18_stream *s)
 {
        struct cx18 *cx = s->cx;
        struct cx18_stream *s_vbi;
index 16cdafbd24c5c137016c12965fdfad3f94835dfb..46da0282fc7d71bf9b1c324226989e29229c665e 100644 (file)
@@ -34,12 +34,3 @@ void cx18_stop_capture(struct cx18_open_id *id, int gop_end);
 void cx18_mute(struct cx18 *cx);
 void cx18_unmute(struct cx18 *cx);
 
-/* Utilities */
-
-/* Try to claim a stream for the filehandle. Return 0 on success,
-   -EBUSY if stream already claimed. Once a stream is claimed, it
-   remains claimed until the associated filehandle is closed. */
-int cx18_claim_stream(struct cx18_open_id *id, int type);
-
-/* Release a previously claimed stream. */
-void cx18_release_stream(struct cx18_stream *s);
index 18c88d1e4833840e3eb83763550c544cfcecaa46..4f08a4058d1a44cfe1ad575118a242c421c5dd2d 100644 (file)
@@ -25,6 +25,7 @@
 #include "cx18-cards.h"
 #include "cx18-gpio.h"
 #include "cx18-av-core.h"
+#include "cx18-i2c.h"
 
 #include <media/ir-kbd-i2c.h>
 
index 4ef6996b204806234730b3455eadfe3961dcc2f5..6990b77c6200ab57ab29bb1a2962a67930ff1392 100644 (file)
 #include "cx18-queue.h"
 #include "cx18-scb.h"
 
-int cx18_buf_copy_from_user(struct cx18_stream *s, struct cx18_buffer *buf,
-               const char __user *src, int copybytes)
-{
-       if (s->buf_size - buf->bytesused < copybytes)
-               copybytes = s->buf_size - buf->bytesused;
-       if (copy_from_user(buf->buf + buf->bytesused, src, copybytes))
-               return -EFAULT;
-       buf->bytesused += copybytes;
-       return copybytes;
-}
-
 void cx18_buf_swap(struct cx18_buffer *buf)
 {
        int i;
@@ -159,8 +148,9 @@ static void cx18_queue_move_buf(struct cx18_stream *s, struct cx18_queue *from,
    -ENOMEM is returned if the buffers could not be obtained, 0 if all
    buffers where obtained from the 'from' list and if non-zero then
    the number of stolen buffers is returned. */
-int cx18_queue_move(struct cx18_stream *s, struct cx18_queue *from,
-       struct cx18_queue *steal, struct cx18_queue *to, int needed_bytes)
+static int cx18_queue_move(struct cx18_stream *s, struct cx18_queue *from,
+                          struct cx18_queue *steal, struct cx18_queue *to,
+                          int needed_bytes)
 {
        unsigned long flags;
        int rc = 0;
index f86c8a6fa6e7690bec9552f8fd4f560d96d75fe0..91423b9863a43a402d6fe7c6efe5b347d059d355 100644 (file)
@@ -39,8 +39,6 @@ static inline void cx18_buf_sync_for_device(struct cx18_stream *s,
                                s->buf_size, s->dma);
 }
 
-int cx18_buf_copy_from_user(struct cx18_stream *s, struct cx18_buffer *buf,
-       const char __user *src, int copybytes);
 void cx18_buf_swap(struct cx18_buffer *buf);
 
 /* cx18_queue utility functions */
@@ -48,8 +46,6 @@ void cx18_queue_init(struct cx18_queue *q);
 void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf,
        struct cx18_queue *q);
 struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q);
-int cx18_queue_move(struct cx18_stream *s, struct cx18_queue *from,
-       struct cx18_queue *steal, struct cx18_queue *to, int needed_bytes);
 struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id,
        u32 bytesused);
 void cx18_flush_queues(struct cx18_stream *s);