ChangeSet 1.1843.4.21, 2004/08/24 15:58:54-07:00, [EMAIL PROTECTED]
USB: rip the pwc decompressor hooks out of the kernel, as they are a GPL violation.
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
drivers/usb/media/pwc-uncompress.c | 180 -------------------------------------
drivers/usb/media/pwc-uncompress.h | 84 -----------------
drivers/usb/media/Makefile | 2
drivers/usb/media/pwc-ctrl.c | 9 -
drivers/usb/media/pwc-if.c | 35 -------
drivers/usb/media/pwc.h | 6 -
6 files changed, 2 insertions(+), 314 deletions(-)
diff -Nru a/drivers/usb/media/Makefile b/drivers/usb/media/Makefile
--- a/drivers/usb/media/Makefile 2004-08-26 16:41:50 -07:00
+++ b/drivers/usb/media/Makefile 2004-08-26 16:41:50 -07:00
@@ -2,7 +2,7 @@
# Makefile for USB Media drivers
#
-pwc-objs := pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o
+pwc-objs := pwc-if.o pwc-misc.o pwc-ctrl.o
sn9c102-objs := sn9c102_core.o sn9c102_pas106b.o sn9c102_tas5110c1b.o
sn9c102_tas5130d1b.o sn9c102_pas202bcb.o
obj-$(CONFIG_USB_DABUSB) += dabusb.o
diff -Nru a/drivers/usb/media/pwc-ctrl.c b/drivers/usb/media/pwc-ctrl.c
--- a/drivers/usb/media/pwc-ctrl.c 2004-08-26 16:41:50 -07:00
+++ b/drivers/usb/media/pwc-ctrl.c 2004-08-26 16:41:50 -07:00
@@ -34,7 +34,6 @@
#include "pwc.h"
#include "pwc-ioctl.h"
-#include "pwc-uncompress.h"
/* Request types: video */
#define SET_LUM_CTL 0x01
@@ -268,8 +267,6 @@
Debug("Failed to send video command... %d\n", ret);
return ret;
}
- if (pEntry->compressed && pdev->decompressor != 0 && pdev->vpalette !=
VIDEO_PALETTE_RAW)
- pdev->decompressor->init(pdev->type, pdev->release, buf,
pdev->decompress_data);
pdev->cmd_len = 3;
memcpy(pdev->cmd_buf, buf, 3);
@@ -336,9 +333,6 @@
if (ret < 0)
return ret;
- if (pChoose->bandlength > 0 && pdev->decompressor != 0 && pdev->vpalette !=
VIDEO_PALETTE_RAW)
- pdev->decompressor->init(pdev->type, pdev->release, buf,
pdev->decompress_data);
-
pdev->cmd_len = 13;
memcpy(pdev->cmd_buf, buf, 13);
@@ -420,9 +414,6 @@
ret = send_video_command(pdev->udev, 4 /* pdev->vendpoint */, buf, 12);
if (ret < 0)
return ret;
-
- if (pChoose->bandlength > 0 && pdev->decompressor != 0 && pdev->vpalette !=
VIDEO_PALETTE_RAW)
- pdev->decompressor->init(pdev->type, pdev->release, buf,
pdev->decompress_data);
pdev->cmd_len = 12;
memcpy(pdev->cmd_buf, buf, 12);
diff -Nru a/drivers/usb/media/pwc-if.c b/drivers/usb/media/pwc-if.c
--- a/drivers/usb/media/pwc-if.c 2004-08-26 16:41:50 -07:00
+++ b/drivers/usb/media/pwc-if.c 2004-08-26 16:41:50 -07:00
@@ -59,7 +59,6 @@
#include "pwc.h"
#include "pwc-ioctl.h"
-#include "pwc-uncompress.h"
/* Function prototypes and driver templates */
@@ -302,14 +301,6 @@
/* Allocate decompressor table space */
kbuf = NULL;
- if (pdev->decompressor != NULL) {
- kbuf = kmalloc(pdev->decompressor->table_size, GFP_KERNEL);
- if (kbuf == NULL) {
- Err("Failed to allocate decompress table.\n");
- return -ENOMEM;
- }
- Trace(TRACE_MEMORY, "Allocated decompress table %p.\n", kbuf);
- }
pdev->decompress_data = kbuf;
/* Allocate image buffer; double buffer for mmap() */
@@ -550,14 +541,6 @@
#if PWC_DEBUG
Trace(TRACE_SEQUENCE, "Decompressing frame %d\n",
pdev->read_frame->sequence);
#endif
- /* Decompression is a lenghty process, so it's outside of the
lock.
- This gives the isoc_handler the opportunity to fill more
frames
- in the mean time.
- */
- spin_unlock_irqrestore(&pdev->ptrlock, flags);
- ret = pwc_decompress(pdev);
- spin_lock_irqsave(&pdev->ptrlock, flags);
-
/* We're done with read_buffer, tack it to the end of the
empty buffer list */
if (pdev->empty_frames == NULL) {
pdev->empty_frames = pdev->read_frame;
@@ -1014,11 +997,7 @@
if (pwc_set_leds(pdev, led_on, led_off) < 0)
Info("Failed to set LED on/off time.\n");
- /* Find our decompressor, if any */
- pdev->decompressor = pwc_find_decompressor(pdev->type);
-#if PWC_DEBUG
- Debug("Found decompressor for %d at 0x%p\n", pdev->type, pdev->decompressor);
-#endif
+ pdev->decompressor = NULL;
pwc_construct(pdev); /* set min/max sizes correct */
/* So far, so good. Allocate memory. */
@@ -1073,12 +1052,6 @@
pdev->vopen++;
file->private_data = vdev;
- /* lock decompressor; this has a small race condition, since we
- could in theory unload pwcx.o between pwc_find_decompressor()
- above and this call. I doubt it's ever going to be a problem.
- */
- if (pdev->decompressor != NULL)
- pdev->decompressor->lock();
up(&pdev->modlock);
Trace(TRACE_OPEN, "<< video_open() returns 0.\n");
return 0;
@@ -1103,12 +1076,6 @@
*/
if (pdev->vframe_count > 20)
Info("Closing video device: %d frames received, dumped %d frames, %d
frames with errors.\n", pdev->vframe_count, pdev->vframes_dumped, pdev->vframes_error);
-
- if (pdev->decompressor != NULL) {
- pdev->decompressor->exit();
- pdev->decompressor->unlock();
- pdev->decompressor = NULL;
- }
pwc_isoc_cleanup(pdev);
pwc_free_buffers(pdev);
diff -Nru a/drivers/usb/media/pwc-uncompress.c b/drivers/usb/media/pwc-uncompress.c
--- a/drivers/usb/media/pwc-uncompress.c 2004-08-26 16:41:50 -07:00
+++ /dev/null Wed Dec 31 16:00:00 196900
@@ -1,180 +0,0 @@
-/* Linux driver for Philips webcam
- Decompression frontend.
- (C) 1999-2003 Nemosoft Unv. ([EMAIL PROTECTED])
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-/*
- This is where the decompression routines register and unregister
- themselves. It also has a decompressor wrapper function.
-*/
-
-#include <asm/current.h>
-#include <asm/types.h>
-// #include <linux/sched.h>
-
-#include "pwc.h"
-#include "pwc-uncompress.h"
-
-
-/* This contains a list of all registered decompressors */
-static LIST_HEAD(pwc_decompressor_list);
-
-/* Should the pwc_decompress structure ever change, we increase the
- version number so that we don't get nasty surprises, or can
- dynamically adjust our structure.
- */
-const int pwc_decompressor_version = PWC_MAJOR;
-
-/* Add decompressor to list, ignoring duplicates */
-void pwc_register_decompressor(struct pwc_decompressor *pwcd)
-{
- if (pwc_find_decompressor(pwcd->type) == NULL) {
- Trace(TRACE_PWCX, "Adding decompressor for model %d.\n", pwcd->type);
- list_add_tail(&pwcd->pwcd_list, &pwc_decompressor_list);
- }
-}
-
-/* Remove decompressor from list */
-void pwc_unregister_decompressor(int type)
-{
- struct pwc_decompressor *find;
-
- find = pwc_find_decompressor(type);
- if (find != NULL) {
- Trace(TRACE_PWCX, "Removing decompressor for model %d.\n", type);
- list_del(&find->pwcd_list);
- }
-}
-
-/* Find decompressor in list */
-struct pwc_decompressor *pwc_find_decompressor(int type)
-{
- struct list_head *tmp;
- struct pwc_decompressor *pwcd;
-
- list_for_each(tmp, &pwc_decompressor_list) {
- pwcd = list_entry(tmp, struct pwc_decompressor, pwcd_list);
- if (pwcd->type == type)
- return pwcd;
- }
- return NULL;
-}
-
-
-
-int pwc_decompress(struct pwc_device *pdev)
-{
- struct pwc_frame_buf *fbuf;
- int n, line, col, stride;
- void *yuv, *image;
- u16 *src;
- u16 *dsty, *dstu, *dstv;
-
- if (pdev == NULL)
- return -EFAULT;
-#if defined(__KERNEL__) && defined(PWC_MAGIC)
- if (pdev->magic != PWC_MAGIC) {
- Err("pwc_decompress(): magic failed.\n");
- return -EFAULT;
- }
-#endif
-
- fbuf = pdev->read_frame;
- if (fbuf == NULL)
- return -EFAULT;
- image = pdev->image_ptr[pdev->fill_image];
- if (!image)
- return -EFAULT;
-
- yuv = fbuf->data + pdev->frame_header_size; /* Skip header */
-
- /* Raw format; that's easy... */
- if (pdev->vpalette == VIDEO_PALETTE_RAW)
- {
- memcpy(image, yuv, pdev->frame_size);
- return 0;
- }
-
- if (pdev->vbandlength == 0) {
- /* Uncompressed mode. We copy the data into the output buffer,
- using the viewport size (which may be larger than the image
- size). Unfortunately we have to do a bit of byte stuffing
- to get the desired output format/size.
- */
- /*
- * We do some byte shuffling here to go from the
- * native format to YUV420P.
- */
- src = (u16 *)yuv;
- n = pdev->view.x * pdev->view.y;
-
- /* offset in Y plane */
- stride = pdev->view.x * pdev->offset.y + pdev->offset.x;
- dsty = (u16 *)(image + stride);
-
- /* offsets in U/V planes */
- stride = pdev->view.x * pdev->offset.y / 4 + pdev->offset.x /
2;
- dstu = (u16 *)(image + n + stride);
- dstv = (u16 *)(image + n + n / 4 + stride);
-
- /* increment after each line */
- stride = (pdev->view.x - pdev->image.x) / 2; /* u16 is 2 bytes
*/
-
- for (line = 0; line < pdev->image.y; line++) {
- for (col = 0; col < pdev->image.x; col += 4) {
- *dsty++ = *src++;
- *dsty++ = *src++;
- if (line & 1)
- *dstv++ = *src++;
- else
- *dstu++ = *src++;
- }
- dsty += stride;
- if (line & 1)
- dstv += (stride >> 1);
- else
- dstu += (stride >> 1);
- }
- }
- else {
- /* Compressed; the decompressor routines will write the data
- in planar format immediately.
- */
- int flags;
-
- flags = PWCX_FLAG_PLANAR;
- if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot)
- flags |= PWCX_FLAG_BAYER;
-
- if (pdev->decompressor)
- pdev->decompressor->decompress(
- &pdev->image, &pdev->view, &pdev->offset,
- yuv, image,
- flags,
- pdev->decompress_data, pdev->vbandlength);
- else
- return -ENXIO; /* No such device or address: missing
decompressor */
- }
- return 0;
-}
-
-/* Make sure these functions are available for the decompressor plugin
- both when this code is compiled into the kernel or as as module.
- */
-
-EXPORT_SYMBOL_NOVERS(pwc_decompressor_version);
-EXPORT_SYMBOL(pwc_register_decompressor);
-EXPORT_SYMBOL(pwc_unregister_decompressor);
diff -Nru a/drivers/usb/media/pwc-uncompress.h b/drivers/usb/media/pwc-uncompress.h
--- a/drivers/usb/media/pwc-uncompress.h 2004-08-26 16:41:50 -07:00
+++ /dev/null Wed Dec 31 16:00:00 196900
@@ -1,84 +0,0 @@
-/* (C) 1999-2003 Nemosoft Unv. ([EMAIL PROTECTED])
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-/* This file is the bridge between the kernel module and the plugin; it
- describes the structures and datatypes used in both modules. Any
- significant change should be reflected by increasing the
- pwc_decompressor_version major number.
- */
-#ifndef PWC_UNCOMPRESS_H
-#define PWC_UNCOMPRESS_H
-
-#include <linux/config.h>
-#include <linux/linkage.h>
-#include <linux/list.h>
-
-#include "pwc-ioctl.h"
-
-/* from pwc-dec.h */
-#define PWCX_FLAG_PLANAR 0x0001
-/* */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The decompressor structure.
- Every type of decompressor registers itself with the main module.
- When a device is opened, it looks up the correct compressor, and
- uses that when a compressed video mode is requested.
- */
-struct pwc_decompressor
-{
- int type; /* type of camera (645, 680, etc) */
- int table_size; /* memory needed */
-
- void (* init)(int type, int release, void *buffer, void *table); /*
Initialization routine; should be called after each set_video_mode */
- void (* exit)(void); /* Cleanup routine */
- void (* decompress)(struct pwc_coord *image, struct pwc_coord *view,
- struct pwc_coord *offset,
- void *src, void *dst, int flags,
- void *table, int bandlength);
- void (* lock)(void); /* make sure module cannot be unloaded */
- void (* unlock)(void); /* release lock on module */
-
- struct list_head pwcd_list;
-};
-
-
-/* Our structure version number. Is set to the version number major */
-extern const int pwc_decompressor_version;
-
-/* Adds decompressor to list, based on its 'type' field (which matches the 'type'
field in pwc_device; ignores any double requests */
-extern void pwc_register_decompressor(struct pwc_decompressor *pwcd);
-/* Removes decompressor, based on the type number */
-extern void pwc_unregister_decompressor(int type);
-/* Returns pointer to decompressor struct, or NULL if it doesn't exist */
-extern struct pwc_decompressor *pwc_find_decompressor(int type);
-
-#ifdef CONFIG_USB_PWCX
-/* If the decompressor is compiled in, we must call these manually */
-extern int usb_pwcx_init(void);
-extern void usb_pwcx_exit(void);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff -Nru a/drivers/usb/media/pwc.h b/drivers/usb/media/pwc.h
--- a/drivers/usb/media/pwc.h 2004-08-26 16:41:50 -07:00
+++ b/drivers/usb/media/pwc.h 2004-08-26 16:41:50 -07:00
@@ -30,7 +30,6 @@
#include <asm/semaphore.h>
#include <asm/errno.h>
-#include "pwc-uncompress.h"
#include "pwc-ioctl.h"
/* Defines and structures for the Philips webcam */
@@ -257,11 +256,6 @@
/* Private ioctl()s; see pwc-ioctl.h */
extern int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg);
-
-
-/** pwc-uncompress.c */
-/* Expand frame to image, possibly including decompression. Uses read_frame and
fill_image */
-extern int pwc_decompress(struct pwc_device *pdev);
#ifdef __cplusplus
}
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel