[kernel/f14/master] backport fallout fixups

Jarod Wilson jwilson at fedoraproject.org
Tue Jan 18 15:36:19 UTC 2011


commit 0252aa3de34b92c51c448a15baa6864f2aff818a
Author: Jarod Wilson <jarod at redhat.com>
Date:   Tue Jan 18 10:35:58 2011 -0500

    backport fallout fixups
    
    Signed-off-by: Jarod Wilson <jarod at redhat.com>

 config-generic                 |    1 +
 kernel.spec                    |   16 +-
 linux-2.6-v4l-dvb-update.patch | 1282 ++++++++++++++++++++++++++--------------
 linux-2.6-vzalloc.patch        |  196 ++++++
 4 files changed, 1034 insertions(+), 461 deletions(-)
---
diff --git a/config-generic b/config-generic
index b16c80b..75fe3c3 100644
--- a/config-generic
+++ b/config-generic
@@ -2530,6 +2530,7 @@ CONFIG_DVB_LGS8GL5=m
 CONFIG_DVB_DUMMY_FE=m
 CONFIG_DVB_FIREDTV=m
 CONFIG_DVB_NGENE=m
+CONFIG_DVB_CXD2099=m
 
 #
 # Supported SAA7146 based PCI Adapters
diff --git a/kernel.spec b/kernel.spec
index b1dccd9..c069063 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -718,6 +718,9 @@ Patch2201: linux-2.6-firewire-git-pending.patch
 # silence the ACPI blacklist code
 Patch2802: linux-2.6-silence-acpi-blacklist.patch
 
+# Drop-in backport of upstream vzalloc additions, used by the v4l/dvb bits
+Patch2805: linux-2.6-vzalloc.patch
+
 # media patches
 Patch2899: linux-2.6-v4l-dvb-update.patch
 Patch2900: linux-2.6-v4l-dvb-fixes.patch
@@ -1431,17 +1434,20 @@ ApplyPatch efifb-check-that-the-base-addr-is-plausible-on-pci-systems.patch
 # silence the ACPI blacklist code
 ApplyPatch linux-2.6-silence-acpi-blacklist.patch
 
+# Backport of upstream vzalloc functions, used by the v4l/dvb bits
+ApplyPatch linux-2.6-vzalloc.patch
+
 # V4L/DVB updates/fixes/experimental drivers
 #  apply if non-empty
-ApplyOptionalPatch linux-2.6-v4l-dvb-update.patch
-ApplyOptionalPatch linux-2.6-v4l-dvb-fixes.patch
-ApplyOptionalPatch linux-2.6-v4l-dvb-experimental.patch
+#ApplyOptionalPatch linux-2.6-v4l-dvb-update.patch
+#ApplyOptionalPatch linux-2.6-v4l-dvb-fixes.patch
+#ApplyOptionalPatch linux-2.6-v4l-dvb-experimental.patch
 
 # one-off non-upstream patch, since ir-keytable doesn't work yet
-ApplyPatch imon-default-proto-modparam.patch
+#ApplyPatch imon-default-proto-modparam.patch
 
 # bz #575873
-ApplyPatch flexcop-fix-xlate_proc_name-warning.patch
+#ApplyPatch flexcop-fix-xlate_proc_name-warning.patch
 
 # Fix DMA bug on via-velocity
 ApplyPatch linux-2.6-via-velocity-dma-fix.patch
diff --git a/linux-2.6-v4l-dvb-update.patch b/linux-2.6-v4l-dvb-update.patch
index 5549099..364cefe 100644
--- a/linux-2.6-v4l-dvb-update.patch
+++ b/linux-2.6-v4l-dvb-update.patch
@@ -4206,17 +4206,7 @@ Index: linux-2.6.35.x86_64/drivers/media/dvb/dvb-core/dvb_net.c
  #include <linux/uio.h>
  #include <asm/uaccess.h>
  #include <linux/crc32.h>
