diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-02-07 11:21:39 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-02-07 11:21:39 -0800 |
commit | f9df0645ee17dd8e4c2f05b3802198779c0c66e2 (patch) | |
tree | ccdeff638796aeab43755f9da6b880ca575bd51f /usb | |
parent | 433417db40e017d9eae65dede6b5b5aaadc9918e (diff) | |
download | patches-f9df0645ee17dd8e4c2f05b3802198779c0c66e2.tar.gz |
remove already applied usb patches
Diffstat (limited to 'usb')
59 files changed, 0 insertions, 13563 deletions
diff --git a/usb/add-might_sleep-to-usb_unlink_urb.patch b/usb/add-might_sleep-to-usb_unlink_urb.patch deleted file mode 100644 index 5d9c0a7f4e177..0000000000000 --- a/usb/add-might_sleep-to-usb_unlink_urb.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Greg Kroah-Hartman <gregkh@suse.de> -Subject: USB: add might_sleep() to usb_unlink_urb() to warn developers - - -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/core/urb.c | 1 + - 1 file changed, 1 insertion(+) - ---- gregkh-2.6.orig/drivers/usb/core/urb.c -+++ gregkh-2.6/drivers/usb/core/urb.c -@@ -468,6 +468,7 @@ int usb_unlink_urb(struct urb *urb) - */ - void usb_kill_urb(struct urb *urb) - { -+ might_sleep(); - if (!(urb && urb->dev && urb->dev->bus && urb->dev->bus->op)) - return; - spin_lock_irq(&urb->lock); diff --git a/usb/ftdi-two-new-atik-based-usb-astronomical-ccd-cameras.patch b/usb/ftdi-two-new-atik-based-usb-astronomical-ccd-cameras.patch deleted file mode 100644 index d7158375a03e1..0000000000000 --- a/usb/ftdi-two-new-atik-based-usb-astronomical-ccd-cameras.patch +++ /dev/null @@ -1,52 +0,0 @@ -From linux-usb-devel-admin@lists.sourceforge.net Mon Jan 9 05:18:20 2006 -Message-ID: <43C26148.5090709@grupopie.com> -From: Rui Santos <rsantos@grupopie.com> -To: Greg Kroah-Hartman <gregkh@suse.de> -Cc: Rui Tripa <rtripa@perseu.pt>, Steve Chambers <Steve@pmdo.com>, Rui Santos <rsantos@ruisantos.com> -Subject: [linux-usb-devel] [PATCH] ftdi: Two new ATIK based USB astronomical CCD cameras -Date: Mon, 09 Jan 2006 13:12:40 +0000 - -Documentation: Specify grayscale specification on ATIK-ATK16 - and ATIK-ATK16HR comments. -New: Add ProductID and VendorID for devices ATIK-ATK16C and - ATIK-ATK16HRC. These devices are also USB Astronomical CCD - cameras that work through an FTDI 245BM chip, share the - same base hardware but, it has a colour CCD chip instead - of a grayscale one. - -Signed-off-by: Rui Santos <rsantos@grupopie.com> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - - ---- - drivers/usb/serial/ftdi_sio.c | 2 ++ - drivers/usb/serial/ftdi_sio.h | 6 ++++-- - 2 files changed, 6 insertions(+), 2 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/serial/ftdi_sio.c -+++ gregkh-2.6/drivers/usb/serial/ftdi_sio.c -@@ -476,7 +476,9 @@ static struct usb_device_id id_table_com - { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, -+ { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) }, -+ { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HRC_PID) }, - { USB_DEVICE(KOBIL_VID, KOBIL_CONV_B1_PID) }, - { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, - { USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) }, ---- gregkh-2.6.orig/drivers/usb/serial/ftdi_sio.h -+++ gregkh-2.6/drivers/usb/serial/ftdi_sio.h -@@ -226,8 +226,10 @@ - * Definitions for ATIK Instruments astronomical USB based cameras - * Check it at http://www.atik-instruments.com/ - */ --#define FTDI_ATIK_ATK16_PID 0xDF30 /* ATIK ATK-16 Camera */ --#define FTDI_ATIK_ATK16HR_PID 0xDF31 /* ATIK ATK-16HR Camera */ -+#define FTDI_ATIK_ATK16_PID 0xDF30 /* ATIK ATK-16 Grayscale Camera */ -+#define FTDI_ATIK_ATK16C_PID 0xDF32 /* ATIK ATK-16C Colour Camera */ -+#define FTDI_ATIK_ATK16HR_PID 0xDF31 /* ATIK ATK-16HR Grayscale Camera */ -+#define FTDI_ATIK_ATK16HRC_PID 0xDF33 /* ATIK ATK-16HRC Colour Camera */ - - /* - * Protego product ids diff --git a/usb/ueagle-add-iso-support.patch b/usb/ueagle-add-iso-support.patch deleted file mode 100644 index 86ba2929b5d1c..0000000000000 --- a/usb/ueagle-add-iso-support.patch +++ /dev/null @@ -1,104 +0,0 @@ -From castet.matthieu@free.fr Tue Jan 17 22:36:43 2006 -Message-ID: <43CDE25B.6030503@free.fr> -Date: Wed, 18 Jan 2006 07:38:19 +0100 -From: matthieu castet <castet.matthieu@free.fr> -To: greg@kroah.com -Subject: [PATCH 1/2] UEAGLE : add iso support - -This patch adds the support for isochronous pipe. - -A new module parameter is added to select iso mode. It is set to iso by -default because bulk mode doesn't work well at high speed rate (>3 Mbps -for upload). - -We use UDSL_IGNORE_EILSEQ flags because ADI firmware doesn't reply to -ISO IN when it has nothing to send [1]. - - -[1] -from cypress datasheet : - -The ISOSEND0 Bit (bit 7 in the USBPAIR Register) is used when the EZ-USB -FX chip receives an isochronous IN token while the IN FIFO is empty. If -ISOSEND0=0 (the default value), the USB core does not respond to the IN -token. If ISOSEND0=1, the USB core sends a zero-length data packet in -response to the IN token. The action to take depends on the overall -system design. The ISOSEND0 Bit applies to all of the isochronous IN -endpoints, IN-8 through IN-15. - - -Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/ueagle-atm.c | 26 +++++++++++++++++++++++++- - 1 file changed, 25 insertions(+), 1 deletion(-) - ---- gregkh-2.6.orig/drivers/usb/atm/ueagle-atm.c -+++ gregkh-2.6/drivers/usb/atm/ueagle-atm.c -@@ -68,7 +68,7 @@ - - #include "usbatm.h" - --#define EAGLEUSBVERSION "ueagle 1.1" -+#define EAGLEUSBVERSION "ueagle 1.2" - - - /* -@@ -364,11 +364,14 @@ static const char *chip_name[] = {"ADI93 - - static int modem_index; - static unsigned int debug; -+static int use_iso[NB_MODEM] = {[0 ... (NB_MODEM - 1)] = 1}; - static int sync_wait[NB_MODEM]; - static char *cmv_file[NB_MODEM]; - - module_param(debug, uint, 0644); - MODULE_PARM_DESC(debug, "module debug level (0=off,1=on,2=verbose)"); -+module_param_array(use_iso, bool, NULL, 0644); -+MODULE_PARM_DESC(use_iso, "use isochronous usb pipe for incoming traffic"); - module_param_array(sync_wait, bool, NULL, 0644); - MODULE_PARM_DESC(sync_wait, "wait the synchronisation before starting ATM"); - module_param_array(cmv_file, charp, NULL, 0644); -@@ -936,6 +939,7 @@ static int uea_stat(struct uea_softc *sc - * ADI930 don't support it (-EPIPE error). - */ - if (UEA_CHIP_VERSION(sc) != ADI930 -+ && !use_iso[sc->modem_index] - && sc->stats.phy.dsrate != (data >> 16) * 32) { - /* Original timming from ADI(used in windows driver) - * 0x20ffff>>16 * 32 = 32 * 32 = 1Mbits -@@ -1659,6 +1663,25 @@ static int uea_bind(struct usbatm_data * - sc->modem_index = (modem_index < NB_MODEM) ? modem_index++ : 0; - sc->driver_info = id->driver_info; - -+ /* ADI930 don't support iso */ -+ if (UEA_CHIP_VERSION(id) != ADI930 && use_iso[sc->modem_index]) { -+ int i; -+ -+ /* try set fastest alternate for inbound traffic interface */ -+ for (i = FASTEST_ISO_INTF; i > 0; i--) -+ if (usb_set_interface(usb, UEA_DS_IFACE_NO, i) == 0) -+ break; -+ -+ if (i > 0) { -+ uea_dbg(usb, "set alternate %d for 2 interface\n", i); -+ uea_info(usb, "using iso mode\n"); -+ usbatm->flags |= UDSL_USE_ISOC | UDSL_IGNORE_EILSEQ; -+ } else { -+ uea_err(usb, "setting any alternate failed for " -+ "2 interface, using bulk mode\n"); -+ } -+ } -+ - ret = uea_boot(sc); - if (ret < 0) { - kfree(sc); -@@ -1708,6 +1731,7 @@ static struct usbatm_driver uea_usbatm_d - .heavy_init = uea_heavy, - .bulk_in = UEA_BULK_DATA_PIPE, - .bulk_out = UEA_BULK_DATA_PIPE, -+ .isoc_in = UEA_ISO_DATA_PIPE, - }; - - static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id) diff --git a/usb/ueagle-cmv-name-bug.patch b/usb/ueagle-cmv-name-bug.patch deleted file mode 100644 index a015e1d0778cb..0000000000000 --- a/usb/ueagle-cmv-name-bug.patch +++ /dev/null @@ -1,31 +0,0 @@ -From castet.matthieu@free.fr Tue Jan 17 22:37:55 2006 -Message-ID: <43CDE29F.5080902@free.fr> -Date: Wed, 18 Jan 2006 07:39:27 +0100 -From: matthieu castet <castet.matthieu@free.fr> -To: greg@kroah.com -Subject: [PATCH 3/2] UEAGLE : cmv name bug (was cosmetic) - -this patch correct a possible bug with cmv_name being static. If there -is 2 modems and the driver is scheduled when filling cmv_name this could -result with garbage in cmv_name. We allocate cmv_name on the stack but -with a small size in order to avoid that. - - -Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/ueagle-atm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- gregkh-2.6.orig/drivers/usb/atm/ueagle-atm.c -+++ gregkh-2.6/drivers/usb/atm/ueagle-atm.c -@@ -1013,7 +1013,7 @@ static int request_cmvs(struct uea_softc - int ret, size; - u8 *data; - char *file; -- static char cmv_name[256] = FW_DIR; -+ char cmv_name[FIRMWARE_NAME_MAX]; /* 30 bytes stack variable */ - - if (cmv_file[sc->modem_index] == NULL) { - if (UEA_CHIP_VERSION(sc) == ADI930) diff --git a/usb/ueagle-cosmetic.patch b/usb/ueagle-cosmetic.patch deleted file mode 100644 index 648fb8b5a0662..0000000000000 --- a/usb/ueagle-cosmetic.patch +++ /dev/null @@ -1,126 +0,0 @@ -From castet.matthieu@free.fr Tue Jan 17 22:37:00 2006 -Message-ID: <43CDE26D.8040002@free.fr> -Date: Wed, 18 Jan 2006 07:38:37 +0100 -From: matthieu castet <castet.matthieu@free.fr> -To: greg@kroah.com -Subject: [PATCH 2/2] UEAGLE : cosmetic - -this patch is purely cosmetic. There is : -- indentation cleaning -- unneeded cast removing -- comments cleaning - - -Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/ueagle-atm.c | 32 +++++++++++--------------------- - 1 file changed, 11 insertions(+), 21 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/ueagle-atm.c -+++ gregkh-2.6/drivers/usb/atm/ueagle-atm.c -@@ -632,8 +632,7 @@ static int request_dsp(struct uea_softc - dsp_name = FW_DIR "DSPep.bin"; - } - -- ret = request_firmware(&sc->dsp_firm, -- dsp_name, &sc->usb_dev->dev); -+ ret = request_firmware(&sc->dsp_firm, dsp_name, &sc->usb_dev->dev); - if (ret < 0) { - uea_err(INS_TO_USBDEV(sc), - "requesting firmware %s failed with error %d\n", -@@ -748,7 +747,6 @@ static inline int wait_cmv_ack(struct ue - return ret; - - return (ret == 0) ? -ETIMEDOUT : 0; -- - } - - #define UCDC_SEND_ENCAPSULATED_COMMAND 0x00 -@@ -1189,8 +1187,7 @@ static int load_XILINX_firmware(struct u - } - } - -- /* finish to send the fpga -- */ -+ /* finish to send the fpga */ - ret = uea_request(sc, 0xe, 1, 0, NULL); - if (ret < 0) { - uea_err(INS_TO_USBDEV(sc), -@@ -1198,9 +1195,7 @@ static int load_XILINX_firmware(struct u - goto err1; - } - -- /* -- * Tell the modem we finish : de-assert reset -- */ -+ /* Tell the modem we finish : de-assert reset */ - value = 0; - ret = uea_send_modem_cmd(sc->usb_dev, 0xe, 1, &value); - if (ret < 0) -@@ -1214,6 +1209,7 @@ err0: - return ret; - } - -+/* The modem send us an ack. First with check if it right */ - static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv) - { - uea_enters(INS_TO_USBDEV(sc)); -@@ -1273,23 +1269,19 @@ bad1: - */ - static void uea_intr(struct urb *urb, struct pt_regs *regs) - { -- struct uea_softc *sc = (struct uea_softc *)urb->context; -- struct intr_pkt *intr; -+ struct uea_softc *sc = urb->context; -+ struct intr_pkt *intr = urb->transfer_buffer; - uea_enters(INS_TO_USBDEV(sc)); - -- if (urb->status < 0) { -+ if (unlikely(urb->status < 0)) { - uea_err(INS_TO_USBDEV(sc), "uea_intr() failed with %d\n", - urb->status); - return; - } - -- intr = (struct intr_pkt *) urb->transfer_buffer; -- - /* device-to-host interrupt */ - if (intr->bType != 0x08 || sc->booting) { -- uea_err(INS_TO_USBDEV(sc), "wrong intr\n"); -- // rebooting ? -- // sc->reset = 1; -+ uea_err(INS_TO_USBDEV(sc), "wrong interrupt\n"); - goto resubmit; - } - -@@ -1305,7 +1297,7 @@ static void uea_intr(struct urb *urb, st - break; - - default: -- uea_err(INS_TO_USBDEV(sc), "unknown intr %u\n", -+ uea_err(INS_TO_USBDEV(sc), "unknown interrupt %u\n", - le16_to_cpu(intr->wInterrupt)); - } - -@@ -1384,7 +1376,7 @@ static void uea_stop(struct uea_softc *s - int ret; - uea_enters(INS_TO_USBDEV(sc)); - ret = kthread_stop(sc->kthread); -- uea_info(INS_TO_USBDEV(sc), "kthread finish with status %d\n", ret); -+ uea_dbg(INS_TO_USBDEV(sc), "kthread finish with status %d\n", ret); - - /* stop any pending boot process */ - flush_scheduled_work(); -@@ -1641,9 +1633,7 @@ static int uea_bind(struct usbatm_data * - if (ret < 0) - return ret; - -- /* ADI930 has only 2 interfaces and inbound traffic -- * is on interface 1 -- */ -+ /* ADI930 has only 2 interfaces and inbound traffic is on interface 1 */ - if (UEA_CHIP_VERSION(id) != ADI930) { - /* interface 2 is for inbound traffic */ - ret = claim_interface(usb, usbatm, UEA_DS_IFACE_NO); diff --git a/usb/usb-add-et61x51-video4linux2-driver.patch b/usb/usb-add-et61x51-video4linux2-driver.patch deleted file mode 100644 index 93b6d99d4521f..0000000000000 --- a/usb/usb-add-et61x51-video4linux2-driver.patch +++ /dev/null @@ -1,3523 +0,0 @@ -From luca.risolia@studio.unibo.it Tue Jan 10 17:01:52 2006 -Date: Wed, 11 Jan 2006 02:06:59 +0000 -From: Luca Risolia <luca.risolia@studio.unibo.it> -To: Greg Kroah-Hartman <gregkh@suse.de> -Cc: Mauro Carvalho Chehab <mchehab@brturbo.com.br>, Laurent Pinchart <laurent.pinchart@skynet.be> -Subject: USB: Add ET61X[12]51 Video4Linux2 driver -Message-ID: <20060111020658.GA6846@studio.unibo.it> -Content-Disposition: inline - -This patch adds a Video4Linux2 driver giving support -to ET61X151 and ET61X251 PC Camera Controllers made by -Etoms Electronics. - -Signed-off-by: Luca Risolia <luca.risolia@studio.unibo.it> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> ---- - Documentation/usb/et61x251.txt | 306 +++ - MAINTAINERS | 10 - drivers/usb/Makefile | 1 - drivers/usb/media/Kconfig | 17 - drivers/usb/media/Makefile | 2 - drivers/usb/media/et61x251.h | 220 ++ - drivers/usb/media/et61x251_core.c | 2605 ++++++++++++++++++++++++++++++++ - drivers/usb/media/et61x251_sensor.h | 115 + - drivers/usb/media/et61x251_tas5130d1b.c | 137 + - include/linux/videodev2.h | 1 - 10 files changed, 3412 insertions(+), 2 deletions(-) - ---- /dev/null -+++ gregkh-2.6/Documentation/usb/et61x251.txt -@@ -0,0 +1,306 @@ -+ -+ ET61X[12]51 PC Camera Controllers -+ Driver for Linux -+ ================================= -+ -+ - Documentation - -+ -+ -+Index -+===== -+1. Copyright -+2. Disclaimer -+3. License -+4. Overview and features -+5. Module dependencies -+6. Module loading -+7. Module parameters -+8. Optional device control through "sysfs" -+9. Supported devices -+10. Notes for V4L2 application developers -+11. Contact information -+ -+ -+1. Copyright -+============ -+Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> -+ -+ -+2. Disclaimer -+============= -+Etoms is a trademark of Etoms Electronics Corp. -+This software is not developed or sponsored by Etoms Electronics. -+ -+ -+3. License -+========== -+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., 675 Mass Ave, Cambridge, MA 02139, USA. -+ -+ -+4. Overview and features -+======================== -+This driver supports the video interface of the devices mounting the ET61X151 -+or ET61X251 PC Camera Controllers. -+ -+It's worth to note that Etoms Electronics has never collaborated with the -+author during the development of this project; despite several requests, -+Etoms Electronics also refused to release enough detailed specifications of -+the video compression engine. -+ -+The driver relies on the Video4Linux2 and USB core modules. It has been -+designed to run properly on SMP systems as well. -+ -+The latest version of the ET61X[12]51 driver can be found at the following URL: -+http://www.linux-projects.org/ -+ -+Some of the features of the driver are: -+ -+- full compliance with the Video4Linux2 API (see also "Notes for V4L2 -+ application developers" paragraph); -+- available mmap or read/poll methods for video streaming through isochronous -+ data transfers; -+- automatic detection of image sensor; -+- support for any window resolutions and optional panning within the maximum -+ pixel area of image sensor; -+- image downscaling with arbitrary scaling factors from 1 and 2 in both -+ directions (see "Notes for V4L2 application developers" paragraph); -+- two different video formats for uncompressed or compressed data in low or -+ high compression quality (see also "Notes for V4L2 application developers" -+ paragraph); -+- full support for the capabilities of every possible image sensors that can -+ be connected to the ET61X[12]51 bridges, including, for istance, red, green, -+ blue and global gain adjustments and exposure control (see "Supported -+ devices" paragraph for details); -+- use of default color settings for sunlight conditions; -+- dynamic I/O interface for both ET61X[12]51 and image sensor control (see -+ "Optional device control through 'sysfs'" paragraph); -+- dynamic driver control thanks to various module parameters (see "Module -+ parameters" paragraph); -+- up to 64 cameras can be handled at the same time; they can be connected and -+ disconnected from the host many times without turning off the computer, if -+ the system supports hotplugging; -+- no known bugs. -+ -+ -+5. Module dependencies -+====================== -+For it to work properly, the driver needs kernel support for Video4Linux and -+USB. -+ -+The following options of the kernel configuration file must be enabled and -+corresponding modules must be compiled: -+ -+ # Multimedia devices -+ # -+ CONFIG_VIDEO_DEV=m -+ -+To enable advanced debugging functionality on the device through /sysfs: -+ -+ # Multimedia devices -+ # -+ CONFIG_VIDEO_ADV_DEBUG=y -+ -+ # USB support -+ # -+ CONFIG_USB=m -+ -+In addition, depending on the hardware being used, the modules below are -+necessary: -+ -+ # USB Host Controller Drivers -+ # -+ CONFIG_USB_EHCI_HCD=m -+ CONFIG_USB_UHCI_HCD=m -+ CONFIG_USB_OHCI_HCD=m -+ -+And finally: -+ -+ # USB Multimedia devices -+ # -+ CONFIG_USB_ET61X251=m -+ -+ -+6. Module loading -+================= -+To use the driver, it is necessary to load the "et61x251" module into memory -+after every other module required: "videodev", "usbcore" and, depending on -+the USB host controller you have, "ehci-hcd", "uhci-hcd" or "ohci-hcd". -+ -+Loading can be done as shown below: -+ -+ [root@localhost home]# modprobe et61x251 -+ -+At this point the devices should be recognized. You can invoke "dmesg" to -+analyze kernel messages and verify that the loading process has gone well: -+ -+ [user@localhost home]$ dmesg -+ -+ -+7. Module parameters -+==================== -+Module parameters are listed below: -+------------------------------------------------------------------------------- -+Name: video_nr -+Type: short array (min = 0, max = 64) -+Syntax: <-1|n[,...]> -+Description: Specify V4L2 minor mode number: -+ -1 = use next available -+ n = use minor number n -+ You can specify up to 64 cameras this way. -+ For example: -+ video_nr=-1,2,-1 would assign minor number 2 to the second -+ registered camera and use auto for the first one and for every -+ other camera. -+Default: -1 -+------------------------------------------------------------------------------- -+Name: force_munmap -+Type: bool array (min = 0, max = 64) -+Syntax: <0|1[,...]> -+Description: Force the application to unmap previously mapped buffer memory -+ before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not -+ all the applications support this feature. This parameter is -+ specific for each detected camera. -+ 0 = do not force memory unmapping -+ 1 = force memory unmapping (save memory) -+Default: 0 -+------------------------------------------------------------------------------- -+Name: debug -+Type: ushort -+Syntax: <n> -+Description: Debugging information level, from 0 to 3: -+ 0 = none (use carefully) -+ 1 = critical errors -+ 2 = significant informations -+ 3 = more verbose messages -+ Level 3 is useful for testing only, when only one device -+ is used at the same time. It also shows some more informations -+ about the hardware being detected. This module parameter can be -+ changed at runtime thanks to the /sys filesystem interface. -+Default: 2 -+------------------------------------------------------------------------------- -+ -+ -+8. Optional device control through "sysfs" -+========================================== -+If the kernel has been compiled with the CONFIG_VIDEO_ADV_DEBUG option enabled, -+it is possible to read and write both the ET61X[12]51 and the image sensor -+registers by using the "sysfs" filesystem interface. -+ -+There are four files in the /sys/class/video4linux/videoX directory for each -+registered camera: "reg", "val", "i2c_reg" and "i2c_val". The first two files -+control the ET61X[12]51 bridge, while the other two control the sensor chip. -+"reg" and "i2c_reg" hold the values of the current register index where the -+following reading/writing operations are addressed at through "val" and -+"i2c_val". Their use is not intended for end-users, unless you know what you -+are doing. Remember that you must be logged in as root before writing to them. -+ -+As an example, suppose we were to want to read the value contained in the -+register number 1 of the sensor register table - which is usually the product -+identifier - of the camera registered as "/dev/video0": -+ -+ [root@localhost #] cd /sys/class/video4linux/video0 -+ [root@localhost #] echo 1 > i2c_reg -+ [root@localhost #] cat i2c_val -+ -+Note that if the sensor registers can not be read, "cat" will fail. -+To avoid race conditions, all the I/O accesses to the files are serialized. -+ -+ -+9. Supported devices -+==================== -+None of the names of the companies as well as their products will be mentioned -+here. They have never collaborated with the author, so no advertising. -+ -+From the point of view of a driver, what unambiguously identify a device are -+its vendor and product USB identifiers. Below is a list of known identifiers of -+devices mounting the ET61X[12]51 PC camera controllers: -+ -+Vendor ID Product ID -+--------- ---------- -+0x102c 0x6151 -+0x102c 0x6251 -+0x102c 0x6253 -+0x102c 0x6254 -+0x102c 0x6255 -+0x102c 0x6256 -+0x102c 0x6257 -+0x102c 0x6258 -+0x102c 0x6259 -+0x102c 0x625a -+0x102c 0x625b -+0x102c 0x625c -+0x102c 0x625d -+0x102c 0x625e -+0x102c 0x625f -+0x102c 0x6260 -+0x102c 0x6261 -+0x102c 0x6262 -+0x102c 0x6263 -+0x102c 0x6264 -+0x102c 0x6265 -+0x102c 0x6266 -+0x102c 0x6267 -+0x102c 0x6268 -+0x102c 0x6269 -+ -+The following image sensors are supported: -+ -+Model Manufacturer -+----- ------------ -+TAS5130D1B Taiwan Advanced Sensor Corporation -+ -+All the available control settings of each image sensor are supported through -+the V4L2 interface. -+ -+ -+10. Notes for V4L2 application developers -+======================================== -+This driver follows the V4L2 API specifications. In particular, it enforces two -+rules: -+ -+- exactly one I/O method, either "mmap" or "read", is associated with each -+file descriptor. Once it is selected, the application must close and reopen the -+device to switch to the other I/O method; -+ -+- although it is not mandatory, previously mapped buffer memory should always -+be unmapped before calling any "VIDIOC_S_CROP" or "VIDIOC_S_FMT" ioctl's. -+The same number of buffers as before will be allocated again to match the size -+of the new video frames, so you have to map the buffers again before any I/O -+attempts on them. -+ -+Consistently with the hardware limits, this driver also supports image -+downscaling with arbitrary scaling factors from 1 and 2 in both directions. -+However, the V4L2 API specifications don't correctly define how the scaling -+factor can be chosen arbitrarily by the "negotiation" of the "source" and -+"target" rectangles. To work around this flaw, we have added the convention -+that, during the negotiation, whenever the "VIDIOC_S_CROP" ioctl is issued, the -+scaling factor is restored to 1. -+ -+This driver supports two different video formats: the first one is the "8-bit -+Sequential Bayer" format and can be used to obtain uncompressed video data -+from the device through the current I/O method, while the second one provides -+"raw" compressed video data (without frame headers not related to the -+compressed data). The current compression quality may vary from 0 to 1 and can -+be selected or queried thanks to the VIDIOC_S_JPEGCOMP and VIDIOC_G_JPEGCOMP -+V4L2 ioctl's. -+ -+ -+11. Contact information -+======================= -+The author may be contacted by e-mail at <luca.risolia@studio.unibo.it>. -+ -+GPG/PGP encrypted e-mail's are accepted. The GPG key ID of the author is -+'FCE635A4'; the public 1024-bit key should be available at any keyserver; -+the fingerprint is: '88E8 F32F 7244 68BA 3958 5D40 99DA 5D2A FCE6 35A4'. ---- gregkh-2.6.orig/drivers/usb/Makefile -+++ gregkh-2.6/drivers/usb/Makefile -@@ -38,6 +38,7 @@ obj-$(CONFIG_USB_XPAD) += input/ - - obj-$(CONFIG_USB_DABUSB) += media/ - obj-$(CONFIG_USB_DSBR) += media/ -+obj-$(CONFIG_USB_ET61X251) += media/ - obj-$(CONFIG_USB_IBMCAM) += media/ - obj-$(CONFIG_USB_KONICAWC) += media/ - obj-$(CONFIG_USB_OV511) += media/ ---- /dev/null -+++ gregkh-2.6/drivers/usb/media/et61x251_core.c -@@ -0,0 +1,2605 @@ -+/*************************************************************************** -+ * V4L2 driver for ET61X[12]51 PC Camera Controllers * -+ * * -+ * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * * -+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * -+ ***************************************************************************/ -+ -+#include <linux/module.h> -+#include <linux/init.h> -+#include <linux/kernel.h> -+#include <linux/param.h> -+#include <linux/moduleparam.h> -+#include <linux/errno.h> -+#include <linux/slab.h> -+#include <linux/string.h> -+#include <linux/device.h> -+#include <linux/fs.h> -+#include <linux/delay.h> -+#include <linux/stddef.h> -+#include <linux/compiler.h> -+#include <linux/ioctl.h> -+#include <linux/poll.h> -+#include <linux/stat.h> -+#include <linux/mm.h> -+#include <linux/vmalloc.h> -+#include <linux/page-flags.h> -+#include <linux/byteorder/generic.h> -+#include <asm/page.h> -+#include <asm/uaccess.h> -+ -+#include "et61x251.h" -+ -+/*****************************************************************************/ -+ -+#define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \ -+ "PC Camera Controllers" -+#define ET61X251_MODULE_AUTHOR "(C) 2006 Luca Risolia" -+#define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" -+#define ET61X251_MODULE_LICENSE "GPL" -+#define ET61X251_MODULE_VERSION "1:1.01" -+#define ET61X251_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 1) -+ -+/*****************************************************************************/ -+ -+MODULE_DEVICE_TABLE(usb, et61x251_id_table); -+ -+MODULE_AUTHOR(ET61X251_MODULE_AUTHOR " " ET61X251_AUTHOR_EMAIL); -+MODULE_DESCRIPTION(ET61X251_MODULE_NAME); -+MODULE_VERSION(ET61X251_MODULE_VERSION); -+MODULE_LICENSE(ET61X251_MODULE_LICENSE); -+ -+static short video_nr[] = {[0 ... ET61X251_MAX_DEVICES-1] = -1}; -+module_param_array(video_nr, short, NULL, 0444); -+MODULE_PARM_DESC(video_nr, -+ "\n<-1|n[,...]> Specify V4L2 minor mode number." -+ "\n -1 = use next available (default)" -+ "\n n = use minor number n (integer >= 0)" -+ "\nYou can specify up to " -+ __MODULE_STRING(ET61X251_MAX_DEVICES) " cameras this way." -+ "\nFor example:" -+ "\nvideo_nr=-1,2,-1 would assign minor number 2 to" -+ "\nthe second registered camera and use auto for the first" -+ "\none and for every other camera." -+ "\n"); -+ -+static short force_munmap[] = {[0 ... ET61X251_MAX_DEVICES-1] = -+ ET61X251_FORCE_MUNMAP}; -+module_param_array(force_munmap, bool, NULL, 0444); -+MODULE_PARM_DESC(force_munmap, -+ "\n<0|1[,...]> Force the application to unmap previously" -+ "\nmapped buffer memory before calling any VIDIOC_S_CROP or" -+ "\nVIDIOC_S_FMT ioctl's. Not all the applications support" -+ "\nthis feature. This parameter is specific for each" -+ "\ndetected camera." -+ "\n 0 = do not force memory unmapping" -+ "\n 1 = force memory unmapping (save memory)" -+ "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." -+ "\n"); -+ -+#ifdef ET61X251_DEBUG -+static unsigned short debug = ET61X251_DEBUG_LEVEL; -+module_param(debug, ushort, 0644); -+MODULE_PARM_DESC(debug, -+ "\n<n> Debugging information level, from 0 to 3:" -+ "\n0 = none (use carefully)" -+ "\n1 = critical errors" -+ "\n2 = significant informations" -+ "\n3 = more verbose messages" -+ "\nLevel 3 is useful for testing only, when only " -+ "one device is used." -+ "\nDefault value is "__MODULE_STRING(ET61X251_DEBUG_LEVEL)"." -+ "\n"); -+#endif -+ -+/*****************************************************************************/ -+ -+static u32 -+et61x251_request_buffers(struct et61x251_device* cam, u32 count, -+ enum et61x251_io_method io) -+{ -+ struct v4l2_pix_format* p = &(cam->sensor->pix_format); -+ struct v4l2_rect* r = &(cam->sensor->cropcap.bounds); -+ const size_t imagesize = cam->module_param.force_munmap || -+ io == IO_READ ? -+ (p->width * p->height * p->priv) / 8 : -+ (r->width * r->height * p->priv) / 8; -+ void* buff = NULL; -+ u32 i; -+ -+ if (count > ET61X251_MAX_FRAMES) -+ count = ET61X251_MAX_FRAMES; -+ -+ cam->nbuffers = count; -+ while (cam->nbuffers > 0) { -+ if ((buff = vmalloc_32(cam->nbuffers * PAGE_ALIGN(imagesize)))) -+ break; -+ cam->nbuffers--; -+ } -+ -+ for (i = 0; i < cam->nbuffers; i++) { -+ cam->frame[i].bufmem = buff + i*PAGE_ALIGN(imagesize); -+ cam->frame[i].buf.index = i; -+ cam->frame[i].buf.m.offset = i*PAGE_ALIGN(imagesize); -+ cam->frame[i].buf.length = imagesize; -+ cam->frame[i].buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ cam->frame[i].buf.sequence = 0; -+ cam->frame[i].buf.field = V4L2_FIELD_NONE; -+ cam->frame[i].buf.memory = V4L2_MEMORY_MMAP; -+ cam->frame[i].buf.flags = 0; -+ } -+ -+ return cam->nbuffers; -+} -+ -+ -+static void et61x251_release_buffers(struct et61x251_device* cam) -+{ -+ if (cam->nbuffers) { -+ vfree(cam->frame[0].bufmem); -+ cam->nbuffers = 0; -+ } -+ cam->frame_current = NULL; -+} -+ -+ -+static void et61x251_empty_framequeues(struct et61x251_device* cam) -+{ -+ u32 i; -+ -+ INIT_LIST_HEAD(&cam->inqueue); -+ INIT_LIST_HEAD(&cam->outqueue); -+ -+ for (i = 0; i < ET61X251_MAX_FRAMES; i++) { -+ cam->frame[i].state = F_UNUSED; -+ cam->frame[i].buf.bytesused = 0; -+ } -+} -+ -+ -+static void et61x251_requeue_outqueue(struct et61x251_device* cam) -+{ -+ struct et61x251_frame_t *i; -+ -+ list_for_each_entry(i, &cam->outqueue, frame) { -+ i->state = F_QUEUED; -+ list_add(&i->frame, &cam->inqueue); -+ } -+ -+ INIT_LIST_HEAD(&cam->outqueue); -+} -+ -+ -+static void et61x251_queue_unusedframes(struct et61x251_device* cam) -+{ -+ unsigned long lock_flags; -+ u32 i; -+ -+ for (i = 0; i < cam->nbuffers; i++) -+ if (cam->frame[i].state == F_UNUSED) { -+ cam->frame[i].state = F_QUEUED; -+ spin_lock_irqsave(&cam->queue_lock, lock_flags); -+ list_add_tail(&cam->frame[i].frame, &cam->inqueue); -+ spin_unlock_irqrestore(&cam->queue_lock, lock_flags); -+ } -+} -+ -+/*****************************************************************************/ -+ -+int et61x251_write_reg(struct et61x251_device* cam, u8 value, u16 index) -+{ -+ struct usb_device* udev = cam->usbdev; -+ u8* buff = cam->control_buffer; -+ int res; -+ -+ *buff = value; -+ -+ res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, -+ 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); -+ if (res < 0) { -+ DBG(3, "Failed to write a register (value 0x%02X, index " -+ "0x%02X, error %d)", value, index, res); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+ -+int et61x251_read_reg(struct et61x251_device* cam, u16 index) -+{ -+ struct usb_device* udev = cam->usbdev; -+ u8* buff = cam->control_buffer; -+ int res; -+ -+ res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, -+ 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); -+ if (res < 0) -+ DBG(3, "Failed to read a register (index 0x%02X, error %d)", -+ index, res); -+ -+ return (res >= 0) ? (int)(*buff) : -1; -+} -+ -+ -+static int -+et61x251_i2c_wait(struct et61x251_device* cam, struct et61x251_sensor* sensor) -+{ -+ int i, r; -+ -+ for (i = 1; i <= 8; i++) { -+ if (sensor->interface == ET61X251_I2C_3WIRES) { -+ r = et61x251_read_reg(cam, 0x8e); -+ if (!(r & 0x02) && (r >= 0)) -+ return 0; -+ } else { -+ r = et61x251_read_reg(cam, 0x8b); -+ if (!(r & 0x01) && (r >= 0)) -+ return 0; -+ } -+ if (r < 0) -+ return -EIO; -+ udelay(8*8); /* minimum for sensors at 400kHz */ -+ } -+ -+ return -EBUSY; -+} -+ -+ -+int -+et61x251_i2c_try_read(struct et61x251_device* cam, -+ struct et61x251_sensor* sensor, u8 address) -+{ -+ struct usb_device* udev = cam->usbdev; -+ u8* data = cam->control_buffer; -+ int err = 0, res; -+ -+ data[0] = address; -+ data[1] = cam->sensor->i2c_slave_id; -+ data[2] = cam->sensor->rsta | 0x10; -+ data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02); -+ res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, -+ 0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT); -+ if (res < 0) -+ err += res; -+ -+ err += et61x251_i2c_wait(cam, sensor); -+ -+ res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, -+ 0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT); -+ if (res < 0) -+ err += res; -+ -+ if (err) -+ DBG(3, "I2C read failed for %s image sensor", sensor->name); -+ -+ PDBGG("I2C read: address 0x%02X, value: 0x%02X", address, data[0]); -+ -+ return err ? -1 : (int)data[0]; -+} -+ -+ -+int -+et61x251_i2c_try_write(struct et61x251_device* cam, -+ struct et61x251_sensor* sensor, u8 address, u8 value) -+{ -+ struct usb_device* udev = cam->usbdev; -+ u8* data = cam->control_buffer; -+ int err = 0, res; -+ -+ data[0] = address; -+ data[1] = cam->sensor->i2c_slave_id; -+ data[2] = cam->sensor->rsta | 0x12; -+ res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, -+ 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); -+ if (res < 0) -+ err += res; -+ -+ data[0] = value; -+ res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, -+ 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); -+ if (res < 0) -+ err += res; -+ -+ err += et61x251_i2c_wait(cam, sensor); -+ -+ if (err) -+ DBG(3, "I2C write failed for %s image sensor", sensor->name); -+ -+ PDBGG("I2C write: address 0x%02X, value: 0x%02X", address, value); -+ -+ return err ? -1 : 0; -+} -+ -+ -+int -+et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, -+ u8 data3, u8 data4, u8 data5, u8 data6, u8 data7, -+ u8 data8, u8 address) -+{ -+ struct usb_device* udev = cam->usbdev; -+ u8* data = cam->control_buffer; -+ int err = 0, res; -+ -+ if (!cam->sensor) -+ return -1; -+ -+ data[0] = data2; -+ data[1] = data3; -+ data[2] = data4; -+ data[3] = data5; -+ data[4] = data6; -+ data[5] = data7; -+ data[6] = data8; -+ res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, -+ 0, 0x81, data, n-1, ET61X251_CTRL_TIMEOUT); -+ if (res < 0) -+ err += res; -+ -+ data[0] = address; -+ data[1] = cam->sensor->i2c_slave_id; -+ data[2] = cam->sensor->rsta | 0x02 | (n << 4); -+ res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, -+ 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); -+ if (res < 0) -+ err += res; -+ -+ /* Start writing through the serial interface */ -+ data[0] = data1; -+ res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, -+ 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); -+ if (res < 0) -+ err += res; -+ -+ err += et61x251_i2c_wait(cam, cam->sensor); -+ -+ if (err) -+ DBG(3, "I2C raw write failed for %s image sensor", -+ cam->sensor->name); -+ -+ PDBGG("I2C raw write: %u bytes, address = 0x%02X, data1 = 0x%02X, " -+ "data2 = 0x%02X, data3 = 0x%02X, data4 = 0x%02X, data5 = 0x%02X," -+ " data6 = 0x%02X, data7 = 0x%02X, data8 = 0x%02X", n, address, -+ data1, data2, data3, data4, data5, data6, data7, data8); -+ -+ return err ? -1 : 0; -+ -+} -+ -+ -+int et61x251_i2c_read(struct et61x251_device* cam, u8 address) -+{ -+ if (!cam->sensor) -+ return -1; -+ -+ return et61x251_i2c_try_read(cam, cam->sensor, address); -+} -+ -+ -+int et61x251_i2c_write(struct et61x251_device* cam, u8 address, u8 value) -+{ -+ if (!cam->sensor) -+ return -1; -+ -+ return et61x251_i2c_try_write(cam, cam->sensor, address, value); -+} -+ -+/*****************************************************************************/ -+ -+static void et61x251_urb_complete(struct urb *urb, struct pt_regs* regs) -+{ -+ struct et61x251_device* cam = urb->context; -+ struct et61x251_frame_t** f; -+ size_t imagesize; -+ u8 i; -+ int err = 0; -+ -+ if (urb->status == -ENOENT) -+ return; -+ -+ f = &cam->frame_current; -+ -+ if (cam->stream == STREAM_INTERRUPT) { -+ cam->stream = STREAM_OFF; -+ if ((*f)) -+ (*f)->state = F_QUEUED; -+ DBG(3, "Stream interrupted"); -+ wake_up_interruptible(&cam->wait_stream); -+ } -+ -+ if (cam->state & DEV_DISCONNECTED) -+ return; -+ -+ if (cam->state & DEV_MISCONFIGURED) { -+ wake_up_interruptible(&cam->wait_frame); -+ return; -+ } -+ -+ if (cam->stream == STREAM_OFF || list_empty(&cam->inqueue)) -+ goto resubmit_urb; -+ -+ if (!(*f)) -+ (*f) = list_entry(cam->inqueue.next, struct et61x251_frame_t, -+ frame); -+ -+ imagesize = (cam->sensor->pix_format.width * -+ cam->sensor->pix_format.height * -+ cam->sensor->pix_format.priv) / 8; -+ -+ for (i = 0; i < urb->number_of_packets; i++) { -+ unsigned int len, status; -+ void *pos; -+ u8* b1, * b2, sof; -+ const u8 VOID_BYTES = 6; -+ size_t imglen; -+ -+ len = urb->iso_frame_desc[i].actual_length; -+ status = urb->iso_frame_desc[i].status; -+ pos = urb->iso_frame_desc[i].offset + urb->transfer_buffer; -+ -+ if (status) { -+ DBG(3, "Error in isochronous frame"); -+ (*f)->state = F_ERROR; -+ continue; -+ } -+ -+ b1 = pos++; -+ b2 = pos++; -+ sof = ((*b1 & 0x3f) == 63); -+ imglen = ((*b1 & 0xc0) << 2) | *b2; -+ -+ PDBGG("Isochrnous frame: length %u, #%u i, image length %zu", -+ len, i, imglen); -+ -+ if ((*f)->state == F_QUEUED || (*f)->state == F_ERROR) -+start_of_frame: -+ if (sof) { -+ (*f)->state = F_GRABBING; -+ (*f)->buf.bytesused = 0; -+ do_gettimeofday(&(*f)->buf.timestamp); -+ pos += 22; -+ DBG(3, "SOF detected: new video frame"); -+ } -+ -+ if ((*f)->state == F_GRABBING) { -+ if (sof && (*f)->buf.bytesused) { -+ if (cam->sensor->pix_format.pixelformat == -+ V4L2_PIX_FMT_ET61X251) -+ goto end_of_frame; -+ else { -+ DBG(3, "Not expected SOF detected " -+ "after %lu bytes", -+ (unsigned long)(*f)->buf.bytesused); -+ (*f)->state = F_ERROR; -+ continue; -+ } -+ } -+ -+ if ((*f)->buf.bytesused + imglen > imagesize) { -+ DBG(3, "Video frame size exceeded"); -+ (*f)->state = F_ERROR; -+ continue; -+ } -+ -+ pos += VOID_BYTES; -+ -+ memcpy((*f)->bufmem+(*f)->buf.bytesused, pos, imglen); -+ (*f)->buf.bytesused += imglen; -+ -+ if ((*f)->buf.bytesused == imagesize) { -+ u32 b; -+end_of_frame: -+ b = (*f)->buf.bytesused; -+ (*f)->state = F_DONE; -+ (*f)->buf.sequence= ++cam->frame_count; -+ spin_lock(&cam->queue_lock); -+ list_move_tail(&(*f)->frame, &cam->outqueue); -+ if (!list_empty(&cam->inqueue)) -+ (*f) = list_entry(cam->inqueue.next, -+ struct et61x251_frame_t, -+ frame); -+ else -+ (*f) = NULL; -+ spin_unlock(&cam->queue_lock); -+ DBG(3, "Video frame captured: : %lu bytes", -+ (unsigned long)(b)); -+ -+ if (!(*f)) -+ goto resubmit_urb; -+ -+ if (sof && -+ cam->sensor->pix_format.pixelformat == -+ V4L2_PIX_FMT_ET61X251) -+ goto start_of_frame; -+ } -+ } -+ } -+ -+resubmit_urb: -+ urb->dev = cam->usbdev; -+ err = usb_submit_urb(urb, GFP_ATOMIC); -+ if (err < 0 && err != -EPERM) { -+ cam->state |= DEV_MISCONFIGURED; -+ DBG(1, "usb_submit_urb() failed"); -+ } -+ -+ wake_up_interruptible(&cam->wait_frame); -+} -+ -+ -+static int et61x251_start_transfer(struct et61x251_device* cam) -+{ -+ struct usb_device *udev = cam->usbdev; -+ struct urb* urb; -+ const unsigned int wMaxPacketSize[] = {0, 256, 384, 512, 640, 768, 832, -+ 864, 896, 920, 956, 980, 1000, -+ 1022}; -+ const unsigned int psz = wMaxPacketSize[ET61X251_ALTERNATE_SETTING]; -+ s8 i, j; -+ int err = 0; -+ -+ for (i = 0; i < ET61X251_URBS; i++) { -+ cam->transfer_buffer[i] = kzalloc(ET61X251_ISO_PACKETS * psz, -+ GFP_KERNEL); -+ if (!cam->transfer_buffer[i]) { -+ err = -ENOMEM; -+ DBG(1, "Not enough memory"); -+ goto free_buffers; -+ } -+ } -+ -+ for (i = 0; i < ET61X251_URBS; i++) { -+ urb = usb_alloc_urb(ET61X251_ISO_PACKETS, GFP_KERNEL); -+ cam->urb[i] = urb; -+ if (!urb) { -+ err = -ENOMEM; -+ DBG(1, "usb_alloc_urb() failed"); -+ goto free_urbs; -+ } -+ urb->dev = udev; -+ urb->context = cam; -+ urb->pipe = usb_rcvisocpipe(udev, 1); -+ urb->transfer_flags = URB_ISO_ASAP; -+ urb->number_of_packets = ET61X251_ISO_PACKETS; -+ urb->complete = et61x251_urb_complete; -+ urb->transfer_buffer = cam->transfer_buffer[i]; -+ urb->transfer_buffer_length = psz * ET61X251_ISO_PACKETS; -+ urb->interval = 1; -+ for (j = 0; j < ET61X251_ISO_PACKETS; j++) { -+ urb->iso_frame_desc[j].offset = psz * j; -+ urb->iso_frame_desc[j].length = psz; -+ } -+ } -+ -+ err = et61x251_write_reg(cam, 0x01, 0x03); -+ err = et61x251_write_reg(cam, 0x00, 0x03); -+ err = et61x251_write_reg(cam, 0x08, 0x03); -+ if (err) { -+ err = -EIO; -+ DBG(1, "I/O hardware error"); -+ goto free_urbs; -+ } -+ -+ err = usb_set_interface(udev, 0, ET61X251_ALTERNATE_SETTING); -+ if (err) { -+ DBG(1, "usb_set_interface() failed"); -+ goto free_urbs; -+ } -+ -+ cam->frame_current = NULL; -+ -+ for (i = 0; i < ET61X251_URBS; i++) { -+ err = usb_submit_urb(cam->urb[i], GFP_KERNEL); -+ if (err) { -+ for (j = i-1; j >= 0; j--) -+ usb_kill_urb(cam->urb[j]); -+ DBG(1, "usb_submit_urb() failed, error %d", err); -+ goto free_urbs; -+ } -+ } -+ -+ return 0; -+ -+free_urbs: -+ for (i = 0; (i < ET61X251_URBS) && cam->urb[i]; i++) -+ usb_free_urb(cam->urb[i]); -+ -+free_buffers: -+ for (i = 0; (i < ET61X251_URBS) && cam->transfer_buffer[i]; i++) -+ kfree(cam->transfer_buffer[i]); -+ -+ return err; -+} -+ -+ -+static int et61x251_stop_transfer(struct et61x251_device* cam) -+{ -+ struct usb_device *udev = cam->usbdev; -+ s8 i; -+ int err = 0; -+ -+ if (cam->state & DEV_DISCONNECTED) -+ return 0; -+ -+ for (i = ET61X251_URBS-1; i >= 0; i--) { -+ usb_kill_urb(cam->urb[i]); -+ usb_free_urb(cam->urb[i]); -+ kfree(cam->transfer_buffer[i]); -+ } -+ -+ err = usb_set_interface(udev, 0, 0); /* 0 Mb/s */ -+ if (err) -+ DBG(3, "usb_set_interface() failed"); -+ -+ return err; -+} -+ -+ -+static int et61x251_stream_interrupt(struct et61x251_device* cam) -+{ -+ int err = 0; -+ -+ cam->stream = STREAM_INTERRUPT; -+ err = wait_event_timeout(cam->wait_stream, -+ (cam->stream == STREAM_OFF) || -+ (cam->state & DEV_DISCONNECTED), -+ ET61X251_URB_TIMEOUT); -+ if (cam->state & DEV_DISCONNECTED) -+ return -ENODEV; -+ else if (err) { -+ cam->state |= DEV_MISCONFIGURED; -+ DBG(1, "URB timeout reached. The camera is misconfigured. To " -+ "use it, close and open /dev/video%d again.", -+ cam->v4ldev->minor); -+ return err; -+ } -+ -+ return 0; -+} -+ -+/*****************************************************************************/ -+ -+#ifdef CONFIG_VIDEO_ADV_DEBUG -+static u8 et61x251_strtou8(const char* buff, size_t len, ssize_t* count) -+{ -+ char str[5]; -+ char* endp; -+ unsigned long val; -+ -+ if (len < 4) { -+ strncpy(str, buff, len); -+ str[len+1] = '\0'; -+ } else { -+ strncpy(str, buff, 4); -+ str[4] = '\0'; -+ } -+ -+ val = simple_strtoul(str, &endp, 0); -+ -+ *count = 0; -+ if (val <= 0xff) -+ *count = (ssize_t)(endp - str); -+ if ((*count) && (len == *count+1) && (buff[*count] == '\n')) -+ *count += 1; -+ -+ return (u8)val; -+} -+ -+/* -+ NOTE 1: being inside one of the following methods implies that the v4l -+ device exists for sure (see kobjects and reference counters) -+ NOTE 2: buffers are PAGE_SIZE long -+*/ -+ -+static ssize_t et61x251_show_reg(struct class_device* cd, char* buf) -+{ -+ struct et61x251_device* cam; -+ ssize_t count; -+ -+ if (down_interruptible(&et61x251_sysfs_lock)) -+ return -ERESTARTSYS; -+ -+ cam = video_get_drvdata(to_video_device(cd)); -+ if (!cam) { -+ up(&et61x251_sysfs_lock); -+ return -ENODEV; -+ } -+ -+ count = sprintf(buf, "%u\n", cam->sysfs.reg); -+ -+ up(&et61x251_sysfs_lock); -+ -+ return count; -+} -+ -+ -+static ssize_t -+et61x251_store_reg(struct class_device* cd, const char* buf, size_t len) -+{ -+ struct et61x251_device* cam; -+ u8 index; -+ ssize_t count; -+ -+ if (down_interruptible(&et61x251_sysfs_lock)) -+ return -ERESTARTSYS; -+ -+ cam = video_get_drvdata(to_video_device(cd)); -+ if (!cam) { -+ up(&et61x251_sysfs_lock); -+ return -ENODEV; -+ } -+ -+ index = et61x251_strtou8(buf, len, &count); -+ if (index > 0x8e || !count) { -+ up(&et61x251_sysfs_lock); -+ return -EINVAL; -+ } -+ -+ cam->sysfs.reg = index; -+ -+ DBG(2, "Moved ET61X[12]51 register index to 0x%02X", cam->sysfs.reg); -+ DBG(3, "Written bytes: %zd", count); -+ -+ up(&et61x251_sysfs_lock); -+ -+ return count; -+} -+ -+ -+static ssize_t et61x251_show_val(struct class_device* cd, char* buf) -+{ -+ struct et61x251_device* cam; -+ ssize_t count; -+ int val; -+ -+ if (down_interruptible(&et61x251_sysfs_lock)) -+ return -ERESTARTSYS; -+ -+ cam = video_get_drvdata(to_video_device(cd)); -+ if (!cam) { -+ up(&et61x251_sysfs_lock); -+ return -ENODEV; -+ } -+ -+ if ((val = et61x251_read_reg(cam, cam->sysfs.reg)) < 0) { -+ up(&et61x251_sysfs_lock); -+ return -EIO; -+ } -+ -+ count = sprintf(buf, "%d\n", val); -+ -+ DBG(3, "Read bytes: %zd", count); -+ -+ up(&et61x251_sysfs_lock); -+ -+ return count; -+} -+ -+ -+static ssize_t -+et61x251_store_val(struct class_device* cd, const char* buf, size_t len) -+{ -+ struct et61x251_device* cam; -+ u8 value; -+ ssize_t count; -+ int err; -+ -+ if (down_interruptible(&et61x251_sysfs_lock)) -+ return -ERESTARTSYS; -+ -+ cam = video_get_drvdata(to_video_device(cd)); -+ if (!cam) { -+ up(&et61x251_sysfs_lock); -+ return -ENODEV; -+ } -+ -+ value = et61x251_strtou8(buf, len, &count); -+ if (!count) { -+ up(&et61x251_sysfs_lock); -+ return -EINVAL; -+ } -+ -+ err = et61x251_write_reg(cam, value, cam->sysfs.reg); -+ if (err) { -+ up(&et61x251_sysfs_lock); -+ return -EIO; -+ } -+ -+ DBG(2, "Written ET61X[12]51 reg. 0x%02X, val. 0x%02X", -+ cam->sysfs.reg, value); -+ DBG(3, "Written bytes: %zd", count); -+ -+ up(&et61x251_sysfs_lock); -+ -+ return count; -+} -+ -+ -+static ssize_t et61x251_show_i2c_reg(struct class_device* cd, char* buf) -+{ -+ struct et61x251_device* cam; -+ ssize_t count; -+ -+ if (down_interruptible(&et61x251_sysfs_lock)) -+ return -ERESTARTSYS; -+ -+ cam = video_get_drvdata(to_video_device(cd)); -+ if (!cam) { -+ up(&et61x251_sysfs_lock); -+ return -ENODEV; -+ } -+ -+ count = sprintf(buf, "%u\n", cam->sysfs.i2c_reg); -+ -+ DBG(3, "Read bytes: %zd", count); -+ -+ up(&et61x251_sysfs_lock); -+ -+ return count; -+} -+ -+ -+static ssize_t -+et61x251_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) -+{ -+ struct et61x251_device* cam; -+ u8 index; -+ ssize_t count; -+ -+ if (down_interruptible(&et61x251_sysfs_lock)) -+ return -ERESTARTSYS; -+ -+ cam = video_get_drvdata(to_video_device(cd)); -+ if (!cam) { -+ up(&et61x251_sysfs_lock); -+ return -ENODEV; -+ } -+ -+ index = et61x251_strtou8(buf, len, &count); -+ if (!count) { -+ up(&et61x251_sysfs_lock); -+ return -EINVAL; -+ } -+ -+ cam->sysfs.i2c_reg = index; -+ -+ DBG(2, "Moved sensor register index to 0x%02X", cam->sysfs.i2c_reg); -+ DBG(3, "Written bytes: %zd", count); -+ -+ up(&et61x251_sysfs_lock); -+ -+ return count; -+} -+ -+ -+static ssize_t et61x251_show_i2c_val(struct class_device* cd, char* buf) -+{ -+ struct et61x251_device* cam; -+ ssize_t count; -+ int val; -+ -+ if (down_interruptible(&et61x251_sysfs_lock)) -+ return -ERESTARTSYS; -+ -+ cam = video_get_drvdata(to_video_device(cd)); -+ if (!cam) { -+ up(&et61x251_sysfs_lock); -+ return -ENODEV; -+ } -+ -+ if (!(cam->sensor->sysfs_ops & ET61X251_I2C_READ)) { -+ up(&et61x251_sysfs_lock); -+ return -ENOSYS; -+ } -+ -+ if ((val = et61x251_i2c_read(cam, cam->sysfs.i2c_reg)) < 0) { -+ up(&et61x251_sysfs_lock); -+ return -EIO; -+ } -+ -+ count = sprintf(buf, "%d\n", val); -+ -+ DBG(3, "Read bytes: %zd", count); -+ -+ up(&et61x251_sysfs_lock); -+ -+ return count; -+} -+ -+ -+static ssize_t -+et61x251_store_i2c_val(struct class_device* cd, const char* buf, size_t len) -+{ -+ struct et61x251_device* cam; -+ u8 value; -+ ssize_t count; -+ int err; -+ -+ if (down_interruptible(&et61x251_sysfs_lock)) -+ return -ERESTARTSYS; -+ -+ cam = video_get_drvdata(to_video_device(cd)); -+ if (!cam) { -+ up(&et61x251_sysfs_lock); -+ return -ENODEV; -+ } -+ -+ if (!(cam->sensor->sysfs_ops & ET61X251_I2C_READ)) { -+ up(&et61x251_sysfs_lock); -+ return -ENOSYS; -+ } -+ -+ value = et61x251_strtou8(buf, len, &count); -+ if (!count) { -+ up(&et61x251_sysfs_lock); -+ return -EINVAL; -+ } -+ -+ err = et61x251_i2c_write(cam, cam->sysfs.i2c_reg, value); -+ if (err) { -+ up(&et61x251_sysfs_lock); -+ return -EIO; -+ } -+ -+ DBG(2, "Written sensor reg. 0x%02X, val. 0x%02X", -+ cam->sysfs.i2c_reg, value); -+ DBG(3, "Written bytes: %zd", count); -+ -+ up(&et61x251_sysfs_lock); -+ -+ return count; -+} -+ -+ -+static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, -+ et61x251_show_reg, et61x251_store_reg); -+static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, -+ et61x251_show_val, et61x251_store_val); -+static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, -+ et61x251_show_i2c_reg, et61x251_store_i2c_reg); -+static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, -+ et61x251_show_i2c_val, et61x251_store_i2c_val); -+ -+ -+static void et61x251_create_sysfs(struct et61x251_device* cam) -+{ -+ struct video_device *v4ldev = cam->v4ldev; -+ -+ video_device_create_file(v4ldev, &class_device_attr_reg); -+ video_device_create_file(v4ldev, &class_device_attr_val); -+ if (cam->sensor && cam->sensor->sysfs_ops) { -+ video_device_create_file(v4ldev, &class_device_attr_i2c_reg); -+ video_device_create_file(v4ldev, &class_device_attr_i2c_val); -+ } -+} -+#endif /* CONFIG_VIDEO_ADV_DEBUG */ -+ -+/*****************************************************************************/ -+ -+static int -+et61x251_set_pix_format(struct et61x251_device* cam, -+ struct v4l2_pix_format* pix) -+{ -+ int r, err = 0; -+ -+ if ((r = et61x251_read_reg(cam, 0x12)) < 0) -+ err += r; -+ if (pix->pixelformat == V4L2_PIX_FMT_ET61X251) -+ err += et61x251_write_reg(cam, r & 0xfd, 0x12); -+ else -+ err += et61x251_write_reg(cam, r | 0x02, 0x12); -+ -+ return err ? -EIO : 0; -+} -+ -+ -+static int -+et61x251_set_compression(struct et61x251_device* cam, -+ struct v4l2_jpegcompression* compression) -+{ -+ int r, err = 0; -+ -+ if ((r = et61x251_read_reg(cam, 0x12)) < 0) -+ err += r; -+ if (compression->quality == 0) -+ err += et61x251_write_reg(cam, r & 0xfb, 0x12); -+ else -+ err += et61x251_write_reg(cam, r | 0x04, 0x12); -+ -+ return err ? -EIO : 0; -+} -+ -+ -+static int et61x251_set_scale(struct et61x251_device* cam, u8 scale) -+{ -+ int r = 0, err = 0; -+ -+ r = et61x251_read_reg(cam, 0x12); -+ if (r < 0) -+ err += r; -+ -+ if (scale == 1) -+ err += et61x251_write_reg(cam, r & ~0x01, 0x12); -+ else if (scale == 2) -+ err += et61x251_write_reg(cam, r | 0x01, 0x12); -+ -+ if (err) -+ return -EIO; -+ -+ PDBGG("Scaling factor: %u", scale); -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_set_crop(struct et61x251_device* cam, struct v4l2_rect* rect) -+{ -+ struct et61x251_sensor* s = cam->sensor; -+ u16 fmw_sx = (u16)(rect->left - s->cropcap.bounds.left + -+ s->active_pixel.left), -+ fmw_sy = (u16)(rect->top - s->cropcap.bounds.top + -+ s->active_pixel.top), -+ fmw_length = (u16)(rect->width), -+ fmw_height = (u16)(rect->height); -+ int err = 0; -+ -+ err += et61x251_write_reg(cam, fmw_sx & 0xff, 0x69); -+ err += et61x251_write_reg(cam, fmw_sy & 0xff, 0x6a); -+ err += et61x251_write_reg(cam, fmw_length & 0xff, 0x6b); -+ err += et61x251_write_reg(cam, fmw_height & 0xff, 0x6c); -+ err += et61x251_write_reg(cam, (fmw_sx >> 8) | ((fmw_sy & 0x300) >> 6) -+ | ((fmw_length & 0x300) >> 4) -+ | ((fmw_height & 0x300) >> 2), 0x6d); -+ if (err) -+ return -EIO; -+ -+ PDBGG("fmw_sx, fmw_sy, fmw_length, fmw_height: %u %u %u %u", -+ fmw_sx, fmw_sy, fmw_length, fmw_height); -+ -+ return 0; -+} -+ -+ -+static int et61x251_init(struct et61x251_device* cam) -+{ -+ struct et61x251_sensor* s = cam->sensor; -+ struct v4l2_control ctrl; -+ struct v4l2_queryctrl *qctrl; -+ struct v4l2_rect* rect; -+ u8 i = 0; -+ int err = 0; -+ -+ if (!(cam->state & DEV_INITIALIZED)) { -+ init_waitqueue_head(&cam->open); -+ qctrl = s->qctrl; -+ rect = &(s->cropcap.defrect); -+ cam->compression.quality = ET61X251_COMPRESSION_QUALITY; -+ } else { /* use current values */ -+ qctrl = s->_qctrl; -+ rect = &(s->_rect); -+ } -+ -+ err += et61x251_set_scale(cam, rect->width / s->pix_format.width); -+ err += et61x251_set_crop(cam, rect); -+ if (err) -+ return err; -+ -+ if (s->init) { -+ err = s->init(cam); -+ if (err) { -+ DBG(3, "Sensor initialization failed"); -+ return err; -+ } -+ } -+ -+ err += et61x251_set_compression(cam, &cam->compression); -+ err += et61x251_set_pix_format(cam, &s->pix_format); -+ if (s->set_pix_format) -+ err += s->set_pix_format(cam, &s->pix_format); -+ if (err) -+ return err; -+ -+ if (s->pix_format.pixelformat == V4L2_PIX_FMT_ET61X251) -+ DBG(3, "Compressed video format is active, quality %d", -+ cam->compression.quality); -+ else -+ DBG(3, "Uncompressed video format is active"); -+ -+ if (s->set_crop) -+ if ((err = s->set_crop(cam, rect))) { -+ DBG(3, "set_crop() failed"); -+ return err; -+ } -+ -+ if (s->set_ctrl) { -+ for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) -+ if (s->qctrl[i].id != 0 && -+ !(s->qctrl[i].flags & V4L2_CTRL_FLAG_DISABLED)) { -+ ctrl.id = s->qctrl[i].id; -+ ctrl.value = qctrl[i].default_value; -+ err = s->set_ctrl(cam, &ctrl); -+ if (err) { -+ DBG(3, "Set %s control failed", -+ s->qctrl[i].name); -+ return err; -+ } -+ DBG(3, "Image sensor supports '%s' control", -+ s->qctrl[i].name); -+ } -+ } -+ -+ if (!(cam->state & DEV_INITIALIZED)) { -+ init_MUTEX(&cam->fileop_sem); -+ spin_lock_init(&cam->queue_lock); -+ init_waitqueue_head(&cam->wait_frame); -+ init_waitqueue_head(&cam->wait_stream); -+ cam->nreadbuffers = 2; -+ memcpy(s->_qctrl, s->qctrl, sizeof(s->qctrl)); -+ memcpy(&(s->_rect), &(s->cropcap.defrect), -+ sizeof(struct v4l2_rect)); -+ cam->state |= DEV_INITIALIZED; -+ } -+ -+ DBG(2, "Initialization succeeded"); -+ return 0; -+} -+ -+ -+static void et61x251_release_resources(struct et61x251_device* cam) -+{ -+ down(&et61x251_sysfs_lock); -+ -+ DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); -+ video_set_drvdata(cam->v4ldev, NULL); -+ video_unregister_device(cam->v4ldev); -+ -+ up(&et61x251_sysfs_lock); -+ -+ kfree(cam->control_buffer); -+} -+ -+/*****************************************************************************/ -+ -+static int et61x251_open(struct inode* inode, struct file* filp) -+{ -+ struct et61x251_device* cam; -+ int err = 0; -+ -+ /* -+ This is the only safe way to prevent race conditions with -+ disconnect -+ */ -+ if (!down_read_trylock(&et61x251_disconnect)) -+ return -ERESTARTSYS; -+ -+ cam = video_get_drvdata(video_devdata(filp)); -+ -+ if (down_interruptible(&cam->dev_sem)) { -+ up_read(&et61x251_disconnect); -+ return -ERESTARTSYS; -+ } -+ -+ if (cam->users) { -+ DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->minor); -+ if ((filp->f_flags & O_NONBLOCK) || -+ (filp->f_flags & O_NDELAY)) { -+ err = -EWOULDBLOCK; -+ goto out; -+ } -+ up(&cam->dev_sem); -+ err = wait_event_interruptible_exclusive(cam->open, -+ cam->state & DEV_DISCONNECTED -+ || !cam->users); -+ if (err) { -+ up_read(&et61x251_disconnect); -+ return err; -+ } -+ if (cam->state & DEV_DISCONNECTED) { -+ up_read(&et61x251_disconnect); -+ return -ENODEV; -+ } -+ down(&cam->dev_sem); -+ } -+ -+ -+ if (cam->state & DEV_MISCONFIGURED) { -+ err = et61x251_init(cam); -+ if (err) { -+ DBG(1, "Initialization failed again. " -+ "I will retry on next open()."); -+ goto out; -+ } -+ cam->state &= ~DEV_MISCONFIGURED; -+ } -+ -+ if ((err = et61x251_start_transfer(cam))) -+ goto out; -+ -+ filp->private_data = cam; -+ cam->users++; -+ cam->io = IO_NONE; -+ cam->stream = STREAM_OFF; -+ cam->nbuffers = 0; -+ cam->frame_count = 0; -+ et61x251_empty_framequeues(cam); -+ -+ DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); -+ -+out: -+ up(&cam->dev_sem); -+ up_read(&et61x251_disconnect); -+ return err; -+} -+ -+ -+static int et61x251_release(struct inode* inode, struct file* filp) -+{ -+ struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); -+ -+ down(&cam->dev_sem); /* prevent disconnect() to be called */ -+ -+ et61x251_stop_transfer(cam); -+ -+ et61x251_release_buffers(cam); -+ -+ if (cam->state & DEV_DISCONNECTED) { -+ et61x251_release_resources(cam); -+ up(&cam->dev_sem); -+ kfree(cam); -+ return 0; -+ } -+ -+ cam->users--; -+ wake_up_interruptible_nr(&cam->open, 1); -+ -+ DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); -+ -+ up(&cam->dev_sem); -+ -+ return 0; -+} -+ -+ -+static ssize_t -+et61x251_read(struct file* filp, char __user * buf, -+ size_t count, loff_t* f_pos) -+{ -+ struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); -+ struct et61x251_frame_t* f, * i; -+ unsigned long lock_flags; -+ int err = 0; -+ -+ if (down_interruptible(&cam->fileop_sem)) -+ return -ERESTARTSYS; -+ -+ if (cam->state & DEV_DISCONNECTED) { -+ DBG(1, "Device not present"); -+ up(&cam->fileop_sem); -+ return -ENODEV; -+ } -+ -+ if (cam->state & DEV_MISCONFIGURED) { -+ DBG(1, "The camera is misconfigured. Close and open it " -+ "again."); -+ up(&cam->fileop_sem); -+ return -EIO; -+ } -+ -+ if (cam->io == IO_MMAP) { -+ DBG(3, "Close and open the device again to choose the read " -+ "method"); -+ up(&cam->fileop_sem); -+ return -EINVAL; -+ } -+ -+ if (cam->io == IO_NONE) { -+ if (!et61x251_request_buffers(cam, cam->nreadbuffers, -+ IO_READ)) { -+ DBG(1, "read() failed, not enough memory"); -+ up(&cam->fileop_sem); -+ return -ENOMEM; -+ } -+ cam->io = IO_READ; -+ cam->stream = STREAM_ON; -+ } -+ -+ if (list_empty(&cam->inqueue)) { -+ if (!list_empty(&cam->outqueue)) -+ et61x251_empty_framequeues(cam); -+ et61x251_queue_unusedframes(cam); -+ } -+ -+ if (!count) { -+ up(&cam->fileop_sem); -+ return 0; -+ } -+ -+ if (list_empty(&cam->outqueue)) { -+ if (filp->f_flags & O_NONBLOCK) { -+ up(&cam->fileop_sem); -+ return -EAGAIN; -+ } -+ err = wait_event_interruptible -+ ( cam->wait_frame, -+ (!list_empty(&cam->outqueue)) || -+ (cam->state & DEV_DISCONNECTED) || -+ (cam->state & DEV_MISCONFIGURED) ); -+ if (err) { -+ up(&cam->fileop_sem); -+ return err; -+ } -+ if (cam->state & DEV_DISCONNECTED) { -+ up(&cam->fileop_sem); -+ return -ENODEV; -+ } -+ if (cam->state & DEV_MISCONFIGURED) { -+ up(&cam->fileop_sem); -+ return -EIO; -+ } -+ } -+ -+ f = list_entry(cam->outqueue.prev, struct et61x251_frame_t, frame); -+ -+ if (count > f->buf.bytesused) -+ count = f->buf.bytesused; -+ -+ if (copy_to_user(buf, f->bufmem, count)) { -+ err = -EFAULT; -+ goto exit; -+ } -+ *f_pos += count; -+ -+exit: -+ spin_lock_irqsave(&cam->queue_lock, lock_flags); -+ list_for_each_entry(i, &cam->outqueue, frame) -+ i->state = F_UNUSED; -+ INIT_LIST_HEAD(&cam->outqueue); -+ spin_unlock_irqrestore(&cam->queue_lock, lock_flags); -+ -+ et61x251_queue_unusedframes(cam); -+ -+ PDBGG("Frame #%lu, bytes read: %zu", -+ (unsigned long)f->buf.index, count); -+ -+ up(&cam->fileop_sem); -+ -+ return err ? err : count; -+} -+ -+ -+static unsigned int et61x251_poll(struct file *filp, poll_table *wait) -+{ -+ struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); -+ struct et61x251_frame_t* f; -+ unsigned long lock_flags; -+ unsigned int mask = 0; -+ -+ if (down_interruptible(&cam->fileop_sem)) -+ return POLLERR; -+ -+ if (cam->state & DEV_DISCONNECTED) { -+ DBG(1, "Device not present"); -+ goto error; -+ } -+ -+ if (cam->state & DEV_MISCONFIGURED) { -+ DBG(1, "The camera is misconfigured. Close and open it " -+ "again."); -+ goto error; -+ } -+ -+ if (cam->io == IO_NONE) { -+ if (!et61x251_request_buffers(cam, cam->nreadbuffers, -+ IO_READ)) { -+ DBG(1, "poll() failed, not enough memory"); -+ goto error; -+ } -+ cam->io = IO_READ; -+ cam->stream = STREAM_ON; -+ } -+ -+ if (cam->io == IO_READ) { -+ spin_lock_irqsave(&cam->queue_lock, lock_flags); -+ list_for_each_entry(f, &cam->outqueue, frame) -+ f->state = F_UNUSED; -+ INIT_LIST_HEAD(&cam->outqueue); -+ spin_unlock_irqrestore(&cam->queue_lock, lock_flags); -+ et61x251_queue_unusedframes(cam); -+ } -+ -+ poll_wait(filp, &cam->wait_frame, wait); -+ -+ if (!list_empty(&cam->outqueue)) -+ mask |= POLLIN | POLLRDNORM; -+ -+ up(&cam->fileop_sem); -+ -+ return mask; -+ -+error: -+ up(&cam->fileop_sem); -+ return POLLERR; -+} -+ -+ -+static void et61x251_vm_open(struct vm_area_struct* vma) -+{ -+ struct et61x251_frame_t* f = vma->vm_private_data; -+ f->vma_use_count++; -+} -+ -+ -+static void et61x251_vm_close(struct vm_area_struct* vma) -+{ -+ /* NOTE: buffers are not freed here */ -+ struct et61x251_frame_t* f = vma->vm_private_data; -+ f->vma_use_count--; -+} -+ -+ -+static struct vm_operations_struct et61x251_vm_ops = { -+ .open = et61x251_vm_open, -+ .close = et61x251_vm_close, -+}; -+ -+ -+static int et61x251_mmap(struct file* filp, struct vm_area_struct *vma) -+{ -+ struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); -+ unsigned long size = vma->vm_end - vma->vm_start, -+ start = vma->vm_start; -+ void *pos; -+ u32 i; -+ -+ if (down_interruptible(&cam->fileop_sem)) -+ return -ERESTARTSYS; -+ -+ if (cam->state & DEV_DISCONNECTED) { -+ DBG(1, "Device not present"); -+ up(&cam->fileop_sem); -+ return -ENODEV; -+ } -+ -+ if (cam->state & DEV_MISCONFIGURED) { -+ DBG(1, "The camera is misconfigured. Close and open it " -+ "again."); -+ up(&cam->fileop_sem); -+ return -EIO; -+ } -+ -+ if (cam->io != IO_MMAP || !(vma->vm_flags & VM_WRITE) || -+ size != PAGE_ALIGN(cam->frame[0].buf.length)) { -+ up(&cam->fileop_sem); -+ return -EINVAL; -+ } -+ -+ for (i = 0; i < cam->nbuffers; i++) { -+ if ((cam->frame[i].buf.m.offset>>PAGE_SHIFT) == vma->vm_pgoff) -+ break; -+ } -+ if (i == cam->nbuffers) { -+ up(&cam->fileop_sem); -+ return -EINVAL; -+ } -+ -+ vma->vm_flags |= VM_IO; -+ vma->vm_flags |= VM_RESERVED; -+ -+ pos = cam->frame[i].bufmem; -+ while (size > 0) { /* size is page-aligned */ -+ if (vm_insert_page(vma, start, vmalloc_to_page(pos))) { -+ up(&cam->fileop_sem); -+ return -EAGAIN; -+ } -+ start += PAGE_SIZE; -+ pos += PAGE_SIZE; -+ size -= PAGE_SIZE; -+ } -+ -+ vma->vm_ops = &et61x251_vm_ops; -+ vma->vm_private_data = &cam->frame[i]; -+ -+ et61x251_vm_open(vma); -+ -+ up(&cam->fileop_sem); -+ -+ return 0; -+} -+ -+/*****************************************************************************/ -+ -+static int -+et61x251_vidioc_querycap(struct et61x251_device* cam, void __user * arg) -+{ -+ struct v4l2_capability cap = { -+ .driver = "et61x251", -+ .version = ET61X251_MODULE_VERSION_CODE, -+ .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | -+ V4L2_CAP_STREAMING, -+ }; -+ -+ strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); -+ if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) -+ strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, -+ sizeof(cap.bus_info)); -+ -+ if (copy_to_user(arg, &cap, sizeof(cap))) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_enuminput(struct et61x251_device* cam, void __user * arg) -+{ -+ struct v4l2_input i; -+ -+ if (copy_from_user(&i, arg, sizeof(i))) -+ return -EFAULT; -+ -+ if (i.index) -+ return -EINVAL; -+ -+ memset(&i, 0, sizeof(i)); -+ strcpy(i.name, "Camera"); -+ -+ if (copy_to_user(arg, &i, sizeof(i))) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_gs_input(struct et61x251_device* cam, void __user * arg) -+{ -+ int index; -+ -+ if (copy_from_user(&index, arg, sizeof(index))) -+ return -EFAULT; -+ -+ if (index != 0) -+ return -EINVAL; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_query_ctrl(struct et61x251_device* cam, void __user * arg) -+{ -+ struct et61x251_sensor* s = cam->sensor; -+ struct v4l2_queryctrl qc; -+ u8 i; -+ -+ if (copy_from_user(&qc, arg, sizeof(qc))) -+ return -EFAULT; -+ -+ for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) -+ if (qc.id && qc.id == s->qctrl[i].id) { -+ memcpy(&qc, &(s->qctrl[i]), sizeof(qc)); -+ if (copy_to_user(arg, &qc, sizeof(qc))) -+ return -EFAULT; -+ return 0; -+ } -+ -+ return -EINVAL; -+} -+ -+ -+static int -+et61x251_vidioc_g_ctrl(struct et61x251_device* cam, void __user * arg) -+{ -+ struct et61x251_sensor* s = cam->sensor; -+ struct v4l2_control ctrl; -+ int err = 0; -+ u8 i; -+ -+ if (!s->get_ctrl && !s->set_ctrl) -+ return -EINVAL; -+ -+ if (copy_from_user(&ctrl, arg, sizeof(ctrl))) -+ return -EFAULT; -+ -+ if (!s->get_ctrl) { -+ for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) -+ if (ctrl.id == s->qctrl[i].id) { -+ ctrl.value = s->_qctrl[i].default_value; -+ goto exit; -+ } -+ return -EINVAL; -+ } else -+ err = s->get_ctrl(cam, &ctrl); -+ -+exit: -+ if (copy_to_user(arg, &ctrl, sizeof(ctrl))) -+ return -EFAULT; -+ -+ return err; -+} -+ -+ -+static int -+et61x251_vidioc_s_ctrl(struct et61x251_device* cam, void __user * arg) -+{ -+ struct et61x251_sensor* s = cam->sensor; -+ struct v4l2_control ctrl; -+ u8 i; -+ int err = 0; -+ -+ if (!s->set_ctrl) -+ return -EINVAL; -+ -+ if (copy_from_user(&ctrl, arg, sizeof(ctrl))) -+ return -EFAULT; -+ -+ for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) -+ if (ctrl.id == s->qctrl[i].id) { -+ if (ctrl.value < s->qctrl[i].minimum || -+ ctrl.value > s->qctrl[i].maximum) -+ return -ERANGE; -+ ctrl.value -= ctrl.value % s->qctrl[i].step; -+ break; -+ } -+ -+ if ((err = s->set_ctrl(cam, &ctrl))) -+ return err; -+ -+ s->_qctrl[i].default_value = ctrl.value; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_cropcap(struct et61x251_device* cam, void __user * arg) -+{ -+ struct v4l2_cropcap* cc = &(cam->sensor->cropcap); -+ -+ cc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ cc->pixelaspect.numerator = 1; -+ cc->pixelaspect.denominator = 1; -+ -+ if (copy_to_user(arg, cc, sizeof(*cc))) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_g_crop(struct et61x251_device* cam, void __user * arg) -+{ -+ struct et61x251_sensor* s = cam->sensor; -+ struct v4l2_crop crop = { -+ .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, -+ }; -+ -+ memcpy(&(crop.c), &(s->_rect), sizeof(struct v4l2_rect)); -+ -+ if (copy_to_user(arg, &crop, sizeof(crop))) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_s_crop(struct et61x251_device* cam, void __user * arg) -+{ -+ struct et61x251_sensor* s = cam->sensor; -+ struct v4l2_crop crop; -+ struct v4l2_rect* rect; -+ struct v4l2_rect* bounds = &(s->cropcap.bounds); -+ struct v4l2_pix_format* pix_format = &(s->pix_format); -+ u8 scale; -+ const enum et61x251_stream_state stream = cam->stream; -+ const u32 nbuffers = cam->nbuffers; -+ u32 i; -+ int err = 0; -+ -+ if (copy_from_user(&crop, arg, sizeof(crop))) -+ return -EFAULT; -+ -+ rect = &(crop.c); -+ -+ if (crop.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; -+ -+ if (cam->module_param.force_munmap) -+ for (i = 0; i < cam->nbuffers; i++) -+ if (cam->frame[i].vma_use_count) { -+ DBG(3, "VIDIOC_S_CROP failed. " -+ "Unmap the buffers first."); -+ return -EINVAL; -+ } -+ -+ /* Preserve R,G or B origin */ -+ rect->left = (s->_rect.left & 1L) ? rect->left | 1L : rect->left & ~1L; -+ rect->top = (s->_rect.top & 1L) ? rect->top | 1L : rect->top & ~1L; -+ -+ if (rect->width < 4) -+ rect->width = 4; -+ if (rect->height < 4) -+ rect->height = 4; -+ if (rect->width > bounds->width) -+ rect->width = bounds->width; -+ if (rect->height > bounds->height) -+ rect->height = bounds->height; -+ if (rect->left < bounds->left) -+ rect->left = bounds->left; -+ if (rect->top < bounds->top) -+ rect->top = bounds->top; -+ if (rect->left + rect->width > bounds->left + bounds->width) -+ rect->left = bounds->left+bounds->width - rect->width; -+ if (rect->top + rect->height > bounds->top + bounds->height) -+ rect->top = bounds->top+bounds->height - rect->height; -+ -+ rect->width &= ~3L; -+ rect->height &= ~3L; -+ -+ if (ET61X251_PRESERVE_IMGSCALE) { -+ /* Calculate the actual scaling factor */ -+ u32 a, b; -+ a = rect->width * rect->height; -+ b = pix_format->width * pix_format->height; -+ scale = b ? (u8)((a / b) < 4 ? 1 : 2) : 1; -+ } else -+ scale = 1; -+ -+ if (cam->stream == STREAM_ON) -+ if ((err = et61x251_stream_interrupt(cam))) -+ return err; -+ -+ if (copy_to_user(arg, &crop, sizeof(crop))) { -+ cam->stream = stream; -+ return -EFAULT; -+ } -+ -+ if (cam->module_param.force_munmap || cam->io == IO_READ) -+ et61x251_release_buffers(cam); -+ -+ err = et61x251_set_crop(cam, rect); -+ if (s->set_crop) -+ err += s->set_crop(cam, rect); -+ err += et61x251_set_scale(cam, scale); -+ -+ if (err) { /* atomic, no rollback in ioctl() */ -+ cam->state |= DEV_MISCONFIGURED; -+ DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To " -+ "use the camera, close and open /dev/video%d again.", -+ cam->v4ldev->minor); -+ return -EIO; -+ } -+ -+ s->pix_format.width = rect->width/scale; -+ s->pix_format.height = rect->height/scale; -+ memcpy(&(s->_rect), rect, sizeof(*rect)); -+ -+ if ((cam->module_param.force_munmap || cam->io == IO_READ) && -+ nbuffers != et61x251_request_buffers(cam, nbuffers, cam->io)) { -+ cam->state |= DEV_MISCONFIGURED; -+ DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To " -+ "use the camera, close and open /dev/video%d again.", -+ cam->v4ldev->minor); -+ return -ENOMEM; -+ } -+ -+ if (cam->io == IO_READ) -+ et61x251_empty_framequeues(cam); -+ else if (cam->module_param.force_munmap) -+ et61x251_requeue_outqueue(cam); -+ -+ cam->stream = stream; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_enum_fmt(struct et61x251_device* cam, void __user * arg) -+{ -+ struct v4l2_fmtdesc fmtd; -+ -+ if (copy_from_user(&fmtd, arg, sizeof(fmtd))) -+ return -EFAULT; -+ -+ if (fmtd.index == 0) { -+ strcpy(fmtd.description, "bayer rgb"); -+ fmtd.pixelformat = V4L2_PIX_FMT_SBGGR8; -+ } else if (fmtd.index == 1) { -+ strcpy(fmtd.description, "compressed"); -+ fmtd.pixelformat = V4L2_PIX_FMT_ET61X251; -+ fmtd.flags = V4L2_FMT_FLAG_COMPRESSED; -+ } else -+ return -EINVAL; -+ -+ fmtd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ memset(&fmtd.reserved, 0, sizeof(fmtd.reserved)); -+ -+ if (copy_to_user(arg, &fmtd, sizeof(fmtd))) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg) -+{ -+ struct v4l2_format format; -+ struct v4l2_pix_format* pfmt = &(cam->sensor->pix_format); -+ -+ if (copy_from_user(&format, arg, sizeof(format))) -+ return -EFAULT; -+ -+ if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; -+ -+ pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251) -+ ? 0 : (pfmt->width * pfmt->priv) / 8; -+ pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); -+ pfmt->field = V4L2_FIELD_NONE; -+ memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); -+ -+ if (copy_to_user(arg, &format, sizeof(format))) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, -+ void __user * arg) -+{ -+ struct et61x251_sensor* s = cam->sensor; -+ struct v4l2_format format; -+ struct v4l2_pix_format* pix; -+ struct v4l2_pix_format* pfmt = &(s->pix_format); -+ struct v4l2_rect* bounds = &(s->cropcap.bounds); -+ struct v4l2_rect rect; -+ u8 scale; -+ const enum et61x251_stream_state stream = cam->stream; -+ const u32 nbuffers = cam->nbuffers; -+ u32 i; -+ int err = 0; -+ -+ if (copy_from_user(&format, arg, sizeof(format))) -+ return -EFAULT; -+ -+ pix = &(format.fmt.pix); -+ -+ if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; -+ -+ memcpy(&rect, &(s->_rect), sizeof(rect)); -+ -+ { /* calculate the actual scaling factor */ -+ u32 a, b; -+ a = rect.width * rect.height; -+ b = pix->width * pix->height; -+ scale = b ? (u8)((a / b) < 4 ? 1 : 2) : 1; -+ } -+ -+ rect.width = scale * pix->width; -+ rect.height = scale * pix->height; -+ -+ if (rect.width < 4) -+ rect.width = 4; -+ if (rect.height < 4) -+ rect.height = 4; -+ if (rect.width > bounds->left + bounds->width - rect.left) -+ rect.width = bounds->left + bounds->width - rect.left; -+ if (rect.height > bounds->top + bounds->height - rect.top) -+ rect.height = bounds->top + bounds->height - rect.top; -+ -+ rect.width &= ~3L; -+ rect.height &= ~3L; -+ -+ { /* adjust the scaling factor */ -+ u32 a, b; -+ a = rect.width * rect.height; -+ b = pix->width * pix->height; -+ scale = b ? (u8)((a / b) < 4 ? 1 : 2) : 1; -+ } -+ -+ pix->width = rect.width / scale; -+ pix->height = rect.height / scale; -+ -+ if (pix->pixelformat != V4L2_PIX_FMT_ET61X251 && -+ pix->pixelformat != V4L2_PIX_FMT_SBGGR8) -+ pix->pixelformat = pfmt->pixelformat; -+ pix->priv = pfmt->priv; /* bpp */ -+ pix->colorspace = pfmt->colorspace; -+ pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251) -+ ? 0 : (pix->width * pix->priv) / 8; -+ pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); -+ pix->field = V4L2_FIELD_NONE; -+ -+ if (cmd == VIDIOC_TRY_FMT) { -+ if (copy_to_user(arg, &format, sizeof(format))) -+ return -EFAULT; -+ return 0; -+ } -+ -+ if (cam->module_param.force_munmap) -+ for (i = 0; i < cam->nbuffers; i++) -+ if (cam->frame[i].vma_use_count) { -+ DBG(3, "VIDIOC_S_FMT failed. " -+ "Unmap the buffers first."); -+ return -EINVAL; -+ } -+ -+ if (cam->stream == STREAM_ON) -+ if ((err = et61x251_stream_interrupt(cam))) -+ return err; -+ -+ if (copy_to_user(arg, &format, sizeof(format))) { -+ cam->stream = stream; -+ return -EFAULT; -+ } -+ -+ if (cam->module_param.force_munmap || cam->io == IO_READ) -+ et61x251_release_buffers(cam); -+ -+ err += et61x251_set_pix_format(cam, pix); -+ err += et61x251_set_crop(cam, &rect); -+ if (s->set_pix_format) -+ err += s->set_pix_format(cam, pix); -+ if (s->set_crop) -+ err += s->set_crop(cam, &rect); -+ err += et61x251_set_scale(cam, scale); -+ -+ if (err) { /* atomic, no rollback in ioctl() */ -+ cam->state |= DEV_MISCONFIGURED; -+ DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To " -+ "use the camera, close and open /dev/video%d again.", -+ cam->v4ldev->minor); -+ return -EIO; -+ } -+ -+ memcpy(pfmt, pix, sizeof(*pix)); -+ memcpy(&(s->_rect), &rect, sizeof(rect)); -+ -+ if ((cam->module_param.force_munmap || cam->io == IO_READ) && -+ nbuffers != et61x251_request_buffers(cam, nbuffers, cam->io)) { -+ cam->state |= DEV_MISCONFIGURED; -+ DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To " -+ "use the camera, close and open /dev/video%d again.", -+ cam->v4ldev->minor); -+ return -ENOMEM; -+ } -+ -+ if (cam->io == IO_READ) -+ et61x251_empty_framequeues(cam); -+ else if (cam->module_param.force_munmap) -+ et61x251_requeue_outqueue(cam); -+ -+ cam->stream = stream; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_g_jpegcomp(struct et61x251_device* cam, void __user * arg) -+{ -+ if (copy_to_user(arg, &cam->compression, -+ sizeof(cam->compression))) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_s_jpegcomp(struct et61x251_device* cam, void __user * arg) -+{ -+ struct v4l2_jpegcompression jc; -+ const enum et61x251_stream_state stream = cam->stream; -+ int err = 0; -+ -+ if (copy_from_user(&jc, arg, sizeof(jc))) -+ return -EFAULT; -+ -+ if (jc.quality != 0 && jc.quality != 1) -+ return -EINVAL; -+ -+ if (cam->stream == STREAM_ON) -+ if ((err = et61x251_stream_interrupt(cam))) -+ return err; -+ -+ err += et61x251_set_compression(cam, &jc); -+ if (err) { /* atomic, no rollback in ioctl() */ -+ cam->state |= DEV_MISCONFIGURED; -+ DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware " -+ "problems. To use the camera, close and open " -+ "/dev/video%d again.", cam->v4ldev->minor); -+ return -EIO; -+ } -+ -+ cam->compression.quality = jc.quality; -+ -+ cam->stream = stream; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_reqbufs(struct et61x251_device* cam, void __user * arg) -+{ -+ struct v4l2_requestbuffers rb; -+ u32 i; -+ int err; -+ -+ if (copy_from_user(&rb, arg, sizeof(rb))) -+ return -EFAULT; -+ -+ if (rb.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || -+ rb.memory != V4L2_MEMORY_MMAP) -+ return -EINVAL; -+ -+ if (cam->io == IO_READ) { -+ DBG(3, "Close and open the device again to choose the mmap " -+ "I/O method"); -+ return -EINVAL; -+ } -+ -+ for (i = 0; i < cam->nbuffers; i++) -+ if (cam->frame[i].vma_use_count) { -+ DBG(3, "VIDIOC_REQBUFS failed. " -+ "Previous buffers are still mapped."); -+ return -EINVAL; -+ } -+ -+ if (cam->stream == STREAM_ON) -+ if ((err = et61x251_stream_interrupt(cam))) -+ return err; -+ -+ et61x251_empty_framequeues(cam); -+ -+ et61x251_release_buffers(cam); -+ if (rb.count) -+ rb.count = et61x251_request_buffers(cam, rb.count, IO_MMAP); -+ -+ if (copy_to_user(arg, &rb, sizeof(rb))) { -+ et61x251_release_buffers(cam); -+ cam->io = IO_NONE; -+ return -EFAULT; -+ } -+ -+ cam->io = rb.count ? IO_MMAP : IO_NONE; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_querybuf(struct et61x251_device* cam, void __user * arg) -+{ -+ struct v4l2_buffer b; -+ -+ if (copy_from_user(&b, arg, sizeof(b))) -+ return -EFAULT; -+ -+ if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || -+ b.index >= cam->nbuffers || cam->io != IO_MMAP) -+ return -EINVAL; -+ -+ memcpy(&b, &cam->frame[b.index].buf, sizeof(b)); -+ -+ if (cam->frame[b.index].vma_use_count) -+ b.flags |= V4L2_BUF_FLAG_MAPPED; -+ -+ if (cam->frame[b.index].state == F_DONE) -+ b.flags |= V4L2_BUF_FLAG_DONE; -+ else if (cam->frame[b.index].state != F_UNUSED) -+ b.flags |= V4L2_BUF_FLAG_QUEUED; -+ -+ if (copy_to_user(arg, &b, sizeof(b))) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_qbuf(struct et61x251_device* cam, void __user * arg) -+{ -+ struct v4l2_buffer b; -+ unsigned long lock_flags; -+ -+ if (copy_from_user(&b, arg, sizeof(b))) -+ return -EFAULT; -+ -+ if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || -+ b.index >= cam->nbuffers || cam->io != IO_MMAP) -+ return -EINVAL; -+ -+ if (cam->frame[b.index].state != F_UNUSED) -+ return -EINVAL; -+ -+ cam->frame[b.index].state = F_QUEUED; -+ -+ spin_lock_irqsave(&cam->queue_lock, lock_flags); -+ list_add_tail(&cam->frame[b.index].frame, &cam->inqueue); -+ spin_unlock_irqrestore(&cam->queue_lock, lock_flags); -+ -+ PDBGG("Frame #%lu queued", (unsigned long)b.index); -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp, -+ void __user * arg) -+{ -+ struct v4l2_buffer b; -+ struct et61x251_frame_t *f; -+ unsigned long lock_flags; -+ int err = 0; -+ -+ if (copy_from_user(&b, arg, sizeof(b))) -+ return -EFAULT; -+ -+ if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io!= IO_MMAP) -+ return -EINVAL; -+ -+ if (list_empty(&cam->outqueue)) { -+ if (cam->stream == STREAM_OFF) -+ return -EINVAL; -+ if (filp->f_flags & O_NONBLOCK) -+ return -EAGAIN; -+ err = wait_event_interruptible -+ ( cam->wait_frame, -+ (!list_empty(&cam->outqueue)) || -+ (cam->state & DEV_DISCONNECTED) || -+ (cam->state & DEV_MISCONFIGURED) ); -+ if (err) -+ return err; -+ if (cam->state & DEV_DISCONNECTED) -+ return -ENODEV; -+ if (cam->state & DEV_MISCONFIGURED) -+ return -EIO; -+ } -+ -+ spin_lock_irqsave(&cam->queue_lock, lock_flags); -+ f = list_entry(cam->outqueue.next, struct et61x251_frame_t, frame); -+ list_del(cam->outqueue.next); -+ spin_unlock_irqrestore(&cam->queue_lock, lock_flags); -+ -+ f->state = F_UNUSED; -+ -+ memcpy(&b, &f->buf, sizeof(b)); -+ if (f->vma_use_count) -+ b.flags |= V4L2_BUF_FLAG_MAPPED; -+ -+ if (copy_to_user(arg, &b, sizeof(b))) -+ return -EFAULT; -+ -+ PDBGG("Frame #%lu dequeued", (unsigned long)f->buf.index); -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_streamon(struct et61x251_device* cam, void __user * arg) -+{ -+ int type; -+ -+ if (copy_from_user(&type, arg, sizeof(type))) -+ return -EFAULT; -+ -+ if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) -+ return -EINVAL; -+ -+ if (list_empty(&cam->inqueue)) -+ return -EINVAL; -+ -+ cam->stream = STREAM_ON; -+ -+ DBG(3, "Stream on"); -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_streamoff(struct et61x251_device* cam, void __user * arg) -+{ -+ int type, err; -+ -+ if (copy_from_user(&type, arg, sizeof(type))) -+ return -EFAULT; -+ -+ if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) -+ return -EINVAL; -+ -+ if (cam->stream == STREAM_ON) -+ if ((err = et61x251_stream_interrupt(cam))) -+ return err; -+ -+ et61x251_empty_framequeues(cam); -+ -+ DBG(3, "Stream off"); -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_g_parm(struct et61x251_device* cam, void __user * arg) -+{ -+ struct v4l2_streamparm sp; -+ -+ if (copy_from_user(&sp, arg, sizeof(sp))) -+ return -EFAULT; -+ -+ if (sp.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; -+ -+ sp.parm.capture.extendedmode = 0; -+ sp.parm.capture.readbuffers = cam->nreadbuffers; -+ -+ if (copy_to_user(arg, &sp, sizeof(sp))) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+ -+static int -+et61x251_vidioc_s_parm(struct et61x251_device* cam, void __user * arg) -+{ -+ struct v4l2_streamparm sp; -+ -+ if (copy_from_user(&sp, arg, sizeof(sp))) -+ return -EFAULT; -+ -+ if (sp.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; -+ -+ sp.parm.capture.extendedmode = 0; -+ -+ if (sp.parm.capture.readbuffers == 0) -+ sp.parm.capture.readbuffers = cam->nreadbuffers; -+ -+ if (sp.parm.capture.readbuffers > ET61X251_MAX_FRAMES) -+ sp.parm.capture.readbuffers = ET61X251_MAX_FRAMES; -+ -+ if (copy_to_user(arg, &sp, sizeof(sp))) -+ return -EFAULT; -+ -+ cam->nreadbuffers = sp.parm.capture.readbuffers; -+ -+ return 0; -+} -+ -+ -+static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, -+ unsigned int cmd, void __user * arg) -+{ -+ struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); -+ -+ switch (cmd) { -+ -+ case VIDIOC_QUERYCAP: -+ return et61x251_vidioc_querycap(cam, arg); -+ -+ case VIDIOC_ENUMINPUT: -+ return et61x251_vidioc_enuminput(cam, arg); -+ -+ case VIDIOC_G_INPUT: -+ case VIDIOC_S_INPUT: -+ return et61x251_vidioc_gs_input(cam, arg); -+ -+ case VIDIOC_QUERYCTRL: -+ return et61x251_vidioc_query_ctrl(cam, arg); -+ -+ case VIDIOC_G_CTRL: -+ return et61x251_vidioc_g_ctrl(cam, arg); -+ -+ case VIDIOC_S_CTRL_OLD: -+ case VIDIOC_S_CTRL: -+ return et61x251_vidioc_s_ctrl(cam, arg); -+ -+ case VIDIOC_CROPCAP_OLD: -+ case VIDIOC_CROPCAP: -+ return et61x251_vidioc_cropcap(cam, arg); -+ -+ case VIDIOC_G_CROP: -+ return et61x251_vidioc_g_crop(cam, arg); -+ -+ case VIDIOC_S_CROP: -+ return et61x251_vidioc_s_crop(cam, arg); -+ -+ case VIDIOC_ENUM_FMT: -+ return et61x251_vidioc_enum_fmt(cam, arg); -+ -+ case VIDIOC_G_FMT: -+ return et61x251_vidioc_g_fmt(cam, arg); -+ -+ case VIDIOC_TRY_FMT: -+ case VIDIOC_S_FMT: -+ return et61x251_vidioc_try_s_fmt(cam, cmd, arg); -+ -+ case VIDIOC_G_JPEGCOMP: -+ return et61x251_vidioc_g_jpegcomp(cam, arg); -+ -+ case VIDIOC_S_JPEGCOMP: -+ return et61x251_vidioc_s_jpegcomp(cam, arg); -+ -+ case VIDIOC_REQBUFS: -+ return et61x251_vidioc_reqbufs(cam, arg); -+ -+ case VIDIOC_QUERYBUF: -+ return et61x251_vidioc_querybuf(cam, arg); -+ -+ case VIDIOC_QBUF: -+ return et61x251_vidioc_qbuf(cam, arg); -+ -+ case VIDIOC_DQBUF: -+ return et61x251_vidioc_dqbuf(cam, filp, arg); -+ -+ case VIDIOC_STREAMON: -+ return et61x251_vidioc_streamon(cam, arg); -+ -+ case VIDIOC_STREAMOFF: -+ return et61x251_vidioc_streamoff(cam, arg); -+ -+ case VIDIOC_G_PARM: -+ return et61x251_vidioc_g_parm(cam, arg); -+ -+ case VIDIOC_S_PARM_OLD: -+ case VIDIOC_S_PARM: -+ return et61x251_vidioc_s_parm(cam, arg); -+ -+ case VIDIOC_G_STD: -+ case VIDIOC_S_STD: -+ case VIDIOC_QUERYSTD: -+ case VIDIOC_ENUMSTD: -+ case VIDIOC_QUERYMENU: -+ return -EINVAL; -+ -+ default: -+ return -EINVAL; -+ -+ } -+} -+ -+ -+static int et61x251_ioctl(struct inode* inode, struct file* filp, -+ unsigned int cmd, unsigned long arg) -+{ -+ struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); -+ int err = 0; -+ -+ if (down_interruptible(&cam->fileop_sem)) -+ return -ERESTARTSYS; -+ -+ if (cam->state & DEV_DISCONNECTED) { -+ DBG(1, "Device not present"); -+ up(&cam->fileop_sem); -+ return -ENODEV; -+ } -+ -+ if (cam->state & DEV_MISCONFIGURED) { -+ DBG(1, "The camera is misconfigured. Close and open it " -+ "again."); -+ up(&cam->fileop_sem); -+ return -EIO; -+ } -+ -+ V4LDBG(3, "et61x251", cmd); -+ -+ err = et61x251_ioctl_v4l2(inode, filp, cmd, (void __user *)arg); -+ -+ up(&cam->fileop_sem); -+ -+ return err; -+} -+ -+ -+static struct file_operations et61x251_fops = { -+ .owner = THIS_MODULE, -+ .open = et61x251_open, -+ .release = et61x251_release, -+ .ioctl = et61x251_ioctl, -+ .read = et61x251_read, -+ .poll = et61x251_poll, -+ .mmap = et61x251_mmap, -+ .llseek = no_llseek, -+}; -+ -+/*****************************************************************************/ -+ -+/* It exists a single interface only. We do not need to validate anything. */ -+static int -+et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) -+{ -+ struct usb_device *udev = interface_to_usbdev(intf); -+ struct et61x251_device* cam; -+ static unsigned int dev_nr = 0; -+ unsigned int i; -+ int err = 0; -+ -+ if (!(cam = kzalloc(sizeof(struct et61x251_device), GFP_KERNEL))) -+ return -ENOMEM; -+ -+ cam->usbdev = udev; -+ -+ if (!(cam->control_buffer = kzalloc(8, GFP_KERNEL))) { -+ DBG(1, "kmalloc() failed"); -+ err = -ENOMEM; -+ goto fail; -+ } -+ -+ if (!(cam->v4ldev = video_device_alloc())) { -+ DBG(1, "video_device_alloc() failed"); -+ err = -ENOMEM; -+ goto fail; -+ } -+ -+ init_MUTEX(&cam->dev_sem); -+ -+ DBG(2, "ET61X[12]51 PC Camera Controller detected " -+ "(vid/pid 0x%04X/0x%04X)",id->idVendor, id->idProduct); -+ -+ for (i = 0; et61x251_sensor_table[i]; i++) { -+ err = et61x251_sensor_table[i](cam); -+ if (!err) -+ break; -+ } -+ -+ if (!err && cam->sensor) -+ DBG(2, "%s image sensor detected", cam->sensor->name); -+ else { -+ DBG(1, "No supported image sensor detected"); -+ err = -ENODEV; -+ goto fail; -+ } -+ -+ if (et61x251_init(cam)) { -+ DBG(1, "Initialization failed. I will retry on open()."); -+ cam->state |= DEV_MISCONFIGURED; -+ } -+ -+ strcpy(cam->v4ldev->name, "ET61X[12]51 PC Camera"); -+ cam->v4ldev->owner = THIS_MODULE; -+ cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES; -+ cam->v4ldev->hardware = 0; -+ cam->v4ldev->fops = &et61x251_fops; -+ cam->v4ldev->minor = video_nr[dev_nr]; -+ cam->v4ldev->release = video_device_release; -+ video_set_drvdata(cam->v4ldev, cam); -+ -+ down(&cam->dev_sem); -+ -+ err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, -+ video_nr[dev_nr]); -+ if (err) { -+ DBG(1, "V4L2 device registration failed"); -+ if (err == -ENFILE && video_nr[dev_nr] == -1) -+ DBG(1, "Free /dev/videoX node not found"); -+ video_nr[dev_nr] = -1; -+ dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0; -+ up(&cam->dev_sem); -+ goto fail; -+ } -+ -+ DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor); -+ -+ cam->module_param.force_munmap = force_munmap[dev_nr]; -+ -+ dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0; -+ -+#ifdef CONFIG_VIDEO_ADV_DEBUG -+ et61x251_create_sysfs(cam); -+ DBG(2, "Optional device control through 'sysfs' interface ready"); -+#endif -+ -+ usb_set_intfdata(intf, cam); -+ -+ up(&cam->dev_sem); -+ -+ return 0; -+ -+fail: -+ if (cam) { -+ kfree(cam->control_buffer); -+ if (cam->v4ldev) -+ video_device_release(cam->v4ldev); -+ kfree(cam); -+ } -+ return err; -+} -+ -+ -+static void et61x251_usb_disconnect(struct usb_interface* intf) -+{ -+ struct et61x251_device* cam = usb_get_intfdata(intf); -+ -+ if (!cam) -+ return; -+ -+ down_write(&et61x251_disconnect); -+ -+ down(&cam->dev_sem); -+ -+ DBG(2, "Disconnecting %s...", cam->v4ldev->name); -+ -+ wake_up_interruptible_all(&cam->open); -+ -+ if (cam->users) { -+ DBG(2, "Device /dev/video%d is open! Deregistration and " -+ "memory deallocation are deferred on close.", -+ cam->v4ldev->minor); -+ cam->state |= DEV_MISCONFIGURED; -+ et61x251_stop_transfer(cam); -+ cam->state |= DEV_DISCONNECTED; -+ wake_up_interruptible(&cam->wait_frame); -+ wake_up_interruptible(&cam->wait_stream); -+ } else { -+ cam->state |= DEV_DISCONNECTED; -+ et61x251_release_resources(cam); -+ } -+ -+ up(&cam->dev_sem); -+ -+ if (!cam->users) -+ kfree(cam); -+ -+ up_write(&et61x251_disconnect); -+} -+ -+ -+static struct usb_driver et61x251_usb_driver = { -+ .name = "et61x251", -+ .id_table = et61x251_id_table, -+ .probe = et61x251_usb_probe, -+ .disconnect = et61x251_usb_disconnect, -+}; -+ -+/*****************************************************************************/ -+ -+static int __init et61x251_module_init(void) -+{ -+ int err = 0; -+ -+ KDBG(2, ET61X251_MODULE_NAME " v" ET61X251_MODULE_VERSION); -+ KDBG(3, ET61X251_MODULE_AUTHOR); -+ -+ if ((err = usb_register(&et61x251_usb_driver))) -+ KDBG(1, "usb_register() failed"); -+ -+ return err; -+} -+ -+ -+static void __exit et61x251_module_exit(void) -+{ -+ usb_deregister(&et61x251_usb_driver); -+} -+ -+ -+module_init(et61x251_module_init); -+module_exit(et61x251_module_exit); ---- /dev/null -+++ gregkh-2.6/drivers/usb/media/et61x251.h -@@ -0,0 +1,220 @@ -+/*************************************************************************** -+ * V4L2 driver for ET61X[12]51 PC Camera Controllers * -+ * * -+ * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * * -+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * -+ ***************************************************************************/ -+ -+#ifndef _ET61X251_H_ -+#define _ET61X251_H_ -+ -+#include <linux/version.h> -+#include <linux/usb.h> -+#include <linux/videodev2.h> -+#include <media/v4l2-common.h> -+#include <linux/device.h> -+#include <linux/list.h> -+#include <linux/spinlock.h> -+#include <linux/time.h> -+#include <linux/wait.h> -+#include <linux/types.h> -+#include <linux/param.h> -+#include <linux/rwsem.h> -+#include <asm/semaphore.h> -+ -+#include "et61x251_sensor.h" -+ -+/*****************************************************************************/ -+ -+#define ET61X251_DEBUG -+#define ET61X251_DEBUG_LEVEL 2 -+#define ET61X251_MAX_DEVICES 64 -+#define ET61X251_PRESERVE_IMGSCALE 0 -+#define ET61X251_FORCE_MUNMAP 0 -+#define ET61X251_MAX_FRAMES 32 -+#define ET61X251_COMPRESSION_QUALITY 0 -+#define ET61X251_URBS 2 -+#define ET61X251_ISO_PACKETS 7 -+#define ET61X251_ALTERNATE_SETTING 13 -+#define ET61X251_URB_TIMEOUT msecs_to_jiffies(2 * ET61X251_ISO_PACKETS) -+#define ET61X251_CTRL_TIMEOUT 100 -+ -+/*****************************************************************************/ -+ -+static const struct usb_device_id et61x251_id_table[] = { -+ { USB_DEVICE(0x102c, 0x6151), }, -+ { USB_DEVICE(0x102c, 0x6251), }, -+ { USB_DEVICE(0x102c, 0x6253), }, -+ { USB_DEVICE(0x102c, 0x6254), }, -+ { USB_DEVICE(0x102c, 0x6255), }, -+ { USB_DEVICE(0x102c, 0x6256), }, -+ { USB_DEVICE(0x102c, 0x6257), }, -+ { USB_DEVICE(0x102c, 0x6258), }, -+ { USB_DEVICE(0x102c, 0x6259), }, -+ { USB_DEVICE(0x102c, 0x625a), }, -+ { USB_DEVICE(0x102c, 0x625b), }, -+ { USB_DEVICE(0x102c, 0x625c), }, -+ { USB_DEVICE(0x102c, 0x625d), }, -+ { USB_DEVICE(0x102c, 0x625e), }, -+ { USB_DEVICE(0x102c, 0x625f), }, -+ { USB_DEVICE(0x102c, 0x6260), }, -+ { USB_DEVICE(0x102c, 0x6261), }, -+ { USB_DEVICE(0x102c, 0x6262), }, -+ { USB_DEVICE(0x102c, 0x6263), }, -+ { USB_DEVICE(0x102c, 0x6264), }, -+ { USB_DEVICE(0x102c, 0x6265), }, -+ { USB_DEVICE(0x102c, 0x6266), }, -+ { USB_DEVICE(0x102c, 0x6267), }, -+ { USB_DEVICE(0x102c, 0x6268), }, -+ { USB_DEVICE(0x102c, 0x6269), }, -+ { } -+}; -+ -+ET61X251_SENSOR_TABLE -+ -+/*****************************************************************************/ -+ -+enum et61x251_frame_state { -+ F_UNUSED, -+ F_QUEUED, -+ F_GRABBING, -+ F_DONE, -+ F_ERROR, -+}; -+ -+struct et61x251_frame_t { -+ void* bufmem; -+ struct v4l2_buffer buf; -+ enum et61x251_frame_state state; -+ struct list_head frame; -+ unsigned long vma_use_count; -+}; -+ -+enum et61x251_dev_state { -+ DEV_INITIALIZED = 0x01, -+ DEV_DISCONNECTED = 0x02, -+ DEV_MISCONFIGURED = 0x04, -+}; -+ -+enum et61x251_io_method { -+ IO_NONE, -+ IO_READ, -+ IO_MMAP, -+}; -+ -+enum et61x251_stream_state { -+ STREAM_OFF, -+ STREAM_INTERRUPT, -+ STREAM_ON, -+}; -+ -+struct et61x251_sysfs_attr { -+ u8 reg, i2c_reg; -+}; -+ -+struct et61x251_module_param { -+ u8 force_munmap; -+}; -+ -+static DECLARE_MUTEX(et61x251_sysfs_lock); -+static DECLARE_RWSEM(et61x251_disconnect); -+ -+struct et61x251_device { -+ struct video_device* v4ldev; -+ -+ struct et61x251_sensor* sensor; -+ -+ struct usb_device* usbdev; -+ struct urb* urb[ET61X251_URBS]; -+ void* transfer_buffer[ET61X251_URBS]; -+ u8* control_buffer; -+ -+ struct et61x251_frame_t *frame_current, frame[ET61X251_MAX_FRAMES]; -+ struct list_head inqueue, outqueue; -+ u32 frame_count, nbuffers, nreadbuffers; -+ -+ enum et61x251_io_method io; -+ enum et61x251_stream_state stream; -+ -+ struct v4l2_jpegcompression compression; -+ -+ struct et61x251_sysfs_attr sysfs; -+ struct et61x251_module_param module_param; -+ -+ enum et61x251_dev_state state; -+ u8 users; -+ -+ struct semaphore dev_sem, fileop_sem; -+ spinlock_t queue_lock; -+ wait_queue_head_t open, wait_frame, wait_stream; -+}; -+ -+/*****************************************************************************/ -+ -+void -+et61x251_attach_sensor(struct et61x251_device* cam, -+ struct et61x251_sensor* sensor) -+{ -+ cam->sensor = sensor; -+ cam->sensor->usbdev = cam->usbdev; -+} -+ -+/*****************************************************************************/ -+ -+#undef DBG -+#undef KDBG -+#ifdef ET61X251_DEBUG -+# define DBG(level, fmt, args...) \ -+do { \ -+ if (debug >= (level)) { \ -+ if ((level) == 1) \ -+ dev_err(&cam->usbdev->dev, fmt "\n", ## args); \ -+ else if ((level) == 2) \ -+ dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ -+ else if ((level) >= 3) \ -+ dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ -+ __FUNCTION__, __LINE__ , ## args); \ -+ } \ -+} while (0) -+# define KDBG(level, fmt, args...) \ -+do { \ -+ if (debug >= (level)) { \ -+ if ((level) == 1 || (level) == 2) \ -+ pr_info("et61x251: " fmt "\n", ## args); \ -+ else if ((level) == 3) \ -+ pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \ -+ __LINE__ , ## args); \ -+ } \ -+} while (0) -+# define V4LDBG(level, name, cmd) \ -+do { \ -+ if (debug >= (level)) \ -+ v4l_print_ioctl(name, cmd); \ -+} while (0) -+#else -+# define DBG(level, fmt, args...) do {;} while(0) -+# define KDBG(level, fmt, args...) do {;} while(0) -+# define V4LDBG(level, name, cmd) do {;} while(0) -+#endif -+ -+#undef PDBG -+#define PDBG(fmt, args...) \ -+dev_info(&cam->dev, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__ , ## args) -+ -+#undef PDBGG -+#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ -+ -+#endif /* _ET61X251_H_ */ ---- /dev/null -+++ gregkh-2.6/drivers/usb/media/et61x251_sensor.h -@@ -0,0 +1,115 @@ -+/*************************************************************************** -+ * API for image sensors connected to ET61X[12]51 PC Camera Controllers * -+ * * -+ * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * * -+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * -+ ***************************************************************************/ -+ -+#ifndef _ET61X251_SENSOR_H_ -+#define _ET61X251_SENSOR_H_ -+ -+#include <linux/usb.h> -+#include <linux/videodev.h> -+#include <linux/device.h> -+#include <linux/stddef.h> -+#include <linux/errno.h> -+#include <asm/types.h> -+ -+struct et61x251_device; -+struct et61x251_sensor; -+ -+/*****************************************************************************/ -+ -+extern int et61x251_probe_tas5130d1b(struct et61x251_device* cam); -+ -+#define ET61X251_SENSOR_TABLE \ -+/* Weak detections must go at the end of the list */ \ -+static int (*et61x251_sensor_table[])(struct et61x251_device*) = { \ -+ &et61x251_probe_tas5130d1b, \ -+ NULL, \ -+}; -+ -+extern void -+et61x251_attach_sensor(struct et61x251_device* cam, -+ struct et61x251_sensor* sensor); -+ -+/*****************************************************************************/ -+ -+extern int et61x251_write_reg(struct et61x251_device*, u8 value, u16 index); -+extern int et61x251_read_reg(struct et61x251_device*, u16 index); -+extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value); -+extern int et61x251_i2c_read(struct et61x251_device*, u8 address); -+extern int et61x251_i2c_try_write(struct et61x251_device*, -+ struct et61x251_sensor*, u8 address, -+ u8 value); -+extern int et61x251_i2c_try_read(struct et61x251_device*, -+ struct et61x251_sensor*, u8 address); -+extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1, -+ u8 data2, u8 data3, u8 data4, u8 data5, -+ u8 data6, u8 data7, u8 data8, u8 address); -+ -+/*****************************************************************************/ -+ -+enum et61x251_i2c_sysfs_ops { -+ ET61X251_I2C_READ = 0x01, -+ ET61X251_I2C_WRITE = 0x02, -+}; -+ -+enum et61x251_i2c_interface { -+ ET61X251_I2C_2WIRES, -+ ET61X251_I2C_3WIRES, -+}; -+ -+/* Repeat start condition when RSTA is high */ -+enum et61x251_i2c_rsta { -+ ET61X251_I2C_RSTA_STOP = 0x00, /* stop then start */ -+ ET61X251_I2C_RSTA_REPEAT = 0x01, /* repeat start */ -+}; -+ -+#define ET61X251_MAX_CTRLS V4L2_CID_LASTP1-V4L2_CID_BASE+10 -+ -+struct et61x251_sensor { -+ char name[32]; -+ -+ enum et61x251_i2c_sysfs_ops sysfs_ops; -+ -+ enum et61x251_i2c_interface interface; -+ u8 i2c_slave_id; -+ enum et61x251_i2c_rsta rsta; -+ struct v4l2_rect active_pixel; /* left and top define FVSX and FVSY */ -+ -+ struct v4l2_queryctrl qctrl[ET61X251_MAX_CTRLS]; -+ struct v4l2_cropcap cropcap; -+ struct v4l2_pix_format pix_format; -+ -+ int (*init)(struct et61x251_device* cam); -+ int (*get_ctrl)(struct et61x251_device* cam, -+ struct v4l2_control* ctrl); -+ int (*set_ctrl)(struct et61x251_device* cam, -+ const struct v4l2_control* ctrl); -+ int (*set_crop)(struct et61x251_device* cam, -+ const struct v4l2_rect* rect); -+ int (*set_pix_format)(struct et61x251_device* cam, -+ const struct v4l2_pix_format* pix); -+ -+ const struct usb_device* usbdev; -+ -+ /* Private */ -+ struct v4l2_queryctrl _qctrl[ET61X251_MAX_CTRLS]; -+ struct v4l2_rect _rect; -+}; -+ -+#endif /* _ET61X251_SENSOR_H_ */ ---- /dev/null -+++ gregkh-2.6/drivers/usb/media/et61x251_tas5130d1b.c -@@ -0,0 +1,137 @@ -+/*************************************************************************** -+ * Plug-in for TAS5130D1B image sensor connected to the ET61X[12]51 * -+ * PC Camera Controllers * -+ * * -+ * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * * -+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * -+ ***************************************************************************/ -+ -+#include "et61x251_sensor.h" -+ -+ -+static int tas5130d1b_init(struct et61x251_device* cam) -+{ -+ int err = 0; -+ -+ err += et61x251_write_reg(cam, 0x14, 0x01); -+ err += et61x251_write_reg(cam, 0x1b, 0x02); -+ err += et61x251_write_reg(cam, 0x02, 0x12); -+ err += et61x251_write_reg(cam, 0x0e, 0x60); -+ err += et61x251_write_reg(cam, 0x80, 0x61); -+ err += et61x251_write_reg(cam, 0xf0, 0x62); -+ err += et61x251_write_reg(cam, 0x03, 0x63); -+ err += et61x251_write_reg(cam, 0x14, 0x64); -+ err += et61x251_write_reg(cam, 0xf4, 0x65); -+ err += et61x251_write_reg(cam, 0x01, 0x66); -+ err += et61x251_write_reg(cam, 0x05, 0x67); -+ err += et61x251_write_reg(cam, 0x8f, 0x68); -+ err += et61x251_write_reg(cam, 0x0f, 0x8d); -+ err += et61x251_write_reg(cam, 0x08, 0x8e); -+ -+ return err; -+} -+ -+ -+static int tas5130d1b_set_ctrl(struct et61x251_device* cam, -+ const struct v4l2_control* ctrl) -+{ -+ int err = 0; -+ -+ switch (ctrl->id) { -+ case V4L2_CID_GAIN: -+ err += et61x251_i2c_raw_write(cam, 2, 0x20, -+ 0xf6-ctrl->value, 0, 0, 0, -+ 0, 0, 0, 0); -+ break; -+ case V4L2_CID_EXPOSURE: -+ err += et61x251_i2c_raw_write(cam, 2, 0x40, -+ 0x47-ctrl->value, 0, 0, 0, -+ 0, 0, 0, 0); -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ return err ? -EIO : 0; -+} -+ -+ -+static struct et61x251_sensor tas5130d1b = { -+ .name = "TAS5130D1B", -+ .interface = ET61X251_I2C_3WIRES, -+ .rsta = ET61X251_I2C_RSTA_STOP, -+ .active_pixel = { -+ .left = 106, -+ .top = 13, -+ }, -+ .init = &tas5130d1b_init, -+ .qctrl = { -+ { -+ .id = V4L2_CID_GAIN, -+ .type = V4L2_CTRL_TYPE_INTEGER, -+ .name = "global gain", -+ .minimum = 0x00, -+ .maximum = 0xf6, -+ .step = 0x02, -+ .default_value = 0x0d, -+ .flags = 0, -+ }, -+ { -+ .id = V4L2_CID_EXPOSURE, -+ .type = V4L2_CTRL_TYPE_INTEGER, -+ .name = "exposure", -+ .minimum = 0x00, -+ .maximum = 0x47, -+ .step = 0x01, -+ .default_value = 0x23, -+ .flags = 0, -+ }, -+ }, -+ .set_ctrl = &tas5130d1b_set_ctrl, -+ .cropcap = { -+ .bounds = { -+ .left = 0, -+ .top = 0, -+ .width = 640, -+ .height = 480, -+ }, -+ .defrect = { -+ .left = 0, -+ .top = 0, -+ .width = 640, -+ .height = 480, -+ }, -+ }, -+ .pix_format = { -+ .width = 640, -+ .height = 480, -+ .pixelformat = V4L2_PIX_FMT_SBGGR8, -+ .priv = 8, -+ }, -+}; -+ -+ -+int et61x251_probe_tas5130d1b(struct et61x251_device* cam) -+{ -+ /* This sensor has no identifiers, so let's attach it anyway */ -+ et61x251_attach_sensor(cam, &tas5130d1b); -+ -+ /* Sensor detection is based on USB pid/vid */ -+ if (le16_to_cpu(tas5130d1b.usbdev->descriptor.idProduct) != 0x6251) -+ return -ENODEV; -+ -+ return 0; -+} ---- gregkh-2.6.orig/drivers/usb/media/Kconfig -+++ gregkh-2.6/drivers/usb/media/Kconfig -@@ -53,6 +53,21 @@ config USB_DSBR - To compile this driver as a module, choose M here: the - module will be called dsbr100. - -+config USB_ET61X251 -+ tristate "USB ET61X[12]51 PC Camera Controller support" -+ depends on USB && VIDEO_DEV -+ ---help--- -+ Say Y here if you want support for cameras based on Etoms ET61X151 -+ or ET61X251 PC Camera Controllers. -+ -+ See <file:Documentation/usb/et61x251.txt> for more informations. -+ -+ This driver uses the Video For Linux API. You must say Y or M to -+ "Video For Linux" to use this driver. -+ -+ To compile this driver as a module, choose M here: the -+ module will be called et61x251. -+ - config USB_IBMCAM - tristate "USB IBM (Xirlink) C-it Camera support" - depends on USB && VIDEO_DEV -@@ -209,5 +224,3 @@ config USB_PWC - - To compile this driver as a module, choose M here: the - module will be called pwc. -- -- ---- gregkh-2.6.orig/drivers/usb/media/Makefile -+++ gregkh-2.6/drivers/usb/media/Makefile -@@ -3,9 +3,11 @@ - # - - sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bcb.o sn9c102_tas5110c1b.o sn9c102_tas5130d1b.o -+et61x251-objs := et61x251_core.o et61x251_tas5130d1b.o - - obj-$(CONFIG_USB_DABUSB) += dabusb.o - obj-$(CONFIG_USB_DSBR) += dsbr100.o -+obj-$(CONFIG_USB_ET61X251) += et61x251.o - obj-$(CONFIG_USB_IBMCAM) += ibmcam.o usbvideo.o ultracam.o - obj-$(CONFIG_USB_KONICAWC) += konicawc.o usbvideo.o - obj-$(CONFIG_USB_OV511) += ov511.o ---- gregkh-2.6.orig/include/linux/videodev2.h -+++ gregkh-2.6/include/linux/videodev2.h -@@ -315,6 +315,7 @@ struct v4l2_pix_format - #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */ - #define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */ - #define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */ -+#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E','6','2','5') /* ET61X251 compression */ - - /* - * F O R M A T E N U M E R A T I O N ---- gregkh-2.6.orig/MAINTAINERS -+++ gregkh-2.6/MAINTAINERS -@@ -2679,6 +2679,14 @@ M: dbrownell@users.sourceforge.net - L: linux-usb-devel@lists.sourceforge.net - S: Maintained - -+USB ET61X[12]51 DRIVER -+P: Luca Risolia -+M: luca.risolia@studio.unibo.it -+L: linux-usb-devel@lists.sourceforge.net -+L: video4linux-list@redhat.com -+W: http://www.linux-projects.org -+S: Maintained -+ - USB HID/HIDBP DRIVERS - P: Vojtech Pavlik - M: vojtech@suse.cz -@@ -2842,6 +2850,7 @@ USB SN9C10x DRIVER - P: Luca Risolia - M: luca.risolia@studio.unibo.it - L: linux-usb-devel@lists.sourceforge.net -+L: video4linux-list@redhat.com - W: http://www.linux-projects.org - S: Maintained - -@@ -2871,6 +2880,7 @@ USB W996[87]CF DRIVER - P: Luca Risolia - M: luca.risolia@studio.unibo.it - L: linux-usb-devel@lists.sourceforge.net -+L: video4linux-list@redhat.com - W: http://www.linux-projects.org - S: Maintained - diff --git a/usb/usb-add-new-auerswald-device-ids.patch b/usb/usb-add-new-auerswald-device-ids.patch deleted file mode 100644 index 7bba8e9a31e52..0000000000000 --- a/usb/usb-add-new-auerswald-device-ids.patch +++ /dev/null @@ -1,32 +0,0 @@ -From akpm@osdl.org Tue Jan 17 15:35:31 2006 -Message-Id: <200601172335.k0HNZMlR006374@shell0.pdx.osdl.net> -From: Andrew Morton <akpm@osdl.org> -Subject: USB: add new auerswald device ids -To: akpm@osdl.org, dj-tj@gmx.de, greg@kroah.com, mm-commits@vger.kernel.org -Date: Tue, 17 Jan 2006 15:37:22 -0800 - - -From: Andrew Morton <akpm@osdl.org> - -Add device support for a couple more Auerswald TK-devices. - -Via Thomas Jackle <dj-tj@gmx.de>, typed in from -http://bugzilla.kernel.org/show_bug.cgi?id=5908. - -Signed-off-by: Andrew Morton <akpm@osdl.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> ---- - drivers/usb/misc/auerswald.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- gregkh-2.6.orig/drivers/usb/misc/auerswald.c -+++ gregkh-2.6/drivers/usb/misc/auerswald.c -@@ -2093,6 +2093,8 @@ static void auerswald_disconnect (struct - static struct usb_device_id auerswald_ids [] = { - { USB_DEVICE (ID_AUERSWALD, 0x00C0) }, /* COMpact 2104 USB */ - { USB_DEVICE (ID_AUERSWALD, 0x00DB) }, /* COMpact 4410/2206 USB */ -+ { USB_DEVICE (ID_AUERSWALD, 0x00DC) }, /* COMpact 4406 DSL */ -+ { USB_DEVICE (ID_AUERSWALD, 0x00DD) }, /* COMpact 2204 USB */ - { USB_DEVICE (ID_AUERSWALD, 0x00F1) }, /* Comfort 2000 System Telephone */ - { USB_DEVICE (ID_AUERSWALD, 0x00F2) }, /* Comfort 1200 System Telephone */ - { } /* Terminating entry */ diff --git a/usb/usb-add-new-pl2303-device-ids.patch b/usb/usb-add-new-pl2303-device-ids.patch deleted file mode 100644 index 316791d6f1065..0000000000000 --- a/usb/usb-add-new-pl2303-device-ids.patch +++ /dev/null @@ -1,35 +0,0 @@ -From denis.monterrat@sagem.com Thu Jan 19 05:52:48 2006 -From: Denis MONTERRAT <denis.monterrat@sagem.com> -Subject: USB: add new pl2303 device ids -Date: Thu, 19 Jan 2006 14:52:38 +0100 -To: greg@kroah.com -Cc: -Message-ID: <OF3A5B0393.4D765429-ON412570FB.004C19A4@sagem.com> - -Signed-off-by: FALIPOU F Developer <fred.falipou@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/serial/pl2303.c | 1 + - drivers/usb/serial/pl2303.h | 3 +++ - 2 files changed, 4 insertions(+) - ---- gregkh-2.6.orig/drivers/usb/serial/pl2303.c -+++ gregkh-2.6/drivers/usb/serial/pl2303.c -@@ -75,6 +75,7 @@ static struct usb_device_id id_table [] - { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, - { USB_DEVICE(NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID ) }, - { USB_DEVICE(CA_42_CA42_VENDOR_ID, CA_42_CA42_PRODUCT_ID ) }, -+ { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) }, - { } /* Terminating entry */ - }; - ---- gregkh-2.6.orig/drivers/usb/serial/pl2303.h -+++ gregkh-2.6/drivers/usb/serial/pl2303.h -@@ -68,3 +68,6 @@ - /* CA-42 CLONE Cable www.ca-42.com chipset: Prolific Technology Inc */ - #define CA_42_CA42_VENDOR_ID 0x10b5 - #define CA_42_CA42_PRODUCT_ID 0xac70 -+ -+#define SAGEM_VENDOR_ID 0x079b -+#define SAGEM_PRODUCT_ID 0x0027 diff --git a/usb/usb-arm26-fix-compilation-of-drivers-usb-core-message.c.patch b/usb/usb-arm26-fix-compilation-of-drivers-usb-core-message.c.patch deleted file mode 100644 index b7ea7f00246ff..0000000000000 --- a/usb/usb-arm26-fix-compilation-of-drivers-usb-core-message.c.patch +++ /dev/null @@ -1,25 +0,0 @@ -From linux-usb-devel-admin@lists.sourceforge.net Wed Jan 18 13:16:04 2006 -From: Alexey Dobriyan <adobriyan@gmail.com> -Message-ID: <20060118210607.GL12771@mipter.zuzino.mipt.ru> -Content-Disposition: inline -Subject: USB: arm26: fix compilation of drivers/usb/core/message.c -Date: Thu, 19 Jan 2006 00:06:07 +0300 - -drivers/usb/core/message.c:395: error: invalid use of undefined type `struct scatterlist' - -Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> ---- - drivers/usb/core/message.c | 1 + - 1 file changed, 1 insertion(+) - ---- gregkh-2.6.orig/drivers/usb/core/message.c -+++ gregkh-2.6/drivers/usb/core/message.c -@@ -13,6 +13,7 @@ - #include <linux/ctype.h> - #include <linux/device.h> - #include <asm/byteorder.h> -+#include <asm/scatterlist.h> - - #include "hcd.h" /* for usbcore internals */ - #include "usb.h" diff --git a/usb/usb-asix-add-device-ids-for-0g0-cable-ethernet.patch b/usb/usb-asix-add-device-ids-for-0g0-cable-ethernet.patch deleted file mode 100644 index 060b91e5e094c..0000000000000 --- a/usb/usb-asix-add-device-ids-for-0g0-cable-ethernet.patch +++ /dev/null @@ -1,32 +0,0 @@ -From linux-usb-devel-admin@lists.sourceforge.net Thu Jan 5 11:46:21 2006 -From: David Hollis <dhollis@davehollis.com> -To: Greg KH <gregkh@suse.de> -Cc: Charles Lepple <clepple@gmail.com> -Message-Id: <1136489989.2509.12.camel@dhollis-lnx.sunera.com> -Subject: USB: asix - Add device IDs for 0G0 Cable Ethernet -Date: Thu, 05 Jan 2006 14:39:49 -0500 - - -Add device IDs for the 0G0 Cable Ethernet device as reported by -Charles Lepple <clepple@gmail.com>. - -Signed-off-by: David Hollis <dhollis@davehollis.com> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/net/asix.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- gregkh-2.6.orig/drivers/usb/net/asix.c -+++ gregkh-2.6/drivers/usb/net/asix.c -@@ -916,6 +916,10 @@ static const struct usb_device_id produc - // Linksys USB200M Rev 2 - USB_DEVICE (0x13b1, 0x0018), - .driver_info = (unsigned long) &ax88772_info, -+}, { -+ // 0Q0 cable ethernet -+ USB_DEVICE (0x1557, 0x7720), -+ .driver_info = (unsigned long) &ax88772_info, - }, - { }, // END - }; diff --git a/usb/usb-au1xx0-replace-casual-readl-with-au_readl-in-the-drivers.patch b/usb/usb-au1xx0-replace-casual-readl-with-au_readl-in-the-drivers.patch deleted file mode 100644 index 15ad2bca79477..0000000000000 --- a/usb/usb-au1xx0-replace-casual-readl-with-au_readl-in-the-drivers.patch +++ /dev/null @@ -1,90 +0,0 @@ -From akpm@osdl.org Thu Jan 5 22:54:16 2006 -From: Sergei Shtylylov <sshtylyov@ru.mvista.com> -Message-Id: <200601060650.k066op5a008830@shell0.pdx.osdl.net> -Subject: USB: Au1xx0: replace casual readl() with au_readl() in the drivers -To: greg@kroah.com -Cc: akpm@osdl.org, sshtylyov@ru.mvista.com, jordan.crouse@amd.com, perex@perex.cz, tiwai@suse.de -Date: Thu, 05 Jan 2006 22:50:39 -0800 - - -From: Sergei Shtylylov <sshtylyov@ru.mvista.com> - -au_readl() does needed byteswapping, etc. - -Cc: Takashi Iwai <tiwai@suse.de> -Cc: Jaroslav Kysela <perex@perex.cz> -Acked-by: Jordan Crouse <jordan.crouse@amd.com> -Signed-off-by: Andrew Morton <akpm@osdl.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> ---- - drivers/usb/host/ohci-au1xxx.c | 2 +- - sound/oss/au1550_ac97.c | 12 ++++++------ - 2 files changed, 7 insertions(+), 7 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/host/ohci-au1xxx.c -+++ gregkh-2.6/drivers/usb/host/ohci-au1xxx.c -@@ -67,7 +67,7 @@ static void au1xxx_stop_hc(struct platfo - ": stopping Au1xxx OHCI USB Controller\n"); - - /* Disable clock */ -- au_writel(readl((void *)USB_HOST_CONFIG) & ~USBH_ENABLE_CE, USB_HOST_CONFIG); -+ au_writel(au_readl(USB_HOST_CONFIG) & ~USBH_ENABLE_CE, USB_HOST_CONFIG); - } - - ---- gregkh-2.6.orig/sound/oss/au1550_ac97.c -+++ gregkh-2.6/sound/oss/au1550_ac97.c -@@ -462,7 +462,7 @@ stop_dac(struct au1550_state *s) - /* Wait for Transmit Busy to show disabled. - */ - do { -- stat = readl((void *)PSC_AC97STAT); -+ stat = au_readl(PSC_AC97STAT); - au_sync(); - } while ((stat & PSC_AC97STAT_TB) != 0); - -@@ -491,7 +491,7 @@ stop_adc(struct au1550_state *s) - /* Wait for Receive Busy to show disabled. - */ - do { -- stat = readl((void *)PSC_AC97STAT); -+ stat = au_readl(PSC_AC97STAT); - au_sync(); - } while ((stat & PSC_AC97STAT_RB) != 0); - -@@ -541,7 +541,7 @@ set_xmit_slots(int num_channels) - /* Wait for Device ready. - */ - do { -- stat = readl((void *)PSC_AC97STAT); -+ stat = au_readl(PSC_AC97STAT); - au_sync(); - } while ((stat & PSC_AC97STAT_DR) == 0); - } -@@ -573,7 +573,7 @@ set_recv_slots(int num_channels) - /* Wait for Device ready. - */ - do { -- stat = readl((void *)PSC_AC97STAT); -+ stat = au_readl(PSC_AC97STAT); - au_sync(); - } while ((stat & PSC_AC97STAT_DR) == 0); - } -@@ -1995,7 +1995,7 @@ au1550_probe(void) - /* Wait for PSC ready. - */ - do { -- val = readl((void *)PSC_AC97STAT); -+ val = au_readl(PSC_AC97STAT); - au_sync(); - } while ((val & PSC_AC97STAT_SR) == 0); - -@@ -2018,7 +2018,7 @@ au1550_probe(void) - /* Wait for Device ready. - */ - do { -- val = readl((void *)PSC_AC97STAT); -+ val = au_readl(PSC_AC97STAT); - au_sync(); - } while ((val & PSC_AC97STAT_DR) == 0); - diff --git a/usb/usb-cleanup-of-usblp.patch b/usb/usb-cleanup-of-usblp.patch deleted file mode 100644 index 37ce8f5395013..0000000000000 --- a/usb/usb-cleanup-of-usblp.patch +++ /dev/null @@ -1,177 +0,0 @@ -From neukum@fachschaft.cup.uni-muenchen.de Sat Jan 7 13:22:02 2006 -Date: Sat, 7 Jan 2006 21:35:20 +0100 (CET) -From: Oliver Neukum <neukum@fachschaft.cup.uni-muenchen.de> -To: vojtech@suse.cz -Cc: greg@kroah.com, oliver@neukum.name -Subject: USB: cleanup of usblp -Message-ID: <Pine.LNX.4.58.0601072131370.2861@fachschaft.cup.uni-muenchen.de> - -this fixes --potential hang by disconnecting through usbfs --kzalloc --general cleanup --micro optimisation in interrupt handlers - -It compiles and I am printing. - -Signed-off-by: Oliver Neukum <oliver@neukum.name> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/class/usblp.c | 71 +++++++++++++++------------------------------- - 1 file changed, 24 insertions(+), 47 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/class/usblp.c -+++ gregkh-2.6/drivers/usb/class/usblp.c -@@ -7,6 +7,7 @@ - * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz> - # Copyright (c) 2001 Pete Zaitcev <zaitcev@redhat.com> - # Copyright (c) 2001 David Paschal <paschal@rcsis.com> -+ * Copyright (c) 2006 Oliver Neukum <oliver@neukum.name> - * - * USB Printer Device Class driver for USB printers and printer cables - * -@@ -273,13 +274,16 @@ static void usblp_bulk_read(struct urb * - { - struct usblp *usblp = urb->context; - -- if (!usblp || !usblp->dev || !usblp->used || !usblp->present) -+ if (unlikely(!usblp || !usblp->dev || !usblp->used)) - return; - -+ if (unlikely(!usblp->present)) -+ goto unplug; - if (unlikely(urb->status)) - warn("usblp%d: nonzero read/write bulk status received: %d", - usblp->minor, urb->status); - usblp->rcomplete = 1; -+unplug: - wake_up_interruptible(&usblp->wait); - } - -@@ -287,13 +291,15 @@ static void usblp_bulk_write(struct urb - { - struct usblp *usblp = urb->context; - -- if (!usblp || !usblp->dev || !usblp->used || !usblp->present) -+ if (unlikely(!usblp || !usblp->dev || !usblp->used)) - return; -- -+ if (unlikely(!usblp->present)) -+ goto unplug; - if (unlikely(urb->status)) - warn("usblp%d: nonzero read/write bulk status received: %d", - usblp->minor, urb->status); - usblp->wcomplete = 1; -+unplug: - wake_up_interruptible(&usblp->wait); - } - -@@ -627,9 +633,8 @@ done: - - static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) - { -- DECLARE_WAITQUEUE(wait, current); - struct usblp *usblp = file->private_data; -- int timeout, err = 0, transfer_length = 0; -+ int timeout, rv, err = 0, transfer_length = 0; - size_t writecount = 0; - - while (writecount < count) { -@@ -641,24 +646,11 @@ static ssize_t usblp_write(struct file * - } - - timeout = USBLP_WRITE_TIMEOUT; -- add_wait_queue(&usblp->wait, &wait); -- while ( 1==1 ) { - -- if (signal_pending(current)) { -- remove_wait_queue(&usblp->wait, &wait); -- return writecount ? writecount : -EINTR; -- } -- set_current_state(TASK_INTERRUPTIBLE); -- if (timeout && !usblp->wcomplete) { -- timeout = schedule_timeout(timeout); -- } else { -- set_current_state(TASK_RUNNING); -- break; -- } -- } -- remove_wait_queue(&usblp->wait, &wait); -+ rv = wait_event_interruptible_timeout(usblp->wait, usblp->wcomplete || !usblp->present , timeout); -+ if (rv < 0) -+ return writecount ? writecount : -EINTR; - } -- - down (&usblp->sem); - if (!usblp->present) { - up (&usblp->sem); -@@ -724,7 +716,7 @@ static ssize_t usblp_write(struct file * - static ssize_t usblp_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) - { - struct usblp *usblp = file->private_data; -- DECLARE_WAITQUEUE(wait, current); -+ int rv; - - if (!usblp->bidir) - return -EINVAL; -@@ -742,26 +734,13 @@ static ssize_t usblp_read(struct file *f - count = -EAGAIN; - goto done; - } -- -- add_wait_queue(&usblp->wait, &wait); -- while (1==1) { -- if (signal_pending(current)) { -- count = -EINTR; -- remove_wait_queue(&usblp->wait, &wait); -- goto done; -- } -- up (&usblp->sem); -- set_current_state(TASK_INTERRUPTIBLE); -- if (!usblp->rcomplete) { -- schedule(); -- } else { -- set_current_state(TASK_RUNNING); -- down(&usblp->sem); -- break; -- } -- down (&usblp->sem); -+ up(&usblp->sem); -+ rv = wait_event_interruptible(usblp->wait, usblp->rcomplete || !usblp->present); -+ down(&usblp->sem); -+ if (rv < 0) { -+ count = -EINTR; -+ goto done; - } -- remove_wait_queue(&usblp->wait, &wait); - } - - if (!usblp->present) { -@@ -874,11 +853,10 @@ static int usblp_probe(struct usb_interf - - /* Malloc and start initializing usblp structure so we can use it - * directly. */ -- if (!(usblp = kmalloc(sizeof(struct usblp), GFP_KERNEL))) { -+ if (!(usblp = kzalloc(sizeof(struct usblp), GFP_KERNEL))) { - err("out of memory for usblp"); - goto abort; - } -- memset(usblp, 0, sizeof(struct usblp)); - usblp->dev = dev; - init_MUTEX (&usblp->sem); - init_waitqueue_head(&usblp->wait); -@@ -1214,10 +1192,9 @@ static int __init usblp_init(void) - { - int retval; - retval = usb_register(&usblp_driver); -- if (retval) -- goto out; -- info(DRIVER_VERSION ": " DRIVER_DESC); --out: -+ if (!retval) -+ info(DRIVER_VERSION ": " DRIVER_DESC); -+ - return retval; - } - diff --git a/usb/usb-cp2101-add-new-device-ids.patch b/usb/usb-cp2101-add-new-device-ids.patch deleted file mode 100644 index d1140341939d8..0000000000000 --- a/usb/usb-cp2101-add-new-device-ids.patch +++ /dev/null @@ -1,48 +0,0 @@ -From craig@microtron.org.uk Thu Jan 19 16:05:09 2006 -From: Craig Shelley <craig@microtron.org.uk> -Subject: USB: cp2101 Add new device IDs -To: Greg KH <greg@kroah.com> -Date: Fri, 20 Jan 2006 00:06:19 +0000 -Message-Id: <1137715579.14806.70.camel@teratron.lan.etheus.net> - -The attached patch adds four new device IDs for the CP2101 driver. -Also 3 tab characters have been removed from device ID table. - -Signed-off-by: Craig Shelley <craig@microtron.org.uk> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/serial/cp2101.c | 14 +++++++++----- - 1 file changed, 9 insertions(+), 5 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/serial/cp2101.c -+++ gregkh-2.6/drivers/usb/serial/cp2101.c -@@ -32,7 +32,7 @@ - /* - * Version Information - */ --#define DRIVER_VERSION "v0.05" -+#define DRIVER_VERSION "v0.06" - #define DRIVER_DESC "Silicon Labs CP2101/CP2102 RS232 serial adaptor driver" - - /* -@@ -55,11 +55,15 @@ static int debug; - - static struct usb_device_id id_table [] = { - { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ -- { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ -- { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ -- { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ - { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ -- { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ -+ { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ -+ { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ -+ { USB_DEVICE(0x10C4, 0x807A) }, /* Crumb128 board */ -+ { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ -+ { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ -+ { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ -+ { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ -+ { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ - { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ - { } /* Terminating Entry */ - }; diff --git a/usb/usb-drivers-usb-media-ov511.c-remove-hooks-for-the-decomp-module.patch b/usb/usb-drivers-usb-media-ov511.c-remove-hooks-for-the-decomp-module.patch deleted file mode 100644 index c12e229c5f1f4..0000000000000 --- a/usb/usb-drivers-usb-media-ov511.c-remove-hooks-for-the-decomp-module.patch +++ /dev/null @@ -1,276 +0,0 @@ -From linux-kernel-owner+greg=40kroah.com-S932605AbWAFC2y@vger.kernel.org Thu Jan 5 19:16:06 2006 -Date: Fri, 6 Jan 2006 03:28:52 +0100 -From: Adrian Bunk <bunk@stusta.de> -To: mmcclell@bigfoot.com -Cc: gregkh@suse.de -Subject: USB: drivers/usb/media/ov511.c: remove hooks for the decomp module -Message-ID: <20060106022852.GW12313@stusta.de> -Content-Disposition: inline - -- the decomp module is not intended for inclusion into the kernel -- people using the decomp module from upstream will usually simply use - the complete upstream 2.xx driver - -Therefore, there seems to be no good reason spending some bytes of -kernel memory for hooks for this module. - - -Signed-off-by: Adrian Bunk <bunk@stusta.de> -Signed-off-by: Mark McClelland <mark@ovcam.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/media/ov511.c | 196 ---------------------------------------------- - 1 file changed, 2 insertions(+), 194 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/media/ov511.c -+++ gregkh-2.6/drivers/usb/media/ov511.c -@@ -204,22 +204,10 @@ MODULE_LICENSE("GPL"); - - static struct usb_driver ov511_driver; - --static struct ov51x_decomp_ops *ov511_decomp_ops; --static struct ov51x_decomp_ops *ov511_mmx_decomp_ops; --static struct ov51x_decomp_ops *ov518_decomp_ops; --static struct ov51x_decomp_ops *ov518_mmx_decomp_ops; -- - /* Number of times to retry a failed I2C transaction. Increase this if you - * are getting "Failed to read sensor ID..." */ - static const int i2c_detect_tries = 5; - --/* MMX support is present in kernel and CPU. Checked upon decomp module load. */ --#if defined(__i386__) || defined(__x86_64__) --#define ov51x_mmx_available (cpu_has_mmx) --#else --#define ov51x_mmx_available (0) --#endif -- - static struct usb_device_id device_table [] = { - { USB_DEVICE(VEND_OMNIVISION, PROD_OV511) }, - { USB_DEVICE(VEND_OMNIVISION, PROD_OV511PLUS) }, -@@ -3012,93 +3000,18 @@ yuv420raw_to_yuv420p(struct ov511_frame - * - **********************************************************************/ - --/* Chooses a decompression module, locks it, and sets ov->decomp_ops -- * accordingly. Returns -ENXIO if decompressor is not available, otherwise -- * returns 0 if no other error. -- */ - static int - request_decompressor(struct usb_ov511 *ov) - { -- if (!ov) -- return -ENODEV; -- -- if (ov->decomp_ops) { -- err("ERROR: Decompressor already requested!"); -- return -EINVAL; -- } -- -- lock_kernel(); -- -- /* Try to get MMX, and fall back on no-MMX if necessary */ -- if (ov->bclass == BCL_OV511) { -- if (ov511_mmx_decomp_ops) { -- PDEBUG(3, "Using OV511 MMX decompressor"); -- ov->decomp_ops = ov511_mmx_decomp_ops; -- } else if (ov511_decomp_ops) { -- PDEBUG(3, "Using OV511 decompressor"); -- ov->decomp_ops = ov511_decomp_ops; -- } else { -- err("No decompressor available"); -- } -- } else if (ov->bclass == BCL_OV518) { -- if (ov518_mmx_decomp_ops) { -- PDEBUG(3, "Using OV518 MMX decompressor"); -- ov->decomp_ops = ov518_mmx_decomp_ops; -- } else if (ov518_decomp_ops) { -- PDEBUG(3, "Using OV518 decompressor"); -- ov->decomp_ops = ov518_decomp_ops; -- } else { -- err("No decompressor available"); -- } -+ if (ov->bclass == BCL_OV511 || ov->bclass == BCL_OV518) { -+ err("No decompressor available"); - } else { - err("Unknown bridge"); - } - -- if (!ov->decomp_ops) -- goto nosys; -- -- if (!ov->decomp_ops->owner) { -- ov->decomp_ops = NULL; -- goto nosys; -- } -- -- if (!try_module_get(ov->decomp_ops->owner)) -- goto nosys; -- -- unlock_kernel(); -- return 0; -- -- nosys: -- unlock_kernel(); - return -ENOSYS; - } - --/* Unlocks decompression module and nulls ov->decomp_ops. Safe to call even -- * if ov->decomp_ops is NULL. -- */ --static void --release_decompressor(struct usb_ov511 *ov) --{ -- int released = 0; /* Did we actually do anything? */ -- -- if (!ov) -- return; -- -- lock_kernel(); -- -- if (ov->decomp_ops) { -- module_put(ov->decomp_ops->owner); -- released = 1; -- } -- -- ov->decomp_ops = NULL; -- -- unlock_kernel(); -- -- if (released) -- PDEBUG(3, "Decompressor released"); --} -- - static void - decompress(struct usb_ov511 *ov, struct ov511_frame *frame, - unsigned char *pIn0, unsigned char *pOut0) -@@ -3107,31 +3020,6 @@ decompress(struct usb_ov511 *ov, struct - if (request_decompressor(ov)) - return; - -- PDEBUG(4, "Decompressing %d bytes", frame->bytes_recvd); -- -- if (frame->format == VIDEO_PALETTE_GREY -- && ov->decomp_ops->decomp_400) { -- int ret = ov->decomp_ops->decomp_400( -- pIn0, -- pOut0, -- frame->compbuf, -- frame->rawwidth, -- frame->rawheight, -- frame->bytes_recvd); -- PDEBUG(4, "DEBUG: decomp_400 returned %d", ret); -- } else if (frame->format != VIDEO_PALETTE_GREY -- && ov->decomp_ops->decomp_420) { -- int ret = ov->decomp_ops->decomp_420( -- pIn0, -- pOut0, -- frame->compbuf, -- frame->rawwidth, -- frame->rawheight, -- frame->bytes_recvd); -- PDEBUG(4, "DEBUG: decomp_420 returned %d", ret); -- } else { -- err("Decompressor does not support this format"); -- } - } - - /********************************************************************** -@@ -4087,8 +3975,6 @@ ov51x_v4l1_close(struct inode *inode, st - ov->user--; - ov51x_stop_isoc(ov); - -- release_decompressor(ov); -- - if (ov->led_policy == LED_AUTO) - ov51x_led_control(ov, 0); - -@@ -6021,82 +5907,6 @@ static struct usb_driver ov511_driver = - * - ***************************************************************************/ - --/* Returns 0 for success */ --int --ov511_register_decomp_module(int ver, struct ov51x_decomp_ops *ops, int ov518, -- int mmx) --{ -- if (ver != DECOMP_INTERFACE_VER) { -- err("Decompression module has incompatible"); -- err("interface version %d", ver); -- err("Interface version %d is required", DECOMP_INTERFACE_VER); -- return -EINVAL; -- } -- -- if (!ops) -- return -EFAULT; -- -- if (mmx && !ov51x_mmx_available) { -- err("MMX not available on this system or kernel"); -- return -EINVAL; -- } -- -- lock_kernel(); -- -- if (ov518) { -- if (mmx) { -- if (ov518_mmx_decomp_ops) -- goto err_in_use; -- else -- ov518_mmx_decomp_ops = ops; -- } else { -- if (ov518_decomp_ops) -- goto err_in_use; -- else -- ov518_decomp_ops = ops; -- } -- } else { -- if (mmx) { -- if (ov511_mmx_decomp_ops) -- goto err_in_use; -- else -- ov511_mmx_decomp_ops = ops; -- } else { -- if (ov511_decomp_ops) -- goto err_in_use; -- else -- ov511_decomp_ops = ops; -- } -- } -- -- unlock_kernel(); -- return 0; -- --err_in_use: -- unlock_kernel(); -- return -EBUSY; --} -- --void --ov511_deregister_decomp_module(int ov518, int mmx) --{ -- lock_kernel(); -- -- if (ov518) { -- if (mmx) -- ov518_mmx_decomp_ops = NULL; -- else -- ov518_decomp_ops = NULL; -- } else { -- if (mmx) -- ov511_mmx_decomp_ops = NULL; -- else -- ov511_decomp_ops = NULL; -- } -- -- unlock_kernel(); --} -- - static int __init - usb_ov511_init(void) - { -@@ -6123,5 +5933,3 @@ usb_ov511_exit(void) - module_init(usb_ov511_init); - module_exit(usb_ov511_exit); - --EXPORT_SYMBOL(ov511_register_decomp_module); --EXPORT_SYMBOL(ov511_deregister_decomp_module); diff --git a/usb/usb-drivers-usb-media-w9968cf.c-remove-hooks-for-the-vpp-module.patch b/usb/usb-drivers-usb-media-w9968cf.c-remove-hooks-for-the-vpp-module.patch deleted file mode 100644 index a49fc8b7cda6b..0000000000000 --- a/usb/usb-drivers-usb-media-w9968cf.c-remove-hooks-for-the-vpp-module.patch +++ /dev/null @@ -1,285 +0,0 @@ -From linux-kernel-owner+greg=40kroah.com-S1161251AbWAHXnl@vger.kernel.org Sun Jan 8 15:46:55 2006 -Date: Mon, 9 Jan 2006 00:43:39 +0100 -From: Adrian Bunk <bunk@stusta.de> -To: gregkh@suse.de -Subject: USB: drivers/usb/media/w9968cf.c: remove hooks for the vpp module -Message-ID: <20060108234339.GQ3774@stusta.de> -Content-Disposition: inline - -- 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> - ---- - Documentation/usb/w9968cf.txt | 32 +--------- - drivers/usb/media/w9968cf.c | 128 ---------------------------------------- - drivers/usb/media/w9968cf.h | 1 - drivers/usb/media/w9968cf_vpp.h | 3 - 4 files changed, 7 insertions(+), 157 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/media/w9968cf_vpp.h -+++ gregkh-2.6/drivers/usb/media/w9968cf_vpp.h -@@ -37,7 +37,4 @@ struct w9968cf_vpp_t { - u8 busy; /* read-only flag: module is/is not in use */ - }; - --extern int w9968cf_vppmod_register(struct w9968cf_vpp_t*); --extern int w9968cf_vppmod_deregister(struct w9968cf_vpp_t*); -- - #endif /* _W9968CF_VPP_H_ */ ---- gregkh-2.6.orig/drivers/usb/media/w9968cf.h -+++ gregkh-2.6/drivers/usb/media/w9968cf.h -@@ -195,7 +195,6 @@ enum w9968cf_vpp_flag { - }; - - static struct w9968cf_vpp_t* w9968cf_vpp; --static DECLARE_MUTEX(w9968cf_vppmod_lock); - static DECLARE_WAIT_QUEUE_HEAD(w9968cf_vppmod_wait); - - static LIST_HEAD(w9968cf_dev_list); /* head of V4L registered cameras list */ ---- gregkh-2.6.orig/drivers/usb/media/w9968cf.c -+++ gregkh-2.6/drivers/usb/media/w9968cf.c -@@ -62,7 +62,6 @@ MODULE_LICENSE(W9968CF_MODULE_LICENSE); - MODULE_SUPPORTED_DEVICE("Video"); - - static int ovmod_load = W9968CF_OVMOD_LOAD; --static int vppmod_load = W9968CF_VPPMOD_LOAD; - static unsigned short simcams = W9968CF_SIMCAMS; - static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ - static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = -@@ -107,7 +106,6 @@ static unsigned int param_nv[24]; /* num - - #ifdef CONFIG_KMOD - module_param(ovmod_load, bool, 0644); --module_param(vppmod_load, bool, 0444); - #endif - module_param(simcams, ushort, 0644); - module_param_array(video_nr, short, ¶m_nv[0], 0444); -@@ -150,18 +148,6 @@ MODULE_PARM_DESC(ovmod_load, - "\ninto memory." - "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"." - "\n"); --MODULE_PARM_DESC(vppmod_load, -- "\n<0|1> Automatic 'w9968cf-vpp' module loading." -- "\n0 disabled, 1 enabled." -- "\nIf enabled, every time an application attempts to open a" -- "\ncamera, 'insmod' searches for the video post-processing" -- "\nmodule in the system and loads it automatically (if" -- "\npresent). The optional 'w9968cf-vpp' module adds extra" -- "\n image manipulation functions to the 'w9968cf' module,like" -- "\nsoftware up-scaling,colour conversions and video decoding" -- "\nfor very high frame rates." -- "\nDefault value is "__MODULE_STRING(W9968CF_VPPMOD_LOAD)"." -- "\n"); - #endif - MODULE_PARM_DESC(simcams, - "\n<n> Number of cameras allowed to stream simultaneously." -@@ -492,10 +478,6 @@ static void w9968cf_push_frame(struct w9 - static void w9968cf_pop_frame(struct w9968cf_device*,struct w9968cf_frame_t**); - static void w9968cf_release_resources(struct w9968cf_device*); - --/* Intermodule communication */ --static int w9968cf_vppmod_detect(struct w9968cf_device*); --static void w9968cf_vppmod_release(struct w9968cf_device*); -- - - - /**************************************************************************** -@@ -2737,9 +2719,7 @@ static int w9968cf_open(struct inode* in - cam->streaming = 0; - cam->misconfigured = 0; - -- if (!w9968cf_vpp) -- if ((err = w9968cf_vppmod_detect(cam))) -- goto out; -+ w9968cf_adjust_configuration(cam); - - if ((err = w9968cf_allocate_memory(cam))) - goto deallocate_memory; -@@ -2766,7 +2746,6 @@ static int w9968cf_open(struct inode* in - - deallocate_memory: - w9968cf_deallocate_memory(cam); --out: - DBG(2, "Failed to open the video device") - up(&cam->dev_sem); - up_read(&w9968cf_disconnect); -@@ -2784,8 +2763,6 @@ static int w9968cf_release(struct inode* - - w9968cf_stop_transfer(cam); - -- w9968cf_vppmod_release(cam); -- - if (cam->disconnected) { - w9968cf_release_resources(cam); - up(&cam->dev_sem); -@@ -3681,106 +3658,6 @@ static struct usb_driver w9968cf_usb_dri - * Module init, exit and intermodule communication * - ****************************************************************************/ - --static int w9968cf_vppmod_detect(struct w9968cf_device* cam) --{ -- if (!w9968cf_vpp) -- if (vppmod_load) -- request_module("w9968cf-vpp"); -- -- down(&w9968cf_vppmod_lock); -- -- if (!w9968cf_vpp) { -- DBG(4, "Video post-processing module not detected") -- w9968cf_adjust_configuration(cam); -- goto out; -- } -- -- if (!try_module_get(w9968cf_vpp->owner)) { -- DBG(1, "Couldn't increment the reference count of " -- "the video post-processing module") -- up(&w9968cf_vppmod_lock); -- return -ENOSYS; -- } -- -- w9968cf_vpp->busy++; -- -- DBG(5, "Video post-processing module detected") -- --out: -- up(&w9968cf_vppmod_lock); -- return 0; --} -- -- --static void w9968cf_vppmod_release(struct w9968cf_device* cam) --{ -- down(&w9968cf_vppmod_lock); -- -- if (w9968cf_vpp && w9968cf_vpp->busy) { -- module_put(w9968cf_vpp->owner); -- w9968cf_vpp->busy--; -- wake_up(&w9968cf_vppmod_wait); -- DBG(5, "Video post-processing module released") -- } -- -- up(&w9968cf_vppmod_lock); --} -- -- --int w9968cf_vppmod_register(struct w9968cf_vpp_t* vpp) --{ -- down(&w9968cf_vppmod_lock); -- -- if (w9968cf_vpp) { -- KDBG(1, "Video post-processing module already registered") -- up(&w9968cf_vppmod_lock); -- return -EINVAL; -- } -- -- w9968cf_vpp = vpp; -- w9968cf_vpp->busy = 0; -- -- KDBG(2, "Video post-processing module registered") -- up(&w9968cf_vppmod_lock); -- return 0; --} -- -- --int w9968cf_vppmod_deregister(struct w9968cf_vpp_t* vpp) --{ -- down(&w9968cf_vppmod_lock); -- -- if (!w9968cf_vpp) { -- up(&w9968cf_vppmod_lock); -- return -EINVAL; -- } -- -- if (w9968cf_vpp != vpp) { -- KDBG(1, "Only the owner can unregister the video " -- "post-processing module") -- up(&w9968cf_vppmod_lock); -- return -EINVAL; -- } -- -- if (w9968cf_vpp->busy) { -- KDBG(2, "Video post-processing module busy. Wait for it to be " -- "released...") -- up(&w9968cf_vppmod_lock); -- wait_event(w9968cf_vppmod_wait, !w9968cf_vpp->busy); -- w9968cf_vpp = NULL; -- goto out; -- } -- -- w9968cf_vpp = NULL; -- -- up(&w9968cf_vppmod_lock); -- --out: -- KDBG(2, "Video post-processing module unregistered") -- return 0; --} -- -- - static int __init w9968cf_module_init(void) - { - int err; -@@ -3810,6 +3687,3 @@ static void __exit w9968cf_module_exit(v - module_init(w9968cf_module_init); - module_exit(w9968cf_module_exit); - -- --EXPORT_SYMBOL(w9968cf_vppmod_register); --EXPORT_SYMBOL(w9968cf_vppmod_deregister); ---- gregkh-2.6.orig/Documentation/usb/w9968cf.txt -+++ gregkh-2.6/Documentation/usb/w9968cf.txt -@@ -57,16 +57,12 @@ based cameras should be supported as wel - The driver is divided into two modules: the basic one, "w9968cf", is needed for - the supported devices to work; the second one, "w9968cf-vpp", is an optional - module, which provides some useful video post-processing functions like video --decoding, up-scaling and colour conversions. Once the driver is installed, --every time an application tries to open a recognized device, "w9968cf" checks --the presence of the "w9968cf-vpp" module and loads it automatically by default. -- --Please keep in mind that official kernels do not include the second module for --performance purposes. However it is always recommended to download and install --the latest and complete release of the driver, replacing the existing one, if --present: it will be still even possible not to load the "w9968cf-vpp" module at --all, if you ever want to. Another important missing feature of the version in --the official Linux 2.4 kernels is the writeable /proc filesystem interface. -+decoding, up-scaling and colour conversions. -+ -+Note that the official kernels do neither include nor support the second -+module for performance purposes. Therefore, it is always recommended to -+download and install the latest and complete release of the driver, -+replacing the existing one, if present. - - The latest and full-featured version of the W996[87]CF driver can be found at: - http://www.linux-projects.org. Please refer to the documentation included in -@@ -201,22 +197,6 @@ Note: The kernel must be comp - enabled for the 'ovcamchip' module to be loaded and for - this parameter to be present. - ------------------------------------------------------------------------------- --Name: vppmod_load --Type: bool --Syntax: <0|1> --Description: Automatic 'w9968cf-vpp' module loading: 0 disabled, 1 enabled. -- If enabled, every time an application attempts to open a -- camera, 'insmod' searches for the video post-processing module -- in the system and loads it automatically (if present). -- The optional 'w9968cf-vpp' module adds extra image manipulation -- capabilities to the 'w9968cf' module,like software up-scaling, -- colour conversions and video decompression for very high frame -- rates. --Default: 1 --Note: The kernel must be compiled with the CONFIG_KMOD option -- enabled for the 'w9968cf-vpp' module to be loaded and for -- this parameter to be present. --------------------------------------------------------------------------------- - Name: simcams - Type: int - Syntax: <n> diff --git a/usb/usb-ehci-another-full-speed-iso-fix.patch b/usb/usb-ehci-another-full-speed-iso-fix.patch deleted file mode 100644 index 28c0338a55c2e..0000000000000 --- a/usb/usb-ehci-another-full-speed-iso-fix.patch +++ /dev/null @@ -1,30 +0,0 @@ -From david-b@pacbell.net Sun Jan 22 11:29:03 2006 -From: David Brownell <david-b@pacbell.net> -To: Greg KH <greg@kroah.com> -Subject: USB: EHCI, another full speed iso fix -Date: Sun, 22 Jan 2006 10:32:49 -0800 -Message-Id: <200601221032.49822.david-b@pacbell.net> - -From: Clemens Ladisch <clemens@ladisch.de> - -This patch adds a reinitializion for the uf variable that got modified -by the preceding start-split bandwidth check. - -Signed-off-by: Clemens Ladisch <clemens@ladisch.de> -Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/host/ehci-sched.c | 1 + - 1 file changed, 1 insertion(+) - ---- gregkh-2.6.orig/drivers/usb/host/ehci-sched.c -+++ gregkh-2.6/drivers/usb/host/ehci-sched.c -@@ -1063,6 +1063,7 @@ sitd_slot_ok ( - - /* for IN, check CSPLIT */ - if (stream->c_usecs) { -+ uf = uframe & 7; - max_used = 100 - stream->c_usecs; - do { - tmp = 1 << uf; diff --git a/usb/usb-ehci-fix-gfp_t-sparse-warning.patch b/usb/usb-ehci-fix-gfp_t-sparse-warning.patch deleted file mode 100644 index df91b8021ed9f..0000000000000 --- a/usb/usb-ehci-fix-gfp_t-sparse-warning.patch +++ /dev/null @@ -1,34 +0,0 @@ -From rdunlap@xenotime.net Sun Dec 25 19:30:06 2005 -Date: Sun, 25 Dec 2005 19:27:18 -0800 -From: "Randy.Dunlap" <rdunlap@xenotime.net> -Cc: gregkh <greg@kroah.com>, david-b@pacbell.net -Subject: USB EHCI: fix gfp_t sparse warning -Message-Id: <20051225192718.0ca15ef5.rdunlap@xenotime.net> - -From: Randy Dunlap <rdunlap@xenotime.net> - -Fix sparse warning: -drivers/usb/host/ehci-hcd.c:719:35: warning: incorrect type in argument 3 (different base types) -drivers/usb/host/ehci-hcd.c:719:35: expected unsigned int [unsigned] mem_flags -drivers/usb/host/ehci-hcd.c:719:35: got restricted unsigned int [usertype] mem_flags - -Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> -Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/host/ehci-sched.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/host/ehci-sched.c -+++ gregkh-2.6/drivers/usb/host/ehci-sched.c -@@ -1844,8 +1844,7 @@ done: - #else - - static inline int --sitd_submit (struct ehci_hcd *ehci, struct urb *urb, -- unsigned mem_flags) -+sitd_submit (struct ehci_hcd *ehci, struct urb *urb, gfp_t mem_flags) - { - ehci_dbg (ehci, "split iso support is disabled\n"); - return -ENOSYS; diff --git a/usb/usb-fix-ehci-early-handoff-issues-warning.patch b/usb/usb-fix-ehci-early-handoff-issues-warning.patch deleted file mode 100644 index a97080b82915a..0000000000000 --- a/usb/usb-fix-ehci-early-handoff-issues-warning.patch +++ /dev/null @@ -1,28 +0,0 @@ -From akpm@osdl.org Tue Jan 24 17:42:44 2006 -Message-Id: <200601250142.k0P1gfXO031519@shell0.pdx.osdl.net> -From: Andrew Morton <akpm@osdl.org> -Subject: USB: fix ehci early handoff issues warning -To: akpm@osdl.org, david-b@pacbell.net, greg@kroah.com -From: akpm@osdl.org -Date: Tue, 24 Jan 2006 17:42:24 -0800 - - -From: Andrew Morton <akpm@osdl.org> - -Cc: David Brownell <david-b@pacbell.net> -Signed-off-by: Andrew Morton <akpm@osdl.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> ---- - drivers/usb/host/ehci-pci.c | 1 - - 1 file changed, 1 deletion(-) - ---- gregkh-2.6.orig/drivers/usb/host/ehci-pci.c -+++ gregkh-2.6/drivers/usb/host/ehci-pci.c -@@ -29,7 +29,6 @@ static int ehci_pci_reinit(struct ehci_h - { - u32 temp; - int retval; -- unsigned count = 256/4; - - /* optional debug port, normally in the first BAR */ - temp = pci_find_capability(pdev, 0x0a); diff --git a/usb/usb-fix-ehci-early-handoff-issues.patch b/usb/usb-fix-ehci-early-handoff-issues.patch deleted file mode 100644 index 8545b1e7f43c0..0000000000000 --- a/usb/usb-fix-ehci-early-handoff-issues.patch +++ /dev/null @@ -1,247 +0,0 @@ -From david-b@pacbell.net Tue Jan 24 07:15:40 2006 -From: David Brownell <david-b@pacbell.net> -Subject: USB: fix EHCI early handoff issues -Date: Tue, 24 Jan 2006 07:15:30 -0800 -Cc: Greg KH <greg@kroah.com>, Andrew Morton <akpm@osdl.org>, "Carlo E. Prelz" <fluido@fluido.as> -Message-Id: <200601240715.30368.david-b@pacbell.net> - - -This moves the previously widely-used ehci-pci.c BIOS handoff -code into the pci-quirks.c file, replacing the less widely used -"early handoff" version that seems to cause problems lately. - -One notable change: the "early handoff" version always enabled -an SMI IRQ ... and did so even if the pre-Linux code said it was -not using EHCI (and not expecting EHCI SMIs). Looks like a goof -in a workaround for some unknown BIOS version. - -This merged version only forcibly enables those IRQs when pre-Linux -code says it's using EHCI. And now it always forces them off "just -in case". - -Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/host/ehci-pci.c | 63 +----------------------- - drivers/usb/host/pci-quirks.c | 106 ++++++++++++++++++++++++++---------------- - 2 files changed, 71 insertions(+), 98 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/host/ehci-pci.c -+++ gregkh-2.6/drivers/usb/host/ehci-pci.c -@@ -24,40 +24,6 @@ - - /*-------------------------------------------------------------------------*/ - --/* EHCI 0.96 (and later) section 5.1 says how to kick BIOS/SMM/... -- * off the controller (maybe it can boot from highspeed USB disks). -- */ --static int bios_handoff(struct ehci_hcd *ehci, int where, u32 cap) --{ -- struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller); -- -- /* always say Linux will own the hardware */ -- pci_write_config_byte(pdev, where + 3, 1); -- -- /* maybe wait a while for BIOS to respond */ -- if (cap & (1 << 16)) { -- int msec = 5000; -- -- do { -- msleep(10); -- msec -= 10; -- pci_read_config_dword(pdev, where, &cap); -- } while ((cap & (1 << 16)) && msec); -- if (cap & (1 << 16)) { -- ehci_err(ehci, "BIOS handoff failed (%d, %08x)\n", -- where, cap); -- // some BIOS versions seem buggy... -- // return 1; -- ehci_warn(ehci, "continuing after BIOS bug...\n"); -- /* disable all SMIs, and clear "BIOS owns" flag */ -- pci_write_config_dword(pdev, where + 4, 0); -- pci_write_config_byte(pdev, where + 2, 0); -- } else -- ehci_dbg(ehci, "BIOS handoff succeeded\n"); -- } -- return 0; --} -- - /* called after powerup, by probe or system-pm "wakeup" */ - static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) - { -@@ -84,32 +50,9 @@ static int ehci_pci_reinit(struct ehci_h - } - } - -- temp = HCC_EXT_CAPS(readl(&ehci->caps->hcc_params)); -- -- /* EHCI 0.96 and later may have "extended capabilities" */ -- while (temp && count--) { -- u32 cap; -- -- pci_read_config_dword(pdev, temp, &cap); -- ehci_dbg(ehci, "capability %04x at %02x\n", cap, temp); -- switch (cap & 0xff) { -- case 1: /* BIOS/SMM/... handoff */ -- if (bios_handoff(ehci, temp, cap) != 0) -- return -EOPNOTSUPP; -- break; -- case 0: /* illegal reserved capability */ -- ehci_dbg(ehci, "illegal capability!\n"); -- cap = 0; -- /* FALLTHROUGH */ -- default: /* unknown */ -- break; -- } -- temp = (cap >> 8) & 0xff; -- } -- if (!count) { -- ehci_err(ehci, "bogus capabilities ... PCI problems!\n"); -- return -EIO; -- } -+ /* we expect static quirk code to handle the "extended capabilities" -+ * (currently just BIOS handoff) allowed starting with EHCI 0.96 -+ */ - - /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ - retval = pci_set_mwi(pdev); ---- gregkh-2.6.orig/drivers/usb/host/pci-quirks.c -+++ gregkh-2.6/drivers/usb/host/pci-quirks.c -@@ -190,7 +190,7 @@ static void __devinit quirk_usb_handoff_ - msleep(10); - } - if (wait_time <= 0) -- printk(KERN_WARNING "%s %s: early BIOS handoff " -+ printk(KERN_WARNING "%s %s: BIOS handoff " - "failed (BIOS bug ?)\n", - pdev->dev.bus_id, "OHCI"); - -@@ -212,8 +212,9 @@ static void __devinit quirk_usb_disable_ - { - int wait_time, delta; - void __iomem *base, *op_reg_base; -- u32 hcc_params, val, temp; -- u8 cap_length; -+ u32 hcc_params, val; -+ u8 offset, cap_length; -+ int count = 256/4; - - if (!mmio_resource_enabled(pdev, 0)) - return; -@@ -224,51 +225,80 @@ static void __devinit quirk_usb_disable_ - - cap_length = readb(base); - op_reg_base = base + cap_length; -+ -+ /* EHCI 0.96 and later may have "extended capabilities" -+ * spec section 5.1 explains the bios handoff, e.g. for -+ * booting from USB disk or using a usb keyboard -+ */ - hcc_params = readl(base + EHCI_HCC_PARAMS); -- hcc_params = (hcc_params >> 8) & 0xff; -- if (hcc_params) { -- pci_read_config_dword(pdev, -- hcc_params + EHCI_USBLEGSUP, -- &val); -- if (((val & 0xff) == 1) && (val & EHCI_USBLEGSUP_BIOS)) { -- /* -- * Ok, BIOS is in smm mode, try to hand off... -- */ -- pci_read_config_dword(pdev, -- hcc_params + EHCI_USBLEGCTLSTS, -- &temp); -- pci_write_config_dword(pdev, -- hcc_params + EHCI_USBLEGCTLSTS, -- temp | EHCI_USBLEGCTLSTS_SOOE); -- val |= EHCI_USBLEGSUP_OS; -- pci_write_config_dword(pdev, -- hcc_params + EHCI_USBLEGSUP, -- val); -+ offset = (hcc_params >> 8) & 0xff; -+ while (offset && count--) { -+ u32 cap; -+ int msec; -+ -+ pci_read_config_dword(pdev, offset, &cap); -+ switch (cap & 0xff) { -+ case 1: /* BIOS/SMM/... handoff support */ -+ if ((cap & EHCI_USBLEGSUP_BIOS)) { -+ pr_debug("%s %s: BIOS handoff\n", -+ pdev->dev.bus_id, "EHCI"); - -- wait_time = 500; -- do { -- msleep(10); -- wait_time -= 10; -+ /* BIOS workaround (?): be sure the -+ * pre-Linux code receives the SMI -+ */ - pci_read_config_dword(pdev, -- hcc_params + EHCI_USBLEGSUP, -+ offset + EHCI_USBLEGCTLSTS, - &val); -- } while (wait_time && (val & EHCI_USBLEGSUP_BIOS)); -- if (!wait_time) { -- /* -- * well, possibly buggy BIOS... -+ pci_write_config_dword(pdev, -+ offset + EHCI_USBLEGCTLSTS, -+ val | EHCI_USBLEGCTLSTS_SOOE); -+ } -+ -+ /* always say Linux will own the hardware -+ * by setting EHCI_USBLEGSUP_OS. -+ */ -+ pci_write_config_byte(pdev, offset + 3, 1); -+ -+ /* if boot firmware now owns EHCI, spin till -+ * it hands it over. -+ */ -+ msec = 5000; -+ while ((cap & EHCI_USBLEGSUP_BIOS) && (msec > 0)) { -+ msleep(10); -+ msec -= 10; -+ pci_read_config_dword(pdev, offset, &cap); -+ } -+ -+ if (cap & EHCI_USBLEGSUP_BIOS) { -+ /* well, possibly buggy BIOS... try to shut -+ * it down, and hope nothing goes too wrong - */ -- printk(KERN_WARNING "%s %s: early BIOS handoff " -+ printk(KERN_WARNING "%s %s: BIOS handoff " - "failed (BIOS bug ?)\n", - pdev->dev.bus_id, "EHCI"); -- pci_write_config_dword(pdev, -- hcc_params + EHCI_USBLEGSUP, -- EHCI_USBLEGSUP_OS); -- pci_write_config_dword(pdev, -- hcc_params + EHCI_USBLEGCTLSTS, -- 0); -+ pci_write_config_byte(pdev, offset + 2, 0); - } -+ -+ /* just in case, always disable EHCI SMIs */ -+ pci_write_config_dword(pdev, -+ offset + EHCI_USBLEGCTLSTS, -+ 0); -+ break; -+ case 0: /* illegal reserved capability */ -+ cap = 0; -+ /* FALLTHROUGH */ -+ default: -+ printk(KERN_WARNING "%s %s: unrecognized " -+ "capability %02x\n", -+ pdev->dev.bus_id, "EHCI", -+ cap & 0xff); -+ break; - } -+ offset = (cap >> 8) & 0xff; - } -+ if (!count) -+ printk(KERN_DEBUG "%s %s: capability loop?\n", -+ pdev->dev.bus_id, "EHCI"); - - /* - * halt EHCI & disable its interrupts in any case diff --git a/usb/usb-fix-oops-in-acm-disconnect.patch b/usb/usb-fix-oops-in-acm-disconnect.patch deleted file mode 100644 index e53eaa1255aef..0000000000000 --- a/usb/usb-fix-oops-in-acm-disconnect.patch +++ /dev/null @@ -1,43 +0,0 @@ -From oliver@neukum.org Sun Jan 8 03:39:31 2006 -From: Oliver Neukum <oliver@neukum.org> -To: Greg KH <gregkh@suse.de> -Subject: USB: fix oops in acm disconnect -Date: Sun, 8 Jan 2006 12:39:13 +0100 -Content-Disposition: inline -Message-Id: <200601081239.13589.oliver@neukum.org> - -this fixes an oops with disconnection in acm. - -Signed-off-by: Oliver Neukum <oliver@neukum.name> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/class/cdc-acm.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/class/cdc-acm.c -+++ gregkh-2.6/drivers/usb/class/cdc-acm.c -@@ -1014,8 +1014,13 @@ static void acm_disconnect(struct usb_in - } - - down(&open_sem); -+ if (!usb_get_intfdata(intf)) { -+ up(&open_sem); -+ return; -+ } - acm->dev = NULL; -- usb_set_intfdata (intf, NULL); -+ usb_set_intfdata(acm->control, NULL); -+ usb_set_intfdata(acm->data, NULL); - - tasklet_disable(&acm->urb_task); - -@@ -1036,7 +1041,7 @@ static void acm_disconnect(struct usb_in - for (i = 0; i < ACM_NRB; i++) - usb_buffer_free(usb_dev, acm->readsize, acm->rb[i].base, acm->rb[i].dma); - -- usb_driver_release_interface(&acm_driver, acm->data); -+ usb_driver_release_interface(&acm_driver, intf == acm->control ? acm->data : intf); - - if (!acm->used) { - acm_tty_unregister(acm); diff --git a/usb/usb-ftdi_sio-new-ids-for-westrex-devices.patch b/usb/usb-ftdi_sio-new-ids-for-westrex-devices.patch deleted file mode 100644 index 9c69948c560d9..0000000000000 --- a/usb/usb-ftdi_sio-new-ids-for-westrex-devices.patch +++ /dev/null @@ -1,48 +0,0 @@ -From ian.abbott@mev.co.uk Mon Jan 9 09:18:11 2006 -Message-ID: <43C2994C.1080009@mev.co.uk> -Date: Mon, 09 Jan 2006 17:11:40 +0000 -From: Ian Abbott <abbotti@mev.co.uk> -To: Greg KH <greg@kroah.com>, Cory Lee <coryclee_1@yahoo.com> -Subject: USB: ftdi_sio: new IDs for Westrex devices - -From: Ian Abbott <abbotti@mev.co.uk> - -This patch adds two new devices to the ftdi_sio driver's device ID -table. The device IDs were supplied by Cory Lee to support two POS -printers made by Westrex International (Model 777 and Model 8900F). - -Signed-off-by: Ian Abbott <abbotti@mev.co.uk> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - - ---- - drivers/usb/serial/ftdi_sio.c | 2 ++ - drivers/usb/serial/ftdi_sio.h | 6 ++++++ - 2 files changed, 8 insertions(+) - ---- gregkh-2.6.orig/drivers/usb/serial/ftdi_sio.c -+++ gregkh-2.6/drivers/usb/serial/ftdi_sio.c -@@ -481,6 +481,8 @@ static struct usb_device_id id_table_com - { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, - { USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_TTUSB_PID) }, -+ { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_777_PID) }, -+ { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_8900F_PID) }, - { }, /* Optional parameter entry */ - { } /* Terminating entry */ - }; ---- gregkh-2.6.orig/drivers/usb/serial/ftdi_sio.h -+++ gregkh-2.6/drivers/usb/serial/ftdi_sio.h -@@ -370,6 +370,12 @@ - #define POSIFLEX_VID 0x0d3a /* Vendor ID */ - #define POSIFLEX_PP7000_PID 0x0300 /* PP-7000II thermal printer */ - -+/* -+ * Westrex International devices submitted by Cory Lee -+ */ -+#define FTDI_WESTREX_MODEL_777_PID 0xDC00 /* Model 777 */ -+#define FTDI_WESTREX_MODEL_8900F_PID 0xDC01 /* Model 8900F */ -+ - /* Commands */ - #define FTDI_SIO_RESET 0 /* Reset the port */ - #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ diff --git a/usb/usb-ftdi_sio-new-pid-for-pcdj-dac2.patch b/usb/usb-ftdi_sio-new-pid-for-pcdj-dac2.patch deleted file mode 100644 index da13cf255323a..0000000000000 --- a/usb/usb-ftdi_sio-new-pid-for-pcdj-dac2.patch +++ /dev/null @@ -1,45 +0,0 @@ -From linux-usb-devel-admin@lists.sourceforge.net Tue Jan 3 05:34:29 2006 -From: Wouter Paesen <wouter@kangaroot.net> -Message-ID: <20060103133031.GA10080@tougher.kangaroot.net> -Content-Disposition: inline -Subject: USB: ftdi_sio: new PID for PCDJ DAC2 -Date: Tue, 3 Jan 2006 14:30:31 +0100 - - -The attached patch adds a new PID for the ftdi_sio driver. It will -enable support for PC-DJ's DAC-2 controller module -(more information on http://www.pcdjhardware.com/DAC2.asp) - -Signed-off-by: Wouter Paesen <wouter@kangaroot.net> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/serial/ftdi_sio.c | 1 + - drivers/usb/serial/ftdi_sio.h | 6 ++++++ - 2 files changed, 7 insertions(+) - ---- gregkh-2.6.orig/drivers/usb/serial/ftdi_sio.c -+++ gregkh-2.6/drivers/usb/serial/ftdi_sio.c -@@ -483,6 +483,7 @@ static struct usb_device_id id_table_com - { USB_DEVICE(FTDI_VID, FTDI_TTUSB_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_777_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_8900F_PID) }, -+ { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, - { }, /* Optional parameter entry */ - { } /* Terminating entry */ - }; ---- gregkh-2.6.orig/drivers/usb/serial/ftdi_sio.h -+++ gregkh-2.6/drivers/usb/serial/ftdi_sio.h -@@ -56,6 +56,12 @@ - #define FTDI_VNHCPCUSB_D_PID 0xfe38 /* Product Id */ - - /* -+ * PCDJ use ftdi based dj-controllers. The following PID is for their DAC-2 device -+ * http://www.pcdjhardware.com/DAC2.asp (PID sent by Wouter Paesen) -+ * (the VID is the standard ftdi vid (FTDI_VID) */ -+#define FTDI_PCDJ_DAC2_PID 0xFA88 -+ -+/* - * The following are the values for the Matrix Orbital LCD displays, - * which are the FT232BM ( similar to the 8U232AM ) - */ diff --git a/usb/usb-gadget-zero-and-dma-coherent-buffers.patch b/usb/usb-gadget-zero-and-dma-coherent-buffers.patch deleted file mode 100644 index 61608d855edfc..0000000000000 --- a/usb/usb-gadget-zero-and-dma-coherent-buffers.patch +++ /dev/null @@ -1,44 +0,0 @@ -From david-b@pacbell.net Fri Jan 20 17:25:17 2006 -From: David Brownell <david-b@pacbell.net> -To: Greg KH <greg@kroah.com> -Subject: USB: gadget zero and dma-coherent buffers -Date: Fri, 20 Jan 2006 14:38:49 -0800 -Message-Id: <200601201438.49982.david-b@pacbell.net> - -This makes sure that the correct length is reported when freeing -a dma-coherent buffer; some platforms complain if that's wrong. -It also makes two parameters readonly in sysfs, as they're not -safe to change while tests are running. - -Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/gadget/zero.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/gadget/zero.c -+++ gregkh-2.6/drivers/usb/gadget/zero.c -@@ -165,8 +165,8 @@ static unsigned buflen = 4096; - static unsigned qlen = 32; - static unsigned pattern = 0; - --module_param (buflen, uint, S_IRUGO|S_IWUSR); --module_param (qlen, uint, S_IRUGO|S_IWUSR); -+module_param (buflen, uint, S_IRUGO); -+module_param (qlen, uint, S_IRUGO); - module_param (pattern, uint, S_IRUGO|S_IWUSR); - - /* -@@ -1127,8 +1127,10 @@ zero_unbind (struct usb_gadget *gadget) - DBG (dev, "unbind\n"); - - /* we've already been disconnected ... no i/o is active */ -- if (dev->req) -+ if (dev->req) { -+ dev->req->length = USB_BUFSIZ; - free_ep_req (gadget->ep0, dev->req); -+ } - del_timer_sync (&dev->resume); - kfree (dev); - set_gadget_data (gadget, NULL); diff --git a/usb/usb-gadgetfs-set-zero-flag-for-short-control-in-response.patch b/usb/usb-gadgetfs-set-zero-flag-for-short-control-in-response.patch deleted file mode 100644 index 75905663f9713..0000000000000 --- a/usb/usb-gadgetfs-set-zero-flag-for-short-control-in-response.patch +++ /dev/null @@ -1,63 +0,0 @@ -From stern@rowland.harvard.edu Tue Jan 3 07:35:07 2006 -Date: Tue, 3 Jan 2006 10:30:31 -0500 (EST) -From: Alan Stern <stern@rowland.harvard.edu> -To: Greg KH <greg@kroah.com> -cc: David Brownell <david-b@pacbell.net> -Subject: USB: gadgetfs: set "zero" flag for short control-IN response -Message-ID: <Pine.LNX.4.44L0.0601031022330.5297-100000@iolanthe.rowland.org> - - -This patch (as622) makes gadgetfs set the "zero" flag for control-IN -responses, when the length of the response is shorter than the length of -the request. - - -Signed-off-by: Alan Stern <stern@rowland.harvard.edu> -Acked-by: David Brownell <david-b@pacbell.net> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/gadget/inode.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - ---- gregkh-2.6.orig/drivers/usb/gadget/inode.c -+++ gregkh-2.6/drivers/usb/gadget/inode.c -@@ -135,6 +135,7 @@ struct dev_data { - setup_out_ready : 1, - setup_out_error : 1, - setup_abort : 1; -+ unsigned setup_wLength; - - /* the rest is basically write-once */ - struct usb_config_descriptor *config, *hs_config; -@@ -942,6 +943,7 @@ static int setup_req (struct usb_ep *ep, - } - req->complete = ep0_complete; - req->length = len; -+ req->zero = 0; - return 0; - } - -@@ -1161,10 +1163,13 @@ ep0_write (struct file *fd, const char _ - spin_unlock_irq (&dev->lock); - if (copy_from_user (dev->req->buf, buf, len)) - retval = -EFAULT; -- else -+ else { -+ if (len < dev->setup_wLength) -+ dev->req->zero = 1; - retval = usb_ep_queue ( - dev->gadget->ep0, dev->req, - GFP_KERNEL); -+ } - if (retval < 0) { - spin_lock_irq (&dev->lock); - clean_req (dev->gadget->ep0, dev->req); -@@ -1483,6 +1488,7 @@ unrecognized: - delegate: - dev->setup_in = (ctrl->bRequestType & USB_DIR_IN) - ? 1 : 0; -+ dev->setup_wLength = w_length; - dev->setup_out_ready = 0; - dev->setup_out_error = 0; - value = 0; diff --git a/usb/usb-hid-add-blacklist-entry-for-hp-keyboard.patch b/usb/usb-hid-add-blacklist-entry-for-hp-keyboard.patch deleted file mode 100644 index bda20c23a9964..0000000000000 --- a/usb/usb-hid-add-blacklist-entry-for-hp-keyboard.patch +++ /dev/null @@ -1,55 +0,0 @@ -From vojtech@suse.cz Wed Jan 25 22:44:04 2006 -Date: Thu, 26 Jan 2006 07:44:31 +0100 -From: Vojtech Pavlik <vojtech@suse.cz> -To: Alan Stern <stern@rowland.harvard.edu> -Cc: Greg KH <greg@kroah.com>, <Johannes.Deisenhofer@tomorrow-focus.de>, Pete Zaitcev <zaitcev@redhat.com>, -Subject: USB HID: add blacklist entry for HP keyboard -Message-ID: <20060126064431.GA6764@suse.cz> -Content-Disposition: inline - -My earlier experiment (adding a clear-halt for the interrupt-in -endpoint) failed. It turns out that it does cause problems for other -devices. And it wasn't needed anyway; a simple blacklist entry was -enough to get my HP keyboard working. - -This patch (as643) removes the clear-halt call and adds the blacklist -entry. - -Signed-off-by: Alan Stern <stern@rowland.harvard.edu> -Signed-off-by: Vojtech Pavlik <vojtech@suse.cz> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/input/hid-core.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/input/hid-core.c -+++ gregkh-2.6/drivers/usb/input/hid-core.c -@@ -1453,6 +1453,9 @@ void hid_init_reports(struct hid_device - #define USB_VENDOR_ID_CHERRY 0x046a - #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 - -+#define USB_VENDOR_ID_HP 0x03f0 -+#define USB_DEVICE_ID_HP_USBHUB_KB 0x020c -+ - /* - * Alphabetically sorted blacklist by quirk type. - */ -@@ -1566,6 +1569,7 @@ static const struct hid_blacklist { - { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, - { USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_KEYBOARD, HID_QUIRK_NOGET}, - { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET}, -+ { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET }, - { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, - - { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_POWERMOUSE, HID_QUIRK_2WHEEL_POWERMOUSE }, -@@ -1828,9 +1832,6 @@ static struct hid_device *usb_hid_config - hid->urbctrl->transfer_dma = hid->ctrlbuf_dma; - hid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); - -- /* May be needed for some devices */ -- usb_clear_halt(hid->dev, hid->urbin->pipe); -- - return hid; - - fail: diff --git a/usb/usb-isp116x-hcd-replace-mdelay-by-msleep.patch b/usb/usb-isp116x-hcd-replace-mdelay-by-msleep.patch deleted file mode 100644 index 639e8464025c3..0000000000000 --- a/usb/usb-isp116x-hcd-replace-mdelay-by-msleep.patch +++ /dev/null @@ -1,77 +0,0 @@ -From ok@artecdesign.ee Tue Dec 27 06:04:38 2005 -Date: Tue, 27 Dec 2005 16:04:02 +0200 (EET) -From: Olav Kongas <ok@artecdesign.ee> -To: Greg KH <greg@kroah.com> -Subject: USB: isp116x-hcd: replace mdelay() by msleep() -Message-ID: <Pine.LNX.4.63.0512271553090.5088@pcy.artec.ee> - -Replace mdelay() by msleep() in bus_suspend(); the rest of the system will -gain 7ms. The related code is reorganized to minimize the number of -locking/unlocking calls. - -The last hunk of the patch is the formatting change by Lindent. - -Signed-off-by: Olav Kongas <ok@artecdesign.ee> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/host/isp116x-hcd.c | 21 +++++++++++---------- - 1 file changed, 11 insertions(+), 10 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/host/isp116x-hcd.c -+++ gregkh-2.6/drivers/usb/host/isp116x-hcd.c -@@ -1420,20 +1420,22 @@ static int isp116x_bus_suspend(struct us - int ret = 0; - - spin_lock_irqsave(&isp116x->lock, flags); -- - val = isp116x_read_reg32(isp116x, HCCONTROL); -+ - switch (val & HCCONTROL_HCFS) { - case HCCONTROL_USB_OPER: -+ spin_unlock_irqrestore(&isp116x->lock, flags); - val &= (~HCCONTROL_HCFS & ~HCCONTROL_RWE); - val |= HCCONTROL_USB_SUSPEND; - if (device_may_wakeup(&hcd->self.root_hub->dev)) - val |= HCCONTROL_RWE; - /* Wait for usb transfers to finish */ -- mdelay(2); -+ msleep(2); -+ spin_lock_irqsave(&isp116x->lock, flags); - isp116x_write_reg32(isp116x, HCCONTROL, val); -+ spin_unlock_irqrestore(&isp116x->lock, flags); - /* Wait for devices to suspend */ -- mdelay(5); -- case HCCONTROL_USB_SUSPEND: -+ msleep(5); - break; - case HCCONTROL_USB_RESUME: - isp116x_write_reg32(isp116x, HCCONTROL, -@@ -1441,12 +1443,11 @@ static int isp116x_bus_suspend(struct us - HCCONTROL_USB_RESET); - case HCCONTROL_USB_RESET: - ret = -EBUSY; -+ default: /* HCCONTROL_USB_SUSPEND */ -+ spin_unlock_irqrestore(&isp116x->lock, flags); - break; -- default: -- ret = -EINVAL; - } - -- spin_unlock_irqrestore(&isp116x->lock, flags); - return ret; - } - -@@ -1715,9 +1716,9 @@ static struct platform_driver isp116x_dr - .remove = isp116x_remove, - .suspend = isp116x_suspend, - .resume = isp116x_resume, -- .driver = { -- .name = (char *)hcd_name, -- }, -+ .driver = { -+ .name = (char *)hcd_name, -+ }, - }; - - /*-----------------------------------------------------------------*/ diff --git a/usb/usb-libusual-fix-warning-on-64bit-boxes.patch b/usb/usb-libusual-fix-warning-on-64bit-boxes.patch deleted file mode 100644 index ba4e4f4112e7e..0000000000000 --- a/usb/usb-libusual-fix-warning-on-64bit-boxes.patch +++ /dev/null @@ -1,34 +0,0 @@ -From akpm@osdl.org Tue Jan 17 15:37:25 2006 -Message-Id: <200601172337.k0HNbPhc006451@shell0.pdx.osdl.net> -From: Alan Cox <alan@lxorguk.ukuu.org.uk> -Subject: USB: libusual: fix warning on 64bit boxes -To: alan@lxorguk.ukuu.org.uk, alan@redhat.com, greg@kroah.com, - zaitcev@redhat.com, mm-commits@vger.kernel.org -From: akpm@osdl.org -Date: Tue, 17 Jan 2006 15:39:25 -0800 - -From: Alan Cox <alan@lxorguk.ukuu.org.uk> - -We cast an int to a void * which not unreasonably makes gcc suspicious. -We don't actually care what type "type" is so use unsigned long so it -matches pointer length on all platforms. - -Signed-off-by: Alan Cox <alan@redhat.com> -Acked-by: Pete Zaitcev <zaitcev@redhat.com> -Signed-off-by: Andrew Morton <akpm@osdl.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> ---- - drivers/usb/storage/libusual.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- gregkh-2.6.orig/drivers/usb/storage/libusual.c -+++ gregkh-2.6/drivers/usb/storage/libusual.c -@@ -116,7 +116,7 @@ EXPORT_SYMBOL_GPL(usb_usual_check_type); - static int usu_probe(struct usb_interface *intf, - const struct usb_device_id *id) - { -- int type; -+ unsigned long type; - int rc; - unsigned long flags; - diff --git a/usb/usb-net2280-warning-fix.patch b/usb/usb-net2280-warning-fix.patch deleted file mode 100644 index 9cd4eee18f456..0000000000000 --- a/usb/usb-net2280-warning-fix.patch +++ /dev/null @@ -1,32 +0,0 @@ -From akpm@osdl.org Wed Jan 18 23:55:24 2006 -Message-Id: <200601190755.k0J7tMAA027510@shell0.pdx.osdl.net> -From: David Brownell <david-b@pacbell.net> -Subject: USB: net2280 warning fix -To: greg@kroah.com -Cc: akpm@osdl.org, david-b@pacbell.net, dbrownell@users.sourceforge.net -From: akpm@osdl.org -Date: Wed, 18 Jan 2006 23:55:08 -0800 - - -From: David Brownell <david-b@pacbell.net> - -For some reason alpha doesn't include <linux/dma-mapping.h> where other -architectures do; this makes net2280 include it explicitly. - -Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> -Signed-off-by: Andrew Morton <akpm@osdl.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> ---- - drivers/usb/gadget/net2280.c | 1 + - 1 file changed, 1 insertion(+) - ---- gregkh-2.6.orig/drivers/usb/gadget/net2280.c -+++ gregkh-2.6/drivers/usb/gadget/net2280.c -@@ -47,6 +47,7 @@ - #include <linux/config.h> - #include <linux/module.h> - #include <linux/pci.h> -+#include <linux/dma-mapping.h> - #include <linux/kernel.h> - #include <linux/delay.h> - #include <linux/ioport.h> diff --git a/usb/usb-new-id-for-ftdi_sio.c-and-ftdi_sio.h.patch b/usb/usb-new-id-for-ftdi_sio.c-and-ftdi_sio.h.patch deleted file mode 100644 index 4a5bd654f4920..0000000000000 --- a/usb/usb-new-id-for-ftdi_sio.c-and-ftdi_sio.h.patch +++ /dev/null @@ -1,47 +0,0 @@ -From louis.nyffenegger@gmail.com Thu Jan 5 08:53:35 2006 -Message-ID: <43BD4755.3020902@gmail.com> -Date: Thu, 05 Jan 2006 17:20:37 +0100 -From: Louis Nyffenegger <louis.nyffenegger@gmail.com> -To: greg@kroah.com -Subject: USB: new id for ftdi_sio.c and ftdi_sio.h - -this patch includes the Vendor Id for a optic fiber to USB device named -TTUSB from thought Technology. It's just add the vendor Id to -ftdi_sio.h and add the Vendor ID and model Id to table_combined. - -Signed-off-by: Louis Nyffenegger <louis.nyffenegger@gmail.com> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - - ---- - drivers/usb/serial/ftdi_sio.c | 1 + - drivers/usb/serial/ftdi_sio.h | 5 +++++ - 2 files changed, 6 insertions(+) - ---- gregkh-2.6.orig/drivers/usb/serial/ftdi_sio.h -+++ gregkh-2.6/drivers/usb/serial/ftdi_sio.h -@@ -31,9 +31,14 @@ - #define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */ - #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ - -+ - /* www.irtrans.de device */ - #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ - -+ -+/* www.thoughttechnology.com/ TT-USB provide with procomp use ftdi_sio */ -+#define FTDI_TTUSB_PID 0xFF20 /* Product Id */ -+ - /* www.crystalfontz.com devices - thanx for providing free devices for evaluation ! */ - /* they use the ftdi chipset for the USB interface and the vendor id is the same */ - #define FTDI_XF_632_PID 0xFC08 /* 632: 16x2 Character Display */ ---- gregkh-2.6.orig/drivers/usb/serial/ftdi_sio.c -+++ gregkh-2.6/drivers/usb/serial/ftdi_sio.c -@@ -480,6 +480,7 @@ static struct usb_device_id id_table_com - { USB_DEVICE(KOBIL_VID, KOBIL_CONV_B1_PID) }, - { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, - { USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) }, -+ { USB_DEVICE(FTDI_VID, FTDI_TTUSB_PID) }, - { }, /* Optional parameter entry */ - { } /* Terminating entry */ - }; diff --git a/usb/usb-pl2303-added-support-for-ca-42-clone-cable.patch b/usb/usb-pl2303-added-support-for-ca-42-clone-cable.patch deleted file mode 100644 index 8de18aea38f32..0000000000000 --- a/usb/usb-pl2303-added-support-for-ca-42-clone-cable.patch +++ /dev/null @@ -1,39 +0,0 @@ -From martin.gingras@gmail.com Mon Jan 9 09:40:38 2006 -Message-ID: <eb6a72270601090935l6f49bfaid93952975b7ee758@mail.gmail.com> -Date: Mon, 9 Jan 2006 12:35:41 -0500 -From: Martin Gingras <martin.gingras@gmail.com> -To: Greg KH <greg@kroah.com> -Subject: USB: pl2303: Added support for CA-42 clone cable - -Added support for CA-42 clone cable (www.ca-42.com) - -Signed-off-by: Martin Gingras <martin.gingras@gmail.com> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/serial/pl2303.c | 3 ++- - drivers/usb/serial/pl2303.h | 4 ++++ - 2 files changed, 6 insertions(+), 1 deletion(-) - ---- gregkh-2.6.orig/drivers/usb/serial/pl2303.c -+++ gregkh-2.6/drivers/usb/serial/pl2303.c -@@ -73,7 +73,8 @@ static struct usb_device_id id_table [] - { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, - { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X75) }, - { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, -- { USB_DEVICE( NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID ) }, -+ { USB_DEVICE(NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID ) }, -+ { USB_DEVICE(CA_42_CA42_VENDOR_ID, CA_42_CA42_PRODUCT_ID ) }, - { } /* Terminating entry */ - }; - ---- gregkh-2.6.orig/drivers/usb/serial/pl2303.h -+++ gregkh-2.6/drivers/usb/serial/pl2303.h -@@ -64,3 +64,7 @@ - /* Nokia CA-42 Cable */ - #define NOKIA_CA42_VENDOR_ID 0x078b - #define NOKIA_CA42_PRODUCT_ID 0x1234 -+ -+/* CA-42 CLONE Cable www.ca-42.com chipset: Prolific Technology Inc */ -+#define CA_42_CA42_VENDOR_ID 0x10b5 -+#define CA_42_CA42_PRODUCT_ID 0xac70 diff --git a/usb/usb-remove-extra-newline-in-hid_init_reports.patch b/usb/usb-remove-extra-newline-in-hid_init_reports.patch deleted file mode 100644 index 050a656ee35e1..0000000000000 --- a/usb/usb-remove-extra-newline-in-hid_init_reports.patch +++ /dev/null @@ -1,30 +0,0 @@ -From linux-usb-devel-admin@lists.sourceforge.net Fri Jan 6 03:48:03 2006 -From: Olaf Hering <olh@suse.de> -To: Greg Kroah-Hartman <gregkh@suse.de> -Message-ID: <20060106114528.GA9640@suse.de> -Content-Disposition: inline -Subject: USB: remove extra newline in hid_init_reports -Date: Fri, 6 Jan 2006 12:45:28 +0100 - - -The warn() macro in include/linux/usb.h adds a newline. - -Signed-off-by: Olaf Hering <olh@suse.de> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - - ---- - drivers/usb/input/hid-core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- gregkh-2.6.orig/drivers/usb/input/hid-core.c -+++ gregkh-2.6/drivers/usb/input/hid-core.c -@@ -1307,7 +1307,7 @@ void hid_init_reports(struct hid_device - } - - if (err) -- warn("timeout initializing reports\n"); -+ warn("timeout initializing reports"); - } - - #define USB_VENDOR_ID_WACOM 0x056a diff --git a/usb/usb-remove-linux_version_code-check-in-pwc-pwc-ctrl.c.patch b/usb/usb-remove-linux_version_code-check-in-pwc-pwc-ctrl.c.patch deleted file mode 100644 index eb1c9f6b732cd..0000000000000 --- a/usb/usb-remove-linux_version_code-check-in-pwc-pwc-ctrl.c.patch +++ /dev/null @@ -1,490 +0,0 @@ -From kernel-janitors-bounces@lists.osdl.org Wed Jan 4 09:16:27 2006 -From: Eric Sesterhenn / snakebyte <snakebyte@gmx.de> -Date: Wed, 04 Jan 2006 18:10:44 +0100 -Message-Id: <1136394645.4692.3.camel@localhost> -Subject: USB: Remove LINUX_VERSION_CODE check in pwc/pwc-ctrl.c - -this patch removes compatibility with 2.4 kernel, which makes -the code much easier to read. - -Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/media/pwc/pwc-ctrl.c | 264 +++++++++++++-------------------------- - 1 file changed, 89 insertions(+), 175 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/media/pwc/pwc-ctrl.c -+++ gregkh-2.6/drivers/usb/media/pwc/pwc-ctrl.c -@@ -1152,45 +1152,6 @@ int pwc_get_cmos_sensor(struct pwc_devic - /* End of Add-Ons */ - /* ************************************************* */ - --/* Linux 2.5.something and 2.6 pass direct pointers to arguments of -- ioctl() calls. With 2.4, you have to do tedious copy_from_user() -- and copy_to_user() calls. With these macros we circumvent this, -- and let me maintain only one source file. The functionality is -- exactly the same otherwise. -- */ -- --#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) -- --/* define local variable for arg */ --#define ARG_DEF(ARG_type, ARG_name)\ -- ARG_type *ARG_name = arg; --/* copy arg to local variable */ --#define ARG_IN(ARG_name) /* nothing */ --/* argument itself (referenced) */ --#define ARGR(ARG_name) (*ARG_name) --/* argument address */ --#define ARGA(ARG_name) ARG_name --/* copy local variable to arg */ --#define ARG_OUT(ARG_name) /* nothing */ -- --#else -- --#define ARG_DEF(ARG_type, ARG_name)\ -- ARG_type ARG_name; --#define ARG_IN(ARG_name)\ -- if (copy_from_user(&ARG_name, arg, sizeof(ARG_name))) {\ -- ret = -EFAULT;\ -- break;\ -- } --#define ARGR(ARG_name) ARG_name --#define ARGA(ARG_name) &ARG_name --#define ARG_OUT(ARG_name)\ -- if (copy_to_user(arg, &ARG_name, sizeof(ARG_name))) {\ -- ret = -EFAULT;\ -- break;\ -- } -- --#endif - - int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) - { -@@ -1220,243 +1181,206 @@ int pwc_ioctl(struct pwc_device *pdev, u - - case VIDIOCPWCSCQUAL: - { -- ARG_DEF(int, qual) -+ int *qual = arg; - -- ARG_IN(qual) -- if (ARGR(qual) < 0 || ARGR(qual) > 3) -+ if (*qual < 0 || *qual > 3) - ret = -EINVAL; - else -- ret = pwc_try_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, ARGR(qual), pdev->vsnapshot); -+ ret = pwc_try_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, *qual, pdev->vsnapshot); - if (ret >= 0) -- pdev->vcompression = ARGR(qual); -+ pdev->vcompression = *qual; - break; - } - - case VIDIOCPWCGCQUAL: - { -- ARG_DEF(int, qual) -- -- ARGR(qual) = pdev->vcompression; -- ARG_OUT(qual) -+ int *qual = arg; -+ *qual = pdev->vcompression; - break; - } - - case VIDIOCPWCPROBE: - { -- ARG_DEF(struct pwc_probe, probe) -- -- strcpy(ARGR(probe).name, pdev->vdev->name); -- ARGR(probe).type = pdev->type; -- ARG_OUT(probe) -+ struct pwc_probe *probe = arg; -+ strcpy(probe->name, pdev->vdev->name); -+ probe->type = pdev->type; - break; - } - - case VIDIOCPWCGSERIAL: - { -- ARG_DEF(struct pwc_serial, serial) -- -- strcpy(ARGR(serial).serial, pdev->serial); -- ARG_OUT(serial) -+ struct pwc_serial *serial = arg; -+ strcpy(serial->serial, pdev->serial); - break; - } - - case VIDIOCPWCSAGC: - { -- ARG_DEF(int, agc) -- -- ARG_IN(agc) -- if (pwc_set_agc(pdev, ARGR(agc) < 0 ? 1 : 0, ARGR(agc))) -+ int *agc = arg; -+ if (pwc_set_agc(pdev, *agc < 0 ? 1 : 0, *agc)) - ret = -EINVAL; - break; - } - - case VIDIOCPWCGAGC: - { -- ARG_DEF(int, agc) -+ int *agc = arg; - -- if (pwc_get_agc(pdev, ARGA(agc))) -+ if (pwc_get_agc(pdev, agc)) - ret = -EINVAL; -- ARG_OUT(agc) - break; - } - - case VIDIOCPWCSSHUTTER: - { -- ARG_DEF(int, shutter_speed) -- -- ARG_IN(shutter_speed) -- ret = pwc_set_shutter_speed(pdev, ARGR(shutter_speed) < 0 ? 1 : 0, ARGR(shutter_speed)); -+ int *shutter_speed = arg; -+ ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed); - break; - } - - case VIDIOCPWCSAWB: - { -- ARG_DEF(struct pwc_whitebalance, wb) -+ struct pwc_whitebalance *wb = arg; - -- ARG_IN(wb) -- ret = pwc_set_awb(pdev, ARGR(wb).mode); -- if (ret >= 0 && ARGR(wb).mode == PWC_WB_MANUAL) { -- pwc_set_red_gain(pdev, ARGR(wb).manual_red); -- pwc_set_blue_gain(pdev, ARGR(wb).manual_blue); -+ ret = pwc_set_awb(pdev, wb->mode); -+ if (ret >= 0 && wb->mode == PWC_WB_MANUAL) { -+ pwc_set_red_gain(pdev, wb->manual_red); -+ pwc_set_blue_gain(pdev, wb->manual_blue); - } - break; - } - - case VIDIOCPWCGAWB: - { -- ARG_DEF(struct pwc_whitebalance, wb) -+ struct pwc_whitebalance *wb = arg; - -- memset(ARGA(wb), 0, sizeof(struct pwc_whitebalance)); -- ARGR(wb).mode = pwc_get_awb(pdev); -- if (ARGR(wb).mode < 0) -+ memset(wb, 0, sizeof(struct pwc_whitebalance)); -+ wb->mode = pwc_get_awb(pdev); -+ if (wb->mode < 0) - ret = -EINVAL; - else { -- if (ARGR(wb).mode == PWC_WB_MANUAL) { -- ret = pwc_get_red_gain(pdev, &ARGR(wb).manual_red); -+ if (wb->mode == PWC_WB_MANUAL) { -+ ret = pwc_get_red_gain(pdev, &wb->manual_red); - if (ret < 0) - break; -- ret = pwc_get_blue_gain(pdev, &ARGR(wb).manual_blue); -+ ret = pwc_get_blue_gain(pdev, &wb->manual_blue); - if (ret < 0) - break; - } -- if (ARGR(wb).mode == PWC_WB_AUTO) { -- ret = pwc_read_red_gain(pdev, &ARGR(wb).read_red); -+ if (wb->mode == PWC_WB_AUTO) { -+ ret = pwc_read_red_gain(pdev, &wb->read_red); - if (ret < 0) - break; -- ret =pwc_read_blue_gain(pdev, &ARGR(wb).read_blue); -+ ret = pwc_read_blue_gain(pdev, &wb->read_blue); - if (ret < 0) - break; - } - } -- ARG_OUT(wb) - break; - } - - case VIDIOCPWCSAWBSPEED: - { -- ARG_DEF(struct pwc_wb_speed, wbs) -+ struct pwc_wb_speed *wbs = arg; - -- if (ARGR(wbs).control_speed > 0) { -- ret = pwc_set_wb_speed(pdev, ARGR(wbs).control_speed); -+ if (wbs->control_speed > 0) { -+ ret = pwc_set_wb_speed(pdev, wbs->control_speed); - } -- if (ARGR(wbs).control_delay > 0) { -- ret = pwc_set_wb_delay(pdev, ARGR(wbs).control_delay); -+ if (wbs->control_delay > 0) { -+ ret = pwc_set_wb_delay(pdev, wbs->control_delay); - } - break; - } - - case VIDIOCPWCGAWBSPEED: - { -- ARG_DEF(struct pwc_wb_speed, wbs) -+ struct pwc_wb_speed *wbs = arg; - -- ret = pwc_get_wb_speed(pdev, &ARGR(wbs).control_speed); -+ ret = pwc_get_wb_speed(pdev, &wbs->control_speed); - if (ret < 0) - break; -- ret = pwc_get_wb_delay(pdev, &ARGR(wbs).control_delay); -+ ret = pwc_get_wb_delay(pdev, &wbs->control_delay); - if (ret < 0) - break; -- ARG_OUT(wbs) - break; - } - - case VIDIOCPWCSLED: - { -- ARG_DEF(struct pwc_leds, leds) -- -- ARG_IN(leds) -- ret = pwc_set_leds(pdev, ARGR(leds).led_on, ARGR(leds).led_off); -+ struct pwc_leds *leds = arg; -+ ret = pwc_set_leds(pdev, leds->led_on, leds->led_off); - break; - } - - - case VIDIOCPWCGLED: - { -- ARG_DEF(struct pwc_leds, leds) -- -- ret = pwc_get_leds(pdev, &ARGR(leds).led_on, &ARGR(leds).led_off); -- ARG_OUT(leds) -+ struct pwc_leds *leds = arg; -+ ret = pwc_get_leds(pdev, &leds->led_on, &leds->led_off); - break; - } - - case VIDIOCPWCSCONTOUR: - { -- ARG_DEF(int, contour) -- -- ARG_IN(contour) -- ret = pwc_set_contour(pdev, ARGR(contour)); -+ int *contour = arg; -+ ret = pwc_set_contour(pdev, *contour); - break; - } - - case VIDIOCPWCGCONTOUR: - { -- ARG_DEF(int, contour) -- -- ret = pwc_get_contour(pdev, ARGA(contour)); -- ARG_OUT(contour) -+ int *contour = arg; -+ ret = pwc_get_contour(pdev, contour); - break; - } - - case VIDIOCPWCSBACKLIGHT: - { -- ARG_DEF(int, backlight) -- -- ARG_IN(backlight) -- ret = pwc_set_backlight(pdev, ARGR(backlight)); -+ int *backlight = arg; -+ ret = pwc_set_backlight(pdev, *backlight); - break; - } - - case VIDIOCPWCGBACKLIGHT: - { -- ARG_DEF(int, backlight) -- -- ret = pwc_get_backlight(pdev, ARGA(backlight)); -- ARG_OUT(backlight) -+ int *backlight = arg; -+ ret = pwc_get_backlight(pdev, backlight); - break; - } - - case VIDIOCPWCSFLICKER: - { -- ARG_DEF(int, flicker) -- -- ARG_IN(flicker) -- ret = pwc_set_flicker(pdev, ARGR(flicker)); -+ int *flicker = arg; -+ ret = pwc_set_flicker(pdev, *flicker); - break; - } - - case VIDIOCPWCGFLICKER: - { -- ARG_DEF(int, flicker) -- -- ret = pwc_get_flicker(pdev, ARGA(flicker)); -- ARG_OUT(flicker) -+ int *flicker = arg; -+ ret = pwc_get_flicker(pdev, flicker); - break; - } - - case VIDIOCPWCSDYNNOISE: - { -- ARG_DEF(int, dynnoise) -- -- ARG_IN(dynnoise) -- ret = pwc_set_dynamic_noise(pdev, ARGR(dynnoise)); -+ int *dynnoise = arg; -+ ret = pwc_set_dynamic_noise(pdev, *dynnoise); - break; - } - - case VIDIOCPWCGDYNNOISE: - { -- ARG_DEF(int, dynnoise) -- -- ret = pwc_get_dynamic_noise(pdev, ARGA(dynnoise)); -- ARG_OUT(dynnoise); -+ int *dynnoise = arg; -+ ret = pwc_get_dynamic_noise(pdev, dynnoise); - break; - } - - case VIDIOCPWCGREALSIZE: - { -- ARG_DEF(struct pwc_imagesize, size) -- -- ARGR(size).width = pdev->image.x; -- ARGR(size).height = pdev->image.y; -- ARG_OUT(size) -+ struct pwc_imagesize *size = arg; -+ size->width = pdev->image.x; -+ size->height = pdev->image.y; - break; - } - -@@ -1464,10 +1388,9 @@ int pwc_ioctl(struct pwc_device *pdev, u - { - if (pdev->features & FEATURE_MOTOR_PANTILT) - { -- ARG_DEF(int, flags) -+ int *flags = arg; - -- ARG_IN(flags) -- ret = pwc_mpt_reset(pdev, ARGR(flags)); -+ ret = pwc_mpt_reset(pdev, *flags); - if (ret >= 0) - { - pdev->pan_angle = 0; -@@ -1485,10 +1408,8 @@ int pwc_ioctl(struct pwc_device *pdev, u - { - if (pdev->features & FEATURE_MOTOR_PANTILT) - { -- ARG_DEF(struct pwc_mpt_range, range) -- -- ARGR(range) = pdev->angle_range; -- ARG_OUT(range) -+ struct pwc_mpt_range *range = arg; -+ *range = pdev->angle_range; - } - else - { -@@ -1503,21 +1424,19 @@ int pwc_ioctl(struct pwc_device *pdev, u - - if (pdev->features & FEATURE_MOTOR_PANTILT) - { -- ARG_DEF(struct pwc_mpt_angles, angles) -- -- ARG_IN(angles) -+ struct pwc_mpt_angles *angles = arg; - /* The camera can only set relative angles, so - do some calculations when getting an absolute angle . - */ -- if (ARGR(angles).absolute) -+ if (angles->absolute) - { -- new_pan = ARGR(angles).pan; -- new_tilt = ARGR(angles).tilt; -+ new_pan = angles->pan; -+ new_tilt = angles->tilt; - } - else - { -- new_pan = pdev->pan_angle + ARGR(angles).pan; -- new_tilt = pdev->tilt_angle + ARGR(angles).tilt; -+ new_pan = pdev->pan_angle + angles->pan; -+ new_tilt = pdev->tilt_angle + angles->tilt; - } - /* check absolute ranges */ - if (new_pan < pdev->angle_range.pan_min || -@@ -1560,12 +1479,11 @@ int pwc_ioctl(struct pwc_device *pdev, u - - if (pdev->features & FEATURE_MOTOR_PANTILT) - { -- ARG_DEF(struct pwc_mpt_angles, angles) -+ struct pwc_mpt_angles *angles = arg; - -- ARGR(angles).absolute = 1; -- ARGR(angles).pan = pdev->pan_angle; -- ARGR(angles).tilt = pdev->tilt_angle; -- ARG_OUT(angles) -+ angles->absolute = 1; -+ angles->pan = pdev->pan_angle; -+ angles->tilt = pdev->tilt_angle; - } - else - { -@@ -1578,10 +1496,8 @@ int pwc_ioctl(struct pwc_device *pdev, u - { - if (pdev->features & FEATURE_MOTOR_PANTILT) - { -- ARG_DEF(struct pwc_mpt_status, status) -- -- ret = pwc_mpt_get_status(pdev, ARGA(status)); -- ARG_OUT(status) -+ struct pwc_mpt_status *status = arg; -+ ret = pwc_mpt_get_status(pdev, status); - } - else - { -@@ -1592,24 +1508,22 @@ int pwc_ioctl(struct pwc_device *pdev, u - - case VIDIOCPWCGVIDCMD: - { -- ARG_DEF(struct pwc_video_command, cmd); -+ struct pwc_video_command *cmd = arg; - -- ARGR(cmd).type = pdev->type; -- ARGR(cmd).release = pdev->release; -- ARGR(cmd).command_len = pdev->cmd_len; -- memcpy(&ARGR(cmd).command_buf, pdev->cmd_buf, pdev->cmd_len); -- ARGR(cmd).bandlength = pdev->vbandlength; -- ARGR(cmd).frame_size = pdev->frame_size; -- ARG_OUT(cmd) -+ cmd->type = pdev->type; -+ cmd->release = pdev->release; -+ cmd->command_len = pdev->cmd_len; -+ memcpy(&cmd->command_buf, pdev->cmd_buf, pdev->cmd_len); -+ cmd->bandlength = pdev->vbandlength; -+ cmd->frame_size = pdev->frame_size; - break; - } - /* - case VIDIOCPWCGVIDTABLE: - { -- ARG_DEF(struct pwc_table_init_buffer, table); -- ARGR(table).len = pdev->cmd_len; -- memcpy(&ARGR(table).buffer, pdev->decompress_data, pdev->decompressor->table_size); -- ARG_OUT(table) -+ struct pwc_table_init_buffer *table = arg; -+ table->len = pdev->cmd_len; -+ memcpy(&table->buffer, pdev->decompress_data, pdev->decompressor->table_size); - break; - } - */ diff --git a/usb/usb-remove-misc-devfs-droppings.patch b/usb/usb-remove-misc-devfs-droppings.patch deleted file mode 100644 index 94ed082d69d7b..0000000000000 --- a/usb/usb-remove-misc-devfs-droppings.patch +++ /dev/null @@ -1,62 +0,0 @@ -From foo@baz.org Sun Jun 5 14:33:21 2005 -Date: Wed, 18 Jan 2006 17:36:58 -0500 -To: Greg KH <gregkh@suse.de> -From: Greg Kroah-Hartman <gregkh@suse.de> -Subject: USB: remove some left over devfs droppings hanging around in the usb drivers - -As there is no more usb devfs support, these bits would just confuse -people. - - -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> ---- - drivers/usb/input/hiddev.c | 3 --- - drivers/usb/misc/ldusb.c | 2 +- - drivers/usb/usb-skeleton.c | 2 +- - 3 files changed, 2 insertions(+), 5 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/input/hiddev.c -+++ gregkh-2.6/drivers/usb/input/hiddev.c -@@ -35,7 +35,6 @@ - #include <linux/usb.h> - #include "hid.h" - #include <linux/hiddev.h> --#include <linux/devfs_fs_kernel.h> - - #ifdef CONFIG_USB_DYNAMIC_MINORS - #define HIDDEV_MINOR_BASE 0 -@@ -832,12 +831,10 @@ static /* const */ struct usb_driver hid - - int __init hiddev_init(void) - { -- devfs_mk_dir("usb/hid"); - return usb_register(&hiddev_driver); - } - - void hiddev_exit(void) - { - usb_deregister(&hiddev_driver); -- devfs_remove("usb/hid"); - } ---- gregkh-2.6.orig/drivers/usb/misc/ldusb.c -+++ gregkh-2.6/drivers/usb/misc/ldusb.c -@@ -593,7 +593,7 @@ static struct file_operations ld_usb_fop - - /* - * usb class driver info in order to get a minor number from the usb core, -- * and to have the device registered with devfs and the driver core -+ * and to have the device registered with the driver core - */ - static struct usb_class_driver ld_usb_class = { - .name = "ldusb%d", ---- gregkh-2.6.orig/drivers/usb/usb-skeleton.c -+++ gregkh-2.6/drivers/usb/usb-skeleton.c -@@ -234,7 +234,7 @@ static struct file_operations skel_fops - - /* - * usb class driver info in order to get a minor number from the usb core, -- * and to have the device registered with devfs and the driver core -+ * and to have the device registered with the driver core - */ - static struct usb_class_driver skel_class = { - .name = "skel%d", diff --git a/usb/usb-sn9c10x-driver-updates-and-bugfixes.patch b/usb/usb-sn9c10x-driver-updates-and-bugfixes.patch deleted file mode 100644 index 00effb34fd441..0000000000000 --- a/usb/usb-sn9c10x-driver-updates-and-bugfixes.patch +++ /dev/null @@ -1,2912 +0,0 @@ -From linux-usb-devel-admin@lists.sourceforge.net Thu Jan 5 09:10:41 2006 -From: Luca Risolia <luca.risolia@studio.unibo.it> -To: Greg Kroah-Hartman <gregkh@suse.de> -Message-ID: <20060105181404.GA9389@studio.unibo.it> -Content-Disposition: inline -Subject: USB: SN9C10x driver updates and bugfixes -Date: Thu, 5 Jan 2006 18:14:04 +0000 - -SN9C10x driver updates and bugfixes. - -Changes: + new, - removed, * cleanup, @ bugfix: - -@ fix poll() -@ Remove bad get_ctrl()'s -* Reduce ioctl stack usage -* Remove final ";" from some macro definitions -* Better support for SN9C103 -+ Add sn9c102_write_regs() -+ Add 0x0c45/0x602d to the list of SN9C10x based devices -+ Add support for OV7630 image sensors -+ Provide support for the built-in microphone interface of the SN9C103 -+ Documentation updates -+ Add 0x0c45/0x602e to the list of SN9C10x based devices - -Signed-off-by: Luca Risolia <luca.risolia@studio.unibo.it> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> ---- - Documentation/usb/sn9c102.txt | 86 + - drivers/usb/media/sn9c102.h | 31 - drivers/usb/media/sn9c102_core.c | 1605 ++++++++++++++++++--------------- - drivers/usb/media/sn9c102_hv7131d.c | 2 - drivers/usb/media/sn9c102_mi0343.c | 2 - drivers/usb/media/sn9c102_ov7630.c | 8 - drivers/usb/media/sn9c102_pas106b.c | 2 - drivers/usb/media/sn9c102_sensor.h | 69 - - drivers/usb/media/sn9c102_tas5110c1b.c | 2 - drivers/usb/media/sn9c102_tas5130d1b.c | 2 - 10 files changed, 1012 insertions(+), 797 deletions(-) - ---- gregkh-2.6.orig/Documentation/usb/sn9c102.txt -+++ gregkh-2.6/Documentation/usb/sn9c102.txt -@@ -17,16 +17,15 @@ Index - 7. Module parameters - 8. Optional device control through "sysfs" - 9. Supported devices --10. How to add plug-in's for new image sensors --11. Notes for V4L2 application developers --12. Video frame formats --13. Contact information --14. Credits -+10. Notes for V4L2 application developers -+11. Video frame formats -+12. Contact information -+13. Credits - - - 1. Copyright - ============ --Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> -+Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> - - - 2. Disclaimer -@@ -54,9 +53,8 @@ Foundation, Inc., 675 Mass Ave, Cambridg - - 4. Overview and features - ======================== --This driver attempts to support the video and audio streaming capabilities of --the devices mounting the SONiX SN9C101, SN9C102 and SN9C103 PC Camera --Controllers. -+This driver attempts to support the video interface of the devices mounting the -+SONiX SN9C101, SN9C102 and SN9C103 PC Camera Controllers. - - It's worth to note that SONiX has never collaborated with the author during the - development of this project, despite several requests for enough detailed -@@ -78,6 +76,7 @@ Some of the features of the driver are: - - available mmap or read/poll methods for video streaming through isochronous - data transfers; - - automatic detection of image sensor; -+- support for built-in microphone interface; - - support for any window resolutions and optional panning within the maximum - pixel area of image sensor; - - image downscaling with arbitrary scaling factors from 1, 2 and 4 in both -@@ -96,7 +95,7 @@ Some of the features of the driver are: - parameters" paragraph); - - up to 64 cameras can be handled at the same time; they can be connected and - disconnected from the host many times without turning off the computer, if -- your system supports hotplugging; -+ the system supports hotplugging; - - no known bugs. - - -@@ -125,6 +124,21 @@ necessary: - CONFIG_USB_UHCI_HCD=m - CONFIG_USB_OHCI_HCD=m - -+The SN9C103 controller also provides a built-in microphone interface. It is -+supported by the USB Audio driver thanks to the ALSA API: -+ -+ # Sound -+ # -+ CONFIG_SOUND=y -+ -+ # Advanced Linux Sound Architecture -+ # -+ CONFIG_SND=m -+ -+ # USB devices -+ # -+ CONFIG_SND_USB_AUDIO=m -+ - And finally: - - # USB Multimedia devices -@@ -153,7 +167,7 @@ analyze kernel messages and verify that - Module parameters are listed below: - ------------------------------------------------------------------------------- - Name: video_nr --Type: int array (min = 0, max = 64) -+Type: short array (min = 0, max = 64) - Syntax: <-1|n[,...]> - Description: Specify V4L2 minor mode number: - -1 = use next available -@@ -165,19 +179,19 @@ Description: Specify V4L2 minor mode - other camera. - Default: -1 - ------------------------------------------------------------------------------- --Name: force_munmap; -+Name: force_munmap - Type: bool array (min = 0, max = 64) - Syntax: <0|1[,...]> - Description: Force the application to unmap previously mapped buffer memory - before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not - all the applications support this feature. This parameter is - specific for each detected camera. -- 0 = do not force memory unmapping" -- 1 = force memory unmapping (save memory)" -+ 0 = do not force memory unmapping -+ 1 = force memory unmapping (save memory) - Default: 0 - ------------------------------------------------------------------------------- - Name: debug --Type: int -+Type: ushort - Syntax: <n> - Description: Debugging information level, from 0 to 3: - 0 = none (use carefully) -@@ -187,7 +201,7 @@ Description: Debugging information le - Level 3 is useful for testing only, when only one device - is used. It also shows some more informations about the - hardware being detected. This parameter can be changed at -- runtime thanks to the /sys filesystem. -+ runtime thanks to the /sys filesystem interface. - Default: 2 - ------------------------------------------------------------------------------- - -@@ -236,7 +250,7 @@ serialized. - - The sysfs interface also provides the "frame_header" entry, which exports the - frame header of the most recent requested and captured video frame. The header --is 12-bytes long and is appended to every video frame by the SN9C10x -+is always 18-bytes long and is appended to every video frame by the SN9C10x - controllers. As an example, this additional information can be used by the user - application for implementing auto-exposure features via software. - -@@ -250,7 +264,8 @@ Byte # Value Description - 0x03 0xC4 Frame synchronisation pattern. - 0x04 0xC4 Frame synchronisation pattern. - 0x05 0x96 Frame synchronisation pattern. --0x06 0x00 or 0x01 Unknown meaning. The exact value depends on the chip. -+0x06 0xXX Unknown meaning. The exact value depends on the chip; -+ possible values are 0x00, 0x01 and 0x20. - 0x07 0xXX Variable value, whose bits are ff00uzzc, where ff is a - frame counter, u is unknown, zz is a size indicator - (00 = VGA, 01 = SIF, 10 = QSIF) and c stands for -@@ -267,12 +282,23 @@ Byte # Value Description - times the area outside of the specified AE area. For - images that are not pure white, the value scales down - according to relative whiteness. -+ according to relative whiteness. -+ -+The following bytes are used by the SN9C103 bridge only: -+ -+0x0C 0xXX Unknown meaning -+0x0D 0xXX Unknown meaning -+0x0E 0xXX Unknown meaning -+0x0F 0xXX Unknown meaning -+0x10 0xXX Unknown meaning -+0x11 0xXX Unknown meaning - - The AE area (sx, sy, ex, ey) in the active window can be set by programming the - registers 0x1c, 0x1d, 0x1e and 0x1f of the SN9C10x controllers, where one unit - corresponds to 32 pixels. - --[1] The frame header has been documented by Bertrik Sikken. -+[1] Part of the meaning of the frame header has been documented by Bertrik -+ Sikken. - - - 9. Supported devices -@@ -298,6 +324,7 @@ Vendor ID Product ID - 0x0c45 0x602b - 0x0c45 0x602c - 0x0c45 0x602d -+0x0c45 0x602e - 0x0c45 0x6030 - 0x0c45 0x6080 - 0x0c45 0x6082 -@@ -348,18 +375,7 @@ appreciated. Non-available hardware will - driver. - - --10. How to add plug-in's for new image sensors --============================================== --It should be easy to write plug-in's for new sensors by using the small API --that has been created for this purpose, which is present in "sn9c102_sensor.h" --(documentation is included there). As an example, have a look at the code in --"sn9c102_pas106b.c", which uses the mentioned interface. -- --At the moment, possible unsupported image sensors are: CIS-VF10 (VGA), --OV7620 (VGA), OV7630 (VGA). -- -- --11. Notes for V4L2 application developers -+10. Notes for V4L2 application developers - ========================================= - This driver follows the V4L2 API specifications. In particular, it enforces two - rules: -@@ -394,7 +410,7 @@ initialized (as described in the documen - supplied by this driver). - - --12. Video frame formats [1] -+11. Video frame formats [1] - ======================= - The SN9C10x PC Camera Controllers can send images in two possible video - formats over the USB: either native "Sequential RGB Bayer" or Huffman -@@ -455,7 +471,7 @@ The following Huffman codes have been fo - documented by Bertrik Sikken. - - --13. Contact information -+12. Contact information - ======================= - The author may be contacted by e-mail at <luca.risolia@studio.unibo.it>. - -@@ -464,7 +480,7 @@ GPG/PGP encrypted e-mail's are accepted. - the fingerprint is: '88E8 F32F 7244 68BA 3958 5D40 99DA 5D2A FCE6 35A4'. - - --14. Credits -+13. Credits - =========== - Many thanks to following persons for their contribute (listed in alphabetical - order): -@@ -480,5 +496,5 @@ order): - - Bertrik Sikken, who reverse-engineered and documented the Huffman compression - algorithm used in the SN9C10x controllers and implemented the first decoder; - - Mizuno Takafumi for the donation of a webcam; --- An "anonymous" donator (who didn't want his name to be revealed) for the -+- an "anonymous" donator (who didn't want his name to be revealed) for the - donation of a webcam. ---- gregkh-2.6.orig/drivers/usb/media/sn9c102_core.c -+++ gregkh-2.6/drivers/usb/media/sn9c102_core.c -@@ -1,7 +1,7 @@ - /*************************************************************************** - * V4L2 driver for SN9C10x PC Camera Controllers * - * * -- * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * - * * - * 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 * -@@ -70,10 +70,10 @@ static short force_munmap[] = {[0 ... SN - SN9C102_FORCE_MUNMAP}; - module_param_array(force_munmap, bool, NULL, 0444); - MODULE_PARM_DESC(force_munmap, -- "\n<0|1[,...]> Force the application to unmap previously " -- "\nmapped buffer memory before calling any VIDIOC_S_CROP or " -- "\nVIDIOC_S_FMT ioctl's. Not all the applications support " -- "\nthis feature. This parameter is specific for each " -+ "\n<0|1[,...]> Force the application to unmap previously" -+ "\nmapped buffer memory before calling any VIDIOC_S_CROP or" -+ "\nVIDIOC_S_FMT ioctl's. Not all the applications support" -+ "\nthis feature. This parameter is specific for each" - "\ndetected camera." - "\n 0 = do not force memory unmapping" - "\n 1 = force memory unmapping (save memory)" -@@ -102,6 +102,9 @@ static sn9c102_sof_header_t sn9c102_sof_ - {0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96, 0x01}, - }; - -+static sn9c103_sof_header_t sn9c103_sof_header[] = { -+ {0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96, 0x20}, -+}; - - static sn9c102_eof_header_t sn9c102_eof_header[] = { - {0x00, 0x00, 0x00, 0x00}, -@@ -202,6 +205,7 @@ static void sn9c102_release_buffers(stru - cam->nbuffers * PAGE_ALIGN(cam->frame[0].buf.length)); - cam->nbuffers = 0; - } -+ cam->frame_current = NULL; - } - - -@@ -219,6 +223,19 @@ static void sn9c102_empty_framequeues(st - } - - -+static void sn9c102_requeue_outqueue(struct sn9c102_device* cam) -+{ -+ struct sn9c102_frame_t *i; -+ -+ list_for_each_entry(i, &cam->outqueue, frame) { -+ i->state = F_QUEUED; -+ list_add(&i->frame, &cam->inqueue); -+ } -+ -+ INIT_LIST_HEAD(&cam->outqueue); -+} -+ -+ - static void sn9c102_queue_unusedframes(struct sn9c102_device* cam) - { - unsigned long lock_flags; -@@ -235,19 +252,46 @@ static void sn9c102_queue_unusedframes(s - - /*****************************************************************************/ - -+int sn9c102_write_regs(struct sn9c102_device* cam, u8* buff, u16 index) -+{ -+ struct usb_device* udev = cam->usbdev; -+ int i, res; -+ -+ if (index + sizeof(buff) >= ARRAY_SIZE(cam->reg)) -+ return -1; -+ -+ res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, -+ index, 0, buff, sizeof(buff), -+ SN9C102_CTRL_TIMEOUT*sizeof(buff)); -+ if (res < 0) { -+ DBG(3, "Failed to write registers (index 0x%02X, error %d)", -+ index, res); -+ return -1; -+ } -+ -+ for (i = 0; i < sizeof(buff); i++) -+ cam->reg[index+i] = buff[i]; -+ -+ return 0; -+} -+ -+ - int sn9c102_write_reg(struct sn9c102_device* cam, u8 value, u16 index) - { - struct usb_device* udev = cam->usbdev; - u8* buff = cam->control_buffer; - int res; - -+ if (index >= ARRAY_SIZE(cam->reg)) -+ return -1; -+ - *buff = value; - - res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, - index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); - if (res < 0) { - DBG(3, "Failed to write a register (value 0x%02X, index " -- "0x%02X, error %d)", value, index, res) -+ "0x%02X, error %d)", value, index, res); - return -1; - } - -@@ -268,7 +312,7 @@ static int sn9c102_read_reg(struct sn9c1 - index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); - if (res < 0) - DBG(3, "Failed to read a register (index 0x%02X, error %d)", -- index, res) -+ index, res); - - return (res >= 0) ? (int)(*buff) : -1; - } -@@ -276,8 +320,8 @@ static int sn9c102_read_reg(struct sn9c1 - - int sn9c102_pread_reg(struct sn9c102_device* cam, u16 index) - { -- if (index > 0x1f) -- return -EINVAL; -+ if (index >= ARRAY_SIZE(cam->reg)) -+ return -1; - - return cam->reg[index]; - } -@@ -367,10 +411,10 @@ sn9c102_i2c_try_raw_read(struct sn9c102_ - err += sn9c102_i2c_detect_read_error(cam, sensor); - - PDBGG("I2C read: address 0x%02X, first read byte: 0x%02X", data1, -- data[4]) -+ data[4]); - - if (err) { -- DBG(3, "I2C read failed for %s image sensor", sensor->name) -+ DBG(3, "I2C read failed for %s image sensor", sensor->name); - return -1; - } - -@@ -410,11 +454,11 @@ sn9c102_i2c_try_raw_write(struct sn9c102 - err += sn9c102_i2c_detect_write_error(cam, sensor); - - if (err) -- DBG(3, "I2C write failed for %s image sensor", sensor->name) -+ DBG(3, "I2C write failed for %s image sensor", sensor->name); - - PDBGG("I2C raw write: %u bytes, data0 = 0x%02X, data1 = 0x%02X, " - "data2 = 0x%02X, data3 = 0x%02X, data4 = 0x%02X, data5 = 0x%02X", -- n, data0, data1, data2, data3, data4, data5) -+ n, data0, data1, data2, data3, data4, data5); - - return err ? -1 : 0; - } -@@ -461,13 +505,27 @@ int sn9c102_i2c_write(struct sn9c102_dev - static void* - sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len) - { -- size_t soflen = sizeof(sn9c102_sof_header_t), i; -- u8 j, n = sizeof(sn9c102_sof_header) / soflen; -+ size_t soflen = 0, i; -+ u8 j, n = 0; -+ -+ switch (cam->bridge) { -+ case BRIDGE_SN9C101: -+ case BRIDGE_SN9C102: -+ soflen = sizeof(sn9c102_sof_header_t); -+ n = sizeof(sn9c102_sof_header) / soflen; -+ break; -+ case BRIDGE_SN9C103: -+ soflen = sizeof(sn9c103_sof_header_t); -+ n = sizeof(sn9c103_sof_header) / soflen; -+ } - -- for (i = 0; (len >= soflen) && (i <= len - soflen); i++) -+ for (i = 0; (len >= soflen) && (i <= len - soflen); i++) - for (j = 0; j < n; j++) -- /* It's enough to compare 7 bytes */ -- if (!memcmp(mem + i, sn9c102_sof_header[j], 7)) { -+ /* The invariable part of the header is 6 bytes long */ -+ if ((cam->bridge != BRIDGE_SN9C103 && -+ !memcmp(mem + i, sn9c102_sof_header[j], 6)) || -+ (cam->bridge == BRIDGE_SN9C103 && -+ !memcmp(mem + i, sn9c103_sof_header[j], 6))) { - memcpy(cam->sof_header, mem + i, soflen); - /* Skip the header */ - return mem + i + soflen; -@@ -499,8 +557,7 @@ static void sn9c102_urb_complete(struct - { - struct sn9c102_device* cam = urb->context; - struct sn9c102_frame_t** f; -- size_t imagesize; -- unsigned long lock_flags; -+ size_t imagesize, soflen; - u8 i; - int err = 0; - -@@ -513,7 +570,7 @@ static void sn9c102_urb_complete(struct - cam->stream = STREAM_OFF; - if ((*f)) - (*f)->state = F_QUEUED; -- DBG(3, "Stream interrupted") -+ DBG(3, "Stream interrupted"); - wake_up_interruptible(&cam->wait_stream); - } - -@@ -536,6 +593,10 @@ static void sn9c102_urb_complete(struct - cam->sensor->pix_format.height * - cam->sensor->pix_format.priv) / 8; - -+ soflen = (cam->bridge) == BRIDGE_SN9C103 ? -+ sizeof(sn9c103_sof_header_t) : -+ sizeof(sn9c102_sof_header_t); -+ - for (i = 0; i < urb->number_of_packets; i++) { - unsigned int img, len, status; - void *pos, *sof, *eof; -@@ -545,19 +606,12 @@ static void sn9c102_urb_complete(struct - pos = urb->iso_frame_desc[i].offset + urb->transfer_buffer; - - if (status) { -- DBG(3, "Error in isochronous frame") -+ DBG(3, "Error in isochronous frame"); - (*f)->state = F_ERROR; - continue; - } - -- PDBGG("Isochrnous frame: length %u, #%u i", len, i) -- -- /* -- NOTE: It is probably correct to assume that SOF and EOF -- headers do not occur between two consecutive packets, -- but who knows..Whatever is the truth, this assumption -- doesn't introduce bugs. -- */ -+ PDBGG("Isochrnous frame: length %u, #%u i", len, i); - - redo: - sof = sn9c102_find_sof_header(cam, pos, len); -@@ -575,10 +629,10 @@ end_of_frame: - imagesize; - img = imagesize - (*f)->buf.bytesused; - DBG(3, "Expected EOF not found: " -- "video frame cut") -+ "video frame cut"); - if (eof) - DBG(3, "Exceeded limit: +%u " -- "bytes", (unsigned)(b)) -+ "bytes", (unsigned)(b)); - } - - memcpy((*f)->bufmem + (*f)->buf.bytesused, pos, -@@ -595,8 +649,7 @@ end_of_frame: - u32 b = (*f)->buf.bytesused; - (*f)->state = F_DONE; - (*f)->buf.sequence= ++cam->frame_count; -- spin_lock_irqsave(&cam->queue_lock, -- lock_flags); -+ spin_lock(&cam->queue_lock); - list_move_tail(&(*f)->frame, - &cam->outqueue); - if (!list_empty(&cam->inqueue)) -@@ -606,13 +659,11 @@ end_of_frame: - frame ); - else - (*f) = NULL; -- spin_unlock_irqrestore(&cam->queue_lock -- , lock_flags); -+ spin_unlock(&cam->queue_lock); - memcpy(cam->sysfs.frame_header, -- cam->sof_header, -- sizeof(sn9c102_sof_header_t)); -- DBG(3, "Video frame captured: " -- "%lu bytes", (unsigned long)(b)) -+ cam->sof_header, soflen); -+ DBG(3, "Video frame captured: %lu " -+ "bytes", (unsigned long)(b)); - - if (!(*f)) - goto resubmit_urb; -@@ -621,18 +672,19 @@ end_of_frame: - (*f)->state = F_ERROR; - DBG(3, "Not expected EOF after %lu " - "bytes of image data", -- (unsigned long)((*f)->buf.bytesused)) -+ (unsigned long) -+ ((*f)->buf.bytesused)); - } - - if (sof) /* (1) */ - goto start_of_frame; - - } else if (eof) { -- DBG(3, "EOF without SOF") -+ DBG(3, "EOF without SOF"); - continue; - - } else { -- PDBGG("Ignoring pointless isochronous frame") -+ PDBGG("Ignoring pointless isochronous frame"); - continue; - } - -@@ -642,7 +694,7 @@ start_of_frame: - (*f)->buf.bytesused = 0; - len -= (sof - pos); - pos = sof; -- DBG(3, "SOF detected: new video frame") -+ DBG(3, "SOF detected: new video frame"); - if (len) - goto redo; - -@@ -653,12 +705,13 @@ start_of_frame: - else { - if (cam->sensor->pix_format.pixelformat == - V4L2_PIX_FMT_SN9C10X) { -- eof = sof-sizeof(sn9c102_sof_header_t); -+ eof = sof - soflen; - goto end_of_frame; - } else { - DBG(3, "SOF before expected EOF after " - "%lu bytes of image data", -- (unsigned long)((*f)->buf.bytesused)) -+ (unsigned long) -+ ((*f)->buf.bytesused)); - goto start_of_frame; - } - } -@@ -670,7 +723,7 @@ resubmit_urb: - err = usb_submit_urb(urb, GFP_ATOMIC); - if (err < 0 && err != -EPERM) { - cam->state |= DEV_MISCONFIGURED; -- DBG(1, "usb_submit_urb() failed") -+ DBG(1, "usb_submit_urb() failed"); - } - - wake_up_interruptible(&cam->wait_frame); -@@ -681,9 +734,13 @@ static int sn9c102_start_transfer(struct - { - struct usb_device *udev = cam->usbdev; - struct urb* urb; -- const unsigned int wMaxPacketSize[] = {0, 128, 256, 384, 512, -- 680, 800, 900, 1023}; -- const unsigned int psz = wMaxPacketSize[SN9C102_ALTERNATE_SETTING]; -+ const unsigned int sn9c102_wMaxPacketSize[] = {0, 128, 256, 384, 512, -+ 680, 800, 900, 1023}; -+ const unsigned int sn9c103_wMaxPacketSize[] = {0, 128, 256, 384, 512, -+ 680, 800, 900, 1003}; -+ const unsigned int psz = (cam->bridge == BRIDGE_SN9C103) ? -+ sn9c103_wMaxPacketSize[SN9C102_ALTERNATE_SETTING] : -+ sn9c102_wMaxPacketSize[SN9C102_ALTERNATE_SETTING]; - s8 i, j; - int err = 0; - -@@ -692,7 +749,7 @@ static int sn9c102_start_transfer(struct - GFP_KERNEL); - if (!cam->transfer_buffer[i]) { - err = -ENOMEM; -- DBG(1, "Not enough memory") -+ DBG(1, "Not enough memory"); - goto free_buffers; - } - } -@@ -702,7 +759,7 @@ static int sn9c102_start_transfer(struct - cam->urb[i] = urb; - if (!urb) { - err = -ENOMEM; -- DBG(1, "usb_alloc_urb() failed") -+ DBG(1, "usb_alloc_urb() failed"); - goto free_urbs; - } - urb->dev = udev; -@@ -725,14 +782,14 @@ static int sn9c102_start_transfer(struct - err = sn9c102_write_reg(cam, cam->reg[0x01] | 0x04, 0x01); - if (err) { - err = -EIO; -- DBG(1, "I/O hardware error") -+ DBG(1, "I/O hardware error"); - goto free_urbs; - } - } - - err = usb_set_interface(udev, 0, SN9C102_ALTERNATE_SETTING); - if (err) { -- DBG(1, "usb_set_interface() failed") -+ DBG(1, "usb_set_interface() failed"); - goto free_urbs; - } - -@@ -743,7 +800,7 @@ static int sn9c102_start_transfer(struct - if (err) { - for (j = i-1; j >= 0; j--) - usb_kill_urb(cam->urb[j]); -- DBG(1, "usb_submit_urb() failed, error %d", err) -+ DBG(1, "usb_submit_urb() failed, error %d", err); - goto free_urbs; - } - } -@@ -779,7 +836,7 @@ static int sn9c102_stop_transfer(struct - - err = usb_set_interface(udev, 0, 0); /* 0 Mb/s */ - if (err) -- DBG(3, "usb_set_interface() failed") -+ DBG(3, "usb_set_interface() failed"); - - return err; - } -@@ -799,7 +856,7 @@ static int sn9c102_stream_interrupt(stru - else if (err) { - cam->state |= DEV_MISCONFIGURED; - DBG(1, "The camera is misconfigured. To use it, close and " -- "open /dev/video%d again.", cam->v4ldev->minor) -+ "open /dev/video%d again.", cam->v4ldev->minor); - return err; - } - -@@ -885,8 +942,8 @@ sn9c102_store_reg(struct class_device* c - - cam->sysfs.reg = index; - -- DBG(2, "Moved SN9C10X register index to 0x%02X", cam->sysfs.reg) -- DBG(3, "Written bytes: %zd", count) -+ DBG(2, "Moved SN9C10X register index to 0x%02X", cam->sysfs.reg); -+ DBG(3, "Written bytes: %zd", count); - - up(&sn9c102_sysfs_lock); - -@@ -916,7 +973,7 @@ static ssize_t sn9c102_show_val(struct c - - count = sprintf(buf, "%d\n", val); - -- DBG(3, "Read bytes: %zd", count) -+ DBG(3, "Read bytes: %zd", count); - - up(&sn9c102_sysfs_lock); - -@@ -954,8 +1011,8 @@ sn9c102_store_val(struct class_device* c - } - - DBG(2, "Written SN9C10X reg. 0x%02X, val. 0x%02X", -- cam->sysfs.reg, value) -- DBG(3, "Written bytes: %zd", count) -+ cam->sysfs.reg, value); -+ DBG(3, "Written bytes: %zd", count); - - up(&sn9c102_sysfs_lock); - -@@ -979,7 +1036,7 @@ static ssize_t sn9c102_show_i2c_reg(stru - - count = sprintf(buf, "%u\n", cam->sysfs.i2c_reg); - -- DBG(3, "Read bytes: %zd", count) -+ DBG(3, "Read bytes: %zd", count); - - up(&sn9c102_sysfs_lock); - -@@ -1011,8 +1068,8 @@ sn9c102_store_i2c_reg(struct class_devic - - cam->sysfs.i2c_reg = index; - -- DBG(2, "Moved sensor register index to 0x%02X", cam->sysfs.i2c_reg) -- DBG(3, "Written bytes: %zd", count) -+ DBG(2, "Moved sensor register index to 0x%02X", cam->sysfs.i2c_reg); -+ DBG(3, "Written bytes: %zd", count); - - up(&sn9c102_sysfs_lock); - -@@ -1047,7 +1104,7 @@ static ssize_t sn9c102_show_i2c_val(stru - - count = sprintf(buf, "%d\n", val); - -- DBG(3, "Read bytes: %zd", count) -+ DBG(3, "Read bytes: %zd", count); - - up(&sn9c102_sysfs_lock); - -@@ -1090,8 +1147,8 @@ sn9c102_store_i2c_val(struct class_devic - } - - DBG(2, "Written sensor reg. 0x%02X, val. 0x%02X", -- cam->sysfs.i2c_reg, value) -- DBG(3, "Written bytes: %zd", count) -+ cam->sysfs.i2c_reg, value); -+ DBG(3, "Written bytes: %zd", count); - - up(&sn9c102_sysfs_lock); - -@@ -1193,7 +1250,7 @@ static ssize_t sn9c102_show_frame_header - count = sizeof(cam->sysfs.frame_header); - memcpy(buf, cam->sysfs.frame_header, count); - -- DBG(3, "Frame header, read bytes: %zd", count) -+ DBG(3, "Frame header, read bytes: %zd", count); - - return count; - } -@@ -1227,7 +1284,7 @@ static void sn9c102_create_sysfs(struct - video_device_create_file(v4ldev, &class_device_attr_blue); - video_device_create_file(v4ldev, &class_device_attr_red); - } -- if (cam->sensor->sysfs_ops) { -+ if (cam->sensor && cam->sensor->sysfs_ops) { - video_device_create_file(v4ldev, &class_device_attr_i2c_reg); - video_device_create_file(v4ldev, &class_device_attr_i2c_val); - } -@@ -1281,7 +1338,7 @@ static int sn9c102_set_scale(struct sn9c - if (err) - return -EIO; - -- PDBGG("Scaling factor: %u", scale) -+ PDBGG("Scaling factor: %u", scale); - - return 0; - } -@@ -1304,7 +1361,7 @@ static int sn9c102_set_crop(struct sn9c1 - return -EIO; - - PDBGG("h_start, v_start, h_size, v_size, ho_size, vo_size " -- "%u %u %u %u", h_start, v_start, h_size, v_size) -+ "%u %u %u %u", h_start, v_start, h_size, v_size); - - return 0; - } -@@ -1336,7 +1393,7 @@ static int sn9c102_init(struct sn9c102_d - if (s->init) { - err = s->init(cam); - if (err) { -- DBG(3, "Sensor initialization failed") -+ DBG(3, "Sensor initialization failed"); - return err; - } - } -@@ -1353,13 +1410,13 @@ static int sn9c102_init(struct sn9c102_d - - if (s->pix_format.pixelformat == V4L2_PIX_FMT_SN9C10X) - DBG(3, "Compressed video format is active, quality %d", -- cam->compression.quality) -+ cam->compression.quality); - else -- DBG(3, "Uncompressed video format is active") -+ DBG(3, "Uncompressed video format is active"); - - if (s->set_crop) - if ((err = s->set_crop(cam, rect))) { -- DBG(3, "set_crop() failed") -+ DBG(3, "set_crop() failed"); - return err; - } - -@@ -1372,11 +1429,11 @@ static int sn9c102_init(struct sn9c102_d - err = s->set_ctrl(cam, &ctrl); - if (err) { - DBG(3, "Set %s control failed", -- s->qctrl[i].name) -+ s->qctrl[i].name); - return err; - } - DBG(3, "Image sensor supports '%s' control", -- s->qctrl[i].name) -+ s->qctrl[i].name); - } - } - -@@ -1392,7 +1449,7 @@ static int sn9c102_init(struct sn9c102_d - cam->state |= DEV_INITIALIZED; - } - -- DBG(2, "Initialization succeeded") -+ DBG(2, "Initialization succeeded"); - return 0; - } - -@@ -1401,7 +1458,7 @@ static void sn9c102_release_resources(st - { - down(&sn9c102_sysfs_lock); - -- DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor) -+ DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); - video_set_drvdata(cam->v4ldev, NULL); - video_unregister_device(cam->v4ldev); - -@@ -1432,7 +1489,7 @@ static int sn9c102_open(struct inode* in - } - - if (cam->users) { -- DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->minor) -+ DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->minor); - if ((filp->f_flags & O_NONBLOCK) || - (filp->f_flags & O_NDELAY)) { - err = -EWOULDBLOCK; -@@ -1458,7 +1515,7 @@ static int sn9c102_open(struct inode* in - err = sn9c102_init(cam); - if (err) { - DBG(1, "Initialization failed again. " -- "I will retry on next open().") -+ "I will retry on next open()."); - goto out; - } - cam->state &= ~DEV_MISCONFIGURED; -@@ -1475,7 +1532,7 @@ static int sn9c102_open(struct inode* in - cam->frame_count = 0; - sn9c102_empty_framequeues(cam); - -- DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor) -+ DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); - - out: - up(&cam->dev_sem); -@@ -1504,7 +1561,7 @@ static int sn9c102_release(struct inode* - cam->users--; - wake_up_interruptible_nr(&cam->open, 1); - -- DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor) -+ DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); - - up(&cam->dev_sem); - -@@ -1524,32 +1581,38 @@ sn9c102_read(struct file* filp, char __u - return -ERESTARTSYS; - - if (cam->state & DEV_DISCONNECTED) { -- DBG(1, "Device not present") -+ DBG(1, "Device not present"); - up(&cam->fileop_sem); - return -ENODEV; - } - - if (cam->state & DEV_MISCONFIGURED) { -- DBG(1, "The camera is misconfigured. Close and open it again.") -+ DBG(1, "The camera is misconfigured. Close and open it " -+ "again."); - up(&cam->fileop_sem); - return -EIO; - } - - if (cam->io == IO_MMAP) { - DBG(3, "Close and open the device again to choose " -- "the read method") -+ "the read method"); - up(&cam->fileop_sem); - return -EINVAL; - } - - if (cam->io == IO_NONE) { - if (!sn9c102_request_buffers(cam,cam->nreadbuffers, IO_READ)) { -- DBG(1, "read() failed, not enough memory") -+ DBG(1, "read() failed, not enough memory"); - up(&cam->fileop_sem); - return -ENOMEM; - } - cam->io = IO_READ; - cam->stream = STREAM_ON; -+ } -+ -+ if (list_empty(&cam->inqueue)) { -+ if (!list_empty(&cam->outqueue)) -+ sn9c102_empty_framequeues(cam); - sn9c102_queue_unusedframes(cam); - } - -@@ -1584,6 +1647,16 @@ sn9c102_read(struct file* filp, char __u - - f = list_entry(cam->outqueue.prev, struct sn9c102_frame_t, frame); - -+ if (count > f->buf.bytesused) -+ count = f->buf.bytesused; -+ -+ if (copy_to_user(buf, f->bufmem, count)) { -+ err = -EFAULT; -+ goto exit; -+ } -+ *f_pos += count; -+ -+exit: - spin_lock_irqsave(&cam->queue_lock, lock_flags); - list_for_each_entry(i, &cam->outqueue, frame) - i->state = F_UNUSED; -@@ -1592,16 +1665,8 @@ sn9c102_read(struct file* filp, char __u - - sn9c102_queue_unusedframes(cam); - -- if (count > f->buf.bytesused) -- count = f->buf.bytesused; -- -- if (copy_to_user(buf, f->bufmem, count)) { -- up(&cam->fileop_sem); -- return -EFAULT; -- } -- *f_pos += count; -- -- PDBGG("Frame #%lu, bytes read: %zu", (unsigned long)f->buf.index,count) -+ PDBGG("Frame #%lu, bytes read: %zu", -+ (unsigned long)f->buf.index, count); - - up(&cam->fileop_sem); - -@@ -1612,33 +1677,42 @@ sn9c102_read(struct file* filp, char __u - static unsigned int sn9c102_poll(struct file *filp, poll_table *wait) - { - struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); -+ struct sn9c102_frame_t* f; -+ unsigned long lock_flags; - unsigned int mask = 0; - - if (down_interruptible(&cam->fileop_sem)) - return POLLERR; - - if (cam->state & DEV_DISCONNECTED) { -- DBG(1, "Device not present") -+ DBG(1, "Device not present"); - goto error; - } - - if (cam->state & DEV_MISCONFIGURED) { -- DBG(1, "The camera is misconfigured. Close and open it again.") -+ DBG(1, "The camera is misconfigured. Close and open it " -+ "again."); - goto error; - } - - if (cam->io == IO_NONE) { - if (!sn9c102_request_buffers(cam, cam->nreadbuffers, - IO_READ)) { -- DBG(1, "poll() failed, not enough memory") -+ DBG(1, "poll() failed, not enough memory"); - goto error; - } - cam->io = IO_READ; - cam->stream = STREAM_ON; - } - -- if (cam->io == IO_READ) -+ if (cam->io == IO_READ) { -+ spin_lock_irqsave(&cam->queue_lock, lock_flags); -+ list_for_each_entry(f, &cam->outqueue, frame) -+ f->state = F_UNUSED; -+ INIT_LIST_HEAD(&cam->outqueue); -+ spin_unlock_irqrestore(&cam->queue_lock, lock_flags); - sn9c102_queue_unusedframes(cam); -+ } - - poll_wait(filp, &cam->wait_frame, wait); - -@@ -1689,13 +1763,14 @@ static int sn9c102_mmap(struct file* fil - return -ERESTARTSYS; - - if (cam->state & DEV_DISCONNECTED) { -- DBG(1, "Device not present") -+ DBG(1, "Device not present"); - up(&cam->fileop_sem); - return -ENODEV; - } - - if (cam->state & DEV_MISCONFIGURED) { -- DBG(1, "The camera is misconfigured. Close and open it again.") -+ DBG(1, "The camera is misconfigured. Close and open it " -+ "again."); - up(&cam->fileop_sem); - return -EIO; - } -@@ -1742,738 +1817,860 @@ static int sn9c102_mmap(struct file* fil - return 0; - } - -+/*****************************************************************************/ - --static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, -- unsigned int cmd, void __user * arg) -+static int -+sn9c102_vidioc_querycap(struct sn9c102_device* cam, void __user * arg) - { -- struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); -- -- switch (cmd) { -- -- case VIDIOC_QUERYCAP: -- { -- struct v4l2_capability cap = { -- .driver = "sn9c102", -- .version = SN9C102_MODULE_VERSION_CODE, -- .capabilities = V4L2_CAP_VIDEO_CAPTURE | -- V4L2_CAP_READWRITE | -- V4L2_CAP_STREAMING, -- }; -- -- strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); -- if (usb_make_path(cam->usbdev, cap.bus_info, -- sizeof(cap.bus_info)) < 0) -- strlcpy(cap.bus_info, cam->dev.bus_id, -- sizeof(cap.bus_info)); -- -- if (copy_to_user(arg, &cap, sizeof(cap))) -- return -EFAULT; -- -- return 0; -- } -+ struct v4l2_capability cap = { -+ .driver = "sn9c102", -+ .version = SN9C102_MODULE_VERSION_CODE, -+ .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | -+ V4L2_CAP_STREAMING, -+ }; -+ -+ strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); -+ if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) -+ strlcpy(cap.bus_info, cam->dev.bus_id, sizeof(cap.bus_info)); - -- case VIDIOC_ENUMINPUT: -- { -- struct v4l2_input i; -- -- if (copy_from_user(&i, arg, sizeof(i))) -- return -EFAULT; -+ if (copy_to_user(arg, &cap, sizeof(cap))) -+ return -EFAULT; - -- if (i.index) -- return -EINVAL; -+ return 0; -+} - -- memset(&i, 0, sizeof(i)); -- strcpy(i.name, "USB"); - -- if (copy_to_user(arg, &i, sizeof(i))) -- return -EFAULT; -+static int -+sn9c102_vidioc_enuminput(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct v4l2_input i; - -- return 0; -- } -+ if (copy_from_user(&i, arg, sizeof(i))) -+ return -EFAULT; - -- case VIDIOC_G_INPUT: -- case VIDIOC_S_INPUT: -- { -- int index; -+ if (i.index) -+ return -EINVAL; - -- if (copy_from_user(&index, arg, sizeof(index))) -- return -EFAULT; -+ memset(&i, 0, sizeof(i)); -+ strcpy(i.name, "USB"); - -- if (index != 0) -- return -EINVAL; -+ if (copy_to_user(arg, &i, sizeof(i))) -+ return -EFAULT; - -- return 0; -- } -+ return 0; -+} - -- case VIDIOC_QUERYCTRL: -- { -- struct sn9c102_sensor* s = cam->sensor; -- struct v4l2_queryctrl qc; -- u8 i; - -- if (copy_from_user(&qc, arg, sizeof(qc))) -- return -EFAULT; -+static int -+sn9c102_vidioc_gs_input(struct sn9c102_device* cam, void __user * arg) -+{ -+ int index; - -- for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) -- if (qc.id && qc.id == s->qctrl[i].id) { -- memcpy(&qc, &(s->qctrl[i]), sizeof(qc)); -- if (copy_to_user(arg, &qc, sizeof(qc))) -- return -EFAULT; -- return 0; -- } -+ if (copy_from_user(&index, arg, sizeof(index))) -+ return -EFAULT; - -+ if (index != 0) - return -EINVAL; -- } - -- case VIDIOC_G_CTRL: -- { -- struct sn9c102_sensor* s = cam->sensor; -- struct v4l2_control ctrl; -- int err = 0; -+ return 0; -+} - -- if (!s->get_ctrl) -- return -EINVAL; - -- if (copy_from_user(&ctrl, arg, sizeof(ctrl))) -- return -EFAULT; -+static int -+sn9c102_vidioc_query_ctrl(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct sn9c102_sensor* s = cam->sensor; -+ struct v4l2_queryctrl qc; -+ u8 i; - -- err = s->get_ctrl(cam, &ctrl); -+ if (copy_from_user(&qc, arg, sizeof(qc))) -+ return -EFAULT; - -- if (copy_to_user(arg, &ctrl, sizeof(ctrl))) -- return -EFAULT; -+ for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) -+ if (qc.id && qc.id == s->qctrl[i].id) { -+ memcpy(&qc, &(s->qctrl[i]), sizeof(qc)); -+ if (copy_to_user(arg, &qc, sizeof(qc))) -+ return -EFAULT; -+ return 0; -+ } - -- return err; -- } -+ return -EINVAL; -+} - -- case VIDIOC_S_CTRL_OLD: -- case VIDIOC_S_CTRL: -- { -- struct sn9c102_sensor* s = cam->sensor; -- struct v4l2_control ctrl; -- u8 i; -- int err = 0; - -- if (!s->set_ctrl) -- return -EINVAL; -+static int -+sn9c102_vidioc_g_ctrl(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct sn9c102_sensor* s = cam->sensor; -+ struct v4l2_control ctrl; -+ int err = 0; -+ u8 i; - -- if (copy_from_user(&ctrl, arg, sizeof(ctrl))) -- return -EFAULT; -+ if (!s->get_ctrl && !s->set_ctrl) -+ return -EINVAL; - -+ if (copy_from_user(&ctrl, arg, sizeof(ctrl))) -+ return -EFAULT; -+ -+ if (!s->get_ctrl) { - for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) -- if (ctrl.id == s->qctrl[i].id) { -- if (ctrl.value < s->qctrl[i].minimum || -- ctrl.value > s->qctrl[i].maximum) -- return -ERANGE; -- ctrl.value -= ctrl.value % s->qctrl[i].step; -- break; -+ if (ctrl.id && ctrl.id == s->qctrl[i].id) { -+ ctrl.value = s->_qctrl[i].default_value; -+ goto exit; - } -+ return -EINVAL; -+ } else -+ err = s->get_ctrl(cam, &ctrl); - -- if ((err = s->set_ctrl(cam, &ctrl))) -- return err; -+exit: -+ if (copy_to_user(arg, &ctrl, sizeof(ctrl))) -+ return -EFAULT; - -- s->_qctrl[i].default_value = ctrl.value; -+ return err; -+} - -- PDBGG("VIDIOC_S_CTRL: id %lu, value %lu", -- (unsigned long)ctrl.id, (unsigned long)ctrl.value) - -- return 0; -- } -+static int -+sn9c102_vidioc_s_ctrl(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct sn9c102_sensor* s = cam->sensor; -+ struct v4l2_control ctrl; -+ u8 i; -+ int err = 0; - -- case VIDIOC_CROPCAP: -- { -- struct v4l2_cropcap* cc = &(cam->sensor->cropcap); -+ if (!s->set_ctrl) -+ return -EINVAL; - -- cc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -- cc->pixelaspect.numerator = 1; -- cc->pixelaspect.denominator = 1; -+ if (copy_from_user(&ctrl, arg, sizeof(ctrl))) -+ return -EFAULT; - -- if (copy_to_user(arg, cc, sizeof(*cc))) -- return -EFAULT; -+ for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) -+ if (ctrl.id == s->qctrl[i].id) { -+ if (ctrl.value < s->qctrl[i].minimum || -+ ctrl.value > s->qctrl[i].maximum) -+ return -ERANGE; -+ ctrl.value -= ctrl.value % s->qctrl[i].step; -+ break; -+ } - -- return 0; -- } -+ if ((err = s->set_ctrl(cam, &ctrl))) -+ return err; - -- case VIDIOC_G_CROP: -- { -- struct sn9c102_sensor* s = cam->sensor; -- struct v4l2_crop crop = { -- .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, -- }; -+ s->_qctrl[i].default_value = ctrl.value; - -- memcpy(&(crop.c), &(s->_rect), sizeof(struct v4l2_rect)); -+ PDBGG("VIDIOC_S_CTRL: id %lu, value %lu", -+ (unsigned long)ctrl.id, (unsigned long)ctrl.value); - -- if (copy_to_user(arg, &crop, sizeof(crop))) -- return -EFAULT; -+ return 0; -+} - -- return 0; -- } - -- case VIDIOC_S_CROP: -- { -- struct sn9c102_sensor* s = cam->sensor; -- struct v4l2_crop crop; -- struct v4l2_rect* rect; -- struct v4l2_rect* bounds = &(s->cropcap.bounds); -- struct v4l2_pix_format* pix_format = &(s->pix_format); -- u8 scale; -- const enum sn9c102_stream_state stream = cam->stream; -- const u32 nbuffers = cam->nbuffers; -- u32 i; -- int err = 0; -+static int -+sn9c102_vidioc_cropcap(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct v4l2_cropcap* cc = &(cam->sensor->cropcap); - -- if (copy_from_user(&crop, arg, sizeof(crop))) -- return -EFAULT; -+ cc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ cc->pixelaspect.numerator = 1; -+ cc->pixelaspect.denominator = 1; - -- rect = &(crop.c); -+ if (copy_to_user(arg, cc, sizeof(*cc))) -+ return -EFAULT; - -- if (crop.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -- return -EINVAL; -+ return 0; -+} - -- if (cam->module_param.force_munmap) -- for (i = 0; i < cam->nbuffers; i++) -- if (cam->frame[i].vma_use_count) { -- DBG(3, "VIDIOC_S_CROP failed. " -- "Unmap the buffers first.") -- return -EINVAL; -- } - -- /* Preserve R,G or B origin */ -- rect->left = (s->_rect.left & 1L) ? -- rect->left | 1L : rect->left & ~1L; -- rect->top = (s->_rect.top & 1L) ? -- rect->top | 1L : rect->top & ~1L; -- -- if (rect->width < 16) -- rect->width = 16; -- if (rect->height < 16) -- rect->height = 16; -- if (rect->width > bounds->width) -- rect->width = bounds->width; -- if (rect->height > bounds->height) -- rect->height = bounds->height; -- if (rect->left < bounds->left) -- rect->left = bounds->left; -- if (rect->top < bounds->top) -- rect->top = bounds->top; -- if (rect->left + rect->width > bounds->left + bounds->width) -- rect->left = bounds->left+bounds->width - rect->width; -- if (rect->top + rect->height > bounds->top + bounds->height) -- rect->top = bounds->top+bounds->height - rect->height; -- -- rect->width &= ~15L; -- rect->height &= ~15L; -- -- if (SN9C102_PRESERVE_IMGSCALE) { -- /* Calculate the actual scaling factor */ -- u32 a, b; -- a = rect->width * rect->height; -- b = pix_format->width * pix_format->height; -- scale = b ? (u8)((a / b) < 4 ? 1 : -- ((a / b) < 16 ? 2 : 4)) : 1; -- } else -- scale = 1; -- -- if (cam->stream == STREAM_ON) -- if ((err = sn9c102_stream_interrupt(cam))) -- return err; -+static int -+sn9c102_vidioc_g_crop(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct sn9c102_sensor* s = cam->sensor; -+ struct v4l2_crop crop = { -+ .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, -+ }; - -- if (copy_to_user(arg, &crop, sizeof(crop))) { -- cam->stream = stream; -- return -EFAULT; -- } -+ memcpy(&(crop.c), &(s->_rect), sizeof(struct v4l2_rect)); - -- if (cam->module_param.force_munmap || cam->io == IO_READ) -- sn9c102_release_buffers(cam); -+ if (copy_to_user(arg, &crop, sizeof(crop))) -+ return -EFAULT; - -- err = sn9c102_set_crop(cam, rect); -- if (s->set_crop) -- err += s->set_crop(cam, rect); -- err += sn9c102_set_scale(cam, scale); -- -- if (err) { /* atomic, no rollback in ioctl() */ -- cam->state |= DEV_MISCONFIGURED; -- DBG(1, "VIDIOC_S_CROP failed because of hardware " -- "problems. To use the camera, close and open " -- "/dev/video%d again.", cam->v4ldev->minor) -- return -EIO; -- } -+ return 0; -+} - -- s->pix_format.width = rect->width/scale; -- s->pix_format.height = rect->height/scale; -- memcpy(&(s->_rect), rect, sizeof(*rect)); -- -- if ((cam->module_param.force_munmap || cam->io == IO_READ) && -- nbuffers != sn9c102_request_buffers(cam, nbuffers, -- cam->io)) { -- cam->state |= DEV_MISCONFIGURED; -- DBG(1, "VIDIOC_S_CROP failed because of not enough " -- "memory. To use the camera, close and open " -- "/dev/video%d again.", cam->v4ldev->minor) -- return -ENOMEM; -- } - -- cam->stream = stream; -+static int -+sn9c102_vidioc_s_crop(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct sn9c102_sensor* s = cam->sensor; -+ struct v4l2_crop crop; -+ struct v4l2_rect* rect; -+ struct v4l2_rect* bounds = &(s->cropcap.bounds); -+ struct v4l2_pix_format* pix_format = &(s->pix_format); -+ u8 scale; -+ const enum sn9c102_stream_state stream = cam->stream; -+ const u32 nbuffers = cam->nbuffers; -+ u32 i; -+ int err = 0; - -- return 0; -- } -+ if (copy_from_user(&crop, arg, sizeof(crop))) -+ return -EFAULT; - -- case VIDIOC_ENUM_FMT: -- { -- struct v4l2_fmtdesc fmtd; -+ rect = &(crop.c); - -- if (copy_from_user(&fmtd, arg, sizeof(fmtd))) -- return -EFAULT; -+ if (crop.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; - -- if (fmtd.index == 0) { -- strcpy(fmtd.description, "bayer rgb"); -- fmtd.pixelformat = V4L2_PIX_FMT_SBGGR8; -- } else if (fmtd.index == 1) { -- strcpy(fmtd.description, "compressed"); -- fmtd.pixelformat = V4L2_PIX_FMT_SN9C10X; -- fmtd.flags = V4L2_FMT_FLAG_COMPRESSED; -- } else -- return -EINVAL; -+ if (cam->module_param.force_munmap) -+ for (i = 0; i < cam->nbuffers; i++) -+ if (cam->frame[i].vma_use_count) { -+ DBG(3, "VIDIOC_S_CROP failed. " -+ "Unmap the buffers first."); -+ return -EINVAL; -+ } - -- fmtd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -- memset(&fmtd.reserved, 0, sizeof(fmtd.reserved)); -+ /* Preserve R,G or B origin */ -+ rect->left = (s->_rect.left & 1L) ? rect->left | 1L : rect->left & ~1L; -+ rect->top = (s->_rect.top & 1L) ? rect->top | 1L : rect->top & ~1L; -+ -+ if (rect->width < 16) -+ rect->width = 16; -+ if (rect->height < 16) -+ rect->height = 16; -+ if (rect->width > bounds->width) -+ rect->width = bounds->width; -+ if (rect->height > bounds->height) -+ rect->height = bounds->height; -+ if (rect->left < bounds->left) -+ rect->left = bounds->left; -+ if (rect->top < bounds->top) -+ rect->top = bounds->top; -+ if (rect->left + rect->width > bounds->left + bounds->width) -+ rect->left = bounds->left+bounds->width - rect->width; -+ if (rect->top + rect->height > bounds->top + bounds->height) -+ rect->top = bounds->top+bounds->height - rect->height; -+ -+ rect->width &= ~15L; -+ rect->height &= ~15L; -+ -+ if (SN9C102_PRESERVE_IMGSCALE) { -+ /* Calculate the actual scaling factor */ -+ u32 a, b; -+ a = rect->width * rect->height; -+ b = pix_format->width * pix_format->height; -+ scale = b ? (u8)((a / b) < 4 ? 1 : ((a / b) < 16 ? 2 : 4)) : 1; -+ } else -+ scale = 1; - -- if (copy_to_user(arg, &fmtd, sizeof(fmtd))) -- return -EFAULT; -+ if (cam->stream == STREAM_ON) -+ if ((err = sn9c102_stream_interrupt(cam))) -+ return err; - -- return 0; -+ if (copy_to_user(arg, &crop, sizeof(crop))) { -+ cam->stream = stream; -+ return -EFAULT; - } - -- case VIDIOC_G_FMT: -- { -- struct v4l2_format format; -- struct v4l2_pix_format* pfmt = &(cam->sensor->pix_format); -- -- if (copy_from_user(&format, arg, sizeof(format))) -- return -EFAULT; -+ if (cam->module_param.force_munmap || cam->io == IO_READ) -+ sn9c102_release_buffers(cam); - -- if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -- return -EINVAL; -+ err = sn9c102_set_crop(cam, rect); -+ if (s->set_crop) -+ err += s->set_crop(cam, rect); -+ err += sn9c102_set_scale(cam, scale); - -- pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_SN9C10X) -- ? 0 : (pfmt->width * pfmt->priv) / 8; -- pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); -- pfmt->field = V4L2_FIELD_NONE; -- memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); -+ if (err) { /* atomic, no rollback in ioctl() */ -+ cam->state |= DEV_MISCONFIGURED; -+ DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To " -+ "use the camera, close and open /dev/video%d again.", -+ cam->v4ldev->minor); -+ return -EIO; -+ } - -- if (copy_to_user(arg, &format, sizeof(format))) -- return -EFAULT; -+ s->pix_format.width = rect->width/scale; -+ s->pix_format.height = rect->height/scale; -+ memcpy(&(s->_rect), rect, sizeof(*rect)); - -- return 0; -+ if ((cam->module_param.force_munmap || cam->io == IO_READ) && -+ nbuffers != sn9c102_request_buffers(cam, nbuffers, cam->io)) { -+ cam->state |= DEV_MISCONFIGURED; -+ DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To " -+ "use the camera, close and open /dev/video%d again.", -+ cam->v4ldev->minor); -+ return -ENOMEM; - } - -- case VIDIOC_TRY_FMT: -- case VIDIOC_S_FMT: -- { -- struct sn9c102_sensor* s = cam->sensor; -- struct v4l2_format format; -- struct v4l2_pix_format* pix; -- struct v4l2_pix_format* pfmt = &(s->pix_format); -- struct v4l2_rect* bounds = &(s->cropcap.bounds); -- struct v4l2_rect rect; -- u8 scale; -- const enum sn9c102_stream_state stream = cam->stream; -- const u32 nbuffers = cam->nbuffers; -- u32 i; -- int err = 0; -+ if (cam->io == IO_READ) -+ sn9c102_empty_framequeues(cam); -+ else if (cam->module_param.force_munmap) -+ sn9c102_requeue_outqueue(cam); - -- if (copy_from_user(&format, arg, sizeof(format))) -- return -EFAULT; -+ cam->stream = stream; - -- pix = &(format.fmt.pix); -+ return 0; -+} - -- if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -- return -EINVAL; - -- memcpy(&rect, &(s->_rect), sizeof(rect)); -+static int -+sn9c102_vidioc_enum_fmt(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct v4l2_fmtdesc fmtd; - -- { /* calculate the actual scaling factor */ -- u32 a, b; -- a = rect.width * rect.height; -- b = pix->width * pix->height; -- scale = b ? (u8)((a / b) < 4 ? 1 : -- ((a / b) < 16 ? 2 : 4)) : 1; -- } -- -- rect.width = scale * pix->width; -- rect.height = scale * pix->height; -- -- if (rect.width < 16) -- rect.width = 16; -- if (rect.height < 16) -- rect.height = 16; -- if (rect.width > bounds->left + bounds->width - rect.left) -- rect.width = bounds->left + bounds->width - rect.left; -- if (rect.height > bounds->top + bounds->height - rect.top) -- rect.height = bounds->top + bounds->height - rect.top; -- -- rect.width &= ~15L; -- rect.height &= ~15L; -- -- { /* adjust the scaling factor */ -- u32 a, b; -- a = rect.width * rect.height; -- b = pix->width * pix->height; -- scale = b ? (u8)((a / b) < 4 ? 1 : -- ((a / b) < 16 ? 2 : 4)) : 1; -- } -- -- pix->width = rect.width / scale; -- pix->height = rect.height / scale; -- -- if (pix->pixelformat != V4L2_PIX_FMT_SN9C10X && -- pix->pixelformat != V4L2_PIX_FMT_SBGGR8) -- pix->pixelformat = pfmt->pixelformat; -- pix->priv = pfmt->priv; /* bpp */ -- pix->colorspace = pfmt->colorspace; -- pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) -- ? 0 : (pix->width * pix->priv) / 8; -- pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); -- pix->field = V4L2_FIELD_NONE; -+ if (copy_from_user(&fmtd, arg, sizeof(fmtd))) -+ return -EFAULT; - -- if (cmd == VIDIOC_TRY_FMT) { -- if (copy_to_user(arg, &format, sizeof(format))) -- return -EFAULT; -- return 0; -- } -+ if (fmtd.index == 0) { -+ strcpy(fmtd.description, "bayer rgb"); -+ fmtd.pixelformat = V4L2_PIX_FMT_SBGGR8; -+ } else if (fmtd.index == 1) { -+ strcpy(fmtd.description, "compressed"); -+ fmtd.pixelformat = V4L2_PIX_FMT_SN9C10X; -+ fmtd.flags = V4L2_FMT_FLAG_COMPRESSED; -+ } else -+ return -EINVAL; - -- if (cam->module_param.force_munmap) -- for (i = 0; i < cam->nbuffers; i++) -- if (cam->frame[i].vma_use_count) { -- DBG(3, "VIDIOC_S_FMT failed. " -- "Unmap the buffers first.") -- return -EINVAL; -- } -+ fmtd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ memset(&fmtd.reserved, 0, sizeof(fmtd.reserved)); - -- if (cam->stream == STREAM_ON) -- if ((err = sn9c102_stream_interrupt(cam))) -- return err; -+ if (copy_to_user(arg, &fmtd, sizeof(fmtd))) -+ return -EFAULT; - -- if (copy_to_user(arg, &format, sizeof(format))) { -- cam->stream = stream; -- return -EFAULT; -- } -+ return 0; -+} - -- if (cam->module_param.force_munmap || cam->io == IO_READ) -- sn9c102_release_buffers(cam); - -- err += sn9c102_set_pix_format(cam, pix); -- err += sn9c102_set_crop(cam, &rect); -- if (s->set_pix_format) -- err += s->set_pix_format(cam, pix); -- if (s->set_crop) -- err += s->set_crop(cam, &rect); -- err += sn9c102_set_scale(cam, scale); -- -- if (err) { /* atomic, no rollback in ioctl() */ -- cam->state |= DEV_MISCONFIGURED; -- DBG(1, "VIDIOC_S_FMT failed because of hardware " -- "problems. To use the camera, close and open " -- "/dev/video%d again.", cam->v4ldev->minor) -- return -EIO; -- } -+static int -+sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct v4l2_format format; -+ struct v4l2_pix_format* pfmt = &(cam->sensor->pix_format); - -- memcpy(pfmt, pix, sizeof(*pix)); -- memcpy(&(s->_rect), &rect, sizeof(rect)); -+ if (copy_from_user(&format, arg, sizeof(format))) -+ return -EFAULT; - -- if ((cam->module_param.force_munmap || cam->io == IO_READ) && -- nbuffers != sn9c102_request_buffers(cam, nbuffers, -- cam->io)) { -- cam->state |= DEV_MISCONFIGURED; -- DBG(1, "VIDIOC_S_FMT failed because of not enough " -- "memory. To use the camera, close and open " -- "/dev/video%d again.", cam->v4ldev->minor) -- return -ENOMEM; -- } -+ if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; - -- cam->stream = stream; -+ pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_SN9C10X) -+ ? 0 : (pfmt->width * pfmt->priv) / 8; -+ pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); -+ pfmt->field = V4L2_FIELD_NONE; -+ memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); - -- return 0; -- } -+ if (copy_to_user(arg, &format, sizeof(format))) -+ return -EFAULT; - -- case VIDIOC_G_JPEGCOMP: -- { -- if (copy_to_user(arg, &cam->compression, -- sizeof(cam->compression))) -- return -EFAULT; -+ return 0; -+} - -- return 0; -- } - -- case VIDIOC_S_JPEGCOMP: -- { -- struct v4l2_jpegcompression jc; -- const enum sn9c102_stream_state stream = cam->stream; -- int err = 0; -+static int -+sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, -+ void __user * arg) -+{ -+ struct sn9c102_sensor* s = cam->sensor; -+ struct v4l2_format format; -+ struct v4l2_pix_format* pix; -+ struct v4l2_pix_format* pfmt = &(s->pix_format); -+ struct v4l2_rect* bounds = &(s->cropcap.bounds); -+ struct v4l2_rect rect; -+ u8 scale; -+ const enum sn9c102_stream_state stream = cam->stream; -+ const u32 nbuffers = cam->nbuffers; -+ u32 i; -+ int err = 0; - -- if (copy_from_user(&jc, arg, sizeof(jc))) -- return -EFAULT; -+ if (copy_from_user(&format, arg, sizeof(format))) -+ return -EFAULT; - -- if (jc.quality != 0 && jc.quality != 1) -- return -EINVAL; -+ pix = &(format.fmt.pix); - -- if (cam->stream == STREAM_ON) -- if ((err = sn9c102_stream_interrupt(cam))) -- return err; -- -- err += sn9c102_set_compression(cam, &jc); -- if (err) { /* atomic, no rollback in ioctl() */ -- cam->state |= DEV_MISCONFIGURED; -- DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware " -- "problems. To use the camera, close and open " -- "/dev/video%d again.", cam->v4ldev->minor) -- return -EIO; -- } -+ if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; - -- cam->compression.quality = jc.quality; -+ memcpy(&rect, &(s->_rect), sizeof(rect)); - -- cam->stream = stream; -+ { /* calculate the actual scaling factor */ -+ u32 a, b; -+ a = rect.width * rect.height; -+ b = pix->width * pix->height; -+ scale = b ? (u8)((a / b) < 4 ? 1 : ((a / b) < 16 ? 2 : 4)) : 1; -+ } -+ -+ rect.width = scale * pix->width; -+ rect.height = scale * pix->height; -+ -+ if (rect.width < 16) -+ rect.width = 16; -+ if (rect.height < 16) -+ rect.height = 16; -+ if (rect.width > bounds->left + bounds->width - rect.left) -+ rect.width = bounds->left + bounds->width - rect.left; -+ if (rect.height > bounds->top + bounds->height - rect.top) -+ rect.height = bounds->top + bounds->height - rect.top; -+ -+ rect.width &= ~15L; -+ rect.height &= ~15L; -+ -+ { /* adjust the scaling factor */ -+ u32 a, b; -+ a = rect.width * rect.height; -+ b = pix->width * pix->height; -+ scale = b ? (u8)((a / b) < 4 ? 1 : ((a / b) < 16 ? 2 : 4)) : 1; -+ } -+ -+ pix->width = rect.width / scale; -+ pix->height = rect.height / scale; -+ -+ if (pix->pixelformat != V4L2_PIX_FMT_SN9C10X && -+ pix->pixelformat != V4L2_PIX_FMT_SBGGR8) -+ pix->pixelformat = pfmt->pixelformat; -+ pix->priv = pfmt->priv; /* bpp */ -+ pix->colorspace = pfmt->colorspace; -+ pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) -+ ? 0 : (pix->width * pix->priv) / 8; -+ pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); -+ pix->field = V4L2_FIELD_NONE; - -+ if (cmd == VIDIOC_TRY_FMT) { -+ if (copy_to_user(arg, &format, sizeof(format))) -+ return -EFAULT; - return 0; - } - -- case VIDIOC_REQBUFS: -- { -- struct v4l2_requestbuffers rb; -- u32 i; -- int err; -- -- if (copy_from_user(&rb, arg, sizeof(rb))) -- return -EFAULT; -- -- if (rb.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || -- rb.memory != V4L2_MEMORY_MMAP) -- return -EINVAL; -- -- if (cam->io == IO_READ) { -- DBG(3, "Close and open the device again to choose " -- "the mmap I/O method") -- return -EINVAL; -- } -- -+ if (cam->module_param.force_munmap) - for (i = 0; i < cam->nbuffers; i++) - if (cam->frame[i].vma_use_count) { -- DBG(3, "VIDIOC_REQBUFS failed. " -- "Previous buffers are still mapped.") -+ DBG(3, "VIDIOC_S_FMT failed. Unmap the " -+ "buffers first."); - return -EINVAL; - } - -- if (cam->stream == STREAM_ON) -- if ((err = sn9c102_stream_interrupt(cam))) -- return err; -+ if (cam->stream == STREAM_ON) -+ if ((err = sn9c102_stream_interrupt(cam))) -+ return err; - -- sn9c102_empty_framequeues(cam); -+ if (copy_to_user(arg, &format, sizeof(format))) { -+ cam->stream = stream; -+ return -EFAULT; -+ } - -+ if (cam->module_param.force_munmap || cam->io == IO_READ) - sn9c102_release_buffers(cam); -- if (rb.count) -- rb.count = sn9c102_request_buffers(cam, rb.count, -- IO_MMAP); -- -- if (copy_to_user(arg, &rb, sizeof(rb))) { -- sn9c102_release_buffers(cam); -- cam->io = IO_NONE; -- return -EFAULT; -- } - -- cam->io = rb.count ? IO_MMAP : IO_NONE; -+ err += sn9c102_set_pix_format(cam, pix); -+ err += sn9c102_set_crop(cam, &rect); -+ if (s->set_pix_format) -+ err += s->set_pix_format(cam, pix); -+ if (s->set_crop) -+ err += s->set_crop(cam, &rect); -+ err += sn9c102_set_scale(cam, scale); - -- return 0; -+ if (err) { /* atomic, no rollback in ioctl() */ -+ cam->state |= DEV_MISCONFIGURED; -+ DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To " -+ "use the camera, close and open /dev/video%d again.", -+ cam->v4ldev->minor); -+ return -EIO; - } - -- case VIDIOC_QUERYBUF: -- { -- struct v4l2_buffer b; -+ memcpy(pfmt, pix, sizeof(*pix)); -+ memcpy(&(s->_rect), &rect, sizeof(rect)); - -- if (copy_from_user(&b, arg, sizeof(b))) -- return -EFAULT; -+ if ((cam->module_param.force_munmap || cam->io == IO_READ) && -+ nbuffers != sn9c102_request_buffers(cam, nbuffers, cam->io)) { -+ cam->state |= DEV_MISCONFIGURED; -+ DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To " -+ "use the camera, close and open /dev/video%d again.", -+ cam->v4ldev->minor); -+ return -ENOMEM; -+ } - -- if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || -- b.index >= cam->nbuffers || cam->io != IO_MMAP) -- return -EINVAL; -+ if (cam->io == IO_READ) -+ sn9c102_empty_framequeues(cam); -+ else if (cam->module_param.force_munmap) -+ sn9c102_requeue_outqueue(cam); - -- memcpy(&b, &cam->frame[b.index].buf, sizeof(b)); -+ cam->stream = stream; - -- if (cam->frame[b.index].vma_use_count) -- b.flags |= V4L2_BUF_FLAG_MAPPED; -+ return 0; -+} - -- if (cam->frame[b.index].state == F_DONE) -- b.flags |= V4L2_BUF_FLAG_DONE; -- else if (cam->frame[b.index].state != F_UNUSED) -- b.flags |= V4L2_BUF_FLAG_QUEUED; - -- if (copy_to_user(arg, &b, sizeof(b))) -- return -EFAULT; -+static int -+sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg) -+{ -+ if (copy_to_user(arg, &cam->compression, -+ sizeof(cam->compression))) -+ return -EFAULT; - -- return 0; -+ return 0; -+} -+ -+ -+static int -+sn9c102_vidioc_s_jpegcomp(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct v4l2_jpegcompression jc; -+ const enum sn9c102_stream_state stream = cam->stream; -+ int err = 0; -+ -+ if (copy_from_user(&jc, arg, sizeof(jc))) -+ return -EFAULT; -+ -+ if (jc.quality != 0 && jc.quality != 1) -+ return -EINVAL; -+ -+ if (cam->stream == STREAM_ON) -+ if ((err = sn9c102_stream_interrupt(cam))) -+ return err; -+ -+ err += sn9c102_set_compression(cam, &jc); -+ if (err) { /* atomic, no rollback in ioctl() */ -+ cam->state |= DEV_MISCONFIGURED; -+ DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware " -+ "problems. To use the camera, close and open " -+ "/dev/video%d again.", cam->v4ldev->minor); -+ return -EIO; - } - -- case VIDIOC_QBUF: -- { -- struct v4l2_buffer b; -- unsigned long lock_flags; -+ cam->compression.quality = jc.quality; - -- if (copy_from_user(&b, arg, sizeof(b))) -- return -EFAULT; -+ cam->stream = stream; -+ -+ return 0; -+} - -- if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || -- b.index >= cam->nbuffers || cam->io != IO_MMAP) -- return -EINVAL; - -- if (cam->frame[b.index].state != F_UNUSED) -+static int -+sn9c102_vidioc_reqbufs(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct v4l2_requestbuffers rb; -+ u32 i; -+ int err; -+ -+ if (copy_from_user(&rb, arg, sizeof(rb))) -+ return -EFAULT; -+ -+ if (rb.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || -+ rb.memory != V4L2_MEMORY_MMAP) -+ return -EINVAL; -+ -+ if (cam->io == IO_READ) { -+ DBG(3, "Close and open the device again to choose the mmap " -+ "I/O method"); -+ return -EINVAL; -+ } -+ -+ for (i = 0; i < cam->nbuffers; i++) -+ if (cam->frame[i].vma_use_count) { -+ DBG(3, "VIDIOC_REQBUFS failed. Previous buffers are " -+ "still mapped."); - return -EINVAL; -+ } - -- cam->frame[b.index].state = F_QUEUED; -+ if (cam->stream == STREAM_ON) -+ if ((err = sn9c102_stream_interrupt(cam))) -+ return err; - -- spin_lock_irqsave(&cam->queue_lock, lock_flags); -- list_add_tail(&cam->frame[b.index].frame, &cam->inqueue); -- spin_unlock_irqrestore(&cam->queue_lock, lock_flags); -+ sn9c102_empty_framequeues(cam); - -- PDBGG("Frame #%lu queued", (unsigned long)b.index) -+ sn9c102_release_buffers(cam); -+ if (rb.count) -+ rb.count = sn9c102_request_buffers(cam, rb.count, IO_MMAP); - -- return 0; -+ if (copy_to_user(arg, &rb, sizeof(rb))) { -+ sn9c102_release_buffers(cam); -+ cam->io = IO_NONE; -+ return -EFAULT; - } - -- case VIDIOC_DQBUF: -- { -- struct v4l2_buffer b; -- struct sn9c102_frame_t *f; -- unsigned long lock_flags; -- int err = 0; -+ cam->io = rb.count ? IO_MMAP : IO_NONE; - -- if (copy_from_user(&b, arg, sizeof(b))) -- return -EFAULT; -+ return 0; -+} - -- if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io!= IO_MMAP) -- return -EINVAL; - -- if (list_empty(&cam->outqueue)) { -- if (cam->stream == STREAM_OFF) -- return -EINVAL; -- if (filp->f_flags & O_NONBLOCK) -- return -EAGAIN; -- err = wait_event_interruptible -- ( cam->wait_frame, -- (!list_empty(&cam->outqueue)) || -- (cam->state & DEV_DISCONNECTED) || -- (cam->state & DEV_MISCONFIGURED) ); -- if (err) -- return err; -- if (cam->state & DEV_DISCONNECTED) -- return -ENODEV; -- if (cam->state & DEV_MISCONFIGURED) -- return -EIO; -- } -+static int -+sn9c102_vidioc_querybuf(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct v4l2_buffer b; - -- spin_lock_irqsave(&cam->queue_lock, lock_flags); -- f = list_entry(cam->outqueue.next, struct sn9c102_frame_t, -- frame); -- list_del(cam->outqueue.next); -- spin_unlock_irqrestore(&cam->queue_lock, lock_flags); -+ if (copy_from_user(&b, arg, sizeof(b))) -+ return -EFAULT; - -- f->state = F_UNUSED; -+ if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || -+ b.index >= cam->nbuffers || cam->io != IO_MMAP) -+ return -EINVAL; - -- memcpy(&b, &f->buf, sizeof(b)); -- if (f->vma_use_count) -- b.flags |= V4L2_BUF_FLAG_MAPPED; -+ memcpy(&b, &cam->frame[b.index].buf, sizeof(b)); - -- if (copy_to_user(arg, &b, sizeof(b))) -- return -EFAULT; -+ if (cam->frame[b.index].vma_use_count) -+ b.flags |= V4L2_BUF_FLAG_MAPPED; - -- PDBGG("Frame #%lu dequeued", (unsigned long)f->buf.index) -+ if (cam->frame[b.index].state == F_DONE) -+ b.flags |= V4L2_BUF_FLAG_DONE; -+ else if (cam->frame[b.index].state != F_UNUSED) -+ b.flags |= V4L2_BUF_FLAG_QUEUED; - -- return 0; -- } -+ if (copy_to_user(arg, &b, sizeof(b))) -+ return -EFAULT; - -- case VIDIOC_STREAMON: -- { -- int type; -+ return 0; -+} - -- if (copy_from_user(&type, arg, sizeof(type))) -- return -EFAULT; - -- if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) -- return -EINVAL; -+static int -+sn9c102_vidioc_qbuf(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct v4l2_buffer b; -+ unsigned long lock_flags; - -- if (list_empty(&cam->inqueue)) -- return -EINVAL; -+ if (copy_from_user(&b, arg, sizeof(b))) -+ return -EFAULT; - -- cam->stream = STREAM_ON; -+ if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || -+ b.index >= cam->nbuffers || cam->io != IO_MMAP) -+ return -EINVAL; - -- DBG(3, "Stream on") -+ if (cam->frame[b.index].state != F_UNUSED) -+ return -EINVAL; - -- return 0; -- } -+ cam->frame[b.index].state = F_QUEUED; - -- case VIDIOC_STREAMOFF: -- { -- int type, err; -+ spin_lock_irqsave(&cam->queue_lock, lock_flags); -+ list_add_tail(&cam->frame[b.index].frame, &cam->inqueue); -+ spin_unlock_irqrestore(&cam->queue_lock, lock_flags); - -- if (copy_from_user(&type, arg, sizeof(type))) -- return -EFAULT; -+ PDBGG("Frame #%lu queued", (unsigned long)b.index); - -- if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) -- return -EINVAL; -+ return 0; -+} - -- if (cam->stream == STREAM_ON) -- if ((err = sn9c102_stream_interrupt(cam))) -- return err; - -- sn9c102_empty_framequeues(cam); -+static int -+sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, -+ void __user * arg) -+{ -+ struct v4l2_buffer b; -+ struct sn9c102_frame_t *f; -+ unsigned long lock_flags; -+ int err = 0; - -- DBG(3, "Stream off") -+ if (copy_from_user(&b, arg, sizeof(b))) -+ return -EFAULT; - -- return 0; -+ if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) -+ return -EINVAL; -+ -+ if (list_empty(&cam->outqueue)) { -+ if (cam->stream == STREAM_OFF) -+ return -EINVAL; -+ if (filp->f_flags & O_NONBLOCK) -+ return -EAGAIN; -+ err = wait_event_interruptible -+ ( cam->wait_frame, -+ (!list_empty(&cam->outqueue)) || -+ (cam->state & DEV_DISCONNECTED) || -+ (cam->state & DEV_MISCONFIGURED) ); -+ if (err) -+ return err; -+ if (cam->state & DEV_DISCONNECTED) -+ return -ENODEV; -+ if (cam->state & DEV_MISCONFIGURED) -+ return -EIO; - } - -- case VIDIOC_G_PARM: -- { -- struct v4l2_streamparm sp; -+ spin_lock_irqsave(&cam->queue_lock, lock_flags); -+ f = list_entry(cam->outqueue.next, struct sn9c102_frame_t, frame); -+ list_del(cam->outqueue.next); -+ spin_unlock_irqrestore(&cam->queue_lock, lock_flags); - -- if (copy_from_user(&sp, arg, sizeof(sp))) -- return -EFAULT; -+ f->state = F_UNUSED; - -- if (sp.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -- return -EINVAL; -+ memcpy(&b, &f->buf, sizeof(b)); -+ if (f->vma_use_count) -+ b.flags |= V4L2_BUF_FLAG_MAPPED; -+ -+ if (copy_to_user(arg, &b, sizeof(b))) -+ return -EFAULT; -+ -+ PDBGG("Frame #%lu dequeued", (unsigned long)f->buf.index); -+ -+ return 0; -+} -+ -+ -+static int -+sn9c102_vidioc_streamon(struct sn9c102_device* cam, void __user * arg) -+{ -+ int type; -+ -+ if (copy_from_user(&type, arg, sizeof(type))) -+ return -EFAULT; -+ -+ if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) -+ return -EINVAL; -+ -+ if (list_empty(&cam->inqueue)) -+ return -EINVAL; -+ -+ cam->stream = STREAM_ON; -+ -+ DBG(3, "Stream on"); -+ -+ return 0; -+} -+ -+ -+static int -+sn9c102_vidioc_streamoff(struct sn9c102_device* cam, void __user * arg) -+{ -+ int type, err; -+ -+ if (copy_from_user(&type, arg, sizeof(type))) -+ return -EFAULT; -+ -+ if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) -+ return -EINVAL; -+ -+ if (cam->stream == STREAM_ON) -+ if ((err = sn9c102_stream_interrupt(cam))) -+ return err; -+ -+ sn9c102_empty_framequeues(cam); -+ -+ DBG(3, "Stream off"); -+ -+ return 0; -+} -+ -+ -+static int -+sn9c102_vidioc_g_parm(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct v4l2_streamparm sp; -+ -+ if (copy_from_user(&sp, arg, sizeof(sp))) -+ return -EFAULT; -+ -+ if (sp.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; -+ -+ sp.parm.capture.extendedmode = 0; -+ sp.parm.capture.readbuffers = cam->nreadbuffers; -+ -+ if (copy_to_user(arg, &sp, sizeof(sp))) -+ return -EFAULT; -+ -+ return 0; -+} -+ -+ -+static int -+sn9c102_vidioc_s_parm(struct sn9c102_device* cam, void __user * arg) -+{ -+ struct v4l2_streamparm sp; -+ -+ if (copy_from_user(&sp, arg, sizeof(sp))) -+ return -EFAULT; -+ -+ if (sp.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -+ return -EINVAL; - -- sp.parm.capture.extendedmode = 0; -+ sp.parm.capture.extendedmode = 0; -+ -+ if (sp.parm.capture.readbuffers == 0) - sp.parm.capture.readbuffers = cam->nreadbuffers; - -- if (copy_to_user(arg, &sp, sizeof(sp))) -- return -EFAULT; -+ if (sp.parm.capture.readbuffers > SN9C102_MAX_FRAMES) -+ sp.parm.capture.readbuffers = SN9C102_MAX_FRAMES; - -- return 0; -- } -+ if (copy_to_user(arg, &sp, sizeof(sp))) -+ return -EFAULT; - -- case VIDIOC_S_PARM_OLD: -- case VIDIOC_S_PARM: -- { -- struct v4l2_streamparm sp; -+ cam->nreadbuffers = sp.parm.capture.readbuffers; - -- if (copy_from_user(&sp, arg, sizeof(sp))) -- return -EFAULT; -+ return 0; -+} - -- if (sp.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) -- return -EINVAL; - -- sp.parm.capture.extendedmode = 0; -+static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, -+ unsigned int cmd, void __user * arg) -+{ -+ struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); - -- if (sp.parm.capture.readbuffers == 0) -- sp.parm.capture.readbuffers = cam->nreadbuffers; -+ switch (cmd) { - -- if (sp.parm.capture.readbuffers > SN9C102_MAX_FRAMES) -- sp.parm.capture.readbuffers = SN9C102_MAX_FRAMES; -+ case VIDIOC_QUERYCAP: -+ return sn9c102_vidioc_querycap(cam, arg); - -- if (copy_to_user(arg, &sp, sizeof(sp))) -- return -EFAULT; -+ case VIDIOC_ENUMINPUT: -+ return sn9c102_vidioc_enuminput(cam, arg); - -- cam->nreadbuffers = sp.parm.capture.readbuffers; -+ case VIDIOC_G_INPUT: -+ case VIDIOC_S_INPUT: -+ return sn9c102_vidioc_gs_input(cam, arg); - -- return 0; -- } -+ case VIDIOC_QUERYCTRL: -+ return sn9c102_vidioc_query_ctrl(cam, arg); -+ -+ case VIDIOC_G_CTRL: -+ return sn9c102_vidioc_g_ctrl(cam, arg); -+ -+ case VIDIOC_S_CTRL_OLD: -+ case VIDIOC_S_CTRL: -+ return sn9c102_vidioc_s_ctrl(cam, arg); -+ -+ case VIDIOC_CROPCAP_OLD: -+ case VIDIOC_CROPCAP: -+ return sn9c102_vidioc_cropcap(cam, arg); -+ -+ case VIDIOC_G_CROP: -+ return sn9c102_vidioc_g_crop(cam, arg); -+ -+ case VIDIOC_S_CROP: -+ return sn9c102_vidioc_s_crop(cam, arg); -+ -+ case VIDIOC_ENUM_FMT: -+ return sn9c102_vidioc_enum_fmt(cam, arg); -+ -+ case VIDIOC_G_FMT: -+ return sn9c102_vidioc_g_fmt(cam, arg); -+ -+ case VIDIOC_TRY_FMT: -+ case VIDIOC_S_FMT: -+ return sn9c102_vidioc_try_s_fmt(cam, cmd, arg); -+ -+ case VIDIOC_G_JPEGCOMP: -+ return sn9c102_vidioc_g_jpegcomp(cam, arg); -+ -+ case VIDIOC_S_JPEGCOMP: -+ return sn9c102_vidioc_s_jpegcomp(cam, arg); -+ -+ case VIDIOC_REQBUFS: -+ return sn9c102_vidioc_reqbufs(cam, arg); -+ -+ case VIDIOC_QUERYBUF: -+ return sn9c102_vidioc_querybuf(cam, arg); -+ -+ case VIDIOC_QBUF: -+ return sn9c102_vidioc_qbuf(cam, arg); -+ -+ case VIDIOC_DQBUF: -+ return sn9c102_vidioc_dqbuf(cam, filp, arg); -+ -+ case VIDIOC_STREAMON: -+ return sn9c102_vidioc_streamon(cam, arg); -+ -+ case VIDIOC_STREAMOFF: -+ return sn9c102_vidioc_streamoff(cam, arg); -+ -+ case VIDIOC_G_PARM: -+ return sn9c102_vidioc_g_parm(cam, arg); -+ -+ case VIDIOC_S_PARM_OLD: -+ case VIDIOC_S_PARM: -+ return sn9c102_vidioc_s_parm(cam, arg); - - case VIDIOC_G_STD: - case VIDIOC_S_STD: -@@ -2499,13 +2696,14 @@ static int sn9c102_ioctl(struct inode* i - return -ERESTARTSYS; - - if (cam->state & DEV_DISCONNECTED) { -- DBG(1, "Device not present") -+ DBG(1, "Device not present"); - up(&cam->fileop_sem); - return -ENODEV; - } - - if (cam->state & DEV_MISCONFIGURED) { -- DBG(1, "The camera is misconfigured. Close and open it again.") -+ DBG(1, "The camera is misconfigured. Close and open it " -+ "again."); - up(&cam->fileop_sem); - return -EIO; - } -@@ -2517,9 +2715,10 @@ static int sn9c102_ioctl(struct inode* i - return err; - } - -+/*****************************************************************************/ - - static struct file_operations sn9c102_fops = { -- .owner = THIS_MODULE, -+ .owner = THIS_MODULE, - .open = sn9c102_open, - .release = sn9c102_release, - .ioctl = sn9c102_ioctl, -@@ -2538,36 +2737,23 @@ sn9c102_usb_probe(struct usb_interface* - struct usb_device *udev = interface_to_usbdev(intf); - struct sn9c102_device* cam; - static unsigned int dev_nr = 0; -- unsigned int i, n; -+ unsigned int i; - int err = 0, r; - -- n = ARRAY_SIZE(sn9c102_id_table); -- for (i = 0; i < n-1; i++) -- if (le16_to_cpu(udev->descriptor.idVendor) == -- sn9c102_id_table[i].idVendor && -- le16_to_cpu(udev->descriptor.idProduct) == -- sn9c102_id_table[i].idProduct) -- break; -- if (i == n-1) -- return -ENODEV; -- - if (!(cam = kmalloc(sizeof(struct sn9c102_device), GFP_KERNEL))) - return -ENOMEM; -- memset(cam, 0, sizeof(*cam)); - - cam->usbdev = udev; -- - memcpy(&cam->dev, &udev->dev, sizeof(struct device)); - - if (!(cam->control_buffer = kmalloc(8, GFP_KERNEL))) { -- DBG(1, "kmalloc() failed") -+ DBG(1, "kmalloc() failed"); - err = -ENOMEM; - goto fail; - } -- memset(cam->control_buffer, 0, 8); - - if (!(cam->v4ldev = video_device_alloc())) { -- DBG(1, "video_device_alloc() failed") -+ DBG(1, "video_device_alloc() failed"); - err = -ENOMEM; - goto fail; - } -@@ -2577,25 +2763,22 @@ sn9c102_usb_probe(struct usb_interface* - r = sn9c102_read_reg(cam, 0x00); - if (r < 0 || r != 0x10) { - DBG(1, "Sorry, this is not a SN9C10x based camera " -- "(vid/pid 0x%04X/0x%04X)", -- sn9c102_id_table[i].idVendor,sn9c102_id_table[i].idProduct) -+ "(vid/pid 0x%04X/0x%04X)", id->idVendor, id->idProduct); - err = -ENODEV; - goto fail; - } - -- cam->bridge = (sn9c102_id_table[i].idProduct & 0xffc0) == 0x6080 ? -+ cam->bridge = (id->idProduct & 0xffc0) == 0x6080 ? - BRIDGE_SN9C103 : BRIDGE_SN9C102; - switch (cam->bridge) { - case BRIDGE_SN9C101: - case BRIDGE_SN9C102: - DBG(2, "SN9C10[12] PC Camera Controller detected " -- "(vid/pid 0x%04X/0x%04X)", sn9c102_id_table[i].idVendor, -- sn9c102_id_table[i].idProduct) -+ "(vid/pid 0x%04X/0x%04X)", id->idVendor, id->idProduct); - break; - case BRIDGE_SN9C103: - DBG(2, "SN9C103 PC Camera Controller detected " -- "(vid/pid 0x%04X/0x%04X)", sn9c102_id_table[i].idVendor, -- sn9c102_id_table[i].idProduct) -+ "(vid/pid 0x%04X/0x%04X)", id->idVendor, id->idProduct); - break; - } - -@@ -2606,17 +2789,17 @@ sn9c102_usb_probe(struct usb_interface* - } - - if (!err && cam->sensor) { -- DBG(2, "%s image sensor detected", cam->sensor->name) -+ DBG(2, "%s image sensor detected", cam->sensor->name); - DBG(3, "Support for %s maintained by %s", -- cam->sensor->name, cam->sensor->maintainer) -+ cam->sensor->name, cam->sensor->maintainer); - } else { -- DBG(1, "No supported image sensor detected") -+ DBG(1, "No supported image sensor detected"); - err = -ENODEV; - goto fail; - } - - if (sn9c102_init(cam)) { -- DBG(1, "Initialization failed. I will retry on open().") -+ DBG(1, "Initialization failed. I will retry on open()."); - cam->state |= DEV_MISCONFIGURED; - } - -@@ -2634,23 +2817,23 @@ sn9c102_usb_probe(struct usb_interface* - err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, - video_nr[dev_nr]); - if (err) { -- DBG(1, "V4L2 device registration failed") -+ DBG(1, "V4L2 device registration failed"); - if (err == -ENFILE && video_nr[dev_nr] == -1) -- DBG(1, "Free /dev/videoX node not found") -+ DBG(1, "Free /dev/videoX node not found"); - video_nr[dev_nr] = -1; - dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0; - up(&cam->dev_sem); - goto fail; - } - -- DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor) -+ DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor); - - cam->module_param.force_munmap = force_munmap[dev_nr]; - - dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0; - - sn9c102_create_sysfs(cam); -- DBG(2, "Optional device control through 'sysfs' interface ready") -+ DBG(2, "Optional device control through 'sysfs' interface ready"); - - usb_set_intfdata(intf, cam); - -@@ -2680,14 +2863,14 @@ static void sn9c102_usb_disconnect(struc - - down(&cam->dev_sem); - -- DBG(2, "Disconnecting %s...", cam->v4ldev->name) -+ DBG(2, "Disconnecting %s...", cam->v4ldev->name); - - wake_up_interruptible_all(&cam->open); - - if (cam->users) { - DBG(2, "Device /dev/video%d is open! Deregistration and " - "memory deallocation are deferred on close.", -- cam->v4ldev->minor) -+ cam->v4ldev->minor); - cam->state |= DEV_MISCONFIGURED; - sn9c102_stop_transfer(cam); - cam->state |= DEV_DISCONNECTED; -@@ -2720,11 +2903,11 @@ static int __init sn9c102_module_init(vo - { - int err = 0; - -- KDBG(2, SN9C102_MODULE_NAME " v" SN9C102_MODULE_VERSION) -- KDBG(3, SN9C102_MODULE_AUTHOR) -+ KDBG(2, SN9C102_MODULE_NAME " v" SN9C102_MODULE_VERSION); -+ KDBG(3, SN9C102_MODULE_AUTHOR); - - if ((err = usb_register(&sn9c102_usb_driver))) -- KDBG(1, "usb_register() failed") -+ KDBG(1, "usb_register() failed"); - - return err; - } ---- gregkh-2.6.orig/drivers/usb/media/sn9c102.h -+++ gregkh-2.6/drivers/usb/media/sn9c102.h -@@ -1,7 +1,7 @@ - /*************************************************************************** - * V4L2 driver for SN9C10x PC Camera Controllers * - * * -- * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * - * * - * 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 * -@@ -53,11 +53,11 @@ - /*****************************************************************************/ - - #define SN9C102_MODULE_NAME "V4L2 driver for SN9C10x PC Camera Controllers" --#define SN9C102_MODULE_AUTHOR "(C) 2004-2005 Luca Risolia" -+#define SN9C102_MODULE_AUTHOR "(C) 2004-2006 Luca Risolia" - #define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" - #define SN9C102_MODULE_LICENSE "GPL" --#define SN9C102_MODULE_VERSION "1:1.24a" --#define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 24) -+#define SN9C102_MODULE_VERSION "1:1.25" -+#define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 25) - - enum sn9c102_bridge { - BRIDGE_SN9C101 = 0x01, -@@ -102,12 +102,13 @@ enum sn9c102_stream_state { - STREAM_ON, - }; - -+typedef char sn9c103_sof_header_t[18]; - typedef char sn9c102_sof_header_t[12]; - typedef char sn9c102_eof_header_t[4]; - - struct sn9c102_sysfs_attr { - u8 reg, i2c_reg; -- sn9c102_sof_header_t frame_header; -+ sn9c103_sof_header_t frame_header; - }; - - struct sn9c102_module_param { -@@ -140,8 +141,8 @@ struct sn9c102_device { - struct v4l2_jpegcompression compression; - - struct sn9c102_sysfs_attr sysfs; -- sn9c102_sof_header_t sof_header; -- u16 reg[32]; -+ sn9c103_sof_header_t sof_header; -+ u16 reg[63]; - - struct sn9c102_module_param module_param; - -@@ -170,7 +171,7 @@ sn9c102_attach_sensor(struct sn9c102_dev - #undef KDBG - #ifdef SN9C102_DEBUG - # define DBG(level, fmt, args...) \ --{ \ -+do { \ - if (debug >= (level)) { \ - if ((level) == 1) \ - dev_err(&cam->dev, fmt "\n", ## args); \ -@@ -180,9 +181,9 @@ sn9c102_attach_sensor(struct sn9c102_dev - dev_info(&cam->dev, "[%s:%d] " fmt "\n", \ - __FUNCTION__, __LINE__ , ## args); \ - } \ --} -+} while (0) - # define KDBG(level, fmt, args...) \ --{ \ -+do { \ - if (debug >= (level)) { \ - if ((level) == 1 || (level) == 2) \ - pr_info("sn9c102: " fmt "\n", ## args); \ -@@ -190,17 +191,17 @@ sn9c102_attach_sensor(struct sn9c102_dev - pr_debug("sn9c102: [%s:%d] " fmt "\n", __FUNCTION__, \ - __LINE__ , ## args); \ - } \ --} -+} while (0) - #else --# define KDBG(level, fmt, args...) do {;} while(0); --# define DBG(level, fmt, args...) do {;} while(0); -+# define KDBG(level, fmt, args...) do {;} while(0) -+# define DBG(level, fmt, args...) do {;} while(0) - #endif - - #undef PDBG - #define PDBG(fmt, args...) \ --dev_info(&cam->dev, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__ , ## args); -+dev_info(&cam->dev, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__ , ## args) - - #undef PDBGG --#define PDBGG(fmt, args...) do {;} while(0); /* placeholder */ -+#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ - - #endif /* _SN9C102_H_ */ ---- gregkh-2.6.orig/drivers/usb/media/sn9c102_hv7131d.c -+++ gregkh-2.6/drivers/usb/media/sn9c102_hv7131d.c -@@ -2,7 +2,7 @@ - * Plug-in for HV7131D image sensor connected to the SN9C10x PC Camera * - * Controllers * - * * -- * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * - * * - * 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 * ---- gregkh-2.6.orig/drivers/usb/media/sn9c102_mi0343.c -+++ gregkh-2.6/drivers/usb/media/sn9c102_mi0343.c -@@ -2,7 +2,7 @@ - * Plug-in for MI-0343 image sensor connected to the SN9C10x PC Camera * - * Controllers * - * * -- * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * - * * - * 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 * ---- gregkh-2.6.orig/drivers/usb/media/sn9c102_ov7630.c -+++ gregkh-2.6/drivers/usb/media/sn9c102_ov7630.c -@@ -2,7 +2,7 @@ - * Plug-in for OV7630 image sensor connected to the SN9C10x PC Camera * - * Controllers * - * * -- * Copyright (C) 2005 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * Copyright (C) 2005-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * - * * - * 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 * -@@ -375,8 +375,10 @@ int sn9c102_probe_ov7630(struct sn9c102_ - - sn9c102_attach_sensor(cam, &ov7630); - -- if (le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x608f && -- le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x602c) -+ if (le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x602c && -+ le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x602d && -+ le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x608f && -+ le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x60b0) - return -ENODEV; - - err += sn9c102_write_reg(cam, 0x01, 0x01); ---- gregkh-2.6.orig/drivers/usb/media/sn9c102_pas106b.c -+++ gregkh-2.6/drivers/usb/media/sn9c102_pas106b.c -@@ -2,7 +2,7 @@ - * Plug-in for PAS106B image sensor connected to the SN9C10x PC Camera * - * Controllers * - * * -- * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * - * * - * 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 * ---- gregkh-2.6.orig/drivers/usb/media/sn9c102_sensor.h -+++ gregkh-2.6/drivers/usb/media/sn9c102_sensor.h -@@ -1,7 +1,7 @@ - /*************************************************************************** - * API for image sensors connected to the SN9C10x PC Camera Controllers * - * * -- * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * - * * - * 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 * -@@ -92,7 +92,18 @@ extern void - sn9c102_attach_sensor(struct sn9c102_device* cam, - struct sn9c102_sensor* sensor); - --/* Each SN9C10X camera has proper PID/VID identifiers. Add them here in case.*/ -+/* -+ Each SN9C10x camera has proper PID/VID identifiers. -+ SN9C103 supports multiple interfaces, but we only handle the video class -+ interface. -+*/ -+#define SN9C102_USB_DEVICE(vend, prod, intclass) \ -+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ -+ USB_DEVICE_ID_MATCH_INT_CLASS, \ -+ .idVendor = (vend), \ -+ .idProduct = (prod), \ -+ .bInterfaceClass = (intclass) -+ - #define SN9C102_ID_TABLE \ - static const struct usb_device_id sn9c102_id_table[] = { \ - { USB_DEVICE(0x0c45, 0x6001), }, /* TAS5110C1B */ \ -@@ -107,33 +118,34 @@ static const struct usb_device_id sn9c10 - { USB_DEVICE(0x0c45, 0x602b), }, /* MI-0343 */ \ - { USB_DEVICE(0x0c45, 0x602c), }, /* OV7630 */ \ - { USB_DEVICE(0x0c45, 0x602d), }, \ -+ { USB_DEVICE(0x0c45, 0x602e), }, /* OV7630 */ \ - { USB_DEVICE(0x0c45, 0x6030), }, /* MI03x */ \ -- { USB_DEVICE(0x0c45, 0x6080), }, \ -- { USB_DEVICE(0x0c45, 0x6082), }, /* MI0343 and MI0360 */ \ -- { USB_DEVICE(0x0c45, 0x6083), }, /* HV7131[D|E1] */ \ -- { USB_DEVICE(0x0c45, 0x6088), }, \ -- { USB_DEVICE(0x0c45, 0x608a), }, \ -- { USB_DEVICE(0x0c45, 0x608b), }, \ -- { USB_DEVICE(0x0c45, 0x608c), }, /* HV7131x */ \ -- { USB_DEVICE(0x0c45, 0x608e), }, /* CIS-VF10 */ \ -- { USB_DEVICE(0x0c45, 0x608f), }, /* OV7630 */ \ -- { USB_DEVICE(0x0c45, 0x60a0), }, \ -- { USB_DEVICE(0x0c45, 0x60a2), }, \ -- { USB_DEVICE(0x0c45, 0x60a3), }, \ -- { USB_DEVICE(0x0c45, 0x60a8), }, /* PAS106B */ \ -- { USB_DEVICE(0x0c45, 0x60aa), }, /* TAS5130D1B */ \ -- { USB_DEVICE(0x0c45, 0x60ab), }, /* TAS5110C1B */ \ -- { USB_DEVICE(0x0c45, 0x60ac), }, \ -- { USB_DEVICE(0x0c45, 0x60ae), }, \ -- { USB_DEVICE(0x0c45, 0x60af), }, /* PAS202BCB */ \ -- { USB_DEVICE(0x0c45, 0x60b0), }, \ -- { USB_DEVICE(0x0c45, 0x60b2), }, \ -- { USB_DEVICE(0x0c45, 0x60b3), }, \ -- { USB_DEVICE(0x0c45, 0x60b8), }, \ -- { USB_DEVICE(0x0c45, 0x60ba), }, \ -- { USB_DEVICE(0x0c45, 0x60bb), }, \ -- { USB_DEVICE(0x0c45, 0x60bc), }, \ -- { USB_DEVICE(0x0c45, 0x60be), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x6080, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x6082, 0xff), }, /* MI0343 & MI0360 */ \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x6083, 0xff), }, /* HV7131[D|E1] */ \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x6088, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x608a, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x608b, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x608c, 0xff), }, /* HV7131x */ \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x608e, 0xff), }, /* CIS-VF10 */ \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x608f, 0xff), }, /* OV7630 */ \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60a0, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60a2, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60a3, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60a8, 0xff), }, /* PAS106B */ \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60aa, 0xff), }, /* TAS5130D1B */ \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60ab, 0xff), }, /* TAS5110C1B */ \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60ac, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60ae, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60af, 0xff), }, /* PAS202BCB */ \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60b0, 0xff), }, /* OV7630 (?) */ \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60b2, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60b3, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60b8, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60ba, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60bb, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60bc, 0xff), }, \ -+ { SN9C102_USB_DEVICE(0x0c45, 0x60be, 0xff), }, \ - { } \ - }; - -@@ -177,6 +189,7 @@ extern int sn9c102_i2c_write(struct sn9c - extern int sn9c102_i2c_read(struct sn9c102_device*, u8 address); - - /* I/O on registers in the bridge. Could be used by the sensor methods too */ -+extern int sn9c102_write_regs(struct sn9c102_device*, u8* buff, u16 index); - extern int sn9c102_write_reg(struct sn9c102_device*, u8 value, u16 index); - extern int sn9c102_pread_reg(struct sn9c102_device*, u16 index); - ---- gregkh-2.6.orig/drivers/usb/media/sn9c102_tas5110c1b.c -+++ gregkh-2.6/drivers/usb/media/sn9c102_tas5110c1b.c -@@ -2,7 +2,7 @@ - * Plug-in for TAS5110C1B image sensor connected to the SN9C10x PC Camera * - * Controllers * - * * -- * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * - * * - * 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 * ---- gregkh-2.6.orig/drivers/usb/media/sn9c102_tas5130d1b.c -+++ gregkh-2.6/drivers/usb/media/sn9c102_tas5130d1b.c -@@ -2,7 +2,7 @@ - * Plug-in for TAS5130D1B image sensor connected to the SN9C10x PC Camera * - * Controllers * - * * -- * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * -+ * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * - * * - * 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 * diff --git a/usb/usb-sn9c10x-driver-updates.patch b/usb/usb-sn9c10x-driver-updates.patch deleted file mode 100644 index c6cabfba123b9..0000000000000 --- a/usb/usb-sn9c10x-driver-updates.patch +++ /dev/null @@ -1,368 +0,0 @@ -From luca.risolia@studio.unibo.it Fri Jan 13 08:13:56 2006 -Date: Fri, 13 Jan 2006 17:19:43 +0000 -From: Luca Risolia <luca.risolia@studio.unibo.it> -To: Greg Kroah-Hartman <gregkh@suse.de> -Subject: USB: SN9C10x driver updates -Message-ID: <20060113171943.GA31598@studio.unibo.it> -Content-Disposition: inline - -SN9C10x driver updates: - -- Use kzalloc() instead of kmalloc() -- Move some macro definitions from sn9c102.h to sn9c102_core.c -- Use vfree() and vmalloc_32() instead of rvfree() and rvmalloc() -- Fix mmap() sys call -- Documentation updates - -Signed-off-by: Luca Risolia <luca.risolia@studio.unibo.it> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - Documentation/usb/sn9c102.txt | 9 +++ - drivers/usb/media/sn9c102.h | 27 ++++------ - drivers/usb/media/sn9c102_core.c | 92 +++++++++++-------------------------- - drivers/usb/media/sn9c102_sensor.h | 16 ++---- - 4 files changed, 54 insertions(+), 90 deletions(-) - ---- gregkh-2.6.orig/Documentation/usb/sn9c102.txt -+++ gregkh-2.6/Documentation/usb/sn9c102.txt -@@ -111,6 +111,12 @@ corresponding modules must be compiled: - # - CONFIG_VIDEO_DEV=m - -+To enable advanced debugging functionality on the device through /sysfs: -+ -+ # Multimedia devices -+ # -+ CONFIG_VIDEO_ADV_DEBUG=y -+ - # USB support - # - CONFIG_USB=m -@@ -208,7 +214,8 @@ Default: 2 - - 8. Optional device control through "sysfs" [1] - ========================================== --It is possible to read and write both the SN9C10x and the image sensor -+If the kernel has been compiled with the CONFIG_VIDEO_ADV_DEBUG option enabled, -+it is possible to read and write both the SN9C10x and the image sensor - registers by using the "sysfs" filesystem interface. - - Every time a supported device is recognized, a write-only file named "green" is ---- gregkh-2.6.orig/drivers/usb/media/sn9c102_core.c -+++ gregkh-2.6/drivers/usb/media/sn9c102_core.c -@@ -45,6 +45,15 @@ - - /*****************************************************************************/ - -+#define SN9C102_MODULE_NAME "V4L2 driver for SN9C10x PC Camera Controllers" -+#define SN9C102_MODULE_AUTHOR "(C) 2004-2006 Luca Risolia" -+#define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" -+#define SN9C102_MODULE_LICENSE "GPL" -+#define SN9C102_MODULE_VERSION "1:1.26" -+#define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 26) -+ -+/*****************************************************************************/ -+ - MODULE_DEVICE_TABLE(usb, sn9c102_id_table); - - MODULE_AUTHOR(SN9C102_MODULE_AUTHOR " " SN9C102_AUTHOR_EMAIL); -@@ -115,50 +124,6 @@ static sn9c102_eof_header_t sn9c102_eof_ - - /*****************************************************************************/ - --static void* rvmalloc(size_t size) --{ -- void* mem; -- unsigned long adr; -- -- size = PAGE_ALIGN(size); -- -- mem = vmalloc_32((unsigned long)size); -- if (!mem) -- return NULL; -- -- memset(mem, 0, size); -- -- adr = (unsigned long)mem; -- while (size > 0) { -- SetPageReserved(vmalloc_to_page((void *)adr)); -- adr += PAGE_SIZE; -- size -= PAGE_SIZE; -- } -- -- return mem; --} -- -- --static void rvfree(void* mem, size_t size) --{ -- unsigned long adr; -- -- if (!mem) -- return; -- -- size = PAGE_ALIGN(size); -- -- adr = (unsigned long)mem; -- while (size > 0) { -- ClearPageReserved(vmalloc_to_page((void *)adr)); -- adr += PAGE_SIZE; -- size -= PAGE_SIZE; -- } -- -- vfree(mem); --} -- -- - static u32 - sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, - enum sn9c102_io_method io) -@@ -177,7 +142,7 @@ sn9c102_request_buffers(struct sn9c102_d - - cam->nbuffers = count; - while (cam->nbuffers > 0) { -- if ((buff = rvmalloc(cam->nbuffers * PAGE_ALIGN(imagesize)))) -+ if ((buff = vmalloc_32(cam->nbuffers * PAGE_ALIGN(imagesize)))) - break; - cam->nbuffers--; - } -@@ -201,8 +166,7 @@ sn9c102_request_buffers(struct sn9c102_d - static void sn9c102_release_buffers(struct sn9c102_device* cam) - { - if (cam->nbuffers) { -- rvfree(cam->frame[0].bufmem, -- cam->nbuffers * PAGE_ALIGN(cam->frame[0].buf.length)); -+ vfree(cam->frame[0].bufmem); - cam->nbuffers = 0; - } - cam->frame_current = NULL; -@@ -745,7 +709,7 @@ static int sn9c102_start_transfer(struct - int err = 0; - - for (i = 0; i < SN9C102_URBS; i++) { -- cam->transfer_buffer[i] = kmalloc(SN9C102_ISO_PACKETS * psz, -+ cam->transfer_buffer[i] = kzalloc(SN9C102_ISO_PACKETS * psz, - GFP_KERNEL); - if (!cam->transfer_buffer[i]) { - err = -ENOMEM; -@@ -865,6 +829,7 @@ static int sn9c102_stream_interrupt(stru - - /*****************************************************************************/ - -+#ifdef CONFIG_VIDEO_ADV_DEBUG - static u8 sn9c102_strtou8(const char* buff, size_t len, ssize_t* count) - { - char str[5]; -@@ -1289,6 +1254,7 @@ static void sn9c102_create_sysfs(struct - video_device_create_file(v4ldev, &class_device_attr_i2c_val); - } - } -+#endif /* CONFIG_VIDEO_ADV_DEBUG */ - - /*****************************************************************************/ - -@@ -1754,9 +1720,8 @@ static int sn9c102_mmap(struct file* fil - { - struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); - unsigned long size = vma->vm_end - vma->vm_start, -- start = vma->vm_start, -- pos, -- page; -+ start = vma->vm_start; -+ void *pos; - u32 i; - - if (down_interruptible(&cam->fileop_sem)) -@@ -1790,15 +1755,12 @@ static int sn9c102_mmap(struct file* fil - return -EINVAL; - } - -- /* VM_IO is eventually going to replace PageReserved altogether */ - vma->vm_flags |= VM_IO; -- vma->vm_flags |= VM_RESERVED; /* avoid to swap out this VMA */ -+ vma->vm_flags |= VM_RESERVED; - -- pos = (unsigned long)cam->frame[i].bufmem; -+ pos = cam->frame[i].bufmem; - while (size > 0) { /* size is page-aligned */ -- page = vmalloc_to_pfn((void *)pos); -- if (remap_pfn_range(vma, start, page, PAGE_SIZE, -- vma->vm_page_prot)) { -+ if (vm_insert_page(vma, start, vmalloc_to_page(pos))) { - up(&cam->fileop_sem); - return -EAGAIN; - } -@@ -1831,7 +1793,8 @@ sn9c102_vidioc_querycap(struct sn9c102_d - - strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); - if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) -- strlcpy(cap.bus_info, cam->dev.bus_id, sizeof(cap.bus_info)); -+ strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, -+ sizeof(cap.bus_info)); - - if (copy_to_user(arg, &cap, sizeof(cap))) - return -EFAULT; -@@ -1852,7 +1815,7 @@ sn9c102_vidioc_enuminput(struct sn9c102_ - return -EINVAL; - - memset(&i, 0, sizeof(i)); -- strcpy(i.name, "USB"); -+ strcpy(i.name, "Camera"); - - if (copy_to_user(arg, &i, sizeof(i))) - return -EFAULT; -@@ -2708,6 +2671,8 @@ static int sn9c102_ioctl(struct inode* i - return -EIO; - } - -+ V4LDBG(3, "sn9c102", cmd); -+ - err = sn9c102_ioctl_v4l2(inode, filp, cmd, (void __user *)arg); - - up(&cam->fileop_sem); -@@ -2740,13 +2705,12 @@ sn9c102_usb_probe(struct usb_interface* - unsigned int i; - int err = 0, r; - -- if (!(cam = kmalloc(sizeof(struct sn9c102_device), GFP_KERNEL))) -+ if (!(cam = kzalloc(sizeof(struct sn9c102_device), GFP_KERNEL))) - return -ENOMEM; - - cam->usbdev = udev; -- memcpy(&cam->dev, &udev->dev, sizeof(struct device)); - -- if (!(cam->control_buffer = kmalloc(8, GFP_KERNEL))) { -+ if (!(cam->control_buffer = kzalloc(8, GFP_KERNEL))) { - DBG(1, "kmalloc() failed"); - err = -ENOMEM; - goto fail; -@@ -2806,7 +2770,7 @@ sn9c102_usb_probe(struct usb_interface* - strcpy(cam->v4ldev->name, "SN9C10x PC Camera"); - cam->v4ldev->owner = THIS_MODULE; - cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES; -- cam->v4ldev->hardware = VID_HARDWARE_SN9C102; -+ cam->v4ldev->hardware = 0; - cam->v4ldev->fops = &sn9c102_fops; - cam->v4ldev->minor = video_nr[dev_nr]; - cam->v4ldev->release = video_device_release; -@@ -2832,8 +2796,10 @@ sn9c102_usb_probe(struct usb_interface* - - dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0; - -+#ifdef CONFIG_VIDEO_ADV_DEBUG - sn9c102_create_sysfs(cam); - DBG(2, "Optional device control through 'sysfs' interface ready"); -+#endif - - usb_set_intfdata(intf, cam); - ---- gregkh-2.6.orig/drivers/usb/media/sn9c102.h -+++ gregkh-2.6/drivers/usb/media/sn9c102.h -@@ -23,7 +23,8 @@ - - #include <linux/version.h> - #include <linux/usb.h> --#include <linux/videodev.h> -+#include <linux/videodev2.h> -+#include <media/v4l2-common.h> - #include <linux/device.h> - #include <linux/list.h> - #include <linux/spinlock.h> -@@ -52,13 +53,6 @@ - - /*****************************************************************************/ - --#define SN9C102_MODULE_NAME "V4L2 driver for SN9C10x PC Camera Controllers" --#define SN9C102_MODULE_AUTHOR "(C) 2004-2006 Luca Risolia" --#define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" --#define SN9C102_MODULE_LICENSE "GPL" --#define SN9C102_MODULE_VERSION "1:1.25" --#define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 25) -- - enum sn9c102_bridge { - BRIDGE_SN9C101 = 0x01, - BRIDGE_SN9C102 = 0x02, -@@ -119,8 +113,6 @@ static DECLARE_MUTEX(sn9c102_sysfs_lock) - static DECLARE_RWSEM(sn9c102_disconnect); - - struct sn9c102_device { -- struct device dev; -- - struct video_device* v4ldev; - - enum sn9c102_bridge bridge; -@@ -161,7 +153,6 @@ sn9c102_attach_sensor(struct sn9c102_dev - struct sn9c102_sensor* sensor) - { - cam->sensor = sensor; -- cam->sensor->dev = &cam->dev; - cam->sensor->usbdev = cam->usbdev; - } - -@@ -174,14 +165,19 @@ sn9c102_attach_sensor(struct sn9c102_dev - do { \ - if (debug >= (level)) { \ - if ((level) == 1) \ -- dev_err(&cam->dev, fmt "\n", ## args); \ -+ dev_err(&cam->usbdev->dev, fmt "\n", ## args); \ - else if ((level) == 2) \ -- dev_info(&cam->dev, fmt "\n", ## args); \ -+ dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ - else if ((level) >= 3) \ -- dev_info(&cam->dev, "[%s:%d] " fmt "\n", \ -+ dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ - __FUNCTION__, __LINE__ , ## args); \ - } \ - } while (0) -+# define V4LDBG(level, name, cmd) \ -+do { \ -+ if (debug >= (level)) \ -+ v4l_print_ioctl(name, cmd); \ -+} while (0) - # define KDBG(level, fmt, args...) \ - do { \ - if (debug >= (level)) { \ -@@ -193,8 +189,9 @@ do { - } \ - } while (0) - #else --# define KDBG(level, fmt, args...) do {;} while(0) - # define DBG(level, fmt, args...) do {;} while(0) -+# define V4LDBG(level, name, cmd) do {;} while(0) -+# define KDBG(level, fmt, args...) do {;} while(0) - #endif - - #undef PDBG ---- gregkh-2.6.orig/drivers/usb/media/sn9c102_sensor.h -+++ gregkh-2.6/drivers/usb/media/sn9c102_sensor.h -@@ -196,10 +196,11 @@ extern int sn9c102_pread_reg(struct sn9c - /* - NOTE: there are no exported debugging functions. To uniform the output you - must use the dev_info()/dev_warn()/dev_err() macros defined in device.h, -- already included here, the argument being the struct device 'dev' of the -- sensor structure. Do NOT use these macros before the sensor is attached or -- the kernel will crash! However, you should not need to notify the user about -- common errors or other messages, since this is done by the master module. -+ already included here, the argument being the struct device '&usbdev->dev' -+ of the sensor structure. Do NOT use these macros before the sensor is -+ attached or the kernel will crash! However, you should not need to notify -+ the user about common errors or other messages, since this is done by the -+ master module. - */ - - /*****************************************************************************/ -@@ -358,13 +359,6 @@ struct sn9c102_sensor { - error code without rolling back. - */ - -- const struct device* dev; -- /* -- This is the argument for dev_err(), dev_info() and dev_warn(). It -- is used for debugging purposes. You must not access the struct -- before the sensor is attached. -- */ -- - const struct usb_device* usbdev; - /* - Points to the usb_device struct after the sensor is attached. diff --git a/usb/usb-touchkitusb.c-fix.patch b/usb/usb-touchkitusb.c-fix.patch deleted file mode 100644 index 3c2576cfd717b..0000000000000 --- a/usb/usb-touchkitusb.c-fix.patch +++ /dev/null @@ -1,30 +0,0 @@ -From schindele@nentec.de Sun Jan 8 23:55:21 2006 -From: Juergen Schindele <schindele@nentec.de> -To: Greg KH <greg@kroah.com> -Subject: USB: touchkitusb.c (eGalax driver) fix -Date: Mon, 9 Jan 2006 08:51:48 +0100 -Message-Id: <200601090851.48435.schindele@nentec.de> - -This patch corrects the URB initialisation for transfers -like this is done in other drivers too. -Without this patch no data was transmitted on a PXA270 OHCI -platform. May apply to others too. - -Signed-off-by: Juergen Schindele <schindele@nentec.de> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> ---- - drivers/usb/input/touchkitusb.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- gregkh-2.6.orig/drivers/usb/input/touchkitusb.c -+++ gregkh-2.6/drivers/usb/input/touchkitusb.c -@@ -337,6 +337,9 @@ static int touchkit_probe(struct usb_int - touchkit->data, TOUCHKIT_REPORT_DATA_SIZE, - touchkit_irq, touchkit, endpoint->bInterval); - -+ touchkit->irq->transfer_dma = touchkit->data_dma; -+ touchkit->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; -+ - input_register_device(touchkit->input); - - usb_set_intfdata(intf, touchkit); diff --git a/usb/usb-ub-03-oops-with-cfq.patch b/usb/usb-ub-03-oops-with-cfq.patch deleted file mode 100644 index 10ed8f8929104..0000000000000 --- a/usb/usb-ub-03-oops-with-cfq.patch +++ /dev/null @@ -1,226 +0,0 @@ -From zaitcev@redhat.com Thu Dec 29 19:00:14 2005 -Date: Wed, 28 Dec 2005 14:22:17 -0800 -From: Pete Zaitcev <zaitcev@redhat.com> -To: greg@kroah.com -Subject: USB: ub 03 Oops with CFQ -Message-Id: <20051228142217.54a8c3d2.zaitcev@redhat.com> - -The blk_cleanup_queue does not necesserily destroy the queue. When we -destroy the corresponding ub_dev, it may leave the queue spinlock pointer -dangling. - -This patch moves spinlocks from ub_dev to static memory. The locking -scheme is not changed. These spinlocks are still separate from the ub_lock. - -Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/block/ub.c | 68 +++++++++++++++++++++++++++++++++++------------------ - 1 file changed, 45 insertions(+), 23 deletions(-) - ---- gregkh-2.6.orig/drivers/block/ub.c -+++ gregkh-2.6/drivers/block/ub.c -@@ -355,7 +355,7 @@ struct ub_lun { - * The USB device instance. - */ - struct ub_dev { -- spinlock_t lock; -+ spinlock_t *lock; - atomic_t poison; /* The USB device is disconnected */ - int openc; /* protected by ub_lock! */ - /* kref is too implicit for our taste */ -@@ -452,6 +452,10 @@ MODULE_DEVICE_TABLE(usb, ub_usb_ids); - #define UB_MAX_HOSTS 26 - static char ub_hostv[UB_MAX_HOSTS]; - -+#define UB_QLOCK_NUM 5 -+static spinlock_t ub_qlockv[UB_QLOCK_NUM]; -+static int ub_qlock_next = 0; -+ - static DEFINE_SPINLOCK(ub_lock); /* Locks globals and ->openc */ - - /* -@@ -531,7 +535,7 @@ static ssize_t ub_diag_show(struct devic - return 0; - - cnt = 0; -- spin_lock_irqsave(&sc->lock, flags); -+ spin_lock_irqsave(sc->lock, flags); - - cnt += sprintf(page + cnt, - "poison %d reset %d\n", -@@ -579,7 +583,7 @@ static ssize_t ub_diag_show(struct devic - if (++nc == SCMD_TRACE_SZ) nc = 0; - } - -- spin_unlock_irqrestore(&sc->lock, flags); -+ spin_unlock_irqrestore(sc->lock, flags); - return cnt; - } - -@@ -627,6 +631,24 @@ static void ub_id_put(int id) - } - - /* -+ * This is necessitated by the fact that blk_cleanup_queue does not -+ * necesserily destroy the queue. Instead, it may merely decrease q->refcnt. -+ * Since our blk_init_queue() passes a spinlock common with ub_dev, -+ * we have life time issues when ub_cleanup frees ub_dev. -+ */ -+static spinlock_t *ub_next_lock(void) -+{ -+ unsigned long flags; -+ spinlock_t *ret; -+ -+ spin_lock_irqsave(&ub_lock, flags); -+ ret = &ub_qlockv[ub_qlock_next]; -+ ub_qlock_next = (ub_qlock_next + 1) % UB_QLOCK_NUM; -+ spin_unlock_irqrestore(&ub_lock, flags); -+ return ret; -+} -+ -+/* - * Downcount for deallocation. This rides on two assumptions: - * - once something is poisoned, its refcount cannot grow - * - opens cannot happen at this time (del_gendisk was done) -@@ -1083,9 +1105,9 @@ static void ub_urb_timeout(unsigned long - struct ub_dev *sc = (struct ub_dev *) arg; - unsigned long flags; - -- spin_lock_irqsave(&sc->lock, flags); -+ spin_lock_irqsave(sc->lock, flags); - usb_unlink_urb(&sc->work_urb); -- spin_unlock_irqrestore(&sc->lock, flags); -+ spin_unlock_irqrestore(sc->lock, flags); - } - - /* -@@ -1108,10 +1130,10 @@ static void ub_scsi_action(unsigned long - struct ub_dev *sc = (struct ub_dev *) _dev; - unsigned long flags; - -- spin_lock_irqsave(&sc->lock, flags); -+ spin_lock_irqsave(sc->lock, flags); - del_timer(&sc->work_timer); - ub_scsi_dispatch(sc); -- spin_unlock_irqrestore(&sc->lock, flags); -+ spin_unlock_irqrestore(sc->lock, flags); - } - - static void ub_scsi_dispatch(struct ub_dev *sc) -@@ -1754,7 +1776,7 @@ static void ub_reset_task(void *arg) - * queues of resets or anything. We do need a spinlock though, - * to interact with block layer. - */ -- spin_lock_irqsave(&sc->lock, flags); -+ spin_lock_irqsave(sc->lock, flags); - sc->reset = 0; - tasklet_schedule(&sc->tasklet); - list_for_each(p, &sc->luns) { -@@ -1762,7 +1784,7 @@ static void ub_reset_task(void *arg) - blk_start_queue(lun->disk->queue); - } - wake_up(&sc->reset_wait); -- spin_unlock_irqrestore(&sc->lock, flags); -+ spin_unlock_irqrestore(sc->lock, flags); - } - - /* -@@ -1990,11 +2012,11 @@ static int ub_sync_tur(struct ub_dev *sc - cmd->done = ub_probe_done; - cmd->back = &compl; - -- spin_lock_irqsave(&sc->lock, flags); -+ spin_lock_irqsave(sc->lock, flags); - cmd->tag = sc->tagcnt++; - - rc = ub_submit_scsi(sc, cmd); -- spin_unlock_irqrestore(&sc->lock, flags); -+ spin_unlock_irqrestore(sc->lock, flags); - - if (rc != 0) { - printk("ub: testing ready: submit error (%d)\n", rc); /* P3 */ -@@ -2052,11 +2074,11 @@ static int ub_sync_read_cap(struct ub_de - cmd->done = ub_probe_done; - cmd->back = &compl; - -- spin_lock_irqsave(&sc->lock, flags); -+ spin_lock_irqsave(sc->lock, flags); - cmd->tag = sc->tagcnt++; - - rc = ub_submit_scsi(sc, cmd); -- spin_unlock_irqrestore(&sc->lock, flags); -+ spin_unlock_irqrestore(sc->lock, flags); - - if (rc != 0) { - printk("ub: reading capacity: submit error (%d)\n", rc); /* P3 */ -@@ -2333,7 +2355,7 @@ static int ub_probe(struct usb_interface - if ((sc = kmalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL) - goto err_core; - memset(sc, 0, sizeof(struct ub_dev)); -- spin_lock_init(&sc->lock); -+ sc->lock = ub_next_lock(); - INIT_LIST_HEAD(&sc->luns); - usb_init_urb(&sc->work_urb); - tasklet_init(&sc->tasklet, ub_scsi_action, (unsigned long)sc); -@@ -2483,7 +2505,7 @@ static int ub_probe_lun(struct ub_dev *s - disk->driverfs_dev = &sc->intf->dev; - - rc = -ENOMEM; -- if ((q = blk_init_queue(ub_request_fn, &sc->lock)) == NULL) -+ if ((q = blk_init_queue(ub_request_fn, sc->lock)) == NULL) - goto err_blkqinit; - - disk->queue = q; -@@ -2554,7 +2576,7 @@ static void ub_disconnect(struct usb_int - * and the whole queue drains. So, we just use this code to - * print warnings. - */ -- spin_lock_irqsave(&sc->lock, flags); -+ spin_lock_irqsave(sc->lock, flags); - { - struct ub_scsi_cmd *cmd; - int cnt = 0; -@@ -2571,7 +2593,7 @@ static void ub_disconnect(struct usb_int - "%d was queued after shutdown\n", sc->name, cnt); - } - } -- spin_unlock_irqrestore(&sc->lock, flags); -+ spin_unlock_irqrestore(sc->lock, flags); - - /* - * Unregister the upper layer. -@@ -2590,19 +2612,15 @@ static void ub_disconnect(struct usb_int - } - - /* -- * Taking a lock on a structure which is about to be freed -- * is very nonsensual. Here it is largely a way to do a debug freeze, -- * and a bracket which shows where the nonsensual code segment ends. -- * - * Testing for -EINPROGRESS is always a bug, so we are bending - * the rules a little. - */ -- spin_lock_irqsave(&sc->lock, flags); -+ spin_lock_irqsave(sc->lock, flags); - if (sc->work_urb.status == -EINPROGRESS) { /* janitors: ignore */ - printk(KERN_WARNING "%s: " - "URB is active after disconnect\n", sc->name); - } -- spin_unlock_irqrestore(&sc->lock, flags); -+ spin_unlock_irqrestore(sc->lock, flags); - - /* - * There is virtually no chance that other CPU runs times so long -@@ -2636,6 +2654,10 @@ static struct usb_driver ub_driver = { - static int __init ub_init(void) - { - int rc; -+ int i; -+ -+ for (i = 0; i < UB_QLOCK_NUM; i++) -+ spin_lock_init(&ub_qlockv[i]); - - if ((rc = register_blkdev(UB_MAJOR, DRV_NAME)) != 0) - goto err_regblkdev; diff --git a/usb/usb-ub-04-loss-of-timer-and-a-hang.patch b/usb/usb-ub-04-loss-of-timer-and-a-hang.patch deleted file mode 100644 index 1e541ef9c515c..0000000000000 --- a/usb/usb-ub-04-loss-of-timer-and-a-hang.patch +++ /dev/null @@ -1,56 +0,0 @@ -From zaitcev@redhat.com Thu Jan 5 00:17:16 2006 -Date: Thu, 5 Jan 2006 00:14:02 -0800 -From: Pete Zaitcev <zaitcev@redhat.com> -To: greg@kroah.com -Subject: USB: ub 04 Loss of timer and a hang -Message-Id: <20060105001402.0a1f019d.zaitcev@redhat.com> - -If SCSI commands are submitted while other commands are still processed, -the dispatch loop turns, and we stop the work_timer. Then, if URB fails -to complete, ub hangs until the device is unplugged. - -This does not happen often, becase we only allow one SCSI command per -block device, but does happen (on multi-LUN devices, for example). - -The fix is to stop timer only when we actually going to change the state. - -The nicest code would be to have the timer stopped in URB callback, but -this is impossible, because it can be called from inside a timer, through -the urb_unlink. Then we get BUG in timer.c:cascade(). So, we do it a -little dirtier. - -Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/block/ub.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- gregkh-2.6.orig/drivers/block/ub.c -+++ gregkh-2.6/drivers/block/ub.c -@@ -1106,7 +1106,8 @@ static void ub_urb_timeout(unsigned long - unsigned long flags; - - spin_lock_irqsave(sc->lock, flags); -- usb_unlink_urb(&sc->work_urb); -+ if (!ub_is_completed(&sc->work_done)) -+ usb_unlink_urb(&sc->work_urb); - spin_unlock_irqrestore(sc->lock, flags); - } - -@@ -1131,7 +1132,6 @@ static void ub_scsi_action(unsigned long - unsigned long flags; - - spin_lock_irqsave(sc->lock, flags); -- del_timer(&sc->work_timer); - ub_scsi_dispatch(sc); - spin_unlock_irqrestore(sc->lock, flags); - } -@@ -1155,6 +1155,7 @@ static void ub_scsi_dispatch(struct ub_d - } else { - if (!ub_is_completed(&sc->work_done)) - break; -+ del_timer(&sc->work_timer); - ub_scsi_urb_compl(sc, cmd); - } - } diff --git a/usb/usb-ub-05-bulk-reset.patch b/usb/usb-ub-05-bulk-reset.patch deleted file mode 100644 index 9b946aac0d52d..0000000000000 --- a/usb/usb-ub-05-bulk-reset.patch +++ /dev/null @@ -1,151 +0,0 @@ -From zaitcev@redhat.com Thu Jan 5 00:28:11 2006 -Date: Thu, 5 Jan 2006 00:26:30 -0800 -From: Pete Zaitcev <zaitcev@redhat.com> -To: greg@kroah.com -Subject: USB: ub 05 Bulk reset -Message-Id: <20060105002630.412b74f2.zaitcev@redhat.com> - -For crying out loud, they have devices which do not like port resets. -So, do what usb-storage does and try both bulk and port resets. -We start with a port reset (which usb-storage does at the end of transport), -then do a Bulk reset, then a port reset again. This seems to work for me. - -The code is getting dirtier and dirtier here, but I swear that I'll -do something about it (see those two new XXX). Honest. - -Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/block/ub.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++------ - 1 file changed, 59 insertions(+), 7 deletions(-) - ---- gregkh-2.6.orig/drivers/block/ub.c -+++ gregkh-2.6/drivers/block/ub.c -@@ -14,7 +14,6 @@ - * -- special case some senses, e.g. 3a/0 -> no media present, reduce retries - * -- verify the 13 conditions and do bulk resets - * -- kill last_pipe and simply do two-state clearing on both pipes -- * -- verify protocol (bulk) from USB descriptors (maybe...) - * -- highmem - * -- move top_sense and work_bcs into separate allocations (if they survive) - * for cache purists and esoteric architectures. -@@ -420,11 +419,13 @@ static void ub_state_sense(struct ub_dev - static int ub_submit_clear_stall(struct ub_dev *sc, struct ub_scsi_cmd *cmd, - int stalled_pipe); - static void ub_top_sense_done(struct ub_dev *sc, struct ub_scsi_cmd *scmd); --static void ub_reset_enter(struct ub_dev *sc); -+static void ub_reset_enter(struct ub_dev *sc, int try); - static void ub_reset_task(void *arg); - static int ub_sync_tur(struct ub_dev *sc, struct ub_lun *lun); - static int ub_sync_read_cap(struct ub_dev *sc, struct ub_lun *lun, - struct ub_capacity *ret); -+static int ub_sync_reset(struct ub_dev *sc); -+static int ub_probe_clear_stall(struct ub_dev *sc, int stalled_pipe); - static int ub_probe_lun(struct ub_dev *sc, int lnum); - - /* -@@ -983,7 +984,7 @@ static int ub_rw_cmd_retry(struct ub_dev - if (atomic_read(&sc->poison)) - return -ENXIO; - -- ub_reset_enter(sc); -+ ub_reset_enter(sc, urq->current_try); - - if (urq->current_try >= 3) - return -EIO; -@@ -1019,8 +1020,6 @@ static int ub_rw_cmd_retry(struct ub_dev - * No exceptions. - * - * Host is assumed locked. -- * -- * XXX We only support Bulk for the moment. - */ - static int ub_submit_scsi(struct ub_dev *sc, struct ub_scsi_cmd *cmd) - { -@@ -1703,16 +1702,18 @@ static void ub_top_sense_done(struct ub_ - - /* - * Reset management -+ * XXX Move usb_reset_device to khubd. Hogging kevent is not a good thing. -+ * XXX Make usb_sync_reset asynchronous. - */ - --static void ub_reset_enter(struct ub_dev *sc) -+static void ub_reset_enter(struct ub_dev *sc, int try) - { - - if (sc->reset) { - /* This happens often on multi-LUN devices. */ - return; - } -- sc->reset = 1; -+ sc->reset = try + 1; - - #if 0 /* Not needed because the disconnect waits for us. */ - unsigned long flags; -@@ -1750,6 +1751,11 @@ static void ub_reset_task(void *arg) - if (atomic_read(&sc->poison)) { - printk(KERN_NOTICE "%s: Not resetting disconnected device\n", - sc->name); /* P3 This floods. Remove soon. XXX */ -+ } else if ((sc->reset & 1) == 0) { -+ ub_sync_reset(sc); -+ msleep(700); /* usb-storage sleeps 6s (!) */ -+ ub_probe_clear_stall(sc, sc->recv_bulk_pipe); -+ ub_probe_clear_stall(sc, sc->send_bulk_pipe); - } else if (sc->dev->actconfig->desc.bNumInterfaces != 1) { - printk(KERN_NOTICE "%s: Not resetting multi-interface device\n", - sc->name); /* P3 This floods. Remove soon. XXX */ -@@ -2141,6 +2147,52 @@ static void ub_probe_timeout(unsigned lo - } - - /* -+ * Reset with a Bulk reset. -+ */ -+static int ub_sync_reset(struct ub_dev *sc) -+{ -+ int ifnum = sc->intf->cur_altsetting->desc.bInterfaceNumber; -+ struct usb_ctrlrequest *cr; -+ struct completion compl; -+ struct timer_list timer; -+ int rc; -+ -+ init_completion(&compl); -+ -+ cr = &sc->work_cr; -+ cr->bRequestType = USB_TYPE_CLASS | USB_RECIP_INTERFACE; -+ cr->bRequest = US_BULK_RESET_REQUEST; -+ cr->wValue = cpu_to_le16(0); -+ cr->wIndex = cpu_to_le16(ifnum); -+ cr->wLength = cpu_to_le16(0); -+ -+ usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, -+ (unsigned char*) cr, NULL, 0, ub_probe_urb_complete, &compl); -+ sc->work_urb.actual_length = 0; -+ sc->work_urb.error_count = 0; -+ sc->work_urb.status = 0; -+ -+ if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0) { -+ printk(KERN_WARNING -+ "%s: Unable to submit a bulk reset (%d)\n", sc->name, rc); -+ return rc; -+ } -+ -+ init_timer(&timer); -+ timer.function = ub_probe_timeout; -+ timer.data = (unsigned long) &compl; -+ timer.expires = jiffies + UB_CTRL_TIMEOUT; -+ add_timer(&timer); -+ -+ wait_for_completion(&compl); -+ -+ del_timer_sync(&timer); -+ usb_kill_urb(&sc->work_urb); -+ -+ return sc->work_urb.status; -+} -+ -+/* - * Get number of LUNs by the way of Bulk GetMaxLUN command. - */ - static int ub_sync_getmaxlun(struct ub_dev *sc) diff --git a/usb/usb-uhci-no-fsbr-until-device-is-configured.patch b/usb/usb-uhci-no-fsbr-until-device-is-configured.patch deleted file mode 100644 index 3a4fa837ffa56..0000000000000 --- a/usb/usb-uhci-no-fsbr-until-device-is-configured.patch +++ /dev/null @@ -1,34 +0,0 @@ -From stern@rowland.harvard.edu Mon Jan 23 14:17:23 2006 -Date: Mon, 23 Jan 2006 17:17:21 -0500 (EST) -From: Alan Stern <stern@rowland.harvard.edu> -To: Greg KH <greg@kroah.com> -Subject: USB: UHCI: No FSBR until device is configured -Message-ID: <Pine.LNX.4.44L0.0601231708160.7889-100000@iolanthe.rowland.org> - - -Some USB devices don't enumerate well with FSBR turned on. This patch -keeps devices on the low-speed part of the schedule (which doesn't use -FSBR) until they have been fully configured. - - -Signed-off-by: Alan Stern <stern@rowland.harvard.edu> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/host/uhci-q.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/host/uhci-q.c -+++ gregkh-2.6/drivers/usb/host/uhci-q.c -@@ -672,9 +672,9 @@ static int uhci_submit_control(struct uh - /* Low-speed transfers get a different queue, and won't hog the bus. - * Also, some devices enumerate better without FSBR; the easiest way - * to do that is to put URBs on the low-speed queue while the device -- * is in the DEFAULT state. */ -+ * isn't in the CONFIGURED state. */ - if (urb->dev->speed == USB_SPEED_LOW || -- urb->dev->state == USB_STATE_DEFAULT) -+ urb->dev->state != USB_STATE_CONFIGURED) - skelqh = uhci->skel_ls_control_qh; - else { - skelqh = uhci->skel_fs_control_qh; diff --git a/usb/usb-usb-authentication-states.patch b/usb/usb-usb-authentication-states.patch deleted file mode 100644 index 34a6d402c315d..0000000000000 --- a/usb/usb-usb-authentication-states.patch +++ /dev/null @@ -1,38 +0,0 @@ -From david-b@pacbell.net Fri Jan 20 17:25:21 2006 -From: David Brownell <david-b@pacbell.net> -To: Greg KH <greg@kroah.com> -Subject: USB: USB authentication states -Date: Fri, 20 Jan 2006 14:44:12 -0800 -Message-Id: <200601201444.13184.david-b@pacbell.net> - -Another hook needed for wireless USB: there are states associated with the -device authentication protocol. Wireless devices must authenticate using -the host system's keystore. - -Note that wired connections could also use this authentication protocol, if -for no other reason than to support the most secure "simple" key exchange -protocols for wireless devices. - -Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - include/linux/usb_ch9.h | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- gregkh-2.6.orig/include/linux/usb_ch9.h -+++ gregkh-2.6/include/linux/usb_ch9.h -@@ -535,9 +535,11 @@ enum usb_device_state { - */ - USB_STATE_NOTATTACHED = 0, - -- /* the chapter 9 device states */ -+ /* chapter 9 and authentication (wireless) device states */ - USB_STATE_ATTACHED, -- USB_STATE_POWERED, -+ USB_STATE_POWERED, /* wired */ -+ USB_STATE_UNAUTHENTICATED, /* auth */ -+ USB_STATE_RECONNECTING, /* auth */ - USB_STATE_DEFAULT, /* limited function */ - USB_STATE_ADDRESS, - USB_STATE_CONFIGURED, /* most functions */ diff --git a/usb/usb-usb-storage-add-support-for-rio-karma.patch b/usb/usb-usb-storage-add-support-for-rio-karma.patch deleted file mode 100644 index 444a8426bf4a1..0000000000000 --- a/usb/usb-usb-storage-add-support-for-rio-karma.patch +++ /dev/null @@ -1,131 +0,0 @@ -From mdharm@multivac.one-eyed-alien.net Fri Dec 30 19:09:06 2005 -Date: Fri, 30 Dec 2005 19:06:53 -0800 -From: Matthew Dharm <mdharm-usb@one-eyed-alien.net> -To: Greg KH <greg@kroah.com> -Subject: USB: usb-storage: Add support for Rio Karma -Message-ID: <20051231030653.GA31722@one-eyed-alien.net> -Content-Disposition: inline - -This patch from Bob Copeland adds support for the Rio Karma portable -digital audio player to the usb-storage driver. The only thing needed to -support this device is a one-time (per plugin) init command which is sent -to the device. - -Signed-off-by: Bob Copeland <me@bobcopeland.com> -Signed-off-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - - ---- - drivers/usb/storage/initializers.c | 73 +++++++++++++++++++++++++++++++++++++ - drivers/usb/storage/initializers.h | 1 - drivers/usb/storage/unusual_devs.h | 5 ++ - 3 files changed, 79 insertions(+) - ---- gregkh-2.6.orig/drivers/usb/storage/initializers.c -+++ gregkh-2.6/drivers/usb/storage/initializers.c -@@ -45,6 +45,12 @@ - #include "debug.h" - #include "transport.h" - -+#define RIO_MSC 0x08 -+#define RIOP_INIT "RIOP\x00\x01\x08" -+#define RIOP_INIT_LEN 7 -+#define RIO_SEND_LEN 40 -+#define RIO_RECV_LEN 0x200 -+ - /* This places the Shuttle/SCM USB<->SCSI bridge devices in multi-target - * mode */ - int usb_stor_euscsi_init(struct us_data *us) -@@ -91,3 +97,70 @@ int usb_stor_ucr61s2b_init(struct us_dat - - return (res ? -1 : 0); - } -+ -+/* Place the Rio Karma into mass storage mode. -+ * -+ * The initialization begins by sending 40 bytes starting -+ * RIOP\x00\x01\x08\x00, which the device will ack with a 512-byte -+ * packet with the high four bits set and everything else null. -+ * -+ * Next, we send RIOP\x80\x00\x08\x00. Each time, a 512 byte response -+ * must be read, but we must loop until byte 5 in the response is 0x08, -+ * indicating success. */ -+int rio_karma_init(struct us_data *us) -+{ -+ int result, partial; -+ char *recv; -+ unsigned long timeout; -+ -+ // us->iobuf is big enough to hold cmd but not receive -+ if (!(recv = kmalloc(RIO_RECV_LEN, GFP_KERNEL))) -+ goto die_nomem; -+ -+ US_DEBUGP("Initializing Karma...\n"); -+ -+ memset(us->iobuf, 0, RIO_SEND_LEN); -+ memcpy(us->iobuf, RIOP_INIT, RIOP_INIT_LEN); -+ -+ result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, -+ us->iobuf, RIO_SEND_LEN, &partial); -+ if (result != USB_STOR_XFER_GOOD) -+ goto die; -+ -+ result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, -+ recv, RIO_RECV_LEN, &partial); -+ if (result != USB_STOR_XFER_GOOD) -+ goto die; -+ -+ us->iobuf[4] = 0x80; -+ us->iobuf[5] = 0; -+ timeout = jiffies + msecs_to_jiffies(3000); -+ for (;;) { -+ US_DEBUGP("Sending init command\n"); -+ result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, -+ us->iobuf, RIO_SEND_LEN, &partial); -+ if (result != USB_STOR_XFER_GOOD) -+ goto die; -+ -+ result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, -+ recv, RIO_RECV_LEN, &partial); -+ if (result != USB_STOR_XFER_GOOD) -+ goto die; -+ -+ if (recv[5] == RIO_MSC) -+ break; -+ if (time_after(jiffies, timeout)) -+ goto die; -+ msleep(10); -+ } -+ US_DEBUGP("Karma initialized.\n"); -+ kfree(recv); -+ return 0; -+ -+die: -+ kfree(recv); -+die_nomem: -+ US_DEBUGP("Could not initialize karma.\n"); -+ return USB_STOR_TRANSPORT_FAILED; -+} -+ ---- gregkh-2.6.orig/drivers/usb/storage/initializers.h -+++ gregkh-2.6/drivers/usb/storage/initializers.h -@@ -48,3 +48,4 @@ int usb_stor_euscsi_init(struct us_data - /* This function is required to activate all four slots on the UCR-61S2B - * flash reader */ - int usb_stor_ucr61s2b_init(struct us_data *us); -+int rio_karma_init(struct us_data *us); ---- gregkh-2.6.orig/drivers/usb/storage/unusual_devs.h -+++ gregkh-2.6/drivers/usb/storage/unusual_devs.h -@@ -145,6 +145,11 @@ UNUSUAL_DEV( 0x0451, 0x5416, 0x0100, 0x - US_SC_DEVICE, US_PR_BULK, NULL, - US_FL_NEED_OVERRIDE ), - -+UNUSUAL_DEV( 0x045a, 0x5210, 0x0101, 0x0101, -+ "Rio", -+ "Rio Karma", -+ US_SC_SCSI, US_PR_BULK, rio_karma_init, 0), -+ - /* Patch submitted by Philipp Friedrich <philipp@void.at> */ - UNUSUAL_DEV( 0x0482, 0x0100, 0x0100, 0x0100, - "Kyocera", diff --git a/usb/usb-usb-storage-support-for-sony-dsc-t5-still-camera.patch b/usb/usb-usb-storage-support-for-sony-dsc-t5-still-camera.patch deleted file mode 100644 index 63d75ba42d325..0000000000000 --- a/usb/usb-usb-storage-support-for-sony-dsc-t5-still-camera.patch +++ /dev/null @@ -1,40 +0,0 @@ -From phil@ipom.com Mon Dec 26 23:09:34 2005 -Message-ID: <43B0E778.6000508@ipom.com> -Date: Mon, 26 Dec 2005 23:04:24 -0800 -From: Phil Dibowitz <phil@ipom.com> -To: Greg KH <greg@kroah.com>, Alexandre Duret-Lutz <adl@gnu.org> -Subject: USB: usb-storage support for SONY DSC-T5 still camera - - -From: Alexandre Duret-Lutz <adl@gnu.org> - -I've been offered a nice Sony DSC-T5 digital camera, with a USB connection. -Unfortunately it is not recognized by Linux 2.6.14.4's usb-storage. - -With the following change I'm able to mount and read my pictures: - -Signed-off-by: Phil Dibowitz <phil@ipom.com> - ---- - drivers/usb/storage/unusual_devs.h | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/storage/unusual_devs.h -+++ gregkh-2.6/drivers/usb/storage/unusual_devs.h -@@ -429,11 +429,11 @@ UNUSUAL_DEV( 0x054c, 0x0010, 0x0106, 0x - US_FL_SINGLE_LUN | US_FL_NOT_LOCKABLE | US_FL_NO_WP_DETECT ), - - /* This entry is needed because the device reports Sub=ff */ --UNUSUAL_DEV( 0x054c, 0x0010, 0x0500, 0x0500, -- "Sony", -- "DSC-T1", -- US_SC_8070, US_PR_DEVICE, NULL, -- US_FL_SINGLE_LUN ), -+UNUSUAL_DEV( 0x054c, 0x0010, 0x0500, 0x0600, -+ "Sony", -+ "DSC-T1/T5", -+ US_SC_8070, US_PR_DEVICE, NULL, -+ US_FL_SINGLE_LUN ), - - - /* Reported by wim@geeks.nl */ diff --git a/usb/usb-yealink-printk-warning-fix.patch b/usb/usb-yealink-printk-warning-fix.patch deleted file mode 100644 index 17702e2dfaa2e..0000000000000 --- a/usb/usb-yealink-printk-warning-fix.patch +++ /dev/null @@ -1,34 +0,0 @@ -From akpm@osdl.org Thu Jan 19 23:59:29 2006 -Message-Id: <200601200759.k0K7xQni020724@shell0.pdx.osdl.net> -From: Andrew Morton <akpm@osdl.org> -Subject: USB: yealink printk warning fix -To: greg@kroah.com -Cc: akpm@osdl.org -From: akpm@osdl.org -Date: Thu, 19 Jan 2006 23:59:12 -0800 - - -From: Andrew Morton <akpm@osdl.org> - -drivers/usb/input/yealink.c: In function `usb_probe': -drivers/usb/input/yealink.c:910: warning: int format, different type arg (arg 4) - - -Signed-off-by: Andrew Morton <akpm@osdl.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/input/yealink.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- gregkh-2.6.orig/drivers/usb/input/yealink.c -+++ gregkh-2.6/drivers/usb/input/yealink.c -@@ -907,7 +907,7 @@ static int usb_probe(struct usb_interfac - pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); - ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); - if (ret != USB_PKT_LEN) -- err("invalid payload size %d, expected %d", ret, USB_PKT_LEN); -+ err("invalid payload size %d, expected %zd", ret, USB_PKT_LEN); - - /* initialise irq urb */ - usb_fill_int_urb(yld->urb_irq, udev, pipe, yld->irq_data, diff --git a/usb/usb-yealink.c-cleanup-device-matching-code.patch b/usb/usb-yealink.c-cleanup-device-matching-code.patch deleted file mode 100644 index f2be9baf8e386..0000000000000 --- a/usb/usb-yealink.c-cleanup-device-matching-code.patch +++ /dev/null @@ -1,124 +0,0 @@ -From spam@god.dyndns.org Fri Dec 30 10:41:23 2005 -Date: Fri, 30 Dec 2005 19:41:11 +0100 -From: Henk <Henk.Vergonet@gmail.com> -To: gregkh@suse.de -Subject: USB: yealink.c: Cleanup device matching code -Message-ID: <20051230184111.GA4223@god.dyndns.org> -Content-Disposition: inline - -[PATCH] drivers/usb/input/yealink.c: Cleanup device matching code -This should fix things mentioned below: - - "I was curious why my firewall was loading a 'phone driver'. - It turns out that the probing in the yealink driver is - a little too assuming.. - - static struct usb_device_id usb_table [] = { - { USB_INTERFACE_INFO(USB_CLASS_HID, 0, 0) }, - { } - }; - - So it picked up my UPS, and loaded the driver. - Whilst no harm came, because it later checks the vendor/product IDs, - this driver should probably be rewritten to only probe - for the device IDs it actually knows about. - - Dave" - - -Signed-off-by: Henk Vergonet <henk.vergonet@gmail.com> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - - ---- - drivers/usb/input/yealink.c | 46 ++++++++++++++++++-------------------------- - 1 file changed, 19 insertions(+), 27 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/input/yealink.c -+++ gregkh-2.6/drivers/usb/input/yealink.c -@@ -59,7 +59,7 @@ - #include "map_to_7segment.h" - #include "yealink.h" - --#define DRIVER_VERSION "yld-20050816" -+#define DRIVER_VERSION "yld-20051230" - #define DRIVER_AUTHOR "Henk Vergonet" - #define DRIVER_DESC "Yealink phone driver" - -@@ -786,16 +786,25 @@ static struct attribute_group yld_attr_g - * Linux interface and usb initialisation - ******************************************************************************/ - --static const struct yld_device { -- u16 idVendor; -- u16 idProduct; -+struct driver_info { - char *name; --} yld_device[] = { -- { 0x6993, 0xb001, "Yealink usb-p1k" }, - }; - --static struct usb_device_id usb_table [] = { -- { USB_INTERFACE_INFO(USB_CLASS_HID, 0, 0) }, -+static const struct driver_info info_P1K = { -+ .name = "Yealink usb-p1k", -+}; -+ -+static const struct usb_device_id usb_table [] = { -+ { -+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | -+ USB_DEVICE_ID_MATCH_INT_INFO, -+ .idVendor = 0x6993, -+ .idProduct = 0xb001, -+ .bInterfaceClass = USB_CLASS_HID, -+ .bInterfaceSubClass = 0, -+ .bInterfaceProtocol = 0, -+ .driver_info = (kernel_ulong_t)&info_P1K -+ }, - { } - }; - -@@ -842,33 +851,16 @@ static void usb_disconnect(struct usb_in - usb_cleanup(yld, 0); - } - --static int usb_match(struct usb_device *udev) --{ -- int i; -- u16 idVendor = le16_to_cpu(udev->descriptor.idVendor); -- u16 idProduct = le16_to_cpu(udev->descriptor.idProduct); -- -- for (i = 0; i < ARRAY_SIZE(yld_device); i++) { -- if ((idVendor == yld_device[i].idVendor) && -- (idProduct == yld_device[i].idProduct)) -- return i; -- } -- return -ENODEV; --} -- - static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) - { - struct usb_device *udev = interface_to_usbdev (intf); -+ struct driver_info *nfo = (struct driver_info *)id->driver_info; - struct usb_host_interface *interface; - struct usb_endpoint_descriptor *endpoint; - struct yealink_dev *yld; - struct input_dev *input_dev; - int ret, pipe, i; - -- i = usb_match(udev); -- if (i < 0) -- return -ENODEV; -- - interface = intf->cur_altsetting; - endpoint = &interface->endpoint[0].desc; - if (!(endpoint->bEndpointAddress & USB_DIR_IN)) -@@ -948,7 +940,7 @@ static int usb_probe(struct usb_interfac - strlcat(yld->phys, "/input0", sizeof(yld->phys)); - - /* register settings for the input device */ -- input_dev->name = yld_device[i].name; -+ input_dev->name = nfo->name; - input_dev->phys = yld->phys; - usb_to_input_id(udev, &input_dev->id); - input_dev->cdev.dev = &intf->dev; diff --git a/usb/usbatm-add-flags-field.patch b/usb/usbatm-add-flags-field.patch deleted file mode 100644 index 3dee1bf337277..0000000000000 --- a/usb/usbatm-add-flags-field.patch +++ /dev/null @@ -1,171 +0,0 @@ -From baldrick@free.fr Tue Jan 17 02:16:16 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 02/13] USBATM: add flags field -Content-Disposition: inline -Date: Tue, 17 Jan 2006 11:16:13 +0100 -Message-Id: <200601171116.13805.baldrick@free.fr> - -Have minidrivers and the core signal special requirements -using a flags field in struct usbatm_data. For the moment -this is only used to replace the need_heavy_init bind -parameter, but there'll be new flags in later patches. - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/cxacru.c | 5 ++--- - drivers/usb/atm/speedtch.c | 9 ++++----- - drivers/usb/atm/ueagle-atm.c | 4 ++-- - drivers/usb/atm/usbatm.c | 6 ++---- - drivers/usb/atm/usbatm.h | 13 ++++++++----- - drivers/usb/atm/xusbatm.c | 3 +-- - 6 files changed, 19 insertions(+), 21 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/cxacru.c -+++ gregkh-2.6/drivers/usb/atm/cxacru.c -@@ -666,8 +666,7 @@ static int cxacru_heavy_init(struct usba - } - - static int cxacru_bind(struct usbatm_data *usbatm_instance, -- struct usb_interface *intf, const struct usb_device_id *id, -- int *need_heavy_init) -+ struct usb_interface *intf, const struct usb_device_id *id) - { - struct cxacru_data *instance; - struct usb_device *usb_dev = interface_to_usbdev(intf); -@@ -726,7 +725,7 @@ static int cxacru_bind(struct usbatm_dat - - usbatm_instance->driver_data = instance; - -- *need_heavy_init = cxacru_card_status(instance); -+ usbatm_instance->flags = (cxacru_card_status(instance) ? 0 : UDSL_SKIP_HEAVY_INIT); - - return 0; - ---- gregkh-2.6.orig/drivers/usb/atm/speedtch.c -+++ gregkh-2.6/drivers/usb/atm/speedtch.c -@@ -681,8 +681,7 @@ static void speedtch_release_interfaces( - - static int speedtch_bind(struct usbatm_data *usbatm, - struct usb_interface *intf, -- const struct usb_device_id *id, -- int *need_heavy_init) -+ const struct usb_device_id *id) - { - struct usb_device *usb_dev = interface_to_usbdev(intf); - struct usb_interface *cur_intf; -@@ -754,11 +753,11 @@ static int speedtch_bind(struct usbatm_d - 0x12, 0xc0, 0x07, 0x00, - instance->scratch_buffer + OFFSET_7, SIZE_7, 500); - -- *need_heavy_init = (ret != SIZE_7); -+ usbatm->flags = (ret == SIZE_7 ? UDSL_SKIP_HEAVY_INIT : 0); - -- usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, need_heavy_init ? "not" : "already"); -+ usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, usbatm->flags & UDSL_SKIP_HEAVY_INIT ? "already" : "not"); - -- if (*need_heavy_init) -+ if (!(usbatm->flags & UDSL_SKIP_HEAVY_INIT)) - if ((ret = usb_reset_device(usb_dev)) < 0) { - usb_err(usbatm, "%s: device reset failed (%d)!\n", __func__, ret); - goto fail_free; ---- gregkh-2.6.orig/drivers/usb/atm/ueagle-atm.c -+++ gregkh-2.6/drivers/usb/atm/ueagle-atm.c -@@ -1617,7 +1617,7 @@ static void create_fs_entries(struct uea - } - - static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, -- const struct usb_device_id *id, int *heavy) -+ const struct usb_device_id *id) - { - struct usb_device *usb = interface_to_usbdev(intf); - struct uea_softc *sc; -@@ -1629,7 +1629,7 @@ static int uea_bind(struct usbatm_data * - if (ifnum != UEA_INTR_IFACE_NO) - return -ENODEV; - -- *heavy = sync_wait[modem_index]; -+ usbatm_instance->flags = (sync_wait[modem_index] ? 0 : UDSL_SKIP_HEAVY_INIT); - - /* interface 1 is for outbound traffic */ - ret = claim_interface(usb, usbatm, UEA_US_IFACE_NO); ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.c -+++ gregkh-2.6/drivers/usb/atm/usbatm.c -@@ -969,7 +969,6 @@ int usbatm_usb_probe(struct usb_interfac - char *buf; - int error = -ENOMEM; - int i, length; -- int need_heavy; - - dev_dbg(dev, "%s: trying driver %s with vendor=%04x, product=%04x, ifnum %2d\n", - __func__, driver->driver_name, -@@ -1014,8 +1013,7 @@ int usbatm_usb_probe(struct usb_interfac - snprintf(buf, length, ")"); - - bind: -- need_heavy = 1; -- if (driver->bind && (error = driver->bind(instance, intf, id, &need_heavy)) < 0) { -+ if (driver->bind && (error = driver->bind(instance, intf, id)) < 0) { - dev_err(dev, "%s: bind failed: %d!\n", __func__, error); - goto fail_free; - } -@@ -1098,7 +1096,7 @@ int usbatm_usb_probe(struct usb_interfac - __func__, urb->transfer_buffer, urb->transfer_buffer_length, urb); - } - -- if (need_heavy && driver->heavy_init) { -+ if (!(instance->flags & UDSL_SKIP_HEAVY_INIT) && driver->heavy_init) { - error = usbatm_heavy_init(instance); - } else { - complete(&instance->thread_exited); /* pretend that heavy_init was run */ ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.h -+++ gregkh-2.6/drivers/usb/atm/usbatm.h -@@ -84,6 +84,11 @@ - #endif - - -+/* flags, set by mini-driver in bind() */ -+ -+#define UDSL_SKIP_HEAVY_INIT (1<<0) -+ -+ - /* mini driver */ - - struct usbatm_data; -@@ -99,12 +104,9 @@ struct usbatm_driver { - - const char *driver_name; - -- /* -- * init device ... can sleep, or cause probe() failure. Drivers with a heavy_init -- * method can avoid having it called by setting need_heavy_init to zero. -- */ -+ /* init device ... can sleep, or cause probe() failure */ - int (*bind) (struct usbatm_data *, struct usb_interface *, -- const struct usb_device_id *id, int *need_heavy_init); -+ const struct usb_device_id *id); - - /* additional device initialization that is too slow to be done in probe() */ - int (*heavy_init) (struct usbatm_data *, struct usb_interface *); -@@ -152,6 +154,7 @@ struct usbatm_data { - struct usbatm_driver *driver; - void *driver_data; - char driver_name[16]; -+ unsigned int flags; /* set by mini-driver in bind() */ - - /* USB device */ - struct usb_device *usb_dev; ---- gregkh-2.6.orig/drivers/usb/atm/xusbatm.c -+++ gregkh-2.6/drivers/usb/atm/xusbatm.c -@@ -62,8 +62,7 @@ static int usb_intf_has_ep(const struct - } - - static int xusbatm_bind(struct usbatm_data *usbatm, -- struct usb_interface *intf, const struct usb_device_id *id, -- int *need_heavy_init) -+ struct usb_interface *intf, const struct usb_device_id *id) - { - struct usb_device *usb_dev = interface_to_usbdev(intf); - int drv_ix = id - xusbatm_usb_ids; diff --git a/usb/usbatm-allow-isochronous-transfer.patch b/usb/usbatm-allow-isochronous-transfer.patch deleted file mode 100644 index 833829c13b9d2..0000000000000 --- a/usb/usbatm-allow-isochronous-transfer.patch +++ /dev/null @@ -1,341 +0,0 @@ -From baldrick@free.fr Fri Jan 13 01:59:23 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 10/13] USBATM: allow isochronous transfer -Date: Fri, 13 Jan 2006 10:59:23 +0100 -Message-Id: <200601131059.24275.baldrick@free.fr> - -While the usbatm core has had some support for using isoc urbs -for some time, there was no way for users to turn it on. While -use of isoc transfer should still be considered experimental, it -now works well enough to let users turn it on. Minidrivers signal -to the core that they want to use isoc transfer by setting the new -UDSL_USE_ISOC flag. The speedtch minidriver gets a new module -parameter enable_isoc (defaults to false), plus some logic that -checks for the existence of an isoc receive endpoint (not all -speedtouch modems have one). - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/cxacru.c | 4 +- - drivers/usb/atm/speedtch.c | 82 ++++++++++++++++++++++++++++++++++--------- - drivers/usb/atm/ueagle-atm.c | 4 +- - drivers/usb/atm/usbatm.c | 30 +++++++-------- - drivers/usb/atm/usbatm.h | 7 ++- - drivers/usb/atm/xusbatm.c | 4 +- - 6 files changed, 92 insertions(+), 39 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/cxacru.c -+++ gregkh-2.6/drivers/usb/atm/cxacru.c -@@ -836,8 +836,8 @@ static struct usbatm_driver cxacru_drive - .heavy_init = cxacru_heavy_init, - .unbind = cxacru_unbind, - .atm_start = cxacru_atm_start, -- .in = CXACRU_EP_DATA, -- .out = CXACRU_EP_DATA, -+ .bulk_in = CXACRU_EP_DATA, -+ .bulk_out = CXACRU_EP_DATA, - .rx_padding = 3, - .tx_padding = 11, - }; ---- gregkh-2.6.orig/drivers/usb/atm/speedtch.c -+++ gregkh-2.6/drivers/usb/atm/speedtch.c -@@ -35,6 +35,8 @@ - #include <linux/slab.h> - #include <linux/stat.h> - #include <linux/timer.h> -+#include <linux/types.h> -+#include <linux/usb_ch9.h> - #include <linux/workqueue.h> - - #include "usbatm.h" -@@ -66,24 +68,33 @@ static const char speedtch_driver_name[] - - #define RESUBMIT_DELAY 1000 /* milliseconds */ - --#define DEFAULT_ALTSETTING 1 -+#define DEFAULT_BULK_ALTSETTING 1 -+#define DEFAULT_ISOC_ALTSETTING 2 - #define DEFAULT_DL_512_FIRST 0 -+#define DEFAULT_ENABLE_ISOC 0 - #define DEFAULT_SW_BUFFERING 0 - --static int altsetting = DEFAULT_ALTSETTING; -+static unsigned int altsetting = 0; /* zero means: use the default */ - static int dl_512_first = DEFAULT_DL_512_FIRST; -+static int enable_isoc = DEFAULT_ENABLE_ISOC; - static int sw_buffering = DEFAULT_SW_BUFFERING; - --module_param(altsetting, int, S_IRUGO | S_IWUSR); -+module_param(altsetting, uint, S_IRUGO | S_IWUSR); - MODULE_PARM_DESC(altsetting, -- "Alternative setting for data interface (default: " -- __MODULE_STRING(DEFAULT_ALTSETTING) ")"); -+ "Alternative setting for data interface (bulk_default: " -+ __MODULE_STRING(DEFAULT_BULK_ALTSETTING) "; isoc_default: " -+ __MODULE_STRING(DEFAULT_ISOC_ALTSETTING) ")"); - - module_param(dl_512_first, bool, S_IRUGO | S_IWUSR); - MODULE_PARM_DESC(dl_512_first, - "Read 512 bytes before sending firmware (default: " - __MODULE_STRING(DEFAULT_DL_512_FIRST) ")"); - -+module_param(enable_isoc, bool, S_IRUGO | S_IWUSR); -+MODULE_PARM_DESC(enable_isoc, -+ "Use isochronous transfers if available (default: " -+ __MODULE_STRING(DEFAULT_ENABLE_ISOC) ")"); -+ - module_param(sw_buffering, bool, S_IRUGO | S_IWUSR); - MODULE_PARM_DESC(sw_buffering, - "Enable software buffering (default: " -@@ -91,7 +102,8 @@ MODULE_PARM_DESC(sw_buffering, - - #define INTERFACE_DATA 1 - #define ENDPOINT_INT 0x81 --#define ENDPOINT_DATA 0x07 -+#define ENDPOINT_BULK_DATA 0x07 -+#define ENDPOINT_ISOC_DATA 0x07 - #define ENDPOINT_FIRMWARE 0x05 - - #define hex2int(c) ( (c >= '0') && (c <= '9') ? (c - '0') : ((c & 0xf) + 9) ) -@@ -687,11 +699,12 @@ static int speedtch_bind(struct usbatm_d - const struct usb_device_id *id) - { - struct usb_device *usb_dev = interface_to_usbdev(intf); -- struct usb_interface *cur_intf; -+ struct usb_interface *cur_intf, *data_intf; - struct speedtch_instance_data *instance; - int ifnum = intf->altsetting->desc.bInterfaceNumber; - int num_interfaces = usb_dev->actconfig->desc.bNumInterfaces; - int i, ret; -+ int use_isoc; - - usb_dbg(usbatm, "%s entered\n", __func__); - -@@ -702,6 +715,11 @@ static int speedtch_bind(struct usbatm_d - return -ENODEV; - } - -+ if (!(data_intf = usb_ifnum_to_if(usb_dev, INTERFACE_DATA))) { -+ usb_err(usbatm, "%s: data interface not found!\n", __func__); -+ return -ENODEV; -+ } -+ - /* claim all interfaces */ - - for (i=0; i < num_interfaces; i++) { -@@ -728,8 +746,9 @@ static int speedtch_bind(struct usbatm_d - - instance->usbatm = usbatm; - -- /* altsetting may change at any moment, so take a snapshot */ -+ /* altsetting and enable_isoc may change at any moment, so take a snapshot */ - instance->altsetting = altsetting; -+ use_isoc = enable_isoc; - - if (instance->altsetting) - if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) { -@@ -737,14 +756,44 @@ static int speedtch_bind(struct usbatm_d - instance->altsetting = 0; /* fall back to default */ - } - -- if (!instance->altsetting) { -- if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_ALTSETTING)) < 0) { -- usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_ALTSETTING, ret); -- goto fail_free; -+ if (!instance->altsetting && use_isoc) -+ if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_ISOC_ALTSETTING)) < 0) { -+ usb_dbg(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_ISOC_ALTSETTING, ret); -+ use_isoc = 0; /* fall back to bulk */ - } -- instance->altsetting = DEFAULT_ALTSETTING; -+ -+ if (use_isoc) { -+ const struct usb_host_interface *desc = data_intf->cur_altsetting; -+ const __u8 target_address = USB_DIR_IN | usbatm->driver->isoc_in; -+ int i; -+ -+ use_isoc = 0; /* fall back to bulk if endpoint not found */ -+ -+ for (i=0; i<desc->desc.bNumEndpoints; i++) { -+ const struct usb_endpoint_descriptor *endpoint_desc = &desc->endpoint[i].desc; -+ -+ if ((endpoint_desc->bEndpointAddress == target_address)) { -+ use_isoc = (endpoint_desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == -+ USB_ENDPOINT_XFER_ISOC; -+ break; -+ } -+ } -+ -+ if (!use_isoc) -+ usb_info(usbatm, "isochronous transfer not supported - using bulk\n"); - } - -+ if (!use_isoc && !instance->altsetting) -+ if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_BULK_ALTSETTING)) < 0) { -+ usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_BULK_ALTSETTING, ret); -+ goto fail_free; -+ } -+ -+ if (!instance->altsetting) -+ instance->altsetting = use_isoc ? DEFAULT_ISOC_ALTSETTING : DEFAULT_BULK_ALTSETTING; -+ -+ usbatm->flags |= (use_isoc ? UDSL_USE_ISOC : 0); -+ - INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance); - - instance->status_checker.timer.function = speedtch_status_poll; -@@ -771,7 +820,7 @@ static int speedtch_bind(struct usbatm_d - 0x12, 0xc0, 0x07, 0x00, - instance->scratch_buffer + OFFSET_7, SIZE_7, 500); - -- usbatm->flags = (ret == SIZE_7 ? UDSL_SKIP_HEAVY_INIT : 0); -+ usbatm->flags |= (ret == SIZE_7 ? UDSL_SKIP_HEAVY_INIT : 0); - - usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, usbatm->flags & UDSL_SKIP_HEAVY_INIT ? "already" : "not"); - -@@ -817,8 +866,9 @@ static struct usbatm_driver speedtch_usb - .unbind = speedtch_unbind, - .atm_start = speedtch_atm_start, - .atm_stop = speedtch_atm_stop, -- .in = ENDPOINT_DATA, -- .out = ENDPOINT_DATA -+ .bulk_in = ENDPOINT_BULK_DATA, -+ .bulk_out = ENDPOINT_BULK_DATA, -+ .isoc_in = ENDPOINT_ISOC_DATA - }; - - static int speedtch_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) ---- gregkh-2.6.orig/drivers/usb/atm/ueagle-atm.c -+++ gregkh-2.6/drivers/usb/atm/ueagle-atm.c -@@ -1705,8 +1705,8 @@ static struct usbatm_driver uea_usbatm_d - .atm_start = uea_atm_open, - .unbind = uea_unbind, - .heavy_init = uea_heavy, -- .in = UEA_BULK_DATA_PIPE, -- .out = UEA_BULK_DATA_PIPE, -+ .bulk_in = UEA_BULK_DATA_PIPE, -+ .bulk_out = UEA_BULK_DATA_PIPE, - }; - - static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id) ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.c -+++ gregkh-2.6/drivers/usb/atm/usbatm.c -@@ -1049,17 +1049,23 @@ int usbatm_usb_probe(struct usb_interfac - init_completion(&instance->thread_exited); - - INIT_LIST_HEAD(&instance->vcc_list); -+ skb_queue_head_init(&instance->sndqueue); - - usbatm_init_channel(&instance->rx_channel); - usbatm_init_channel(&instance->tx_channel); - tasklet_init(&instance->rx_channel.tasklet, usbatm_rx_process, (unsigned long)instance); - tasklet_init(&instance->tx_channel.tasklet, usbatm_tx_process, (unsigned long)instance); -- instance->rx_channel.endpoint = usb_rcvbulkpipe(usb_dev, driver->in); -- instance->tx_channel.endpoint = usb_sndbulkpipe(usb_dev, driver->out); - instance->rx_channel.stride = ATM_CELL_SIZE + driver->rx_padding; - instance->tx_channel.stride = ATM_CELL_SIZE + driver->tx_padding; - instance->rx_channel.usbatm = instance->tx_channel.usbatm = instance; - -+ if ((instance->flags & UDSL_USE_ISOC) && driver->isoc_in) -+ instance->rx_channel.endpoint = usb_rcvisocpipe(usb_dev, driver->isoc_in); -+ else -+ instance->rx_channel.endpoint = usb_rcvbulkpipe(usb_dev, driver->bulk_in); -+ -+ instance->tx_channel.endpoint = usb_sndbulkpipe(usb_dev, driver->bulk_out); -+ - /* tx buffer size must be a positive multiple of the stride */ - instance->tx_channel.buf_size = max (instance->tx_channel.stride, - snd_buf_bytes - (snd_buf_bytes % instance->tx_channel.stride)); -@@ -1080,6 +1086,7 @@ int usbatm_usb_probe(struct usb_interfac - num_packets--; - - instance->rx_channel.buf_size = num_packets * maxpacket; -+ instance->rx_channel.packet_size = maxpacket; - - #ifdef DEBUG - for (i = 0; i < 2; i++) { -@@ -1090,22 +1097,16 @@ int usbatm_usb_probe(struct usb_interfac - } - #endif - -- skb_queue_head_init(&instance->sndqueue); -+ /* initialize urbs */ - - for (i = 0; i < num_rcv_urbs + num_snd_urbs; i++) { -- struct urb *urb; - u8 *buffer; -- unsigned int iso_packets = 0, iso_size = 0; - struct usbatm_channel *channel = i < num_rcv_urbs ? - &instance->rx_channel : &instance->tx_channel; -+ struct urb *urb; -+ unsigned int iso_packets = usb_pipeisoc(channel->endpoint) ? channel->buf_size / channel->packet_size : 0; - -- if (usb_pipeisoc(channel->endpoint)) { -- /* don't expect iso out endpoints */ -- iso_size = usb_maxpacket(instance->usb_dev, channel->endpoint, 0); -- iso_size -= iso_size % channel->stride; /* alignment */ -- BUG_ON(!iso_size); -- iso_packets = (channel->buf_size - 1) / iso_size + 1; -- } -+ UDSL_ASSERT(!usb_pipeisoc(channel->endpoint) || usb_pipein(channel->endpoint)); - - urb = usb_alloc_urb(iso_packets, GFP_KERNEL); - if (!urb) { -@@ -1132,9 +1133,8 @@ int usbatm_usb_probe(struct usb_interfac - urb->transfer_flags = URB_ISO_ASAP; - urb->number_of_packets = iso_packets; - for (j = 0; j < iso_packets; j++) { -- urb->iso_frame_desc[j].offset = iso_size * j; -- urb->iso_frame_desc[j].length = min_t(int, iso_size, -- channel->buf_size - urb->iso_frame_desc[j].offset); -+ urb->iso_frame_desc[j].offset = channel->packet_size * j; -+ urb->iso_frame_desc[j].length = channel->packet_size; - } - } - ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.h -+++ gregkh-2.6/drivers/usb/atm/usbatm.h -@@ -87,6 +87,7 @@ - /* flags, set by mini-driver in bind() */ - - #define UDSL_SKIP_HEAVY_INIT (1<<0) -+#define UDSL_USE_ISOC (1<<1) - - - /* mini driver */ -@@ -118,8 +119,9 @@ struct usbatm_driver { - /* cleanup ATM device ... can sleep, but can't fail */ - void (*atm_stop) (struct usbatm_data *, struct atm_dev *); - -- int in; /* rx endpoint */ -- int out; /* tx endpoint */ -+ int bulk_in; /* bulk rx endpoint */ -+ int isoc_in; /* isochronous rx endpoint */ -+ int bulk_out; /* bulk tx endpoint */ - - unsigned rx_padding; - unsigned tx_padding; -@@ -134,6 +136,7 @@ struct usbatm_channel { - int endpoint; /* usb pipe */ - unsigned int stride; /* ATM cell size + padding */ - unsigned int buf_size; /* urb buffer size */ -+ unsigned int packet_size; /* endpoint maxpacket */ - spinlock_t lock; - struct list_head list; - struct tasklet_struct tasklet; ---- gregkh-2.6.orig/drivers/usb/atm/xusbatm.c -+++ gregkh-2.6/drivers/usb/atm/xusbatm.c -@@ -210,8 +210,8 @@ static int __init xusbatm_init(void) - xusbatm_drivers[i].bind = xusbatm_bind; - xusbatm_drivers[i].unbind = xusbatm_unbind; - xusbatm_drivers[i].atm_start = xusbatm_atm_start; -- xusbatm_drivers[i].in = rx_endpoint[i]; -- xusbatm_drivers[i].out = tx_endpoint[i]; -+ xusbatm_drivers[i].bulk_in = rx_endpoint[i]; -+ xusbatm_drivers[i].bulk_out = tx_endpoint[i]; - xusbatm_drivers[i].rx_padding = rx_padding[i]; - xusbatm_drivers[i].tx_padding = tx_padding[i]; - } diff --git a/usb/usbatm-bump-version-numbers.patch b/usb/usbatm-bump-version-numbers.patch deleted file mode 100644 index be4379a8570b8..0000000000000 --- a/usb/usbatm-bump-version-numbers.patch +++ /dev/null @@ -1,37 +0,0 @@ -From baldrick@free.fr Fri Jan 13 02:08:14 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 12/13] USBATM: bump version numbers -Date: Fri, 13 Jan 2006 11:08:05 +0100 -Message-Id: <200601131108.06255.baldrick@free.fr> - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/speedtch.c | 2 +- - drivers/usb/atm/usbatm.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/speedtch.c -+++ gregkh-2.6/drivers/usb/atm/speedtch.c -@@ -42,7 +42,7 @@ - #include "usbatm.h" - - #define DRIVER_AUTHOR "Johan Verrept, Duncan Sands <duncan.sands@free.fr>" --#define DRIVER_VERSION "1.9" -+#define DRIVER_VERSION "1.10" - #define DRIVER_DESC "Alcatel SpeedTouch USB driver version " DRIVER_VERSION - - static const char speedtch_driver_name[] = "speedtch"; ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.c -+++ gregkh-2.6/drivers/usb/atm/usbatm.c -@@ -92,7 +92,7 @@ static int usbatm_print_packet(const uns - #endif - - #define DRIVER_AUTHOR "Johan Verrept, Duncan Sands <duncan.sands@free.fr>" --#define DRIVER_VERSION "1.9" -+#define DRIVER_VERSION "1.10" - #define DRIVER_DESC "Generic USB ATM/DSL I/O, version " DRIVER_VERSION - - static const char usbatm_driver_name[] = "usbatm"; diff --git a/usb/usbatm-eilseq-workaround.patch b/usb/usbatm-eilseq-workaround.patch deleted file mode 100644 index caad2738b9502..0000000000000 --- a/usb/usbatm-eilseq-workaround.patch +++ /dev/null @@ -1,44 +0,0 @@ -From baldrick@free.fr Fri Jan 13 02:13:02 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 13/13] USBATM: -EILSEQ workaround -Date: Fri, 13 Jan 2006 11:12:58 +0100 -Message-Id: <200601131112.59414.baldrick@free.fr> - -Don't throttle on -EILSEQ urb status if requested by a minidriver. -It seems the ueagle modems are buggy, giving -EILSEQ when they -have no data to send. The ueagle change will be sent separately -by the ueagle guys. Patch by Matthieu Castet. - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/usbatm.c | 5 ++++- - drivers/usb/atm/usbatm.h | 1 + - 2 files changed, 5 insertions(+), 1 deletion(-) - ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.c -+++ gregkh-2.6/drivers/usb/atm/usbatm.c -@@ -270,7 +270,10 @@ static void usbatm_complete(struct urb * - - spin_unlock_irqrestore(&channel->lock, flags); - -- if (unlikely(urb->status)) { -+ if (unlikely(urb->status) && -+ (!(channel->usbatm->flags & UDSL_IGNORE_EILSEQ) || -+ urb->status != -EILSEQ )) -+ { - if (printk_ratelimit()) - atm_warn(channel->usbatm, "%s: urb 0x%p failed (%d)!\n", - __func__, urb, urb->status); ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.h -+++ gregkh-2.6/drivers/usb/atm/usbatm.h -@@ -88,6 +88,7 @@ - - #define UDSL_SKIP_HEAVY_INIT (1<<0) - #define UDSL_USE_ISOC (1<<1) -+#define UDSL_IGNORE_EILSEQ (1<<2) - - - /* mini driver */ diff --git a/usb/usbatm-handle-urbs-containing-partial-cells.patch b/usb/usbatm-handle-urbs-containing-partial-cells.patch deleted file mode 100644 index f9dbeea887820..0000000000000 --- a/usb/usbatm-handle-urbs-containing-partial-cells.patch +++ /dev/null @@ -1,394 +0,0 @@ -From baldrick@free.fr Fri Jan 13 02:06:55 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 11/13] USBATM: handle urbs containing partial cells -Date: Fri, 13 Jan 2006 11:06:46 +0100 -Message-Id: <200601131106.47262.baldrick@free.fr> - -The receive logic has always assumed that urbs contain an integral -number of ATM cells, which is a bit naughty, though it never caused -any problems with bulk transfers. Isochronous urbs spank us soundly -for this. Fixed thanks to this patch, mostly by Stanislaw Gruszka. - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/usbatm.c | 275 ++++++++++++++++++++++++++++++----------------- - drivers/usb/atm/usbatm.h | 7 + - 2 files changed, 184 insertions(+), 98 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.c -+++ gregkh-2.6/drivers/usb/atm/usbatm.c -@@ -296,126 +296,159 @@ static inline struct usbatm_vcc_data *us - return NULL; - } - --static void usbatm_extract_cells(struct usbatm_data *instance, -- unsigned char *source, unsigned int avail_data) -+static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char *source) - { -- struct usbatm_vcc_data *cached_vcc = NULL; - struct atm_vcc *vcc; - struct sk_buff *sarb; -- unsigned int stride = instance->rx_channel.stride; -- int vci, cached_vci = 0; -- short vpi, cached_vpi = 0; -- u8 pti; -+ short vpi = ((source[0] & 0x0f) << 4) | (source[1] >> 4); -+ int vci = ((source[1] & 0x0f) << 12) | (source[2] << 4) | (source[3] >> 4); -+ u8 pti = ((source[3] & 0xe) >> 1); - -- for (; avail_data >= stride; avail_data -= stride, source += stride) { -- vpi = ((source[0] & 0x0f) << 4) | (source[1] >> 4); -- vci = ((source[1] & 0x0f) << 12) | (source[2] << 4) | (source[3] >> 4); -- pti = ((source[3] & 0xe) >> 1); -+ vdbg("%s: vpi %hd, vci %d, pti %d", __func__, vpi, vci, pti); - -- vdbg("%s: vpi %hd, vci %d, pti %d", __func__, vpi, vci, pti); -+ if ((vci != instance->cached_vci) || (vpi != instance->cached_vpi)) { -+ instance->cached_vpi = vpi; -+ instance->cached_vci = vci; - -- if ((vci != cached_vci) || (vpi != cached_vpi)) { -- cached_vpi = vpi; -- cached_vci = vci; -+ instance->cached_vcc = usbatm_find_vcc(instance, vpi, vci); - -- cached_vcc = usbatm_find_vcc(instance, vpi, vci); -+ if (!instance->cached_vcc) -+ atm_rldbg(instance, "%s: unknown vpi/vci (%hd/%d)!\n", __func__, vpi, vci); -+ } - -- if (!cached_vcc) -- atm_rldbg(instance, "%s: unknown vpi/vci (%hd/%d)!\n", __func__, vpi, vci); -- } -+ if (!instance->cached_vcc) -+ return; - -- if (!cached_vcc) -- continue; -+ vcc = instance->cached_vcc->vcc; - -- vcc = cached_vcc->vcc; -+ /* OAM F5 end-to-end */ -+ if (pti == ATM_PTI_E2EF5) { -+ if (printk_ratelimit()) -+ atm_warn(instance, "%s: OAM not supported (vpi %d, vci %d)!\n", -+ __func__, vpi, vci); -+ atomic_inc(&vcc->stats->rx_err); -+ return; -+ } - -- /* OAM F5 end-to-end */ -- if (pti == ATM_PTI_E2EF5) { -- if (printk_ratelimit()) -- atm_warn(instance, "%s: OAM not supported (vpi %d, vci %d)!\n", -- __func__, vpi, vci); -+ sarb = instance->cached_vcc->sarb; -+ -+ if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) { -+ atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", -+ __func__, sarb->len, vcc); -+ /* discard cells already received */ -+ skb_trim(sarb, 0); -+ UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end); -+ } -+ -+ memcpy(sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); -+ __skb_put(sarb, ATM_CELL_PAYLOAD); -+ -+ if (pti & 1) { -+ struct sk_buff *skb; -+ unsigned int length; -+ unsigned int pdu_length; -+ -+ length = (source[ATM_CELL_SIZE - 6] << 8) + source[ATM_CELL_SIZE - 5]; -+ -+ /* guard against overflow */ -+ if (length > ATM_MAX_AAL5_PDU) { -+ atm_rldbg(instance, "%s: bogus length %u (vcc: 0x%p)!\n", -+ __func__, length, vcc); - atomic_inc(&vcc->stats->rx_err); -- continue; -+ goto out; - } - -- sarb = cached_vcc->sarb; -+ pdu_length = usbatm_pdu_length(length); - -- if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) { -- atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", -- __func__, sarb->len, vcc); -- /* discard cells already received */ -- skb_trim(sarb, 0); -- UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end); -- } -- -- memcpy(sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); -- __skb_put(sarb, ATM_CELL_PAYLOAD); -- -- if (pti & 1) { -- struct sk_buff *skb; -- unsigned int length; -- unsigned int pdu_length; -- -- length = (source[ATM_CELL_SIZE - 6] << 8) + source[ATM_CELL_SIZE - 5]; -- -- /* guard against overflow */ -- if (length > ATM_MAX_AAL5_PDU) { -- atm_rldbg(instance, "%s: bogus length %u (vcc: 0x%p)!\n", -- __func__, length, vcc); -- atomic_inc(&vcc->stats->rx_err); -- goto out; -- } -+ if (sarb->len < pdu_length) { -+ atm_rldbg(instance, "%s: bogus pdu_length %u (sarb->len: %u, vcc: 0x%p)!\n", -+ __func__, pdu_length, sarb->len, vcc); -+ atomic_inc(&vcc->stats->rx_err); -+ goto out; -+ } - -- pdu_length = usbatm_pdu_length(length); -+ if (crc32_be(~0, sarb->tail - pdu_length, pdu_length) != 0xc704dd7b) { -+ atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", -+ __func__, vcc); -+ atomic_inc(&vcc->stats->rx_err); -+ goto out; -+ } - -- if (sarb->len < pdu_length) { -- atm_rldbg(instance, "%s: bogus pdu_length %u (sarb->len: %u, vcc: 0x%p)!\n", -- __func__, pdu_length, sarb->len, vcc); -- atomic_inc(&vcc->stats->rx_err); -- goto out; -- } -+ vdbg("%s: got packet (length: %u, pdu_length: %u, vcc: 0x%p)", __func__, length, pdu_length, vcc); - -- if (crc32_be(~0, sarb->tail - pdu_length, pdu_length) != 0xc704dd7b) { -- atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", -- __func__, vcc); -- atomic_inc(&vcc->stats->rx_err); -- goto out; -- } -+ if (!(skb = dev_alloc_skb(length))) { -+ if (printk_ratelimit()) -+ atm_err(instance, "%s: no memory for skb (length: %u)!\n", -+ __func__, length); -+ atomic_inc(&vcc->stats->rx_drop); -+ goto out; -+ } - -- vdbg("%s: got packet (length: %u, pdu_length: %u, vcc: 0x%p)", __func__, length, pdu_length, vcc); -+ vdbg("%s: allocated new sk_buff (skb: 0x%p, skb->truesize: %u)", __func__, skb, skb->truesize); - -- if (!(skb = dev_alloc_skb(length))) { -- if (printk_ratelimit()) -- atm_err(instance, "%s: no memory for skb (length: %u)!\n", -- __func__, length); -- atomic_inc(&vcc->stats->rx_drop); -- goto out; -- } -+ if (!atm_charge(vcc, skb->truesize)) { -+ atm_rldbg(instance, "%s: failed atm_charge (skb->truesize: %u)!\n", -+ __func__, skb->truesize); -+ dev_kfree_skb_any(skb); -+ goto out; /* atm_charge increments rx_drop */ -+ } - -- vdbg("%s: allocated new sk_buff (skb: 0x%p, skb->truesize: %u)", __func__, skb, skb->truesize); -+ memcpy(skb->data, sarb->tail - pdu_length, length); -+ __skb_put(skb, length); - -- if (!atm_charge(vcc, skb->truesize)) { -- atm_rldbg(instance, "%s: failed atm_charge (skb->truesize: %u)!\n", -- __func__, skb->truesize); -- dev_kfree_skb_any(skb); -- goto out; /* atm_charge increments rx_drop */ -- } -+ vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", -+ __func__, skb, skb->len, skb->truesize); - -- memcpy(skb->data, sarb->tail - pdu_length, length); -- __skb_put(skb, length); -+ PACKETDEBUG(skb->data, skb->len); - -- vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", -- __func__, skb, skb->len, skb->truesize); -+ vcc->push(vcc, skb); - -- PACKETDEBUG(skb->data, skb->len); -+ atomic_inc(&vcc->stats->rx); -+ out: -+ skb_trim(sarb, 0); -+ } -+} - -- vcc->push(vcc, skb); -+static void usbatm_extract_cells(struct usbatm_data *instance, -+ unsigned char *source, unsigned int avail_data) -+{ -+ unsigned int stride = instance->rx_channel.stride; -+ unsigned int buf_usage = instance->buf_usage; - -- atomic_inc(&vcc->stats->rx); -- out: -- skb_trim(sarb, 0); -+ /* extract cells from incoming data, taking into account that -+ * the length of avail data may not be a multiple of stride */ -+ -+ if (buf_usage > 0) { -+ /* we have a partially received atm cell */ -+ unsigned char *cell_buf = instance->cell_buf; -+ unsigned int space_left = stride - buf_usage; -+ -+ UDSL_ASSERT(buf_usage <= stride); -+ -+ if (avail_data >= space_left) { -+ /* add new data and process cell */ -+ memcpy(cell_buf + buf_usage, source, space_left); -+ source += space_left; -+ avail_data -= space_left; -+ usbatm_extract_one_cell(instance, cell_buf); -+ instance->buf_usage = 0; -+ } else { -+ /* not enough data to fill the cell */ -+ memcpy(cell_buf + buf_usage, source, avail_data); -+ instance->buf_usage = buf_usage + avail_data; -+ return; - } - } -+ -+ for (; avail_data >= stride; avail_data -= stride, source += stride) -+ usbatm_extract_one_cell(instance, source); -+ -+ if (avail_data > 0) { -+ /* length was not a multiple of stride - -+ * save remaining data for next call */ -+ memcpy(instance->cell_buf, source, avail_data); -+ instance->buf_usage = avail_data; -+ } - } - - -@@ -496,16 +529,40 @@ static void usbatm_rx_process(unsigned l - vdbg("%s: processing urb 0x%p", __func__, urb); - - if (usb_pipeisoc(urb->pipe)) { -+ unsigned char *merge_start = NULL; -+ unsigned int merge_length = 0; -+ const unsigned int packet_size = instance->rx_channel.packet_size; - int i; -- for (i = 0; i < urb->number_of_packets; i++) -- if (!urb->iso_frame_desc[i].status) -- usbatm_extract_cells(instance, -- (u8 *)urb->transfer_buffer + urb->iso_frame_desc[i].offset, -- urb->iso_frame_desc[i].actual_length); -- } -- else -+ -+ for (i = 0; i < urb->number_of_packets; i++) { -+ if (!urb->iso_frame_desc[i].status) { -+ unsigned int actual_length = urb->iso_frame_desc[i].actual_length; -+ -+ UDSL_ASSERT(actual_length <= packet_size); -+ -+ if (!merge_length) -+ merge_start = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset; -+ merge_length += actual_length; -+ if (merge_length && (actual_length < packet_size)) { -+ usbatm_extract_cells(instance, merge_start, merge_length); -+ merge_length = 0; -+ } -+ } else { -+ atm_rldbg(instance, "%s: status %d in frame %d!\n", __func__, urb->status, i); -+ if (merge_length) -+ usbatm_extract_cells(instance, merge_start, merge_length); -+ merge_length = 0; -+ instance->buf_usage = 0; -+ } -+ } -+ -+ if (merge_length) -+ usbatm_extract_cells(instance, merge_start, merge_length); -+ } else - if (!urb->status) - usbatm_extract_cells(instance, urb->transfer_buffer, urb->actual_length); -+ else -+ instance->buf_usage = 0; - - if (usbatm_submit_urb(urb)) - return; -@@ -797,6 +854,9 @@ static int usbatm_atm_open(struct atm_vc - vcc->dev_data = new; - - tasklet_disable(&instance->rx_channel.tasklet); -+ instance->cached_vcc = new; -+ instance->cached_vpi = vpi; -+ instance->cached_vci = vci; - list_add(&new->list, &instance->vcc_list); - tasklet_enable(&instance->rx_channel.tasklet); - -@@ -836,6 +896,11 @@ static void usbatm_atm_close(struct atm_ - down(&instance->serialize); /* vs self, usbatm_atm_open, usbatm_usb_disconnect */ - - tasklet_disable(&instance->rx_channel.tasklet); -+ if (instance->cached_vcc == vcc_data) { -+ instance->cached_vcc = NULL; -+ instance->cached_vpi = ATM_VPI_UNSPEC; -+ instance->cached_vci = ATM_VCI_UNSPEC; -+ } - list_del(&vcc_data->list); - tasklet_enable(&instance->rx_channel.tasklet); - -@@ -1146,6 +1211,16 @@ int usbatm_usb_probe(struct usb_interfac - __func__, urb->transfer_buffer, urb->transfer_buffer_length, urb); - } - -+ instance->cached_vpi = ATM_VPI_UNSPEC; -+ instance->cached_vci = ATM_VCI_UNSPEC; -+ instance->cell_buf = kmalloc(instance->rx_channel.stride, GFP_KERNEL); -+ -+ if (!instance->cell_buf) { -+ dev_err(dev, "%s: no memory for cell buffer!\n", __func__); -+ error = -ENOMEM; -+ goto fail_unbind; -+ } -+ - if (!(instance->flags & UDSL_SKIP_HEAVY_INIT) && driver->heavy_init) { - error = usbatm_heavy_init(instance); - } else { -@@ -1165,6 +1240,8 @@ int usbatm_usb_probe(struct usb_interfac - if (instance->driver->unbind) - instance->driver->unbind(instance, intf); - fail_free: -+ kfree(instance->cell_buf); -+ - for (i = 0; i < num_rcv_urbs + num_snd_urbs; i++) { - if (instance->urbs[i]) - kfree(instance->urbs[i]->transfer_buffer); -@@ -1236,6 +1313,8 @@ void usbatm_usb_disconnect(struct usb_in - usb_free_urb(instance->urbs[i]); - } - -+ kfree(instance->cell_buf); -+ - /* ATM finalize */ - if (instance->atm_dev) - atm_dev_deregister(instance->atm_dev); ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.h -+++ gregkh-2.6/drivers/usb/atm/usbatm.h -@@ -187,6 +187,13 @@ struct usbatm_data { - struct sk_buff_head sndqueue; - struct sk_buff *current_skb; /* being emptied */ - -+ struct usbatm_vcc_data *cached_vcc; -+ int cached_vci; -+ short cached_vpi; -+ -+ unsigned char *cell_buf; /* holds partial rx cell */ -+ unsigned int buf_usage; -+ - struct urb *urbs[0]; - }; - diff --git a/usb/usbatm-kzalloc-conversion.patch b/usb/usbatm-kzalloc-conversion.patch deleted file mode 100644 index f59b73331dd01..0000000000000 --- a/usb/usbatm-kzalloc-conversion.patch +++ /dev/null @@ -1,89 +0,0 @@ -From baldrick@free.fr Fri Jan 13 00:38:21 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 04/13] USBATM: kzalloc conversion -Date: Fri, 13 Jan 2006 09:38:22 +0100 -Message-Id: <200601130938.22715.baldrick@free.fr> - -Convert kmalloc + memset to kzalloc. - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/cxacru.c | 4 +--- - drivers/usb/atm/speedtch.c | 4 +--- - drivers/usb/atm/usbatm.c | 8 +++----- - 3 files changed, 5 insertions(+), 11 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/cxacru.c -+++ gregkh-2.6/drivers/usb/atm/cxacru.c -@@ -673,14 +673,12 @@ static int cxacru_bind(struct usbatm_dat - int ret; - - /* instance init */ -- instance = kmalloc(sizeof(*instance), GFP_KERNEL); -+ instance = kzalloc(sizeof(*instance), GFP_KERNEL); - if (!instance) { - dbg("cxacru_bind: no memory for instance data"); - return -ENOMEM; - } - -- memset(instance, 0, sizeof(*instance)); -- - instance->usbatm = usbatm_instance; - instance->modem_type = (struct cxacru_modem_type *) id->driver_info; - ---- gregkh-2.6.orig/drivers/usb/atm/speedtch.c -+++ gregkh-2.6/drivers/usb/atm/speedtch.c -@@ -715,7 +715,7 @@ static int speedtch_bind(struct usbatm_d - } - } - -- instance = kmalloc(sizeof(*instance), GFP_KERNEL); -+ instance = kzalloc(sizeof(*instance), GFP_KERNEL); - - if (!instance) { - usb_err(usbatm, "%s: no memory for instance data!\n", __func__); -@@ -723,8 +723,6 @@ static int speedtch_bind(struct usbatm_d - goto fail_release; - } - -- memset(instance, 0, sizeof(struct speedtch_instance_data)); -- - instance->usbatm = usbatm; - - INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance); ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.c -+++ gregkh-2.6/drivers/usb/atm/usbatm.c -@@ -763,13 +763,12 @@ static int usbatm_atm_open(struct atm_vc - goto fail; - } - -- if (!(new = kmalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) { -+ if (!(new = kzalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) { - atm_err(instance, "%s: no memory for vcc_data!\n", __func__); - ret = -ENOMEM; - goto fail; - } - -- memset(new, 0, sizeof(struct usbatm_vcc_data)); - new->vcc = vcc; - new->vpi = vpi; - new->vci = vci; -@@ -1066,13 +1065,12 @@ int usbatm_usb_probe(struct usb_interfac - - instance->urbs[i] = urb; - -- buffer = kmalloc(channel->buf_size, GFP_KERNEL); -+ /* zero the tx padding to avoid leaking information */ -+ buffer = kzalloc(channel->buf_size, GFP_KERNEL); - if (!buffer) { - dev_err(dev, "%s: no memory for buffer %d!\n", __func__, i); - goto fail_unbind; - } -- /* zero the tx padding to avoid leaking information */ -- memset(buffer, 0, channel->buf_size); - - usb_fill_bulk_urb(urb, instance->usb_dev, channel->endpoint, - buffer, channel->buf_size, usbatm_complete, channel); diff --git a/usb/usbatm-measure-buffer-size-in-bytes-force-valid-sizes.patch b/usb/usbatm-measure-buffer-size-in-bytes-force-valid-sizes.patch deleted file mode 100644 index 98ca54b834a32..0000000000000 --- a/usb/usbatm-measure-buffer-size-in-bytes-force-valid-sizes.patch +++ /dev/null @@ -1,280 +0,0 @@ -From baldrick@free.fr Fri Jan 13 01:52:41 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 09/13] USBATM: measure buffer size in bytes; force valid sizes -Date: Fri, 13 Jan 2006 10:52:38 +0100 -Message-Id: <200601131052.39257.baldrick@free.fr> - -Change the module parameters rcv_buf_size and snd_buf_size to -specify buffer sizes in bytes rather than ATM cells. Since -there is some danger that users may not notice this change, -the parameters are renamed to rcv_buf_bytes etc. The transmit -buffer needs to be a multiple of the ATM cell size in length, -while the receive buffer should be a multiple of the endpoint -maxpacket size (this wasn't enforced before, which causes trouble -with isochronous transfers), so enforce these restrictions. Now -that the usbatm probe method inspects the endpoint maxpacket size, -minidriver bind routines need to set the correct alternate setting -for the interface in their bind routine. This is the reason for -the speedtch changes. - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/speedtch.c | 30 ++++++++++++--- - drivers/usb/atm/usbatm.c | 90 +++++++++++++++++++++++++++++---------------- - 2 files changed, 84 insertions(+), 36 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.c -+++ gregkh-2.6/drivers/usb/atm/usbatm.c -@@ -99,12 +99,11 @@ static const char usbatm_driver_name[] = - - #define UDSL_MAX_RCV_URBS 16 - #define UDSL_MAX_SND_URBS 16 --#define UDSL_MAX_RCV_BUF_SIZE 1024 /* ATM cells */ --#define UDSL_MAX_SND_BUF_SIZE 1024 /* ATM cells */ -+#define UDSL_MAX_BUF_SIZE 64 * 1024 /* bytes */ - #define UDSL_DEFAULT_RCV_URBS 4 - #define UDSL_DEFAULT_SND_URBS 4 --#define UDSL_DEFAULT_RCV_BUF_SIZE 64 /* ATM cells */ --#define UDSL_DEFAULT_SND_BUF_SIZE 64 /* ATM cells */ -+#define UDSL_DEFAULT_RCV_BUF_SIZE 64 * ATM_CELL_SIZE /* bytes */ -+#define UDSL_DEFAULT_SND_BUF_SIZE 64 * ATM_CELL_SIZE /* bytes */ - - #define ATM_CELL_HEADER (ATM_CELL_SIZE - ATM_CELL_PAYLOAD) - -@@ -112,8 +111,8 @@ static const char usbatm_driver_name[] = - - static unsigned int num_rcv_urbs = UDSL_DEFAULT_RCV_URBS; - static unsigned int num_snd_urbs = UDSL_DEFAULT_SND_URBS; --static unsigned int rcv_buf_size = UDSL_DEFAULT_RCV_BUF_SIZE; --static unsigned int snd_buf_size = UDSL_DEFAULT_SND_BUF_SIZE; -+static unsigned int rcv_buf_bytes = UDSL_DEFAULT_RCV_BUF_SIZE; -+static unsigned int snd_buf_bytes = UDSL_DEFAULT_SND_BUF_SIZE; - - module_param(num_rcv_urbs, uint, S_IRUGO); - MODULE_PARM_DESC(num_rcv_urbs, -@@ -127,15 +126,15 @@ MODULE_PARM_DESC(num_snd_urbs, - __MODULE_STRING(UDSL_MAX_SND_URBS) ", default: " - __MODULE_STRING(UDSL_DEFAULT_SND_URBS) ")"); - --module_param(rcv_buf_size, uint, S_IRUGO); --MODULE_PARM_DESC(rcv_buf_size, -- "Size of the buffers used for reception in ATM cells (range: 1-" -- __MODULE_STRING(UDSL_MAX_RCV_BUF_SIZE) ", default: " -+module_param(rcv_buf_bytes, uint, S_IRUGO); -+MODULE_PARM_DESC(rcv_buf_bytes, -+ "Size of the buffers used for reception, in bytes (range: 1-" -+ __MODULE_STRING(UDSL_MAX_BUF_SIZE) ", default: " - __MODULE_STRING(UDSL_DEFAULT_RCV_BUF_SIZE) ")"); - --module_param(snd_buf_size, uint, S_IRUGO); --MODULE_PARM_DESC(snd_buf_size, -- "Size of the buffers used for transmission in ATM cells (range: 1-" -+module_param(snd_buf_bytes, uint, S_IRUGO); -+MODULE_PARM_DESC(snd_buf_bytes, -+ "Size of the buffers used for transmission, in bytes (range: 1-" - __MODULE_STRING(UDSL_MAX_SND_BUF_SIZE) ", default: " - __MODULE_STRING(UDSL_DEFAULT_SND_BUF_SIZE) ")"); - -@@ -430,14 +429,14 @@ static unsigned int usbatm_write_cells(s - { - struct usbatm_control *ctrl = UDSL_SKB(skb); - struct atm_vcc *vcc = ctrl->atm.vcc; -- unsigned int num_written; -+ unsigned int bytes_written; - unsigned int stride = instance->tx_channel.stride; - - vdbg("%s: skb->len=%d, avail_space=%u", __func__, skb->len, avail_space); - UDSL_ASSERT(!(avail_space % stride)); - -- for (num_written = 0; num_written < avail_space && ctrl->len; -- num_written += stride, target += stride) { -+ for (bytes_written = 0; bytes_written < avail_space && ctrl->len; -+ bytes_written += stride, target += stride) { - unsigned int data_len = min_t(unsigned int, skb->len, ATM_CELL_PAYLOAD); - unsigned int left = ATM_CELL_PAYLOAD - data_len; - u8 *ptr = target; -@@ -480,7 +479,7 @@ static unsigned int usbatm_write_cells(s - ctrl->crc = crc32_be(ctrl->crc, ptr, left); - } - -- return num_written; -+ return bytes_written; - } - - -@@ -524,7 +523,7 @@ static void usbatm_tx_process(unsigned l - struct sk_buff *skb = instance->current_skb; - struct urb *urb = NULL; - const unsigned int buf_size = instance->tx_channel.buf_size; -- unsigned int num_written = 0; -+ unsigned int bytes_written = 0; - u8 *buffer = NULL; - - if (!skb) -@@ -536,16 +535,16 @@ static void usbatm_tx_process(unsigned l - if (!urb) - break; /* no more senders */ - buffer = urb->transfer_buffer; -- num_written = (urb->status == -EAGAIN) ? -+ bytes_written = (urb->status == -EAGAIN) ? - urb->transfer_buffer_length : 0; - } - -- num_written += usbatm_write_cells(instance, skb, -- buffer + num_written, -- buf_size - num_written); -+ bytes_written += usbatm_write_cells(instance, skb, -+ buffer + bytes_written, -+ buf_size - bytes_written); - - vdbg("%s: wrote %u bytes from skb 0x%p to urb 0x%p", -- __func__, num_written, skb, urb); -+ __func__, bytes_written, skb, urb); - - if (!UDSL_SKB(skb)->len) { - struct atm_vcc *vcc = UDSL_SKB(skb)->atm.vcc; -@@ -556,8 +555,8 @@ static void usbatm_tx_process(unsigned l - skb = skb_dequeue(&instance->sndqueue); - } - -- if (num_written == buf_size || (!skb && num_written)) { -- urb->transfer_buffer_length = num_written; -+ if (bytes_written == buf_size || (!skb && bytes_written)) { -+ urb->transfer_buffer_length = bytes_written; - - if (usbatm_submit_urb(urb)) - break; -@@ -990,6 +989,7 @@ int usbatm_usb_probe(struct usb_interfac - char *buf; - int error = -ENOMEM; - int i, length; -+ unsigned int maxpacket, num_packets; - - dev_dbg(dev, "%s: trying driver %s with vendor=%04x, product=%04x, ifnum %2d\n", - __func__, driver->driver_name, -@@ -1058,10 +1058,38 @@ int usbatm_usb_probe(struct usb_interfac - instance->tx_channel.endpoint = usb_sndbulkpipe(usb_dev, driver->out); - instance->rx_channel.stride = ATM_CELL_SIZE + driver->rx_padding; - instance->tx_channel.stride = ATM_CELL_SIZE + driver->tx_padding; -- instance->rx_channel.buf_size = rcv_buf_size * instance->rx_channel.stride; -- instance->tx_channel.buf_size = snd_buf_size * instance->tx_channel.stride; - instance->rx_channel.usbatm = instance->tx_channel.usbatm = instance; - -+ /* tx buffer size must be a positive multiple of the stride */ -+ instance->tx_channel.buf_size = max (instance->tx_channel.stride, -+ snd_buf_bytes - (snd_buf_bytes % instance->tx_channel.stride)); -+ -+ /* rx buffer size must be a positive multiple of the endpoint maxpacket */ -+ maxpacket = usb_maxpacket(usb_dev, instance->rx_channel.endpoint, 0); -+ -+ if ((maxpacket < 1) || (maxpacket > UDSL_MAX_BUF_SIZE)) { -+ dev_err(dev, "%s: invalid endpoint %02x!\n", __func__, -+ usb_pipeendpoint(instance->rx_channel.endpoint)); -+ error = -EINVAL; -+ goto fail_unbind; -+ } -+ -+ num_packets = max (1U, (rcv_buf_bytes + maxpacket / 2) / maxpacket); /* round */ -+ -+ if (num_packets * maxpacket > UDSL_MAX_BUF_SIZE) -+ num_packets--; -+ -+ instance->rx_channel.buf_size = num_packets * maxpacket; -+ -+#ifdef DEBUG -+ for (i = 0; i < 2; i++) { -+ struct usbatm_channel *channel = i ? -+ &instance->tx_channel : &instance->rx_channel; -+ -+ dev_dbg(dev, "%s: using %d byte buffer for %s channel 0x%p\n", __func__, channel->buf_size, i ? "tx" : "rx", channel); -+ } -+#endif -+ - skb_queue_head_init(&instance->sndqueue); - - for (i = 0; i < num_rcv_urbs + num_snd_urbs; i++) { -@@ -1232,10 +1260,10 @@ static int __init usbatm_usb_init(void) - - if ((num_rcv_urbs > UDSL_MAX_RCV_URBS) - || (num_snd_urbs > UDSL_MAX_SND_URBS) -- || (rcv_buf_size < 1) -- || (rcv_buf_size > UDSL_MAX_RCV_BUF_SIZE) -- || (snd_buf_size < 1) -- || (snd_buf_size > UDSL_MAX_SND_BUF_SIZE)) -+ || (rcv_buf_bytes < 1) -+ || (rcv_buf_bytes > UDSL_MAX_BUF_SIZE) -+ || (snd_buf_bytes < 1) -+ || (snd_buf_bytes > UDSL_MAX_BUF_SIZE)) - return -EINVAL; - - return 0; ---- gregkh-2.6.orig/drivers/usb/atm/speedtch.c -+++ gregkh-2.6/drivers/usb/atm/speedtch.c -@@ -89,6 +89,7 @@ MODULE_PARM_DESC(sw_buffering, - "Enable software buffering (default: " - __MODULE_STRING(DEFAULT_SW_BUFFERING) ")"); - -+#define INTERFACE_DATA 1 - #define ENDPOINT_INT 0x81 - #define ENDPOINT_DATA 0x07 - #define ENDPOINT_FIRMWARE 0x05 -@@ -98,6 +99,8 @@ MODULE_PARM_DESC(sw_buffering, - struct speedtch_instance_data { - struct usbatm_data *usbatm; - -+ unsigned int altsetting; -+ - struct work_struct status_checker; - - unsigned char last_status; -@@ -270,6 +273,11 @@ static int speedtch_upload_firmware(stru - because we're in our own kernel thread anyway. */ - msleep_interruptible(1000); - -+ if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) { -+ usb_err(usbatm, "%s: setting interface to %d failed (%d)!\n", __func__, instance->altsetting, ret); -+ goto out_free; -+ } -+ - /* Enable software buffering, if requested */ - if (sw_buffering) - speedtch_set_swbuff(instance, 1); -@@ -586,11 +594,6 @@ static int speedtch_atm_start(struct usb - - atm_dbg(usbatm, "%s entered\n", __func__); - -- if ((ret = usb_set_interface(usb_dev, 1, altsetting)) < 0) { -- atm_dbg(usbatm, "%s: usb_set_interface returned %d!\n", __func__, ret); -- return ret; -- } -- - /* Set MAC address, it is stored in the serial number */ - memset(atm_dev->esi, 0, sizeof(atm_dev->esi)); - if (usb_string(usb_dev, usb_dev->descriptor.iSerialNumber, mac_str, sizeof(mac_str)) == 12) { -@@ -725,6 +728,23 @@ static int speedtch_bind(struct usbatm_d - - instance->usbatm = usbatm; - -+ /* altsetting may change at any moment, so take a snapshot */ -+ instance->altsetting = altsetting; -+ -+ if (instance->altsetting) -+ if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) { -+ usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, instance->altsetting, ret); -+ instance->altsetting = 0; /* fall back to default */ -+ } -+ -+ if (!instance->altsetting) { -+ if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_ALTSETTING)) < 0) { -+ usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_ALTSETTING, ret); -+ goto fail_free; -+ } -+ instance->altsetting = DEFAULT_ALTSETTING; -+ } -+ - INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance); - - instance->status_checker.timer.function = speedtch_status_poll; diff --git a/usb/usbatm-remove-.owner.patch b/usb/usbatm-remove-.owner.patch deleted file mode 100644 index 78a30bed73599..0000000000000 --- a/usb/usbatm-remove-.owner.patch +++ /dev/null @@ -1,80 +0,0 @@ -From baldrick@free.fr Fri Jan 13 00:36:22 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 03/13] USBATM: remove .owner -Date: Fri, 13 Jan 2006 09:36:20 +0100 -Message-Id: <200601130936.21286.baldrick@free.fr> - -Remove the unused .owner field in struct usbatm_driver. - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/cxacru.c | 1 - - drivers/usb/atm/speedtch.c | 1 - - drivers/usb/atm/ueagle-atm.c | 3 +-- - drivers/usb/atm/usbatm.h | 2 -- - drivers/usb/atm/xusbatm.c | 1 - - 5 files changed, 1 insertion(+), 7 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/cxacru.c -+++ gregkh-2.6/drivers/usb/atm/cxacru.c -@@ -833,7 +833,6 @@ static const struct usb_device_id cxacru - MODULE_DEVICE_TABLE(usb, cxacru_usb_ids); - - static struct usbatm_driver cxacru_driver = { -- .owner = THIS_MODULE, - .driver_name = cxacru_driver_name, - .bind = cxacru_bind, - .heavy_init = cxacru_heavy_init, ---- gregkh-2.6.orig/drivers/usb/atm/speedtch.c -+++ gregkh-2.6/drivers/usb/atm/speedtch.c -@@ -793,7 +793,6 @@ static void speedtch_unbind(struct usbat - ***********/ - - static struct usbatm_driver speedtch_usbatm_driver = { -- .owner = THIS_MODULE, - .driver_name = speedtch_driver_name, - .bind = speedtch_bind, - .heavy_init = speedtch_heavy_init, ---- gregkh-2.6.orig/drivers/usb/atm/ueagle-atm.c -+++ gregkh-2.6/drivers/usb/atm/ueagle-atm.c -@@ -1629,7 +1629,7 @@ static int uea_bind(struct usbatm_data * - if (ifnum != UEA_INTR_IFACE_NO) - return -ENODEV; - -- usbatm_instance->flags = (sync_wait[modem_index] ? 0 : UDSL_SKIP_HEAVY_INIT); -+ usbatm->flags = (sync_wait[modem_index] ? 0 : UDSL_SKIP_HEAVY_INIT); - - /* interface 1 is for outbound traffic */ - ret = claim_interface(usb, usbatm, UEA_US_IFACE_NO); -@@ -1701,7 +1701,6 @@ static void uea_unbind(struct usbatm_dat - - static struct usbatm_driver uea_usbatm_driver = { - .driver_name = "ueagle-atm", -- .owner = THIS_MODULE, - .bind = uea_bind, - .atm_start = uea_atm_open, - .unbind = uea_unbind, ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.h -+++ gregkh-2.6/drivers/usb/atm/usbatm.h -@@ -100,8 +100,6 @@ struct usbatm_data; - */ - - struct usbatm_driver { -- struct module *owner; -- - const char *driver_name; - - /* init device ... can sleep, or cause probe() failure */ ---- gregkh-2.6.orig/drivers/usb/atm/xusbatm.c -+++ gregkh-2.6/drivers/usb/atm/xusbatm.c -@@ -166,7 +166,6 @@ static int __init xusbatm_init(void) - xusbatm_usb_ids[i].idProduct = product[i]; - - -- xusbatm_drivers[i].owner = THIS_MODULE; - xusbatm_drivers[i].driver_name = xusbatm_driver_name; - xusbatm_drivers[i].bind = xusbatm_bind; - xusbatm_drivers[i].unbind = xusbatm_unbind; diff --git a/usb/usbatm-return-correct-error-code-when-out-of-memory.patch b/usb/usbatm-return-correct-error-code-when-out-of-memory.patch deleted file mode 100644 index d006b5deb5a15..0000000000000 --- a/usb/usbatm-return-correct-error-code-when-out-of-memory.patch +++ /dev/null @@ -1,34 +0,0 @@ -From baldrick@free.fr Fri Jan 13 01:07:18 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 07/13] USBATM: return correct error code when out of memory -Date: Fri, 13 Jan 2006 10:07:08 +0100 -Message-Id: <200601131007.09403.baldrick@free.fr> - -We weren't always returning -ENOMEM. - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/usbatm.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.c -+++ gregkh-2.6/drivers/usb/atm/usbatm.c -@@ -1081,6 +1081,7 @@ int usbatm_usb_probe(struct usb_interfac - urb = usb_alloc_urb(iso_packets, GFP_KERNEL); - if (!urb) { - dev_err(dev, "%s: no memory for urb %d!\n", __func__, i); -+ error = -ENOMEM; - goto fail_unbind; - } - -@@ -1090,6 +1091,7 @@ int usbatm_usb_probe(struct usb_interfac - buffer = kzalloc(channel->buf_size, GFP_KERNEL); - if (!buffer) { - dev_err(dev, "%s: no memory for buffer %d!\n", __func__, i); -+ error = -ENOMEM; - goto fail_unbind; - } - diff --git a/usb/usbatm-semaphore-to-mutex-conversion.patch b/usb/usbatm-semaphore-to-mutex-conversion.patch deleted file mode 100644 index 12bc03cec29fe..0000000000000 --- a/usb/usbatm-semaphore-to-mutex-conversion.patch +++ /dev/null @@ -1,313 +0,0 @@ -From baldrick@free.fr Fri Jan 13 06:53:18 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 14/13] USBATM: semaphore to mutex conversion -Cc: Ingo Molnar <mingo@elte.hu>, Arjan van de Ven <arjan@infradead.org>, Jes Sorensen <jes@trained-monkey.org> -Date: Fri, 13 Jan 2006 15:52:55 +0100 -Message-Id: <200601131552.55795.baldrick@free.fr> - -From: Arjan van de Ven <arjan@infradead.org> - -This is the usbatm part of the Arjan, Jes and Ingo -mass semaphore to mutex conversion, reworked to apply on top -of the patches I just sent to you. This time, with correct -attribution and signed-off lines. - -Signed-off-by: Arjan van de Ven <arjan@infradead.org> -Signed-off-by: Ingo Molnar <mingo@elte.hu> -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/cxacru.c | 9 +++++---- - drivers/usb/atm/ueagle-atm.c | 27 ++++++++++++++------------- - drivers/usb/atm/usbatm.c | 28 ++++++++++++++-------------- - drivers/usb/atm/usbatm.h | 3 ++- - 4 files changed, 35 insertions(+), 32 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/cxacru.c -+++ gregkh-2.6/drivers/usb/atm/cxacru.c -@@ -36,6 +36,7 @@ - #include <linux/init.h> - #include <linux/device.h> /* FIXME: linux/firmware.h should include it itself */ - #include <linux/firmware.h> -+#include <linux/mutex.h> - - #include "usbatm.h" - -@@ -160,7 +161,7 @@ struct cxacru_data { - struct work_struct poll_work; - - /* contol handles */ -- struct semaphore cm_serialize; -+ struct mutex cm_serialize; - u8 *rcv_buf; - u8 *snd_buf; - struct urb *rcv_urb; -@@ -219,7 +220,7 @@ static int cxacru_cm(struct cxacru_data - goto fail; - } - -- down(&instance->cm_serialize); -+ mutex_lock(&instance->cm_serialize); - - /* submit reading urb before the writing one */ - init_completion(&instance->rcv_done); -@@ -288,7 +289,7 @@ static int cxacru_cm(struct cxacru_data - ret = offd; - dbg("cm %#x", cm); - fail: -- up(&instance->cm_serialize); -+ mutex_unlock(&instance->cm_serialize); - return ret; - } - -@@ -717,7 +718,7 @@ static int cxacru_bind(struct usbatm_dat - instance->snd_buf, PAGE_SIZE, - cxacru_blocking_completion, &instance->snd_done, 4); - -- init_MUTEX(&instance->cm_serialize); -+ mutex_init(&instance->cm_serialize); - - INIT_WORK(&instance->poll_work, (void *)cxacru_poll_status, instance); - ---- gregkh-2.6.orig/drivers/usb/atm/ueagle-atm.c -+++ gregkh-2.6/drivers/usb/atm/ueagle-atm.c -@@ -63,6 +63,7 @@ - #include <linux/ctype.h> - #include <linux/kthread.h> - #include <linux/version.h> -+#include <linux/mutex.h> - #include <asm/unaligned.h> - - #include "usbatm.h" -@@ -358,7 +359,7 @@ struct intr_pkt { - #define INTR_PKT_SIZE 28 - - static struct usb_driver uea_driver; --static DECLARE_MUTEX(uea_semaphore); -+static DEFINE_MUTEX(uea_mutex); - static const char *chip_name[] = {"ADI930", "Eagle I", "Eagle II", "Eagle III"}; - - static int modem_index; -@@ -1418,13 +1419,13 @@ static ssize_t read_status(struct device - int ret = -ENODEV; - struct uea_softc *sc; - -- down(&uea_semaphore); -+ mutex_lock(&uea_mutex); - sc = dev_to_uea(dev); - if (!sc) - goto out; - ret = snprintf(buf, 10, "%08x\n", sc->stats.phy.state); - out: -- up(&uea_semaphore); -+ mutex_unlock(&uea_mutex); - return ret; - } - -@@ -1434,14 +1435,14 @@ static ssize_t reboot(struct device *dev - int ret = -ENODEV; - struct uea_softc *sc; - -- down(&uea_semaphore); -+ mutex_lock(&uea_mutex); - sc = dev_to_uea(dev); - if (!sc) - goto out; - sc->reset = 1; - ret = count; - out: -- up(&uea_semaphore); -+ mutex_unlock(&uea_mutex); - return ret; - } - -@@ -1453,7 +1454,7 @@ static ssize_t read_human_status(struct - int ret = -ENODEV; - struct uea_softc *sc; - -- down(&uea_semaphore); -+ mutex_lock(&uea_mutex); - sc = dev_to_uea(dev); - if (!sc) - goto out; -@@ -1473,7 +1474,7 @@ static ssize_t read_human_status(struct - break; - } - out: -- up(&uea_semaphore); -+ mutex_unlock(&uea_mutex); - return ret; - } - -@@ -1485,7 +1486,7 @@ static ssize_t read_delin(struct device - int ret = -ENODEV; - struct uea_softc *sc; - -- down(&uea_semaphore); -+ mutex_lock(&uea_mutex); - sc = dev_to_uea(dev); - if (!sc) - goto out; -@@ -1497,7 +1498,7 @@ static ssize_t read_delin(struct device - else - ret = sprintf(buf, "GOOD\n"); - out: -- up(&uea_semaphore); -+ mutex_unlock(&uea_mutex); - return ret; - } - -@@ -1511,7 +1512,7 @@ static ssize_t read_##name(struct device - int ret = -ENODEV; \ - struct uea_softc *sc; \ - \ -- down(&uea_semaphore); \ -+ mutex_lock(&uea_mutex); \ - sc = dev_to_uea(dev); \ - if (!sc) \ - goto out; \ -@@ -1519,7 +1520,7 @@ static ssize_t read_##name(struct device - if (reset) \ - sc->stats.phy.name = 0; \ - out: \ -- up(&uea_semaphore); \ -+ mutex_unlock(&uea_mutex); \ - return ret; \ - } \ - \ -@@ -1737,9 +1738,9 @@ static void uea_disconnect(struct usb_in - * Pre-firmware device has one interface - */ - if (usb->config->desc.bNumInterfaces != 1 && ifnum == 0) { -- down(&uea_semaphore); -+ mutex_lock(&uea_mutex); - usbatm_usb_disconnect(intf); -- up(&uea_semaphore); -+ mutex_unlock(&uea_mutex); - uea_info(usb, "ADSL device removed\n"); - } - ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.c -+++ gregkh-2.6/drivers/usb/atm/usbatm.c -@@ -823,7 +823,7 @@ static int usbatm_atm_open(struct atm_vc - return -EINVAL; - } - -- down(&instance->serialize); /* vs self, usbatm_atm_close, usbatm_usb_disconnect */ -+ mutex_lock(&instance->serialize); /* vs self, usbatm_atm_close, usbatm_usb_disconnect */ - - if (instance->disconnected) { - atm_dbg(instance, "%s: disconnected!\n", __func__); -@@ -867,7 +867,7 @@ static int usbatm_atm_open(struct atm_vc - set_bit(ATM_VF_PARTIAL, &vcc->flags); - set_bit(ATM_VF_READY, &vcc->flags); - -- up(&instance->serialize); -+ mutex_unlock(&instance->serialize); - - atm_dbg(instance, "%s: allocated vcc data 0x%p\n", __func__, new); - -@@ -875,7 +875,7 @@ static int usbatm_atm_open(struct atm_vc - - fail: - kfree(new); -- up(&instance->serialize); -+ mutex_unlock(&instance->serialize); - return ret; - } - -@@ -896,7 +896,7 @@ static void usbatm_atm_close(struct atm_ - - usbatm_cancel_send(instance, vcc); - -- down(&instance->serialize); /* vs self, usbatm_atm_open, usbatm_usb_disconnect */ -+ mutex_lock(&instance->serialize); /* vs self, usbatm_atm_open, usbatm_usb_disconnect */ - - tasklet_disable(&instance->rx_channel.tasklet); - if (instance->cached_vcc == vcc_data) { -@@ -919,7 +919,7 @@ static void usbatm_atm_close(struct atm_ - clear_bit(ATM_VF_PARTIAL, &vcc->flags); - clear_bit(ATM_VF_ADDR, &vcc->flags); - -- up(&instance->serialize); -+ mutex_unlock(&instance->serialize); - - atm_dbg(instance, "%s successful\n", __func__); - } -@@ -1009,9 +1009,9 @@ static int usbatm_do_heavy_init(void *ar - if (!ret) - ret = usbatm_atm_init(instance); - -- down(&instance->serialize); -+ mutex_lock(&instance->serialize); - instance->thread_pid = -1; -- up(&instance->serialize); -+ mutex_unlock(&instance->serialize); - - complete_and_exit(&instance->thread_exited, ret); - } -@@ -1025,9 +1025,9 @@ static int usbatm_heavy_init(struct usba - return ret; - } - -- down(&instance->serialize); -+ mutex_lock(&instance->serialize); - instance->thread_pid = ret; -- up(&instance->serialize); -+ mutex_unlock(&instance->serialize); - - wait_for_completion(&instance->thread_started); - -@@ -1110,7 +1110,7 @@ int usbatm_usb_probe(struct usb_interfac - /* private fields */ - - kref_init(&instance->refcount); /* dropped in usbatm_usb_disconnect */ -- init_MUTEX(&instance->serialize); -+ mutex_init(&instance->serialize); - - instance->thread_pid = -1; - init_completion(&instance->thread_started); -@@ -1273,18 +1273,18 @@ void usbatm_usb_disconnect(struct usb_in - - usb_set_intfdata(intf, NULL); - -- down(&instance->serialize); -+ mutex_lock(&instance->serialize); - instance->disconnected = 1; - if (instance->thread_pid >= 0) - kill_proc(instance->thread_pid, SIGTERM, 1); -- up(&instance->serialize); -+ mutex_unlock(&instance->serialize); - - wait_for_completion(&instance->thread_exited); - -- down(&instance->serialize); -+ mutex_lock(&instance->serialize); - list_for_each_entry(vcc_data, &instance->vcc_list, list) - vcc_release_async(vcc_data->vcc, -EPIPE); -- up(&instance->serialize); -+ mutex_unlock(&instance->serialize); - - tasklet_disable(&instance->rx_channel.tasklet); - tasklet_disable(&instance->tx_channel.tasklet); ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.h -+++ gregkh-2.6/drivers/usb/atm/usbatm.h -@@ -34,6 +34,7 @@ - #include <linux/list.h> - #include <linux/stringify.h> - #include <linux/usb.h> -+#include <linux/mutex.h> - - /* - #define VERBOSE_DEBUG -@@ -171,7 +172,7 @@ struct usbatm_data { - ********************************/ - - struct kref refcount; -- struct semaphore serialize; -+ struct mutex serialize; - int disconnected; - - /* heavy init */ diff --git a/usb/usbatm-shutdown-open-connections-when-disconnected.patch b/usb/usbatm-shutdown-open-connections-when-disconnected.patch deleted file mode 100644 index 46af88774bb35..0000000000000 --- a/usb/usbatm-shutdown-open-connections-when-disconnected.patch +++ /dev/null @@ -1,172 +0,0 @@ -From baldrick@free.fr Fri Jan 13 01:05:25 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 06/13] USBATM: shutdown open connections when disconnected -Date: Fri, 13 Jan 2006 10:05:15 +0100 -Message-Id: <200601131005.15690.baldrick@free.fr> - -This patch causes vcc_release_async to be applied to any open -vcc's when the modem is disconnected. This signals a socket -shutdown, letting the socket user know that the game is up. -I wrote this patch because of reports that pppd would keep -connections open forever when the modem is disconnected. -This patch does not fix that problem, but it's a step in the -right direction. It doesn't help because the pppoatm module -doesn't yet monitor state changes on the ATM socket, so simply -never realises that the ATM connection has gone down (meaning -it doesn't tell the ppp layer). But at least there is a socket -state change now. Unfortunately this patch may create problems -for those rare users like me who use routed IP or some other -non-ppp connection method that goes via the ATM ARP daemon: the -daemon is buggy, and with this patch will crash when the modem -is disconnected. Users with a buggy atmarpd can simply restart -it after disconnecting the modem. - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/usbatm.c | 66 +++++++++++++++++++++++++++++++++-------------- - drivers/usb/atm/usbatm.h | 1 - 2 files changed, 48 insertions(+), 19 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.c -+++ gregkh-2.6/drivers/usb/atm/usbatm.c -@@ -602,8 +602,12 @@ static int usbatm_atm_send(struct atm_vc - - vdbg("%s called (skb 0x%p, len %u)", __func__, skb, skb->len); - -- if (!instance) { -- dbg("%s: NULL data!", __func__); -+ /* racy disconnection check - fine */ -+ if (!instance || instance->disconnected) { -+#ifdef DEBUG -+ if (printk_ratelimit()) -+ printk(KERN_DEBUG "%s: %s!\n", __func__, instance ? "disconnected" : "NULL instance"); -+#endif - err = -ENODEV; - goto fail; - } -@@ -715,15 +719,19 @@ static int usbatm_atm_proc_read(struct a - atomic_read(&atm_dev->stats.aal5.rx_err), - atomic_read(&atm_dev->stats.aal5.rx_drop)); - -- if (!left--) -- switch (atm_dev->signal) { -- case ATM_PHY_SIG_FOUND: -- return sprintf(page, "Line up\n"); -- case ATM_PHY_SIG_LOST: -- return sprintf(page, "Line down\n"); -- default: -- return sprintf(page, "Line state unknown\n"); -- } -+ if (!left--) { -+ if (instance->disconnected) -+ return sprintf(page, "Disconnected\n"); -+ else -+ switch (atm_dev->signal) { -+ case ATM_PHY_SIG_FOUND: -+ return sprintf(page, "Line up\n"); -+ case ATM_PHY_SIG_LOST: -+ return sprintf(page, "Line down\n"); -+ default: -+ return sprintf(page, "Line state unknown\n"); -+ } -+ } - - return 0; - } -@@ -757,6 +765,12 @@ static int usbatm_atm_open(struct atm_vc - - down(&instance->serialize); /* vs self, usbatm_atm_close, usbatm_usb_disconnect */ - -+ if (instance->disconnected) { -+ atm_dbg(instance, "%s: disconnected!\n", __func__); -+ ret = -ENODEV; -+ goto fail; -+ } -+ - if (usbatm_find_vcc(instance, vpi, vci)) { - atm_dbg(instance, "%s: %hd/%d already in use!\n", __func__, vpi, vci); - ret = -EADDRINUSE; -@@ -845,6 +859,13 @@ static void usbatm_atm_close(struct atm_ - static int usbatm_atm_ioctl(struct atm_dev *atm_dev, unsigned int cmd, - void __user * arg) - { -+ struct usbatm_data *instance = atm_dev->dev_data; -+ -+ if (!instance || instance->disconnected) { -+ dbg("%s: %s!", __func__, instance ? "disconnected" : "NULL instance"); -+ return -ENODEV; -+ } -+ - switch (cmd) { - case ATM_QUERYLOOP: - return put_user(ATM_LM_NONE, (int __user *)arg) ? -EFAULT : 0; -@@ -1129,6 +1150,7 @@ void usbatm_usb_disconnect(struct usb_in - { - struct device *dev = &intf->dev; - struct usbatm_data *instance = usb_get_intfdata(intf); -+ struct usbatm_vcc_data *vcc_data; - int i; - - dev_dbg(dev, "%s entered\n", __func__); -@@ -1141,12 +1163,18 @@ void usbatm_usb_disconnect(struct usb_in - usb_set_intfdata(intf, NULL); - - down(&instance->serialize); -+ instance->disconnected = 1; - if (instance->thread_pid >= 0) - kill_proc(instance->thread_pid, SIGTERM, 1); - up(&instance->serialize); - - wait_for_completion(&instance->thread_exited); - -+ down(&instance->serialize); -+ list_for_each_entry(vcc_data, &instance->vcc_list, list) -+ vcc_release_async(vcc_data->vcc, -EPIPE); -+ up(&instance->serialize); -+ - tasklet_disable(&instance->rx_channel.tasklet); - tasklet_disable(&instance->tx_channel.tasklet); - -@@ -1156,6 +1184,14 @@ void usbatm_usb_disconnect(struct usb_in - del_timer_sync(&instance->rx_channel.delay); - del_timer_sync(&instance->tx_channel.delay); - -+ /* turn usbatm_[rt]x_process into something close to a no-op */ -+ /* no need to take the spinlock */ -+ INIT_LIST_HEAD(&instance->rx_channel.list); -+ INIT_LIST_HEAD(&instance->tx_channel.list); -+ -+ tasklet_enable(&instance->rx_channel.tasklet); -+ tasklet_enable(&instance->tx_channel.tasklet); -+ - if (instance->atm_dev && instance->driver->atm_stop) - instance->driver->atm_stop(instance, instance->atm_dev); - -@@ -1164,14 +1200,6 @@ void usbatm_usb_disconnect(struct usb_in - - instance->driver_data = NULL; - -- /* turn usbatm_[rt]x_process into noop */ -- /* no need to take the spinlock */ -- INIT_LIST_HEAD(&instance->rx_channel.list); -- INIT_LIST_HEAD(&instance->tx_channel.list); -- -- tasklet_enable(&instance->rx_channel.tasklet); -- tasklet_enable(&instance->tx_channel.tasklet); -- - for (i = 0; i < num_rcv_urbs + num_snd_urbs; i++) { - kfree(instance->urbs[i]->transfer_buffer); - usb_free_urb(instance->urbs[i]); ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.h -+++ gregkh-2.6/drivers/usb/atm/usbatm.h -@@ -168,6 +168,7 @@ struct usbatm_data { - - struct kref refcount; - struct semaphore serialize; -+ int disconnected; - - /* heavy init */ - int thread_pid; diff --git a/usb/usbatm-trivial-modifications.patch b/usb/usbatm-trivial-modifications.patch deleted file mode 100644 index c8e691b175c59..0000000000000 --- a/usb/usbatm-trivial-modifications.patch +++ /dev/null @@ -1,924 +0,0 @@ -From baldrick@free.fr Tue Jan 17 02:15:31 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 01/13] USBATM: trivial modifications -Content-Disposition: inline -Date: Tue, 17 Jan 2006 11:15:13 +0100 -Message-Id: <200601171115.13698.baldrick@free.fr> - -Formatting, changes to variable names, comments, log level changes, -printk rate limiting. - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - - ---- - drivers/usb/atm/cxacru.c | 69 +++++++++++++++--------------- - drivers/usb/atm/speedtch.c | 53 +++++++++++++---------- - drivers/usb/atm/usbatm.c | 101 ++++++++++++++++++++++++++------------------- - drivers/usb/atm/usbatm.h | 25 +++++++---- - drivers/usb/atm/xusbatm.c | 23 +++++----- - 5 files changed, 153 insertions(+), 118 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/cxacru.c -+++ gregkh-2.6/drivers/usb/atm/cxacru.c -@@ -352,7 +352,6 @@ static int cxacru_atm_start(struct usbat - struct atm_dev *atm_dev) - { - struct cxacru_data *instance = usbatm_instance->driver_data; -- struct device *dev = &usbatm_instance->usb_intf->dev; - /* - struct atm_dev *atm_dev = usbatm_instance->atm_dev; - */ -@@ -364,14 +363,14 @@ static int cxacru_atm_start(struct usbat - ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_MAC_ADDRESS, NULL, 0, - atm_dev->esi, sizeof(atm_dev->esi)); - if (ret < 0) { -- dev_err(dev, "cxacru_atm_start: CARD_GET_MAC_ADDRESS returned %d\n", ret); -+ atm_err(usbatm_instance, "cxacru_atm_start: CARD_GET_MAC_ADDRESS returned %d\n", ret); - return ret; - } - - /* start ADSL */ - ret = cxacru_cm(instance, CM_REQUEST_CHIP_ADSL_LINE_START, NULL, 0, NULL, 0); - if (ret < 0) { -- dev_err(dev, "cxacru_atm_start: CHIP_ADSL_LINE_START returned %d\n", ret); -+ atm_err(usbatm_instance, "cxacru_atm_start: CHIP_ADSL_LINE_START returned %d\n", ret); - return ret; - } - -@@ -383,13 +382,13 @@ static int cxacru_atm_start(struct usbat - static void cxacru_poll_status(struct cxacru_data *instance) - { - u32 buf[CXINF_MAX] = {}; -- struct device *dev = &instance->usbatm->usb_intf->dev; -- struct atm_dev *atm_dev = instance->usbatm->atm_dev; -+ struct usbatm_data *usbatm = instance->usbatm; -+ struct atm_dev *atm_dev = usbatm->atm_dev; - int ret; - - ret = cxacru_cm_get_array(instance, CM_REQUEST_CARD_INFO_GET, buf, CXINF_MAX); - if (ret < 0) { -- dev_warn(dev, "poll status: error %d\n", ret); -+ atm_warn(usbatm, "poll status: error %d\n", ret); - goto reschedule; - } - -@@ -400,50 +399,50 @@ static void cxacru_poll_status(struct cx - switch (instance->line_status) { - case 0: - atm_dev->signal = ATM_PHY_SIG_LOST; -- dev_info(dev, "ADSL line: down\n"); -+ atm_info(usbatm, "ADSL line: down\n"); - break; - - case 1: - atm_dev->signal = ATM_PHY_SIG_LOST; -- dev_info(dev, "ADSL line: attemtping to activate\n"); -+ atm_info(usbatm, "ADSL line: attempting to activate\n"); - break; - - case 2: - atm_dev->signal = ATM_PHY_SIG_LOST; -- dev_info(dev, "ADSL line: training\n"); -+ atm_info(usbatm, "ADSL line: training\n"); - break; - - case 3: - atm_dev->signal = ATM_PHY_SIG_LOST; -- dev_info(dev, "ADSL line: channel analysis\n"); -+ atm_info(usbatm, "ADSL line: channel analysis\n"); - break; - - case 4: - atm_dev->signal = ATM_PHY_SIG_LOST; -- dev_info(dev, "ADSL line: exchange\n"); -+ atm_info(usbatm, "ADSL line: exchange\n"); - break; - - case 5: - atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424; - atm_dev->signal = ATM_PHY_SIG_FOUND; - -- dev_info(dev, "ADSL line: up (%d kb/s down | %d kb/s up)\n", -+ atm_info(usbatm, "ADSL line: up (%d kb/s down | %d kb/s up)\n", - buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]); - break; - - case 6: - atm_dev->signal = ATM_PHY_SIG_LOST; -- dev_info(dev, "ADSL line: waiting\n"); -+ atm_info(usbatm, "ADSL line: waiting\n"); - break; - - case 7: - atm_dev->signal = ATM_PHY_SIG_LOST; -- dev_info(dev, "ADSL line: initializing\n"); -+ atm_info(usbatm, "ADSL line: initializing\n"); - break; - - default: - atm_dev->signal = ATM_PHY_SIG_UNKNOWN; -- dev_info(dev, "Unknown line state %02x\n", instance->line_status); -+ atm_info(usbatm, "Unknown line state %02x\n", instance->line_status); - break; - } - reschedule: -@@ -504,8 +503,8 @@ static void cxacru_upload_firmware(struc - { - int ret; - int off; -- struct usb_device *usb_dev = instance->usbatm->usb_dev; -- struct device *dev = &instance->usbatm->usb_intf->dev; -+ struct usbatm_data *usbatm = instance->usbatm; -+ struct usb_device *usb_dev = usbatm->usb_dev; - u16 signature[] = { usb_dev->descriptor.idVendor, usb_dev->descriptor.idProduct }; - u32 val; - -@@ -515,7 +514,7 @@ static void cxacru_upload_firmware(struc - val = cpu_to_le32(instance->modem_type->pll_f_clk); - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLFCLK_ADDR, (u8 *) &val, 4); - if (ret) { -- dev_err(dev, "FirmwarePllFClkValue failed: %d\n", ret); -+ usb_err(usbatm, "FirmwarePllFClkValue failed: %d\n", ret); - return; - } - -@@ -523,7 +522,7 @@ static void cxacru_upload_firmware(struc - val = cpu_to_le32(instance->modem_type->pll_b_clk); - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLBCLK_ADDR, (u8 *) &val, 4); - if (ret) { -- dev_err(dev, "FirmwarePllBClkValue failed: %d\n", ret); -+ usb_err(usbatm, "FirmwarePllBClkValue failed: %d\n", ret); - return; - } - -@@ -531,14 +530,14 @@ static void cxacru_upload_firmware(struc - val = cpu_to_le32(SDRAM_ENA); - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SDRAMEN_ADDR, (u8 *) &val, 4); - if (ret) { -- dev_err(dev, "Enable SDRAM failed: %d\n", ret); -+ usb_err(usbatm, "Enable SDRAM failed: %d\n", ret); - return; - } - - /* Firmware */ - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, FW_ADDR, fw->data, fw->size); - if (ret) { -- dev_err(dev, "Firmware upload failed: %d\n", ret); -+ usb_err(usbatm, "Firmware upload failed: %d\n", ret); - return; - } - -@@ -546,7 +545,7 @@ static void cxacru_upload_firmware(struc - if (instance->modem_type->boot_rom_patch) { - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_ADDR, bp->data, bp->size); - if (ret) { -- dev_err(dev, "Boot ROM patching failed: %d\n", ret); -+ usb_err(usbatm, "Boot ROM patching failed: %d\n", ret); - return; - } - } -@@ -554,7 +553,7 @@ static void cxacru_upload_firmware(struc - /* Signature */ - ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SIG_ADDR, (u8 *) signature, 4); - if (ret) { -- dev_err(dev, "Signature storing failed: %d\n", ret); -+ usb_err(usbatm, "Signature storing failed: %d\n", ret); - return; - } - -@@ -566,7 +565,7 @@ static void cxacru_upload_firmware(struc - ret = cxacru_fw(usb_dev, FW_GOTO_MEM, 0x0, 0x0, FW_ADDR, NULL, 0); - } - if (ret) { -- dev_err(dev, "Passing control to firmware failed: %d\n", ret); -+ usb_err(usbatm, "Passing control to firmware failed: %d\n", ret); - return; - } - -@@ -580,7 +579,7 @@ static void cxacru_upload_firmware(struc - - ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_STATUS, NULL, 0, NULL, 0); - if (ret < 0) { -- dev_err(dev, "modem failed to initialize: %d\n", ret); -+ usb_err(usbatm, "modem failed to initialize: %d\n", ret); - return; - } - -@@ -597,7 +596,7 @@ static void cxacru_upload_firmware(struc - ret = cxacru_cm(instance, CM_REQUEST_CARD_DATA_SET, - (u8 *) buf, len, NULL, 0); - if (ret < 0) { -- dev_err(dev, "load config data failed: %d\n", ret); -+ usb_err(usbatm, "load config data failed: %d\n", ret); - return; - } - } -@@ -608,18 +607,19 @@ static void cxacru_upload_firmware(struc - static int cxacru_find_firmware(struct cxacru_data *instance, - char* phase, const struct firmware **fw_p) - { -- struct device *dev = &instance->usbatm->usb_intf->dev; -+ struct usbatm_data *usbatm = instance->usbatm; -+ struct device *dev = &usbatm->usb_intf->dev; - char buf[16]; - - sprintf(buf, "cxacru-%s.bin", phase); - dbg("cxacru_find_firmware: looking for %s", buf); - - if (request_firmware(fw_p, buf, dev)) { -- dev_dbg(dev, "no stage %s firmware found\n", phase); -+ usb_dbg(usbatm, "no stage %s firmware found\n", phase); - return -ENOENT; - } - -- dev_info(dev, "found firmware %s\n", buf); -+ usb_info(usbatm, "found firmware %s\n", buf); - - return 0; - } -@@ -627,20 +627,19 @@ static int cxacru_find_firmware(struct c - static int cxacru_heavy_init(struct usbatm_data *usbatm_instance, - struct usb_interface *usb_intf) - { -- struct device *dev = &usbatm_instance->usb_intf->dev; - const struct firmware *fw, *bp, *cf; - struct cxacru_data *instance = usbatm_instance->driver_data; - - int ret = cxacru_find_firmware(instance, "fw", &fw); - if (ret) { -- dev_warn(dev, "firmware (cxacru-fw.bin) unavailable (hotplug misconfiguration?)\n"); -+ usb_warn(usbatm_instance, "firmware (cxacru-fw.bin) unavailable (system misconfigured?)\n"); - return ret; - } - - if (instance->modem_type->boot_rom_patch) { - ret = cxacru_find_firmware(instance, "bp", &bp); - if (ret) { -- dev_warn(dev, "boot ROM patch (cxacru-bp.bin) unavailable (hotplug misconfiguration?)\n"); -+ usb_warn(usbatm_instance, "boot ROM patch (cxacru-bp.bin) unavailable (system misconfigured?)\n"); - release_firmware(fw); - return ret; - } -@@ -787,12 +786,12 @@ static const struct usb_device_id cxacru - { /* V = Conexant P = ADSL modem (Hasbani project) */ - USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00 - }, -- { /* V = Conexant P = ADSL modem (Well PTI-800 */ -- USB_DEVICE(0x0572, 0xcb02), .driver_info = (unsigned long) &cxacru_cb00 -- }, - { /* V = Conexant P = ADSL modem */ - USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00 - }, -+ { /* V = Conexant P = ADSL modem (Well PTI-800) */ -+ USB_DEVICE(0x0572, 0xcb02), .driver_info = (unsigned long) &cxacru_cb00 -+ }, - { /* V = Conexant P = ADSL modem */ - USB_DEVICE(0x0572, 0xcb06), .driver_info = (unsigned long) &cxacru_cb00 - }, ---- gregkh-2.6.orig/drivers/usb/atm/speedtch.c -+++ gregkh-2.6/drivers/usb/atm/speedtch.c -@@ -205,7 +205,7 @@ static int speedtch_upload_firmware(stru - buffer, 0x200, &actual_length, 2000); - - if (ret < 0 && ret != -ETIMEDOUT) -- usb_dbg(usbatm, "%s: read BLOCK0 from modem failed (%d)!\n", __func__, ret); -+ usb_warn(usbatm, "%s: read BLOCK0 from modem failed (%d)!\n", __func__, ret); - else - usb_dbg(usbatm, "%s: BLOCK0 downloaded (%d bytes)\n", __func__, ret); - } -@@ -219,7 +219,7 @@ static int speedtch_upload_firmware(stru - buffer, thislen, &actual_length, DATA_TIMEOUT); - - if (ret < 0) { -- usb_dbg(usbatm, "%s: write BLOCK1 to modem failed (%d)!\n", __func__, ret); -+ usb_err(usbatm, "%s: write BLOCK1 to modem failed (%d)!\n", __func__, ret); - goto out_free; - } - usb_dbg(usbatm, "%s: BLOCK1 uploaded (%zu bytes)\n", __func__, fw1->size); -@@ -232,7 +232,7 @@ static int speedtch_upload_firmware(stru - buffer, 0x200, &actual_length, DATA_TIMEOUT); - - if (ret < 0) { -- usb_dbg(usbatm, "%s: read BLOCK2 from modem failed (%d)!\n", __func__, ret); -+ usb_err(usbatm, "%s: read BLOCK2 from modem failed (%d)!\n", __func__, ret); - goto out_free; - } - usb_dbg(usbatm, "%s: BLOCK2 downloaded (%d bytes)\n", __func__, actual_length); -@@ -246,7 +246,7 @@ static int speedtch_upload_firmware(stru - buffer, thislen, &actual_length, DATA_TIMEOUT); - - if (ret < 0) { -- usb_dbg(usbatm, "%s: write BLOCK3 to modem failed (%d)!\n", __func__, ret); -+ usb_err(usbatm, "%s: write BLOCK3 to modem failed (%d)!\n", __func__, ret); - goto out_free; - } - } -@@ -259,7 +259,7 @@ static int speedtch_upload_firmware(stru - buffer, 0x200, &actual_length, DATA_TIMEOUT); - - if (ret < 0) { -- usb_dbg(usbatm, "%s: read BLOCK4 from modem failed (%d)!\n", __func__, ret); -+ usb_err(usbatm, "%s: read BLOCK4 from modem failed (%d)!\n", __func__, ret); - goto out_free; - } - -@@ -285,8 +285,8 @@ out: - return ret; - } - --static int speedtch_find_firmware(struct usb_interface *intf, int phase, -- const struct firmware **fw_p) -+static int speedtch_find_firmware(struct usbatm_data *usbatm, struct usb_interface *intf, -+ int phase, const struct firmware **fw_p) - { - struct device *dev = &intf->dev; - const u16 bcdDevice = le16_to_cpu(interface_to_usbdev(intf)->descriptor.bcdDevice); -@@ -295,24 +295,24 @@ static int speedtch_find_firmware(struct - char buf[24]; - - sprintf(buf, "speedtch-%d.bin.%x.%02x", phase, major_revision, minor_revision); -- dev_dbg(dev, "%s: looking for %s\n", __func__, buf); -+ usb_dbg(usbatm, "%s: looking for %s\n", __func__, buf); - - if (request_firmware(fw_p, buf, dev)) { - sprintf(buf, "speedtch-%d.bin.%x", phase, major_revision); -- dev_dbg(dev, "%s: looking for %s\n", __func__, buf); -+ usb_dbg(usbatm, "%s: looking for %s\n", __func__, buf); - - if (request_firmware(fw_p, buf, dev)) { - sprintf(buf, "speedtch-%d.bin", phase); -- dev_dbg(dev, "%s: looking for %s\n", __func__, buf); -+ usb_dbg(usbatm, "%s: looking for %s\n", __func__, buf); - - if (request_firmware(fw_p, buf, dev)) { -- dev_warn(dev, "no stage %d firmware found!\n", phase); -+ usb_err(usbatm, "%s: no stage %d firmware found!\n", __func__, phase); - return -ENOENT; - } - } - } - -- dev_info(dev, "found stage %d firmware %s\n", phase, buf); -+ usb_info(usbatm, "found stage %d firmware %s\n", phase, buf); - - return 0; - } -@@ -323,15 +323,16 @@ static int speedtch_heavy_init(struct us - struct speedtch_instance_data *instance = usbatm->driver_data; - int ret; - -- if ((ret = speedtch_find_firmware(intf, 1, &fw1)) < 0) -- return ret; -+ if ((ret = speedtch_find_firmware(usbatm, intf, 1, &fw1)) < 0) -+ return ret; - -- if ((ret = speedtch_find_firmware(intf, 2, &fw2)) < 0) { -+ if ((ret = speedtch_find_firmware(usbatm, intf, 2, &fw2)) < 0) { - release_firmware(fw1); - return ret; - } - -- ret = speedtch_upload_firmware(instance, fw1, fw2); -+ if ((ret = speedtch_upload_firmware(instance, fw1, fw2)) < 0) -+ usb_err(usbatm, "%s: firmware upload failed (%d)!\n", __func__, ret); - - release_firmware(fw2); - release_firmware(fw1); -@@ -428,7 +429,9 @@ static void speedtch_check_status(struct - int down_speed, up_speed, ret; - unsigned char status; - -+#ifdef VERBOSE_DEBUG - atm_dbg(usbatm, "%s entered\n", __func__); -+#endif - - ret = speedtch_read_status(instance); - if (ret < 0) { -@@ -441,9 +444,9 @@ static void speedtch_check_status(struct - - status = buf[OFFSET_7]; - -- atm_dbg(usbatm, "%s: line state %02x\n", __func__, status); -- - if ((status != instance->last_status) || !status) { -+ atm_dbg(usbatm, "%s: line state 0x%02x\n", __func__, status); -+ - switch (status) { - case 0: - atm_dev->signal = ATM_PHY_SIG_LOST; -@@ -484,7 +487,7 @@ static void speedtch_check_status(struct - - default: - atm_dev->signal = ATM_PHY_SIG_UNKNOWN; -- atm_info(usbatm, "Unknown line state %02x\n", status); -+ atm_info(usbatm, "unknown line state %02x\n", status); - break; - } - -@@ -690,8 +693,10 @@ static int speedtch_bind(struct usbatm_d - - usb_dbg(usbatm, "%s entered\n", __func__); - -+ /* sanity checks */ -+ - if (usb_dev->descriptor.bDeviceClass != USB_CLASS_VENDOR_SPEC) { -- usb_dbg(usbatm, "%s: wrong device class %d\n", __func__, usb_dev->descriptor.bDeviceClass); -+ usb_err(usbatm, "%s: wrong device class %d\n", __func__, usb_dev->descriptor.bDeviceClass); - return -ENODEV; - } - -@@ -704,7 +709,7 @@ static int speedtch_bind(struct usbatm_d - ret = usb_driver_claim_interface(&speedtch_usb_driver, cur_intf, usbatm); - - if (ret < 0) { -- usb_dbg(usbatm, "%s: failed to claim interface %d (%d)\n", __func__, i, ret); -+ usb_err(usbatm, "%s: failed to claim interface %2d (%d)!\n", __func__, i, ret); - speedtch_release_interfaces(usb_dev, i); - return ret; - } -@@ -714,7 +719,7 @@ static int speedtch_bind(struct usbatm_d - instance = kmalloc(sizeof(*instance), GFP_KERNEL); - - if (!instance) { -- usb_dbg(usbatm, "%s: no memory for instance data!\n", __func__); -+ usb_err(usbatm, "%s: no memory for instance data!\n", __func__); - ret = -ENOMEM; - goto fail_release; - } -@@ -754,8 +759,10 @@ static int speedtch_bind(struct usbatm_d - usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, need_heavy_init ? "not" : "already"); - - if (*need_heavy_init) -- if ((ret = usb_reset_device(usb_dev)) < 0) -+ if ((ret = usb_reset_device(usb_dev)) < 0) { -+ usb_err(usbatm, "%s: device reset failed (%d)!\n", __func__, ret); - goto fail_free; -+ } - - usbatm->driver_data = instance; - ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.c -+++ gregkh-2.6/drivers/usb/atm/usbatm.c -@@ -166,10 +166,10 @@ struct usbatm_control { - - /* ATM */ - --static void usbatm_atm_dev_close(struct atm_dev *dev); -+static void usbatm_atm_dev_close(struct atm_dev *atm_dev); - static int usbatm_atm_open(struct atm_vcc *vcc); - static void usbatm_atm_close(struct atm_vcc *vcc); --static int usbatm_atm_ioctl(struct atm_dev *dev, unsigned int cmd, void __user * arg); -+static int usbatm_atm_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void __user * arg); - static int usbatm_atm_send(struct atm_vcc *vcc, struct sk_buff *skb); - static int usbatm_atm_proc_read(struct atm_dev *atm_dev, loff_t * pos, char *page); - -@@ -234,8 +234,9 @@ static int usbatm_submit_urb(struct urb - - ret = usb_submit_urb(urb, GFP_ATOMIC); - if (ret) { -- atm_dbg(channel->usbatm, "%s: urb 0x%p submission failed (%d)!\n", -- __func__, urb, ret); -+ if (printk_ratelimit()) -+ atm_warn(channel->usbatm, "%s: urb 0x%p submission failed (%d)!\n", -+ __func__, urb, ret); - - /* consider all errors transient and return the buffer back to the queue */ - urb->status = -EAGAIN; -@@ -269,10 +270,13 @@ static void usbatm_complete(struct urb * - - spin_unlock_irqrestore(&channel->lock, flags); - -- if (unlikely(urb->status)) -+ if (unlikely(urb->status)) { -+ if (printk_ratelimit()) -+ atm_warn(channel->usbatm, "%s: urb 0x%p failed (%d)!\n", -+ __func__, urb, urb->status); - /* throttle processing in case of an error */ - mod_timer(&channel->delay, jiffies + msecs_to_jiffies(THROTTLE_MSECS)); -- else -+ } else - tasklet_schedule(&channel->tasklet); - } - -@@ -284,11 +288,11 @@ static void usbatm_complete(struct urb * - static inline struct usbatm_vcc_data *usbatm_find_vcc(struct usbatm_data *instance, - short vpi, int vci) - { -- struct usbatm_vcc_data *vcc; -+ struct usbatm_vcc_data *vcc_data; - -- list_for_each_entry(vcc, &instance->vcc_list, list) -- if ((vcc->vci == vci) && (vcc->vpi == vpi)) -- return vcc; -+ list_for_each_entry(vcc_data, &instance->vcc_list, list) -+ if ((vcc_data->vci == vci) && (vcc_data->vpi == vpi)) -+ return vcc_data; - return NULL; - } - -@@ -317,7 +321,7 @@ static void usbatm_extract_cells(struct - cached_vcc = usbatm_find_vcc(instance, vpi, vci); - - if (!cached_vcc) -- atm_dbg(instance, "%s: unknown vpi/vci (%hd/%d)!\n", __func__, vpi, vci); -+ atm_rldbg(instance, "%s: unknown vpi/vci (%hd/%d)!\n", __func__, vpi, vci); - } - - if (!cached_vcc) -@@ -327,7 +331,9 @@ static void usbatm_extract_cells(struct - - /* OAM F5 end-to-end */ - if (pti == ATM_PTI_E2EF5) { -- atm_warn(instance, "%s: OAM not supported (vpi %d, vci %d)!\n", __func__, vpi, vci); -+ if (printk_ratelimit()) -+ atm_warn(instance, "%s: OAM not supported (vpi %d, vci %d)!\n", -+ __func__, vpi, vci); - atomic_inc(&vcc->stats->rx_err); - continue; - } -@@ -335,7 +341,7 @@ static void usbatm_extract_cells(struct - sarb = cached_vcc->sarb; - - if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) { -- atm_dbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", -+ atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", - __func__, sarb->len, vcc); - /* discard cells already received */ - skb_trim(sarb, 0); -@@ -354,7 +360,7 @@ static void usbatm_extract_cells(struct - - /* guard against overflow */ - if (length > ATM_MAX_AAL5_PDU) { -- atm_dbg(instance, "%s: bogus length %u (vcc: 0x%p)!\n", -+ atm_rldbg(instance, "%s: bogus length %u (vcc: 0x%p)!\n", - __func__, length, vcc); - atomic_inc(&vcc->stats->rx_err); - goto out; -@@ -363,14 +369,14 @@ static void usbatm_extract_cells(struct - pdu_length = usbatm_pdu_length(length); - - if (sarb->len < pdu_length) { -- atm_dbg(instance, "%s: bogus pdu_length %u (sarb->len: %u, vcc: 0x%p)!\n", -+ atm_rldbg(instance, "%s: bogus pdu_length %u (sarb->len: %u, vcc: 0x%p)!\n", - __func__, pdu_length, sarb->len, vcc); - atomic_inc(&vcc->stats->rx_err); - goto out; - } - - if (crc32_be(~0, sarb->tail - pdu_length, pdu_length) != 0xc704dd7b) { -- atm_dbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", -+ atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", - __func__, vcc); - atomic_inc(&vcc->stats->rx_err); - goto out; -@@ -379,7 +385,9 @@ static void usbatm_extract_cells(struct - vdbg("%s: got packet (length: %u, pdu_length: %u, vcc: 0x%p)", __func__, length, pdu_length, vcc); - - if (!(skb = dev_alloc_skb(length))) { -- atm_dbg(instance, "%s: no memory for skb (length: %u)!\n", __func__, length); -+ if (printk_ratelimit()) -+ atm_err(instance, "%s: no memory for skb (length: %u)!\n", -+ __func__, length); - atomic_inc(&vcc->stats->rx_drop); - goto out; - } -@@ -387,7 +395,8 @@ static void usbatm_extract_cells(struct - vdbg("%s: allocated new sk_buff (skb: 0x%p, skb->truesize: %u)", __func__, skb, skb->truesize); - - if (!atm_charge(vcc, skb->truesize)) { -- atm_dbg(instance, "%s: failed atm_charge (skb->truesize: %u)!\n", __func__, skb->truesize); -+ atm_rldbg(instance, "%s: failed atm_charge (skb->truesize: %u)!\n", -+ __func__, skb->truesize); - dev_kfree_skb(skb); - goto out; /* atm_charge increments rx_drop */ - } -@@ -600,13 +609,13 @@ static int usbatm_atm_send(struct atm_vc - } - - if (vcc->qos.aal != ATM_AAL5) { -- atm_dbg(instance, "%s: unsupported ATM type %d!\n", __func__, vcc->qos.aal); -+ atm_rldbg(instance, "%s: unsupported ATM type %d!\n", __func__, vcc->qos.aal); - err = -EINVAL; - goto fail; - } - - if (skb->len > ATM_MAX_AAL5_PDU) { -- atm_dbg(instance, "%s: packet too long (%d vs %d)!\n", -+ atm_rldbg(instance, "%s: packet too long (%d vs %d)!\n", - __func__, skb->len, ATM_MAX_AAL5_PDU); - err = -EINVAL; - goto fail; -@@ -665,16 +674,16 @@ static void usbatm_put_instance(struct u - ** ATM ** - **********/ - --static void usbatm_atm_dev_close(struct atm_dev *dev) -+static void usbatm_atm_dev_close(struct atm_dev *atm_dev) - { -- struct usbatm_data *instance = dev->dev_data; -+ struct usbatm_data *instance = atm_dev->dev_data; - - dbg("%s", __func__); - - if (!instance) - return; - -- dev->dev_data = NULL; -+ atm_dev->dev_data = NULL; /* catch bugs */ - usbatm_put_instance(instance); /* taken in usbatm_atm_init */ - } - -@@ -735,13 +744,18 @@ static int usbatm_atm_open(struct atm_vc - atm_dbg(instance, "%s: vpi %hd, vci %d\n", __func__, vpi, vci); - - /* only support AAL5 */ -- if ((vcc->qos.aal != ATM_AAL5) || (vcc->qos.rxtp.max_sdu < 0) -- || (vcc->qos.rxtp.max_sdu > ATM_MAX_AAL5_PDU)) { -- atm_dbg(instance, "%s: unsupported ATM type %d!\n", __func__, vcc->qos.aal); -+ if ((vcc->qos.aal != ATM_AAL5)) { -+ atm_warn(instance, "%s: unsupported ATM type %d!\n", __func__, vcc->qos.aal); -+ return -EINVAL; -+ } -+ -+ /* sanity checks */ -+ if ((vcc->qos.rxtp.max_sdu < 0) || (vcc->qos.rxtp.max_sdu > ATM_MAX_AAL5_PDU)) { -+ atm_dbg(instance, "%s: max_sdu %d out of range!\n", __func__, vcc->qos.rxtp.max_sdu); - return -EINVAL; - } - -- down(&instance->serialize); /* vs self, usbatm_atm_close */ -+ down(&instance->serialize); /* vs self, usbatm_atm_close, usbatm_usb_disconnect */ - - if (usbatm_find_vcc(instance, vpi, vci)) { - atm_dbg(instance, "%s: %hd/%d already in use!\n", __func__, vpi, vci); -@@ -750,7 +764,7 @@ static int usbatm_atm_open(struct atm_vc - } - - if (!(new = kmalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) { -- atm_dbg(instance, "%s: no memory for vcc_data!\n", __func__); -+ atm_err(instance, "%s: no memory for vcc_data!\n", __func__); - ret = -ENOMEM; - goto fail; - } -@@ -762,7 +776,7 @@ static int usbatm_atm_open(struct atm_vc - - new->sarb = alloc_skb(usbatm_pdu_length(vcc->qos.rxtp.max_sdu), GFP_KERNEL); - if (!new->sarb) { -- atm_dbg(instance, "%s: no memory for SAR buffer!\n", __func__); -+ atm_err(instance, "%s: no memory for SAR buffer!\n", __func__); - ret = -ENOMEM; - goto fail; - } -@@ -806,7 +820,7 @@ static void usbatm_atm_close(struct atm_ - - usbatm_cancel_send(instance, vcc); - -- down(&instance->serialize); /* vs self, usbatm_atm_open */ -+ down(&instance->serialize); /* vs self, usbatm_atm_open, usbatm_usb_disconnect */ - - tasklet_disable(&instance->rx_channel.tasklet); - list_del(&vcc_data->list); -@@ -829,7 +843,7 @@ static void usbatm_atm_close(struct atm_ - atm_dbg(instance, "%s successful\n", __func__); - } - --static int usbatm_atm_ioctl(struct atm_dev *dev, unsigned int cmd, -+static int usbatm_atm_ioctl(struct atm_dev *atm_dev, unsigned int cmd, - void __user * arg) - { - switch (cmd) { -@@ -845,10 +859,13 @@ static int usbatm_atm_init(struct usbatm - struct atm_dev *atm_dev; - int ret, i; - -- /* ATM init */ -+ /* ATM init. The ATM initialization scheme suffers from an intrinsic race -+ * condition: callbacks we register can be executed at once, before we have -+ * initialized the struct atm_dev. To protect against this, all callbacks -+ * abort if atm_dev->dev_data is NULL. */ - atm_dev = atm_dev_register(instance->driver_name, &usbatm_atm_devops, -1, NULL); - if (!atm_dev) { -- usb_dbg(instance, "%s: failed to register ATM device!\n", __func__); -+ usb_err(instance, "%s: failed to register ATM device!\n", __func__); - return -1; - } - -@@ -862,12 +879,13 @@ static int usbatm_atm_init(struct usbatm - atm_dev->link_rate = 128 * 1000 / 424; - - if (instance->driver->atm_start && ((ret = instance->driver->atm_start(instance, atm_dev)) < 0)) { -- atm_dbg(instance, "%s: atm_start failed: %d!\n", __func__, ret); -+ atm_err(instance, "%s: atm_start failed: %d!\n", __func__, ret); - goto fail; - } - -- /* ready for ATM callbacks */ - usbatm_get_instance(instance); /* dropped in usbatm_atm_dev_close */ -+ -+ /* ready for ATM callbacks */ - mb(); - atm_dev->dev_data = instance; - -@@ -915,7 +933,7 @@ static int usbatm_heavy_init(struct usba - int ret = kernel_thread(usbatm_do_heavy_init, instance, CLONE_KERNEL); - - if (ret < 0) { -- usb_dbg(instance, "%s: failed to create kernel_thread (%d)!\n", __func__, ret); -+ usb_err(instance, "%s: failed to create kernel_thread (%d)!\n", __func__, ret); - return ret; - } - -@@ -953,7 +971,7 @@ int usbatm_usb_probe(struct usb_interfac - int i, length; - int need_heavy; - -- dev_dbg(dev, "%s: trying driver %s with vendor=0x%x, product=0x%x, ifnum %d\n", -+ dev_dbg(dev, "%s: trying driver %s with vendor=%04x, product=%04x, ifnum %2d\n", - __func__, driver->driver_name, - le16_to_cpu(usb_dev->descriptor.idVendor), - le16_to_cpu(usb_dev->descriptor.idProduct), -@@ -962,7 +980,7 @@ int usbatm_usb_probe(struct usb_interfac - /* instance init */ - instance = kzalloc(sizeof(*instance) + sizeof(struct urb *) * (num_rcv_urbs + num_snd_urbs), GFP_KERNEL); - if (!instance) { -- dev_dbg(dev, "%s: no memory for instance data!\n", __func__); -+ dev_err(dev, "%s: no memory for instance data!\n", __func__); - return -ENOMEM; - } - -@@ -998,7 +1016,7 @@ int usbatm_usb_probe(struct usb_interfac - bind: - need_heavy = 1; - if (driver->bind && (error = driver->bind(instance, intf, id, &need_heavy)) < 0) { -- dev_dbg(dev, "%s: bind failed: %d!\n", __func__, error); -+ dev_err(dev, "%s: bind failed: %d!\n", __func__, error); - goto fail_free; - } - -@@ -1044,7 +1062,7 @@ int usbatm_usb_probe(struct usb_interfac - - urb = usb_alloc_urb(iso_packets, GFP_KERNEL); - if (!urb) { -- dev_dbg(dev, "%s: no memory for urb %d!\n", __func__, i); -+ dev_err(dev, "%s: no memory for urb %d!\n", __func__, i); - goto fail_unbind; - } - -@@ -1052,9 +1070,10 @@ int usbatm_usb_probe(struct usb_interfac - - buffer = kmalloc(channel->buf_size, GFP_KERNEL); - if (!buffer) { -- dev_dbg(dev, "%s: no memory for buffer %d!\n", __func__, i); -+ dev_err(dev, "%s: no memory for buffer %d!\n", __func__, i); - goto fail_unbind; - } -+ /* zero the tx padding to avoid leaking information */ - memset(buffer, 0, channel->buf_size); - - usb_fill_bulk_urb(urb, instance->usb_dev, channel->endpoint, ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.h -+++ gregkh-2.6/drivers/usb/atm/usbatm.h -@@ -24,22 +24,21 @@ - #ifndef _USBATM_H_ - #define _USBATM_H_ - --#include <linux/config.h> -- --/* --#define VERBOSE_DEBUG --*/ -- - #include <asm/semaphore.h> - #include <linux/atm.h> - #include <linux/atmdev.h> - #include <linux/completion.h> - #include <linux/device.h> -+#include <linux/kernel.h> - #include <linux/kref.h> - #include <linux/list.h> - #include <linux/stringify.h> - #include <linux/usb.h> - -+/* -+#define VERBOSE_DEBUG -+*/ -+ - #ifdef DEBUG - #define UDSL_ASSERT(x) BUG_ON(!(x)) - #else -@@ -52,8 +51,13 @@ - dev_info(&(instance)->usb_intf->dev , format , ## arg) - #define usb_warn(instance, format, arg...) \ - dev_warn(&(instance)->usb_intf->dev , format , ## arg) -+#ifdef DEBUG -+#define usb_dbg(instance, format, arg...) \ -+ dev_printk(KERN_DEBUG , &(instance)->usb_intf->dev , format , ## arg) -+#else - #define usb_dbg(instance, format, arg...) \ -- dev_dbg(&(instance)->usb_intf->dev , format , ## arg) -+ do {} while (0) -+#endif - - /* FIXME: move to dev_* once ATM is driver model aware */ - #define atm_printk(level, instance, format, arg...) \ -@@ -69,9 +73,14 @@ - #ifdef DEBUG - #define atm_dbg(instance, format, arg...) \ - atm_printk(KERN_DEBUG, instance , format , ## arg) -+#define atm_rldbg(instance, format, arg...) \ -+ if (printk_ratelimit()) \ -+ atm_printk(KERN_DEBUG, instance , format , ## arg) - #else - #define atm_dbg(instance, format, arg...) \ - do {} while (0) -+#define atm_rldbg(instance, format, arg...) \ -+ do {} while (0) - #endif - - -@@ -171,7 +180,7 @@ struct usbatm_data { - struct usbatm_channel tx_channel; - - struct sk_buff_head sndqueue; -- struct sk_buff *current_skb; /* being emptied */ -+ struct sk_buff *current_skb; /* being emptied */ - - struct urb *urbs[0]; - }; ---- gregkh-2.6.orig/drivers/usb/atm/xusbatm.c -+++ gregkh-2.6/drivers/usb/atm/xusbatm.c -@@ -61,7 +61,7 @@ static int usb_intf_has_ep(const struct - return 0; - } - --static int xusbatm_bind(struct usbatm_data *usbatm_instance, -+static int xusbatm_bind(struct usbatm_data *usbatm, - struct usb_interface *intf, const struct usb_device_id *id, - int *need_heavy_init) - { -@@ -72,14 +72,14 @@ static int xusbatm_bind(struct usbatm_da - u8 searched_ep = rx_ep_present ? tx_endpoint[drv_ix] : rx_endpoint[drv_ix]; - int i, ret; - -- usb_dbg(usbatm_instance, "%s: binding driver %d: vendor %#x product %#x" -- " rx: ep %#x padd %d tx: ep %#x padd %d\n", -+ usb_dbg(usbatm, "%s: binding driver %d: vendor %04x product %04x" -+ " rx: ep %02x padd %d tx: ep %02x padd %d\n", - __func__, drv_ix, vendor[drv_ix], product[drv_ix], - rx_endpoint[drv_ix], rx_padding[drv_ix], - tx_endpoint[drv_ix], tx_padding[drv_ix]); - - if (!rx_ep_present && !tx_ep_present) { -- usb_dbg(usbatm_instance, "%s: intf #%d has neither rx (%#x) nor tx (%#x) endpoint\n", -+ usb_dbg(usbatm, "%s: intf #%d has neither rx (%#x) nor tx (%#x) endpoint\n", - __func__, intf->altsetting->desc.bInterfaceNumber, - rx_endpoint[drv_ix], tx_endpoint[drv_ix]); - return -ENODEV; -@@ -93,25 +93,26 @@ static int xusbatm_bind(struct usbatm_da - - if (cur_if != intf && usb_intf_has_ep(cur_if, searched_ep)) { - ret = usb_driver_claim_interface(&xusbatm_usb_driver, -- cur_if, usbatm_instance); -+ cur_if, usbatm); - if (!ret) -- usb_err(usbatm_instance, "%s: failed to claim interface #%d (%d)\n", -+ usb_err(usbatm, "%s: failed to claim interface #%d (%d)\n", - __func__, cur_if->altsetting->desc.bInterfaceNumber, ret); - return ret; - } - } - -- usb_err(usbatm_instance, "%s: no interface has endpoint %#x\n", -+ usb_err(usbatm, "%s: no interface has endpoint %#x\n", - __func__, searched_ep); - return -ENODEV; - } - --static void xusbatm_unbind(struct usbatm_data *usbatm_instance, -+static void xusbatm_unbind(struct usbatm_data *usbatm, - struct usb_interface *intf) - { - struct usb_device *usb_dev = interface_to_usbdev(intf); - int i; -- usb_dbg(usbatm_instance, "%s entered\n", __func__); -+ -+ usb_dbg(usbatm, "%s entered\n", __func__); - - for(i = 0; i < usb_dev->actconfig->desc.bNumInterfaces; i++) { - struct usb_interface *cur_if = usb_dev->actconfig->interface[i]; -@@ -120,10 +121,10 @@ static void xusbatm_unbind(struct usbatm - } - } - --static int xusbatm_atm_start(struct usbatm_data *usbatm_instance, -+static int xusbatm_atm_start(struct usbatm_data *usbatm, - struct atm_dev *atm_dev) - { -- atm_dbg(usbatm_instance, "%s entered\n", __func__); -+ atm_dbg(usbatm, "%s entered\n", __func__); - - /* use random MAC as we've no way to get it from the device */ - random_ether_addr(atm_dev->esi); diff --git a/usb/usbatm-use-dev_kfree_skb_any-rather-than-dev_kfree_skb.patch b/usb/usbatm-use-dev_kfree_skb_any-rather-than-dev_kfree_skb.patch deleted file mode 100644 index e386638ab3c73..0000000000000 --- a/usb/usbatm-use-dev_kfree_skb_any-rather-than-dev_kfree_skb.patch +++ /dev/null @@ -1,46 +0,0 @@ -From baldrick@free.fr Fri Jan 13 01:13:25 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 08/13] USBATM: use dev_kfree_skb_any rather than dev_kfree_skb -Date: Fri, 13 Jan 2006 10:13:19 +0100 -Message-Id: <200601131013.19986.baldrick@free.fr> - -In one spot (usbatm_cancel_send) we were calling dev_kfree_skb with irqs -disabled. This mistake is just too easy to make, so systematically use -dev_kfree_skb_any rather than dev_kfree_skb. - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/usbatm.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/usbatm.c -+++ gregkh-2.6/drivers/usb/atm/usbatm.c -@@ -72,6 +72,7 @@ - #include <linux/kernel.h> - #include <linux/module.h> - #include <linux/moduleparam.h> -+#include <linux/netdevice.h> - #include <linux/proc_fs.h> - #include <linux/sched.h> - #include <linux/signal.h> -@@ -199,7 +200,7 @@ static inline void usbatm_pop(struct atm - if (vcc->pop) - vcc->pop(vcc, skb); - else -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - } - - -@@ -397,7 +398,7 @@ static void usbatm_extract_cells(struct - if (!atm_charge(vcc, skb->truesize)) { - atm_rldbg(instance, "%s: failed atm_charge (skb->truesize: %u)!\n", - __func__, skb->truesize); -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - goto out; /* atm_charge increments rx_drop */ - } - diff --git a/usb/usbatm-xusbatm-rewrite.patch b/usb/usbatm-xusbatm-rewrite.patch deleted file mode 100644 index 1a8cdfb58efa8..0000000000000 --- a/usb/usbatm-xusbatm-rewrite.patch +++ /dev/null @@ -1,190 +0,0 @@ -From baldrick@free.fr Fri Jan 13 00:48:36 2006 -From: Duncan Sands <baldrick@free.fr> -To: Greg KH <greg@kroah.com> -Subject: [PATCH 05/13] USBATM: xusbatm rewrite -Date: Fri, 13 Jan 2006 09:48:36 +0100 -Message-Id: <200601130948.36673.baldrick@free.fr> - -The xusbatm driver is for otherwise unsupported modems. -All it does is grab hold of a user-specified set of -interfaces - the generic usbatm core methods (hopefully) -do the rest. As Aurelio Arroyo discovered when he tried -to use xusbatm (big mistake!), the interface grabbing logic -was completely borked. Here is a rewrite that works. - -Signed-off-by: Duncan Sands <baldrick@free.fr> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/usb/atm/xusbatm.c | 112 +++++++++++++++++++++++++++++++--------------- - 1 file changed, 76 insertions(+), 36 deletions(-) - ---- gregkh-2.6.orig/drivers/usb/atm/xusbatm.c -+++ gregkh-2.6/drivers/usb/atm/xusbatm.c -@@ -41,6 +41,8 @@ XUSBATM_PARM(rx_endpoint, unsigned char, - XUSBATM_PARM(tx_endpoint, unsigned char, byte, "tx endpoint number"); - XUSBATM_PARM(rx_padding, unsigned char, byte, "rx padding (default 0)"); - XUSBATM_PARM(tx_padding, unsigned char, byte, "tx padding (default 0)"); -+XUSBATM_PARM(rx_altsetting, unsigned char, byte, "rx altsetting (default 0)"); -+XUSBATM_PARM(tx_altsetting, unsigned char, byte, "rx altsetting (default 0)"); - - static const char xusbatm_driver_name[] = "xusbatm"; - -@@ -48,61 +50,94 @@ static struct usbatm_driver xusbatm_driv - static struct usb_device_id xusbatm_usb_ids[XUSBATM_DRIVERS_MAX + 1]; - static struct usb_driver xusbatm_usb_driver; - --static int usb_intf_has_ep(const struct usb_interface *intf, u8 ep) -+static struct usb_interface *xusbatm_find_intf (struct usb_device *usb_dev, int altsetting, u8 ep) - { -+ struct usb_host_interface *alt; -+ struct usb_interface *intf; - int i, j; - -- for (i = 0; i < intf->num_altsetting; i++) { -- struct usb_host_interface *alt = intf->altsetting; -- for (j = 0; j < alt->desc.bNumEndpoints; j++) -- if ((alt->endpoint[i].desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK) == ep) -- return 1; -+ for(i = 0; i < usb_dev->actconfig->desc.bNumInterfaces; i++) -+ if ((intf = usb_dev->actconfig->interface[i]) && (alt = usb_altnum_to_altsetting(intf, altsetting))) -+ for (j = 0; j < alt->desc.bNumEndpoints; j++) -+ if (alt->endpoint[j].desc.bEndpointAddress == ep) -+ return intf; -+ return NULL; -+} -+ -+static int xusbatm_capture_intf (struct usbatm_data *usbatm, struct usb_device *usb_dev, -+ struct usb_interface *intf, int altsetting, int claim) -+{ -+ int ifnum = intf->altsetting->desc.bInterfaceNumber; -+ int ret; -+ -+ if (claim && (ret = usb_driver_claim_interface(&xusbatm_usb_driver, intf, usbatm))) { -+ usb_err(usbatm, "%s: failed to claim interface %2d (%d)!\n", __func__, ifnum, ret); -+ return ret; -+ } -+ if ((ret = usb_set_interface(usb_dev, ifnum, altsetting))) { -+ usb_err(usbatm, "%s: altsetting %2d for interface %2d failed (%d)!\n", __func__, altsetting, ifnum, ret); -+ return ret; - } - return 0; - } - -+static void xusbatm_release_intf (struct usb_device *usb_dev, struct usb_interface *intf, int claimed) -+{ -+ if (claimed) { -+ usb_set_intfdata(intf, NULL); -+ usb_driver_release_interface(&xusbatm_usb_driver, intf); -+ } -+} -+ - static int xusbatm_bind(struct usbatm_data *usbatm, - struct usb_interface *intf, const struct usb_device_id *id) - { - struct usb_device *usb_dev = interface_to_usbdev(intf); - int drv_ix = id - xusbatm_usb_ids; -- int rx_ep_present = usb_intf_has_ep(intf, rx_endpoint[drv_ix]); -- int tx_ep_present = usb_intf_has_ep(intf, tx_endpoint[drv_ix]); -- u8 searched_ep = rx_ep_present ? tx_endpoint[drv_ix] : rx_endpoint[drv_ix]; -- int i, ret; -+ int rx_alt = rx_altsetting[drv_ix]; -+ int tx_alt = tx_altsetting[drv_ix]; -+ struct usb_interface *rx_intf = xusbatm_find_intf(usb_dev, rx_alt, rx_endpoint[drv_ix]); -+ struct usb_interface *tx_intf = xusbatm_find_intf(usb_dev, tx_alt, tx_endpoint[drv_ix]); -+ int ret; - - usb_dbg(usbatm, "%s: binding driver %d: vendor %04x product %04x" -- " rx: ep %02x padd %d tx: ep %02x padd %d\n", -+ " rx: ep %02x padd %d alt %2d tx: ep %02x padd %d alt %2d\n", - __func__, drv_ix, vendor[drv_ix], product[drv_ix], -- rx_endpoint[drv_ix], rx_padding[drv_ix], -- tx_endpoint[drv_ix], tx_padding[drv_ix]); -+ rx_endpoint[drv_ix], rx_padding[drv_ix], rx_alt, -+ tx_endpoint[drv_ix], tx_padding[drv_ix], tx_alt); - -- if (!rx_ep_present && !tx_ep_present) { -- usb_dbg(usbatm, "%s: intf #%d has neither rx (%#x) nor tx (%#x) endpoint\n", -- __func__, intf->altsetting->desc.bInterfaceNumber, -- rx_endpoint[drv_ix], tx_endpoint[drv_ix]); -+ if (!rx_intf || !tx_intf) { -+ if (!rx_intf) -+ usb_dbg(usbatm, "%s: no interface contains endpoint %02x in altsetting %2d\n", -+ __func__, rx_endpoint[drv_ix], rx_alt); -+ if (!tx_intf) -+ usb_dbg(usbatm, "%s: no interface contains endpoint %02x in altsetting %2d\n", -+ __func__, tx_endpoint[drv_ix], tx_alt); - return -ENODEV; - } - -- if (rx_ep_present && tx_ep_present) -- return 0; -+ if ((rx_intf != intf) && (tx_intf != intf)) -+ return -ENODEV; - -- for(i = 0; i < usb_dev->actconfig->desc.bNumInterfaces; i++) { -- struct usb_interface *cur_if = usb_dev->actconfig->interface[i]; -+ if ((rx_intf == tx_intf) && (rx_alt != tx_alt)) { -+ usb_err(usbatm, "%s: altsettings clash on interface %2d (%2d vs %2d)!\n", __func__, -+ rx_intf->altsetting->desc.bInterfaceNumber, rx_alt, tx_alt); -+ return -EINVAL; -+ } - -- if (cur_if != intf && usb_intf_has_ep(cur_if, searched_ep)) { -- ret = usb_driver_claim_interface(&xusbatm_usb_driver, -- cur_if, usbatm); -- if (!ret) -- usb_err(usbatm, "%s: failed to claim interface #%d (%d)\n", -- __func__, cur_if->altsetting->desc.bInterfaceNumber, ret); -- return ret; -- } -+ usb_dbg(usbatm, "%s: rx If#=%2d; tx If#=%2d\n", __func__, -+ rx_intf->altsetting->desc.bInterfaceNumber, -+ tx_intf->altsetting->desc.bInterfaceNumber); -+ -+ if ((ret = xusbatm_capture_intf(usbatm, usb_dev, rx_intf, rx_alt, rx_intf != intf))) -+ return ret; -+ -+ if ((tx_intf != rx_intf) && (ret = xusbatm_capture_intf(usbatm, usb_dev, tx_intf, tx_alt, tx_intf != intf))) { -+ xusbatm_release_intf(usb_dev, rx_intf, rx_intf != intf); -+ return ret; - } - -- usb_err(usbatm, "%s: no interface has endpoint %#x\n", -- __func__, searched_ep); -- return -ENODEV; -+ return 0; - } - - static void xusbatm_unbind(struct usbatm_data *usbatm, -@@ -114,9 +149,12 @@ static void xusbatm_unbind(struct usbatm - usb_dbg(usbatm, "%s entered\n", __func__); - - for(i = 0; i < usb_dev->actconfig->desc.bNumInterfaces; i++) { -- struct usb_interface *cur_if = usb_dev->actconfig->interface[i]; -- usb_set_intfdata(cur_if, NULL); -- usb_driver_release_interface(&xusbatm_usb_driver, cur_if); -+ struct usb_interface *cur_intf = usb_dev->actconfig->interface[i]; -+ -+ if (cur_intf && (usb_get_intfdata(cur_intf) == usbatm)) { -+ usb_set_intfdata(cur_intf, NULL); -+ usb_driver_release_interface(&xusbatm_usb_driver, cur_intf); -+ } - } - } - -@@ -161,11 +199,13 @@ static int __init xusbatm_init(void) - } - - for (i = 0; i < num_vendor; i++) { -+ rx_endpoint[i] |= USB_DIR_IN; -+ tx_endpoint[i] &= USB_ENDPOINT_NUMBER_MASK; -+ - xusbatm_usb_ids[i].match_flags = USB_DEVICE_ID_MATCH_DEVICE; - xusbatm_usb_ids[i].idVendor = vendor[i]; - xusbatm_usb_ids[i].idProduct = product[i]; - -- - xusbatm_drivers[i].driver_name = xusbatm_driver_name; - xusbatm_drivers[i].bind = xusbatm_bind; - xusbatm_drivers[i].unbind = xusbatm_unbind; |