--- /dev/null
+From stable-bounces@linux.kernel.org Sat Mar 3 06:37:39 2007
+From: Jin-Bong lee <jinbong.lee@samsung.com>
+Date: Sat, 03 Mar 2007 09:36:05 -0500
+Subject: DVB: cxusb: fix firmware patch for big endian systems
+To: stable@kernel.org
+Cc: v4l-dvb maintainer list <v4l-dvb-maintainer@linuxtv.org>
+Message-ID: <45E987D5.8080200@linuxtv.org>
+
+
+From: Jin-Bong lee <jinbong.lee@samsung.com>
+
+Without this patch, the device will not be detected after firmware download
+on big endian systems.
+
+(cherry picked from commit 1d1370a48ca285ebe197ecd3197a8d5f161bc291)
+
+Signed-off-by: Jin-Bong lee <jinbong.lee@samsung.com>
+Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/media/dvb/dvb-usb/cxusb.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- linux-2.6.20.1.orig/drivers/media/dvb/dvb-usb/cxusb.c
++++ linux-2.6.20.1/drivers/media/dvb/dvb-usb/cxusb.c
+@@ -469,9 +469,9 @@ static int bluebird_patch_dvico_firmware
+ fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) {
+
+ fw->data[BLUEBIRD_01_ID_OFFSET + 2] =
+- udev->descriptor.idProduct + 1;
++ le16_to_cpu(udev->descriptor.idProduct) + 1;
+ fw->data[BLUEBIRD_01_ID_OFFSET + 3] =
+- udev->descriptor.idProduct >> 8;
++ le16_to_cpu(udev->descriptor.idProduct) >> 8;
+
+ return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2);
+ }
--- /dev/null
+From stable-bounces@linux.kernel.org Sat Mar 3 06:37:44 2007
+From: Michael Krufky <mkrufky@linuxtv.org>
+Date: Sat, 03 Mar 2007 09:36:09 -0500
+Subject: DVB: digitv: open nxt6000 i2c_gate for TDED4 tuner handling
+To: stable@kernel.org
+Cc: v4l-dvb maintainer list <v4l-dvb-maintainer@linuxtv.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
+Message-ID: <45E987D9.9000808@linuxtv.org>
+
+From: Michael Krufky <mkrufky@linuxtv.org>
+
+dvb-pll normally opens the i2c gate before attempting to communicate with
+the pll, but the code for this device is not using dvb-pll. This should
+be cleaned up in the future, but for now, just open the i2c gate at the
+appropriate place in order to fix this driver bug.
+
+(cherry picked from commit 2fe22dcdc79b8dd34e61a3f1231caffd6180a626)
+
+Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/media/dvb/dvb-usb/digitv.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- linux-2.6.20.1.orig/drivers/media/dvb/dvb-usb/digitv.c
++++ linux-2.6.20.1/drivers/media/dvb/dvb-usb/digitv.c
+@@ -119,6 +119,8 @@ static int digitv_nxt6000_tuner_set_para
+ struct dvb_usb_adapter *adap = fe->dvb->priv;
+ u8 b[5];
+ dvb_usb_tuner_calc_regs(fe,fep,b, 5);
++ if (fe->ops.i2c_gate_ctrl)
++ fe->ops.i2c_gate_ctrl(fe, 1);
+ return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0);
+ }
+
--- /dev/null
+From stable-bounces@linux.kernel.org Sat Mar 3 06:37:14 2007
+From: Michael Krufky <mkrufky@linuxtv.org>
+Date: Sat, 03 Mar 2007 09:35:48 -0500
+Subject: dvbdev: fix illegal re-usage of fileoperations struct
+To: stable@kernel.org
+Cc: v4l-dvb maintainer list <v4l-dvb-maintainer@linuxtv.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
+Message-ID: <45E987C4.8040302@linuxtv.org>
+
+From: Marcel Siegert <mws@linuxtv.org>
+
+Arjan van de Ven <arjan@infradead.org> reported an illegal re-usage of
+the fileoperations struct if more than one dvb device (e.g. frontend) is
+present.
+
+This patch fixes this issue.
+
+It allocates a new fileoperations struct each time a device is
+registered and copies the default template fileops.
+
+(backported from commit b61901024776b25ce7b8edc31bb1757c7382a88e)
+
+Signed-off-by: Marcel Siegert <mws@linuxtv.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
+Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/media/dvb/dvb-core/dvbdev.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+--- linux-2.6.20.1.orig/drivers/media/dvb/dvb-core/dvbdev.c
++++ linux-2.6.20.1/drivers/media/dvb/dvb-core/dvbdev.c
+@@ -200,6 +200,8 @@ int dvb_register_device(struct dvb_adapt
+ const struct dvb_device *template, void *priv, int type)
+ {
+ struct dvb_device *dvbdev;
++ struct file_operations *dvbdevfops;
++
+ int id;
+
+ if (mutex_lock_interruptible(&dvbdev_register_lock))
+@@ -219,12 +221,22 @@ int dvb_register_device(struct dvb_adapt
+ return -ENOMEM;
+ }
+
++ dvbdevfops = kzalloc(sizeof(struct file_operations), GFP_KERNEL);
++
++ if (!dvbdevfops) {
++ kfree (dvbdev);
++ mutex_unlock(&dvbdev_register_lock);
++ return -ENOMEM;
++ }
++
+ memcpy(dvbdev, template, sizeof(struct dvb_device));
+ dvbdev->type = type;
+ dvbdev->id = id;
+ dvbdev->adapter = adap;
+ dvbdev->priv = priv;
++ dvbdev->fops = dvbdevfops;
+
++ memcpy(dvbdev->fops, template->fops, sizeof(struct file_operations));
+ dvbdev->fops->owner = adap->module;
+
+ list_add_tail (&dvbdev->list_head, &adap->device_list);
+@@ -252,6 +264,7 @@ void dvb_unregister_device(struct dvb_de
+ dvbdev->type, dvbdev->id)));
+
+ list_del (&dvbdev->list_head);
++ kfree (dvbdev->fops);
+ kfree (dvbdev);
+ }
+ EXPORT_SYMBOL(dvb_unregister_device);
--- /dev/null
+From tglx@linutronix.de Wed Feb 21 16:28:30 2007
+From: Thomas Gleixner <tglx@linutronix.de>
+Date: Thu, 22 Feb 2007 01:33:29 +0100
+Subject: Fix posix-cpu-timer breakage caused by stale p->last_ran value
+To: Andrew Morton <akpm@linux-foundation.org>
+Cc: Ingo Molnar <mingo@elte.hu>, john stultz <johnstul@us.ibm.com>, Roman Zippel <zippel@linux-m68k.org>, Mike Galbraith <efault@gmx.de>, Ken Chen <kenneth.w.chen@intel.com>, balducci@units.it, Greg KH <greg@kroah.com>
+Message-ID: <1172104409.25076.165.camel@localhost.localdomain>
+
+From: Thomas Gleixner <tglx@linutronix.de>
+
+Problem description at:
+http://bugzilla.kernel.org/show_bug.cgi?id=8048
+
+Commit b18ec80396834497933d77b81ec0918519f4e2a7
+ [PATCH] sched: improve migration accuracy
+optimized the scheduler time calculations, but broke posix-cpu-timers.
+
+The problem is that the p->last_ran value is not updated after a context
+switch. So a subsequent call to current_sched_time() calculates with a
+stale p->last_ran value, i.e. accounts the full time, which the task was
+scheduled away.
+
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Acked-by: Ingo Molnar <mingo@elte.hu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ kernel/sched.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- linux-2.6.20.1.orig/kernel/sched.c
++++ linux-2.6.20.1/kernel/sched.c
+@@ -3547,7 +3547,7 @@ switch_tasks:
+
+ sched_info_switch(prev, next);
+ if (likely(prev != next)) {
+- next->timestamp = now;
++ next->timestamp = next->last_ran = now;
+ rq->nr_switches++;
+ rq->curr = next;
+ ++*switch_count;
--- /dev/null
+From stable-bounces@linux.kernel.org Fri Feb 23 13:55:02 2007
+From: Hugh Dickins <hugh@veritas.com>
+Date: Fri, 23 Feb 2007 21:53:49 +0000 (GMT)
+Subject: fix umask when noACL kernel meets extN tuned for ACLs
+To: Greg KH <greg@kroah.com>
+Cc: Chris Wright <chrisw@sous-sol.org>, Tigran Aivazian <tigran@aivazian.fsnet.co.uk>, stable@kernel.org, Andreas Gruenbacher <agruen@suse.de>
+Message-ID: <Pine.LNX.4.64.0702232152330.11377@blonde.wat.veritas.com>
+
+From: Hugh Dickins <hugh@veritas.com>
+
+Fix insecure default behaviour reported by Tigran Aivazian: if an ext2
+or ext3 or ext4 filesystem is tuned to mount with "acl", but mounted by
+a kernel built without ACL support, then umask was ignored when creating
+inodes - though root or user has umask 022, touch creates files as 0666,
+and mkdir creates directories as 0777.
+
+This appears to have worked right until 2.6.11, when a fix to the default
+mode on symlinks (always 0777) assumed VFS applies umask: which it does,
+unless the mount is marked for ACLs; but ext[234] set MS_POSIXACL in
+s_flags according to s_mount_opt set according to def_mount_opts.
+
+We could revert to the 2.6.10 ext[234]_init_acl (adding an S_ISLNK test);
+but other filesystems only set MS_POSIXACL when ACLs are configured. We
+could fix this at another level; but it seems most robust to avoid setting
+the s_mount_opt flag in the first place (at the expense of more ifdefs).
+
+Likewise don't set the XATTR_USER flag when built without XATTR support.
+
+Signed-off-by: Hugh Dickins <hugh@veritas.com>
+Acked-by: Andreas Gruenbacher <agruen@suse.de>
+Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/ext2/super.c | 4 ++++
+ fs/ext3/super.c | 4 ++++
+ fs/ext4/super.c | 4 ++++
+ 3 files changed, 12 insertions(+)
+
+--- linux-2.6.20.1.orig/fs/ext2/super.c
++++ linux-2.6.20.1/fs/ext2/super.c
+@@ -708,10 +708,14 @@ static int ext2_fill_super(struct super_
+ set_opt(sbi->s_mount_opt, GRPID);
+ if (def_mount_opts & EXT2_DEFM_UID16)
+ set_opt(sbi->s_mount_opt, NO_UID32);
++#ifdef CONFIG_EXT2_FS_XATTR
+ if (def_mount_opts & EXT2_DEFM_XATTR_USER)
+ set_opt(sbi->s_mount_opt, XATTR_USER);
++#endif
++#ifdef CONFIG_EXT2_FS_POSIX_ACL
+ if (def_mount_opts & EXT2_DEFM_ACL)
+ set_opt(sbi->s_mount_opt, POSIX_ACL);
++#endif
+
+ if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC)
+ set_opt(sbi->s_mount_opt, ERRORS_PANIC);
+--- linux-2.6.20.1.orig/fs/ext3/super.c
++++ linux-2.6.20.1/fs/ext3/super.c
+@@ -1459,10 +1459,14 @@ static int ext3_fill_super (struct super
+ set_opt(sbi->s_mount_opt, GRPID);
+ if (def_mount_opts & EXT3_DEFM_UID16)
+ set_opt(sbi->s_mount_opt, NO_UID32);
++#ifdef CONFIG_EXT3_FS_XATTR
+ if (def_mount_opts & EXT3_DEFM_XATTR_USER)
+ set_opt(sbi->s_mount_opt, XATTR_USER);
++#endif
++#ifdef CONFIG_EXT3_FS_POSIX_ACL
+ if (def_mount_opts & EXT3_DEFM_ACL)
+ set_opt(sbi->s_mount_opt, POSIX_ACL);
++#endif
+ if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_DATA)
+ sbi->s_mount_opt |= EXT3_MOUNT_JOURNAL_DATA;
+ else if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_ORDERED)
+--- linux-2.6.20.1.orig/fs/ext4/super.c
++++ linux-2.6.20.1/fs/ext4/super.c
+@@ -1518,10 +1518,14 @@ static int ext4_fill_super (struct super
+ set_opt(sbi->s_mount_opt, GRPID);
+ if (def_mount_opts & EXT4_DEFM_UID16)
+ set_opt(sbi->s_mount_opt, NO_UID32);
++#ifdef CONFIG_EXT4DEV_FS_XATTR
+ if (def_mount_opts & EXT4_DEFM_XATTR_USER)
+ set_opt(sbi->s_mount_opt, XATTR_USER);
++#endif
++#ifdef CONFIG_EXT4DEV_FS_POSIX_ACL
+ if (def_mount_opts & EXT4_DEFM_ACL)
+ set_opt(sbi->s_mount_opt, POSIX_ACL);
++#endif
+ if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA)
+ sbi->s_mount_opt |= EXT4_MOUNT_JOURNAL_DATA;
+ else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED)
--- /dev/null
+From stable-bounces@linux.kernel.org Sat Feb 24 05:32:07 2007
+From: Tejun Heo <htejun@gmail.com>
+Date: Sat, 24 Feb 2007 22:30:36 +0900
+Subject: sata_sil: ignore and clear spurious IRQs while executing commands by polling
+To: Jeff Garzik <jeff@garzik.org>, <linux-ide@vger.kernel.org>
+Cc: stable@kernel.org
+Message-ID: <20070224133036.GB20322@htj.dyndns.org>
+Content-Disposition: inline
+
+
+sata_sil used to trigger HSM error if IRQ occurs during polling
+command. This didn't matter because polling wasn't used in sata_sil.
+However, as of 2.6.20, all IDENTIFYs are performed by polling and
+device detection sometimes fails due to spurious IRQ. This patch
+makes sata_sil ignore and clear spurious IRQ while executing commands
+by polling.
+
+This fixes bug#7996 and IMHO should also be included in -stable.
+
+Signed-off-by: Tejun Heo <htejun@gmail.com>
+Cc: Jeff Garzik <jeff@garzik.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/ata/sata_sil.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- linux-2.6.20.1.orig/drivers/ata/sata_sil.c
++++ linux-2.6.20.1/drivers/ata/sata_sil.c
+@@ -383,9 +383,15 @@ static void sil_host_intr(struct ata_por
+ goto freeze;
+ }
+
+- if (unlikely(!qc || qc->tf.ctl & ATA_NIEN))
++ if (unlikely(!qc))
+ goto freeze;
+
++ if (unlikely(qc->tf.flags & ATA_TFLAG_POLLING)) {
++ /* this sometimes happens, just clear IRQ */
++ ata_chk_status(ap);
++ return;
++ }
++
+ /* Check whether we are expecting interrupt in this state */
+ switch (ap->hsm_task_state) {
+ case HSM_ST_FIRST:
i386-fix-broken-config_compat_vdso-on-i386.patch
bcm43xx-fix-for-4309.patch
md-fix-raid10-recovery-problem.patch
+dvbdev-fix-illegal-re-usage-of-fileoperations-struct.patch
+v4l-pvrusb2-fix-video-corruption-on-stream-start.patch
+v4l-pvrusb2-handle-larger-cx2341x-firmware-images.patch
+dvb-cxusb-fix-firmware-patch-for-big-endian-systems.patch
+dvb-digitv-open-nxt6000-i2c_gate-for-tded4-tuner-handling.patch
+v4l-fix-cx25840-firmware-loading.patch
+v4l-cx88-blackbird-allow-usage-of-376836-and-262144-sized-firmware-images.patch
+fix-posix-cpu-timer-breakage-caused-by-stale-p-last_ran-value.patch
+swsusp-fix-possible-oops-in-userland-interface.patch
+sata_sil-ignore-and-clear-spurious-irqs-while-executing-commands-by-polling.patch
+fix-umask-when-noacl-kernel-meets-extn-tuned-for-acls.patch
+uml-fix-2.6.20-hang.patch
--- /dev/null
+From stable-bounces@linux.kernel.org Sat Feb 24 14:15:16 2007
+From: "Rafael J. Wysocki" <rjw@sisk.pl>
+Date: Sat, 24 Feb 2007 23:06:43 +0100
+Subject: swsusp: Fix possible oops in userland interface
+To: stable@kernel.org
+Cc: Stefan Seyfried <seife@suse.de>, Pavel Machek <pavel@ucw.cz>
+Message-ID: <200702242306.44445.rjw@sisk.pl>
+Content-Disposition: inline
+
+From: Stefan Seyfried <seife@suse.de>
+
+Fix the Oops occuring when SNAPSHOT_PMOPS or SNAPSHOT_S2RAM ioctl is called on
+a system without pm_ops defined (eg. a non-ACPI kernel on x86 PC).
+
+Signed-off-by: Stefan Seyfried <seife@suse.de>
+Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
+Acked-by: Pavel Machek <pavel@ucw.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ kernel/power/user.c | 19 ++++++++++++-------
+ 1 file changed, 12 insertions(+), 7 deletions(-)
+
+--- linux-2.6.20.1.orig/kernel/power/user.c
++++ linux-2.6.20.1/kernel/power/user.c
+@@ -292,7 +292,7 @@ static int snapshot_ioctl(struct inode *
+ break;
+ }
+
+- if (pm_ops->prepare) {
++ if (pm_ops && pm_ops->prepare) {
+ error = pm_ops->prepare(PM_SUSPEND_MEM);
+ if (error)
+ goto OutS3;
+@@ -311,7 +311,7 @@ static int snapshot_ioctl(struct inode *
+ device_resume();
+ }
+ resume_console();
+- if (pm_ops->finish)
++ if (pm_ops && pm_ops->finish)
+ pm_ops->finish(PM_SUSPEND_MEM);
+
+ OutS3:
+@@ -322,20 +322,25 @@ static int snapshot_ioctl(struct inode *
+ switch (arg) {
+
+ case PMOPS_PREPARE:
+- if (pm_ops->prepare) {
++ if (pm_ops && pm_ops->prepare)
+ error = pm_ops->prepare(PM_SUSPEND_DISK);
+- }
++ else
++ error = -ENOSYS;
+ break;
+
+ case PMOPS_ENTER:
+ kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
+- error = pm_ops->enter(PM_SUSPEND_DISK);
++ if (pm_ops && pm_ops->enter)
++ error = pm_ops->enter(PM_SUSPEND_DISK);
++ else
++ error = -ENOSYS;
+ break;
+
+ case PMOPS_FINISH:
+- if (pm_ops && pm_ops->finish) {
++ if (pm_ops && pm_ops->finish)
+ pm_ops->finish(PM_SUSPEND_DISK);
+- }
++ else
++ error = -ENOSYS;
+ break;
+
+ default:
--- /dev/null
+From stable-bounces@linux.kernel.org Thu Feb 22 08:58:01 2007
+From: Jeff Dike <jdike@addtoit.com>
+Date: Thu, 22 Feb 2007 11:48:38 -0500
+Subject: UML - Fix 2.6.20 hang
+To: stable@kernel.org, linux-kernel@vger.kernel.org
+Cc: Blaisorblade <blaisorblade@yahoo.it>, user-mode-linux-devel@lists.sourceforge.net
+Message-ID: <20070222164838.GA3396@ccure.user-mode-linux.org>
+Content-Disposition: inline
+
+From: Jeff Dike <jdike@addtoit.com>
+
+A previous cleanup misused need_poll, which had a fairly broken
+interface. It implemented a growable array, changing the used
+elements count itself, but leaving it up to the caller to fill in the
+actual elements, including the entire array if the array had to be
+reallocated. This worked because the previous users were switching
+between two such structures, and the elements were copied from the
+inactive array to the active array after making sure the active array
+had enough room.
+
+maybe_sigio_broken was made to use need_poll, but it was operating on
+a single array, so when the buffer was reallocated, the previous
+contents were lost.
+
+This patch makes need_poll implement more sane semantics. It merely
+assures that the array is of the proper size and that the contents are
+preserved. It is up to the caller to adjust the used elements count
+and to ensure that the proper elements are resent.
+
+This manifested itself as a hang in 2.6.20 as the uninitialized buffer
+convinced UML that one of its own file descriptors didn't support
+SIGIO and needed to be watched by poll in a separate thread. The
+result was an interrupt flood as control traffic over this descriptor
+sparked interrupts, which resulted in more control traffic, ad nauseum.
+
+Signed-off-by: Jeff Dike <jdike@addtoit.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/um/os-Linux/sigio.c | 38 ++++++++++++++++++++------------------
+ 1 file changed, 20 insertions(+), 18 deletions(-)
+
+--- linux-2.6.20.1.orig/arch/um/os-Linux/sigio.c
++++ linux-2.6.20.1/arch/um/os-Linux/sigio.c
+@@ -97,20 +97,22 @@ static int write_sigio_thread(void *unus
+
+ static int need_poll(struct pollfds *polls, int n)
+ {
+- if(n <= polls->size){
+- polls->used = n;
++ struct pollfd *new;
++
++ if(n <= polls->size)
+ return 0;
+- }
+- kfree(polls->poll);
+- polls->poll = um_kmalloc_atomic(n * sizeof(struct pollfd));
+- if(polls->poll == NULL){
++
++ new = um_kmalloc_atomic(n * sizeof(struct pollfd));
++ if(new == NULL){
+ printk("need_poll : failed to allocate new pollfds\n");
+- polls->size = 0;
+- polls->used = 0;
+ return -ENOMEM;
+ }
++
++ memcpy(new, polls->poll, polls->used * sizeof(struct pollfd));
++ kfree(polls->poll);
++
++ polls->poll = new;
+ polls->size = n;
+- polls->used = n;
+ return 0;
+ }
+
+@@ -171,15 +173,15 @@ int add_sigio_fd(int fd)
+ goto out;
+ }
+
+- n = current_poll.used + 1;
+- err = need_poll(&next_poll, n);
++ n = current_poll.used;
++ err = need_poll(&next_poll, n + 1);
+ if(err)
+ goto out;
+
+- for(i = 0; i < current_poll.used; i++)
+- next_poll.poll[i] = current_poll.poll[i];
+-
+- next_poll.poll[n - 1] = *p;
++ memcpy(next_poll.poll, current_poll.poll,
++ current_poll.used * sizeof(struct pollfd));
++ next_poll.poll[n] = *p;
++ next_poll.used = n + 1;
+ update_thread();
+ out:
+ sigio_unlock();
+@@ -214,6 +216,7 @@ int ignore_sigio_fd(int fd)
+ if(p->fd != fd)
+ next_poll.poll[n++] = *p;
+ }
++ next_poll.used = current_poll.used - 1;
+
+ update_thread();
+ out:
+@@ -331,10 +334,9 @@ void maybe_sigio_broken(int fd, int read
+
+ sigio_lock();
+ err = need_poll(&all_sigio_fds, all_sigio_fds.used + 1);
+- if(err){
+- printk("maybe_sigio_broken - failed to add pollfd\n");
++ if(err)
+ goto out;
+- }
++
+ all_sigio_fds.poll[all_sigio_fds.used++] =
+ ((struct pollfd) { .fd = fd,
+ .events = read ? POLLIN : POLLOUT,
--- /dev/null
+From stable-bounces@linux.kernel.org Sat Mar 3 06:37:57 2007
+From: Michael Krufky <mkrufky@linuxtv.org>
+Date: Sat, 03 Mar 2007 09:36:15 -0500
+Subject: V4L: cx88-blackbird: allow usage of 376836 and 262144 sized firmware images
+To: stable@kernel.org
+Cc: v4l-dvb maintainer list <v4l-dvb-maintainer@linuxtv.org>
+Message-ID: <45E987DF.3060903@linuxtv.org>
+
+
+From: Michael Krufky <mkrufky@linuxtv.org>
+
+This updates the cx88-blackbird driver to be able to use the new cx23416
+firmware image released by Hauppauge Computer Works, while retaining
+compatibility with the older firmware images.
+cx2341x firmware can be downloaded at: http://dl.ivtvdriver.org/ivtv/firmware/
+
+(cherry picked from commit af70dbd3346999570db73b3bc3d4f7b7c004f2ea)
+
+Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/media/video/cx88/cx88-blackbird.c | 14 +++++++++-----
+ drivers/media/video/cx88/cx88.h | 1 +
+ 2 files changed, 10 insertions(+), 5 deletions(-)
+
+--- linux-2.6.20.1.orig/drivers/media/video/cx88/cx88-blackbird.c
++++ linux-2.6.20.1/drivers/media/video/cx88/cx88-blackbird.c
+@@ -53,7 +53,8 @@ MODULE_PARM_DESC(debug,"enable debug mes
+
+ /* ------------------------------------------------------------------ */
+
+-#define BLACKBIRD_FIRM_IMAGE_SIZE 256*1024
++#define OLD_BLACKBIRD_FIRM_IMAGE_SIZE 262144
++#define BLACKBIRD_FIRM_IMAGE_SIZE 376836
+
+ /* defines below are from ivtv-driver.h */
+
+@@ -401,7 +402,7 @@ static int blackbird_find_mailbox(struct
+ u32 value;
+ int i;
+
+- for (i = 0; i < BLACKBIRD_FIRM_IMAGE_SIZE; i++) {
++ for (i = 0; i < dev->fw_size; i++) {
+ memory_read(dev->core, i, &value);
+ if (value == signature[signaturecnt])
+ signaturecnt++;
+@@ -449,12 +450,15 @@ static int blackbird_load_firmware(struc
+ return -1;
+ }
+
+- if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) {
+- dprintk(0, "ERROR: Firmware size mismatch (have %zd, expected %d)\n",
+- firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE);
++ if ((firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) &&
++ (firmware->size != OLD_BLACKBIRD_FIRM_IMAGE_SIZE)) {
++ dprintk(0, "ERROR: Firmware size mismatch (have %zd, expected %d or %d)\n",
++ firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE,
++ OLD_BLACKBIRD_FIRM_IMAGE_SIZE);
+ release_firmware(firmware);
+ return -1;
+ }
++ dev->fw_size = firmware->size;
+
+ if (0 != memcmp(firmware->data, magic, 8)) {
+ dprintk(0, "ERROR: Firmware magic mismatch, wrong file?\n");
+--- linux-2.6.20.1.orig/drivers/media/video/cx88/cx88.h
++++ linux-2.6.20.1/drivers/media/video/cx88/cx88.h
+@@ -459,6 +459,7 @@ struct cx8802_dev {
+ u32 mailbox;
+ int width;
+ int height;
++ int fw_size;
+
+ /* for dvb only */
+ struct videobuf_dvb dvb;
--- /dev/null
+From stable-bounces@linux.kernel.org Sat Mar 3 06:37:50 2007
+From: Hans Verkuil <hverkuil@xs4all.nl>
+Date: Sat, 03 Mar 2007 09:36:11 -0500
+Subject: V4L: fix cx25840 firmware loading
+To: stable@kernel.org
+Cc: v4l-dvb maintainer list <v4l-dvb-maintainer@linuxtv.org>
+Message-ID: <45E987DB.1070502@linuxtv.org>
+
+
+From: Hans Verkuil <hverkuil@xs4all.nl>
+Date: Thu, 15 Feb 2007 03:40:34 -0300
+Subject: [PATCH] V4L: fix cx25840 firmware loading
+
+Due to changes in the i2c handling in 2.6.20 this cx25840 bug surfaced,
+causing the firmware load to fail for the ivtv driver. The correct
+sequence is to first attach the i2c client, then use the client's
+device to load the firmware.
+
+(cherry picked from commit d55c7aec666658495e5b57a6b194c8c2a1ac255f)
+
+Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
+Acked-by: Mike Isely <isely@pobox.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
+Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/media/video/cx25840/cx25840-core.c | 4 ++--
+ drivers/media/video/cx25840/cx25840-firmware.c | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+--- linux-2.6.20.1.orig/drivers/media/video/cx25840/cx25840-core.c
++++ linux-2.6.20.1/drivers/media/video/cx25840/cx25840-core.c
+@@ -907,13 +907,13 @@ static int cx25840_detect_client(struct
+ state->vbi_line_offset = 8;
+ state->id = id;
+
++ i2c_attach_client(client);
++
+ if (state->is_cx25836)
+ cx25836_initialize(client);
+ else
+ cx25840_initialize(client, 1);
+
+- i2c_attach_client(client);
+-
+ return 0;
+ }
+
+--- linux-2.6.20.1.orig/drivers/media/video/cx25840/cx25840-firmware.c
++++ linux-2.6.20.1/drivers/media/video/cx25840/cx25840-firmware.c
+@@ -37,7 +37,7 @@
+ */
+ #define FWSEND 48
+
+-#define FWDEV(x) &((x)->adapter->dev)
++#define FWDEV(x) &((x)->dev)
+
+ static char *firmware = FWFILE;
+
--- /dev/null
+From stable-bounces@linux.kernel.org Sat Mar 3 06:37:14 2007
+From: Michael Krufky <mkrufky@linuxtv.org>
+Date: Sat, 03 Mar 2007 09:35:54 -0500
+Subject: V4L: pvrusb2: Fix video corruption on stream start
+To: stable@kernel.org
+Cc: v4l-dvb maintainer list <v4l-dvb-maintainer@linuxtv.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
+Message-ID: <45E987CA.90407@linuxtv.org>
+
+From: Mike Isely <isely@pobox.com>
+
+This introduces some extra cx23416 commands when streaming is
+started. The addition of these commands fix random sporadic video
+corruption that can take place when the video stream is temporarily
+disrupted through loss of signal (e.g. changing the channel in the RF
+tuner).
+
+This fix is already in the upstream driver source and has proven
+itself there; this is a backport for the 2.6.20.y kernel series.
+
+(backported from commit 6fe7d2c4660174110c6872cacc4fc2acb6e00acf)
+
+Signed-off-by: Mike Isely <isely@pobox.com>
+Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/media/video/pvrusb2/pvrusb2-encoder.c | 40 ++++++++++++++++++++++++++
+ 1 file changed, 40 insertions(+)
+
+--- linux-2.6.20.1.orig/drivers/media/video/pvrusb2/pvrusb2-encoder.c
++++ linux-2.6.20.1/drivers/media/video/pvrusb2/pvrusb2-encoder.c
+@@ -288,6 +288,44 @@ static int pvr2_encoder_vcmd(struct pvr2
+ return pvr2_encoder_cmd(hdw,cmd,args,0,data);
+ }
+
++
++/* This implements some extra setup for the encoder that seems to be
++ specific to the PVR USB2 hardware. */
++int pvr2_encoder_prep_config(struct pvr2_hdw *hdw)
++{
++ int ret = 0;
++ int encMisc3Arg = 0;
++
++ /* Mike Isely <isely@pobox.com> 22-Feb-2007 The windows driver
++ sends the following list of ENC_MISC commands (for both
++ 24xxx and 29xxx devices). Meanings are not entirely clear,
++ however without the ENC_MISC(3,encMisc3Arg) command then we risk
++ random perpetual video corruption whenever the video input
++ breaks up for a moment (like when switching channels). */
++
++
++ /* This ENC_MISC(3,encMisc3Arg) command is critical - without
++ it there will eventually be video corruption. Also, the
++ 29xxx case is strange - the Windows driver is passing 1
++ regardless of device type but if we have 1 for 29xxx device
++ the video turns sluggish. */
++ switch (hdw->hdw_type) {
++ case PVR2_HDW_TYPE_24XXX: encMisc3Arg = 1; break;
++ case PVR2_HDW_TYPE_29XXX: encMisc3Arg = 0; break;
++ default: break;
++ }
++ ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 3,
++ encMisc3Arg,0,0);
++
++ ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 8,0,0,0);
++
++ ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 0,3,0,0);
++ ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4,15,0,0,0);
++
++ return ret;
++}
++
++
+ int pvr2_encoder_configure(struct pvr2_hdw *hdw)
+ {
+ int ret;
+@@ -302,6 +340,8 @@ int pvr2_encoder_configure(struct pvr2_h
+
+ ret = 0;
+
++ ret |= pvr2_encoder_prep_config(hdw);
++
+ if (!ret) ret = pvr2_encoder_vcmd(
+ hdw,CX2341X_ENC_SET_NUM_VSYNC_LINES, 2,
+ 0xf0, 0xf0);
--- /dev/null
+From stable-bounces@linux.kernel.org Sat Mar 3 06:37:30 2007
+From: Michael Krufky <mkrufky@linuxtv.org>
+Date: Sat, 03 Mar 2007 09:36:02 -0500
+Subject: V4L: pvrusb2: Handle larger cx2341x firmware images
+To: stable@kernel.org
+Cc: v4l-dvb maintainer list <v4l-dvb-maintainer@linuxtv.org>
+Message-ID: <45E987D2.6050603@linuxtv.org>
+
+From: Mike Isely <isely@pobox.com>
+
+Rework the cx23416 firmware loader so that it longer requires the
+firmware size to be a multiple of 8KB. Until recently all cx2341x
+firmware images were exactly 256KB, but newer firmware is larger than
+that and also appears to have arbitrary size. We still must check
+against a multiple of 4 bytes (because the cx23416 itself uses a 32
+bit word size).
+
+This fix is already in the upstream driver source and has proven
+itself there; this is a backport for the 2.6.20.y kernel series.
+
+(backported from commit 90060d32ca0a941b158994f78e60d0381871c84b)
+
+Signed-off-by: Mike Isely <isely@pobox.com>
+Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/media/video/pvrusb2/pvrusb2-hdw.c | 31 ++++++++++++++++--------------
+ 1 file changed, 17 insertions(+), 14 deletions(-)
+
+--- linux-2.6.20.1.orig/drivers/media/video/pvrusb2/pvrusb2-hdw.c
++++ linux-2.6.20.1/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+@@ -1041,7 +1041,7 @@ int pvr2_upload_firmware2(struct pvr2_hd
+ {
+ const struct firmware *fw_entry = NULL;
+ void *fw_ptr;
+- unsigned int pipe, fw_len, fw_done;
++ unsigned int pipe, fw_len, fw_done, bcnt, icnt;
+ int actual_length;
+ int ret = 0;
+ int fwidx;
+@@ -1093,11 +1093,11 @@ int pvr2_upload_firmware2(struct pvr2_hd
+
+ fw_len = fw_entry->size;
+
+- if (fw_len % FIRMWARE_CHUNK_SIZE) {
++ if (fw_len % sizeof(u32)) {
+ pvr2_trace(PVR2_TRACE_ERROR_LEGS,
+ "size of %s firmware"
+- " must be a multiple of 8192B",
+- fw_files[fwidx]);
++ " must be a multiple of %zu bytes",
++ fw_files[fwidx],sizeof(u32));
+ release_firmware(fw_entry);
+ return -1;
+ }
+@@ -1112,18 +1112,21 @@ int pvr2_upload_firmware2(struct pvr2_hd
+
+ pipe = usb_sndbulkpipe(hdw->usb_dev, PVR2_FIRMWARE_ENDPOINT);
+
+- for (fw_done = 0 ; (fw_done < fw_len) && !ret ;
+- fw_done += FIRMWARE_CHUNK_SIZE ) {
+- int i;
+- memcpy(fw_ptr, fw_entry->data + fw_done, FIRMWARE_CHUNK_SIZE);
+- /* Usbsnoop log shows that we must swap bytes... */
+- for (i = 0; i < FIRMWARE_CHUNK_SIZE/4 ; i++)
+- ((u32 *)fw_ptr)[i] = ___swab32(((u32 *)fw_ptr)[i]);
++ fw_done = 0;
++ for (fw_done = 0; fw_done < fw_len;) {
++ bcnt = fw_len - fw_done;
++ if (bcnt > FIRMWARE_CHUNK_SIZE) bcnt = FIRMWARE_CHUNK_SIZE;
++ memcpy(fw_ptr, fw_entry->data + fw_done, bcnt);
++ /* Usbsnoop log shows that we must swap bytes... */
++ for (icnt = 0; icnt < bcnt/4 ; icnt++)
++ ((u32 *)fw_ptr)[icnt] =
++ ___swab32(((u32 *)fw_ptr)[icnt]);
+
+- ret |= usb_bulk_msg(hdw->usb_dev, pipe, fw_ptr,
+- FIRMWARE_CHUNK_SIZE,
++ ret |= usb_bulk_msg(hdw->usb_dev, pipe, fw_ptr,bcnt,
+ &actual_length, HZ);
+- ret |= (actual_length != FIRMWARE_CHUNK_SIZE);
++ ret |= (actual_length != bcnt);
++ if (ret) break;
++ fw_done += bcnt;
+ }
+
+ trace_firmware("upload of %s : %i / %i ",