diff options
author | Adrian Bunk <bunk@stusta.de> | 2006-01-08 18:43:39 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-31 20:23:42 -0500 |
commit | 7f2c01ab8ad50c74d174acdd814ddb53383bee93 (patch) | |
tree | 0cad74779f6e8deff6508372e5a83ceddc9f81a8 /drivers/usb | |
parent | bf8b2b5345145d41d39035b80f36c8e17342d833 (diff) |
[PATCH] USB: drivers/usb/media/w9968cf.c: remove hooks for the vpp module
- the w9968cf-vpp module is not intended for inclusion into the kernel
- the upstream w9968cf package shipping the w9968cf-vpp module suggests
to simply replace the w9968cf module shipped with the kernel
Therefore, there seems to be no good reason spending some bytes of
kernel memory for hooks for the w9968cf-vpp module.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Luca Risolia <luca.risolia@studio.unibo.it>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/media/w9968cf.c | 128 | ||||
-rw-r--r-- | drivers/usb/media/w9968cf.h | 1 | ||||
-rw-r--r-- | drivers/usb/media/w9968cf_vpp.h | 3 |
3 files changed, 1 insertions, 131 deletions
diff --git a/drivers/usb/media/w9968cf.c b/drivers/usb/media/w9968cf.c index bff9434c8e55..9937fc64c8bf 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/usb/media/w9968cf.c | |||
@@ -62,7 +62,6 @@ MODULE_LICENSE(W9968CF_MODULE_LICENSE); | |||
62 | MODULE_SUPPORTED_DEVICE("Video"); | 62 | MODULE_SUPPORTED_DEVICE("Video"); |
63 | 63 | ||
64 | static int ovmod_load = W9968CF_OVMOD_LOAD; | 64 | static int ovmod_load = W9968CF_OVMOD_LOAD; |
65 | static int vppmod_load = W9968CF_VPPMOD_LOAD; | ||
66 | static unsigned short simcams = W9968CF_SIMCAMS; | 65 | static unsigned short simcams = W9968CF_SIMCAMS; |
67 | static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ | 66 | static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ |
68 | static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 67 | static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
@@ -107,7 +106,6 @@ static unsigned int param_nv[24]; /* number of values per parameter */ | |||
107 | 106 | ||
108 | #ifdef CONFIG_KMOD | 107 | #ifdef CONFIG_KMOD |
109 | module_param(ovmod_load, bool, 0644); | 108 | module_param(ovmod_load, bool, 0644); |
110 | module_param(vppmod_load, bool, 0444); | ||
111 | #endif | 109 | #endif |
112 | module_param(simcams, ushort, 0644); | 110 | module_param(simcams, ushort, 0644); |
113 | module_param_array(video_nr, short, ¶m_nv[0], 0444); | 111 | module_param_array(video_nr, short, ¶m_nv[0], 0444); |
@@ -150,18 +148,6 @@ MODULE_PARM_DESC(ovmod_load, | |||
150 | "\ninto memory." | 148 | "\ninto memory." |
151 | "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"." | 149 | "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"." |
152 | "\n"); | 150 | "\n"); |
153 | MODULE_PARM_DESC(vppmod_load, | ||
154 | "\n<0|1> Automatic 'w9968cf-vpp' module loading." | ||
155 | "\n0 disabled, 1 enabled." | ||
156 | "\nIf enabled, every time an application attempts to open a" | ||
157 | "\ncamera, 'insmod' searches for the video post-processing" | ||
158 | "\nmodule in the system and loads it automatically (if" | ||
159 | "\npresent). The optional 'w9968cf-vpp' module adds extra" | ||
160 | "\n image manipulation functions to the 'w9968cf' module,like" | ||
161 | "\nsoftware up-scaling,colour conversions and video decoding" | ||
162 | "\nfor very high frame rates." | ||
163 | "\nDefault value is "__MODULE_STRING(W9968CF_VPPMOD_LOAD)"." | ||
164 | "\n"); | ||
165 | #endif | 151 | #endif |
166 | MODULE_PARM_DESC(simcams, | 152 | MODULE_PARM_DESC(simcams, |
167 | "\n<n> Number of cameras allowed to stream simultaneously." | 153 | "\n<n> Number of cameras allowed to stream simultaneously." |
@@ -492,10 +478,6 @@ static void w9968cf_push_frame(struct w9968cf_device*, u8 f_num); | |||
492 | static void w9968cf_pop_frame(struct w9968cf_device*,struct w9968cf_frame_t**); | 478 | static void w9968cf_pop_frame(struct w9968cf_device*,struct w9968cf_frame_t**); |
493 | static void w9968cf_release_resources(struct w9968cf_device*); | 479 | static void w9968cf_release_resources(struct w9968cf_device*); |
494 | 480 | ||
495 | /* Intermodule communication */ | ||
496 | static int w9968cf_vppmod_detect(struct w9968cf_device*); | ||
497 | static void w9968cf_vppmod_release(struct w9968cf_device*); | ||
498 | |||
499 | 481 | ||
500 | 482 | ||
501 | /**************************************************************************** | 483 | /**************************************************************************** |
@@ -2737,9 +2719,7 @@ static int w9968cf_open(struct inode* inode, struct file* filp) | |||
2737 | cam->streaming = 0; | 2719 | cam->streaming = 0; |
2738 | cam->misconfigured = 0; | 2720 | cam->misconfigured = 0; |
2739 | 2721 | ||
2740 | if (!w9968cf_vpp) | 2722 | w9968cf_adjust_configuration(cam); |
2741 | if ((err = w9968cf_vppmod_detect(cam))) | ||
2742 | goto out; | ||
2743 | 2723 | ||
2744 | if ((err = w9968cf_allocate_memory(cam))) | 2724 | if ((err = w9968cf_allocate_memory(cam))) |
2745 | goto deallocate_memory; | 2725 | goto deallocate_memory; |
@@ -2766,7 +2746,6 @@ static int w9968cf_open(struct inode* inode, struct file* filp) | |||
2766 | 2746 | ||
2767 | deallocate_memory: | 2747 | deallocate_memory: |
2768 | w9968cf_deallocate_memory(cam); | 2748 | w9968cf_deallocate_memory(cam); |
2769 | out: | ||
2770 | DBG(2, "Failed to open the video device") | 2749 | DBG(2, "Failed to open the video device") |
2771 | up(&cam->dev_sem); | 2750 | up(&cam->dev_sem); |
2772 | up_read(&w9968cf_disconnect); | 2751 | up_read(&w9968cf_disconnect); |
@@ -2784,8 +2763,6 @@ static int w9968cf_release(struct inode* inode, struct file* filp) | |||
2784 | 2763 | ||
2785 | w9968cf_stop_transfer(cam); | 2764 | w9968cf_stop_transfer(cam); |
2786 | 2765 | ||
2787 | w9968cf_vppmod_release(cam); | ||
2788 | |||
2789 | if (cam->disconnected) { | 2766 | if (cam->disconnected) { |
2790 | w9968cf_release_resources(cam); | 2767 | w9968cf_release_resources(cam); |
2791 | up(&cam->dev_sem); | 2768 | up(&cam->dev_sem); |
@@ -3681,106 +3658,6 @@ static struct usb_driver w9968cf_usb_driver = { | |||
3681 | * Module init, exit and intermodule communication * | 3658 | * Module init, exit and intermodule communication * |
3682 | ****************************************************************************/ | 3659 | ****************************************************************************/ |
3683 | 3660 | ||
3684 | static int w9968cf_vppmod_detect(struct w9968cf_device* cam) | ||
3685 | { | ||
3686 | if (!w9968cf_vpp) | ||
3687 | if (vppmod_load) | ||
3688 | request_module("w9968cf-vpp"); | ||
3689 | |||
3690 | down(&w9968cf_vppmod_lock); | ||
3691 | |||
3692 | if (!w9968cf_vpp) { | ||
3693 | DBG(4, "Video post-processing module not detected") | ||
3694 | w9968cf_adjust_configuration(cam); | ||
3695 | goto out; | ||
3696 | } | ||
3697 | |||
3698 | if (!try_module_get(w9968cf_vpp->owner)) { | ||
3699 | DBG(1, "Couldn't increment the reference count of " | ||
3700 | "the video post-processing module") | ||
3701 | up(&w9968cf_vppmod_lock); | ||
3702 | return -ENOSYS; | ||
3703 | } | ||
3704 | |||
3705 | w9968cf_vpp->busy++; | ||
3706 | |||
3707 | DBG(5, "Video post-processing module detected") | ||
3708 | |||
3709 | out: | ||
3710 | up(&w9968cf_vppmod_lock); | ||
3711 | return 0; | ||
3712 | } | ||
3713 | |||
3714 | |||
3715 | static void w9968cf_vppmod_release(struct w9968cf_device* cam) | ||
3716 | { | ||
3717 | down(&w9968cf_vppmod_lock); | ||
3718 | |||
3719 | if (w9968cf_vpp && w9968cf_vpp->busy) { | ||
3720 | module_put(w9968cf_vpp->owner); | ||
3721 | w9968cf_vpp->busy--; | ||
3722 | wake_up(&w9968cf_vppmod_wait); | ||
3723 | DBG(5, "Video post-processing module released") | ||
3724 | } | ||
3725 | |||
3726 | up(&w9968cf_vppmod_lock); | ||
3727 | } | ||
3728 | |||
3729 | |||
3730 | int w9968cf_vppmod_register(struct w9968cf_vpp_t* vpp) | ||
3731 | { | ||
3732 | down(&w9968cf_vppmod_lock); | ||
3733 | |||
3734 | if (w9968cf_vpp) { | ||
3735 | KDBG(1, "Video post-processing module already registered") | ||
3736 | up(&w9968cf_vppmod_lock); | ||
3737 | return -EINVAL; | ||
3738 | } | ||
3739 | |||
3740 | w9968cf_vpp = vpp; | ||
3741 | w9968cf_vpp->busy = 0; | ||
3742 | |||
3743 | KDBG(2, "Video post-processing module registered") | ||
3744 | up(&w9968cf_vppmod_lock); | ||
3745 | return 0; | ||
3746 | } | ||
3747 | |||
3748 | |||
3749 | int w9968cf_vppmod_deregister(struct w9968cf_vpp_t* vpp) | ||
3750 | { | ||
3751 | down(&w9968cf_vppmod_lock); | ||
3752 | |||
3753 | if (!w9968cf_vpp) { | ||
3754 | up(&w9968cf_vppmod_lock); | ||
3755 | return -EINVAL; | ||
3756 | } | ||
3757 | |||
3758 | if (w9968cf_vpp != vpp) { | ||
3759 | KDBG(1, "Only the owner can unregister the video " | ||
3760 | "post-processing module") | ||
3761 | up(&w9968cf_vppmod_lock); | ||
3762 | return -EINVAL; | ||
3763 | } | ||
3764 | |||
3765 | if (w9968cf_vpp->busy) { | ||
3766 | KDBG(2, "Video post-processing module busy. Wait for it to be " | ||
3767 | "released...") | ||
3768 | up(&w9968cf_vppmod_lock); | ||
3769 | wait_event(w9968cf_vppmod_wait, !w9968cf_vpp->busy); | ||
3770 | w9968cf_vpp = NULL; | ||
3771 | goto out; | ||
3772 | } | ||
3773 | |||
3774 | w9968cf_vpp = NULL; | ||
3775 | |||
3776 | up(&w9968cf_vppmod_lock); | ||
3777 | |||
3778 | out: | ||
3779 | KDBG(2, "Video post-processing module unregistered") | ||
3780 | return 0; | ||
3781 | } | ||
3782 | |||
3783 | |||
3784 | static int __init w9968cf_module_init(void) | 3661 | static int __init w9968cf_module_init(void) |
3785 | { | 3662 | { |
3786 | int err; | 3663 | int err; |
@@ -3810,6 +3687,3 @@ static void __exit w9968cf_module_exit(void) | |||
3810 | module_init(w9968cf_module_init); | 3687 | module_init(w9968cf_module_init); |
3811 | module_exit(w9968cf_module_exit); | 3688 | module_exit(w9968cf_module_exit); |
3812 | 3689 | ||
3813 | |||
3814 | EXPORT_SYMBOL(w9968cf_vppmod_register); | ||
3815 | EXPORT_SYMBOL(w9968cf_vppmod_deregister); | ||
diff --git a/drivers/usb/media/w9968cf.h b/drivers/usb/media/w9968cf.h index 8acbfe205bc7..47a6ff794171 100644 --- a/drivers/usb/media/w9968cf.h +++ b/drivers/usb/media/w9968cf.h | |||
@@ -195,7 +195,6 @@ enum w9968cf_vpp_flag { | |||
195 | }; | 195 | }; |
196 | 196 | ||
197 | static struct w9968cf_vpp_t* w9968cf_vpp; | 197 | static struct w9968cf_vpp_t* w9968cf_vpp; |
198 | static DECLARE_MUTEX(w9968cf_vppmod_lock); | ||
199 | static DECLARE_WAIT_QUEUE_HEAD(w9968cf_vppmod_wait); | 198 | static DECLARE_WAIT_QUEUE_HEAD(w9968cf_vppmod_wait); |
200 | 199 | ||
201 | static LIST_HEAD(w9968cf_dev_list); /* head of V4L registered cameras list */ | 200 | static LIST_HEAD(w9968cf_dev_list); /* head of V4L registered cameras list */ |
diff --git a/drivers/usb/media/w9968cf_vpp.h b/drivers/usb/media/w9968cf_vpp.h index 3f5317dc4c29..f3b91b782671 100644 --- a/drivers/usb/media/w9968cf_vpp.h +++ b/drivers/usb/media/w9968cf_vpp.h | |||
@@ -37,7 +37,4 @@ struct w9968cf_vpp_t { | |||
37 | u8 busy; /* read-only flag: module is/is not in use */ | 37 | u8 busy; /* read-only flag: module is/is not in use */ |
38 | }; | 38 | }; |
39 | 39 | ||
40 | extern int w9968cf_vppmod_register(struct w9968cf_vpp_t*); | ||
41 | extern int w9968cf_vppmod_deregister(struct w9968cf_vpp_t*); | ||
42 | |||
43 | #endif /* _W9968CF_VPP_H_ */ | 40 | #endif /* _W9968CF_VPP_H_ */ |