-@@ -1330,7 +1329,8 @@ static int dvb_net_remove_if(struct dvb_
- 		return -EBUSY;
- 
- 	dvb_net_stop(net);
--	flush_scheduled_work();
-+	flush_work_sync(&priv->set_multicast_list_wq);
-+	flush_work_sync(&priv->restart_net_feed_wq);
- 	printk("dvb_net: removed network interface %s\n", net->name);
- 	unregister_netdev(net);
- 	dvbnet->state[num]=0;
-@@ -1445,13 +1445,7 @@ static int dvb_net_do_ioctl(struct file 
+@@ -1445,13 +1444,7 @@ static int dvb_net_do_ioctl(struct file 
  static long dvb_net_ioctl(struct file *file,
  	      unsigned int cmd, unsigned long arg)
  {
@@ -4231,7 +4221,7 @@ Index: linux-2.6.35.x86_64/drivers/media/dvb/dvb-core/dvb_net.c
  }
  
  static int dvb_net_close(struct inode *inode, struct file *file)
-@@ -1475,6 +1469,7 @@ static const struct file_operations dvb_
+@@ -1475,6 +1468,7 @@ static const struct file_operations dvb_
  	.unlocked_ioctl = dvb_net_ioctl,
  	.open =	dvb_generic_open,
  	.release = dvb_net_close,
@@ -11438,14 +11428,14 @@ Index: linux-2.6.35.x86_64/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
  
  	d->state |= DVB_USB_STATE_REMOTE;
  
-@@ -219,9 +313,11 @@ int dvb_usb_remote_init(struct dvb_usb_d
+@@ -219,9 +313,12 @@ int dvb_usb_remote_init(struct dvb_usb_d
  int dvb_usb_remote_exit(struct dvb_usb_device *d)
  {
  	if (d->state & DVB_USB_STATE_REMOTE) {
 -		cancel_rearming_delayed_work(&d->rc_query_work);
--		flush_scheduled_work();
--		input_unregister_device(d->rc_input_dev);
 +		cancel_delayed_work_sync(&d->rc_query_work);
+ 		flush_scheduled_work();
+-		input_unregister_device(d->rc_input_dev);
 +		if (d->props.rc.mode == DVB_RC_LEGACY)
 +			input_unregister_device(d->input_dev);
 +		else
@@ -11453,7 +11443,7 @@ Index: linux-2.6.35.x86_64/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
  	}
  	d->state &= ~DVB_USB_STATE_REMOTE;
  	return 0;
-@@ -234,7 +330,7 @@ int dvb_usb_nec_rc_key_to_event(struct d
+@@ -234,7 +331,7 @@ int dvb_usb_nec_rc_key_to_event(struct d
  		u8 keybuf[5], u32 *event, int *state)
  {
  	int i;
@@ -11462,7 +11452,7 @@ Index: linux-2.6.35.x86_64/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
  	*event = 0;
  	*state = REMOTE_NO_KEY_PRESSED;
  	switch (keybuf[0]) {
-@@ -247,10 +343,10 @@ int dvb_usb_nec_rc_key_to_event(struct d
+@@ -247,10 +344,10 @@ int dvb_usb_nec_rc_key_to_event(struct d
  				break;
  			}
  			/* See if we can match the raw key code. */
@@ -31755,19 +31745,6 @@ Index: linux-2.6.35.x86_64/drivers/media/dvb/mantis/mantis_dvb.c
  	if (mantis->hwconfig) {
  		result = config->frontend_init(mantis, mantis->fe);
  		if (result < 0) {
-Index: linux-2.6.35.x86_64/drivers/media/dvb/mantis/mantis_evm.c
-===================================================================
---- linux-2.6.35.x86_64.orig/drivers/media/dvb/mantis/mantis_evm.c
-+++ linux-2.6.35.x86_64/drivers/media/dvb/mantis/mantis_evm.c
-@@ -111,7 +111,7 @@ void mantis_evmgr_exit(struct mantis_ca 
- 	struct mantis_pci *mantis = ca->ca_priv;
- 
- 	dprintk(MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
--	flush_scheduled_work();
-+	flush_work_sync(&ca->hif_evm_work);
- 	mantis_hif_exit(ca);
- 	mantis_pcmcia_exit(ca);
- }
 Index: linux-2.6.35.x86_64/drivers/media/dvb/mantis/mantis_i2c.c
 ===================================================================
 --- linux-2.6.35.x86_64.orig/drivers/media/dvb/mantis/mantis_i2c.c
@@ -31981,17 +31958,6 @@ Index: linux-2.6.35.x86_64/drivers/media/dvb/mantis/mantis.mod.c
 +
 +
 +MODULE_INFO(srcversion, "64FF266ECD6822CDFD565F4");
-Index: linux-2.6.35.x86_64/drivers/media/dvb/mantis/mantis_uart.c
-===================================================================
---- linux-2.6.35.x86_64.orig/drivers/media/dvb/mantis/mantis_uart.c
-+++ linux-2.6.35.x86_64/drivers/media/dvb/mantis/mantis_uart.c
-@@ -182,5 +182,6 @@ void mantis_uart_exit(struct mantis_pci 
- {
- 	/* disable interrupt */
- 	mmwrite(mmread(MANTIS_UART_CTL) & 0xffef, MANTIS_UART_CTL);
-+	flush_work_sync(&mantis->uart_work);
- }
- EXPORT_SYMBOL_GPL(mantis_uart_exit);
 Index: linux-2.6.35.x86_64/drivers/media/dvb/mantis/mantis_vp1033.c
 ===================================================================
 --- linux-2.6.35.x86_64.orig/drivers/media/dvb/mantis/mantis_vp1033.c
@@ -55605,8 +55571,8 @@ Index: linux-2.6.35.x86_64/drivers/media/rc/keymaps/rc-tbs-nec.c
 +	{ 0x8e, KEY_8},
 +	{ 0x8d, KEY_9},
 +	{ 0x92, KEY_0},
-+	{ 0xc0, KEY_10CHANNELSUP},	/* 10+ */
-+	{ 0xd0, KEY_10CHANNELSDOWN},	/* 10- */
++	//{ 0xc0, KEY_10CHANNELSUP},	/* 10+ */
++	//{ 0xd0, KEY_10CHANNELSDOWN},	/* 10- */
 +	{ 0x96, KEY_CHANNELUP},		/* ch+ */
 +	{ 0x91, KEY_CHANNELDOWN},	/* ch- */
 +	{ 0x93, KEY_VOLUMEUP},		/* vol+ */
@@ -66282,22 +66248,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  
  
  unsigned int bttv_num;			/* number of Bt848s in use */
-@@ -190,8 +189,14 @@ static void request_modules(struct bttv 
- 	INIT_WORK(&dev->request_module_wk, request_module_async);
- 	schedule_work(&dev->request_module_wk);
- }
-+
-+static void flush_request_modules(struct bttv *dev)
-+{
-+	flush_work_sync(&dev->request_module_wk);
-+}
- #else
- #define request_modules(dev)
-+#define flush_request_modules(dev)
- #endif /* CONFIG_MODULES */
- 
- 
-@@ -842,7 +847,7 @@ static const struct v4l2_queryctrl *ctrl
+@@ -842,7 +841,7 @@ static const struct v4l2_queryctrl *ctrl
  			 RESOURCE_OVERLAY)
  
  static
@@ -66306,7 +66257,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  {
  	int xbits; /* mutual exclusive resources */
  
-@@ -855,7 +860,6 @@ int check_alloc_btres(struct bttv *btv, 
+@@ -855,7 +854,6 @@ int check_alloc_btres(struct bttv *btv, 
  		xbits |= RESOURCE_VIDEO_READ | RESOURCE_VIDEO_STREAM;
  
  	/* is it free? */
@@ -66314,7 +66265,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	if (btv->resources & xbits) {
  		/* no, someone else uses it */
  		goto fail;
-@@ -885,11 +889,9 @@ int check_alloc_btres(struct bttv *btv, 
+@@ -885,11 +883,9 @@ int check_alloc_btres(struct bttv *btv, 
  	/* it's free, grab it */
  	fh->resources  |= bit;
  	btv->resources |= bit;
@@ -66326,7 +66277,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return 0;
  }
  
-@@ -935,13 +937,12 @@ disclaim_video_lines(struct bttv *btv)
+@@ -935,13 +931,12 @@ disclaim_video_lines(struct bttv *btv)
  }
  
  static
@@ -66341,7 +66292,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	fh->resources  &= ~bits;
  	btv->resources &= ~bits;
  
-@@ -952,8 +953,6 @@ void free_btres(struct bttv *btv, struct
+@@ -952,8 +947,6 @@ void free_btres(struct bttv *btv, struct
  
  	if (0 == (bits & VBI_RESOURCES))
  		disclaim_vbi_lines(btv);
@@ -66350,7 +66301,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  }
  
  /* ----------------------------------------------------------------------- */
-@@ -1682,7 +1681,7 @@ bttv_switch_overlay(struct bttv *btv, st
+@@ -1682,7 +1675,7 @@ bttv_switch_overlay(struct bttv *btv, st
  		kfree(old);
  	}
  	if (NULL == new)
@@ -66359,7 +66310,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	dprintk("switch_overlay: done\n");
  	return retval;
  }
-@@ -1714,28 +1713,20 @@ static int bttv_prepare_buffer(struct vi
+@@ -1714,28 +1707,20 @@ static int bttv_prepare_buffer(struct vi
  
  		/* Make sure tvnorm and vbi_end remain consistent
  		   until we're done. */
@@ -66388,7 +66339,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  		if (width < c.min_scaled_width ||
  		    width > c.max_scaled_width ||
  		    height < c.min_scaled_height)
-@@ -1860,20 +1851,22 @@ static int bttv_s_std(struct file *file,
+@@ -1860,20 +1845,22 @@ static int bttv_s_std(struct file *file,
  	int err;
  
  	err = v4l2_prio_check(&btv->prio, fh->prio);
@@ -66418,7 +66369,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  }
  
  static int bttv_querystd(struct file *file, void *f, v4l2_std_id *id)
-@@ -1893,10 +1886,12 @@ static int bttv_enum_input(struct file *
+@@ -1893,10 +1880,12 @@ static int bttv_enum_input(struct file *
  {
  	struct bttv_fh *fh = priv;
  	struct bttv *btv = fh->btv;
@@ -66434,7 +66385,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  
  	i->type     = V4L2_INPUT_TYPE_CAMERA;
  	i->audioset = 1;
-@@ -1919,10 +1914,11 @@ static int bttv_enum_input(struct file *
+@@ -1919,10 +1908,11 @@ static int bttv_enum_input(struct file *
  			i->status |= V4L2_IN_ST_NO_H_LOCK;
  	}
  
@@ -66449,7 +66400,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  }
  
  static int bttv_g_input(struct file *file, void *priv, unsigned int *i)
-@@ -1931,6 +1927,7 @@ static int bttv_g_input(struct file *fil
+@@ -1931,6 +1921,7 @@ static int bttv_g_input(struct file *fil
  	struct bttv *btv = fh->btv;
  
  	*i = btv->input;
@@ -66457,7 +66408,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return 0;
  }
  
-@@ -1942,15 +1939,17 @@ static int bttv_s_input(struct file *fil
+@@ -1942,15 +1933,17 @@ static int bttv_s_input(struct file *fil
  	int err;
  
  	err = v4l2_prio_check(&btv->prio, fh->prio);
@@ -66481,7 +66432,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return 0;
  }
  
-@@ -1961,23 +1960,24 @@ static int bttv_s_tuner(struct file *fil
+@@ -1961,23 +1954,24 @@ static int bttv_s_tuner(struct file *fil
  	struct bttv *btv = fh->btv;
  	int err;
  
@@ -66515,7 +66466,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  
  	return 0;
  }
-@@ -2001,21 +2001,24 @@ static int bttv_s_frequency(struct file 
+@@ -2001,21 +1995,24 @@ static int bttv_s_frequency(struct file 
  	struct bttv *btv = fh->btv;
  	int err;
  
@@ -66548,7 +66499,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return 0;
  }
  
-@@ -2124,7 +2127,7 @@ bttv_crop_adjust	(struct bttv_crop *    
+@@ -2124,7 +2121,7 @@ bttv_crop_adjust	(struct bttv_crop *    
     also adjust the current cropping parameters to get closer to the
     desired image size. */
  static int
@@ -66557,7 +66508,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  			 __s32 *                        width,
  			 __s32 *                        height,
  			 enum v4l2_field                field,
-@@ -2147,7 +2150,6 @@ limit_scaled_size       (struct bttv_fh 
+@@ -2147,7 +2144,6 @@ limit_scaled_size       (struct bttv_fh 
  
  	/* Make sure tvnorm, vbi_end and the current cropping parameters
  	   remain consistent until we're done. */
@@ -66565,7 +66516,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  
  	b = &bttv_tvnorms[btv->tvnorm].cropcap.bounds;
  
-@@ -2225,7 +2227,6 @@ limit_scaled_size       (struct bttv_fh 
+@@ -2225,7 +2221,6 @@ limit_scaled_size       (struct bttv_fh 
  	rc = 0; /* success */
  
   fail:
@@ -66573,7 +66524,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  
  	return rc;
  }
-@@ -2238,7 +2239,7 @@ limit_scaled_size       (struct bttv_fh 
+@@ -2238,7 +2233,7 @@ limit_scaled_size       (struct bttv_fh 
     may also adjust the current cropping parameters to get closer
     to the desired window size. */
  static int
@@ -66582,7 +66533,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  			 struct v4l2_window *           win,
  			 int                            adjust_size,
  			 int                            adjust_crop)
-@@ -2292,7 +2293,7 @@ verify_window		(struct bttv_fh *        
+@@ -2292,7 +2287,7 @@ verify_window		(struct bttv_fh *        
  	win->w.width -= win->w.left & ~width_mask;
  	win->w.left = (win->w.left - width_mask - 1) & width_mask;
  
@@ -66591,7 +66542,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  			       field, width_mask,
  			       /* width_bias: round down */ 0,
  			       adjust_size, adjust_crop);
-@@ -2303,7 +2304,7 @@ verify_window		(struct bttv_fh *        
+@@ -2303,7 +2298,7 @@ verify_window		(struct bttv_fh *        
  	return 0;
  }
  
@@ -66600,7 +66551,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  			struct v4l2_window *win, int fixup)
  {
  	struct v4l2_clip *clips = NULL;
-@@ -2313,7 +2314,7 @@ static int setup_window(struct bttv_fh *
+@@ -2313,7 +2308,7 @@ static int setup_window(struct bttv_fh *
  		return -EINVAL;
  	if (!(fh->ovfmt->flags & FORMAT_FLAGS_PACKED))
  		return -EINVAL;
@@ -66609,7 +66560,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  			       /* adjust_size */ fixup,
  			       /* adjust_crop */ fixup);
  	if (0 != retval)
-@@ -2332,6 +2333,7 @@ static int setup_window(struct bttv_fh *
+@@ -2332,6 +2327,7 @@ static int setup_window(struct bttv_fh *
  			return -EFAULT;
  		}
  	}
@@ -66617,7 +66568,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	/* clip against screen */
  	if (NULL != btv->fbuf.base)
  		n = btcx_screen_clips(btv->fbuf.fmt.width, btv->fbuf.fmt.height,
-@@ -2354,7 +2356,6 @@ static int setup_window(struct bttv_fh *
+@@ -2354,7 +2350,6 @@ static int setup_window(struct bttv_fh *
  		BUG();
  	}
  
@@ -66625,7 +66576,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	kfree(fh->ov.clips);
  	fh->ov.clips    = clips;
  	fh->ov.nclips   = n;
-@@ -2362,6 +2363,7 @@ static int setup_window(struct bttv_fh *
+@@ -2362,6 +2357,7 @@ static int setup_window(struct bttv_fh *
  	fh->ov.w        = win->w;
  	fh->ov.field    = win->field;
  	fh->ov.setup_ok = 1;
@@ -66633,7 +66584,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	btv->init.ov.w.width   = win->w.width;
  	btv->init.ov.w.height  = win->w.height;
  	btv->init.ov.field     = win->field;
-@@ -2376,7 +2378,6 @@ static int setup_window(struct bttv_fh *
+@@ -2376,7 +2372,6 @@ static int setup_window(struct bttv_fh *
  		bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
  		retval = bttv_switch_overlay(btv,fh,new);
  	}
@@ -66641,7 +66592,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return retval;
  }
  
-@@ -2516,7 +2517,7 @@ static int bttv_try_fmt_vid_cap(struct f
+@@ -2516,7 +2511,7 @@ static int bttv_try_fmt_vid_cap(struct f
  	width = f->fmt.pix.width;
  	height = f->fmt.pix.height;
  
@@ -66650,7 +66601,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  			       /* width_mask: 4 pixels */ ~3,
  			       /* width_bias: nearest */ 2,
  			       /* adjust_size */ 1,
-@@ -2536,7 +2537,7 @@ static int bttv_try_fmt_vid_overlay(stru
+@@ -2536,7 +2531,7 @@ static int bttv_try_fmt_vid_overlay(stru
  {
  	struct bttv_fh *fh = priv;
  
@@ -66659,7 +66610,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  			/* adjust_size */ 1,
  			/* adjust_crop */ 0);
  }
-@@ -2563,7 +2564,7 @@ static int bttv_s_fmt_vid_cap(struct fil
+@@ -2563,7 +2558,7 @@ static int bttv_s_fmt_vid_cap(struct fil
  	height = f->fmt.pix.height;
  	field = f->fmt.pix.field;
  
@@ -66668,7 +66619,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  			       /* width_mask: 4 pixels */ ~3,
  			       /* width_bias: nearest */ 2,
  			       /* adjust_size */ 1,
-@@ -2576,7 +2577,6 @@ static int bttv_s_fmt_vid_cap(struct fil
+@@ -2576,7 +2571,6 @@ static int bttv_s_fmt_vid_cap(struct fil
  	fmt = format_by_fourcc(f->fmt.pix.pixelformat);
  
  	/* update our state informations */
@@ -66676,7 +66627,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	fh->fmt              = fmt;
  	fh->cap.field        = f->fmt.pix.field;
  	fh->cap.last         = V4L2_FIELD_NONE;
-@@ -2585,7 +2585,6 @@ static int bttv_s_fmt_vid_cap(struct fil
+@@ -2585,7 +2579,6 @@ static int bttv_s_fmt_vid_cap(struct fil
  	btv->init.fmt        = fmt;
  	btv->init.width      = f->fmt.pix.width;
  	btv->init.height     = f->fmt.pix.height;
@@ -66684,13 +66635,14 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  
  	return 0;
  }
-@@ -2601,36 +2600,8 @@ static int bttv_s_fmt_vid_overlay(struct
+@@ -2601,37 +2594,9 @@ static int bttv_s_fmt_vid_overlay(struct
  		return -EINVAL;
  	}
  
 -	return setup_window(fh, btv, &f->fmt.win, 1);
--}
--
++	return setup_window_lock(fh, btv, &f->fmt.win, 1);
+ }
+ 
 -#ifdef CONFIG_VIDEO_V4L1_COMPAT
 -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf)
 -{
@@ -66716,13 +66668,13 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
 -
 -	mutex_unlock(&fh->cap.vb_lock);
 -	return 0;
-+	return setup_window_lock(fh, btv, &f->fmt.win, 1);
- }
+-}
 -#endif
- 
+-
  static int bttv_querycap(struct file *file, void  *priv,
  				struct v4l2_capability *cap)
-@@ -2651,11 +2622,15 @@ static int bttv_querycap(struct file *fi
+ {
+@@ -2651,11 +2616,15 @@ static int bttv_querycap(struct file *fi
  		V4L2_CAP_VBI_CAPTURE |
  		V4L2_CAP_READWRITE |
  		V4L2_CAP_STREAMING;
@@ -66740,7 +66692,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	if (btv->tuner_type != TUNER_ABSENT)
  		cap->capabilities |= V4L2_CAP_TUNER;
  	return 0;
-@@ -2730,22 +2705,24 @@ static int bttv_overlay(struct file *fil
+@@ -2730,22 +2699,24 @@ static int bttv_overlay(struct file *fil
  	struct bttv_fh *fh = f;
  	struct bttv *btv = fh->btv;
  	struct bttv_buffer *new;
@@ -66771,7 +66723,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	if (on) {
  		fh->ov.tvnorm = btv->tvnorm;
  		new = videobuf_sg_alloc(sizeof(*new));
-@@ -2757,7 +2734,6 @@ static int bttv_overlay(struct file *fil
+@@ -2757,7 +2728,6 @@ static int bttv_overlay(struct file *fil
  
  	/* switch over */
  	retval = bttv_switch_overlay(btv, fh, new);
@@ -66779,7 +66731,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return retval;
  }
  
-@@ -2785,7 +2761,7 @@ static int bttv_s_fbuf(struct file *file
+@@ -2785,7 +2755,7 @@ static int bttv_s_fbuf(struct file *file
  		__s32 width = fb->fmt.width;
  		__s32 height = fb->fmt.height;
  
@@ -66788,7 +66740,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  					   V4L2_FIELD_INTERLACED,
  					   /* width_mask */ ~3,
  					   /* width_bias */ 2,
-@@ -2796,7 +2772,6 @@ static int bttv_s_fbuf(struct file *file
+@@ -2796,7 +2766,6 @@ static int bttv_s_fbuf(struct file *file
  	}
  
  	/* ok, accept it */
@@ -66796,7 +66748,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	btv->fbuf.base       = fb->base;
  	btv->fbuf.fmt.width  = fb->fmt.width;
  	btv->fbuf.fmt.height = fb->fmt.height;
-@@ -2828,7 +2803,6 @@ static int bttv_s_fbuf(struct file *file
+@@ -2828,7 +2797,6 @@ static int bttv_s_fbuf(struct file *file
  			retval = bttv_switch_overlay(btv, fh, new);
  		}
  	}
@@ -66804,7 +66756,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return retval;
  }
  
-@@ -2852,7 +2826,7 @@ static int bttv_qbuf(struct file *file, 
+@@ -2852,7 +2820,7 @@ static int bttv_qbuf(struct file *file, 
  	struct bttv *btv = fh->btv;
  	int res = bttv_resource(fh);
  
@@ -66813,7 +66765,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  		return -EBUSY;
  
  	return videobuf_qbuf(bttv_queue(fh), b);
-@@ -2872,7 +2846,7 @@ static int bttv_streamon(struct file *fi
+@@ -2872,7 +2840,7 @@ static int bttv_streamon(struct file *fi
  	struct bttv *btv = fh->btv;
  	int res = bttv_resource(fh);
  
@@ -66822,7 +66774,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  		return -EBUSY;
  	return videobuf_streamon(bttv_queue(fh));
  }
-@@ -2890,7 +2864,7 @@ static int bttv_streamoff(struct file *f
+@@ -2890,7 +2858,7 @@ static int bttv_streamoff(struct file *f
  	retval = videobuf_streamoff(bttv_queue(fh));
  	if (retval < 0)
  		return retval;
@@ -66831,7 +66783,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return 0;
  }
  
-@@ -2926,6 +2900,7 @@ static int bttv_g_parm(struct file *file
+@@ -2926,6 +2894,7 @@ static int bttv_g_parm(struct file *file
  
  	v4l2_video_std_frame_period(bttv_tvnorms[btv->tvnorm].v4l2_id,
  				    &parm->parm.capture.timeperframe);
@@ -66839,7 +66791,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return 0;
  }
  
-@@ -2940,7 +2915,6 @@ static int bttv_g_tuner(struct file *fil
+@@ -2940,7 +2909,6 @@ static int bttv_g_tuner(struct file *fil
  	if (0 != t->index)
  		return -EINVAL;
  
@@ -66847,7 +66799,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	t->rxsubchans = V4L2_TUNER_SUB_MONO;
  	bttv_call_all(btv, tuner, g_tuner, t);
  	strcpy(t->name, "Television");
-@@ -2952,7 +2926,6 @@ static int bttv_g_tuner(struct file *fil
+@@ -2952,7 +2920,6 @@ static int bttv_g_tuner(struct file *fil
  	if (btv->audio_mode_gpio)
  		btv->audio_mode_gpio(btv, t, 0);
  
@@ -66855,7 +66807,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return 0;
  }
  
-@@ -2971,8 +2944,11 @@ static int bttv_s_priority(struct file *
+@@ -2971,8 +2938,11 @@ static int bttv_s_priority(struct file *
  {
  	struct bttv_fh *fh = f;
  	struct bttv *btv = fh->btv;
@@ -66868,7 +66820,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  }
  
  static int bttv_cropcap(struct file *file, void *priv,
-@@ -3024,19 +3000,17 @@ static int bttv_s_crop(struct file *file
+@@ -3024,19 +2994,17 @@ static int bttv_s_crop(struct file *file
  	    crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
  		return -EINVAL;
  
@@ -66893,7 +66845,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  		return retval;
  	}
  
-@@ -3048,7 +3022,6 @@ static int bttv_s_crop(struct file *file
+@@ -3048,7 +3016,6 @@ static int bttv_s_crop(struct file *file
  
  	b_top = max(b->top, btv->vbi_end);
  	if (b_top + 32 >= b_bottom) {
@@ -66901,7 +66853,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  		return retval;
  	}
  
-@@ -3071,12 +3044,8 @@ static int bttv_s_crop(struct file *file
+@@ -3071,12 +3038,8 @@ static int bttv_s_crop(struct file *file
  
  	btv->crop[1] = c;
  
@@ -66914,7 +66866,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	if (fh->width < c.min_scaled_width) {
  		fh->width = c.min_scaled_width;
  		btv->init.width = c.min_scaled_width;
-@@ -3093,8 +3062,6 @@ static int bttv_s_crop(struct file *file
+@@ -3093,8 +3056,6 @@ static int bttv_s_crop(struct file *file
  		btv->init.height = c.max_scaled_height;
  	}
  
@@ -66923,7 +66875,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return 0;
  }
  
-@@ -3128,17 +3095,17 @@ static ssize_t bttv_read(struct file *fi
+@@ -3128,17 +3089,17 @@ static ssize_t bttv_read(struct file *fi
  
  	switch (fh->type) {
  	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
@@ -66944,7 +66896,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  			return -EBUSY;
  		retval = videobuf_read_stream(&fh->vbi, data, count, ppos, 1,
  					      file->f_flags & O_NONBLOCK);
-@@ -3157,20 +3124,18 @@ static unsigned int bttv_poll(struct fil
+@@ -3157,20 +3118,18 @@ static unsigned int bttv_poll(struct fil
  	unsigned int rc = POLLERR;
  
  	if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) {
@@ -66966,7 +66918,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  		if (NULL == fh->cap.read_buf) {
  			/* need to capture a new frame */
  			if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM))
-@@ -3188,7 +3153,6 @@ static unsigned int bttv_poll(struct fil
+@@ -3188,7 +3147,6 @@ static unsigned int bttv_poll(struct fil
  			fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf);
  			fh->cap.read_off = 0;
  		}
@@ -66974,7 +66926,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  		buf = (struct bttv_buffer*)fh->cap.read_buf;
  	}
  
-@@ -3199,7 +3163,6 @@ static unsigned int bttv_poll(struct fil
+@@ -3199,7 +3157,6 @@ static unsigned int bttv_poll(struct fil
  	else
  		rc = 0;
  err:
@@ -66982,7 +66934,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return rc;
  }
  
-@@ -3221,21 +3184,20 @@ static int bttv_open(struct file *file)
+@@ -3221,21 +3178,20 @@ static int bttv_open(struct file *file)
  		return -ENODEV;
  	}
  
@@ -67009,7 +66961,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	v4l2_prio_open(&btv->prio, &fh->prio);
  
  	videobuf_queue_sg_init(&fh->cap, &bttv_video_qops,
-@@ -3243,13 +3205,13 @@ static int bttv_open(struct file *file)
+@@ -3243,13 +3199,13 @@ static int bttv_open(struct file *file)
  			    V4L2_BUF_TYPE_VIDEO_CAPTURE,
  			    V4L2_FIELD_INTERLACED,
  			    sizeof(struct bttv_buffer),
@@ -67025,7 +66977,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	set_tvnorm(btv,btv->tvnorm);
  	set_input(btv, btv->input, btv->tvnorm);
  
-@@ -3272,7 +3234,6 @@ static int bttv_open(struct file *file)
+@@ -3272,7 +3228,6 @@ static int bttv_open(struct file *file)
  	bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm);
  
  	bttv_field_count(btv);
@@ -67033,7 +66985,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return 0;
  }
  
-@@ -3288,23 +3249,24 @@ static int bttv_release(struct file *fil
+@@ -3288,23 +3243,24 @@ static int bttv_release(struct file *fil
  	/* stop video capture */
  	if (check_btres(fh, RESOURCE_VIDEO_STREAM)) {
  		videobuf_streamoff(&fh->cap);
@@ -67061,7 +67013,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	videobuf_mmap_free(&fh->cap);
  	videobuf_mmap_free(&fh->vbi);
  	v4l2_prio_close(&btv->prio, fh->prio);
-@@ -3333,13 +3295,13 @@ bttv_mmap(struct file *file, struct vm_a
+@@ -3333,13 +3289,13 @@ bttv_mmap(struct file *file, struct vm_a
  
  static const struct v4l2_file_operations bttv_fops =
  {
@@ -67082,7 +67034,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  };
  
  static const struct v4l2_ioctl_ops bttv_ioctl_ops = {
-@@ -3373,9 +3335,6 @@ static const struct v4l2_ioctl_ops bttv_
+@@ -3373,9 +3329,6 @@ static const struct v4l2_ioctl_ops bttv_
  	.vidioc_streamoff               = bttv_streamoff,
  	.vidioc_g_tuner                 = bttv_g_tuner,
  	.vidioc_s_tuner                 = bttv_s_tuner,
@@ -67092,7 +67044,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	.vidioc_g_crop                  = bttv_g_crop,
  	.vidioc_s_crop                  = bttv_s_crop,
  	.vidioc_g_fbuf                  = bttv_g_fbuf,
-@@ -3412,29 +3371,22 @@ static int radio_open(struct file *file)
+@@ -3412,29 +3365,22 @@ static int radio_open(struct file *file)
  
  	dprintk("bttv: open dev=%s\n", video_device_node_name(vdev));
  
@@ -67124,7 +67076,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return 0;
  }
  
-@@ -3442,7 +3394,7 @@ static int radio_release(struct file *fi
+@@ -3442,7 +3388,7 @@ static int radio_release(struct file *fi
  {
  	struct bttv_fh *fh = file->private_data;
  	struct bttv *btv = fh->btv;
@@ -67133,7 +67085,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  
  	v4l2_prio_close(&btv->prio, fh->prio);
  	file->private_data = NULL;
-@@ -3450,7 +3402,7 @@ static int radio_release(struct file *fi
+@@ -3450,7 +3396,7 @@ static int radio_release(struct file *fi
  
  	btv->radio_user--;
  
@@ -67142,7 +67094,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  
  	return 0;
  }
-@@ -3479,7 +3431,6 @@ static int radio_g_tuner(struct file *fi
+@@ -3479,7 +3425,6 @@ static int radio_g_tuner(struct file *fi
  		return -EINVAL;
  	if (0 != t->index)
  		return -EINVAL;
@@ -67150,7 +67102,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	strcpy(t->name, "Radio");
  	t->type = V4L2_TUNER_RADIO;
  
-@@ -3488,8 +3439,6 @@ static int radio_g_tuner(struct file *fi
+@@ -3488,8 +3433,6 @@ static int radio_g_tuner(struct file *fi
  	if (btv->audio_mode_gpio)
  		btv->audio_mode_gpio(btv, t, 0);
  
@@ -67159,7 +67111,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	return 0;
  }
  
-@@ -3580,13 +3529,13 @@ static ssize_t radio_read(struct file *f
+@@ -3580,13 +3523,13 @@ static ssize_t radio_read(struct file *f
  {
  	struct bttv_fh *fh = file->private_data;
  	struct bttv *btv = fh->btv;
@@ -67175,7 +67127,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  
  	return cmd.result;
  }
-@@ -3595,11 +3544,11 @@ static unsigned int radio_poll(struct fi
+@@ -3595,11 +3538,11 @@ static unsigned int radio_poll(struct fi
  {
  	struct bttv_fh *fh = file->private_data;
  	struct bttv *btv = fh->btv;
@@ -67189,7 +67141,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  
  	return cmd.result;
  }
-@@ -3610,7 +3559,7 @@ static const struct v4l2_file_operations
+@@ -3610,7 +3553,7 @@ static const struct v4l2_file_operations
  	.open	  = radio_open,
  	.read     = radio_read,
  	.release  = radio_release,
@@ -67198,7 +67150,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	.poll     = radio_poll,
  };
  
-@@ -4070,9 +4019,6 @@ static irqreturn_t bttv_irq(int irq, voi
+@@ -4070,9 +4013,6 @@ static irqreturn_t bttv_irq(int irq, voi
  
  	btv=(struct bttv *)dev_id;
  
@@ -67208,7 +67160,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	count=0;
  	while (1) {
  		/* get/clear interrupt status bits */
-@@ -4108,7 +4054,6 @@ static irqreturn_t bttv_irq(int irq, voi
+@@ -4108,7 +4048,6 @@ static irqreturn_t bttv_irq(int irq, voi
  			btv->field_count++;
  
  		if ((astat & BT848_INT_GPINT) && btv->remote) {
@@ -67216,7 +67168,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  			bttv_input_irq(btv);
  		}
  
-@@ -4313,7 +4258,6 @@ static int __devinit bttv_probe(struct p
+@@ -4313,7 +4252,6 @@ static int __devinit bttv_probe(struct p
  	mutex_init(&btv->lock);
  	spin_lock_init(&btv->s_lock);
  	spin_lock_init(&btv->gpio_lock);
@@ -67224,17 +67176,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/bt8xx/bttv-driver.c
  	init_waitqueue_head(&btv->i2c_queue);
  	INIT_LIST_HEAD(&btv->c.subs);
  	INIT_LIST_HEAD(&btv->capture);
-@@ -4491,6 +4435,9 @@ static void __devexit bttv_remove(struct
- 	if (bttv_verbose)
- 		printk("bttv%d: unloading\n",btv->c.nr);
- 
-+	if (bttv_tvcards[btv->c.type].has_dvb)
-+		flush_request_modules(btv);
-+
- 	/* shutdown everything (DMA+IRQs) */
- 	btand(~15, BT848_GPIO_DMA_CTL);
- 	btwrite(0, BT848_INT_MASK);
-@@ -4501,7 +4448,6 @@ static void __devexit bttv_remove(struct
+@@ -4501,7 +4439,6 @@ static void __devexit bttv_remove(struct
  
  	/* tell gpio modules we are leaving ... */
  	btv->shutdown=1;
@@ -70866,22 +70808,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx18/cx18-driver.c
  		 "\t\t\t 0 = Autodetect (default)\n"
  		 "\t\t\t-1 = Ignore this card\n\t\t");
  MODULE_PARM_DESC(pal, "Set PAL standard: B, G, H, D, K, I, M, N, Nc, 60");
-@@ -266,8 +268,14 @@ static void request_modules(struct cx18 
- 	INIT_WORK(&dev->request_module_wk, request_module_async);
- 	schedule_work(&dev->request_module_wk);
- }
-+
-+static void flush_request_modules(struct cx18 *dev)
-+{
-+	flush_work_sync(&dev->request_module_wk);
-+}
- #else
- #define request_modules(dev)
-+#define flush_request_modules(dev)
- #endif /* CONFIG_MODULES */
- 
- /* Generic utility functions */
-@@ -333,6 +341,7 @@ void cx18_read_eeprom(struct cx18 *cx, s
+@@ -333,6 +335,7 @@ void cx18_read_eeprom(struct cx18 *cx, s
  		tveeprom_hauppauge_analog(&c, tv, eedata);
  		break;
  	case CX18_CARD_YUAN_MPC718:
@@ -70889,52 +70816,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx18/cx18-driver.c
  		tv->model = 0x718;
  		cx18_eeprom_dump(cx, eedata, sizeof(eedata));
  		CX18_INFO("eeprom PCI ID: %02x%02x:%02x%02x\n",
-@@ -656,7 +665,7 @@ static int __devinit cx18_create_in_work
- {
- 	snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
- 		 cx->v4l2_dev.name);
--	cx->in_work_queue = create_singlethread_workqueue(cx->in_workq_name);
-+	cx->in_work_queue = alloc_ordered_workqueue(cx->in_workq_name, 0);
- 	if (cx->in_work_queue == NULL) {
- 		CX18_ERR("Unable to create incoming mailbox handler thread\n");
- 		return -ENOMEM;
-@@ -664,18 +673,6 @@ static int __devinit cx18_create_in_work
- 	return 0;
- }
- 
--static int __devinit cx18_create_out_workq(struct cx18 *cx)
--{
--	snprintf(cx->out_workq_name, sizeof(cx->out_workq_name), "%s-out",
--		 cx->v4l2_dev.name);
--	cx->out_work_queue = create_workqueue(cx->out_workq_name);
--	if (cx->out_work_queue == NULL) {
--		CX18_ERR("Unable to create outgoing mailbox handler threads\n");
--		return -ENOMEM;
--	}
--	return 0;
--}
--
- static void __devinit cx18_init_in_work_orders(struct cx18 *cx)
- {
- 	int i;
-@@ -702,15 +699,9 @@ static int __devinit cx18_init_struct1(s
- 	mutex_init(&cx->epu2apu_mb_lock);
- 	mutex_init(&cx->epu2cpu_mb_lock);
- 
--	ret = cx18_create_out_workq(cx);
--	if (ret)
--		return ret;
--
- 	ret = cx18_create_in_workq(cx);
--	if (ret) {
--		destroy_workqueue(cx->out_work_queue);
-+	if (ret)
- 		return ret;
--	}
- 
- 	cx18_init_in_work_orders(cx);
- 
-@@ -718,15 +709,21 @@ static int __devinit cx18_init_struct1(s
+@@ -718,15 +721,21 @@ static int __devinit cx18_init_struct1(s
  	cx->open_id = 1;
  
  	/* Initial settings */
@@ -70965,7 +70847,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx18/cx18-driver.c
  	init_waitqueue_head(&cx->cap_w);
  	init_waitqueue_head(&cx->mb_apu_waitq);
  	init_waitqueue_head(&cx->mb_cpu_waitq);
-@@ -923,8 +920,13 @@ static int __devinit cx18_probe(struct p
+@@ -923,8 +932,13 @@ static int __devinit cx18_probe(struct p
  	cx->enc_mem = ioremap_nocache(cx->base_addr + CX18_MEM_OFFSET,
  				       CX18_MEM_SIZE);
  	if (!cx->enc_mem) {
@@ -70981,7 +70863,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx18/cx18-driver.c
  		retval = -ENOMEM;
  		goto free_mem;
  	}
-@@ -1033,7 +1035,7 @@ static int __devinit cx18_probe(struct p
+@@ -1033,7 +1047,7 @@ static int __devinit cx18_probe(struct p
  	else
  		cx->is_50hz = 1;
  
@@ -70990,7 +70872,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx18/cx18-driver.c
  
  	if (cx->options.radio > 0)
  		cx->v4l2_cap |= V4L2_CAP_RADIO;
-@@ -1079,7 +1081,6 @@ static int __devinit cx18_probe(struct p
+@@ -1079,7 +1093,6 @@ static int __devinit cx18_probe(struct p
  
  	/* Load cx18 submodules (cx18-alsa) */
  	request_modules(cx);
@@ -70998,32 +70880,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx18/cx18-driver.c
  	return 0;
  
  free_streams:
-@@ -1094,7 +1095,6 @@ free_mem:
- 	release_mem_region(cx->base_addr, CX18_MEM_SIZE);
- free_workqueues:
- 	destroy_workqueue(cx->in_work_queue);
--	destroy_workqueue(cx->out_work_queue);
- err:
- 	if (retval == 0)
- 		retval = -ENODEV;
-@@ -1226,6 +1226,8 @@ static void cx18_remove(struct pci_dev *
- 
- 	CX18_DEBUG_INFO("Removing Card\n");
- 
-+	flush_request_modules(cx);
-+
- 	/* Stop all captures */
- 	CX18_DEBUG_INFO("Stopping all streams\n");
- 	if (atomic_read(&cx->tot_capturing) > 0)
-@@ -1244,7 +1246,6 @@ static void cx18_remove(struct pci_dev *
- 	cx18_halt_firmware(cx);
- 
- 	destroy_workqueue(cx->in_work_queue);
--	destroy_workqueue(cx->out_work_queue);
- 
- 	cx18_streams_cleanup(cx, 1);
- 
-@@ -1262,6 +1263,8 @@ static void cx18_remove(struct pci_dev *
+@@ -1262,6 +1275,8 @@ static void cx18_remove(struct pci_dev *
  		for (i = 0; i < CX18_VBI_FRAMES; i++)
  			kfree(cx->vbi.sliced_mpeg_data[i]);
  
@@ -71096,17 +70953,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx18/cx18-driver.h
  	u32 filter_mode;
  	u32 temporal_strength;
  	u32 spatial_strength;
-@@ -614,9 +617,6 @@ struct cx18 {
- 	struct cx18_in_work_order in_work_order[CX18_MAX_IN_WORK_ORDERS];
- 	char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */
- 
--	struct workqueue_struct *out_work_queue;
--	char out_workq_name[12]; /* "cx18-NN-out" */
--
- 	/* i2c */
- 	struct i2c_adapter i2c_adap[2];
- 	struct i2c_algo_bit_data i2c_algo[2];
-@@ -674,18 +674,25 @@ static inline int cx18_raw_vbi(const str
+@@ -674,18 +677,25 @@ static inline int cx18_raw_vbi(const str
  
  /* Call the specified callback for all subdevs with a grp_id bit matching the
   * mask in hw (if 0, then match them all). Ignore any errors. */
@@ -71787,16 +71634,6 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx18/cx18-streams.h
  	       (s->type == CX18_ENC_STREAM_TYPE_IDX &&
  		s->cx->stream_buffers[CX18_ENC_STREAM_TYPE_IDX] != 0);
  }
-@@ -41,8 +42,7 @@ static inline bool cx18_stream_enabled(s
- /* Related to submission of mdls to firmware */
- static inline void cx18_stream_load_fw_queue(struct cx18_stream *s)
- {
--	struct cx18 *cx = s->cx;
--	queue_work(cx->out_work_queue, &s->out_work_order);
-+	schedule_work(&s->out_work_order);
- }
- 
- static inline void cx18_stream_put_mdl_fw(struct cx18_stream *s,
 Index: linux-2.6.35.x86_64/drivers/media/video/cx18/Kconfig
 ===================================================================
 --- linux-2.6.35.x86_64.orig/drivers/media/video/cx18/Kconfig
@@ -76076,22 +75913,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  }
  
  #if defined(CONFIG_MODULES) && defined(MODULE)
-@@ -517,8 +813,14 @@ static void request_modules(struct cx231
- 	INIT_WORK(&dev->request_module_wk, request_module_async);
- 	schedule_work(&dev->request_module_wk);
- }
-+
-+static void flush_request_modules(struct cx231xx *dev)
-+{
-+	flush_work_sync(&dev->request_module_wk);
-+}
- #else
- #define request_modules(dev)
-+#define flush_request_modules(dev)
- #endif /* CONFIG_MODULES */
- 
- /*
-@@ -537,13 +839,12 @@ static int cx231xx_usb_probe(struct usb_
+@@ -537,13 +833,12 @@ static int cx231xx_usb_probe(struct usb_
  	char *speed;
  	char descr[255] = "";
  	struct usb_interface *lif = NULL;
@@ -76106,7 +75928,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  		/*
  		 * Interface number 0 - IR interface
  		 */
-@@ -552,8 +853,8 @@ static int cx231xx_usb_probe(struct usb_
+@@ -552,8 +847,8 @@ static int cx231xx_usb_probe(struct usb_
  		cx231xx_devused |= 1 << nr;
  
  		if (nr >= CX231XX_MAXBOARDS) {
@@ -76117,7 +75939,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  			cx231xx_devused &= ~(1 << nr);
  			return -ENOMEM;
  		}
-@@ -578,6 +879,7 @@ static int cx231xx_usb_probe(struct usb_
+@@ -578,6 +873,7 @@ static int cx231xx_usb_probe(struct usb_
  		dev->xc_fw_load_done = 0;
  		dev->has_alsa_audio = 1;
  		dev->power_mode = -1;
@@ -76125,7 +75947,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  
  		/* 0 - vbi ; 1 -sliced cc mode */
  		dev->vbi_or_sliced_cc_mode = 0;
-@@ -591,6 +893,11 @@ static int cx231xx_usb_probe(struct usb_
+@@ -591,6 +887,11 @@ static int cx231xx_usb_probe(struct usb_
  		/* store the current interface */
  		lif = interface;
  
@@ -76137,7 +75959,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  		switch (udev->speed) {
  		case USB_SPEED_LOW:
  			speed = "1.5";
-@@ -624,13 +931,6 @@ static int cx231xx_usb_probe(struct usb_
+@@ -624,13 +925,6 @@ static int cx231xx_usb_probe(struct usb_
  		     le16_to_cpu(udev->descriptor.idVendor),
  		     le16_to_cpu(udev->descriptor.idProduct),
  		     dev->max_iad_interface_count);
@@ -76151,7 +75973,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  
  		/* store the interface 0 back */
  		lif = udev->actconfig->interface[0];
-@@ -641,35 +941,21 @@ static int cx231xx_usb_probe(struct usb_
+@@ -641,35 +935,21 @@ static int cx231xx_usb_probe(struct usb_
  		/* get device number */
  		nr = dev->devno;
  
@@ -76194,7 +76016,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  	/*
  	 * AV device initialization - only done at the last interface
  	 */
-@@ -680,15 +966,18 @@ static int cx231xx_usb_probe(struct usb_
+@@ -680,15 +960,18 @@ static int cx231xx_usb_probe(struct usb_
  		cx231xx_errdev("v4l2_device_register failed\n");
  		cx231xx_devused &= ~(1 << nr);
  		kfree(dev);
@@ -76214,7 +76036,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  		return retval;
  	}
  
-@@ -711,6 +1000,7 @@ static int cx231xx_usb_probe(struct usb_
+@@ -711,6 +994,7 @@ static int cx231xx_usb_probe(struct usb_
  		cx231xx_devused &= ~(1 << nr);
  		v4l2_device_unregister(&dev->v4l2_dev);
  		kfree(dev);
@@ -76222,7 +76044,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  		return -ENOMEM;
  	}
  
-@@ -744,6 +1034,7 @@ static int cx231xx_usb_probe(struct usb_
+@@ -744,6 +1028,7 @@ static int cx231xx_usb_probe(struct usb_
  		cx231xx_devused &= ~(1 << nr);
  		v4l2_device_unregister(&dev->v4l2_dev);
  		kfree(dev);
@@ -76230,7 +76052,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  		return -ENOMEM;
  	}
  
-@@ -778,6 +1069,7 @@ static int cx231xx_usb_probe(struct usb_
+@@ -778,6 +1063,7 @@ static int cx231xx_usb_probe(struct usb_
  		cx231xx_devused &= ~(1 << nr);
  		v4l2_device_unregister(&dev->v4l2_dev);
  		kfree(dev);
@@ -76238,7 +76060,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  		return -ENOMEM;
  	}
  
-@@ -813,6 +1105,7 @@ static int cx231xx_usb_probe(struct usb_
+@@ -813,6 +1099,7 @@ static int cx231xx_usb_probe(struct usb_
  			cx231xx_devused &= ~(1 << nr);
  			v4l2_device_unregister(&dev->v4l2_dev);
  			kfree(dev);
@@ -76246,7 +76068,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  			return -ENOMEM;
  		}
  
-@@ -827,6 +1120,15 @@ static int cx231xx_usb_probe(struct usb_
+@@ -827,6 +1114,15 @@ static int cx231xx_usb_probe(struct usb_
  		}
  	}
  
@@ -76262,16 +76084,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  	/* load other modules required */
  	request_modules(dev);
  
-@@ -851,6 +1153,8 @@ static void cx231xx_usb_disconnect(struc
- 	if (!dev->udev)
- 		return;
- 
-+	flush_request_modules(dev);
-+
- 	/* delete v4l2 device */
- 	v4l2_device_unregister(&dev->v4l2_dev);
- 
-@@ -867,7 +1171,10 @@ static void cx231xx_usb_disconnect(struc
+@@ -867,7 +1163,10 @@ static void cx231xx_usb_disconnect(struc
  		     video_device_node_name(dev->vdev));
  
  		dev->state |= DEV_MISCONFIGURED;
@@ -76283,7 +76096,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx231xx/cx231xx-cards.c
  		dev->state |= DEV_DISCONNECTED;
  		wake_up_interruptible(&dev->wait_frame);
  		wake_up_interruptible(&dev->wait_stream);
-@@ -886,6 +1193,7 @@ static void cx231xx_usb_disconnect(struc
+@@ -886,6 +1185,7 @@ static void cx231xx_usb_disconnect(struc
  		kfree(dev->sliced_cc_mode.alt_max_pkt_size);
  		kfree(dev->ts1_mode.alt_max_pkt_size);
  		kfree(dev);
@@ -85399,9 +85212,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx23885/cx23885-input.c
 -
 -static void cx23885_input_next_pulse_width_rc5(struct cx23885_dev *dev,
 -					       u32 ns_pulse)
-+static void cx23885_input_process_measurements(struct cx23885_dev *dev,
-+					       bool overrun)
- {
+-{
 -	const int rc5_quarterbit_ns = 444444; /* 32 cycles/36 kHz/2 = 444 us */
 -	struct card_ir *ir_input = dev->ir_input;
 -	int i, level, quarterbits, halfbits;
@@ -85412,8 +85223,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx23885/cx23885-input.c
 -		ir_input->code = 0;
 -		ir_input->last_bit = 0;
 -	}
-+	struct cx23885_kernel_ir *kernel_ir = dev->kernel_ir;
- 
+-
 -	if (ns_pulse == V4L2_SUBDEV_IR_PULSE_RX_SEQ_END) {
 -		ir_input->last_bit++; /* Account for the final space */
 -		ir_input->active = 0;
@@ -85459,10 +85269,13 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx23885/cx23885-input.c
 -
 -static void cx23885_input_process_pulse_widths_rc5(struct cx23885_dev *dev,
 -						   bool add_eom)
--{
++static void cx23885_input_process_measurements(struct cx23885_dev *dev,
++					       bool overrun)
+ {
 -	struct card_ir *ir_input = dev->ir_input;
 -	struct ir_input_state *ir_input_state = &ir_input->ir;
--
++	struct cx23885_kernel_ir *kernel_ir = dev->kernel_ir;
+ 
 -	u32 ns_pulse[RC5_HALF_BITS+1];
 -	ssize_t num = 0;
 +	ssize_t num;
@@ -85629,16 +85442,11 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx23885/cx23885-input.c
  	struct v4l2_subdev_ir_parameters params;
  
  	if (dev->sd_ir == NULL)
-@@ -325,23 +229,24 @@ static void cx23885_input_ir_stop(struct
- 		v4l2_subdev_call(dev->sd_ir, ir, rx_s_parameters, &params);
- 		v4l2_subdev_call(dev->sd_ir, ir, rx_g_parameters, &params);
+@@ -327,21 +231,24 @@ static void cx23885_input_ir_stop(struct
  	}
-+}
  
--	flush_scheduled_work();
-+static void cx23885_input_ir_close(struct rc_dev *rc)
-+{
-+	struct cx23885_kernel_ir *kernel_ir = rc->priv;
+ 	flush_scheduled_work();
++}
  
 -	switch (dev->board) {
 -	case CX23885_BOARD_HAUPPAUGE_HVR1850:
@@ -85646,6 +85454,10 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx23885/cx23885-input.c
 -		del_timer_sync(&ir_input->timer_keyup);
 -		break;
 -	}
++static void cx23885_input_ir_close(struct rc_dev *rc)
++{
++	struct cx23885_kernel_ir *kernel_ir = rc->priv;
++
 +	if (kernel_ir->cx != NULL)
 +		cx23885_input_ir_stop(kernel_ir->cx);
  }
@@ -85665,7 +85477,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx23885/cx23885-input.c
  	int ret;
  
  	/*
-@@ -354,53 +259,66 @@ int cx23885_input_init(struct cx23885_de
+@@ -354,53 +261,66 @@ int cx23885_input_init(struct cx23885_de
  	switch (dev->board) {
  	case CX23885_BOARD_HAUPPAUGE_HVR1850:
  	case CX23885_BOARD_HAUPPAUGE_HVR1290:
@@ -85769,7 +85581,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx23885/cx23885-input.c
  	if (ret)
  		goto err_out_stop;
  
-@@ -408,9 +326,12 @@ int cx23885_input_init(struct cx23885_de
+@@ -408,9 +328,12 @@ int cx23885_input_init(struct cx23885_de
  
  err_out_stop:
  	cx23885_input_ir_stop(dev);
@@ -85784,7 +85596,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx23885/cx23885-input.c
  	return ret;
  }
  
-@@ -419,9 +340,11 @@ void cx23885_input_fini(struct cx23885_d
+@@ -419,9 +342,11 @@ void cx23885_input_fini(struct cx23885_d
  	/* Always stop the IR hardware from generating interrupts */
  	cx23885_input_ir_stop(dev);
  
@@ -90935,22 +90747,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx88/cx88-mpeg.c
 ===================================================================
 --- linux-2.6.35.x86_64.orig/drivers/media/video/cx88/cx88-mpeg.c
 +++ linux-2.6.35.x86_64/drivers/media/video/cx88/cx88-mpeg.c
-@@ -66,8 +66,14 @@ static void request_modules(struct cx880
- 	INIT_WORK(&dev->request_module_wk, request_module_async);
- 	schedule_work(&dev->request_module_wk);
- }
-+
-+static void flush_request_modules(struct cx8802_dev *dev)
-+{
-+	flush_work_sync(&dev->request_module_wk);
-+}
- #else
- #define request_modules(dev)
-+#define flush_request_modules(dev)
- #endif /* CONFIG_MODULES */
- 
- 
-@@ -313,7 +319,7 @@ void cx8802_buf_queue(struct cx8802_dev 
+@@ -313,7 +313,7 @@ void cx8802_buf_queue(struct cx8802_dev 
  
  /* ----------------------------------------------------------- */
  
@@ -90959,7 +90756,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx88/cx88-mpeg.c
  {
  	struct cx88_dmaqueue *q = &dev->mpegq;
  	struct cx88_buffer *buf;
-@@ -358,7 +364,7 @@ static void cx8802_timeout(unsigned long
+@@ -358,7 +358,7 @@ static void cx8802_timeout(unsigned long
  	do_cancel_buffers(dev,"timeout",1);
  }
  
@@ -90968,16 +90765,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/cx88/cx88-mpeg.c
  	"ts_risci1", NULL, NULL, NULL,
  	"ts_risci2", NULL, NULL, NULL,
  	"ts_oflow",  NULL, NULL, NULL,
-@@ -819,6 +825,8 @@ static void __devexit cx8802_remove(stru
- 
- 	dprintk( 1, "%s\n", __func__);
- 
-+	flush_request_modules(dev);
-+
- 	if (!list_empty(&dev->drvlist)) {
- 		struct cx8802_driver *drv, *tmp;
- 		int err;
-@@ -849,7 +857,7 @@ static void __devexit cx8802_remove(stru
+@@ -849,7 +849,7 @@ static void __devexit cx8802_remove(stru
  	kfree(dev);
  }
  
@@ -94099,22 +93887,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/em28xx/em28xx-cards.c
  		}
  	}
  
-@@ -2573,8 +2693,14 @@ static void request_modules(struct em28x
- 	INIT_WORK(&dev->request_module_wk, request_module_async);
- 	schedule_work(&dev->request_module_wk);
- }
-+
-+static void flush_request_modules(struct em28xx *dev)
-+{
-+	flush_work_sync(&dev->request_module_wk);
-+}
- #else
- #define request_modules(dev)
-+#define flush_request_modules(dev)
- #endif /* CONFIG_MODULES */
- 
- /*
-@@ -2690,8 +2816,8 @@ static int em28xx_init_dev(struct em28xx
+@@ -2690,8 +2810,8 @@ static int em28xx_init_dev(struct em28xx
  	em28xx_pre_card_setup(dev);
  
  	if (!dev->board.is_em2800) {
@@ -94125,15 +93898,6 @@ Index: linux-2.6.35.x86_64/drivers/media/video/em28xx/em28xx-cards.c
  		if (retval < 0) {
  			em28xx_errdev("%s: em28xx_write_regs_req failed!"
  				      " retval [%d]\n",
-@@ -3001,6 +3127,8 @@ static void em28xx_usb_disconnect(struct
- 
- 	em28xx_info("disconnecting %s\n", dev->vdev->name);
- 
-+	flush_request_modules(dev);
-+
- 	/* wait until all current v4l2 io is finished then deallocate
- 	   resources */
- 	mutex_lock(&dev->lock);
 Index: linux-2.6.35.x86_64/drivers/media/video/em28xx/em28xx-cards.c.orig
 ===================================================================
 --- /dev/null
@@ -96584,7 +96348,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/em28xx/em28xx-cards.c.orig
 +
 +	if (dev->init_data.name)
 +		info.platform_data = &dev->init_data;
-+	i2c_new_probed_device(&dev->i2c_adap, &info, addr_list, NULL);
++	i2c_new_probed_device(&dev->i2c_adap, &info, addr_list);
 +}
 +
 +void em28xx_card_setup(struct em28xx *dev)
@@ -102051,7 +101815,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/gspca/gspca.c
 ===================================================================
 --- linux-2.6.35.x86_64.orig/drivers/media/video/gspca/gspca.c
 +++ linux-2.6.35.x86_64/drivers/media/video/gspca/gspca.c
-@@ -55,7 +55,7 @@ MODULE_AUTHOR("Jean-François Moine <htt
+@@ -55,7 +55,7 @@ MODULE_AUTHOR("Jean-François Moine <htt
  MODULE_DESCRIPTION("GSPCA USB Camera Driver");
  MODULE_LICENSE("GPL");
  
@@ -141579,15 +141343,6 @@ Index: linux-2.6.35.x86_64/drivers/media/video/omap24xxcam.c
  		videobuf_dma_free(videobuf_to_dma(vb));
  	}
  
-@@ -1198,7 +1198,7 @@ static int vidioc_streamoff(struct file 
- 
- 	atomic_inc(&cam->reset_disable);
- 
--	flush_scheduled_work();
-+	flush_work_sync(&cam->sensor_reset_work);
- 
- 	rval = videobuf_streamoff(q);
- 	if (!rval) {
 @@ -1491,7 +1491,7 @@ static int omap24xxcam_open(struct file 
  	videobuf_queue_sg_init(&fh->vbq, &omap24xxcam_vbq_ops, NULL,
  				&fh->vbq_lock, V4L2_BUF_TYPE_VIDEO_CAPTURE,
@@ -141597,24 +141352,6 @@ Index: linux-2.6.35.x86_64/drivers/media/video/omap24xxcam.c
  
  	return 0;
  
-@@ -1512,7 +1512,7 @@ static int omap24xxcam_release(struct fi
- 
- 	atomic_inc(&cam->reset_disable);
- 
--	flush_scheduled_work();
-+	flush_work_sync(&cam->sensor_reset_work);
- 
- 	/* stop streaming capture */
- 	videobuf_streamoff(&fh->vbq);
-@@ -1536,7 +1536,7 @@ static int omap24xxcam_release(struct fi
- 	 * not be scheduled anymore since streaming is already
- 	 * disabled.)
- 	 */
--	flush_scheduled_work();
-+	flush_work_sync(&cam->sensor_reset_work);
- 
- 	mutex_lock(&cam->mutex);
- 	if (atomic_dec_return(&cam->users) == 0) {
 Index: linux-2.6.35.x86_64/drivers/media/video/ov2640.c
 ===================================================================
 --- /dev/null
@@ -153914,22 +153651,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/saa7134/saa7134-core.c
 ===================================================================
 --- linux-2.6.35.x86_64.orig/drivers/media/video/saa7134/saa7134-core.c
 +++ linux-2.6.35.x86_64/drivers/media/video/saa7134/saa7134-core.c
-@@ -166,8 +166,14 @@ static void request_submodules(struct sa
- 	schedule_work(&dev->request_module_wk);
- }
- 
-+static void flush_request_submodules(struct saa7134_dev *dev)
-+{
-+	flush_work_sync(&dev->request_module_wk);
-+}
-+
- #else
- #define request_submodules(dev)
-+#define flush_request_submodules(dev)
- #endif /* CONFIG_MODULES */
- 
- /* ------------------------------------------------------------------ */
-@@ -255,8 +261,8 @@ void saa7134_dma_free(struct videobuf_qu
+@@ -255,8 +255,8 @@ void saa7134_dma_free(struct videobuf_qu
  	struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
  	BUG_ON(in_interrupt());
  
@@ -153940,7 +153662,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/saa7134/saa7134-core.c
  	videobuf_dma_free(dma);
  	buf->vb.state = VIDEOBUF_NEEDS_INIT;
  }
-@@ -991,7 +997,7 @@ static int __devinit saa7134_initdev(str
+@@ -991,7 +991,7 @@ static int __devinit saa7134_initdev(str
  	if (card_is_empress(dev)) {
  		struct v4l2_subdev *sd =
  			v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
@@ -153949,7 +153671,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/saa7134/saa7134-core.c
  				saa7134_boards[dev->board].empress_addr, NULL);
  
  		if (sd)
-@@ -1002,7 +1008,7 @@ static int __devinit saa7134_initdev(str
+@@ -1002,7 +1002,7 @@ static int __devinit saa7134_initdev(str
  		struct v4l2_subdev *sd;
  
  		sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
@@ -153958,32 +153680,6 @@ Index: linux-2.6.35.x86_64/drivers/media/video/saa7134/saa7134-core.c
  				0, I2C_ADDRS(saa7134_boards[dev->board].rds_addr));
  		if (sd) {
  			printk(KERN_INFO "%s: found RDS decoder\n", dev->name);
-@@ -1010,8 +1016,6 @@ static int __devinit saa7134_initdev(str
- 		}
- 	}
- 
--	request_submodules(dev);
--
- 	v4l2_prio_init(&dev->prio);
- 
- 	mutex_lock(&saa7134_devlist_lock);
-@@ -1066,6 +1070,7 @@ static int __devinit saa7134_initdev(str
- 	if (saa7134_dmasound_init && !dev->dmasound.priv_data)
- 		saa7134_dmasound_init(dev);
- 
-+	request_submodules(dev);
- 	return 0;
- 
-  fail4:
-@@ -1091,6 +1096,8 @@ static void __devexit saa7134_finidev(st
- 	struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev);
- 	struct saa7134_mpeg_ops *mops;
- 
-+	flush_request_submodules(dev);
-+
- 	/* Release DMA sound modules if present */
- 	if (saa7134_dmasound_exit && dev->dmasound.priv_data) {
- 		saa7134_dmasound_exit(dev);
 Index: linux-2.6.35.x86_64/drivers/media/video/saa7134/saa7134-dvb.c
 ===================================================================
 --- linux-2.6.35.x86_64.orig/drivers/media/video/saa7134/saa7134-dvb.c
@@ -154165,15 +153861,6 @@ Index: linux-2.6.35.x86_64/drivers/media/video/saa7134/saa7134-empress.c
  
  	empress_signal_update(&dev->empress_workqueue);
  	return 0;
-@@ -554,7 +553,7 @@ static int empress_fini(struct saa7134_d
- 
- 	if (NULL == dev->empress_dev)
- 		return 0;
--	flush_scheduled_work();
-+	flush_work_sync(&dev->empress_workqueue);
- 	video_unregister_device(dev->empress_dev);
- 	dev->empress_dev = NULL;
- 	return 0;
 Index: linux-2.6.35.x86_64/drivers/media/video/saa7134/saa7134-empress.mod.c
 ===================================================================
 --- /dev/null
@@ -168061,17 +167748,7 @@ Index: linux-2.6.35.x86_64/drivers/media/video/tlg2300/pd-main.c
  
  	max_packet_size = udev->ep_out[0x1]->desc.wMaxPacketSize;
  	log("\t\t download size : %d", (int)max_packet_size);
-@@ -454,7 +452,8 @@ static int poseidon_probe(struct usb_int
- 
- 	device_init_wakeup(&udev->dev, 1);
- #ifdef CONFIG_PM
--	pd->udev->autosuspend_delay = HZ * PM_SUSPEND_DELAY;
-+	pm_runtime_set_autosuspend_delay(&pd->udev->dev,
-+			1000 * PM_SUSPEND_DELAY);
- 	usb_enable_autosuspend(pd->udev);
- 
- 	if (in_hibernation(pd)) {
-@@ -486,15 +485,11 @@ static void poseidon_disconnect(struct u
+@@ -486,15 +484,11 @@ static void poseidon_disconnect(struct u
  	/*unregister v4l2 device */
  	v4l2_device_unregister(&pd->v4l2_dev);
  
@@ -220294,3 +219971,696 @@ Index: linux-2.6.35.x86_64/include/media/videobuf-vmalloc.h
  
  void *videobuf_to_vmalloc(struct videobuf_buffer *buf);
  
+Index: linux-2.6.35.x86_64/drivers/staging/cxd2099/cxd2099.h
+===================================================================
+--- /dev/null
++++ linux-2.6.35.x86_64/drivers/staging/cxd2099/cxd2099.h
+@@ -0,0 +1,41 @@
++/*
++ * cxd2099.h: Driver for the CXD2099AR Common Interface Controller
++ *
++ * Copyright (C) 2010 DigitalDevices UG
++ *
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * version 2 only, as published by the Free Software Foundation.
++ *
++ *
++ * 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., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301, USA
++ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
++ */
++
++#ifndef _CXD2099_H_
++#define _CXD2099_H_
++
++#include <dvb_ca_en50221.h>
++
++#if defined(CONFIG_DVB_CXD2099) || \
++        (defined(CONFIG_DVB_CXD2099_MODULE) && defined(MODULE))
++struct dvb_ca_en50221 *cxd2099_attach(u8 adr, void *priv, struct i2c_adapter *i2c);
++#else
++struct dvb_ca_en50221 *cxd2099_attach(u8 adr, void *priv, struct i2c_adapter *i2c)
++{
++	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
++	return NULL;
++}
++#endif
++
++#endif
+Index: linux-2.6.35.x86_64/drivers/staging/Kconfig
+===================================================================
+--- linux-2.6.35.x86_64.orig/drivers/staging/Kconfig
++++ linux-2.6.35.x86_64/drivers/staging/Kconfig
+@@ -51,6 +51,8 @@ source "drivers/staging/cx25821/Kconfig"
+ 
+ source "drivers/staging/tm6000/Kconfig"
+ 
++source "drivers/staging/cxd2099/Kconfig"
++
+ source "drivers/staging/usbip/Kconfig"
+ 
+ source "drivers/staging/winbond/Kconfig"
+Index: linux-2.6.35.x86_64/drivers/staging/Makefile
+===================================================================
+--- linux-2.6.35.x86_64.orig/drivers/staging/Makefile
++++ linux-2.6.35.x86_64/drivers/staging/Makefile
+@@ -8,6 +8,7 @@ obj-$(CONFIG_SLICOSS)		+= slicoss/
+ obj-$(CONFIG_VIDEO_GO7007)	+= go7007/
+ obj-$(CONFIG_VIDEO_CX25821)	+= cx25821/
+ obj-$(CONFIG_VIDEO_TM6000)	+= tm6000/
++obj-$(CONFIG_VIDEO_CXD2099)	+= cxd2099/
+ obj-$(CONFIG_USB_IP_COMMON)	+= usbip/
+ obj-$(CONFIG_W35UND)		+= winbond/
+ obj-$(CONFIG_PRISM2_USB)	+= wlan-ng/
+Index: linux-2.6.35.x86_64/drivers/staging/cxd2099/Kconfig
+===================================================================
+--- /dev/null
++++ linux-2.6.35.x86_64/drivers/staging/cxd2099/Kconfig
+@@ -0,0 +1,11 @@
++config DVB_CXD2099
++        tristate "CXD2099AR Common Interface driver"
++        depends on DVB_CORE && PCI && I2C && DVB_NGENE
++        ---help---
++          Support for the CI module found on cineS2 DVB-S2, supported by
++	  the Micronas PCIe device driver (ngene).
++
++	  For now, data is passed through '/dev/dvb/adapterX/sec0':
++	    - Encrypted data must be written to 'sec0'.
++	    - Decrypted data can be read from 'sec0'.
++	    - Setup the CAM using device 'ca0'.
+Index: linux-2.6.35.x86_64/drivers/staging/cxd2099/Makefile
+===================================================================
+--- /dev/null
++++ linux-2.6.35.x86_64/drivers/staging/cxd2099/Makefile
+@@ -0,0 +1,5 @@
++obj-$(CONFIG_DVB_CXD2099) += cxd2099.o
++
++EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/
++EXTRA_CFLAGS += -Idrivers/media/dvb/frontends/
++EXTRA_CFLAGS += -Idrivers/media/common/tuners/
+Index: linux-2.6.35.x86_64/drivers/staging/cxd2099/TODO
+===================================================================
+--- /dev/null
++++ linux-2.6.35.x86_64/drivers/staging/cxd2099/TODO
+@@ -0,0 +1,12 @@
++For now, data is passed through '/dev/dvb/adapterX/sec0':
++ - Encrypted data must be written to 'sec0'.
++ - Decrypted data can be read from 'sec0'.
++ - Setup the CAM using device 'ca0'.
++
++But this is wrong. There are some discussions about the proper way for
++doing it, as seen at:
++	http://www.mail-archive.com/linux-media@vger.kernel.org/msg22196.html
++
++While there's no proper fix for it, the driver should be kept in staging.
++
++Patches should be submitted to: linux-media at vger.kernel.org.
+Index: linux-2.6.35.x86_64/drivers/staging/cxd2099/cxd2099.c
+===================================================================
+--- /dev/null
++++ linux-2.6.35.x86_64/drivers/staging/cxd2099/cxd2099.c
+@@ -0,0 +1,574 @@
++/*
++ * cxd2099.c: Driver for the CXD2099AR Common Interface Controller
++ *
++ * Copyright (C) 2010 DigitalDevices UG
++ *
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * version 2 only, as published by the Free Software Foundation.
++ *
++ *
++ * 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., 51 Franklin Street, Fifth Floor, Boston, MA
++ * 02110-1301, USA
++ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
++ */
++
++#include <linux/version.h>
++#include <linux/slab.h>
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/moduleparam.h>
++#include <linux/init.h>
++#include <linux/i2c.h>
++#include <linux/wait.h>
++#include <linux/delay.h>
++#include <linux/mutex.h>
++#include <linux/io.h>
++
++#include "cxd2099.h"
++
++#define MAX_BUFFER_SIZE 248
++
++struct cxd {
++	struct dvb_ca_en50221 en;
++
++	struct i2c_adapter *i2c;
++	u8     adr;
++	u8     regs[0x23];
++	u8     lastaddress;
++	u8     clk_reg_f;
++	u8     clk_reg_b;
++	int    mode;
++	u32    bitrate;
++	int    ready;
++	int    dr;
++	int    slot_stat;
++
++	u8     amem[1024];
++	int    amem_read;
++
++	int    cammode;
++	struct mutex lock;
++};
++
++static int i2c_write_reg(struct i2c_adapter *adapter, u8 adr,
++			 u8 reg, u8 data)
++{
++	u8 m[2] = {reg, data};
++	struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = m, .len = 2};
++
++	if (i2c_transfer(adapter, &msg, 1) != 1) {
++		printk(KERN_ERR "Failed to write to I2C register %02x@%02x!\n",
++		       reg, adr);
++		return -1;
++	}
++	return 0;
++}
++
++static int i2c_write(struct i2c_adapter *adapter, u8 adr,
++		     u8 *data, u8 len)
++{
++	struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = data, .len = len};
++
++	if (i2c_transfer(adapter, &msg, 1) != 1) {
++		printk(KERN_ERR "Failed to write to I2C!\n");
++		return -1;
++	}
++	return 0;
++}
++
++static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr,
++			u8 reg, u8 *val)
++{
++	struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
++				   .buf = &reg, .len = 1 },
++				  {.addr = adr, .flags = I2C_M_RD,
++				   .buf = val, .len = 1 } };
++
++	if (i2c_transfer(adapter, msgs, 2) != 2) {
++		printk(KERN_ERR "error in i2c_read_reg\n");
++		return -1;
++	}
++	return 0;
++}
++
++static int i2c_read(struct i2c_adapter *adapter, u8 adr,
++		    u8 reg, u8 *data, u8 n)
++{
++	struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
++				   .buf = &reg, .len = 1 },
++				  {.addr = adr, .flags = I2C_M_RD,
++				   .buf = data, .len = n } };
++
++	if (i2c_transfer(adapter, msgs, 2) != 2) {
++		printk(KERN_ERR "error in i2c_read\n");
++		return -1;
++	}
++	return 0;
++}
++
++static int read_block(struct cxd *ci, u8 adr, u8 *data, u8 n)
++{
++	int status;
++
++	status = i2c_write_reg(ci->i2c, ci->adr, 0, adr);
++	if (!status) {
++		ci->lastaddress = adr;
++		status = i2c_read(ci->i2c, ci->adr, 1, data, n);
++	}
++	return status;
++}
++
++static int read_reg(struct cxd *ci, u8 reg, u8 *val)
++{
++	return read_block(ci, reg, val, 1);
++}
++
++
++static int read_pccard(struct cxd *ci, u16 address, u8 *data, u8 n)
++{
++	int status;
++	u8 addr[3] = { 2, address&0xff, address>>8 };
++
++	status = i2c_write(ci->i2c, ci->adr, addr, 3);
++	if (!status)
++		status = i2c_read(ci->i2c, ci->adr, 3, data, n);
++	return status;
++}
++
++static int write_pccard(struct cxd *ci, u16 address, u8 *data, u8 n)
++{
++	int status;
++	u8 addr[3] = { 2, address&0xff, address>>8 };
++
++	status = i2c_write(ci->i2c, ci->adr, addr, 3);
++	if (!status) {
++		u8 buf[256] = {3};
++		memcpy(buf+1, data, n);
++		status = i2c_write(ci->i2c, ci->adr, buf, n+1);
++	}
++	return status;
++}
++
++static int read_io(struct cxd *ci, u16 address, u8 *val)
++{
++	int status;
++	u8 addr[3] = { 2, address&0xff, address>>8 };
++
++	status = i2c_write(ci->i2c, ci->adr, addr, 3);
++	if (!status)
++		status = i2c_read(ci->i2c, ci->adr, 3, val, 1);
++	return status;
++}
++
++static int write_io(struct cxd *ci, u16 address, u8 val)
++{
++	int status;
++	u8 addr[3] = { 2, address&0xff, address>>8 };
++	u8 buf[2] = { 3, val };
++
++	status = i2c_write(ci->i2c, ci->adr, addr, 3);
++	if (!status)
++		status = i2c_write(ci->i2c, ci->adr, buf, 2);
++
++	return status;
++}
++
++
++static int write_regm(struct cxd *ci, u8 reg, u8 val, u8 mask)
++{
++	int status;
++
++	status = i2c_write_reg(ci->i2c, ci->adr, 0, reg);
++	if (!status && reg >= 6 && reg <= 8 && mask != 0xff)
++		status = i2c_read_reg(ci->i2c, ci->adr, 1, &ci->regs[reg]);
++	ci->regs[reg] = (ci->regs[reg]&(~mask))|val;
++	if (!status) {
++		ci->lastaddress = reg;
++		status = i2c_write_reg(ci->i2c, ci->adr, 1, ci->regs[reg]);
++	}
++	if (reg == 0x20)
++		ci->regs[reg] &= 0x7f;
++	return status;
++}
++
++static int write_reg(struct cxd *ci, u8 reg, u8 val)
++{
++	return write_regm(ci, reg, val, 0xff);
++}
++
++#ifdef BUFFER_MODE
++static int write_block(struct cxd *ci, u8 adr, u8 *data, int n)
++{
++	int status;
++	u8 buf[256] = {1};
++
++	status = i2c_write_reg(ci->i2c, ci->adr, 0, adr);
++	if (!status) {
++		ci->lastaddress = adr;
++		memcpy(buf+1, data, n);
++		status = i2c_write(ci->i2c, ci->adr, buf, n+1);
++	}
++	return status;
++}
++#endif
++
++static void set_mode(struct cxd *ci, int mode)
++{
++	if (mode == ci->mode)
++		return;
++
++	switch (mode) {
++	case 0x00: /* IO mem */
++		write_regm(ci, 0x06, 0x00, 0x07);
++		break;
++	case 0x01: /* ATT mem */
++		write_regm(ci, 0x06, 0x02, 0x07);
++		break;
++	default:
++		break;
++	}
++	ci->mode = mode;
++}
++
++static void cam_mode(struct cxd *ci, int mode)
++{
++	if (mode == ci->cammode)
++		return;
++
++	switch (mode) {
++	case 0x00:
++		write_regm(ci, 0x20, 0x80, 0x80);
++		break;
++	case 0x01:
++		printk(KERN_INFO "enable cam buffer mode\n");
++		/* write_reg(ci, 0x0d, 0x00); */
++		/* write_reg(ci, 0x0e, 0x01); */
++		write_regm(ci, 0x08, 0x40, 0x40);
++		/* read_reg(ci, 0x12, &dummy); */
++		write_regm(ci, 0x08, 0x80, 0x80);
++		break;
++	default:
++		break;
++	}
++	ci->cammode = mode;
++}
++
++
++
++#define CHK_ERROR(s) if ((status = s)) break
++
++static int init(struct cxd *ci)
++{
++	int status;
++
++	mutex_lock(&ci->lock);
++	ci->mode = -1;
++	do {
++		CHK_ERROR(write_reg(ci, 0x00, 0x00));
++		CHK_ERROR(write_reg(ci, 0x01, 0x00));
++		CHK_ERROR(write_reg(ci, 0x02, 0x10));
++		CHK_ERROR(write_reg(ci, 0x03, 0x00));
++		CHK_ERROR(write_reg(ci, 0x05, 0xFF));
++		CHK_ERROR(write_reg(ci, 0x06, 0x1F));
++		CHK_ERROR(write_reg(ci, 0x07, 0x1F));
++		CHK_ERROR(write_reg(ci, 0x08, 0x28));
++		CHK_ERROR(write_reg(ci, 0x14, 0x20));
++
++		CHK_ERROR(write_reg(ci, 0x09, 0x4D)); /* Input Mode C, BYPass Serial, TIVAL = low, MSB */
++		CHK_ERROR(write_reg(ci, 0x0A, 0xA7)); /* TOSTRT = 8, Mode B (gated clock), falling Edge, Serial, POL=HIGH, MSB */
++
++		/* Sync detector */
++		CHK_ERROR(write_reg(ci, 0x0B, 0x33));
++		CHK_ERROR(write_reg(ci, 0x0C, 0x33));
++
++		CHK_ERROR(write_regm(ci, 0x14, 0x00, 0x0F));
++		CHK_ERROR(write_reg(ci, 0x15, ci->clk_reg_b));
++		CHK_ERROR(write_regm(ci, 0x16, 0x00, 0x0F));
++		CHK_ERROR(write_reg(ci, 0x17, ci->clk_reg_f));
++
++		CHK_ERROR(write_reg(ci, 0x20, 0x28)); /* Integer Divider, Falling Edge, Internal Sync, */
++		CHK_ERROR(write_reg(ci, 0x21, 0x00)); /* MCLKI = TICLK/8 */
++		CHK_ERROR(write_reg(ci, 0x22, 0x07)); /* MCLKI = TICLK/8 */
++
++
++		CHK_ERROR(write_regm(ci, 0x20, 0x80, 0x80)); /* Reset CAM state machine */
++
++		CHK_ERROR(write_regm(ci, 0x03, 0x02, 02));  /* Enable IREQA Interrupt */
++		CHK_ERROR(write_reg(ci, 0x01, 0x04));  /* Enable CD Interrupt */
++		CHK_ERROR(write_reg(ci, 0x00, 0x31));  /* Enable TS1,Hot Swap,Slot A */
++		CHK_ERROR(write_regm(ci, 0x09, 0x08, 0x08));  /* Put TS in bypass */
++		ci->cammode = -1;
++#ifdef BUFFER_MODE
++		cam_mode(ci, 0);
++#endif
++	} while (0);
++	mutex_unlock(&ci->lock);
++
++	return 0;
++}
++
++
++static int read_attribute_mem(struct dvb_ca_en50221 *ca,
++			      int slot, int address)
++{
++	struct cxd *ci = ca->data;
++	u8 val;
++	mutex_lock(&ci->lock);
++	set_mode(ci, 1);
++	read_pccard(ci, address, &val, 1);
++	mutex_unlock(&ci->lock);
++	return val;
++}
++
++
++static int write_attribute_mem(struct dvb_ca_en50221 *ca, int slot,
++			       int address, u8 value)
++{
++	struct cxd *ci = ca->data;
++
++	mutex_lock(&ci->lock);
++	set_mode(ci, 1);
++	write_pccard(ci, address, &value, 1);
++	mutex_unlock(&ci->lock);
++	return 0;
++}
++
++static int read_cam_control(struct dvb_ca_en50221 *ca,
++			    int slot, u8 address)
++{
++	struct cxd *ci = ca->data;
++	u8 val;
++
++	mutex_lock(&ci->lock);
++	set_mode(ci, 0);
++	read_io(ci, address, &val);
++	mutex_unlock(&ci->lock);
++	return val;
++}
++
++static int write_cam_control(struct dvb_ca_en50221 *ca, int slot,
++			     u8 address, u8 value)
++{
++	struct cxd *ci = ca->data;
++
++	mutex_lock(&ci->lock);
++	set_mode(ci, 0);
++	write_io(ci, address, value);
++	mutex_unlock(&ci->lock);
++	return 0;
++}
++
++static int slot_reset(struct dvb_ca_en50221 *ca, int slot)
++{
++	struct cxd *ci = ca->data;
++
++	mutex_lock(&ci->lock);
++	cam_mode(ci, 0);
++	write_reg(ci, 0x00, 0x21);
++	write_reg(ci, 0x06, 0x1F);
++	write_reg(ci, 0x00, 0x31);
++	write_regm(ci, 0x20, 0x80, 0x80);
++	write_reg(ci, 0x03, 0x02);
++	ci->ready = 0;
++	ci->mode = -1;
++	{
++		int i;
++		for (i = 0; i < 100; i++) {
++			msleep(10);
++			if (ci->ready)
++				break;
++		}
++	}
++	mutex_unlock(&ci->lock);
++	/* msleep(500); */
++	return 0;
++}
++
++static int slot_shutdown(struct dvb_ca_en50221 *ca, int slot)
++{
++	struct cxd *ci = ca->data;
++
++	printk(KERN_INFO "slot_shutdown\n");
++	mutex_lock(&ci->lock);
++	/* write_regm(ci, 0x09, 0x08, 0x08); */
++	write_regm(ci, 0x20, 0x80, 0x80);
++	write_regm(ci, 0x06, 0x07, 0x07);
++	ci->mode = -1;
++	mutex_unlock(&ci->lock);
++	return 0; /* shutdown(ci); */
++}
++
++static int slot_ts_enable(struct dvb_ca_en50221 *ca, int slot)
++{
++	struct cxd *ci = ca->data;
++
++	mutex_lock(&ci->lock);
++	write_regm(ci, 0x09, 0x00, 0x08);
++	set_mode(ci, 0);
++#ifdef BUFFER_MODE
++	cam_mode(ci, 1);
++#endif
++	mutex_unlock(&ci->lock);
++	return 0;
++}
++
++
++static int campoll(struct cxd *ci)
++{
++	u8 istat;
++
++	read_reg(ci, 0x04, &istat);
++	if (!istat)
++		return 0;
++	write_reg(ci, 0x05, istat);
++
++	if (istat&0x40) {
++		ci->dr = 1;
++		printk(KERN_INFO "DR\n");
++	}
++	if (istat&0x20)
++		printk(KERN_INFO "WC\n");
++
++	if (istat&2) {
++		u8 slotstat;
++
++		read_reg(ci, 0x01, &slotstat);
++		if (!(2&slotstat)) {
++			if (!ci->slot_stat) {
++				ci->slot_stat |= DVB_CA_EN50221_POLL_CAM_PRESENT;
++				write_regm(ci, 0x03, 0x08, 0x08);
++			}
++
++		} else {
++			if (ci->slot_stat) {
++				ci->slot_stat = 0;
++				write_regm(ci, 0x03, 0x00, 0x08);
++				printk(KERN_INFO "NO CAM\n");
++				ci->ready = 0;
++			}
++		}
++		if (istat&8 && ci->slot_stat == DVB_CA_EN50221_POLL_CAM_PRESENT) {
++			ci->ready = 1;
++			ci->slot_stat |= DVB_CA_EN50221_POLL_CAM_READY;
++			printk(KERN_INFO "READY\n");
++		}
++	}
++	return 0;
++}
++
++
++static int poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open)
++{
++	struct cxd *ci = ca->data;
++	u8 slotstat;
++
++	mutex_lock(&ci->lock);
++	campoll(ci);
++	read_reg(ci, 0x01, &slotstat);
++	mutex_unlock(&ci->lock);
++
++	return ci->slot_stat;
++}
++
++#ifdef BUFFER_MODE
++static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount)
++{
++	struct cxd *ci = ca->data;
++	u8 msb, lsb;
++	u16 len;
++
++	mutex_lock(&ci->lock);
++	campoll(ci);
++	mutex_unlock(&ci->lock);
++
++	printk(KERN_INFO "read_data\n");
++	if (!ci->dr)
++		return 0;
++
++	mutex_lock(&ci->lock);
++	read_reg(ci, 0x0f, &msb);
++	read_reg(ci, 0x10, &lsb);
++	len = (msb<<8)|lsb;
++	read_block(ci, 0x12, ebuf, len);
++	ci->dr = 0;
++	mutex_unlock(&ci->lock);
++
++	return len;
++}
++
++static int write_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount)
++{
++	struct cxd *ci = ca->data;
++
++	mutex_lock(&ci->lock);
++	printk(KERN_INFO "write_data %d\n", ecount);
++	write_reg(ci, 0x0d, ecount>>8);
++	write_reg(ci, 0x0e, ecount&0xff);
++	write_block(ci, 0x11, ebuf, ecount);
++	mutex_unlock(&ci->lock);
++	return ecount;
++}
++#endif
++
++static struct dvb_ca_en50221 en_templ = {
++	.read_attribute_mem  = read_attribute_mem,
++	.write_attribute_mem = write_attribute_mem,
++	.read_cam_control    = read_cam_control,
++	.write_cam_control   = write_cam_control,
++	.slot_reset          = slot_reset,
++	.slot_shutdown       = slot_shutdown,
++	.slot_ts_enable      = slot_ts_enable,
++	.poll_slot_status    = poll_slot_status,
++#ifdef BUFFER_MODE
++	.read_data           = read_data,
++	.write_data          = write_data,
++#endif
++
++};
++
++struct dvb_ca_en50221 *cxd2099_attach(u8 adr, void *priv,
++				      struct i2c_adapter *i2c)
++{
++	struct cxd *ci = 0;
++	u32 bitrate = 62000000;
++	u8 val;
++
++	if (i2c_read_reg(i2c, adr, 0, &val) < 0) {
++		printk(KERN_ERR "No CXD2099 detected at %02x\n", adr);
++		return 0;
++	}
++
++	ci = kmalloc(sizeof(struct cxd), GFP_KERNEL);
++	if (!ci)
++		return 0;
++	memset(ci, 0, sizeof(*ci));
++
++	mutex_init(&ci->lock);
++	ci->i2c = i2c;
++	ci->adr = adr;
++	ci->lastaddress = 0xff;
++	ci->clk_reg_b = 0x4a;
++	ci->clk_reg_f = 0x1b;
++	ci->bitrate = bitrate;
++
++	memcpy(&ci->en, &en_templ, sizeof(en_templ));
++	ci->en.data = ci;
++	init(ci);
++	printk(KERN_INFO "Attached CXD2099AR at %02x\n", ci->adr);
++	return &ci->en;
++}
++EXPORT_SYMBOL(cxd2099_attach);
++
++MODULE_DESCRIPTION("cxd2099");
++MODULE_AUTHOR("Ralph Metzler <rjkm at metzlerbros.de>");
++MODULE_LICENSE("GPL");
diff --git a/linux-2.6-vzalloc.patch b/linux-2.6-vzalloc.patch
new file mode 100644
index 0000000..4053bd2
--- /dev/null
+++ b/linux-2.6-vzalloc.patch
@@ -0,0 +1,196 @@
+mm: add vzalloc() and vzalloc_node() helpers
+
+Drop-in helper function backport from upstream.
+    
+Upstream commits:
+  commit e1ca7788dec6773b1a2bce51b7141948f2b8bccf
+  Author: Dave Young <hidave.darkstar at gmail.com>
+  Date:   Tue Oct 26 14:22:06 2010 -0700
+
+    mm: add vzalloc() and vzalloc_node() helpers
+
+    Add vzalloc() and vzalloc_node() to encapsulate the
+    vmalloc-then-memset-zero operation.
+
+    Use __GFP_ZERO to zero fill the allocated memory.
+
+    Signed-off-by: Dave Young <hidave.darkstar at gmail.com>
+    Cc: Christoph Lameter <cl at linux-foundation.org>
+    Acked-by: Greg Ungerer <gerg at snapgear.com>
+    Cc: David Howells <dhowells at redhat.com>
+    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
+    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+
+  commit 9a14f653dfe349c0916e6a78c413effa2fa3f001
+  Author: Paul Mundt <lethal at linux-sh.org>
+  Date:   Fri Dec 24 11:50:34 2010 +0900
+
+    nommu: Fix up vmalloc_node() symbol export regression.
+
+    Commit e1ca778 ("mm: add vzalloc() and vzalloc_node() helpers") ended up
+    accidentally deleting the vmalloc_node() symbol export, resulting in:
+
+    "vmalloc_node" [net/core/pktgen.ko] undefined!
+    "vmalloc_node" [net/netfilter/x_tables.ko] undefined!
+
+    regressions.
+
+    Signed-off-by: Paul Mundt <lethal at linux-sh.org>
+
+Signed-off-by: Jarod Wilson <jarod at redhat.com>
+
+diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
+index d9a787a..5e03b00 100644
+--- a/include/linux/vmalloc.h
++++ b/include/linux/vmalloc.h
+@@ -51,8 +51,10 @@ static inline void vmalloc_init(void)
+ #endif
+ 
+ extern void *vmalloc(unsigned long size);
++extern void *vzalloc(unsigned long size);
+ extern void *vmalloc_user(unsigned long size);
+ extern void *vmalloc_node(unsigned long size, int node);
++extern void *vzalloc_node(unsigned long size, int node);
+ extern void *vmalloc_exec(unsigned long size);
+ extern void *vmalloc_32(unsigned long size);
+ extern void *vmalloc_32_user(unsigned long size);
+diff --git a/mm/nommu.c b/mm/nommu.c
+index b30fde0..bdb4d22 100644
+--- a/mm/nommu.c
++++ b/mm/nommu.c
+@@ -298,12 +298,60 @@ void *vmalloc(unsigned long size)
+ }
+ EXPORT_SYMBOL(vmalloc);
+ 
++/*
++ *	vzalloc - allocate virtually continguos memory with zero fill
++ *
++ *	@size:		allocation size
++ *
++ *	Allocate enough pages to cover @size from the page level
++ *	allocator and map them into continguos kernel virtual space.
++ *	The memory allocated is set to zero.
++ *
++ *	For tight control over page level allocator and protection flags
++ *	use __vmalloc() instead.
++ */
++void *vzalloc(unsigned long size)
++{
++	return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,
++			PAGE_KERNEL);
++}
++EXPORT_SYMBOL(vzalloc);
++
++/**
++ * vmalloc_node - allocate memory on a specific node
++ * @size:	allocation size
++ * @node:	numa node
++ *
++ * Allocate enough pages to cover @size from the page level
++ * allocator and map them into contiguous kernel virtual space.
++ *
++ * For tight control over page level allocator and protection flags
++ * use __vmalloc() instead.
++ */
+ void *vmalloc_node(unsigned long size, int node)
+ {
+ 	return vmalloc(size);
+ }
+ EXPORT_SYMBOL(vmalloc_node);
+ 
++/**
++ * vzalloc_node - allocate memory on a specific node with zero fill
++ * @size:	allocation size
++ * @node:	numa node
++ *
++ * Allocate enough pages to cover @size from the page level
++ * allocator and map them into contiguous kernel virtual space.
++ * The memory allocated is set to zero.
++ *
++ * For tight control over page level allocator and protection flags
++ * use __vmalloc() instead.
++ */
++void *vzalloc_node(unsigned long size, int node)
++{
++	return vzalloc(size);
++}
++EXPORT_SYMBOL(vzalloc_node);
++
+ #ifndef PAGE_KERNEL_EXEC
+ # define PAGE_KERNEL_EXEC PAGE_KERNEL
+ #endif
+diff --git a/mm/vmalloc.c b/mm/vmalloc.c
+index 12568fa..2e2e7a3 100644
+--- a/mm/vmalloc.c
++++ b/mm/vmalloc.c
+@@ -1583,6 +1583,13 @@ void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
+ }
+ EXPORT_SYMBOL(__vmalloc);
+ 
++static inline void *__vmalloc_node_flags(unsigned long size,
++					int node, gfp_t flags)
++{
++	return __vmalloc_node(size, 1, flags, PAGE_KERNEL,
++					node, __builtin_return_address(0));
++}
++
+ /**
+  *	vmalloc  -  allocate virtually contiguous memory
+  *	@size:		allocation size
+@@ -1594,12 +1601,28 @@ EXPORT_SYMBOL(__vmalloc);
+  */
+ void *vmalloc(unsigned long size)
+ {
+-	return __vmalloc_node(size, 1, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL,
+-					-1, __builtin_return_address(0));
++	return __vmalloc_node_flags(size, -1, GFP_KERNEL | __GFP_HIGHMEM);
+ }
+ EXPORT_SYMBOL(vmalloc);
+ 
+ /**
++ *	vzalloc - allocate virtually contiguous memory with zero fill
++ *	@size:	allocation size
++ *	Allocate enough pages to cover @size from the page level
++ *	allocator and map them into contiguous kernel virtual space.
++ *	The memory allocated is set to zero.
++ *
++ *	For tight control over page level allocator and protection flags
++ *	use __vmalloc() instead.
++ */
++void *vzalloc(unsigned long size)
++{
++	return __vmalloc_node_flags(size, -1,
++				GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO);
++}
++EXPORT_SYMBOL(vzalloc);
++
++/**
+  * vmalloc_user - allocate zeroed virtually contiguous memory for userspace
+  * @size: allocation size
+  *
+@@ -1640,6 +1663,25 @@ void *vmalloc_node(unsigned long size, int node)
+ }
+ EXPORT_SYMBOL(vmalloc_node);
+ 
++/**
++ * vzalloc_node - allocate memory on a specific node with zero fill
++ * @size:	allocation size
++ * @node:	numa node
++ *
++ * Allocate enough pages to cover @size from the page level
++ * allocator and map them into contiguous kernel virtual space.
++ * The memory allocated is set to zero.
++ *
++ * For tight control over page level allocator and protection flags
++ * use __vmalloc_node() instead.
++ */
++void *vzalloc_node(unsigned long size, int node)
++{
++	return __vmalloc_node_flags(size, node,
++			 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO);
++}
++EXPORT_SYMBOL(vzalloc_node);
++
+ #ifndef PAGE_KERNEL_EXEC
+ # define PAGE_KERNEL_EXEC PAGE_KERNEL
+ #endif


More information about the scm-commits mailing list