--- /dev/null
+#!/usr/bin/env python
+
+import patch, sys
+
+ps = patch.fromfile(sys.argv[1])
+f = open('INFO', 'w')
+f.write(''.join(ps.items[0].header))
+f.close()
+
+for p in ps.items:
+ s = p.source[2:].replace('/', '_')
+ f = open(s, 'w')
+ f.write('--- %s\n' % p.source)
+ f.write('+++ %s\n' % p.target)
+ for h in p.hunks:
+ f.write('@@ -%d,%d +%d,%d @@\n' % (
+ h.startsrc, h.linessrc,
+ h.starttgt, h.linestgt))
+ f.write(''.join(h.text))
+ f.close()
+++ /dev/null
-Commit 3cf2667 as of next-20130301 extended the struct fb_info
-with a skip_vt_switch to allow drivers to skip the VT switch
-at suspend/resume time. For older kernels we can skip this
-as all this switch does is call pm_vt_switch_required() with true
-or false depending on this new flag and later
-pm_vt_switch_unregister() would not have been made.
-
-This patch cannot be broken down further so I'm pegging
-this as the first one with 4 digits under the DRM folder
-for collateral evolutions. This reflects its as atomic as
-is possible.
-
-Relevant commits below, starting with the first one that
-added this new collateral evolution.
-
-commit 3cf2667b9f8b2c2fe298a427deb399e52321da6b
-Author: Jesse Barnes <jbarnes@virtuousgeek.org>
-Date: Mon Feb 4 13:37:21 2013 +0000
-
- fb: add support for drivers not needing VT switch at suspend/resume time
-
- Use the new PM routines to indicate whether we need to VT switch at suspend
- and resume time. When a new driver is bound, set its flag accordingly,
- and when unbound, remove it from the PM's console tracking list.
-
- Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
- Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
- Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-
-commit 24576d23976746cb52e7700c4cadbf4bc1bc3472
-Author: Jesse Barnes <jbarnes@virtuousgeek.org>
-Date: Tue Mar 26 09:25:45 2013 -0700
-
- drm/i915: enable VT switchless resume v3
-
- With the other bits in place, we can do this safely.
-
- v2: disable backlight on suspend to prevent premature enablement on resume
- v3: disable CRTCs on suspend to allow RTD3 (Kristen)
-
- Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
- Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
- Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-
---- a/drivers/gpu/drm/i915/intel_fb.c
-+++ b/drivers/gpu/drm/i915/intel_fb.c
-@@ -151,7 +151,7 @@ static int intelfb_create(struct drm_fb_
- info->screen_size = size;
-
- /* This driver doesn't need a VT switch to restore the mode on resume */
-- info->skip_vt_switch = true;
-+ fb_enable_skip_vt_switch(info);
-
- drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
- drm_fb_helper_fill_var(info, &ifbdev->helper, sizes->fb_width, sizes->fb_height);
--- /dev/null
+Commit 3cf2667 as of next-20130301 extended the struct fb_info
+with a skip_vt_switch to allow drivers to skip the VT switch
+at suspend/resume time. For older kernels we can skip this
+as all this switch does is call pm_vt_switch_required() with true
+or false depending on this new flag and later
+pm_vt_switch_unregister() would not have been made.
+
+This patch cannot be broken down further so I'm pegging
+this as the first one with 4 digits under the DRM folder
+for collateral evolutions. This reflects its as atomic as
+is possible.
+
+Relevant commits below, starting with the first one that
+added this new collateral evolution.
+
+commit 3cf2667b9f8b2c2fe298a427deb399e52321da6b
+Author: Jesse Barnes <jbarnes@virtuousgeek.org>
+Date: Mon Feb 4 13:37:21 2013 +0000
+
+ fb: add support for drivers not needing VT switch at suspend/resume time
+
+ Use the new PM routines to indicate whether we need to VT switch at suspend
+ and resume time. When a new driver is bound, set its flag accordingly,
+ and when unbound, remove it from the PM's console tracking list.
+
+ Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
+ Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+ Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+
+commit 24576d23976746cb52e7700c4cadbf4bc1bc3472
+Author: Jesse Barnes <jbarnes@virtuousgeek.org>
+Date: Tue Mar 26 09:25:45 2013 -0700
+
+ drm/i915: enable VT switchless resume v3
+
+ With the other bits in place, we can do this safely.
+
+ v2: disable backlight on suspend to prevent premature enablement on resume
+ v3: disable CRTCs on suspend to allow RTD3 (Kristen)
+
+ Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
+ Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
+ Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+
--- /dev/null
+--- a/drivers/gpu/drm/i915/intel_fb.c
++++ b/drivers/gpu/drm/i915/intel_fb.c
+@@ -151,7 +151,7 @@
+ info->screen_size = size;
+
+ /* This driver doesn't need a VT switch to restore the mode on resume */
+- info->skip_vt_switch = true;
++ fb_enable_skip_vt_switch(info);
+
+ drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
+ drm_fb_helper_fill_var(info, &ifbdev->helper, sizes->fb_width, sizes->fb_height);
+++ /dev/null
-Assign vmap, vunmap and mmap fields in dma_buf_ops structs only
-if kernel version >= 3.5.0 as they are added in 3.5. The begin_cpu_access
-was added as of the original dma-buf code via 3.4.
-
-mcgrof@frijol ~/linux-next (git::master)$ git describe --contains fc13020e086bfedf2afb95c91c026d5af1f80107
-v3.4-rc1~57^2~3
-
-Note that the dma-buf itself was added with 3.4. It is not available
-on kernels < 3.4.
-
---- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
-+++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
-@@ -216,10 +216,14 @@ static const struct dma_buf_ops i915_dma
- .kmap_atomic = i915_gem_dmabuf_kmap_atomic,
- .kunmap = i915_gem_dmabuf_kunmap,
- .kunmap_atomic = i915_gem_dmabuf_kunmap_atomic,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .mmap = i915_gem_dmabuf_mmap,
- .vmap = i915_gem_dmabuf_vmap,
- .vunmap = i915_gem_dmabuf_vunmap,
-+#endif
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- .begin_cpu_access = i915_gem_begin_cpu_access,
-+#endif
- };
-
- struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
---- a/drivers/gpu/drm/drm_prime.c
-+++ b/drivers/gpu/drm/drm_prime.c
-@@ -152,9 +152,11 @@ static const struct dma_buf_ops drm_gem_
- .kmap_atomic = drm_gem_dmabuf_kmap_atomic,
- .kunmap = drm_gem_dmabuf_kunmap,
- .kunmap_atomic = drm_gem_dmabuf_kunmap_atomic,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .mmap = drm_gem_dmabuf_mmap,
- .vmap = drm_gem_dmabuf_vmap,
- .vunmap = drm_gem_dmabuf_vunmap,
-+#endif
- };
-
- /**
--- /dev/null
+Assign vmap, vunmap and mmap fields in dma_buf_ops structs only
+if kernel version >= 3.5.0 as they are added in 3.5. The begin_cpu_access
+was added as of the original dma-buf code via 3.4.
+
+mcgrof@frijol ~/linux-next (git::master)$ git describe --contains fc13020e086bfedf2afb95c91c026d5af1f80107
+v3.4-rc1~57^2~3
+
+Note that the dma-buf itself was added with 3.4. It is not available
+on kernels < 3.4.
+
--- /dev/null
+--- a/drivers/gpu/drm/drm_prime.c
++++ b/drivers/gpu/drm/drm_prime.c
+@@ -152,9 +152,11 @@
+ .kmap_atomic = drm_gem_dmabuf_kmap_atomic,
+ .kunmap = drm_gem_dmabuf_kunmap,
+ .kunmap_atomic = drm_gem_dmabuf_kunmap_atomic,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .mmap = drm_gem_dmabuf_mmap,
+ .vmap = drm_gem_dmabuf_vmap,
+ .vunmap = drm_gem_dmabuf_vunmap,
++#endif
+ };
+
+ /**
--- /dev/null
+--- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
++++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
+@@ -216,10 +216,14 @@
+ .kmap_atomic = i915_gem_dmabuf_kmap_atomic,
+ .kunmap = i915_gem_dmabuf_kunmap,
+ .kunmap_atomic = i915_gem_dmabuf_kunmap_atomic,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .mmap = i915_gem_dmabuf_mmap,
+ .vmap = i915_gem_dmabuf_vmap,
+ .vunmap = i915_gem_dmabuf_vunmap,
++#endif
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ .begin_cpu_access = i915_gem_begin_cpu_access,
++#endif
+ };
+
+ struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
+++ /dev/null
-vm_mmap() and vm_munmap() were introduced in kernels >= 3.4.0. Revert
-those changes for versions older than that.
-
-These can't be backported as they rely on non-exported symbols.
-
---- a/drivers/gpu/drm/drm_bufs.c
-+++ b/drivers/gpu/drm/drm_bufs.c
-@@ -1541,6 +1541,20 @@ int drm_mapbufs(struct drm_device *dev,
- retcode = -EINVAL;
- goto done;
- }
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
-+ down_write(¤t->mm->mmap_sem);
-+ virtual = do_mmap(file_priv->filp, 0, map->size,
-+ PROT_READ | PROT_WRITE,
-+ MAP_SHARED,
-+ token);
-+ up_write(¤t->mm->mmap_sem);
-+ } else {
-+ down_write(¤t->mm->mmap_sem);
-+ virtual = do_mmap(file_priv->filp, 0, dma->byte_count,
-+ PROT_READ | PROT_WRITE,
-+ MAP_SHARED, 0);
-+ up_write(¤t->mm->mmap_sem);
-+#else
- virtual = vm_mmap(file_priv->filp, 0, map->size,
- PROT_READ | PROT_WRITE,
- MAP_SHARED,
-@@ -1549,6 +1563,7 @@ int drm_mapbufs(struct drm_device *dev,
- virtual = vm_mmap(file_priv->filp, 0, dma->byte_count,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, 0);
-+#endif
- }
- if (virtual > -1024UL) {
- /* Real error */
---- a/drivers/gpu/drm/i810/i810_dma.c
-+++ b/drivers/gpu/drm/i810/i810_dma.c
-@@ -135,9 +135,17 @@ static int i810_map_buffer(struct drm_bu
- old_fops = file_priv->filp->f_op;
- file_priv->filp->f_op = &i810_buffer_fops;
- dev_priv->mmap_buffer = buf;
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
-+ down_write(¤t->mm->mmap_sem);
-+ buf_priv->virtual = (void *)do_mmap(file_priv->filp, 0, buf->total,
-+ PROT_READ | PROT_WRITE,
-+ MAP_SHARED, buf->bus_address);
-+ up_write(¤t->mm->mmap_sem);
-+#else
- buf_priv->virtual = (void *)vm_mmap(file_priv->filp, 0, buf->total,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, buf->bus_address);
-+#endif
- dev_priv->mmap_buffer = NULL;
- file_priv->filp->f_op = old_fops;
- if (IS_ERR(buf_priv->virtual)) {
-@@ -158,9 +166,15 @@ static int i810_unmap_buffer(struct drm_
- if (buf_priv->currently_mapped != I810_BUF_MAPPED)
- return -EINVAL;
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
-+ down_write(¤t->mm->mmap_sem);
-+ retcode = do_munmap(current->mm, (unsigned long)buf_priv->virtual,
-+ (size_t) buf->total);
-+ up_write(¤t->mm->mmap_sem);
-+#else
- retcode = vm_munmap((unsigned long)buf_priv->virtual,
- (size_t) buf->total);
--
-+#endif
- buf_priv->currently_mapped = I810_BUF_UNMAPPED;
- buf_priv->virtual = NULL;
-
---- a/drivers/gpu/drm/i915/i915_gem.c
-+++ b/drivers/gpu/drm/i915/i915_gem.c
-@@ -1294,10 +1294,17 @@ i915_gem_mmap_ioctl(struct drm_device *d
- drm_gem_object_unreference_unlocked(obj);
- return -EINVAL;
- }
--
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
-+ down_write(¤t->mm->mmap_sem);
-+ addr = do_mmap(obj->filp, 0, args->size,
-+ PROT_READ | PROT_WRITE, MAP_SHARED,
-+ args->offset);
-+ up_write(¤t->mm->mmap_sem);
-+#else
- addr = vm_mmap(obj->filp, 0, args->size,
- PROT_READ | PROT_WRITE, MAP_SHARED,
- args->offset);
-+#endif
- drm_gem_object_unreference_unlocked(obj);
- if (IS_ERR((void *)addr))
- return addr;
--- /dev/null
+vm_mmap() and vm_munmap() were introduced in kernels >= 3.4.0. Revert
+those changes for versions older than that.
+
+These can't be backported as they rely on non-exported symbols.
+
--- /dev/null
+--- a/drivers/gpu/drm/drm_bufs.c
++++ b/drivers/gpu/drm/drm_bufs.c
+@@ -1541,6 +1541,20 @@
+ retcode = -EINVAL;
+ goto done;
+ }
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
++ down_write(¤t->mm->mmap_sem);
++ virtual = do_mmap(file_priv->filp, 0, map->size,
++ PROT_READ | PROT_WRITE,
++ MAP_SHARED,
++ token);
++ up_write(¤t->mm->mmap_sem);
++ } else {
++ down_write(¤t->mm->mmap_sem);
++ virtual = do_mmap(file_priv->filp, 0, dma->byte_count,
++ PROT_READ | PROT_WRITE,
++ MAP_SHARED, 0);
++ up_write(¤t->mm->mmap_sem);
++#else
+ virtual = vm_mmap(file_priv->filp, 0, map->size,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED,
+@@ -1549,6 +1563,7 @@
+ virtual = vm_mmap(file_priv->filp, 0, dma->byte_count,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED, 0);
++#endif
+ }
+ if (virtual > -1024UL) {
+ /* Real error */
--- /dev/null
+--- a/drivers/gpu/drm/i810/i810_dma.c
++++ b/drivers/gpu/drm/i810/i810_dma.c
+@@ -135,9 +135,17 @@
+ old_fops = file_priv->filp->f_op;
+ file_priv->filp->f_op = &i810_buffer_fops;
+ dev_priv->mmap_buffer = buf;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
++ down_write(¤t->mm->mmap_sem);
++ buf_priv->virtual = (void *)do_mmap(file_priv->filp, 0, buf->total,
++ PROT_READ | PROT_WRITE,
++ MAP_SHARED, buf->bus_address);
++ up_write(¤t->mm->mmap_sem);
++#else
+ buf_priv->virtual = (void *)vm_mmap(file_priv->filp, 0, buf->total,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED, buf->bus_address);
++#endif
+ dev_priv->mmap_buffer = NULL;
+ file_priv->filp->f_op = old_fops;
+ if (IS_ERR(buf_priv->virtual)) {
+@@ -158,9 +166,15 @@
+ if (buf_priv->currently_mapped != I810_BUF_MAPPED)
+ return -EINVAL;
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
++ down_write(¤t->mm->mmap_sem);
++ retcode = do_munmap(current->mm, (unsigned long)buf_priv->virtual,
++ (size_t) buf->total);
++ up_write(¤t->mm->mmap_sem);
++#else
+ retcode = vm_munmap((unsigned long)buf_priv->virtual,
+ (size_t) buf->total);
+-
++#endif
+ buf_priv->currently_mapped = I810_BUF_UNMAPPED;
+ buf_priv->virtual = NULL;
+
--- /dev/null
+--- a/drivers/gpu/drm/i915/i915_gem.c
++++ b/drivers/gpu/drm/i915/i915_gem.c
+@@ -1294,10 +1294,17 @@
+ drm_gem_object_unreference_unlocked(obj);
+ return -EINVAL;
+ }
+-
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
++ down_write(¤t->mm->mmap_sem);
++ addr = do_mmap(obj->filp, 0, args->size,
++ PROT_READ | PROT_WRITE, MAP_SHARED,
++ args->offset);
++ up_write(¤t->mm->mmap_sem);
++#else
+ addr = vm_mmap(obj->filp, 0, args->size,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ args->offset);
++#endif
+ drm_gem_object_unreference_unlocked(obj);
+ if (IS_ERR((void *)addr))
+ return addr;
+++ /dev/null
-
-swiotlb_nr_tbl() was available since 3.2 but was exported since 3.3.
-Since it uses an internal global state variable, it is impossible
-to backport it to compat.git. So revert the changes.
-
---- a/drivers/gpu/drm/nouveau/nouveau_bo.c
-+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
-@@ -1374,11 +1374,13 @@ nouveau_ttm_tt_populate(struct ttm_tt *t
- }
- #endif
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
- #ifdef CONFIG_SWIOTLB
- if (swiotlb_nr_tbl()) {
- return ttm_dma_populate((void *)ttm, dev->dev);
- }
- #endif
-+#endif
-
- r = ttm_pool_populate(ttm);
- if (r) {
-@@ -1424,12 +1426,14 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt
- }
- #endif
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
- #ifdef CONFIG_SWIOTLB
- if (swiotlb_nr_tbl()) {
- ttm_dma_unpopulate((void *)ttm, dev->dev);
- return;
- }
- #endif
-+#endif
-
- for (i = 0; i < ttm->num_pages; i++) {
- if (ttm_dma->dma_address[i]) {
---- a/drivers/gpu/drm/radeon/radeon_ttm.c
-+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
-@@ -603,11 +603,13 @@ static int radeon_ttm_tt_populate(struct
- }
- #endif
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
- #ifdef CONFIG_SWIOTLB
- if (swiotlb_nr_tbl()) {
- return ttm_dma_populate(>t->ttm, rdev->dev);
- }
- #endif
-+#endif
-
- r = ttm_pool_populate(ttm);
- if (r) {
-@@ -649,12 +651,14 @@ static void radeon_ttm_tt_unpopulate(str
- }
- #endif
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
- #ifdef CONFIG_SWIOTLB
- if (swiotlb_nr_tbl()) {
- ttm_dma_unpopulate(>t->ttm, rdev->dev);
- return;
- }
- #endif
-+#endif
-
- for (i = 0; i < ttm->num_pages; i++) {
- if (gtt->ttm.dma_address[i]) {
-@@ -877,6 +881,7 @@ static int radeon_ttm_debugfs_init(struc
- radeon_mem_types_list[i].show = &ttm_page_alloc_debugfs;
- radeon_mem_types_list[i].driver_features = 0;
- radeon_mem_types_list[i++].data = NULL;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
- #ifdef CONFIG_SWIOTLB
- if (swiotlb_nr_tbl()) {
- sprintf(radeon_mem_types_names[i], "ttm_dma_page_pool");
-@@ -886,6 +891,7 @@ static int radeon_ttm_debugfs_init(struc
- radeon_mem_types_list[i++].data = NULL;
- }
- #endif
-+#endif
- return radeon_debugfs_add_files(rdev, radeon_mem_types_list, i);
-
- #endif
--- /dev/null
+
+swiotlb_nr_tbl() was available since 3.2 but was exported since 3.3.
+Since it uses an internal global state variable, it is impossible
+to backport it to compat.git. So revert the changes.
+
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
++++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
+@@ -1374,11 +1374,13 @@
+ }
+ #endif
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+ #ifdef CONFIG_SWIOTLB
+ if (swiotlb_nr_tbl()) {
+ return ttm_dma_populate((void *)ttm, dev->dev);
+ }
+ #endif
++#endif
+
+ r = ttm_pool_populate(ttm);
+ if (r) {
+@@ -1424,12 +1426,14 @@
+ }
+ #endif
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+ #ifdef CONFIG_SWIOTLB
+ if (swiotlb_nr_tbl()) {
+ ttm_dma_unpopulate((void *)ttm, dev->dev);
+ return;
+ }
+ #endif
++#endif
+
+ for (i = 0; i < ttm->num_pages; i++) {
+ if (ttm_dma->dma_address[i]) {
--- /dev/null
+--- a/drivers/gpu/drm/radeon/radeon_ttm.c
++++ b/drivers/gpu/drm/radeon/radeon_ttm.c
+@@ -603,11 +603,13 @@
+ }
+ #endif
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+ #ifdef CONFIG_SWIOTLB
+ if (swiotlb_nr_tbl()) {
+ return ttm_dma_populate(>t->ttm, rdev->dev);
+ }
+ #endif
++#endif
+
+ r = ttm_pool_populate(ttm);
+ if (r) {
+@@ -649,12 +651,14 @@
+ }
+ #endif
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+ #ifdef CONFIG_SWIOTLB
+ if (swiotlb_nr_tbl()) {
+ ttm_dma_unpopulate(>t->ttm, rdev->dev);
+ return;
+ }
+ #endif
++#endif
+
+ for (i = 0; i < ttm->num_pages; i++) {
+ if (gtt->ttm.dma_address[i]) {
+@@ -877,6 +881,7 @@
+ radeon_mem_types_list[i].show = &ttm_page_alloc_debugfs;
+ radeon_mem_types_list[i].driver_features = 0;
+ radeon_mem_types_list[i++].data = NULL;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+ #ifdef CONFIG_SWIOTLB
+ if (swiotlb_nr_tbl()) {
+ sprintf(radeon_mem_types_names[i], "ttm_dma_page_pool");
+@@ -886,6 +891,7 @@
+ radeon_mem_types_list[i++].data = NULL;
+ }
+ #endif
++#endif
+ return radeon_debugfs_add_files(rdev, radeon_mem_types_list, i);
+
+ #endif
+++ /dev/null
-Disable PRIME support in core drm, radeon, nouveau and i915 for
-kernels < 3.4.0.
-
-PRIME depends on dma-buf which is added to the kernel with 3.3 but
-the one in 3.3 is mostly stub, e.g. it is a skeleton API which
-is highly modified in 3.4. So disable PRIME for kernels < 3.4.0,
-not < 3.3.0.
-
---- a/drivers/gpu/drm/drm_drv.c
-+++ b/drivers/gpu/drm/drm_drv.c
-@@ -137,8 +137,10 @@ static struct drm_ioctl_desc drm_ioctls[
-
- DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- DRM_IOCTL_DEF(DRM_IOCTL_PRIME_HANDLE_TO_FD, drm_prime_handle_to_fd_ioctl, DRM_AUTH|DRM_UNLOCKED),
- DRM_IOCTL_DEF(DRM_IOCTL_PRIME_FD_TO_HANDLE, drm_prime_fd_to_handle_ioctl, DRM_AUTH|DRM_UNLOCKED),
-+#endif
-
- DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
- DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
---- a/drivers/gpu/drm/drm_fops.c
-+++ b/drivers/gpu/drm/drm_fops.c
-@@ -284,8 +284,10 @@ static int drm_open_helper(struct inode
- if (dev->driver->driver_features & DRIVER_GEM)
- drm_gem_open(dev, priv);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- if (drm_core_check_feature(dev, DRIVER_PRIME))
- drm_prime_init_file_private(&priv->prime);
-+#endif
-
- if (dev->driver->open) {
- ret = dev->driver->open(dev, priv);
-@@ -538,8 +540,10 @@ int drm_release(struct inode *inode, str
- if (dev->driver->postclose)
- dev->driver->postclose(dev, file_priv);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- if (drm_core_check_feature(dev, DRIVER_PRIME))
- drm_prime_destroy_file_private(&file_priv->prime);
-+#endif
-
- put_pid(file_priv->pid);
- kfree(file_priv);
---- a/drivers/gpu/drm/drm_gem.c
-+++ b/drivers/gpu/drm/drm_gem.c
-@@ -35,7 +35,9 @@
- #include <linux/mman.h>
- #include <linux/pagemap.h>
- #include <linux/shmem_fs.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- #include <linux/dma-buf.h>
-+#endif
- #include <drm/drmP.h>
-
- /** @file drm_gem.c
-@@ -204,6 +206,7 @@ EXPORT_SYMBOL(drm_gem_object_alloc);
- static void
- drm_gem_remove_prime_handles(struct drm_gem_object *obj, struct drm_file *filp)
- {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- if (obj->import_attach) {
- drm_prime_remove_imported_buf_handle(&filp->prime,
- obj->import_attach->dmabuf);
-@@ -212,6 +215,7 @@ drm_gem_remove_prime_handles(struct drm_
- drm_prime_remove_imported_buf_handle(&filp->prime,
- obj->export_dma_buf);
- }
-+#endif
- }
-
- /**
---- a/drivers/gpu/drm/drm_prime.c
-+++ b/drivers/gpu/drm/drm_prime.c
-@@ -26,6 +26,8 @@
- *
- */
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-+
- #include <linux/export.h>
- #include <linux/dma-buf.h>
- #include <drm/drmP.h>
-@@ -532,3 +534,4 @@ void drm_prime_remove_imported_buf_handl
- mutex_unlock(&prime_fpriv->lock);
- }
- EXPORT_SYMBOL(drm_prime_remove_imported_buf_handle);
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) */
---- a/drivers/gpu/drm/nouveau/nouveau_prime.c
-+++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
-@@ -22,6 +22,8 @@
- * Authors: Dave Airlie
- */
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-+
- #include <drm/drmP.h>
-
- #include "nouveau_drm.h"
-@@ -93,3 +95,4 @@ int nouveau_gem_prime_pin(struct drm_gem
-
- return 0;
- }
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) */
---- a/drivers/gpu/drm/radeon/radeon_prime.c
-+++ b/drivers/gpu/drm/radeon/radeon_prime.c
-@@ -23,6 +23,7 @@
- *
- * Authors: Alex Deucher
- */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- #include <drm/drmP.h>
-
- #include "radeon.h"
-@@ -96,3 +97,4 @@ int radeon_gem_prime_pin(struct drm_gem_
-
- return 0;
- }
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) */
---- a/drivers/gpu/drm/radeon/radeon_drv.c
-+++ b/drivers/gpu/drm/radeon/radeon_drv.c
-@@ -374,8 +374,10 @@ static const struct file_operations rade
- static struct drm_driver kms_driver = {
- .driver_features =
- DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
-- DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_GEM |
-- DRIVER_PRIME,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-+ DRIVER_PRIME |
-+#endif
-+ DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_GEM,
- .dev_priv_size = 0,
- .load = radeon_driver_load_kms,
- .firstopen = radeon_driver_firstopen_kms,
-@@ -410,6 +412,7 @@ static struct drm_driver kms_driver = {
- .dumb_destroy = radeon_mode_dumb_destroy,
- .fops = &radeon_driver_kms_fops,
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
- .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
- .gem_prime_export = drm_gem_prime_export,
-@@ -419,6 +422,7 @@ static struct drm_driver kms_driver = {
- .gem_prime_import_sg_table = radeon_gem_prime_import_sg_table,
- .gem_prime_vmap = radeon_gem_prime_vmap,
- .gem_prime_vunmap = radeon_gem_prime_vunmap,
-+#endif
-
- .name = DRIVER_NAME,
- .desc = DRIVER_DESC,
---- a/drivers/gpu/drm/radeon/radeon_gem.c
-+++ b/drivers/gpu/drm/radeon/radeon_gem.c
-@@ -41,8 +41,10 @@ void radeon_gem_object_free(struct drm_g
- struct radeon_bo *robj = gem_to_radeon_bo(gobj);
-
- if (robj) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- if (robj->gem_base.import_attach)
- drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
-+#endif
- radeon_bo_unref(&robj);
- }
- }
---- a/drivers/gpu/drm/radeon/radeon_ttm.c
-+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
-@@ -584,17 +584,21 @@ static int radeon_ttm_tt_populate(struct
- struct radeon_ttm_tt *gtt = (void *)ttm;
- unsigned i;
- int r;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
-+#endif
-
- if (ttm->state != tt_unpopulated)
- return 0;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- if (slave && ttm->sg) {
- drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
- gtt->ttm.dma_address, ttm->num_pages);
- ttm->state = tt_unbound;
- return 0;
- }
-+#endif
-
- rdev = radeon_get_rdev(ttm->bdev);
- #if __OS_HAS_AGP
-@@ -638,10 +642,12 @@ static void radeon_ttm_tt_unpopulate(str
- struct radeon_device *rdev;
- struct radeon_ttm_tt *gtt = (void *)ttm;
- unsigned i;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
-
- if (slave)
- return;
-+#endif
-
- rdev = radeon_get_rdev(ttm->bdev);
- #if __OS_HAS_AGP
---- a/drivers/gpu/drm/nouveau/nouveau_bo.c
-+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
-@@ -1352,11 +1352,14 @@ nouveau_ttm_tt_populate(struct ttm_tt *t
- struct drm_device *dev;
- unsigned i;
- int r;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
-+#endif
-
- if (ttm->state != tt_unpopulated)
- return 0;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- if (slave && ttm->sg) {
- /* make userspace faulting work */
- drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
-@@ -1364,6 +1367,7 @@ nouveau_ttm_tt_populate(struct ttm_tt *t
- ttm->state = tt_unbound;
- return 0;
- }
-+#endif
-
- drm = nouveau_bdev(ttm->bdev);
- dev = drm->dev;
-@@ -1411,10 +1415,12 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt
- struct nouveau_drm *drm;
- struct drm_device *dev;
- unsigned i;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
-
- if (slave)
- return;
-+#endif
-
- drm = nouveau_bdev(ttm->bdev);
- dev = drm->dev;
---- a/drivers/gpu/drm/nouveau/nouveau_drm.c
-+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
-@@ -662,7 +662,10 @@ driver = {
- .driver_features =
- DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG |
- DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM |
-- DRIVER_MODESET | DRIVER_PRIME,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-+ DRIVER_PRIME |
-+#endif
-+ DRIVER_MODESET,
-
- .load = nouveau_drm_load,
- .unload = nouveau_drm_unload,
-@@ -688,6 +691,7 @@ driver = {
- .ioctls = nouveau_ioctls,
- .fops = &nouveau_driver_fops,
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
- .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
- .gem_prime_export = drm_gem_prime_export,
-@@ -697,6 +701,7 @@ driver = {
- .gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table,
- .gem_prime_vmap = nouveau_gem_prime_vmap,
- .gem_prime_vunmap = nouveau_gem_prime_vunmap,
-+#endif
-
- .gem_init_object = nouveau_gem_object_new,
- .gem_free_object = nouveau_gem_object_del,
---- a/drivers/gpu/drm/nouveau/nouveau_gem.c
-+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
-@@ -55,8 +55,10 @@ nouveau_gem_object_del(struct drm_gem_ob
- nouveau_bo_unpin(nvbo);
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- if (gem->import_attach)
- drm_prime_gem_destroy(gem, nvbo->bo.sg);
-+#endif
-
- ttm_bo_unref(&bo);
-
---- a/drivers/gpu/drm/i915/i915_drv.c
-+++ b/drivers/gpu/drm/i915/i915_drv.c
-@@ -1058,7 +1058,11 @@ static struct drm_driver driver = {
- */
- .driver_features =
- DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | DRIVER_PRIME,
-+#else
-+ DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM,
-+#endif
- .load = i915_driver_load,
- .unload = i915_driver_unload,
- .open = i915_driver_open,
-@@ -1081,10 +1085,12 @@ static struct drm_driver driver = {
- .gem_free_object = i915_gem_free_object,
- .gem_vm_ops = &i915_gem_vm_ops,
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
- .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
- .gem_prime_export = i915_gem_prime_export,
- .gem_prime_import = i915_gem_prime_import,
-+#endif
-
- .dumb_create = i915_gem_dumb_create,
- .dumb_map_offset = i915_gem_mmap_gtt,
---- a/drivers/gpu/drm/i915/i915_gem.c
-+++ b/drivers/gpu/drm/i915/i915_gem.c
-@@ -34,7 +34,9 @@
- #include <linux/slab.h>
- #include <linux/swap.h>
- #include <linux/pci.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- #include <linux/dma-buf.h>
-+#endif
-
- static void i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj);
- static void i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj);
-@@ -3825,8 +3827,10 @@ void i915_gem_free_object(struct drm_gem
-
- BUG_ON(obj->pages);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- if (obj->base.import_attach)
- drm_prime_gem_destroy(&obj->base, NULL);
-+#endif
-
- drm_gem_object_release(&obj->base);
- i915_gem_info_remove_obj(dev_priv, obj->base.size);
---- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
-+++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
-@@ -23,6 +23,7 @@
- * Authors:
- * Dave Airlie <airlied@redhat.com>
- */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
- #include <drm/drmP.h>
- #include "i915_drv.h"
- #include <linux/dma-buf.h>
-@@ -307,3 +308,4 @@ fail_detach:
- dma_buf_detach(dma_buf, attach);
- return ERR_PTR(ret);
- }
-+#endif
--- /dev/null
+Disable PRIME support in core drm, radeon, nouveau and i915 for
+kernels < 3.4.0.
+
+PRIME depends on dma-buf which is added to the kernel with 3.3 but
+the one in 3.3 is mostly stub, e.g. it is a skeleton API which
+is highly modified in 3.4. So disable PRIME for kernels < 3.4.0,
+not < 3.3.0.
+
--- /dev/null
+--- a/drivers/gpu/drm/drm_drv.c
++++ b/drivers/gpu/drm/drm_drv.c
+@@ -137,8 +137,10 @@
+
+ DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ DRM_IOCTL_DEF(DRM_IOCTL_PRIME_HANDLE_TO_FD, drm_prime_handle_to_fd_ioctl, DRM_AUTH|DRM_UNLOCKED),
+ DRM_IOCTL_DEF(DRM_IOCTL_PRIME_FD_TO_HANDLE, drm_prime_fd_to_handle_ioctl, DRM_AUTH|DRM_UNLOCKED),
++#endif
+
+ DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
+ DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
--- /dev/null
+--- a/drivers/gpu/drm/drm_fops.c
++++ b/drivers/gpu/drm/drm_fops.c
+@@ -284,8 +284,10 @@
+ if (dev->driver->driver_features & DRIVER_GEM)
+ drm_gem_open(dev, priv);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ if (drm_core_check_feature(dev, DRIVER_PRIME))
+ drm_prime_init_file_private(&priv->prime);
++#endif
+
+ if (dev->driver->open) {
+ ret = dev->driver->open(dev, priv);
+@@ -538,8 +540,10 @@
+ if (dev->driver->postclose)
+ dev->driver->postclose(dev, file_priv);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ if (drm_core_check_feature(dev, DRIVER_PRIME))
+ drm_prime_destroy_file_private(&file_priv->prime);
++#endif
+
+ put_pid(file_priv->pid);
+ kfree(file_priv);
--- /dev/null
+--- a/drivers/gpu/drm/drm_gem.c
++++ b/drivers/gpu/drm/drm_gem.c
+@@ -35,7 +35,9 @@
+ #include <linux/mman.h>
+ #include <linux/pagemap.h>
+ #include <linux/shmem_fs.h>
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ #include <linux/dma-buf.h>
++#endif
+ #include <drm/drmP.h>
+
+ /** @file drm_gem.c
+@@ -204,6 +206,7 @@
+ static void
+ drm_gem_remove_prime_handles(struct drm_gem_object *obj, struct drm_file *filp)
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ if (obj->import_attach) {
+ drm_prime_remove_imported_buf_handle(&filp->prime,
+ obj->import_attach->dmabuf);
+@@ -212,6 +215,7 @@
+ drm_prime_remove_imported_buf_handle(&filp->prime,
+ obj->export_dma_buf);
+ }
++#endif
+ }
+
+ /**
--- /dev/null
+--- a/drivers/gpu/drm/drm_prime.c
++++ b/drivers/gpu/drm/drm_prime.c
+@@ -26,6 +26,8 @@
+ *
+ */
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
++
+ #include <linux/export.h>
+ #include <linux/dma-buf.h>
+ #include <drm/drmP.h>
+@@ -532,3 +534,4 @@
+ mutex_unlock(&prime_fpriv->lock);
+ }
+ EXPORT_SYMBOL(drm_prime_remove_imported_buf_handle);
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) */
--- /dev/null
+--- a/drivers/gpu/drm/i915/i915_drv.c
++++ b/drivers/gpu/drm/i915/i915_drv.c
+@@ -1058,7 +1058,11 @@
+ */
+ .driver_features =
+ DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | DRIVER_PRIME,
++#else
++ DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM,
++#endif
+ .load = i915_driver_load,
+ .unload = i915_driver_unload,
+ .open = i915_driver_open,
+@@ -1081,10 +1085,12 @@
+ .gem_free_object = i915_gem_free_object,
+ .gem_vm_ops = &i915_gem_vm_ops,
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
+ .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
+ .gem_prime_export = i915_gem_prime_export,
+ .gem_prime_import = i915_gem_prime_import,
++#endif
+
+ .dumb_create = i915_gem_dumb_create,
+ .dumb_map_offset = i915_gem_mmap_gtt,
--- /dev/null
+--- a/drivers/gpu/drm/i915/i915_gem.c
++++ b/drivers/gpu/drm/i915/i915_gem.c
+@@ -34,7 +34,9 @@
+ #include <linux/slab.h>
+ #include <linux/swap.h>
+ #include <linux/pci.h>
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ #include <linux/dma-buf.h>
++#endif
+
+ static void i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj);
+ static void i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj);
+@@ -3825,8 +3827,10 @@
+
+ BUG_ON(obj->pages);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ if (obj->base.import_attach)
+ drm_prime_gem_destroy(&obj->base, NULL);
++#endif
+
+ drm_gem_object_release(&obj->base);
+ i915_gem_info_remove_obj(dev_priv, obj->base.size);
--- /dev/null
+--- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
++++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
+@@ -23,6 +23,7 @@
+ * Authors:
+ * Dave Airlie <airlied@redhat.com>
+ */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ #include <drm/drmP.h>
+ #include "i915_drv.h"
+ #include <linux/dma-buf.h>
+@@ -307,3 +308,4 @@
+ dma_buf_detach(dma_buf, attach);
+ return ERR_PTR(ret);
+ }
++#endif
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
++++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
+@@ -1352,11 +1352,14 @@
+ struct drm_device *dev;
+ unsigned i;
+ int r;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
++#endif
+
+ if (ttm->state != tt_unpopulated)
+ return 0;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ if (slave && ttm->sg) {
+ /* make userspace faulting work */
+ drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
+@@ -1364,6 +1367,7 @@
+ ttm->state = tt_unbound;
+ return 0;
+ }
++#endif
+
+ drm = nouveau_bdev(ttm->bdev);
+ dev = drm->dev;
+@@ -1411,10 +1415,12 @@
+ struct nouveau_drm *drm;
+ struct drm_device *dev;
+ unsigned i;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
+
+ if (slave)
+ return;
++#endif
+
+ drm = nouveau_bdev(ttm->bdev);
+ dev = drm->dev;
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
+@@ -662,7 +662,10 @@
+ .driver_features =
+ DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG |
+ DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM |
+- DRIVER_MODESET | DRIVER_PRIME,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
++ DRIVER_PRIME |
++#endif
++ DRIVER_MODESET,
+
+ .load = nouveau_drm_load,
+ .unload = nouveau_drm_unload,
+@@ -688,6 +691,7 @@
+ .ioctls = nouveau_ioctls,
+ .fops = &nouveau_driver_fops,
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
+ .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
+ .gem_prime_export = drm_gem_prime_export,
+@@ -697,6 +701,7 @@
+ .gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table,
+ .gem_prime_vmap = nouveau_gem_prime_vmap,
+ .gem_prime_vunmap = nouveau_gem_prime_vunmap,
++#endif
+
+ .gem_init_object = nouveau_gem_object_new,
+ .gem_free_object = nouveau_gem_object_del,
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
++++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
+@@ -55,8 +55,10 @@
+ nouveau_bo_unpin(nvbo);
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ if (gem->import_attach)
+ drm_prime_gem_destroy(gem, nvbo->bo.sg);
++#endif
+
+ ttm_bo_unref(&bo);
+
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/nouveau_prime.c
++++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
+@@ -22,6 +22,8 @@
+ * Authors: Dave Airlie
+ */
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
++
+ #include <drm/drmP.h>
+
+ #include "nouveau_drm.h"
+@@ -93,3 +95,4 @@
+
+ return 0;
+ }
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) */
--- /dev/null
+--- a/drivers/gpu/drm/radeon/radeon_drv.c
++++ b/drivers/gpu/drm/radeon/radeon_drv.c
+@@ -374,8 +374,10 @@
+ static struct drm_driver kms_driver = {
+ .driver_features =
+ DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
+- DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_GEM |
+- DRIVER_PRIME,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
++ DRIVER_PRIME |
++#endif
++ DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_GEM,
+ .dev_priv_size = 0,
+ .load = radeon_driver_load_kms,
+ .firstopen = radeon_driver_firstopen_kms,
+@@ -410,6 +412,7 @@
+ .dumb_destroy = radeon_mode_dumb_destroy,
+ .fops = &radeon_driver_kms_fops,
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
+ .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
+ .gem_prime_export = drm_gem_prime_export,
+@@ -419,6 +422,7 @@
+ .gem_prime_import_sg_table = radeon_gem_prime_import_sg_table,
+ .gem_prime_vmap = radeon_gem_prime_vmap,
+ .gem_prime_vunmap = radeon_gem_prime_vunmap,
++#endif
+
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
--- /dev/null
+--- a/drivers/gpu/drm/radeon/radeon_gem.c
++++ b/drivers/gpu/drm/radeon/radeon_gem.c
+@@ -41,8 +41,10 @@
+ struct radeon_bo *robj = gem_to_radeon_bo(gobj);
+
+ if (robj) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ if (robj->gem_base.import_attach)
+ drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
++#endif
+ radeon_bo_unref(&robj);
+ }
+ }
--- /dev/null
+--- a/drivers/gpu/drm/radeon/radeon_prime.c
++++ b/drivers/gpu/drm/radeon/radeon_prime.c
+@@ -23,6 +23,7 @@
+ *
+ * Authors: Alex Deucher
+ */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ #include <drm/drmP.h>
+
+ #include "radeon.h"
+@@ -96,3 +97,4 @@
+
+ return 0;
+ }
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) */
--- /dev/null
+--- a/drivers/gpu/drm/radeon/radeon_ttm.c
++++ b/drivers/gpu/drm/radeon/radeon_ttm.c
+@@ -584,17 +584,21 @@
+ struct radeon_ttm_tt *gtt = (void *)ttm;
+ unsigned i;
+ int r;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
++#endif
+
+ if (ttm->state != tt_unpopulated)
+ return 0;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ if (slave && ttm->sg) {
+ drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
+ gtt->ttm.dma_address, ttm->num_pages);
+ ttm->state = tt_unbound;
+ return 0;
+ }
++#endif
+
+ rdev = radeon_get_rdev(ttm->bdev);
+ #if __OS_HAS_AGP
+@@ -638,10 +642,12 @@
+ struct radeon_device *rdev;
+ struct radeon_ttm_tt *gtt = (void *)ttm;
+ unsigned i;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
+ bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
+
+ if (slave)
+ return;
++#endif
+
+ rdev = radeon_get_rdev(ttm->bdev);
+ #if __OS_HAS_AGP
+++ /dev/null
-The definition of ACPI_VIDEO_CLASS was moved from video.c
-to video.h in 3.1. Define it here to fix build for kernels older
-than 3.1.
-
---- a/drivers/gpu/drm/i915/intel_opregion.c
-+++ b/drivers/gpu/drm/i915/intel_opregion.c
-@@ -307,6 +307,9 @@ static int intel_opregion_video_event(st
- struct acpi_bus_event *event = data;
- int ret = NOTIFY_OK;
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
-+#define ACPI_VIDEO_CLASS "video"
-+#endif
- if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
- return NOTIFY_DONE;
-
--- /dev/null
+The definition of ACPI_VIDEO_CLASS was moved from video.c
+to video.h in 3.1. Define it here to fix build for kernels older
+than 3.1.
+
--- /dev/null
+--- a/drivers/gpu/drm/i915/intel_opregion.c
++++ b/drivers/gpu/drm/i915/intel_opregion.c
+@@ -307,6 +307,9 @@
+ struct acpi_bus_event *event = data;
+ int ret = NOTIFY_OK;
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
++#define ACPI_VIDEO_CLASS "video"
++#endif
+ if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
+ return NOTIFY_DONE;
+
+++ /dev/null
---- a/drivers/gpu/drm/Makefile
-+++ b/drivers/gpu/drm/Makefile
-@@ -15,41 +15,41 @@ drm-y := drm_auth.o drm_buffer.o d
- drm_trace_points.o drm_global.o drm_prime.o
-
- drm-$(CONFIG_COMPAT) += drm_ioc32.o
--drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
-+drm-$(CONFIG_COMPAT_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
- drm-$(CONFIG_PCI) += ati_pcigart.o
-
- drm-usb-y := drm_usb.o
-
- drm_kms_helper-y := drm_fb_helper.o drm_crtc_helper.o drm_dp_helper.o
--drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
--drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
-+drm_kms_helper-$(CONFIG_COMPAT_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
-+drm_kms_helper-$(CONFIG_COMPAT_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
-
--obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
-+obj-$(CONFIG_COMPAT_DRM_KMS_HELPER) += drm_kms_helper.o
-
- CFLAGS_drm_trace_points.o := -I$(src)
-
--obj-$(CONFIG_DRM) += drm.o
--obj-$(CONFIG_DRM_USB) += drm_usb.o
--obj-$(CONFIG_DRM_TTM) += ttm/
--obj-$(CONFIG_DRM_TDFX) += tdfx/
--obj-$(CONFIG_DRM_R128) += r128/
--obj-$(CONFIG_DRM_RADEON)+= radeon/
--obj-$(CONFIG_DRM_MGA) += mga/
--obj-$(CONFIG_DRM_I810) += i810/
--obj-$(CONFIG_DRM_I915) += i915/
--obj-$(CONFIG_DRM_MGAG200) += mgag200/
--obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus/
--obj-$(CONFIG_DRM_SIS) += sis/
--obj-$(CONFIG_DRM_SAVAGE)+= savage/
--obj-$(CONFIG_DRM_VMWGFX)+= vmwgfx/
--obj-$(CONFIG_DRM_VIA) +=via/
--obj-$(CONFIG_DRM_NOUVEAU) +=nouveau/
--obj-$(CONFIG_DRM_EXYNOS) +=exynos/
--obj-$(CONFIG_DRM_GMA500) += gma500/
--obj-$(CONFIG_DRM_UDL) += udl/
--obj-$(CONFIG_DRM_AST) += ast/
--obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/
--obj-$(CONFIG_DRM_TEGRA) += tegra/
--obj-$(CONFIG_DRM_OMAP) += omapdrm/
--obj-$(CONFIG_DRM_TILCDC) += tilcdc/
-+obj-$(CONFIG_COMPAT_DRM) += drm.o
-+obj-$(CONFIG_COMPAT_DRM_USB) += drm_usb.o
-+obj-$(CONFIG_COMPAT_DRM_TTM) += ttm/
-+obj-$(CONFIG_COMPAT_DRM_TDFX) += tdfx/
-+obj-$(CONFIG_COMPAT_DRM_R128) += r128/
-+obj-$(CONFIG_COMPAT_DRM_RADEON)+= radeon/
-+obj-$(CONFIG_COMPAT_DRM_MGA) += mga/
-+obj-$(CONFIG_COMPAT_DRM_I810) += i810/
-+obj-$(CONFIG_COMPAT_DRM_I915) += i915/
-+obj-$(CONFIG_COMPAT_DRM_MGAG200) += mgag200/
-+obj-$(CONFIG_COMPAT_DRM_CIRRUS_QEMU) += cirrus/
-+obj-$(CONFIG_COMPAT_DRM_SIS) += sis/
-+obj-$(CONFIG_COMPAT_DRM_SAVAGE)+= savage/
-+obj-$(CONFIG_COMPAT_DRM_VMWGFX)+= vmwgfx/
-+obj-$(CONFIG_COMPAT_DRM_VIA) +=via/
-+obj-$(CONFIG_COMPAT_DRM_NOUVEAU) +=nouveau/
-+obj-$(CONFIG_COMPAT_DRM_EXYNOS) +=exynos/
-+obj-$(CONFIG_COMPAT_DRM_GMA500) += gma500/
-+obj-$(CONFIG_COMPAT_DRM_UDL) += udl/
-+obj-$(CONFIG_COMPAT_DRM_AST) += ast/
-+obj-$(CONFIG_COMPAT_DRM_SHMOBILE) +=shmobile/
-+obj-$(CONFIG_COMPAT_DRM_TEGRA) += tegra/
-+obj-$(CONFIG_COMPAT_DRM_OMAP) += omapdrm/
-+obj-$(CONFIG_COMPAT_DRM_TILCDC) += tilcdc/
- obj-y += i2c/
---- a/drivers/gpu/drm/ast/Makefile
-+++ b/drivers/gpu/drm/ast/Makefile
-@@ -6,4 +6,4 @@ ccflags-y := -Iinclude/drm
-
- ast-y := ast_drv.o ast_main.o ast_mode.o ast_fb.o ast_ttm.o ast_post.o
-
--obj-$(CONFIG_DRM_AST) := ast.o
-\ No newline at end of file
-+obj-$(CONFIG_COMPAT_DRM_AST) := ast.o
---- a/drivers/gpu/drm/cirrus/Makefile
-+++ b/drivers/gpu/drm/cirrus/Makefile
-@@ -2,4 +2,4 @@ ccflags-y := -Iinclude/drm
- cirrus-y := cirrus_main.o cirrus_mode.o \
- cirrus_drv.o cirrus_fbdev.o cirrus_ttm.o
-
--obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus.o
-+obj-$(CONFIG_COMPAT_DRM_CIRRUS_QEMU) += cirrus.o
---- a/drivers/gpu/drm/drm_crtc_helper.c
-+++ b/drivers/gpu/drm/drm_crtc_helper.c
-@@ -152,7 +152,7 @@ int drm_helper_probe_single_connector_mo
- goto prune;
- }
-
--#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE
-+#ifdef CONFIG_COMPAT_DRM_LOAD_EDID_FIRMWARE
- count = drm_load_edid_firmware(connector);
- if (count == 0)
- #endif
---- a/drivers/gpu/drm/gma500/Makefile
-+++ b/drivers/gpu/drm/gma500/Makefile
-@@ -49,4 +49,4 @@ gma500_gfx-$(CONFIG_DRM_MEDFIELD) += mdf
- mdfld_tmd_vid.o \
- tc35876x-dsi-lvds.o
-
--obj-$(CONFIG_DRM_GMA500) += gma500_gfx.o
-+obj-$(CONFIG_COMPAT_DRM_GMA500) += gma500_gfx.o
---- a/drivers/gpu/drm/i2c/Makefile
-+++ b/drivers/gpu/drm/i2c/Makefile
-@@ -1,10 +1,10 @@
- ccflags-y := -Iinclude/drm
-
- ch7006-y := ch7006_drv.o ch7006_mode.o
--obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o
-+obj-$(CONFIG_COMPAT_DRM_I2C_CH7006) += ch7006.o
-
- sil164-y := sil164_drv.o
--obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o
-+obj-$(CONFIG_COMPAT_DRM_I2C_SIL164) += sil164.o
-
- tda998x-y := tda998x_drv.o
--obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o
-+obj-$(CONFIG_COMPAT_DRM_I2C_NXP_TDA998X) += tda998x.o
---- a/drivers/gpu/drm/i810/Makefile
-+++ b/drivers/gpu/drm/i810/Makefile
-@@ -5,4 +5,4 @@
- ccflags-y := -Iinclude/drm
- i810-y := i810_drv.o i810_dma.o
-
--obj-$(CONFIG_DRM_I810) += i810.o
-+obj-$(CONFIG_COMPAT_DRM_I810) += i810.o
---- a/drivers/gpu/drm/i915/Makefile
-+++ b/drivers/gpu/drm/i915/Makefile
-@@ -48,6 +48,6 @@ i915-$(CONFIG_COMPAT) += i915_ioc32.o
-
- i915-$(CONFIG_ACPI) += intel_acpi.o
-
--obj-$(CONFIG_DRM_I915) += i915.o
-+obj-$(CONFIG_COMPAT_DRM_I915) += i915.o
-
- CFLAGS_i915_trace_points.o := -I$(src)
---- a/drivers/gpu/drm/mgag200/Makefile
-+++ b/drivers/gpu/drm/mgag200/Makefile
-@@ -2,4 +2,4 @@ ccflags-y := -Iinclude/drm
- mgag200-y := mgag200_main.o mgag200_mode.o \
- mgag200_drv.o mgag200_fb.o mgag200_i2c.o mgag200_ttm.o
-
--obj-$(CONFIG_DRM_MGAG200) += mgag200.o
-+obj-$(CONFIG_COMPAT_DRM_MGAG200) += mgag200.o
---- a/drivers/gpu/drm/nouveau/Makefile
-+++ b/drivers/gpu/drm/nouveau/Makefile
-@@ -241,7 +241,7 @@ nouveau-$(CONFIG_COMPAT) += nouveau_ioc3
- ifdef CONFIG_X86
- nouveau-$(CONFIG_ACPI) += nouveau_acpi.o
- endif
--nouveau-$(CONFIG_DRM_NOUVEAU_BACKLIGHT) += nouveau_backlight.o
-+nouveau-$(CONFIG_COMPAT_DRM_NOUVEAU_BACKLIGHT) += nouveau_backlight.o
- nouveau-$(CONFIG_DEBUG_FS) += nouveau_debugfs.o
-
--obj-$(CONFIG_DRM_NOUVEAU)+= nouveau.o
-+obj-$(CONFIG_COMPAT_DRM_NOUVEAU)+= nouveau.o
---- a/drivers/gpu/drm/nouveau/nouveau_display.h
-+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
-@@ -73,7 +73,7 @@ int nouveau_display_dumb_destroy(struct
-
- void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
-
--#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
-+#ifdef CONFIG_COMPAT_DRM_NOUVEAU_BACKLIGHT
- extern int nouveau_backlight_init(struct drm_device *);
- extern void nouveau_backlight_exit(struct drm_device *);
- #else
---- a/drivers/gpu/drm/radeon/Makefile
-+++ b/drivers/gpu/drm/radeon/Makefile
-@@ -82,6 +82,6 @@ radeon-$(CONFIG_COMPAT) += radeon_ioc32.
- radeon-$(CONFIG_VGA_SWITCHEROO) += radeon_atpx_handler.o
- radeon-$(CONFIG_ACPI) += radeon_acpi.o
-
--obj-$(CONFIG_DRM_RADEON)+= radeon.o
-+obj-$(CONFIG_COMPAT_DRM_RADEON)+= radeon.o
-
- CFLAGS_radeon_trace_points.o := -I$(src)
---- a/drivers/gpu/drm/ttm/Makefile
-+++ b/drivers/gpu/drm/ttm/Makefile
-@@ -11,4 +11,4 @@ ifeq ($(CONFIG_SWIOTLB),y)
- ttm-y += ttm_page_alloc_dma.o
- endif
-
--obj-$(CONFIG_DRM_TTM) += ttm.o
-+obj-$(CONFIG_COMPAT_DRM_TTM) += ttm.o
---- a/drivers/gpu/drm/via/Makefile
-+++ b/drivers/gpu/drm/via/Makefile
-@@ -5,4 +5,4 @@
- ccflags-y := -Iinclude/drm
- via-y := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o
-
--obj-$(CONFIG_DRM_VIA) +=via.o
-+obj-$(CONFIG_COMPAT_DRM_VIA) +=via.o
---- a/drivers/gpu/drm/vmwgfx/Makefile
-+++ b/drivers/gpu/drm/vmwgfx/Makefile
-@@ -8,4 +8,4 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.
- vmwgfx_fence.o vmwgfx_dmabuf.o vmwgfx_scrn.o vmwgfx_context.o \
- vmwgfx_surface.o
-
--obj-$(CONFIG_DRM_VMWGFX) := vmwgfx.o
-+obj-$(CONFIG_COMPAT_DRM_VMWGFX) := vmwgfx.o
--- /dev/null
+--- a/drivers/gpu/drm/Makefile
++++ b/drivers/gpu/drm/Makefile
+@@ -15,41 +15,41 @@
+ drm_trace_points.o drm_global.o drm_prime.o
+
+ drm-$(CONFIG_COMPAT) += drm_ioc32.o
+-drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
++drm-$(CONFIG_COMPAT_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
+ drm-$(CONFIG_PCI) += ati_pcigart.o
+
+ drm-usb-y := drm_usb.o
+
+ drm_kms_helper-y := drm_fb_helper.o drm_crtc_helper.o drm_dp_helper.o
+-drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
+-drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
++drm_kms_helper-$(CONFIG_COMPAT_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
++drm_kms_helper-$(CONFIG_COMPAT_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
+
+-obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
++obj-$(CONFIG_COMPAT_DRM_KMS_HELPER) += drm_kms_helper.o
+
+ CFLAGS_drm_trace_points.o := -I$(src)
+
+-obj-$(CONFIG_DRM) += drm.o
+-obj-$(CONFIG_DRM_USB) += drm_usb.o
+-obj-$(CONFIG_DRM_TTM) += ttm/
+-obj-$(CONFIG_DRM_TDFX) += tdfx/
+-obj-$(CONFIG_DRM_R128) += r128/
+-obj-$(CONFIG_DRM_RADEON)+= radeon/
+-obj-$(CONFIG_DRM_MGA) += mga/
+-obj-$(CONFIG_DRM_I810) += i810/
+-obj-$(CONFIG_DRM_I915) += i915/
+-obj-$(CONFIG_DRM_MGAG200) += mgag200/
+-obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus/
+-obj-$(CONFIG_DRM_SIS) += sis/
+-obj-$(CONFIG_DRM_SAVAGE)+= savage/
+-obj-$(CONFIG_DRM_VMWGFX)+= vmwgfx/
+-obj-$(CONFIG_DRM_VIA) +=via/
+-obj-$(CONFIG_DRM_NOUVEAU) +=nouveau/
+-obj-$(CONFIG_DRM_EXYNOS) +=exynos/
+-obj-$(CONFIG_DRM_GMA500) += gma500/
+-obj-$(CONFIG_DRM_UDL) += udl/
+-obj-$(CONFIG_DRM_AST) += ast/
+-obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/
+-obj-$(CONFIG_DRM_TEGRA) += tegra/
+-obj-$(CONFIG_DRM_OMAP) += omapdrm/
+-obj-$(CONFIG_DRM_TILCDC) += tilcdc/
++obj-$(CONFIG_COMPAT_DRM) += drm.o
++obj-$(CONFIG_COMPAT_DRM_USB) += drm_usb.o
++obj-$(CONFIG_COMPAT_DRM_TTM) += ttm/
++obj-$(CONFIG_COMPAT_DRM_TDFX) += tdfx/
++obj-$(CONFIG_COMPAT_DRM_R128) += r128/
++obj-$(CONFIG_COMPAT_DRM_RADEON)+= radeon/
++obj-$(CONFIG_COMPAT_DRM_MGA) += mga/
++obj-$(CONFIG_COMPAT_DRM_I810) += i810/
++obj-$(CONFIG_COMPAT_DRM_I915) += i915/
++obj-$(CONFIG_COMPAT_DRM_MGAG200) += mgag200/
++obj-$(CONFIG_COMPAT_DRM_CIRRUS_QEMU) += cirrus/
++obj-$(CONFIG_COMPAT_DRM_SIS) += sis/
++obj-$(CONFIG_COMPAT_DRM_SAVAGE)+= savage/
++obj-$(CONFIG_COMPAT_DRM_VMWGFX)+= vmwgfx/
++obj-$(CONFIG_COMPAT_DRM_VIA) +=via/
++obj-$(CONFIG_COMPAT_DRM_NOUVEAU) +=nouveau/
++obj-$(CONFIG_COMPAT_DRM_EXYNOS) +=exynos/
++obj-$(CONFIG_COMPAT_DRM_GMA500) += gma500/
++obj-$(CONFIG_COMPAT_DRM_UDL) += udl/
++obj-$(CONFIG_COMPAT_DRM_AST) += ast/
++obj-$(CONFIG_COMPAT_DRM_SHMOBILE) +=shmobile/
++obj-$(CONFIG_COMPAT_DRM_TEGRA) += tegra/
++obj-$(CONFIG_COMPAT_DRM_OMAP) += omapdrm/
++obj-$(CONFIG_COMPAT_DRM_TILCDC) += tilcdc/
+ obj-y += i2c/
--- /dev/null
+--- a/drivers/gpu/drm/ast/Makefile
++++ b/drivers/gpu/drm/ast/Makefile
+@@ -6,4 +6,4 @@
+
+ ast-y := ast_drv.o ast_main.o ast_mode.o ast_fb.o ast_ttm.o ast_post.o
+
+-obj-$(CONFIG_DRM_AST) := ast.o
+\ No newline at end of file
++obj-$(CONFIG_COMPAT_DRM_AST) := ast.o
--- /dev/null
+--- a/drivers/gpu/drm/cirrus/Makefile
++++ b/drivers/gpu/drm/cirrus/Makefile
+@@ -2,4 +2,4 @@
+ cirrus-y := cirrus_main.o cirrus_mode.o \
+ cirrus_drv.o cirrus_fbdev.o cirrus_ttm.o
+
+-obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus.o
++obj-$(CONFIG_COMPAT_DRM_CIRRUS_QEMU) += cirrus.o
--- /dev/null
+--- a/drivers/gpu/drm/drm_crtc_helper.c
++++ b/drivers/gpu/drm/drm_crtc_helper.c
+@@ -152,7 +152,7 @@
+ goto prune;
+ }
+
+-#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE
++#ifdef CONFIG_COMPAT_DRM_LOAD_EDID_FIRMWARE
+ count = drm_load_edid_firmware(connector);
+ if (count == 0)
+ #endif
--- /dev/null
+--- a/drivers/gpu/drm/gma500/Makefile
++++ b/drivers/gpu/drm/gma500/Makefile
+@@ -49,4 +49,4 @@
+ mdfld_tmd_vid.o \
+ tc35876x-dsi-lvds.o
+
+-obj-$(CONFIG_DRM_GMA500) += gma500_gfx.o
++obj-$(CONFIG_COMPAT_DRM_GMA500) += gma500_gfx.o
--- /dev/null
+--- a/drivers/gpu/drm/i2c/Makefile
++++ b/drivers/gpu/drm/i2c/Makefile
+@@ -1,10 +1,10 @@
+ ccflags-y := -Iinclude/drm
+
+ ch7006-y := ch7006_drv.o ch7006_mode.o
+-obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o
++obj-$(CONFIG_COMPAT_DRM_I2C_CH7006) += ch7006.o
+
+ sil164-y := sil164_drv.o
+-obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o
++obj-$(CONFIG_COMPAT_DRM_I2C_SIL164) += sil164.o
+
+ tda998x-y := tda998x_drv.o
+-obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o
++obj-$(CONFIG_COMPAT_DRM_I2C_NXP_TDA998X) += tda998x.o
--- /dev/null
+--- a/drivers/gpu/drm/i810/Makefile
++++ b/drivers/gpu/drm/i810/Makefile
+@@ -5,4 +5,4 @@
+ ccflags-y := -Iinclude/drm
+ i810-y := i810_drv.o i810_dma.o
+
+-obj-$(CONFIG_DRM_I810) += i810.o
++obj-$(CONFIG_COMPAT_DRM_I810) += i810.o
--- /dev/null
+--- a/drivers/gpu/drm/i915/Makefile
++++ b/drivers/gpu/drm/i915/Makefile
+@@ -48,6 +48,6 @@
+
+ i915-$(CONFIG_ACPI) += intel_acpi.o
+
+-obj-$(CONFIG_DRM_I915) += i915.o
++obj-$(CONFIG_COMPAT_DRM_I915) += i915.o
+
+ CFLAGS_i915_trace_points.o := -I$(src)
--- /dev/null
+--- a/drivers/gpu/drm/mgag200/Makefile
++++ b/drivers/gpu/drm/mgag200/Makefile
+@@ -2,4 +2,4 @@
+ mgag200-y := mgag200_main.o mgag200_mode.o \
+ mgag200_drv.o mgag200_fb.o mgag200_i2c.o mgag200_ttm.o
+
+-obj-$(CONFIG_DRM_MGAG200) += mgag200.o
++obj-$(CONFIG_COMPAT_DRM_MGAG200) += mgag200.o
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/Makefile
++++ b/drivers/gpu/drm/nouveau/Makefile
+@@ -241,7 +241,7 @@
+ ifdef CONFIG_X86
+ nouveau-$(CONFIG_ACPI) += nouveau_acpi.o
+ endif
+-nouveau-$(CONFIG_DRM_NOUVEAU_BACKLIGHT) += nouveau_backlight.o
++nouveau-$(CONFIG_COMPAT_DRM_NOUVEAU_BACKLIGHT) += nouveau_backlight.o
+ nouveau-$(CONFIG_DEBUG_FS) += nouveau_debugfs.o
+
+-obj-$(CONFIG_DRM_NOUVEAU)+= nouveau.o
++obj-$(CONFIG_COMPAT_DRM_NOUVEAU)+= nouveau.o
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/nouveau_display.h
++++ b/drivers/gpu/drm/nouveau/nouveau_display.h
+@@ -73,7 +73,7 @@
+
+ void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
+
+-#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
++#ifdef CONFIG_COMPAT_DRM_NOUVEAU_BACKLIGHT
+ extern int nouveau_backlight_init(struct drm_device *);
+ extern void nouveau_backlight_exit(struct drm_device *);
+ #else
--- /dev/null
+--- a/drivers/gpu/drm/radeon/Makefile
++++ b/drivers/gpu/drm/radeon/Makefile
+@@ -82,6 +82,6 @@
+ radeon-$(CONFIG_VGA_SWITCHEROO) += radeon_atpx_handler.o
+ radeon-$(CONFIG_ACPI) += radeon_acpi.o
+
+-obj-$(CONFIG_DRM_RADEON)+= radeon.o
++obj-$(CONFIG_COMPAT_DRM_RADEON)+= radeon.o
+
+ CFLAGS_radeon_trace_points.o := -I$(src)
--- /dev/null
+--- a/drivers/gpu/drm/ttm/Makefile
++++ b/drivers/gpu/drm/ttm/Makefile
+@@ -11,4 +11,4 @@
+ ttm-y += ttm_page_alloc_dma.o
+ endif
+
+-obj-$(CONFIG_DRM_TTM) += ttm.o
++obj-$(CONFIG_COMPAT_DRM_TTM) += ttm.o
--- /dev/null
+--- a/drivers/gpu/drm/via/Makefile
++++ b/drivers/gpu/drm/via/Makefile
+@@ -5,4 +5,4 @@
+ ccflags-y := -Iinclude/drm
+ via-y := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o
+
+-obj-$(CONFIG_DRM_VIA) +=via.o
++obj-$(CONFIG_COMPAT_DRM_VIA) +=via.o
--- /dev/null
+--- a/drivers/gpu/drm/vmwgfx/Makefile
++++ b/drivers/gpu/drm/vmwgfx/Makefile
+@@ -8,4 +8,4 @@
+ vmwgfx_fence.o vmwgfx_dmabuf.o vmwgfx_scrn.o vmwgfx_context.o \
+ vmwgfx_surface.o
+
+-obj-$(CONFIG_DRM_VMWGFX) := vmwgfx.o
++obj-$(CONFIG_COMPAT_DRM_VMWGFX) := vmwgfx.o
+++ /dev/null
-Kernels older than 3.6 don't have intel_enable_gtt() exported
-and most Linux distributions have CONFIG_AGP_INTEL as built-in
-(y) and as such we don't bother to make it available as
-modular here. The change to export intel_enable_gtt() was
-made through commit 8ecd1a66 but previous to this the driver
-never called intel_enable_gtt() so we can safely assume we
-can do the same for older kernels.
-
-There should be a way to export an intel_enable_gtt() for
-kernels with CONFIG_AGP_INTEL as built-in but that itself
-is a project.
-
-commit 8ecd1a6615f0d9de6759aafe229bc1cc4ee99c7b
-Author: Daniel Vetter <daniel.vetter@ffwll.ch>
-Date: Thu Jun 7 15:56:03 2012 +0200
-
- drm/i915: call intel_enable_gtt
-
- When drm/i915 is in control of the gtt, we need to call
- the enable function at all the relevant places ourselves.
-
- Reviewed-by: Jani Nikula <jani.nikula@linux.intel.com>
- Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-
---- a/drivers/gpu/drm/i915/i915_gem.c
-+++ b/drivers/gpu/drm/i915/i915_gem.c
-@@ -3997,9 +3997,14 @@ i915_gem_init_hw(struct drm_device *dev)
- drm_i915_private_t *dev_priv = dev->dev_private;
- int ret;
-
-- if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
-+ if (INTEL_INFO(dev)->gen < 6)
- return -EIO;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
-+ if (!intel_enable_gtt())
-+ return -EIO;
-+#endif
-+
- if (IS_HASWELL(dev) && (I915_READ(0x120010) == 1))
- I915_WRITE(0x9008, I915_READ(0x9008) | 0xf0000);
-
--- /dev/null
+Kernels older than 3.6 don't have intel_enable_gtt() exported
+and most Linux distributions have CONFIG_AGP_INTEL as built-in
+(y) and as such we don't bother to make it available as
+modular here. The change to export intel_enable_gtt() was
+made through commit 8ecd1a66 but previous to this the driver
+never called intel_enable_gtt() so we can safely assume we
+can do the same for older kernels.
+
+There should be a way to export an intel_enable_gtt() for
+kernels with CONFIG_AGP_INTEL as built-in but that itself
+is a project.
+
+commit 8ecd1a6615f0d9de6759aafe229bc1cc4ee99c7b
+Author: Daniel Vetter <daniel.vetter@ffwll.ch>
+Date: Thu Jun 7 15:56:03 2012 +0200
+
+ drm/i915: call intel_enable_gtt
+
+ When drm/i915 is in control of the gtt, we need to call
+ the enable function at all the relevant places ourselves.
+
+ Reviewed-by: Jani Nikula <jani.nikula@linux.intel.com>
+ Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+
--- /dev/null
+--- a/drivers/gpu/drm/i915/i915_gem.c
++++ b/drivers/gpu/drm/i915/i915_gem.c
+@@ -3997,9 +3997,14 @@
+ drm_i915_private_t *dev_priv = dev->dev_private;
+ int ret;
+
+- if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
++ if (INTEL_INFO(dev)->gen < 6)
+ return -EIO;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
++ if (!intel_enable_gtt())
++ return -EIO;
++#endif
++
+ if (IS_HASWELL(dev) && (I915_READ(0x120010) == 1))
+ I915_WRITE(0x9008, I915_READ(0x9008) | 0xf0000);
+
+++ /dev/null
-Backport e2377fe0b -- this could likely be implemented
-on compat.git but I'd much prefer a better review of that.
-For now this stays as a patch.
-
-commit e2377fe0b65e3c7577ff6df1701c56ef477d336f
-Author: Hugh Dickins <hughd@google.com>
-Date: Mon Jun 27 16:18:19 2011 -0700
-
- drm/i915: use shmem_truncate_range
-
- The interface to ->truncate_range is changing very slightly: once "tmpfs:
- take control of its truncate_range" has been applied, this can be applied.
- For now there is only a slight inefficiency while this remains unapplied,
- but it will soon become essential for managing shmem's use of swap.
-
- Change i915_gem_object_truncate() to use shmem_truncate_range() directly:
- which should also spare i915 later change if we switch from
- inode_operations->truncate_range to file_operations->fallocate.
-
- Signed-off-by: Hugh Dickins <hughd@google.com>
- Cc: Christoph Hellwig <hch@infradead.org>
- Cc: Chris Wilson <chris@chris-wilson.co.uk>
- Cc: Keith Packard <keithp@keithp.com>
- Cc: Dave Airlie <airlied@redhat.com>
- Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
- Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-
---- a/drivers/gpu/drm/i915/i915_gem.c
-+++ b/drivers/gpu/drm/i915/i915_gem.c
-@@ -1620,7 +1620,13 @@ i915_gem_object_truncate(struct drm_i915
- * backing pages, *now*.
- */
- inode = file_inode(obj->base.filp);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0))
- shmem_truncate_range(inode, 0, (loff_t)-1);
-+#else
-+ truncate_inode_pages(inode->i_mapping, 0);
-+ if (inode->i_op->truncate_range)
-+ inode->i_op->truncate_range(inode, 0, (loff_t)-1);
-+#endif
-
- obj->madv = __I915_MADV_PURGED;
- }
--- /dev/null
+Backport e2377fe0b -- this could likely be implemented
+on compat.git but I'd much prefer a better review of that.
+For now this stays as a patch.
+
+commit e2377fe0b65e3c7577ff6df1701c56ef477d336f
+Author: Hugh Dickins <hughd@google.com>
+Date: Mon Jun 27 16:18:19 2011 -0700
+
+ drm/i915: use shmem_truncate_range
+
+ The interface to ->truncate_range is changing very slightly: once "tmpfs:
+ take control of its truncate_range" has been applied, this can be applied.
+ For now there is only a slight inefficiency while this remains unapplied,
+ but it will soon become essential for managing shmem's use of swap.
+
+ Change i915_gem_object_truncate() to use shmem_truncate_range() directly:
+ which should also spare i915 later change if we switch from
+ inode_operations->truncate_range to file_operations->fallocate.
+
+ Signed-off-by: Hugh Dickins <hughd@google.com>
+ Cc: Christoph Hellwig <hch@infradead.org>
+ Cc: Chris Wilson <chris@chris-wilson.co.uk>
+ Cc: Keith Packard <keithp@keithp.com>
+ Cc: Dave Airlie <airlied@redhat.com>
+ Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+ Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+
--- /dev/null
+--- a/drivers/gpu/drm/i915/i915_gem.c
++++ b/drivers/gpu/drm/i915/i915_gem.c
+@@ -1620,7 +1620,13 @@
+ * backing pages, *now*.
+ */
+ inode = file_inode(obj->base.filp);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0))
+ shmem_truncate_range(inode, 0, (loff_t)-1);
++#else
++ truncate_inode_pages(inode->i_mapping, 0);
++ if (inode->i_op->truncate_range)
++ inode->i_op->truncate_range(inode, 0, (loff_t)-1);
++#endif
+
+ obj->madv = __I915_MADV_PURGED;
+ }
+++ /dev/null
-Rename CONFIG_NOUVEAU_DEBUG and CONFIG_NOUVEAU_DEBUG_DEFAULT to
-CONFIG_COMPAT_*.
-
---- a/drivers/gpu/drm/nouveau/core/core/option.c
-+++ b/drivers/gpu/drm/nouveau/core/core/option.c
-@@ -86,7 +86,7 @@ nouveau_boolopt(const char *optstr, cons
- int
- nouveau_dbgopt(const char *optstr, const char *sub)
- {
-- int mode = 1, level = CONFIG_NOUVEAU_DEBUG_DEFAULT;
-+ int mode = 1, level = CONFIG_COMPAT_NOUVEAU_DEBUG_DEFAULT;
-
- while (optstr) {
- int len = strcspn(optstr, ",=");
---- a/drivers/gpu/drm/nouveau/core/include/core/client.h
-+++ b/drivers/gpu/drm/nouveau/core/include/core/client.h
-@@ -15,7 +15,7 @@ struct nouveau_client {
- static inline struct nouveau_client *
- nv_client(void *obj)
- {
--#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
-+#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
- if (unlikely(!nv_iclass(obj, NV_CLIENT_CLASS)))
- nv_assert("BAD CAST -> NvClient, %08x", nv_hclass(obj));
- #endif
---- a/drivers/gpu/drm/nouveau/core/include/core/device.h
-+++ b/drivers/gpu/drm/nouveau/core/include/core/device.h
-@@ -97,7 +97,7 @@ nv_device(void *obj)
- if (device->parent)
- device = device->parent;
-
--#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
-+#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
- if (unlikely(!nv_iclass(device, NV_SUBDEV_CLASS) ||
- (nv_hclass(device) & 0xff) != NVDEV_SUBDEV_DEVICE)) {
- nv_assert("BAD CAST -> NvDevice, 0x%08x 0x%08x",
---- a/drivers/gpu/drm/nouveau/core/include/core/engctx.h
-+++ b/drivers/gpu/drm/nouveau/core/include/core/engctx.h
-@@ -20,7 +20,7 @@ struct nouveau_engctx {
- static inline struct nouveau_engctx *
- nv_engctx(void *obj)
- {
--#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
-+#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
- if (unlikely(!nv_iclass(obj, NV_ENGCTX_CLASS)))
- nv_assert("BAD CAST -> NvEngCtx, %08x", nv_hclass(obj));
- #endif
---- a/drivers/gpu/drm/nouveau/core/include/core/engine.h
-+++ b/drivers/gpu/drm/nouveau/core/include/core/engine.h
-@@ -22,7 +22,7 @@ struct nouveau_engine {
- static inline struct nouveau_engine *
- nv_engine(void *obj)
- {
--#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
-+#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
- if (unlikely(!nv_iclass(obj, NV_ENGINE_CLASS)))
- nv_assert("BAD CAST -> NvEngine, %08x", nv_hclass(obj));
- #endif
---- a/drivers/gpu/drm/nouveau/core/include/core/gpuobj.h
-+++ b/drivers/gpu/drm/nouveau/core/include/core/gpuobj.h
-@@ -27,7 +27,7 @@ struct nouveau_gpuobj {
- static inline struct nouveau_gpuobj *
- nv_gpuobj(void *obj)
- {
--#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
-+#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
- if (unlikely(!nv_iclass(obj, NV_GPUOBJ_CLASS)))
- nv_assert("BAD CAST -> NvGpuObj, %08x", nv_hclass(obj));
- #endif
---- a/drivers/gpu/drm/nouveau/core/include/core/namedb.h
-+++ b/drivers/gpu/drm/nouveau/core/include/core/namedb.h
-@@ -14,7 +14,7 @@ struct nouveau_namedb {
- static inline struct nouveau_namedb *
- nv_namedb(void *obj)
- {
--#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
-+#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
- if (unlikely(!nv_iclass(obj, NV_NAMEDB_CLASS)))
- nv_assert("BAD CAST -> NvNameDB, %08x", nv_hclass(obj));
- #endif
---- a/drivers/gpu/drm/nouveau/core/include/core/object.h
-+++ b/drivers/gpu/drm/nouveau/core/include/core/object.h
-@@ -20,7 +20,7 @@ struct nouveau_object {
- struct nouveau_object *engine;
- atomic_t refcount;
- atomic_t usecount;
--#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
-+#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
- #define NOUVEAU_OBJECT_MAGIC 0x75ef0bad
- struct list_head list;
- u32 _magic;
-@@ -30,7 +30,7 @@ struct nouveau_object {
- static inline struct nouveau_object *
- nv_object(void *obj)
- {
--#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
-+#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
- if (likely(obj)) {
- struct nouveau_object *object = obj;
- if (unlikely(object->_magic != NOUVEAU_OBJECT_MAGIC))
---- a/drivers/gpu/drm/nouveau/core/include/core/parent.h
-+++ b/drivers/gpu/drm/nouveau/core/include/core/parent.h
-@@ -29,7 +29,7 @@ struct nouveau_parent {
- static inline struct nouveau_parent *
- nv_parent(void *obj)
- {
--#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
-+#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
- if (unlikely(!(nv_iclass(obj, NV_PARENT_CLASS))))
- nv_assert("BAD CAST -> NvParent, %08x", nv_hclass(obj));
- #endif
---- a/drivers/gpu/drm/nouveau/core/include/core/printk.h
-+++ b/drivers/gpu/drm/nouveau/core/include/core/printk.h
-@@ -19,7 +19,7 @@ void __printf(4, 5)
- nv_printk_(struct nouveau_object *, const char *, int, const char *, ...);
-
- #define nv_printk(o,l,f,a...) do { \
-- if (NV_DBG_##l <= CONFIG_NOUVEAU_DEBUG) \
-+ if (NV_DBG_##l <= CONFIG_COMPAT_NOUVEAU_DEBUG) \
- nv_printk_(nv_object(o), NV_PRINTK_##l, NV_DBG_##l, f, ##a); \
- } while(0)
-
-@@ -32,7 +32,7 @@ nv_printk_(struct nouveau_object *, cons
- #define nv_spam(o,f,a...) nv_printk((o), SPAM, f, ##a)
-
- #define nv_assert(f,a...) do { \
-- if (NV_DBG_FATAL <= CONFIG_NOUVEAU_DEBUG) \
-+ if (NV_DBG_FATAL <= CONFIG_COMPAT_NOUVEAU_DEBUG) \
- nv_printk_(NULL, NV_PRINTK_FATAL, NV_DBG_FATAL, f "\n", ##a); \
- BUG_ON(1); \
- } while(0)
---- a/drivers/gpu/drm/nouveau/core/include/core/subdev.h
-+++ b/drivers/gpu/drm/nouveau/core/include/core/subdev.h
-@@ -20,7 +20,7 @@ struct nouveau_subdev {
- static inline struct nouveau_subdev *
- nv_subdev(void *obj)
- {
--#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
-+#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
- if (unlikely(!nv_iclass(obj, NV_SUBDEV_CLASS)))
- nv_assert("BAD CAST -> NvSubDev, %08x", nv_hclass(obj));
- #endif
---- a/drivers/gpu/drm/nouveau/core/include/subdev/instmem.h
-+++ b/drivers/gpu/drm/nouveau/core/include/subdev/instmem.h
-@@ -16,7 +16,7 @@ struct nouveau_instobj {
- static inline struct nouveau_instobj *
- nv_memobj(void *obj)
- {
--#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
-+#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
- if (unlikely(!nv_iclass(obj, NV_MEMOBJ_CLASS)))
- nv_assert("BAD CAST -> NvMemObj, %08x", nv_hclass(obj));
- #endif
--- /dev/null
+Rename CONFIG_NOUVEAU_DEBUG and CONFIG_NOUVEAU_DEBUG_DEFAULT to
+CONFIG_COMPAT_*.
+
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/core/core/option.c
++++ b/drivers/gpu/drm/nouveau/core/core/option.c
+@@ -86,7 +86,7 @@
+ int
+ nouveau_dbgopt(const char *optstr, const char *sub)
+ {
+- int mode = 1, level = CONFIG_NOUVEAU_DEBUG_DEFAULT;
++ int mode = 1, level = CONFIG_COMPAT_NOUVEAU_DEBUG_DEFAULT;
+
+ while (optstr) {
+ int len = strcspn(optstr, ",=");
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/core/include/core/client.h
++++ b/drivers/gpu/drm/nouveau/core/include/core/client.h
+@@ -15,7 +15,7 @@
+ static inline struct nouveau_client *
+ nv_client(void *obj)
+ {
+-#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
++#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
+ if (unlikely(!nv_iclass(obj, NV_CLIENT_CLASS)))
+ nv_assert("BAD CAST -> NvClient, %08x", nv_hclass(obj));
+ #endif
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/core/include/core/device.h
++++ b/drivers/gpu/drm/nouveau/core/include/core/device.h
+@@ -97,7 +97,7 @@
+ if (device->parent)
+ device = device->parent;
+
+-#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
++#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
+ if (unlikely(!nv_iclass(device, NV_SUBDEV_CLASS) ||
+ (nv_hclass(device) & 0xff) != NVDEV_SUBDEV_DEVICE)) {
+ nv_assert("BAD CAST -> NvDevice, 0x%08x 0x%08x",
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/core/include/core/engctx.h
++++ b/drivers/gpu/drm/nouveau/core/include/core/engctx.h
+@@ -20,7 +20,7 @@
+ static inline struct nouveau_engctx *
+ nv_engctx(void *obj)
+ {
+-#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
++#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
+ if (unlikely(!nv_iclass(obj, NV_ENGCTX_CLASS)))
+ nv_assert("BAD CAST -> NvEngCtx, %08x", nv_hclass(obj));
+ #endif
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/core/include/core/engine.h
++++ b/drivers/gpu/drm/nouveau/core/include/core/engine.h
+@@ -22,7 +22,7 @@
+ static inline struct nouveau_engine *
+ nv_engine(void *obj)
+ {
+-#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
++#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
+ if (unlikely(!nv_iclass(obj, NV_ENGINE_CLASS)))
+ nv_assert("BAD CAST -> NvEngine, %08x", nv_hclass(obj));
+ #endif
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/core/include/core/gpuobj.h
++++ b/drivers/gpu/drm/nouveau/core/include/core/gpuobj.h
+@@ -27,7 +27,7 @@
+ static inline struct nouveau_gpuobj *
+ nv_gpuobj(void *obj)
+ {
+-#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
++#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
+ if (unlikely(!nv_iclass(obj, NV_GPUOBJ_CLASS)))
+ nv_assert("BAD CAST -> NvGpuObj, %08x", nv_hclass(obj));
+ #endif
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/core/include/core/namedb.h
++++ b/drivers/gpu/drm/nouveau/core/include/core/namedb.h
+@@ -14,7 +14,7 @@
+ static inline struct nouveau_namedb *
+ nv_namedb(void *obj)
+ {
+-#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
++#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
+ if (unlikely(!nv_iclass(obj, NV_NAMEDB_CLASS)))
+ nv_assert("BAD CAST -> NvNameDB, %08x", nv_hclass(obj));
+ #endif
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/core/include/core/object.h
++++ b/drivers/gpu/drm/nouveau/core/include/core/object.h
+@@ -20,7 +20,7 @@
+ struct nouveau_object *engine;
+ atomic_t refcount;
+ atomic_t usecount;
+-#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
++#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
+ #define NOUVEAU_OBJECT_MAGIC 0x75ef0bad
+ struct list_head list;
+ u32 _magic;
+@@ -30,7 +30,7 @@
+ static inline struct nouveau_object *
+ nv_object(void *obj)
+ {
+-#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
++#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
+ if (likely(obj)) {
+ struct nouveau_object *object = obj;
+ if (unlikely(object->_magic != NOUVEAU_OBJECT_MAGIC))
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/core/include/core/parent.h
++++ b/drivers/gpu/drm/nouveau/core/include/core/parent.h
+@@ -29,7 +29,7 @@
+ static inline struct nouveau_parent *
+ nv_parent(void *obj)
+ {
+-#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
++#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
+ if (unlikely(!(nv_iclass(obj, NV_PARENT_CLASS))))
+ nv_assert("BAD CAST -> NvParent, %08x", nv_hclass(obj));
+ #endif
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/core/include/core/printk.h
++++ b/drivers/gpu/drm/nouveau/core/include/core/printk.h
+@@ -19,7 +19,7 @@
+ nv_printk_(struct nouveau_object *, const char *, int, const char *, ...);
+
+ #define nv_printk(o,l,f,a...) do { \
+- if (NV_DBG_##l <= CONFIG_NOUVEAU_DEBUG) \
++ if (NV_DBG_##l <= CONFIG_COMPAT_NOUVEAU_DEBUG) \
+ nv_printk_(nv_object(o), NV_PRINTK_##l, NV_DBG_##l, f, ##a); \
+ } while(0)
+
+@@ -32,7 +32,7 @@
+ #define nv_spam(o,f,a...) nv_printk((o), SPAM, f, ##a)
+
+ #define nv_assert(f,a...) do { \
+- if (NV_DBG_FATAL <= CONFIG_NOUVEAU_DEBUG) \
++ if (NV_DBG_FATAL <= CONFIG_COMPAT_NOUVEAU_DEBUG) \
+ nv_printk_(NULL, NV_PRINTK_FATAL, NV_DBG_FATAL, f "\n", ##a); \
+ BUG_ON(1); \
+ } while(0)
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/core/include/core/subdev.h
++++ b/drivers/gpu/drm/nouveau/core/include/core/subdev.h
+@@ -20,7 +20,7 @@
+ static inline struct nouveau_subdev *
+ nv_subdev(void *obj)
+ {
+-#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
++#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
+ if (unlikely(!nv_iclass(obj, NV_SUBDEV_CLASS)))
+ nv_assert("BAD CAST -> NvSubDev, %08x", nv_hclass(obj));
+ #endif
--- /dev/null
+--- a/drivers/gpu/drm/nouveau/core/include/subdev/instmem.h
++++ b/drivers/gpu/drm/nouveau/core/include/subdev/instmem.h
+@@ -16,7 +16,7 @@
+ static inline struct nouveau_instobj *
+ nv_memobj(void *obj)
+ {
+-#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
++#if CONFIG_COMPAT_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
+ if (unlikely(!nv_iclass(obj, NV_MEMOBJ_CLASS)))
+ nv_assert("BAD CAST -> NvMemObj, %08x", nv_hclass(obj));
+ #endif
+++ /dev/null
-acpi_get_table_with_size() was exported with kernels >= 3.6. Revert the
-size checking for kernels < 3.6.
-
---- a/drivers/gpu/drm/radeon/radeon_bios.c
-+++ b/drivers/gpu/drm/radeon/radeon_bios.c
-@@ -554,12 +554,21 @@ static bool radeon_acpi_vfct_bios(struct
- {
- bool ret = false;
- struct acpi_table_header *hdr;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
- acpi_size tbl_size;
-+#else
-+ /* acpi_get_table_with_size() not exported on kernels < 3.6 */
-+ acpi_size tbl_size = 0x7fffffff;
-+#endif
- UEFI_ACPI_VFCT *vfct;
- GOP_VBIOS_CONTENT *vbios;
- VFCT_IMAGE_HEADER *vhdr;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
- if (!ACPI_SUCCESS(acpi_get_table_with_size("VFCT", 1, &hdr, &tbl_size)))
-+#else
-+ if (!ACPI_SUCCESS(acpi_get_table("VFCT", 1, &hdr)))
-+#endif
- return false;
- if (tbl_size < sizeof(UEFI_ACPI_VFCT)) {
- DRM_ERROR("ACPI VFCT table present but broken (too short #1)\n");
--- /dev/null
+acpi_get_table_with_size() was exported with kernels >= 3.6. Revert the
+size checking for kernels < 3.6.
+
--- /dev/null
+--- a/drivers/gpu/drm/radeon/radeon_bios.c
++++ b/drivers/gpu/drm/radeon/radeon_bios.c
+@@ -554,12 +554,21 @@
+ {
+ bool ret = false;
+ struct acpi_table_header *hdr;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ acpi_size tbl_size;
++#else
++ /* acpi_get_table_with_size() not exported on kernels < 3.6 */
++ acpi_size tbl_size = 0x7fffffff;
++#endif
+ UEFI_ACPI_VFCT *vfct;
+ GOP_VBIOS_CONTENT *vbios;
+ VFCT_IMAGE_HEADER *vhdr;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ if (!ACPI_SUCCESS(acpi_get_table_with_size("VFCT", 1, &hdr, &tbl_size)))
++#else
++ if (!ACPI_SUCCESS(acpi_get_table("VFCT", 1, &hdr)))
++#endif
+ return false;
+ if (tbl_size < sizeof(UEFI_ACPI_VFCT)) {
+ DRM_ERROR("ACPI VFCT table present but broken (too short #1)\n");
+++ /dev/null
---- a/drivers/gpu/drm/drm_modes.c
-+++ b/drivers/gpu/drm/drm_modes.c
-@@ -35,8 +35,12 @@
- #include <linux/export.h>
- #include <drm/drmP.h>
- #include <drm/drm_crtc.h>
-+#if IS_ENABLED(CONFIG_OF_VIDEOMODE)
- #include <video/of_videomode.h>
-+#endif
-+#if IS_ENABLED(CONFIG_VIDEOMODE)
- #include <video/videomode.h>
-+#endif
-
- /**
- * drm_mode_debug_printmodeline - debug print a mode
--- /dev/null
+--- a/drivers/gpu/drm/drm_modes.c
++++ b/drivers/gpu/drm/drm_modes.c
+@@ -35,8 +35,12 @@
+ #include <linux/export.h>
+ #include <drm/drmP.h>
+ #include <drm/drm_crtc.h>
++#if IS_ENABLED(CONFIG_OF_VIDEOMODE)
+ #include <video/of_videomode.h>
++#endif
++#if IS_ENABLED(CONFIG_VIDEOMODE)
+ #include <video/videomode.h>
++#endif
+
+ /**
+ * drm_mode_debug_printmodeline - debug print a mode
+++ /dev/null
-
-Undef/define/include printk.h for fixing redefinition warnings
-during build.
-
-Patch adapted from compat-wireless tree.
-
---- a/drivers/gpu/drm/drm_fb_helper.c
-+++ b/drivers/gpu/drm/drm_fb_helper.c
-@@ -27,9 +27,11 @@
- * Dave Airlie <airlied@linux.ie>
- * Jesse Barnes <jesse.barnes@intel.com>
- */
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include <linux/kernel.h>
-+#include <linux/printk.h>
- #include <linux/sysrq.h>
- #include <linux/slab.h>
- #include <linux/fb.h>
---- a/drivers/gpu/drm/ttm/ttm_agp_backend.c
-+++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c
-@@ -29,8 +29,10 @@
- * Keith Packard.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) "[TTM] " fmt
-
-+#include <linux/printk.h>
- #include <drm/ttm/ttm_module.h>
- #include <drm/ttm/ttm_bo_driver.h>
- #include <drm/ttm/ttm_page_alloc.h>
---- a/drivers/gpu/drm/ttm/ttm_bo.c
-+++ b/drivers/gpu/drm/ttm/ttm_bo.c
-@@ -28,11 +28,13 @@
- * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) "[TTM] " fmt
-
- #include <drm/ttm/ttm_module.h>
- #include <drm/ttm/ttm_bo_driver.h>
- #include <drm/ttm/ttm_placement.h>
-+#include <linux/printk.h>
- #include <linux/jiffies.h>
- #include <linux/slab.h>
- #include <linux/sched.h>
---- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
-+++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
-@@ -28,8 +28,10 @@
- * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) "[TTM] " fmt
-
-+#include <linux/printk.h>
- #include <ttm/ttm_module.h>
- #include <ttm/ttm_bo_driver.h>
- #include <ttm/ttm_placement.h>
---- a/drivers/gpu/drm/ttm/ttm_memory.c
-+++ b/drivers/gpu/drm/ttm/ttm_memory.c
-@@ -25,11 +25,13 @@
- *
- **************************************************************************/
-
-+#undef pr_fmt
- #define pr_fmt(fmt) "[TTM] " fmt
-
- #include <drm/ttm/ttm_memory.h>
- #include <drm/ttm/ttm_module.h>
- #include <drm/ttm/ttm_page_alloc.h>
-+#include <linux/printk.h>
- #include <linux/spinlock.h>
- #include <linux/sched.h>
- #include <linux/wait.h>
---- a/drivers/gpu/drm/ttm/ttm_object.c
-+++ b/drivers/gpu/drm/ttm/ttm_object.c
-@@ -49,10 +49,12 @@
- * for fast lookup of ref objects given a base object.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) "[TTM] " fmt
-
- #include <drm/ttm/ttm_object.h>
- #include <drm/ttm/ttm_module.h>
-+#include <linux/printk.h>
- #include <linux/list.h>
- #include <linux/spinlock.h>
- #include <linux/slab.h>
---- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
-+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
-@@ -31,8 +31,10 @@
- * - doesn't track currently in use pages
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) "[TTM] " fmt
-
-+#include <linux/printk.h>
- #include <linux/list.h>
- #include <linux/spinlock.h>
- #include <linux/highmem.h>
---- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
-+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
-@@ -33,8 +33,10 @@
- * when freed).
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) "[TTM] " fmt
-
-+#include <linux/printk.h>
- #include <linux/dma-mapping.h>
- #include <linux/list.h>
- #include <linux/seq_file.h> /* for seq_printf */
---- a/drivers/gpu/drm/ttm/ttm_tt.c
-+++ b/drivers/gpu/drm/ttm/ttm_tt.c
-@@ -28,8 +28,10 @@
- * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) "[TTM] " fmt
-
-+#include <linux/printk.h>
- #include <linux/sched.h>
- #include <linux/highmem.h>
- #include <linux/pagemap.h>
---- a/drivers/gpu/drm/i915/i915_dma.c
-+++ b/drivers/gpu/drm/i915/i915_dma.c
-@@ -26,6 +26,7 @@
- *
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include <drm/drmP.h>
-@@ -35,6 +36,7 @@
- #include <drm/i915_drm.h>
- #include "i915_drv.h"
- #include "i915_trace.h"
-+#include <linux/printk.h>
- #include <linux/pci.h>
- #include <linux/vgaarb.h>
- #include <linux/acpi.h>
---- a/drivers/gpu/drm/i915/i915_irq.c
-+++ b/drivers/gpu/drm/i915/i915_irq.c
-@@ -26,8 +26,10 @@
- *
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/sysrq.h>
- #include <linux/slab.h>
- #include <drm/drmP.h>
---- a/drivers/gpu/drm/i915/intel_opregion.c
-+++ b/drivers/gpu/drm/i915/intel_opregion.c
-@@ -25,8 +25,10 @@
- *
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/acpi.h>
- #include <linux/acpi_io.h>
- #include <acpi/video.h>
---- a/drivers/gpu/drm/i915/intel_panel.c
-+++ b/drivers/gpu/drm/i915/intel_panel.c
-@@ -28,8 +28,10 @@
- * Chris Wilson <chris@chris-wilson.co.uk>
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/moduleparam.h>
- #include "intel_drv.h"
-
--- /dev/null
+
+Undef/define/include printk.h for fixing redefinition warnings
+during build.
+
+Patch adapted from compat-wireless tree.
+
--- /dev/null
+--- a/drivers/gpu/drm/drm_fb_helper.c
++++ b/drivers/gpu/drm/drm_fb_helper.c
+@@ -27,9 +27,11 @@
+ * Dave Airlie <airlied@linux.ie>
+ * Jesse Barnes <jesse.barnes@intel.com>
+ */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/sysrq.h>
+ #include <linux/slab.h>
+ #include <linux/fb.h>
--- /dev/null
+--- a/drivers/gpu/drm/i915/i915_dma.c
++++ b/drivers/gpu/drm/i915/i915_dma.c
+@@ -26,6 +26,7 @@
+ *
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <drm/drmP.h>
+@@ -35,6 +36,7 @@
+ #include <drm/i915_drm.h>
+ #include "i915_drv.h"
+ #include "i915_trace.h"
++#include <linux/printk.h>
+ #include <linux/pci.h>
+ #include <linux/vgaarb.h>
+ #include <linux/acpi.h>
--- /dev/null
+--- a/drivers/gpu/drm/i915/i915_irq.c
++++ b/drivers/gpu/drm/i915/i915_irq.c
+@@ -26,8 +26,10 @@
+ *
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/sysrq.h>
+ #include <linux/slab.h>
+ #include <drm/drmP.h>
--- /dev/null
+--- a/drivers/gpu/drm/i915/intel_opregion.c
++++ b/drivers/gpu/drm/i915/intel_opregion.c
+@@ -25,8 +25,10 @@
+ *
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/acpi.h>
+ #include <linux/acpi_io.h>
+ #include <acpi/video.h>
--- /dev/null
+--- a/drivers/gpu/drm/i915/intel_panel.c
++++ b/drivers/gpu/drm/i915/intel_panel.c
+@@ -28,8 +28,10 @@
+ * Chris Wilson <chris@chris-wilson.co.uk>
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/moduleparam.h>
+ #include "intel_drv.h"
+
--- /dev/null
+--- a/drivers/gpu/drm/ttm/ttm_agp_backend.c
++++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c
+@@ -29,8 +29,10 @@
+ * Keith Packard.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) "[TTM] " fmt
+
++#include <linux/printk.h>
+ #include <drm/ttm/ttm_module.h>
+ #include <drm/ttm/ttm_bo_driver.h>
+ #include <drm/ttm/ttm_page_alloc.h>
--- /dev/null
+--- a/drivers/gpu/drm/ttm/ttm_bo.c
++++ b/drivers/gpu/drm/ttm/ttm_bo.c
+@@ -28,11 +28,13 @@
+ * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) "[TTM] " fmt
+
+ #include <drm/ttm/ttm_module.h>
+ #include <drm/ttm/ttm_bo_driver.h>
+ #include <drm/ttm/ttm_placement.h>
++#include <linux/printk.h>
+ #include <linux/jiffies.h>
+ #include <linux/slab.h>
+ #include <linux/sched.h>
--- /dev/null
+--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
++++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
+@@ -28,8 +28,10 @@
+ * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) "[TTM] " fmt
+
++#include <linux/printk.h>
+ #include <ttm/ttm_module.h>
+ #include <ttm/ttm_bo_driver.h>
+ #include <ttm/ttm_placement.h>
--- /dev/null
+--- a/drivers/gpu/drm/ttm/ttm_memory.c
++++ b/drivers/gpu/drm/ttm/ttm_memory.c
+@@ -25,11 +25,13 @@
+ *
+ **************************************************************************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) "[TTM] " fmt
+
+ #include <drm/ttm/ttm_memory.h>
+ #include <drm/ttm/ttm_module.h>
+ #include <drm/ttm/ttm_page_alloc.h>
++#include <linux/printk.h>
+ #include <linux/spinlock.h>
+ #include <linux/sched.h>
+ #include <linux/wait.h>
--- /dev/null
+--- a/drivers/gpu/drm/ttm/ttm_object.c
++++ b/drivers/gpu/drm/ttm/ttm_object.c
+@@ -49,10 +49,12 @@
+ * for fast lookup of ref objects given a base object.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) "[TTM] " fmt
+
+ #include <drm/ttm/ttm_object.h>
+ #include <drm/ttm/ttm_module.h>
++#include <linux/printk.h>
+ #include <linux/list.h>
+ #include <linux/spinlock.h>
+ #include <linux/slab.h>
--- /dev/null
+--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
++++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
+@@ -31,8 +31,10 @@
+ * - doesn't track currently in use pages
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) "[TTM] " fmt
+
++#include <linux/printk.h>
+ #include <linux/list.h>
+ #include <linux/spinlock.h>
+ #include <linux/highmem.h>
--- /dev/null
+--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
++++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+@@ -33,8 +33,10 @@
+ * when freed).
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) "[TTM] " fmt
+
++#include <linux/printk.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/list.h>
+ #include <linux/seq_file.h> /* for seq_printf */
--- /dev/null
+--- a/drivers/gpu/drm/ttm/ttm_tt.c
++++ b/drivers/gpu/drm/ttm/ttm_tt.c
+@@ -28,8 +28,10 @@
+ * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) "[TTM] " fmt
+
++#include <linux/printk.h>
+ #include <linux/sched.h>
+ #include <linux/highmem.h>
+ #include <linux/pagemap.h>
+++ /dev/null
-Remove drivers that we do not want to build from gpu/drm/Makefile
-
---- a/drivers/gpu/drm/Makefile
-+++ b/drivers/gpu/drm/Makefile
-@@ -31,25 +31,14 @@ CFLAGS_drm_trace_points.o := -I$(src)
- obj-$(CONFIG_COMPAT_DRM) += drm.o
- obj-$(CONFIG_COMPAT_DRM_USB) += drm_usb.o
- obj-$(CONFIG_COMPAT_DRM_TTM) += ttm/
--obj-$(CONFIG_COMPAT_DRM_TDFX) += tdfx/
--obj-$(CONFIG_COMPAT_DRM_R128) += r128/
- obj-$(CONFIG_COMPAT_DRM_RADEON)+= radeon/
--obj-$(CONFIG_COMPAT_DRM_MGA) += mga/
- obj-$(CONFIG_COMPAT_DRM_I810) += i810/
- obj-$(CONFIG_COMPAT_DRM_I915) += i915/
- obj-$(CONFIG_COMPAT_DRM_MGAG200) += mgag200/
- obj-$(CONFIG_COMPAT_DRM_CIRRUS_QEMU) += cirrus/
--obj-$(CONFIG_COMPAT_DRM_SIS) += sis/
--obj-$(CONFIG_COMPAT_DRM_SAVAGE)+= savage/
- obj-$(CONFIG_COMPAT_DRM_VMWGFX)+= vmwgfx/
- obj-$(CONFIG_COMPAT_DRM_VIA) +=via/
- obj-$(CONFIG_COMPAT_DRM_NOUVEAU) +=nouveau/
--obj-$(CONFIG_COMPAT_DRM_EXYNOS) +=exynos/
- obj-$(CONFIG_COMPAT_DRM_GMA500) += gma500/
--obj-$(CONFIG_COMPAT_DRM_UDL) += udl/
- obj-$(CONFIG_COMPAT_DRM_AST) += ast/
--obj-$(CONFIG_COMPAT_DRM_SHMOBILE) +=shmobile/
--obj-$(CONFIG_COMPAT_DRM_TEGRA) += tegra/
--obj-$(CONFIG_COMPAT_DRM_OMAP) += omapdrm/
--obj-$(CONFIG_COMPAT_DRM_TILCDC) += tilcdc/
- obj-y += i2c/
--- /dev/null
+Remove drivers that we do not want to build from gpu/drm/Makefile
+
--- /dev/null
+--- a/drivers/gpu/drm/Makefile
++++ b/drivers/gpu/drm/Makefile
+@@ -31,25 +31,14 @@
+ obj-$(CONFIG_COMPAT_DRM) += drm.o
+ obj-$(CONFIG_COMPAT_DRM_USB) += drm_usb.o
+ obj-$(CONFIG_COMPAT_DRM_TTM) += ttm/
+-obj-$(CONFIG_COMPAT_DRM_TDFX) += tdfx/
+-obj-$(CONFIG_COMPAT_DRM_R128) += r128/
+ obj-$(CONFIG_COMPAT_DRM_RADEON)+= radeon/
+-obj-$(CONFIG_COMPAT_DRM_MGA) += mga/
+ obj-$(CONFIG_COMPAT_DRM_I810) += i810/
+ obj-$(CONFIG_COMPAT_DRM_I915) += i915/
+ obj-$(CONFIG_COMPAT_DRM_MGAG200) += mgag200/
+ obj-$(CONFIG_COMPAT_DRM_CIRRUS_QEMU) += cirrus/
+-obj-$(CONFIG_COMPAT_DRM_SIS) += sis/
+-obj-$(CONFIG_COMPAT_DRM_SAVAGE)+= savage/
+ obj-$(CONFIG_COMPAT_DRM_VMWGFX)+= vmwgfx/
+ obj-$(CONFIG_COMPAT_DRM_VIA) +=via/
+ obj-$(CONFIG_COMPAT_DRM_NOUVEAU) +=nouveau/
+-obj-$(CONFIG_COMPAT_DRM_EXYNOS) +=exynos/
+ obj-$(CONFIG_COMPAT_DRM_GMA500) += gma500/
+-obj-$(CONFIG_COMPAT_DRM_UDL) += udl/
+ obj-$(CONFIG_COMPAT_DRM_AST) += ast/
+-obj-$(CONFIG_COMPAT_DRM_SHMOBILE) +=shmobile/
+-obj-$(CONFIG_COMPAT_DRM_TEGRA) += tegra/
+-obj-$(CONFIG_COMPAT_DRM_OMAP) += omapdrm/
+-obj-$(CONFIG_COMPAT_DRM_TILCDC) += tilcdc/
+ obj-y += i2c/
+++ /dev/null
-
-This patch backports the struct net_device_ops changes added on 2.6.29.
-
-If we add the compat.git netdev_attach_ops() implementation
-for newer kernels upstream it means we do not have to use this
-patch at all for older kernels.
-
-mcgrof@tux ~/linux-stable (git::master)$ git describe --contains d314774cf2cd5dfeb39a00d37deee65d4c627927
-v2.6.29-rc1~581^2~677
-
-commit d314774cf2cd5dfeb39a00d37deee65d4c627927
-Author: Stephen Hemminger <shemminger@vyatta.com>
-Date: Wed Nov 19 21:32:24 2008 -0800
-
- netdev: network device operations infrastructure
-
- This patch changes the network device internal API to move adminstrative
- operations out of the network device structure and into a separate structure.
-
- This patch involves some hackery to maintain compatablity between the
- new and old model, so all 300+ drivers don't have to be changed at once.
- For drivers that aren't converted yet, the netdevice_ops virt function list
- still resides in the net_device structure. For old protocols, the new
- net_device_ops are copied out to the old net_device pointers.
-
- After the transistion is completed the nag message can be changed to
- an WARN_ON, and the compatiablity code can be made configurable.
-
- Some function pointers aren't moved:
- * destructor can't be in net_device_ops because
- it may need to be referenced after the module is unloaded.
- * neighbor setup is manipulated in a couple of places that need special
- consideration
- * hard_start_xmit is in the fast path for transmit.
-
- Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
- Signed-off-by: David S. Miller <davem@davemloft.net>
-
---- a/drivers/net/usb/rndis_host.c
-+++ b/drivers/net/usb/rndis_host.c
-@@ -358,7 +358,7 @@ generic_rndis_bind(struct usbnet *dev, s
- dev->rx_urb_size &= ~(dev->maxpacket - 1);
- u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size);
-
-- net->netdev_ops = &rndis_netdev_ops;
-+ netdev_attach_ops(net, &rndis_netdev_ops);
-
- retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE);
- if (unlikely(retval < 0)) {
---- a/drivers/net/usb/usbnet.c
-+++ b/drivers/net/usb/usbnet.c
-@@ -1446,7 +1446,7 @@ usbnet_probe (struct usb_interface *udev
- net->features |= NETIF_F_HIGHDMA;
- #endif
-
-- net->netdev_ops = &usbnet_netdev_ops;
-+ netdev_attach_ops(net, &usbnet_netdev_ops);
- net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
- net->ethtool_ops = &usbnet_ethtool_ops;
-
---- a/drivers/net/wireless/ath/ath6kl/main.c
-+++ b/drivers/net/wireless/ath/ath6kl/main.c
-@@ -1289,7 +1289,7 @@ static const struct net_device_ops ath6k
-
- void init_netdev(struct net_device *dev)
- {
-- dev->netdev_ops = &ath6kl_netdev_ops;
-+ netdev_attach_ops(dev, &ath6kl_netdev_ops);
- dev->destructor = free_netdev;
- dev->watchdog_timeo = ATH6KL_TX_TIMEOUT;
-
---- a/drivers/net/wireless/ath/wil6210/netdev.c
-+++ b/drivers/net/wireless/ath/wil6210/netdev.c
-@@ -76,7 +76,7 @@ void *wil_if_alloc(struct device *dev, v
- goto out_priv;
- }
-
-- ndev->netdev_ops = &wil_netdev_ops;
-+ netdev_attach_ops(ndev, &wil_netdev_ops);
- ndev->ieee80211_ptr = wdev;
- SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy));
- wdev->netdev = ndev;
---- a/drivers/net/wireless/rndis_wlan.c
-+++ b/drivers/net/wireless/rndis_wlan.c
-@@ -3438,7 +3438,7 @@ static int rndis_wlan_bind(struct usbnet
- * rndis_host wants to avoid all OID as much as possible
- * so do promisc/multicast handling in rndis_wlan.
- */
-- usbdev->net->netdev_ops = &rndis_wlan_netdev_ops;
-+ netdev_attach_ops(usbdev->net, &rndis_wlan_netdev_ops);
-
- tmp = cpu_to_le32(RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST);
- retval = rndis_set_oid(usbdev,
---- a/drivers/net/ethernet/broadcom/b44.c
-+++ b/drivers/net/ethernet/broadcom/b44.c
-@@ -2170,7 +2170,7 @@ static int b44_init_one(struct ssb_devic
- bp->rx_pending = B44_DEF_RX_RING_PENDING;
- bp->tx_pending = B44_DEF_TX_RING_PENDING;
-
-- dev->netdev_ops = &b44_netdev_ops;
-+ netdev_attach_ops(dev, &b44_netdev_ops);
- netif_napi_add(dev, &bp->napi, b44_poll, 64);
- dev->watchdog_timeo = B44_TX_TIMEOUT;
- dev->irq = sdev->irq;
---- a/drivers/net/wireless/ipw2x00/ipw2100.c
-+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
-@@ -6086,7 +6086,7 @@ static struct net_device *ipw2100_alloc_
- priv->ieee->perfect_rssi = -20;
- priv->ieee->worst_rssi = -85;
-
-- dev->netdev_ops = &ipw2100_netdev_ops;
-+ netdev_attach_ops(dev, &ipw2100_netdev_ops);
- dev->ethtool_ops = &ipw2100_ethtool_ops;
- dev->wireless_handlers = &ipw2100_wx_handler_def;
- priv->wireless_data.libipw = priv->ieee;
---- a/drivers/net/wireless/ipw2x00/ipw2200.c
-+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
-@@ -11680,7 +11680,7 @@ static int ipw_prom_alloc(struct ipw_pri
- memcpy(priv->prom_net_dev->dev_addr, priv->mac_addr, ETH_ALEN);
-
- priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP;
-- priv->prom_net_dev->netdev_ops = &ipw_prom_netdev_ops;
-+ netdev_attach_ops(priv->prom_net_dev, &ipw_prom_netdev_ops);
-
- priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR;
- SET_NETDEV_DEV(priv->prom_net_dev, &priv->pci_dev->dev);
-@@ -11818,7 +11818,7 @@ static int ipw_pci_probe(struct pci_dev
- priv->ieee->perfect_rssi = -20;
- priv->ieee->worst_rssi = -85;
-
-- net_dev->netdev_ops = &ipw_netdev_ops;
-+ netdev_attach_ops(net_dev, &ipw_netdev_ops);
- priv->wireless_data.spy_data = &priv->ieee->spy_data;
- net_dev->wireless_data = &priv->wireless_data;
- net_dev->wireless_handlers = &ipw_wx_handler_def;
---- a/drivers/net/wireless/libertas/main.c
-+++ b/drivers/net/wireless/libertas/main.c
-@@ -993,7 +993,7 @@ struct lbs_private *lbs_add_card(void *c
- wdev->netdev = dev;
- priv->dev = dev;
-
-- dev->netdev_ops = &lbs_netdev_ops;
-+ netdev_attach_ops(dev, &lbs_netdev_ops);
- dev->watchdog_timeo = 5 * HZ;
- dev->ethtool_ops = &lbs_ethtool_ops;
- dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
---- a/drivers/net/wireless/libertas/mesh.c
-+++ b/drivers/net/wireless/libertas/mesh.c
-@@ -1015,7 +1015,7 @@ static int lbs_add_mesh(struct lbs_priva
- mesh_dev->ieee80211_ptr = mesh_wdev;
- priv->mesh_dev = mesh_dev;
-
-- mesh_dev->netdev_ops = &mesh_netdev_ops;
-+ netdev_attach_ops(mesh_dev, &mesh_netdev_ops);
- mesh_dev->ethtool_ops = &lbs_ethtool_ops;
- memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, ETH_ALEN);
-
---- a/drivers/net/wireless/mac80211_hwsim.c
-+++ b/drivers/net/wireless/mac80211_hwsim.c
-@@ -1695,7 +1695,7 @@ static const struct net_device_ops hwsim
-
- static void hwsim_mon_setup(struct net_device *dev)
- {
-- dev->netdev_ops = &hwsim_netdev_ops;
-+ netdev_attach_ops(dev, &hwsim_netdev_ops);
- dev->destructor = free_netdev;
- ether_setup(dev);
- dev->tx_queue_len = 0;
---- a/drivers/net/wireless/mwifiex/main.c
-+++ b/drivers/net/wireless/mwifiex/main.c
-@@ -654,7 +654,7 @@ static const struct net_device_ops mwifi
- void mwifiex_init_priv_params(struct mwifiex_private *priv,
- struct net_device *dev)
- {
-- dev->netdev_ops = &mwifiex_netdev_ops;
-+ netdev_attach_ops(dev, &mwifiex_netdev_ops);
- /* Initialize private structure */
- priv->current_key_index = 0;
- priv->media_connected = false;
---- a/net/bluetooth/bnep/netdev.c
-+++ b/net/bluetooth/bnep/netdev.c
-@@ -223,7 +223,7 @@ void bnep_net_setup(struct net_device *d
-
- ether_setup(dev);
- dev->priv_flags &= ~IFF_TX_SKB_SHARING;
-- dev->netdev_ops = &bnep_netdev_ops;
-+ netdev_attach_ops(dev, &bnep_netdev_ops);
-
- dev->watchdog_timeo = HZ * 2;
- }
---- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
-+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
-@@ -2207,7 +2207,7 @@ static int atl1e_init_netdev(struct net_
- SET_NETDEV_DEV(netdev, &pdev->dev);
- pci_set_drvdata(pdev, netdev);
-
-- netdev->netdev_ops = &atl1e_netdev_ops;
-+ netdev_attach_ops(netdev, &atl1e_netdev_ops);
-
- netdev->watchdog_timeo = AT_TX_WATCHDOG;
- atl1e_set_ethtool_ops(netdev);
---- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
-+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
-@@ -2470,7 +2470,7 @@ static int atl1c_init_netdev(struct net_
- SET_NETDEV_DEV(netdev, &pdev->dev);
- pci_set_drvdata(pdev, netdev);
-
-- netdev->netdev_ops = &atl1c_netdev_ops;
-+ netdev_attach_ops(netdev, &atl1c_netdev_ops);
- netdev->watchdog_timeo = AT_TX_WATCHDOG;
- atl1c_set_ethtool_ops(netdev);
-
---- a/drivers/net/ethernet/atheros/atlx/atl1.c
-+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
-@@ -3009,7 +3009,7 @@ static int atl1_probe(struct pci_dev *pd
- adapter->mii.phy_id_mask = 0x1f;
- adapter->mii.reg_num_mask = 0x1f;
-
-- netdev->netdev_ops = &atl1_netdev_ops;
-+ netdev_attach_ops(netdev, &atl1_netdev_ops);
- netdev->watchdog_timeo = 5 * HZ;
- netif_napi_add(netdev, &adapter->napi, atl1_rings_clean, 64);
-
---- a/drivers/net/ethernet/atheros/atlx/atl2.c
-+++ b/drivers/net/ethernet/atheros/atlx/atl2.c
-@@ -1396,7 +1396,7 @@ static int atl2_probe(struct pci_dev *pd
-
- atl2_setup_pcicmd(pdev);
-
-- netdev->netdev_ops = &atl2_netdev_ops;
-+ netdev_attach_ops(netdev, &atl2_netdev_ops);
- atl2_set_ethtool_ops(netdev);
- netdev->watchdog_timeo = 5 * HZ;
- strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -1017,7 +1017,7 @@ static void ieee80211_if_setup(struct ne
- {
- ether_setup(dev);
- dev->priv_flags &= ~IFF_TX_SKB_SHARING;
-- dev->netdev_ops = &ieee80211_dataif_ops;
-+ netdev_attach_ops(dev, &ieee80211_dataif_ops);
- dev->destructor = free_netdev;
- }
-
-@@ -1180,7 +1180,7 @@ static void ieee80211_setup_sdata(struct
-
- /* only monitor/p2p-device differ */
- if (sdata->dev) {
-- sdata->dev->netdev_ops = &ieee80211_dataif_ops;
-+ netdev_attach_ops(sdata->dev, &ieee80211_dataif_ops);
- sdata->dev->type = ARPHRD_ETHER;
- }
-
-@@ -1218,7 +1218,7 @@ static void ieee80211_setup_sdata(struct
- break;
- case NL80211_IFTYPE_MONITOR:
- sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP;
-- sdata->dev->netdev_ops = &ieee80211_monitorif_ops;
-+ netdev_attach_ops(sdata->dev, &ieee80211_monitorif_ops);
- sdata->u.mntr_flags = MONITOR_FLAG_CONTROL |
- MONITOR_FLAG_OTHER_BSS;
- break;
---- a/drivers/net/wireless/orinoco/main.c
-+++ b/drivers/net/wireless/orinoco/main.c
-@@ -2272,9 +2272,9 @@ int orinoco_if_add(struct orinoco_privat
- #endif
- /* Default to standard ops if not set */
- if (ops)
-- dev->netdev_ops = ops;
-+ netdev_attach_ops(dev, ops);
- else
-- dev->netdev_ops = &orinoco_netdev_ops;
-+ netdev_attach_ops(dev, &orinoco_netdev_ops);
-
- /* we use the default eth_mac_addr for setting the MAC addr */
-
---- a/net/wireless/wext-core.c
-+++ b/net/wireless/wext-core.c
-@@ -925,9 +925,7 @@ static int wireless_process_ioctl(struct
- return private(dev, iwr, cmd, info, handler);
- }
- /* Old driver API : call driver ioctl handler */
-- if (dev->netdev_ops->ndo_do_ioctl)
-- return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
-- return -EOPNOTSUPP;
-+ return ndo_do_ioctl(dev, ifr, cmd);
- }
-
- /* If command is `set a parameter', or `get the encoding parameters',
--- /dev/null
+
+This patch backports the struct net_device_ops changes added on 2.6.29.
+
+If we add the compat.git netdev_attach_ops() implementation
+for newer kernels upstream it means we do not have to use this
+patch at all for older kernels.
+
+mcgrof@tux ~/linux-stable (git::master)$ git describe --contains d314774cf2cd5dfeb39a00d37deee65d4c627927
+v2.6.29-rc1~581^2~677
+
+commit d314774cf2cd5dfeb39a00d37deee65d4c627927
+Author: Stephen Hemminger <shemminger@vyatta.com>
+Date: Wed Nov 19 21:32:24 2008 -0800
+
+ netdev: network device operations infrastructure
+
+ This patch changes the network device internal API to move adminstrative
+ operations out of the network device structure and into a separate structure.
+
+ This patch involves some hackery to maintain compatablity between the
+ new and old model, so all 300+ drivers don't have to be changed at once.
+ For drivers that aren't converted yet, the netdevice_ops virt function list
+ still resides in the net_device structure. For old protocols, the new
+ net_device_ops are copied out to the old net_device pointers.
+
+ After the transistion is completed the nag message can be changed to
+ an WARN_ON, and the compatiablity code can be made configurable.
+
+ Some function pointers aren't moved:
+ * destructor can't be in net_device_ops because
+ it may need to be referenced after the module is unloaded.
+ * neighbor setup is manipulated in a couple of places that need special
+ consideration
+ * hard_start_xmit is in the fast path for transmit.
+
+ Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
+ Signed-off-by: David S. Miller <davem@davemloft.net>
+
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
++++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+@@ -2470,7 +2470,7 @@
+ SET_NETDEV_DEV(netdev, &pdev->dev);
+ pci_set_drvdata(pdev, netdev);
+
+- netdev->netdev_ops = &atl1c_netdev_ops;
++ netdev_attach_ops(netdev, &atl1c_netdev_ops);
+ netdev->watchdog_timeo = AT_TX_WATCHDOG;
+ atl1c_set_ethtool_ops(netdev);
+
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
++++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+@@ -2207,7 +2207,7 @@
+ SET_NETDEV_DEV(netdev, &pdev->dev);
+ pci_set_drvdata(pdev, netdev);
+
+- netdev->netdev_ops = &atl1e_netdev_ops;
++ netdev_attach_ops(netdev, &atl1e_netdev_ops);
+
+ netdev->watchdog_timeo = AT_TX_WATCHDOG;
+ atl1e_set_ethtool_ops(netdev);
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atlx/atl1.c
++++ b/drivers/net/ethernet/atheros/atlx/atl1.c
+@@ -3009,7 +3009,7 @@
+ adapter->mii.phy_id_mask = 0x1f;
+ adapter->mii.reg_num_mask = 0x1f;
+
+- netdev->netdev_ops = &atl1_netdev_ops;
++ netdev_attach_ops(netdev, &atl1_netdev_ops);
+ netdev->watchdog_timeo = 5 * HZ;
+ netif_napi_add(netdev, &adapter->napi, atl1_rings_clean, 64);
+
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atlx/atl2.c
++++ b/drivers/net/ethernet/atheros/atlx/atl2.c
+@@ -1396,7 +1396,7 @@
+
+ atl2_setup_pcicmd(pdev);
+
+- netdev->netdev_ops = &atl2_netdev_ops;
++ netdev_attach_ops(netdev, &atl2_netdev_ops);
+ atl2_set_ethtool_ops(netdev);
+ netdev->watchdog_timeo = 5 * HZ;
+ strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
--- /dev/null
+--- a/drivers/net/ethernet/broadcom/b44.c
++++ b/drivers/net/ethernet/broadcom/b44.c
+@@ -2170,7 +2170,7 @@
+ bp->rx_pending = B44_DEF_RX_RING_PENDING;
+ bp->tx_pending = B44_DEF_TX_RING_PENDING;
+
+- dev->netdev_ops = &b44_netdev_ops;
++ netdev_attach_ops(dev, &b44_netdev_ops);
+ netif_napi_add(dev, &bp->napi, b44_poll, 64);
+ dev->watchdog_timeo = B44_TX_TIMEOUT;
+ dev->irq = sdev->irq;
--- /dev/null
+--- a/drivers/net/usb/rndis_host.c
++++ b/drivers/net/usb/rndis_host.c
+@@ -358,7 +358,7 @@
+ dev->rx_urb_size &= ~(dev->maxpacket - 1);
+ u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size);
+
+- net->netdev_ops = &rndis_netdev_ops;
++ netdev_attach_ops(net, &rndis_netdev_ops);
+
+ retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE);
+ if (unlikely(retval < 0)) {
--- /dev/null
+--- a/drivers/net/usb/usbnet.c
++++ b/drivers/net/usb/usbnet.c
+@@ -1446,7 +1446,7 @@
+ net->features |= NETIF_F_HIGHDMA;
+ #endif
+
+- net->netdev_ops = &usbnet_netdev_ops;
++ netdev_attach_ops(net, &usbnet_netdev_ops);
+ net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
+ net->ethtool_ops = &usbnet_ethtool_ops;
+
--- /dev/null
+--- a/drivers/net/wireless/ath/ath6kl/main.c
++++ b/drivers/net/wireless/ath/ath6kl/main.c
+@@ -1289,7 +1289,7 @@
+
+ void init_netdev(struct net_device *dev)
+ {
+- dev->netdev_ops = &ath6kl_netdev_ops;
++ netdev_attach_ops(dev, &ath6kl_netdev_ops);
+ dev->destructor = free_netdev;
+ dev->watchdog_timeo = ATH6KL_TX_TIMEOUT;
+
--- /dev/null
+--- a/drivers/net/wireless/ath/wil6210/netdev.c
++++ b/drivers/net/wireless/ath/wil6210/netdev.c
+@@ -76,7 +76,7 @@
+ goto out_priv;
+ }
+
+- ndev->netdev_ops = &wil_netdev_ops;
++ netdev_attach_ops(ndev, &wil_netdev_ops);
+ ndev->ieee80211_ptr = wdev;
+ SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy));
+ wdev->netdev = ndev;
--- /dev/null
+--- a/drivers/net/wireless/ipw2x00/ipw2100.c
++++ b/drivers/net/wireless/ipw2x00/ipw2100.c
+@@ -6086,7 +6086,7 @@
+ priv->ieee->perfect_rssi = -20;
+ priv->ieee->worst_rssi = -85;
+
+- dev->netdev_ops = &ipw2100_netdev_ops;
++ netdev_attach_ops(dev, &ipw2100_netdev_ops);
+ dev->ethtool_ops = &ipw2100_ethtool_ops;
+ dev->wireless_handlers = &ipw2100_wx_handler_def;
+ priv->wireless_data.libipw = priv->ieee;
--- /dev/null
+--- a/drivers/net/wireless/ipw2x00/ipw2200.c
++++ b/drivers/net/wireless/ipw2x00/ipw2200.c
+@@ -11680,7 +11680,7 @@
+ memcpy(priv->prom_net_dev->dev_addr, priv->mac_addr, ETH_ALEN);
+
+ priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP;
+- priv->prom_net_dev->netdev_ops = &ipw_prom_netdev_ops;
++ netdev_attach_ops(priv->prom_net_dev, &ipw_prom_netdev_ops);
+
+ priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR;
+ SET_NETDEV_DEV(priv->prom_net_dev, &priv->pci_dev->dev);
+@@ -11818,7 +11818,7 @@
+ priv->ieee->perfect_rssi = -20;
+ priv->ieee->worst_rssi = -85;
+
+- net_dev->netdev_ops = &ipw_netdev_ops;
++ netdev_attach_ops(net_dev, &ipw_netdev_ops);
+ priv->wireless_data.spy_data = &priv->ieee->spy_data;
+ net_dev->wireless_data = &priv->wireless_data;
+ net_dev->wireless_handlers = &ipw_wx_handler_def;
--- /dev/null
+--- a/drivers/net/wireless/libertas/main.c
++++ b/drivers/net/wireless/libertas/main.c
+@@ -993,7 +993,7 @@
+ wdev->netdev = dev;
+ priv->dev = dev;
+
+- dev->netdev_ops = &lbs_netdev_ops;
++ netdev_attach_ops(dev, &lbs_netdev_ops);
+ dev->watchdog_timeo = 5 * HZ;
+ dev->ethtool_ops = &lbs_ethtool_ops;
+ dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
--- /dev/null
+--- a/drivers/net/wireless/libertas/mesh.c
++++ b/drivers/net/wireless/libertas/mesh.c
+@@ -1015,7 +1015,7 @@
+ mesh_dev->ieee80211_ptr = mesh_wdev;
+ priv->mesh_dev = mesh_dev;
+
+- mesh_dev->netdev_ops = &mesh_netdev_ops;
++ netdev_attach_ops(mesh_dev, &mesh_netdev_ops);
+ mesh_dev->ethtool_ops = &lbs_ethtool_ops;
+ memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, ETH_ALEN);
+
--- /dev/null
+--- a/drivers/net/wireless/mac80211_hwsim.c
++++ b/drivers/net/wireless/mac80211_hwsim.c
+@@ -1695,7 +1695,7 @@
+
+ static void hwsim_mon_setup(struct net_device *dev)
+ {
+- dev->netdev_ops = &hwsim_netdev_ops;
++ netdev_attach_ops(dev, &hwsim_netdev_ops);
+ dev->destructor = free_netdev;
+ ether_setup(dev);
+ dev->tx_queue_len = 0;
--- /dev/null
+--- a/drivers/net/wireless/mwifiex/main.c
++++ b/drivers/net/wireless/mwifiex/main.c
+@@ -654,7 +654,7 @@
+ void mwifiex_init_priv_params(struct mwifiex_private *priv,
+ struct net_device *dev)
+ {
+- dev->netdev_ops = &mwifiex_netdev_ops;
++ netdev_attach_ops(dev, &mwifiex_netdev_ops);
+ /* Initialize private structure */
+ priv->current_key_index = 0;
+ priv->media_connected = false;
--- /dev/null
+--- a/drivers/net/wireless/orinoco/main.c
++++ b/drivers/net/wireless/orinoco/main.c
+@@ -2272,9 +2272,9 @@
+ #endif
+ /* Default to standard ops if not set */
+ if (ops)
+- dev->netdev_ops = ops;
++ netdev_attach_ops(dev, ops);
+ else
+- dev->netdev_ops = &orinoco_netdev_ops;
++ netdev_attach_ops(dev, &orinoco_netdev_ops);
+
+ /* we use the default eth_mac_addr for setting the MAC addr */
+
--- /dev/null
+--- a/drivers/net/wireless/rndis_wlan.c
++++ b/drivers/net/wireless/rndis_wlan.c
+@@ -3438,7 +3438,7 @@
+ * rndis_host wants to avoid all OID as much as possible
+ * so do promisc/multicast handling in rndis_wlan.
+ */
+- usbdev->net->netdev_ops = &rndis_wlan_netdev_ops;
++ netdev_attach_ops(usbdev->net, &rndis_wlan_netdev_ops);
+
+ tmp = cpu_to_le32(RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST);
+ retval = rndis_set_oid(usbdev,
--- /dev/null
+--- a/net/bluetooth/bnep/netdev.c
++++ b/net/bluetooth/bnep/netdev.c
+@@ -223,7 +223,7 @@
+
+ ether_setup(dev);
+ dev->priv_flags &= ~IFF_TX_SKB_SHARING;
+- dev->netdev_ops = &bnep_netdev_ops;
++ netdev_attach_ops(dev, &bnep_netdev_ops);
+
+ dev->watchdog_timeo = HZ * 2;
+ }
--- /dev/null
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -1017,7 +1017,7 @@
+ {
+ ether_setup(dev);
+ dev->priv_flags &= ~IFF_TX_SKB_SHARING;
+- dev->netdev_ops = &ieee80211_dataif_ops;
++ netdev_attach_ops(dev, &ieee80211_dataif_ops);
+ dev->destructor = free_netdev;
+ }
+
+@@ -1180,7 +1180,7 @@
+
+ /* only monitor/p2p-device differ */
+ if (sdata->dev) {
+- sdata->dev->netdev_ops = &ieee80211_dataif_ops;
++ netdev_attach_ops(sdata->dev, &ieee80211_dataif_ops);
+ sdata->dev->type = ARPHRD_ETHER;
+ }
+
+@@ -1218,7 +1218,7 @@
+ break;
+ case NL80211_IFTYPE_MONITOR:
+ sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP;
+- sdata->dev->netdev_ops = &ieee80211_monitorif_ops;
++ netdev_attach_ops(sdata->dev, &ieee80211_monitorif_ops);
+ sdata->u.mntr_flags = MONITOR_FLAG_CONTROL |
+ MONITOR_FLAG_OTHER_BSS;
+ break;
--- /dev/null
+--- a/net/wireless/wext-core.c
++++ b/net/wireless/wext-core.c
+@@ -925,9 +925,7 @@
+ return private(dev, iwr, cmd, info, handler);
+ }
+ /* Old driver API : call driver ioctl handler */
+- if (dev->netdev_ops->ndo_do_ioctl)
+- return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
+- return -EOPNOTSUPP;
++ return ndo_do_ioctl(dev, ifr, cmd);
+ }
+
+ /* If command is `set a parameter', or `get the encoding parameters',
+++ /dev/null
-These are things that removed in later kernels but no good explanatin
-was provided as to their removal. We should review if this is needed
-and if not remove these hunks.
-
-Pretty sure we can remove the netdev_tx_t hunk change on
-net/bluetooth/bnep/netdev.c, removing that hunk just needs to be
-compile tested against older kernels.
-
---- a/drivers/net/usb/rndis_host.c
-+++ b/drivers/net/usb/rndis_host.c
-@@ -332,6 +332,11 @@ generic_rndis_bind(struct usbnet *dev, s
- u.init->major_version = cpu_to_le32(1);
- u.init->minor_version = cpu_to_le32(0);
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
-+ /* can't we remove this? */
-+ net->change_mtu = NULL;
-+#endif
-+
- /* max transfer (in spec) is 0x4000 at full speed, but for
- * TX we'll stick to one Ethernet packet plus RNDIS framing.
- * For RX we handle drivers that zero-pad to end-of-packet.
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -1018,6 +1018,11 @@ static void ieee80211_if_setup(struct ne
- ether_setup(dev);
- dev->priv_flags &= ~IFF_TX_SKB_SHARING;
- netdev_attach_ops(dev, &ieee80211_dataif_ops);
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
-+ /* Do we need this ? */
-+ /* we will validate the address ourselves in ->open */
-+ dev->validate_addr = NULL;
-+#endif
- dev->destructor = free_netdev;
- }
-
---- a/net/bluetooth/bnep/netdev.c
-+++ b/net/bluetooth/bnep/netdev.c
-@@ -161,8 +161,12 @@ static int bnep_net_proto_filter(struct
- }
- #endif
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
- static netdev_tx_t bnep_net_xmit(struct sk_buff *skb,
- struct net_device *dev)
-+#else
-+static int bnep_net_xmit(struct sk_buff *skb, struct net_device *dev)
-+#endif
- {
- struct bnep_session *s = netdev_priv(dev);
- struct sock *sk = s->sock->sk;
---- a/drivers/net/wireless/libertas/defs.h
-+++ b/drivers/net/wireless/libertas/defs.h
-@@ -16,6 +16,14 @@
- #define DRV_NAME "libertas"
- #endif
-
-+/*
-+ * Really nasty hack to avoid stuffing compat.diff with tons of ifdefs,
-+ * we could add this to a compat header file but too lazy to check ml_priv
-+ * is not used anywhere else
-+ */
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
-+#define ml_priv priv
-+#endif
-
- #define LBS_DEB_ENTER 0x00000001
- #define LBS_DEB_LEAVE 0x00000002
--- /dev/null
+These are things that removed in later kernels but no good explanatin
+was provided as to their removal. We should review if this is needed
+and if not remove these hunks.
+
+Pretty sure we can remove the netdev_tx_t hunk change on
+net/bluetooth/bnep/netdev.c, removing that hunk just needs to be
+compile tested against older kernels.
+
--- /dev/null
+--- a/drivers/net/usb/rndis_host.c
++++ b/drivers/net/usb/rndis_host.c
+@@ -332,6 +332,11 @@
+ u.init->major_version = cpu_to_le32(1);
+ u.init->minor_version = cpu_to_le32(0);
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
++ /* can't we remove this? */
++ net->change_mtu = NULL;
++#endif
++
+ /* max transfer (in spec) is 0x4000 at full speed, but for
+ * TX we'll stick to one Ethernet packet plus RNDIS framing.
+ * For RX we handle drivers that zero-pad to end-of-packet.
--- /dev/null
+--- a/drivers/net/wireless/libertas/defs.h
++++ b/drivers/net/wireless/libertas/defs.h
+@@ -16,6 +16,14 @@
+ #define DRV_NAME "libertas"
+ #endif
+
++/*
++ * Really nasty hack to avoid stuffing compat.diff with tons of ifdefs,
++ * we could add this to a compat header file but too lazy to check ml_priv
++ * is not used anywhere else
++ */
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
++#define ml_priv priv
++#endif
+
+ #define LBS_DEB_ENTER 0x00000001
+ #define LBS_DEB_LEAVE 0x00000002
--- /dev/null
+--- a/net/bluetooth/bnep/netdev.c
++++ b/net/bluetooth/bnep/netdev.c
+@@ -161,8 +161,12 @@
+ }
+ #endif
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static netdev_tx_t bnep_net_xmit(struct sk_buff *skb,
+ struct net_device *dev)
++#else
++static int bnep_net_xmit(struct sk_buff *skb, struct net_device *dev)
++#endif
+ {
+ struct bnep_session *s = netdev_priv(dev);
+ struct sock *sk = s->sock->sk;
--- /dev/null
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -1018,6 +1018,11 @@
+ ether_setup(dev);
+ dev->priv_flags &= ~IFF_TX_SKB_SHARING;
+ netdev_attach_ops(dev, &ieee80211_dataif_ops);
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
++ /* Do we need this ? */
++ /* we will validate the address ourselves in ->open */
++ dev->validate_addr = NULL;
++#endif
+ dev->destructor = free_netdev;
+ }
+
+++ /dev/null
-This is an optimization introduced on newer kernels, just ignore for
-older kernels on mac80211. For others the netdev->hard_header_len
-could be used.
-
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -1518,6 +1518,7 @@ int ieee80211_if_add(struct ieee80211_lo
- return -ENOMEM;
- dev_net_set(ndev, wiphy_net(local->hw.wiphy));
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
- ndev->needed_headroom = local->tx_headroom +
- 4*6 /* four MAC addresses */
- + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */
-@@ -1526,6 +1527,7 @@ int ieee80211_if_add(struct ieee80211_lo
- - ETH_HLEN /* ethernet hard_header_len */
- + IEEE80211_ENCRYPT_HEADROOM;
- ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM;
-+#endif
-
- ret = dev_alloc_name(ndev, ndev->name);
- if (ret < 0) {
---- a/drivers/net/wireless/orinoco/main.c
-+++ b/drivers/net/wireless/orinoco/main.c
-@@ -2279,7 +2279,11 @@ int orinoco_if_add(struct orinoco_privat
- /* we use the default eth_mac_addr for setting the MAC addr */
-
- /* Reserve space in skb for the SNAP header */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
- dev->needed_headroom = ENCAPS_OVERHEAD;
-+#else
-+ dev->hard_header_len += ENCAPS_OVERHEAD;
-+#endif
-
- netif_carrier_off(dev);
-
--- /dev/null
+This is an optimization introduced on newer kernels, just ignore for
+older kernels on mac80211. For others the netdev->hard_header_len
+could be used.
+
--- /dev/null
+--- a/drivers/net/wireless/orinoco/main.c
++++ b/drivers/net/wireless/orinoco/main.c
+@@ -2279,7 +2279,11 @@
+ /* we use the default eth_mac_addr for setting the MAC addr */
+
+ /* Reserve space in skb for the SNAP header */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
+ dev->needed_headroom = ENCAPS_OVERHEAD;
++#else
++ dev->hard_header_len += ENCAPS_OVERHEAD;
++#endif
+
+ netif_carrier_off(dev);
+
--- /dev/null
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -1518,6 +1518,7 @@
+ return -ENOMEM;
+ dev_net_set(ndev, wiphy_net(local->hw.wiphy));
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
+ ndev->needed_headroom = local->tx_headroom +
+ 4*6 /* four MAC addresses */
+ + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */
+@@ -1526,6 +1527,7 @@
+ - ETH_HLEN /* ethernet hard_header_len */
+ + IEEE80211_ENCRYPT_HEADROOM;
+ ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM;
++#endif
+
+ ret = dev_alloc_name(ndev, ndev->name);
+ if (ret < 0) {
+++ /dev/null
-
-This patch backports the namespace changes added
-through net/wireless/wext.c.
-
---- a/net/wireless/wext-core.c
-+++ b/net/wireless/wext-core.c
-@@ -342,6 +342,7 @@ static const int compat_event_type_size[
-
- /* IW event code */
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
- static int __net_init wext_pernet_init(struct net *net)
- {
- skb_queue_head_init(&net->wext_nlevents);
-@@ -384,6 +385,29 @@ static void wireless_nlevent_process(str
-
- static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process);
-
-+#else
-+/* Older kernels get the old way of doing stuff*/
-+static struct sk_buff_head wireless_nlevent_queue;
-+
-+static int __init wireless_nlevent_init(void)
-+{
-+ skb_queue_head_init(&wireless_nlevent_queue);
-+ return 0;
-+}
-+
-+subsys_initcall(wireless_nlevent_init);
-+
-+static void wireless_nlevent_process(unsigned long data)
-+{
-+ struct sk_buff *skb;
-+ while ((skb = skb_dequeue(&wireless_nlevent_queue)))
-+ rtnl_notify(skb, &init_net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
-+}
-+
-+static DECLARE_TASKLET(wireless_nlevent_tasklet, wireless_nlevent_process, 0);
-+
-+#endif
-+
- static struct nlmsghdr *rtnetlink_ifinfo_prep(struct net_device *dev,
- struct sk_buff *skb)
- {
-@@ -597,8 +621,13 @@ void wireless_send_event(struct net_devi
-
- skb_shinfo(skb)->frag_list = compskb;
- #endif
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
- skb_queue_tail(&dev_net(dev)->wext_nlevents, skb);
- schedule_work(&wireless_nlevent_work);
-+#else
-+ skb_queue_tail(&wireless_nlevent_queue, skb);
-+ tasklet_schedule(&wireless_nlevent_tasklet);
-+#endif
- }
- EXPORT_SYMBOL(wireless_send_event);
-
--- /dev/null
+
+This patch backports the namespace changes added
+through net/wireless/wext.c.
+
--- /dev/null
+--- a/net/wireless/wext-core.c
++++ b/net/wireless/wext-core.c
+@@ -342,6 +342,7 @@
+
+ /* IW event code */
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+ static int __net_init wext_pernet_init(struct net *net)
+ {
+ skb_queue_head_init(&net->wext_nlevents);
+@@ -384,6 +385,29 @@
+
+ static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process);
+
++#else
++/* Older kernels get the old way of doing stuff*/
++static struct sk_buff_head wireless_nlevent_queue;
++
++static int __init wireless_nlevent_init(void)
++{
++ skb_queue_head_init(&wireless_nlevent_queue);
++ return 0;
++}
++
++subsys_initcall(wireless_nlevent_init);
++
++static void wireless_nlevent_process(unsigned long data)
++{
++ struct sk_buff *skb;
++ while ((skb = skb_dequeue(&wireless_nlevent_queue)))
++ rtnl_notify(skb, &init_net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
++}
++
++static DECLARE_TASKLET(wireless_nlevent_tasklet, wireless_nlevent_process, 0);
++
++#endif
++
+ static struct nlmsghdr *rtnetlink_ifinfo_prep(struct net_device *dev,
+ struct sk_buff *skb)
+ {
+@@ -597,8 +621,13 @@
+
+ skb_shinfo(skb)->frag_list = compskb;
+ #endif
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+ skb_queue_tail(&dev_net(dev)->wext_nlevents, skb);
+ schedule_work(&wireless_nlevent_work);
++#else
++ skb_queue_tail(&wireless_nlevent_queue, skb);
++ tasklet_schedule(&wireless_nlevent_tasklet);
++#endif
+ }
+ EXPORT_SYMBOL(wireless_send_event);
+
+++ /dev/null
-The patch:
-
-commit 15e473046cb6e5d18a4d0057e61d76315230382b
-Author: Eric W. Biederman <ebiederm@xmission.com>
-Date: Fri Sep 7 20:12:54 2012 +0000
-
- netlink: Rename pid to portid to avoid confusion
-
- It is a frequent mistake to confuse the netlink port identifier with a
- process identifier. Try to reduce this confusion by renaming fields
- that hold port identifiers portid instead of pid.
-
- I have carefully avoided changing the structures exported to
- userspace to avoid changing the userspace API.
-
- I have successfully built an allyesconfig kernel with this change.
-
- Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
- Acked-by: Stephen Hemminger <shemminger@vyatta.com>
- Signed-off-by: David S. Miller <davem@davemloft.net>
-
-Changed the struct members:
-
-struct netlink_notify->pid to
-struct netlink_notify->portid
-
-struct genl_info->snd_pid to
-struct genl_info->snd_portid
-
-To help backport this and not have to #ifdef around it against
-kernel versions compat has introduced two helpers for us to
-simply do the backport with two macro helpers:
-
-genl_info_snd_portid()
-netlink_notify_portid()
-
-This takes care of the work for us requiring only one
-single line change. If we get another patch thrown into
-this file then I suspect we can extract SMPL out of it
-and use it to backport further collateral evolutions like
-this one should other drivers / subsystem need this change.
-
---- a/drivers/net/wireless/mac80211_hwsim.c
-+++ b/drivers/net/wireless/mac80211_hwsim.c
-@@ -2019,10 +2019,10 @@ static int hwsim_register_received_nl(st
- if (info == NULL)
- goto out;
-
-- wmediumd_portid = info->snd_portid;
-+ wmediumd_portid = genl_info_snd_portid(info);
-
- printk(KERN_DEBUG "mac80211_hwsim: received a REGISTER, "
-- "switching to wmediumd mode with pid %d\n", info->snd_portid);
-+ "switching to wmediumd mode with pid %d\n", genl_info_snd_portid(info));
-
- return 0;
- out:
-@@ -2059,7 +2059,7 @@ static int mac80211_hwsim_netlink_notify
- if (state != NETLINK_URELEASE)
- return NOTIFY_DONE;
-
-- if (notify->portid == wmediumd_portid) {
-+ if (netlink_notify_portid(notify) == wmediumd_portid) {
- printk(KERN_INFO "mac80211_hwsim: wmediumd released netlink"
- " socket, switching to perfect channel medium\n");
- wmediumd_portid = 0;
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -1593,7 +1593,7 @@ static int nl80211_dump_wiphy(struct sk_
- /* attempt to fit multiple wiphy data chunks into the skb */
- do {
- ret = nl80211_send_wiphy(dev, skb,
-- NETLINK_CB(cb->skb).portid,
-+ NETLINK_CB_PORTID(cb->skb),
- cb->nlh->nlmsg_seq,
- NLM_F_MULTI,
- split, &cb->args[1],
-@@ -1642,7 +1642,7 @@ static int nl80211_get_wiphy(struct sk_b
- if (!msg)
- return -ENOMEM;
-
-- if (nl80211_send_wiphy(dev, msg, info->snd_portid, info->snd_seq, 0,
-+ if (nl80211_send_wiphy(dev, msg, genl_info_snd_portid(info), info->snd_seq, 0,
- false, NULL, NULL, NULL) < 0) {
- nlmsg_free(msg);
- return -ENOBUFS;
-@@ -2222,7 +2222,7 @@ static int nl80211_dump_interface(struct
- if_idx++;
- continue;
- }
-- if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).portid,
-+ if (nl80211_send_iface(skb, NETLINK_CB_PORTID(cb->skb),
- cb->nlh->nlmsg_seq, NLM_F_MULTI,
- rdev, wdev) < 0) {
- mutex_unlock(&rdev->devlist_mtx);
-@@ -2253,7 +2253,7 @@ static int nl80211_get_interface(struct
- if (!msg)
- return -ENOMEM;
-
-- if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0,
-+ if (nl80211_send_iface(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- dev, wdev) < 0) {
- nlmsg_free(msg);
- return -ENOBUFS;
-@@ -2478,7 +2478,7 @@ static int nl80211_new_interface(struct
- break;
- }
-
-- if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0,
-+ if (nl80211_send_iface(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- rdev, wdev) < 0) {
- nlmsg_free(msg);
- return -ENOBUFS;
-@@ -2613,7 +2613,7 @@ static int nl80211_get_key(struct sk_buf
- if (!msg)
- return -ENOMEM;
-
-- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
-+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- NL80211_CMD_NEW_KEY);
- if (IS_ERR(hdr))
- return PTR_ERR(hdr);
-@@ -3549,7 +3549,7 @@ static int nl80211_dump_station(struct s
- goto out_err;
-
- if (nl80211_send_station(skb,
-- NETLINK_CB(cb->skb).portid,
-+ NETLINK_CB_PORTID(cb->skb),
- cb->nlh->nlmsg_seq, NLM_F_MULTI,
- dev, netdev, mac_addr,
- &sinfo) < 0)
-@@ -3595,7 +3595,7 @@ static int nl80211_get_station(struct sk
- if (!msg)
- return -ENOMEM;
-
-- if (nl80211_send_station(msg, info->snd_portid, info->snd_seq, 0,
-+ if (nl80211_send_station(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- rdev, dev, mac_addr, &sinfo) < 0) {
- nlmsg_free(msg);
- return -ENOBUFS;
-@@ -4195,7 +4195,7 @@ static int nl80211_dump_mpath(struct sk_
- if (err)
- goto out_err;
-
-- if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).portid,
-+ if (nl80211_send_mpath(skb, NETLINK_CB_PORTID(cb->skb),
- cb->nlh->nlmsg_seq, NLM_F_MULTI,
- netdev, dst, next_hop,
- &pinfo) < 0)
-@@ -4244,7 +4244,7 @@ static int nl80211_get_mpath(struct sk_b
- if (!msg)
- return -ENOMEM;
-
-- if (nl80211_send_mpath(msg, info->snd_portid, info->snd_seq, 0,
-+ if (nl80211_send_mpath(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- dev, dst, next_hop, &pinfo) < 0) {
- nlmsg_free(msg);
- return -ENOBUFS;
-@@ -4508,7 +4508,7 @@ static int nl80211_get_mesh_config(struc
- msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
- if (!msg)
- return -ENOMEM;
-- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
-+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- NL80211_CMD_GET_MESH_CONFIG);
- if (!hdr)
- goto out;
-@@ -4858,7 +4858,7 @@ static int nl80211_get_reg(struct sk_buf
- goto out;
- }
-
-- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
-+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- NL80211_CMD_GET_REG);
- if (!hdr)
- goto put_failure;
-@@ -5558,7 +5558,7 @@ static int nl80211_send_bss(struct sk_bu
-
- ASSERT_WDEV_LOCK(wdev);
-
-- hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).portid, seq, flags,
-+ hdr = nl80211hdr_put(msg, NETLINK_CB_PORTID(cb->skb), seq, flags,
- NL80211_CMD_NEW_SCAN_RESULTS);
- if (!hdr)
- return -1;
-@@ -5789,7 +5789,7 @@ static int nl80211_dump_survey(struct sk
- }
-
- if (nl80211_send_survey(skb,
-- NETLINK_CB(cb->skb).portid,
-+ NETLINK_CB_PORTID(cb->skb),
- cb->nlh->nlmsg_seq, NLM_F_MULTI,
- netdev,
- &survey) < 0)
-@@ -6448,7 +6448,7 @@ static int nl80211_testmode_dump(struct
- }
-
- while (1) {
-- void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).portid,
-+ void *hdr = nl80211hdr_put(skb, NETLINK_CB_PORTID(cb->skb),
- cb->nlh->nlmsg_seq, NLM_F_MULTI,
- NL80211_CMD_TESTMODE);
- struct nlattr *tmdata;
-@@ -6527,7 +6527,7 @@ struct sk_buff *cfg80211_testmode_alloc_
- return NULL;
-
- return __cfg80211_testmode_alloc_skb(rdev, approxlen,
-- rdev->testmode_info->snd_portid,
-+ genl_info_snd_portid(rdev->testmode_info),
- rdev->testmode_info->snd_seq,
- GFP_KERNEL);
- }
-@@ -6887,7 +6887,7 @@ static int nl80211_remain_on_channel(str
- if (!msg)
- return -ENOMEM;
-
-- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
-+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- NL80211_CMD_REMAIN_ON_CHANNEL);
-
- if (IS_ERR(hdr)) {
-@@ -7106,7 +7106,7 @@ static int nl80211_register_mgmt(struct
- if (!rdev->ops->mgmt_tx)
- return -EOPNOTSUPP;
-
-- return cfg80211_mlme_register_mgmt(wdev, info->snd_portid, frame_type,
-+ return cfg80211_mlme_register_mgmt(wdev, genl_info_snd_portid(info), frame_type,
- nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]),
- nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH]));
- }
-@@ -7176,7 +7176,7 @@ static int nl80211_tx_mgmt(struct sk_buf
- if (!msg)
- return -ENOMEM;
-
-- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
-+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- NL80211_CMD_FRAME);
-
- if (IS_ERR(hdr)) {
-@@ -7291,7 +7291,7 @@ static int nl80211_get_power_save(struct
- if (!msg)
- return -ENOMEM;
-
-- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
-+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- NL80211_CMD_GET_POWER_SAVE);
- if (!hdr) {
- err = -ENOBUFS;
-@@ -7583,7 +7583,7 @@ static int nl80211_get_wowlan(struct sk_
- if (!msg)
- return -ENOMEM;
-
-- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
-+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- NL80211_CMD_GET_WOWLAN);
- if (!hdr)
- goto nla_put_failure;
-@@ -8007,7 +8007,7 @@ static int nl80211_register_unexpected_f
- if (wdev->ap_unexpected_nlportid)
- return -EBUSY;
-
-- wdev->ap_unexpected_nlportid = info->snd_portid;
-+ wdev->ap_unexpected_nlportid = genl_info_snd_portid(info);
- return 0;
- }
-
-@@ -8037,7 +8037,7 @@ static int nl80211_probe_client(struct s
- if (!msg)
- return -ENOMEM;
-
-- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
-+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- NL80211_CMD_PROBE_CLIENT);
-
- if (IS_ERR(hdr)) {
-@@ -8081,13 +8081,13 @@ static int nl80211_register_beacons(stru
- /* First, check if already registered. */
- spin_lock_bh(&rdev->beacon_registrations_lock);
- list_for_each_entry(reg, &rdev->beacon_registrations, list) {
-- if (reg->nlportid == info->snd_portid) {
-+ if (reg->nlportid == genl_info_snd_portid(info)) {
- rv = -EALREADY;
- goto out_err;
- }
- }
- /* Add it to the list */
-- nreg->nlportid = info->snd_portid;
-+ nreg->nlportid = genl_info_snd_portid(info);
- list_add(&nreg->list, &rdev->beacon_registrations);
-
- spin_unlock_bh(&rdev->beacon_registrations_lock);
-@@ -8160,7 +8160,7 @@ static int nl80211_get_protocol_features
- if (!msg)
- return -ENOMEM;
-
-- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
-+ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
- NL80211_CMD_GET_PROTOCOL_FEATURES);
- if (!hdr)
- goto nla_put_failure;
-@@ -10565,12 +10565,12 @@ static int nl80211_netlink_notify(struct
-
- list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) {
- list_for_each_entry_rcu(wdev, &rdev->wdev_list, list)
-- cfg80211_mlme_unregister_socket(wdev, notify->portid);
-+ cfg80211_mlme_unregister_socket(wdev, netlink_notify_portid(notify));
-
- spin_lock_bh(&rdev->beacon_registrations_lock);
- list_for_each_entry_safe(reg, tmp, &rdev->beacon_registrations,
- list) {
-- if (reg->nlportid == notify->portid) {
-+ if (reg->nlportid == netlink_notify_portid(notify)) {
- list_del(®->list);
- kfree(reg);
- break;
--- /dev/null
+The patch:
+
+commit 15e473046cb6e5d18a4d0057e61d76315230382b
+Author: Eric W. Biederman <ebiederm@xmission.com>
+Date: Fri Sep 7 20:12:54 2012 +0000
+
+ netlink: Rename pid to portid to avoid confusion
+
+ It is a frequent mistake to confuse the netlink port identifier with a
+ process identifier. Try to reduce this confusion by renaming fields
+ that hold port identifiers portid instead of pid.
+
+ I have carefully avoided changing the structures exported to
+ userspace to avoid changing the userspace API.
+
+ I have successfully built an allyesconfig kernel with this change.
+
+ Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
+ Acked-by: Stephen Hemminger <shemminger@vyatta.com>
+ Signed-off-by: David S. Miller <davem@davemloft.net>
+
+Changed the struct members:
+
+struct netlink_notify->pid to
+struct netlink_notify->portid
+
+struct genl_info->snd_pid to
+struct genl_info->snd_portid
+
+To help backport this and not have to #ifdef around it against
+kernel versions compat has introduced two helpers for us to
+simply do the backport with two macro helpers:
+
+genl_info_snd_portid()
+netlink_notify_portid()
+
+This takes care of the work for us requiring only one
+single line change. If we get another patch thrown into
+this file then I suspect we can extract SMPL out of it
+and use it to backport further collateral evolutions like
+this one should other drivers / subsystem need this change.
+
--- /dev/null
+--- a/drivers/net/wireless/mac80211_hwsim.c
++++ b/drivers/net/wireless/mac80211_hwsim.c
+@@ -2019,10 +2019,10 @@
+ if (info == NULL)
+ goto out;
+
+- wmediumd_portid = info->snd_portid;
++ wmediumd_portid = genl_info_snd_portid(info);
+
+ printk(KERN_DEBUG "mac80211_hwsim: received a REGISTER, "
+- "switching to wmediumd mode with pid %d\n", info->snd_portid);
++ "switching to wmediumd mode with pid %d\n", genl_info_snd_portid(info));
+
+ return 0;
+ out:
+@@ -2059,7 +2059,7 @@
+ if (state != NETLINK_URELEASE)
+ return NOTIFY_DONE;
+
+- if (notify->portid == wmediumd_portid) {
++ if (netlink_notify_portid(notify) == wmediumd_portid) {
+ printk(KERN_INFO "mac80211_hwsim: wmediumd released netlink"
+ " socket, switching to perfect channel medium\n");
+ wmediumd_portid = 0;
--- /dev/null
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -1593,7 +1593,7 @@
+ /* attempt to fit multiple wiphy data chunks into the skb */
+ do {
+ ret = nl80211_send_wiphy(dev, skb,
+- NETLINK_CB(cb->skb).portid,
++ NETLINK_CB_PORTID(cb->skb),
+ cb->nlh->nlmsg_seq,
+ NLM_F_MULTI,
+ split, &cb->args[1],
+@@ -1642,7 +1642,7 @@
+ if (!msg)
+ return -ENOMEM;
+
+- if (nl80211_send_wiphy(dev, msg, info->snd_portid, info->snd_seq, 0,
++ if (nl80211_send_wiphy(dev, msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ false, NULL, NULL, NULL) < 0) {
+ nlmsg_free(msg);
+ return -ENOBUFS;
+@@ -2222,7 +2222,7 @@
+ if_idx++;
+ continue;
+ }
+- if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).portid,
++ if (nl80211_send_iface(skb, NETLINK_CB_PORTID(cb->skb),
+ cb->nlh->nlmsg_seq, NLM_F_MULTI,
+ rdev, wdev) < 0) {
+ mutex_unlock(&rdev->devlist_mtx);
+@@ -2253,7 +2253,7 @@
+ if (!msg)
+ return -ENOMEM;
+
+- if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0,
++ if (nl80211_send_iface(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ dev, wdev) < 0) {
+ nlmsg_free(msg);
+ return -ENOBUFS;
+@@ -2478,7 +2478,7 @@
+ break;
+ }
+
+- if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0,
++ if (nl80211_send_iface(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ rdev, wdev) < 0) {
+ nlmsg_free(msg);
+ return -ENOBUFS;
+@@ -2613,7 +2613,7 @@
+ if (!msg)
+ return -ENOMEM;
+
+- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
++ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ NL80211_CMD_NEW_KEY);
+ if (IS_ERR(hdr))
+ return PTR_ERR(hdr);
+@@ -3549,7 +3549,7 @@
+ goto out_err;
+
+ if (nl80211_send_station(skb,
+- NETLINK_CB(cb->skb).portid,
++ NETLINK_CB_PORTID(cb->skb),
+ cb->nlh->nlmsg_seq, NLM_F_MULTI,
+ dev, netdev, mac_addr,
+ &sinfo) < 0)
+@@ -3595,7 +3595,7 @@
+ if (!msg)
+ return -ENOMEM;
+
+- if (nl80211_send_station(msg, info->snd_portid, info->snd_seq, 0,
++ if (nl80211_send_station(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ rdev, dev, mac_addr, &sinfo) < 0) {
+ nlmsg_free(msg);
+ return -ENOBUFS;
+@@ -4195,7 +4195,7 @@
+ if (err)
+ goto out_err;
+
+- if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).portid,
++ if (nl80211_send_mpath(skb, NETLINK_CB_PORTID(cb->skb),
+ cb->nlh->nlmsg_seq, NLM_F_MULTI,
+ netdev, dst, next_hop,
+ &pinfo) < 0)
+@@ -4244,7 +4244,7 @@
+ if (!msg)
+ return -ENOMEM;
+
+- if (nl80211_send_mpath(msg, info->snd_portid, info->snd_seq, 0,
++ if (nl80211_send_mpath(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ dev, dst, next_hop, &pinfo) < 0) {
+ nlmsg_free(msg);
+ return -ENOBUFS;
+@@ -4508,7 +4508,7 @@
+ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+ if (!msg)
+ return -ENOMEM;
+- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
++ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ NL80211_CMD_GET_MESH_CONFIG);
+ if (!hdr)
+ goto out;
+@@ -4858,7 +4858,7 @@
+ goto out;
+ }
+
+- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
++ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ NL80211_CMD_GET_REG);
+ if (!hdr)
+ goto put_failure;
+@@ -5558,7 +5558,7 @@
+
+ ASSERT_WDEV_LOCK(wdev);
+
+- hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).portid, seq, flags,
++ hdr = nl80211hdr_put(msg, NETLINK_CB_PORTID(cb->skb), seq, flags,
+ NL80211_CMD_NEW_SCAN_RESULTS);
+ if (!hdr)
+ return -1;
+@@ -5789,7 +5789,7 @@
+ }
+
+ if (nl80211_send_survey(skb,
+- NETLINK_CB(cb->skb).portid,
++ NETLINK_CB_PORTID(cb->skb),
+ cb->nlh->nlmsg_seq, NLM_F_MULTI,
+ netdev,
+ &survey) < 0)
+@@ -6448,7 +6448,7 @@
+ }
+
+ while (1) {
+- void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).portid,
++ void *hdr = nl80211hdr_put(skb, NETLINK_CB_PORTID(cb->skb),
+ cb->nlh->nlmsg_seq, NLM_F_MULTI,
+ NL80211_CMD_TESTMODE);
+ struct nlattr *tmdata;
+@@ -6527,7 +6527,7 @@
+ return NULL;
+
+ return __cfg80211_testmode_alloc_skb(rdev, approxlen,
+- rdev->testmode_info->snd_portid,
++ genl_info_snd_portid(rdev->testmode_info),
+ rdev->testmode_info->snd_seq,
+ GFP_KERNEL);
+ }
+@@ -6887,7 +6887,7 @@
+ if (!msg)
+ return -ENOMEM;
+
+- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
++ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ NL80211_CMD_REMAIN_ON_CHANNEL);
+
+ if (IS_ERR(hdr)) {
+@@ -7106,7 +7106,7 @@
+ if (!rdev->ops->mgmt_tx)
+ return -EOPNOTSUPP;
+
+- return cfg80211_mlme_register_mgmt(wdev, info->snd_portid, frame_type,
++ return cfg80211_mlme_register_mgmt(wdev, genl_info_snd_portid(info), frame_type,
+ nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]),
+ nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH]));
+ }
+@@ -7176,7 +7176,7 @@
+ if (!msg)
+ return -ENOMEM;
+
+- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
++ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ NL80211_CMD_FRAME);
+
+ if (IS_ERR(hdr)) {
+@@ -7291,7 +7291,7 @@
+ if (!msg)
+ return -ENOMEM;
+
+- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
++ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ NL80211_CMD_GET_POWER_SAVE);
+ if (!hdr) {
+ err = -ENOBUFS;
+@@ -7583,7 +7583,7 @@
+ if (!msg)
+ return -ENOMEM;
+
+- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
++ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ NL80211_CMD_GET_WOWLAN);
+ if (!hdr)
+ goto nla_put_failure;
+@@ -8007,7 +8007,7 @@
+ if (wdev->ap_unexpected_nlportid)
+ return -EBUSY;
+
+- wdev->ap_unexpected_nlportid = info->snd_portid;
++ wdev->ap_unexpected_nlportid = genl_info_snd_portid(info);
+ return 0;
+ }
+
+@@ -8037,7 +8037,7 @@
+ if (!msg)
+ return -ENOMEM;
+
+- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
++ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ NL80211_CMD_PROBE_CLIENT);
+
+ if (IS_ERR(hdr)) {
+@@ -8081,13 +8081,13 @@
+ /* First, check if already registered. */
+ spin_lock_bh(&rdev->beacon_registrations_lock);
+ list_for_each_entry(reg, &rdev->beacon_registrations, list) {
+- if (reg->nlportid == info->snd_portid) {
++ if (reg->nlportid == genl_info_snd_portid(info)) {
+ rv = -EALREADY;
+ goto out_err;
+ }
+ }
+ /* Add it to the list */
+- nreg->nlportid = info->snd_portid;
++ nreg->nlportid = genl_info_snd_portid(info);
+ list_add(&nreg->list, &rdev->beacon_registrations);
+
+ spin_unlock_bh(&rdev->beacon_registrations_lock);
+@@ -8160,7 +8160,7 @@
+ if (!msg)
+ return -ENOMEM;
+
+- hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
++ hdr = nl80211hdr_put(msg, genl_info_snd_portid(info), info->snd_seq, 0,
+ NL80211_CMD_GET_PROTOCOL_FEATURES);
+ if (!hdr)
+ goto nla_put_failure;
+@@ -10565,12 +10565,12 @@
+
+ list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) {
+ list_for_each_entry_rcu(wdev, &rdev->wdev_list, list)
+- cfg80211_mlme_unregister_socket(wdev, notify->portid);
++ cfg80211_mlme_unregister_socket(wdev, netlink_notify_portid(notify));
+
+ spin_lock_bh(&rdev->beacon_registrations_lock);
+ list_for_each_entry_safe(reg, tmp, &rdev->beacon_registrations,
+ list) {
+- if (reg->nlportid == notify->portid) {
++ if (reg->nlportid == netlink_notify_portid(notify)) {
+ list_del(®->list);
+ kfree(reg);
+ break;
+++ /dev/null
-On older kernels, we can't do this workaround, so if you use
-an old 64-bit kernel with compat you'd better upgrade.
-
-For more details of this work around refer to this commit
-upstream that deals with the code added:
-
-commit 645e77def93f1dd0e211c7244fbe152dac8a7100
-Author: Johannes Berg <johannes.berg@intel.com>
-Date: Fri Mar 1 14:03:49 2013 +0100
-
- nl80211: increase wiphy dump size dynamically
-
- Given a device with many channels capabilities the wiphy
- information can still overflow even though its size in
- 3.9 was reduced to 3.8 levels. For new userspace and
- kernel 3.10 we're going to implement a new "split dump"
- protocol that can use multiple messages per wiphy.
-
- For now though, add a workaround to be able to send more
- information to userspace. Since generic netlink doesn't
- have a way to set the minimum dump size globally, and we
- wouldn't really want to set it globally anyway, increase
- the size only when needed, as described in the comments.
- As userspace might not be prepared for large buffers, we
- can only use 4k.
-
- Also increase the size for the get_wiphy command.
-
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -1600,6 +1600,7 @@ static int nl80211_dump_wiphy(struct sk_
- &cb->args[2],
- &cb->args[3]);
- if (ret < 0) {
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
- /*
- * If sending the wiphy data didn't fit (ENOBUFS
- * or EMSGSIZE returned), this SKB is still
-@@ -1620,6 +1621,7 @@ static int nl80211_dump_wiphy(struct sk_
- mutex_unlock(&cfg80211_mutex);
- return 1;
- }
-+#endif
- idx--;
- break;
- }
--- /dev/null
+On older kernels, we can't do this workaround, so if you use
+an old 64-bit kernel with compat you'd better upgrade.
+
+For more details of this work around refer to this commit
+upstream that deals with the code added:
+
+commit 645e77def93f1dd0e211c7244fbe152dac8a7100
+Author: Johannes Berg <johannes.berg@intel.com>
+Date: Fri Mar 1 14:03:49 2013 +0100
+
+ nl80211: increase wiphy dump size dynamically
+
+ Given a device with many channels capabilities the wiphy
+ information can still overflow even though its size in
+ 3.9 was reduced to 3.8 levels. For new userspace and
+ kernel 3.10 we're going to implement a new "split dump"
+ protocol that can use multiple messages per wiphy.
+
+ For now though, add a workaround to be able to send more
+ information to userspace. Since generic netlink doesn't
+ have a way to set the minimum dump size globally, and we
+ wouldn't really want to set it globally anyway, increase
+ the size only when needed, as described in the comments.
+ As userspace might not be prepared for large buffers, we
+ can only use 4k.
+
+ Also increase the size for the get_wiphy command.
+
--- /dev/null
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -1600,6 +1600,7 @@
+ &cb->args[2],
+ &cb->args[3]);
+ if (ret < 0) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
+ /*
+ * If sending the wiphy data didn't fit (ENOBUFS
+ * or EMSGSIZE returned), this SKB is still
+@@ -1620,6 +1621,7 @@
+ mutex_unlock(&cfg80211_mutex);
+ return 1;
+ }
++#endif
+ idx--;
+ break;
+ }
+++ /dev/null
-ksize() was added as of 2.6.29, it gives you the actual
-size of the allocated data. Since we have no support for
-this we simply do not optimize for it and deal with
-large alloocations for the IEs.
-
-We technically could backport this as
-
-define ksize(bleh) SOME_LARGE_NUMBER
-
-but doing it this way emphasis careful review
-of the situation.
-
---- a/drivers/net/wireless/orinoco/wext.c
-+++ b/drivers/net/wireless/orinoco/wext.c
-@@ -31,8 +31,22 @@ static int orinoco_set_key(struct orinoc
- enum orinoco_alg alg, const u8 *key, int key_len,
- const u8 *seq, int seq_len)
- {
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
-+ int len;
-+ if (!unlikely(ZERO_OR_NULL_PTR(priv->keys[index].key))) {
-+ len = priv->keys[index].key_len;
-+ memset(priv->keys[index].key, 0, len);
-+ kfree(priv->keys[index].key);
-+ }
-+ if (!unlikely(ZERO_OR_NULL_PTR(priv->keys[index].seq))) {
-+ len = priv->keys[index].seq_len;
-+ memset(priv->keys[index].seq, 0, len);
-+ kfree(priv->keys[index].seq);
-+ }
-+#else
- kzfree(priv->keys[index].key);
- kzfree(priv->keys[index].seq);
-+#endif
-
- if (key_len) {
- priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC);
--- /dev/null
+ksize() was added as of 2.6.29, it gives you the actual
+size of the allocated data. Since we have no support for
+this we simply do not optimize for it and deal with
+large alloocations for the IEs.
+
+We technically could backport this as
+
+define ksize(bleh) SOME_LARGE_NUMBER
+
+but doing it this way emphasis careful review
+of the situation.
+
--- /dev/null
+--- a/drivers/net/wireless/orinoco/wext.c
++++ b/drivers/net/wireless/orinoco/wext.c
+@@ -31,8 +31,22 @@
+ enum orinoco_alg alg, const u8 *key, int key_len,
+ const u8 *seq, int seq_len)
+ {
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
++ int len;
++ if (!unlikely(ZERO_OR_NULL_PTR(priv->keys[index].key))) {
++ len = priv->keys[index].key_len;
++ memset(priv->keys[index].key, 0, len);
++ kfree(priv->keys[index].key);
++ }
++ if (!unlikely(ZERO_OR_NULL_PTR(priv->keys[index].seq))) {
++ len = priv->keys[index].seq_len;
++ memset(priv->keys[index].seq, 0, len);
++ kfree(priv->keys[index].seq);
++ }
++#else
+ kzfree(priv->keys[index].key);
+ kzfree(priv->keys[index].seq);
++#endif
+
+ if (key_len) {
+ priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC);
+++ /dev/null
-rfkill was re-implemented on 2.6.31. We port it to
-older kernels with a simple hack, just rename the
-module as a new one rfkill_backport, and every
-exported symbol gets redefined with a _backport
-postfix through compat-2.6.31.h. The changes below
-are the ones we could not do through compat-2.6.31.h
-
-Do older kernels have /dev/rfkill ? I not then we can
-just keep /dev/rfkill and not /dev/rfkill_backport.
-
-Note that 2.6.31 added netdevice notifier upon interface
-dev_open() which on cfg80211 will check if checks to see
-if rfkill is enabled (or if the mode of operation is not
-supported) on the cfg80211_netdev_notifier_call() and if
-so deny bringing the interface up. This was added via
-commit:
-
-3b8bcfd5d31ea0fec58681d035544ace707d2536
-
-Since older kernels will not have the notifier call
-on dev_open() if we *really want* to port this we could have
-mac80211's subif_open() call :
-
- ret = call_netdevice_notifiers(NETDEV_PRE_UP, dev);
- ret = notifier_to_errno(ret);
- if (ret)
- return ret;
-
-This would do the policing from within mac80211.
-
---- a/net/rfkill/Makefile
-+++ b/net/rfkill/Makefile
-@@ -2,8 +2,8 @@
- # Makefile for the RF switch subsystem.
- #
-
--rfkill-y += core.o
--rfkill-$(CONFIG_RFKILL_INPUT) += input.o
--obj-$(CONFIG_RFKILL) += rfkill.o
-+rfkill_backport-y += core.o
-+rfkill_backport-$(CONFIG_RFKILL_BACKPORT_INPUT) += input.o
-+obj-$(CONFIG_RFKILL_BACKPORT) += rfkill_backport.o
- obj-$(CONFIG_RFKILL_REGULATOR) += rfkill-regulator.o
- obj-$(CONFIG_RFKILL_GPIO) += rfkill-gpio.o
---- a/net/rfkill/input.c
-+++ b/net/rfkill/input.c
-@@ -230,7 +230,7 @@ static int rfkill_connect(struct input_h
-
- handle->dev = dev;
- handle->handler = handler;
-- handle->name = "rfkill";
-+ handle->name = "rfkill_backport";
-
- /* causes rfkill_start() to be called */
- error = input_register_handle(handle);
---- a/net/rfkill/core.c
-+++ b/net/rfkill/core.c
-@@ -826,7 +826,7 @@ static int rfkill_resume(struct device *
- }
-
- static struct class rfkill_class = {
-- .name = "rfkill",
-+ .name = "rfkill_backport",
- .dev_release = rfkill_release,
- .dev_attrs = rfkill_dev_attrs,
- .dev_uevent = rfkill_dev_uevent,
--- /dev/null
+rfkill was re-implemented on 2.6.31. We port it to
+older kernels with a simple hack, just rename the
+module as a new one rfkill_backport, and every
+exported symbol gets redefined with a _backport
+postfix through compat-2.6.31.h. The changes below
+are the ones we could not do through compat-2.6.31.h
+
+Do older kernels have /dev/rfkill ? I not then we can
+just keep /dev/rfkill and not /dev/rfkill_backport.
+
+Note that 2.6.31 added netdevice notifier upon interface
+dev_open() which on cfg80211 will check if checks to see
+if rfkill is enabled (or if the mode of operation is not
+supported) on the cfg80211_netdev_notifier_call() and if
+so deny bringing the interface up. This was added via
+commit:
+
+3b8bcfd5d31ea0fec58681d035544ace707d2536
+
+Since older kernels will not have the notifier call
+on dev_open() if we *really want* to port this we could have
+mac80211's subif_open() call :
+
+ ret = call_netdevice_notifiers(NETDEV_PRE_UP, dev);
+ ret = notifier_to_errno(ret);
+ if (ret)
+ return ret;
+
+This would do the policing from within mac80211.
+
--- /dev/null
+--- a/net/rfkill/Makefile
++++ b/net/rfkill/Makefile
+@@ -2,8 +2,8 @@
+ # Makefile for the RF switch subsystem.
+ #
+
+-rfkill-y += core.o
+-rfkill-$(CONFIG_RFKILL_INPUT) += input.o
+-obj-$(CONFIG_RFKILL) += rfkill.o
++rfkill_backport-y += core.o
++rfkill_backport-$(CONFIG_RFKILL_BACKPORT_INPUT) += input.o
++obj-$(CONFIG_RFKILL_BACKPORT) += rfkill_backport.o
+ obj-$(CONFIG_RFKILL_REGULATOR) += rfkill-regulator.o
+ obj-$(CONFIG_RFKILL_GPIO) += rfkill-gpio.o
--- /dev/null
+--- a/net/rfkill/core.c
++++ b/net/rfkill/core.c
+@@ -826,7 +826,7 @@
+ }
+
+ static struct class rfkill_class = {
+- .name = "rfkill",
++ .name = "rfkill_backport",
+ .dev_release = rfkill_release,
+ .dev_attrs = rfkill_dev_attrs,
+ .dev_uevent = rfkill_dev_uevent,
--- /dev/null
+--- a/net/rfkill/input.c
++++ b/net/rfkill/input.c
+@@ -230,7 +230,7 @@
+
+ handle->dev = dev;
+ handle->handler = handler;
+- handle->name = "rfkill";
++ handle->name = "rfkill_backport";
+
+ /* causes rfkill_start() to be called */
+ error = input_register_handle(handle);
+++ /dev/null
-The only other namespace change. Note that pach 01-netdev.patch
-also has some other namespace changes there, look at that file
-for the other changes. It'd be nice to figure out a way to
-bring thise here cleanly and seprately but they touch the same
-files...
-
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -6740,7 +6740,9 @@ static int nl80211_wiphy_netns(struct sk
- if (!net_eq(wiphy_net(&rdev->wiphy), net))
- err = cfg80211_switch_netns(rdev, net);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
- put_net(net);
-+#endif
- return err;
- }
-
---- a/net/wireless/core.c
-+++ b/net/wireless/core.c
-@@ -160,6 +160,7 @@ int cfg80211_dev_rename(struct cfg80211_
- return 0;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
- int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
- struct net *net)
- {
-@@ -204,6 +205,7 @@ int cfg80211_switch_netns(struct cfg8021
-
- return 0;
- }
-+#endif
-
- static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data)
- {
-@@ -372,7 +374,9 @@ struct wiphy *wiphy_new(const struct cfg
- rdev->wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
- #endif
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
- wiphy_net_set(&rdev->wiphy, &init_net);
-+#endif
-
- rdev->rfkill_ops.set_block = cfg80211_rfkill_set_block;
- rdev->rfkill = rfkill_alloc(dev_name(&rdev->wiphy.dev),
-@@ -919,8 +923,10 @@ static int cfg80211_netdev_notifier_call
- wdev->identifier = ++rdev->wdev_id;
- list_add_rcu(&wdev->list, &rdev->wdev_list);
- rdev->devlist_generation++;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
- /* can only change netns with wiphy */
- dev->features |= NETIF_F_NETNS_LOCAL;
-+#endif
-
- if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj,
- "phy80211")) {
-@@ -1081,6 +1087,7 @@ static struct notifier_block cfg80211_ne
- .notifier_call = cfg80211_netdev_notifier_call,
- };
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
- static void __net_exit cfg80211_pernet_exit(struct net *net)
- {
- struct cfg80211_registered_device *rdev;
-@@ -1098,14 +1105,17 @@ static void __net_exit cfg80211_pernet_e
- static struct pernet_operations cfg80211_pernet_ops = {
- .exit = cfg80211_pernet_exit,
- };
-+#endif
-
- static int __init cfg80211_init(void)
- {
- int err;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
- err = register_pernet_device(&cfg80211_pernet_ops);
- if (err)
- goto out_fail_pernet;
-+#endif
-
- err = wiphy_sysfs_init();
- if (err)
-@@ -1142,8 +1152,10 @@ out_fail_nl80211:
- out_fail_notifier:
- wiphy_sysfs_exit();
- out_fail_sysfs:
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
- unregister_pernet_device(&cfg80211_pernet_ops);
- out_fail_pernet:
-+#endif
- return err;
- }
- subsys_initcall(cfg80211_init);
-@@ -1155,7 +1167,9 @@ static void __exit cfg80211_exit(void)
- unregister_netdevice_notifier(&cfg80211_netdev_notifier);
- wiphy_sysfs_exit();
- regulatory_exit();
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
- unregister_pernet_device(&cfg80211_pernet_ops);
-+#endif
- destroy_workqueue(cfg80211_wq);
- }
- module_exit(cfg80211_exit);
---- a/net/wireless/wext-core.c
-+++ b/net/wireless/wext-core.c
-@@ -367,6 +367,7 @@ static int __init wireless_nlevent_init(
- subsys_initcall(wireless_nlevent_init);
-
- /* Process events generated by the wireless layer or the driver. */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
- static void wireless_nlevent_process(struct work_struct *work)
- {
- struct sk_buff *skb;
-@@ -382,6 +383,20 @@ static void wireless_nlevent_process(str
-
- rtnl_unlock();
- }
-+#else
-+static void wireless_nlevent_process(struct work_struct *work)
-+{
-+ struct sk_buff *skb;
-+ struct net *net;
-+
-+ rtnl_lock();
-+
-+ while ((skb = skb_dequeue(&net->wext_nlevents)))
-+ rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
-+
-+ rtnl_unlock();
-+}
-+#endif
-
- static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process);
-
---- a/net/wireless/wext-proc.c
-+++ b/net/wireless/wext-proc.c
-@@ -98,7 +98,11 @@ static void *wireless_dev_seq_start(stru
- return SEQ_START_TOKEN;
-
- off = 1;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
- for_each_netdev(net, dev)
-+#else
-+ for_each_netdev(net)
-+#endif
- if (off++ == *pos)
- return dev;
- return NULL;
--- /dev/null
+The only other namespace change. Note that pach 01-netdev.patch
+also has some other namespace changes there, look at that file
+for the other changes. It'd be nice to figure out a way to
+bring thise here cleanly and seprately but they touch the same
+files...
+
--- /dev/null
+--- a/net/wireless/core.c
++++ b/net/wireless/core.c
+@@ -160,6 +160,7 @@
+ return 0;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
+ struct net *net)
+ {
+@@ -204,6 +205,7 @@
+
+ return 0;
+ }
++#endif
+
+ static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data)
+ {
+@@ -372,7 +374,9 @@
+ rdev->wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
+ #endif
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ wiphy_net_set(&rdev->wiphy, &init_net);
++#endif
+
+ rdev->rfkill_ops.set_block = cfg80211_rfkill_set_block;
+ rdev->rfkill = rfkill_alloc(dev_name(&rdev->wiphy.dev),
+@@ -919,8 +923,10 @@
+ wdev->identifier = ++rdev->wdev_id;
+ list_add_rcu(&wdev->list, &rdev->wdev_list);
+ rdev->devlist_generation++;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ /* can only change netns with wiphy */
+ dev->features |= NETIF_F_NETNS_LOCAL;
++#endif
+
+ if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj,
+ "phy80211")) {
+@@ -1081,6 +1087,7 @@
+ .notifier_call = cfg80211_netdev_notifier_call,
+ };
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ static void __net_exit cfg80211_pernet_exit(struct net *net)
+ {
+ struct cfg80211_registered_device *rdev;
+@@ -1098,14 +1105,17 @@
+ static struct pernet_operations cfg80211_pernet_ops = {
+ .exit = cfg80211_pernet_exit,
+ };
++#endif
+
+ static int __init cfg80211_init(void)
+ {
+ int err;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ err = register_pernet_device(&cfg80211_pernet_ops);
+ if (err)
+ goto out_fail_pernet;
++#endif
+
+ err = wiphy_sysfs_init();
+ if (err)
+@@ -1142,8 +1152,10 @@
+ out_fail_notifier:
+ wiphy_sysfs_exit();
+ out_fail_sysfs:
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ unregister_pernet_device(&cfg80211_pernet_ops);
+ out_fail_pernet:
++#endif
+ return err;
+ }
+ subsys_initcall(cfg80211_init);
+@@ -1155,7 +1167,9 @@
+ unregister_netdevice_notifier(&cfg80211_netdev_notifier);
+ wiphy_sysfs_exit();
+ regulatory_exit();
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ unregister_pernet_device(&cfg80211_pernet_ops);
++#endif
+ destroy_workqueue(cfg80211_wq);
+ }
+ module_exit(cfg80211_exit);
--- /dev/null
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -6740,7 +6740,9 @@
+ if (!net_eq(wiphy_net(&rdev->wiphy), net))
+ err = cfg80211_switch_netns(rdev, net);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ put_net(net);
++#endif
+ return err;
+ }
+
--- /dev/null
+--- a/net/wireless/wext-core.c
++++ b/net/wireless/wext-core.c
+@@ -367,6 +367,7 @@
+ subsys_initcall(wireless_nlevent_init);
+
+ /* Process events generated by the wireless layer or the driver. */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ static void wireless_nlevent_process(struct work_struct *work)
+ {
+ struct sk_buff *skb;
+@@ -382,6 +383,20 @@
+
+ rtnl_unlock();
+ }
++#else
++static void wireless_nlevent_process(struct work_struct *work)
++{
++ struct sk_buff *skb;
++ struct net *net;
++
++ rtnl_lock();
++
++ while ((skb = skb_dequeue(&net->wext_nlevents)))
++ rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
++
++ rtnl_unlock();
++}
++#endif
+
+ static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process);
+
--- /dev/null
+--- a/net/wireless/wext-proc.c
++++ b/net/wireless/wext-proc.c
+@@ -98,7 +98,11 @@
+ return SEQ_START_TOKEN;
+
+ off = 1;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ for_each_netdev(net, dev)
++#else
++ for_each_netdev(net)
++#endif
+ if (off++ == *pos)
+ return dev;
+ return NULL;
+++ /dev/null
-USB opt soft_unbid was added as of 2.6.27.
-
---- a/drivers/net/wireless/p54/p54usb.c
-+++ b/drivers/net/wireless/p54/p54usb.c
-@@ -1137,7 +1137,9 @@ static struct usb_driver p54u_driver = {
- .resume = p54u_resume,
- .reset_resume = p54u_resume,
- #endif /* CONFIG_PM */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
- .soft_unbind = 1,
-+#endif
- .disable_hub_initiated_lpm = 1,
- };
-
---- a/drivers/net/wireless/ath/ath9k/hif_usb.c
-+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
-@@ -1370,7 +1370,9 @@ static struct usb_driver ath9k_hif_usb_d
- .reset_resume = ath9k_hif_usb_resume,
- #endif
- .id_table = ath9k_hif_usb_ids,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
- .soft_unbind = 1,
-+#endif
- .disable_hub_initiated_lpm = 1,
- };
-
--- /dev/null
+USB opt soft_unbid was added as of 2.6.27.
+
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
+@@ -1370,7 +1370,9 @@
+ .reset_resume = ath9k_hif_usb_resume,
+ #endif
+ .id_table = ath9k_hif_usb_ids,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+ .soft_unbind = 1,
++#endif
+ .disable_hub_initiated_lpm = 1,
+ };
+
--- /dev/null
+--- a/drivers/net/wireless/p54/p54usb.c
++++ b/drivers/net/wireless/p54/p54usb.c
+@@ -1137,7 +1137,9 @@
+ .resume = p54u_resume,
+ .reset_resume = p54u_resume,
+ #endif /* CONFIG_PM */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+ .soft_unbind = 1,
++#endif
+ .disable_hub_initiated_lpm = 1,
+ };
+
+++ /dev/null
-
-Every kernel release there are a few changes to headers
-made. Some code gets shifted around between headers or
-new headers are defined. This patch deals with such
-cases.
-
---- a/drivers/net/wireless/ath/ath6kl/htc_pipe.c
-+++ b/drivers/net/wireless/ath/ath6kl/htc_pipe.c
-@@ -18,6 +18,10 @@
- #include "debug.h"
- #include "hif-ops.h"
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
-+#include <asm/unaligned.h>
-+#endif
-+
- #define HTC_PACKET_CONTAINER_ALLOCATION 32
- #define HTC_CONTROL_BUFFER_SIZE (HTC_MAX_CTRL_MSG_LEN + HTC_HDR_LENGTH)
-
---- a/drivers/net/wireless/b43/phy_common.h
-+++ b/drivers/net/wireless/b43/phy_common.h
-@@ -3,6 +3,9 @@
-
- #include <linux/types.h>
- #include <linux/nl80211.h>
-+#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,28))
-+#include <asm/atomic.h>
-+#endif
-
- struct b43_wldev;
-
---- a/drivers/net/wireless/rtlwifi/base.c
-+++ b/drivers/net/wireless/rtlwifi/base.c
-@@ -36,6 +36,7 @@
- #include "regd.h"
-
- #include <linux/ip.h>
-+#include <linux/in.h>
- #include <linux/module.h>
-
- /*
---- a/drivers/net/wireless/ti/wl1251/main.c
-+++ b/drivers/net/wireless/ti/wl1251/main.c
-@@ -24,6 +24,9 @@
- #include <linux/firmware.h>
- #include <linux/delay.h>
- #include <linux/irq.h>
-+#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,28))
-+#include <linux/device.h>
-+#endif
- #include <linux/crc32.h>
- #include <linux/etherdevice.h>
- #include <linux/vmalloc.h>
---- a/drivers/net/wireless/ti/wl1251/spi.c
-+++ b/drivers/net/wireless/ti/wl1251/spi.c
-@@ -24,6 +24,9 @@
- #include <linux/module.h>
- #include <linux/slab.h>
- #include <linux/crc7.h>
-+#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,28))
-+#include <linux/device.h>
-+#endif
- #include <linux/spi/spi.h>
- #include <linux/wl12xx.h>
-
---- a/net/mac80211/key.c
-+++ b/net/mac80211/key.c
-@@ -24,6 +24,9 @@
- #include "aes_ccm.h"
- #include "aes_cmac.h"
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
-+#include <asm/unaligned.h>
-+#endif
-
- /**
- * DOC: Key handling basics
---- a/net/mac80211/pm.c
-+++ b/net/mac80211/pm.c
-@@ -1,5 +1,6 @@
- #include <net/mac80211.h>
- #include <net/rtnetlink.h>
-+#include <linux/export.h>
-
- #include "ieee80211_i.h"
- #include "mesh.h"
---- a/net/bluetooth/bnep/sock.c
-+++ b/net/bluetooth/bnep/sock.c
-@@ -26,6 +26,7 @@
-
- #include <linux/export.h>
- #include <linux/file.h>
-+#include <linux/compat.h>
-
- #include "bnep.h"
-
---- a/net/bluetooth/hci_sock.c
-+++ b/net/bluetooth/hci_sock.c
-@@ -25,6 +25,7 @@
- /* Bluetooth HCI sockets. */
-
- #include <linux/export.h>
-+#include <linux/compat.h>
- #include <asm/unaligned.h>
-
- #include <net/bluetooth/bluetooth.h>
---- a/net/bluetooth/hidp/sock.c
-+++ b/net/bluetooth/hidp/sock.c
-@@ -22,6 +22,7 @@
-
- #include <linux/export.h>
- #include <linux/file.h>
-+#include <linux/compat.h>
-
- #include "hidp.h"
-
---- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
-+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
-@@ -20,6 +20,7 @@
- #include <linux/moduleparam.h>
- #include <linux/inetdevice.h>
- #include <linux/export.h>
-+#include <asm/unaligned.h>
-
- #include "core.h"
- #include "cfg80211.h"
---- a/drivers/net/wireless/mwifiex/usb.c
-+++ b/drivers/net/wireless/mwifiex/usb.c
-@@ -19,6 +19,7 @@
-
- #include "main.h"
- #include "usb.h"
-+#include <linux/usb/audio.h>
-
- #define USB_VERSION "1.0"
-
---- a/net/wireless/util.c
-+++ b/net/wireless/util.c
-@@ -10,6 +10,7 @@
- #include <net/cfg80211.h>
- #include <net/ip.h>
- #include <net/dsfield.h>
-+#include <asm/unaligned.h>
- #include "core.h"
- #include "rdev-ops.h"
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -20,6 +20,7 @@
- #include <linux/ieee80211.h>
- #include <net/cfg80211.h>
- #include <asm/unaligned.h>
-+#include <net/if_inet6.h>
-
- /**
- * DOC: Introduction
---- a/drivers/net/wireless/ti/wlcore/event.c
-+++ b/drivers/net/wireless/ti/wlcore/event.c
-@@ -21,6 +21,7 @@
- *
- */
-
-+#include <linux/export.h>
- #include "wlcore.h"
- #include "debug.h"
- #include "io.h"
---- a/drivers/net/wireless/ti/wlcore/scan.c
-+++ b/drivers/net/wireless/ti/wlcore/scan.c
-@@ -22,6 +22,7 @@
- */
-
- #include <linux/ieee80211.h>
-+#include <linux/export.h>
-
- #include "wlcore.h"
- #include "debug.h"
--- /dev/null
+
+Every kernel release there are a few changes to headers
+made. Some code gets shifted around between headers or
+new headers are defined. This patch deals with such
+cases.
+
--- /dev/null
+--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
++++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
+@@ -20,6 +20,7 @@
+ #include <linux/moduleparam.h>
+ #include <linux/inetdevice.h>
+ #include <linux/export.h>
++#include <asm/unaligned.h>
+
+ #include "core.h"
+ #include "cfg80211.h"
--- /dev/null
+--- a/drivers/net/wireless/ath/ath6kl/htc_pipe.c
++++ b/drivers/net/wireless/ath/ath6kl/htc_pipe.c
+@@ -18,6 +18,10 @@
+ #include "debug.h"
+ #include "hif-ops.h"
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
++#include <asm/unaligned.h>
++#endif
++
+ #define HTC_PACKET_CONTAINER_ALLOCATION 32
+ #define HTC_CONTROL_BUFFER_SIZE (HTC_MAX_CTRL_MSG_LEN + HTC_HDR_LENGTH)
+
--- /dev/null
+--- a/drivers/net/wireless/b43/phy_common.h
++++ b/drivers/net/wireless/b43/phy_common.h
+@@ -3,6 +3,9 @@
+
+ #include <linux/types.h>
+ #include <linux/nl80211.h>
++#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,28))
++#include <asm/atomic.h>
++#endif
+
+ struct b43_wldev;
+
--- /dev/null
+--- a/drivers/net/wireless/mwifiex/usb.c
++++ b/drivers/net/wireless/mwifiex/usb.c
+@@ -19,6 +19,7 @@
+
+ #include "main.h"
+ #include "usb.h"
++#include <linux/usb/audio.h>
+
+ #define USB_VERSION "1.0"
+
--- /dev/null
+--- a/drivers/net/wireless/rtlwifi/base.c
++++ b/drivers/net/wireless/rtlwifi/base.c
+@@ -36,6 +36,7 @@
+ #include "regd.h"
+
+ #include <linux/ip.h>
++#include <linux/in.h>
+ #include <linux/module.h>
+
+ /*
--- /dev/null
+--- a/drivers/net/wireless/ti/wl1251/main.c
++++ b/drivers/net/wireless/ti/wl1251/main.c
+@@ -24,6 +24,9 @@
+ #include <linux/firmware.h>
+ #include <linux/delay.h>
+ #include <linux/irq.h>
++#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,28))
++#include <linux/device.h>
++#endif
+ #include <linux/crc32.h>
+ #include <linux/etherdevice.h>
+ #include <linux/vmalloc.h>
--- /dev/null
+--- a/drivers/net/wireless/ti/wl1251/spi.c
++++ b/drivers/net/wireless/ti/wl1251/spi.c
+@@ -24,6 +24,9 @@
+ #include <linux/module.h>
+ #include <linux/slab.h>
+ #include <linux/crc7.h>
++#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,28))
++#include <linux/device.h>
++#endif
+ #include <linux/spi/spi.h>
+ #include <linux/wl12xx.h>
+
--- /dev/null
+--- a/drivers/net/wireless/ti/wlcore/event.c
++++ b/drivers/net/wireless/ti/wlcore/event.c
+@@ -21,6 +21,7 @@
+ *
+ */
+
++#include <linux/export.h>
+ #include "wlcore.h"
+ #include "debug.h"
+ #include "io.h"
--- /dev/null
+--- a/drivers/net/wireless/ti/wlcore/scan.c
++++ b/drivers/net/wireless/ti/wlcore/scan.c
+@@ -22,6 +22,7 @@
+ */
+
+ #include <linux/ieee80211.h>
++#include <linux/export.h>
+
+ #include "wlcore.h"
+ #include "debug.h"
--- /dev/null
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -20,6 +20,7 @@
+ #include <linux/ieee80211.h>
+ #include <net/cfg80211.h>
+ #include <asm/unaligned.h>
++#include <net/if_inet6.h>
+
+ /**
+ * DOC: Introduction
--- /dev/null
+--- a/net/bluetooth/bnep/sock.c
++++ b/net/bluetooth/bnep/sock.c
+@@ -26,6 +26,7 @@
+
+ #include <linux/export.h>
+ #include <linux/file.h>
++#include <linux/compat.h>
+
+ #include "bnep.h"
+
--- /dev/null
+--- a/net/bluetooth/hci_sock.c
++++ b/net/bluetooth/hci_sock.c
+@@ -25,6 +25,7 @@
+ /* Bluetooth HCI sockets. */
+
+ #include <linux/export.h>
++#include <linux/compat.h>
+ #include <asm/unaligned.h>
+
+ #include <net/bluetooth/bluetooth.h>
--- /dev/null
+--- a/net/bluetooth/hidp/sock.c
++++ b/net/bluetooth/hidp/sock.c
+@@ -22,6 +22,7 @@
+
+ #include <linux/export.h>
+ #include <linux/file.h>
++#include <linux/compat.h>
+
+ #include "hidp.h"
+
--- /dev/null
+--- a/net/mac80211/key.c
++++ b/net/mac80211/key.c
+@@ -24,6 +24,9 @@
+ #include "aes_ccm.h"
+ #include "aes_cmac.h"
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
++#include <asm/unaligned.h>
++#endif
+
+ /**
+ * DOC: Key handling basics
--- /dev/null
+--- a/net/mac80211/pm.c
++++ b/net/mac80211/pm.c
+@@ -1,5 +1,6 @@
+ #include <net/mac80211.h>
+ #include <net/rtnetlink.h>
++#include <linux/export.h>
+
+ #include "ieee80211_i.h"
+ #include "mesh.h"
--- /dev/null
+--- a/net/wireless/util.c
++++ b/net/wireless/util.c
+@@ -10,6 +10,7 @@
+ #include <net/cfg80211.h>
+ #include <net/ip.h>
+ #include <net/dsfield.h>
++#include <asm/unaligned.h>
+ #include "core.h"
+ #include "rdev-ops.h"
+
+++ /dev/null
-
-Your current kernels configuration (.config and linux/autoconf.h)
-are always respected when compiling external modules. Because
-of this if you are using an old kernel which preferred the
-PID rate control algorithm we cannot force it to use minstrel
-instead. Minstrel is now the default rate control algorithm
-and we want you to use it. To let you use it we redefine here
-the CONFIG_MAC80211_RC_DEFAULT to CONFIG_COMPAT_MAC80211_RC_DEFAULT
-and define CONFIG_COMPAT_MAC80211_RC_DEFAULT on config.mk.
-Through the compat autoconf we then get it also defined there
-at compilation time.
-
---- a/net/mac80211/rate.c
-+++ b/net/mac80211/rate.c
-@@ -24,7 +24,7 @@ struct rate_control_alg {
- static LIST_HEAD(rate_ctrl_algs);
- static DEFINE_MUTEX(rate_ctrl_mutex);
-
--static char *ieee80211_default_rc_algo = CONFIG_MAC80211_RC_DEFAULT;
-+static char *ieee80211_default_rc_algo = CONFIG_COMPAT_MAC80211_RC_DEFAULT;
- module_param(ieee80211_default_rc_algo, charp, 0644);
- MODULE_PARM_DESC(ieee80211_default_rc_algo,
- "Default rate control algorithm for mac80211 to use");
-@@ -120,8 +120,8 @@ ieee80211_rate_control_ops_get(const cha
- ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo);
-
- /* try built-in one if specific alg requested but not found */
-- if (!ops && strlen(CONFIG_MAC80211_RC_DEFAULT))
-- ops = ieee80211_try_rate_control_ops_get(CONFIG_MAC80211_RC_DEFAULT);
-+ if (!ops && strlen(CONFIG_COMPAT_MAC80211_RC_DEFAULT))
-+ ops = ieee80211_try_rate_control_ops_get(CONFIG_COMPAT_MAC80211_RC_DEFAULT);
- kparam_unblock_sysfs_write(ieee80211_default_rc_algo);
-
- return ops;
--- /dev/null
+
+Your current kernels configuration (.config and linux/autoconf.h)
+are always respected when compiling external modules. Because
+of this if you are using an old kernel which preferred the
+PID rate control algorithm we cannot force it to use minstrel
+instead. Minstrel is now the default rate control algorithm
+and we want you to use it. To let you use it we redefine here
+the CONFIG_MAC80211_RC_DEFAULT to CONFIG_COMPAT_MAC80211_RC_DEFAULT
+and define CONFIG_COMPAT_MAC80211_RC_DEFAULT on config.mk.
+Through the compat autoconf we then get it also defined there
+at compilation time.
+
--- /dev/null
+--- a/net/mac80211/rate.c
++++ b/net/mac80211/rate.c
+@@ -24,7 +24,7 @@
+ static LIST_HEAD(rate_ctrl_algs);
+ static DEFINE_MUTEX(rate_ctrl_mutex);
+
+-static char *ieee80211_default_rc_algo = CONFIG_MAC80211_RC_DEFAULT;
++static char *ieee80211_default_rc_algo = CONFIG_COMPAT_MAC80211_RC_DEFAULT;
+ module_param(ieee80211_default_rc_algo, charp, 0644);
+ MODULE_PARM_DESC(ieee80211_default_rc_algo,
+ "Default rate control algorithm for mac80211 to use");
+@@ -120,8 +120,8 @@
+ ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo);
+
+ /* try built-in one if specific alg requested but not found */
+- if (!ops && strlen(CONFIG_MAC80211_RC_DEFAULT))
+- ops = ieee80211_try_rate_control_ops_get(CONFIG_MAC80211_RC_DEFAULT);
++ if (!ops && strlen(CONFIG_COMPAT_MAC80211_RC_DEFAULT))
++ ops = ieee80211_try_rate_control_ops_get(CONFIG_COMPAT_MAC80211_RC_DEFAULT);
+ kparam_unblock_sysfs_write(ieee80211_default_rc_algo);
+
+ return ops;
+++ /dev/null
-This file renames CONFIG_ options that may be defined in older
-kernels but that we know we can *safely* rename to other config
-option names to ensure we disable building these options at
-through this framework. An example here is ath9k's rate control
-aglorithm is always selected by default via CONFIG_ATH9K_RATE_CONTROL.
-By renaming this to CONFIG_COMPAT_ATH9K_RATE_CONTROL we have
-the flexibility to disable it for a replacement driver.
-
-In kernel 2.6.26 and older CONFIG_IWL4965 was build as an extra
-module, but now it is directly included in the iwlagn.
-
-CONFIG_IWL4965 has to be set to y, to build correctly.
-
-zd1211rw does not build with kernel < 2.6.28, but it is often activated
-in the kernel config of older kernels. We rename the option to
-deactivate it on older kernels.
-CONFIG_BT_L2CAP and CONFIG_BT_SCO are boolean now, but often set to m
-in the kernel config.
-
-CONFIG_BT_HIDP does not build with older kernel versions.
-
---- a/drivers/net/wireless/Makefile
-+++ b/drivers/net/wireless/Makefile
-@@ -21,7 +21,7 @@ obj-$(CONFIG_PRISM54) += prism54/
- obj-$(CONFIG_HOSTAP) += hostap/
- obj-$(CONFIG_B43) += b43/
- obj-$(CONFIG_B43LEGACY) += b43legacy/
--obj-$(CONFIG_ZD1211RW) += zd1211rw/
-+obj-$(CONFIG_COMPAT_ZD1211RW) += zd1211rw/
- obj-$(CONFIG_RTL8180) += rtl818x/
- obj-$(CONFIG_RTL8187) += rtl818x/
- obj-$(CONFIG_RTLWIFI) += rtlwifi/
-@@ -49,11 +49,11 @@ obj-$(CONFIG_P54_COMMON) += p54/
-
- obj-$(CONFIG_ATH_CARDS) += ath/
-
--obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o
-+obj-$(CONFIG_COMPAT_MAC80211_HWSIM) += mac80211_hwsim.o
-
- obj-$(CONFIG_WL_TI) += ti/
-
--obj-$(CONFIG_MWIFIEX) += mwifiex/
-+obj-$(CONFIG_COMPAT_MWIFIEX) += mwifiex/
-
- obj-$(CONFIG_BRCMFMAC) += brcm80211/
- obj-$(CONFIG_BRCMSMAC) += brcm80211/
---- a/drivers/net/wireless/iwlegacy/Makefile
-+++ b/drivers/net/wireless/iwlegacy/Makefile
-@@ -5,7 +5,7 @@ iwlegacy-$(CONFIG_IWLEGACY_DEBUGFS) += d
- iwlegacy-objs += $(iwlegacy-m)
-
- # 4965
--obj-$(CONFIG_IWL4965) += iwl4965.o
-+obj-$(CONFIG_COMPAT_IWL4965) += iwl4965.o
- iwl4965-objs := 4965.o 4965-mac.o 4965-rs.o 4965-calib.o
- iwl4965-$(CONFIG_IWLEGACY_DEBUGFS) += 4965-debug.o
-
---- a/drivers/net/wireless/iwlegacy/common.h
-+++ b/drivers/net/wireless/iwlegacy/common.h
-@@ -1348,7 +1348,7 @@ struct il_priv {
-
- } _3945;
- #endif
--#if defined(CONFIG_IWL4965) || defined(CONFIG_IWL4965_MODULE)
-+#if defined(CONFIG_COMPAT_IWL4965) || defined(CONFIG_COMPAT_IWL4965_MODULE)
- struct {
- struct il_rx_phy_res last_phy_res;
- bool last_phy_res_valid;
---- a/drivers/net/wireless/libertas/Makefile
-+++ b/drivers/net/wireless/libertas/Makefile
-@@ -17,5 +17,5 @@ libertas_spi-objs += if_spi.o
- obj-$(CONFIG_LIBERTAS) += libertas.o
- obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o
- obj-$(CONFIG_LIBERTAS_CS) += libertas_cs.o
--obj-$(CONFIG_LIBERTAS_SDIO) += libertas_sdio.o
-+obj-$(CONFIG_COMPAT_LIBERTAS_SDIO) += libertas_sdio.o
- obj-$(CONFIG_LIBERTAS_SPI) += libertas_spi.o
---- a/drivers/net/wireless/zd1211rw/Makefile
-+++ b/drivers/net/wireless/zd1211rw/Makefile
-@@ -1,4 +1,4 @@
--obj-$(CONFIG_ZD1211RW) += zd1211rw.o
-+obj-$(CONFIG_COMPAT_ZD1211RW) += zd1211rw.o
-
- zd1211rw-objs := zd_chip.o zd_mac.o \
- zd_rf_al2230.o zd_rf_rf2959.o \
---- a/net/bluetooth/Makefile
-+++ b/net/bluetooth/Makefile
-@@ -6,7 +6,7 @@ obj-$(CONFIG_BT) += bluetooth.o
- obj-$(CONFIG_BT_RFCOMM) += rfcomm/
- obj-$(CONFIG_BT_BNEP) += bnep/
- obj-$(CONFIG_BT_CMTP) += cmtp/
--obj-$(CONFIG_BT_HIDP) += hidp/
-+obj-$(CONFIG_COMPAT_BT_HIDP) += hidp/
-
- bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o \
- hci_sock.o hci_sysfs.o l2cap_core.o l2cap_sock.o smp.o sco.o lib.o \
---- a/net/bluetooth/hidp/Makefile
-+++ b/net/bluetooth/hidp/Makefile
-@@ -2,6 +2,6 @@
- # Makefile for the Linux Bluetooth HIDP layer
- #
-
--obj-$(CONFIG_BT_HIDP) += hidp.o
-+obj-$(CONFIG_COMPAT_BT_HIDP) += hidp.o
-
- hidp-objs := core.o sock.o
---- a/drivers/net/wireless/ti/wl1251/Makefile
-+++ b/drivers/net/wireless/ti/wl1251/Makefile
-@@ -4,7 +4,7 @@ wl1251_spi-objs += spi.o
- wl1251_sdio-objs += sdio.o
-
- obj-$(CONFIG_WL1251) += wl1251.o
--obj-$(CONFIG_WL1251_SPI) += wl1251_spi.o
--obj-$(CONFIG_WL1251_SDIO) += wl1251_sdio.o
-+obj-$(CONFIG_COMPAT_WL1251_SPI)+= wl1251_spi.o
-+obj-$(CONFIG_COMPAT_WL1251_SDIO)+= wl1251_sdio.o
-
- ccflags-y += -D__CHECK_ENDIAN__
---- a/drivers/net/wireless/ath/ath9k/Makefile
-+++ b/drivers/net/wireless/ath/ath9k/Makefile
-@@ -8,7 +8,7 @@ ath9k-y += beacon.o \
- antenna.o
-
- ath9k-$(CONFIG_ATH9K_BTCOEX_SUPPORT) += mci.o
--ath9k-$(CONFIG_ATH9K_RATE_CONTROL) += rc.o
-+ath9k-$(CONFIG_COMPAT_ATH9K_RATE_CONTROL) += rc.o
- ath9k-$(CONFIG_ATH9K_PCI) += pci.o
- ath9k-$(CONFIG_ATH9K_AHB) += ahb.o
- ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o
---- a/drivers/net/wireless/ath/ath9k/init.c
-+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -809,7 +809,7 @@ void ath9k_set_hw_capab(struct ath_softc
- sc->ant_rx = hw->wiphy->available_antennas_rx;
- sc->ant_tx = hw->wiphy->available_antennas_tx;
-
--#ifdef CONFIG_ATH9K_RATE_CONTROL
-+#ifdef CONFIG_COMPAT_ATH9K_RATE_CONTROL
- hw->rate_control_algorithm = "ath9k_rate_control";
- #endif
-
---- a/drivers/net/wireless/ath/ath9k/rc.h
-+++ b/drivers/net/wireless/ath/ath9k/rc.h
-@@ -231,7 +231,7 @@ static inline void ath_debug_stat_retrie
- }
- #endif
-
--#ifdef CONFIG_ATH9K_RATE_CONTROL
-+#ifdef CONFIG_COMPAT_ATH9K_RATE_CONTROL
- int ath_rate_control_register(void);
- void ath_rate_control_unregister(void);
- #else
---- a/net/bluetooth/rfcomm/Makefile
-+++ b/net/bluetooth/rfcomm/Makefile
-@@ -5,4 +5,4 @@
- obj-$(CONFIG_BT_RFCOMM) += rfcomm.o
-
- rfcomm-y := core.o sock.o
--rfcomm-$(CONFIG_BT_RFCOMM_TTY) += tty.o
-+rfcomm-$(CONFIG_COMPAT_BT_RFCOMM_TTY) += tty.o
---- a/include/net/bluetooth/rfcomm.h
-+++ b/include/net/bluetooth/rfcomm.h
-@@ -351,7 +351,7 @@ struct rfcomm_dev_list_req {
-
- int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
-
--#ifdef CONFIG_BT_RFCOMM_TTY
-+#ifdef CONFIG_COMPAT_BT_RFCOMM_TTY
- int rfcomm_init_ttys(void);
- void rfcomm_cleanup_ttys(void);
- #else
---- a/net/bluetooth/rfcomm/sock.c
-+++ b/net/bluetooth/rfcomm/sock.c
-@@ -860,7 +860,7 @@ static int rfcomm_sock_ioctl(struct sock
- err = bt_sock_ioctl(sock, cmd, arg);
-
- if (err == -ENOIOCTLCMD) {
--#ifdef CONFIG_BT_RFCOMM_TTY
-+#ifdef CONFIG_COMPAT_BT_RFCOMM_TTY
- lock_sock(sk);
- err = rfcomm_dev_ioctl(sk, cmd, (void __user *) arg);
- release_sock(sk);
---- a/drivers/net/wireless/mwifiex/Makefile
-+++ b/drivers/net/wireless/mwifiex/Makefile
-@@ -41,7 +41,7 @@ mwifiex-y += uap_txrx.o
- mwifiex-y += cfg80211.o
- mwifiex-y += ethtool.o
- mwifiex-$(CONFIG_DEBUG_FS) += debugfs.o
--obj-$(CONFIG_MWIFIEX) += mwifiex.o
-+obj-$(CONFIG_COMPAT_MWIFIEX) += mwifiex.o
-
- mwifiex_sdio-y += sdio.o
- obj-$(CONFIG_MWIFIEX_SDIO) += mwifiex_sdio.o
--- /dev/null
+This file renames CONFIG_ options that may be defined in older
+kernels but that we know we can *safely* rename to other config
+option names to ensure we disable building these options at
+through this framework. An example here is ath9k's rate control
+aglorithm is always selected by default via CONFIG_ATH9K_RATE_CONTROL.
+By renaming this to CONFIG_COMPAT_ATH9K_RATE_CONTROL we have
+the flexibility to disable it for a replacement driver.
+
+In kernel 2.6.26 and older CONFIG_IWL4965 was build as an extra
+module, but now it is directly included in the iwlagn.
+
+CONFIG_IWL4965 has to be set to y, to build correctly.
+
+zd1211rw does not build with kernel < 2.6.28, but it is often activated
+in the kernel config of older kernels. We rename the option to
+deactivate it on older kernels.
+CONFIG_BT_L2CAP and CONFIG_BT_SCO are boolean now, but often set to m
+in the kernel config.
+
+CONFIG_BT_HIDP does not build with older kernel versions.
+
--- /dev/null
+--- a/drivers/net/wireless/Makefile
++++ b/drivers/net/wireless/Makefile
+@@ -21,7 +21,7 @@
+ obj-$(CONFIG_HOSTAP) += hostap/
+ obj-$(CONFIG_B43) += b43/
+ obj-$(CONFIG_B43LEGACY) += b43legacy/
+-obj-$(CONFIG_ZD1211RW) += zd1211rw/
++obj-$(CONFIG_COMPAT_ZD1211RW) += zd1211rw/
+ obj-$(CONFIG_RTL8180) += rtl818x/
+ obj-$(CONFIG_RTL8187) += rtl818x/
+ obj-$(CONFIG_RTLWIFI) += rtlwifi/
+@@ -49,11 +49,11 @@
+
+ obj-$(CONFIG_ATH_CARDS) += ath/
+
+-obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o
++obj-$(CONFIG_COMPAT_MAC80211_HWSIM) += mac80211_hwsim.o
+
+ obj-$(CONFIG_WL_TI) += ti/
+
+-obj-$(CONFIG_MWIFIEX) += mwifiex/
++obj-$(CONFIG_COMPAT_MWIFIEX) += mwifiex/
+
+ obj-$(CONFIG_BRCMFMAC) += brcm80211/
+ obj-$(CONFIG_BRCMSMAC) += brcm80211/
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/Makefile
++++ b/drivers/net/wireless/ath/ath9k/Makefile
+@@ -8,7 +8,7 @@
+ antenna.o
+
+ ath9k-$(CONFIG_ATH9K_BTCOEX_SUPPORT) += mci.o
+-ath9k-$(CONFIG_ATH9K_RATE_CONTROL) += rc.o
++ath9k-$(CONFIG_COMPAT_ATH9K_RATE_CONTROL) += rc.o
+ ath9k-$(CONFIG_ATH9K_PCI) += pci.o
+ ath9k-$(CONFIG_ATH9K_AHB) += ahb.o
+ ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/init.c
++++ b/drivers/net/wireless/ath/ath9k/init.c
+@@ -809,7 +809,7 @@
+ sc->ant_rx = hw->wiphy->available_antennas_rx;
+ sc->ant_tx = hw->wiphy->available_antennas_tx;
+
+-#ifdef CONFIG_ATH9K_RATE_CONTROL
++#ifdef CONFIG_COMPAT_ATH9K_RATE_CONTROL
+ hw->rate_control_algorithm = "ath9k_rate_control";
+ #endif
+
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/rc.h
++++ b/drivers/net/wireless/ath/ath9k/rc.h
+@@ -231,7 +231,7 @@
+ }
+ #endif
+
+-#ifdef CONFIG_ATH9K_RATE_CONTROL
++#ifdef CONFIG_COMPAT_ATH9K_RATE_CONTROL
+ int ath_rate_control_register(void);
+ void ath_rate_control_unregister(void);
+ #else
--- /dev/null
+--- a/drivers/net/wireless/iwlegacy/Makefile
++++ b/drivers/net/wireless/iwlegacy/Makefile
+@@ -5,7 +5,7 @@
+ iwlegacy-objs += $(iwlegacy-m)
+
+ # 4965
+-obj-$(CONFIG_IWL4965) += iwl4965.o
++obj-$(CONFIG_COMPAT_IWL4965) += iwl4965.o
+ iwl4965-objs := 4965.o 4965-mac.o 4965-rs.o 4965-calib.o
+ iwl4965-$(CONFIG_IWLEGACY_DEBUGFS) += 4965-debug.o
+
--- /dev/null
+--- a/drivers/net/wireless/iwlegacy/common.h
++++ b/drivers/net/wireless/iwlegacy/common.h
+@@ -1348,7 +1348,7 @@
+
+ } _3945;
+ #endif
+-#if defined(CONFIG_IWL4965) || defined(CONFIG_IWL4965_MODULE)
++#if defined(CONFIG_COMPAT_IWL4965) || defined(CONFIG_COMPAT_IWL4965_MODULE)
+ struct {
+ struct il_rx_phy_res last_phy_res;
+ bool last_phy_res_valid;
--- /dev/null
+--- a/drivers/net/wireless/libertas/Makefile
++++ b/drivers/net/wireless/libertas/Makefile
+@@ -17,5 +17,5 @@
+ obj-$(CONFIG_LIBERTAS) += libertas.o
+ obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o
+ obj-$(CONFIG_LIBERTAS_CS) += libertas_cs.o
+-obj-$(CONFIG_LIBERTAS_SDIO) += libertas_sdio.o
++obj-$(CONFIG_COMPAT_LIBERTAS_SDIO) += libertas_sdio.o
+ obj-$(CONFIG_LIBERTAS_SPI) += libertas_spi.o
--- /dev/null
+--- a/drivers/net/wireless/mwifiex/Makefile
++++ b/drivers/net/wireless/mwifiex/Makefile
+@@ -41,7 +41,7 @@
+ mwifiex-y += cfg80211.o
+ mwifiex-y += ethtool.o
+ mwifiex-$(CONFIG_DEBUG_FS) += debugfs.o
+-obj-$(CONFIG_MWIFIEX) += mwifiex.o
++obj-$(CONFIG_COMPAT_MWIFIEX) += mwifiex.o
+
+ mwifiex_sdio-y += sdio.o
+ obj-$(CONFIG_MWIFIEX_SDIO) += mwifiex_sdio.o
--- /dev/null
+--- a/drivers/net/wireless/ti/wl1251/Makefile
++++ b/drivers/net/wireless/ti/wl1251/Makefile
+@@ -4,7 +4,7 @@
+ wl1251_sdio-objs += sdio.o
+
+ obj-$(CONFIG_WL1251) += wl1251.o
+-obj-$(CONFIG_WL1251_SPI) += wl1251_spi.o
+-obj-$(CONFIG_WL1251_SDIO) += wl1251_sdio.o
++obj-$(CONFIG_COMPAT_WL1251_SPI)+= wl1251_spi.o
++obj-$(CONFIG_COMPAT_WL1251_SDIO)+= wl1251_sdio.o
+
+ ccflags-y += -D__CHECK_ENDIAN__
--- /dev/null
+--- a/drivers/net/wireless/zd1211rw/Makefile
++++ b/drivers/net/wireless/zd1211rw/Makefile
+@@ -1,4 +1,4 @@
+-obj-$(CONFIG_ZD1211RW) += zd1211rw.o
++obj-$(CONFIG_COMPAT_ZD1211RW) += zd1211rw.o
+
+ zd1211rw-objs := zd_chip.o zd_mac.o \
+ zd_rf_al2230.o zd_rf_rf2959.o \
--- /dev/null
+--- a/include/net/bluetooth/rfcomm.h
++++ b/include/net/bluetooth/rfcomm.h
+@@ -351,7 +351,7 @@
+
+ int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
+
+-#ifdef CONFIG_BT_RFCOMM_TTY
++#ifdef CONFIG_COMPAT_BT_RFCOMM_TTY
+ int rfcomm_init_ttys(void);
+ void rfcomm_cleanup_ttys(void);
+ #else
--- /dev/null
+--- a/net/bluetooth/Makefile
++++ b/net/bluetooth/Makefile
+@@ -6,7 +6,7 @@
+ obj-$(CONFIG_BT_RFCOMM) += rfcomm/
+ obj-$(CONFIG_BT_BNEP) += bnep/
+ obj-$(CONFIG_BT_CMTP) += cmtp/
+-obj-$(CONFIG_BT_HIDP) += hidp/
++obj-$(CONFIG_COMPAT_BT_HIDP) += hidp/
+
+ bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o \
+ hci_sock.o hci_sysfs.o l2cap_core.o l2cap_sock.o smp.o sco.o lib.o \
--- /dev/null
+--- a/net/bluetooth/hidp/Makefile
++++ b/net/bluetooth/hidp/Makefile
+@@ -2,6 +2,6 @@
+ # Makefile for the Linux Bluetooth HIDP layer
+ #
+
+-obj-$(CONFIG_BT_HIDP) += hidp.o
++obj-$(CONFIG_COMPAT_BT_HIDP) += hidp.o
+
+ hidp-objs := core.o sock.o
--- /dev/null
+--- a/net/bluetooth/rfcomm/Makefile
++++ b/net/bluetooth/rfcomm/Makefile
+@@ -5,4 +5,4 @@
+ obj-$(CONFIG_BT_RFCOMM) += rfcomm.o
+
+ rfcomm-y := core.o sock.o
+-rfcomm-$(CONFIG_BT_RFCOMM_TTY) += tty.o
++rfcomm-$(CONFIG_COMPAT_BT_RFCOMM_TTY) += tty.o
--- /dev/null
+--- a/net/bluetooth/rfcomm/sock.c
++++ b/net/bluetooth/rfcomm/sock.c
+@@ -860,7 +860,7 @@
+ err = bt_sock_ioctl(sock, cmd, arg);
+
+ if (err == -ENOIOCTLCMD) {
+-#ifdef CONFIG_BT_RFCOMM_TTY
++#ifdef CONFIG_COMPAT_BT_RFCOMM_TTY
+ lock_sock(sk);
+ err = rfcomm_dev_ioctl(sk, cmd, (void __user *) arg);
+ release_sock(sk);
+++ /dev/null
-This is a tricky one.
-
-Consider a kernel that has this code in net/wireless/wext-core.c:
-
-#ifdef CONFIG_CFG80211_WEXT
- if (dev->ieee80211_ptr && dev->ieee80211_ptr->wiphy)
- handlers = dev->ieee80211_ptr->wiphy->wext;
-#endif
-#ifdef CONFIG_WIRELESS_EXT
- if (dev->wireless_handlers)
- handlers = dev->wireless_handlers;
-#endif
-
-If a kernel is compiled without CONFIG_WIRELESS_EXT then
-compat-drivers can't do wireless extensions against it.
-However, if the kernel is compiled with CONFIG_CFG80211_WEXT
-then it will try to get the wext handlers from struct wiphy.
-
-Now, struct wiphy in the base kernel and struct wiphy in
-compat-drivers don't match, so the kernel crashes!!
-
-To fix this, add lots of padding to compat-drivers's
-struct wiphy so that the "wext" pointer is guaranteed
-to be NULL.
-
-Make sure the padding is larger than the struct so we
-don't ever run into this again because the wext pointer
-moved due to struct enlargements.
-
-
---- a/include/net/cfg80211.h
-+++ b/include/net/cfg80211.h
-@@ -2561,6 +2561,9 @@ struct wiphy_wowlan_support {
- struct wiphy {
- /* assign these fields before you register the wiphy */
-
-+#define WIPHY_COMPAT_PAD_SIZE 2048
-+ u8 padding[WIPHY_COMPAT_PAD_SIZE];
-+
- /* permanent MAC address(es) */
- u8 perm_addr[ETH_ALEN];
- u8 addr_mask[ETH_ALEN];
---- a/net/wireless/core.c
-+++ b/net/wireless/core.c
-@@ -316,6 +316,17 @@ struct wiphy *wiphy_new(const struct cfg
- struct cfg80211_registered_device *rdev;
- int alloc_size;
-
-+ /*
-+ * Make sure the padding is >= the rest of the struct so that we
-+ * always keep it large enough to pad out the entire original
-+ * kernel's struct. We really only need to make sure it's larger
-+ * than the kernel compat is compiled against, but since it'll
-+ * only increase in size make sure it's larger than the current
-+ * version of it. Subtract since it's included.
-+ */
-+ BUILD_BUG_ON(WIPHY_COMPAT_PAD_SIZE <
-+ sizeof(struct wiphy) - WIPHY_COMPAT_PAD_SIZE);
-+
- WARN_ON(ops->add_key && (!ops->del_key || !ops->set_default_key));
- WARN_ON(ops->auth && (!ops->assoc || !ops->deauth || !ops->disassoc));
- WARN_ON(ops->connect && !ops->disconnect);
--- /dev/null
+This is a tricky one.
+
+Consider a kernel that has this code in net/wireless/wext-core.c:
+
+#ifdef CONFIG_CFG80211_WEXT
+ if (dev->ieee80211_ptr && dev->ieee80211_ptr->wiphy)
+ handlers = dev->ieee80211_ptr->wiphy->wext;
+#endif
+#ifdef CONFIG_WIRELESS_EXT
+ if (dev->wireless_handlers)
+ handlers = dev->wireless_handlers;
+#endif
+
+If a kernel is compiled without CONFIG_WIRELESS_EXT then
+compat-drivers can't do wireless extensions against it.
+However, if the kernel is compiled with CONFIG_CFG80211_WEXT
+then it will try to get the wext handlers from struct wiphy.
+
+Now, struct wiphy in the base kernel and struct wiphy in
+compat-drivers don't match, so the kernel crashes!!
+
+To fix this, add lots of padding to compat-drivers's
+struct wiphy so that the "wext" pointer is guaranteed
+to be NULL.
+
+Make sure the padding is larger than the struct so we
+don't ever run into this again because the wext pointer
+moved due to struct enlargements.
+
+
--- /dev/null
+--- a/include/net/cfg80211.h
++++ b/include/net/cfg80211.h
+@@ -2561,6 +2561,9 @@
+ struct wiphy {
+ /* assign these fields before you register the wiphy */
+
++#define WIPHY_COMPAT_PAD_SIZE 2048
++ u8 padding[WIPHY_COMPAT_PAD_SIZE];
++
+ /* permanent MAC address(es) */
+ u8 perm_addr[ETH_ALEN];
+ u8 addr_mask[ETH_ALEN];
--- /dev/null
+--- a/net/wireless/core.c
++++ b/net/wireless/core.c
+@@ -316,6 +316,17 @@
+ struct cfg80211_registered_device *rdev;
+ int alloc_size;
+
++ /*
++ * Make sure the padding is >= the rest of the struct so that we
++ * always keep it large enough to pad out the entire original
++ * kernel's struct. We really only need to make sure it's larger
++ * than the kernel compat is compiled against, but since it'll
++ * only increase in size make sure it's larger than the current
++ * version of it. Subtract since it's included.
++ */
++ BUILD_BUG_ON(WIPHY_COMPAT_PAD_SIZE <
++ sizeof(struct wiphy) - WIPHY_COMPAT_PAD_SIZE);
++
+ WARN_ON(ops->add_key && (!ops->del_key || !ops->set_default_key));
+ WARN_ON(ops->auth && (!ops->assoc || !ops->deauth || !ops->disassoc));
+ WARN_ON(ops->connect && !ops->disconnect);
+++ /dev/null
-The 2.6.31 kernel has threaded IRQ support and b43 is the first
-wireless driver that makes use of it. To support threaded IRSs
-on older kernels we built our own struct compat_threaded_irq
-to queue_work() onto it as the kernel thread be running the
-thread in process context as well.
-
---- a/drivers/net/wireless/b43/main.c
-+++ b/drivers/net/wireless/b43/main.c
-@@ -4243,8 +4243,13 @@ redo:
- if (b43_bus_host_is_sdio(dev->dev)) {
- b43_sdio_free_irq(dev);
- } else {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+ compat_synchronize_threaded_irq(&dev->irq_compat);
-+ compat_free_threaded_irq(&dev->irq_compat);
-+#else
- synchronize_irq(dev->dev->irq);
- free_irq(dev->dev->irq, dev);
-+#endif
- }
- mutex_lock(&wl->mutex);
- dev = wl->current_dev;
-@@ -4290,9 +4295,17 @@ static int b43_wireless_core_start(struc
- goto out;
- }
- } else {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+ err = compat_request_threaded_irq(&dev->irq_compat,
-+ dev->dev->irq,
-+ b43_interrupt_handler,
-+ b43_interrupt_thread_handler,
-+ IRQF_SHARED, KBUILD_MODNAME, dev);
-+#else
- err = request_threaded_irq(dev->dev->irq, b43_interrupt_handler,
- b43_interrupt_thread_handler,
- IRQF_SHARED, KBUILD_MODNAME, dev);
-+#endif
- if (err) {
- b43err(dev->wl, "Cannot request IRQ-%d\n",
- dev->dev->irq);
-@@ -5115,6 +5128,10 @@ static int b43_setup_bands(struct b43_wl
-
- static void b43_wireless_core_detach(struct b43_wldev *dev)
- {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+ if (dev->dev->sdev->bus->bustype != SSB_BUSTYPE_SDIO)
-+ compat_destroy_threaded_irq(&dev->irq_compat);
-+#endif
- /* We release firmware that late to not be required to re-request
- * is all the time when we reinit the core. */
- b43_release_firmware(dev);
---- a/drivers/net/wireless/b43/b43.h
-+++ b/drivers/net/wireless/b43/b43.h
-@@ -872,6 +872,9 @@ struct b43_wldev {
- unsigned int tx_count;
- unsigned int rx_count;
- #endif
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+ struct compat_threaded_irq irq_compat;
-+#endif
- };
-
- /* Data structure for the WLAN parts (802.11 cores) of the b43 chip. */
---- a/drivers/net/wireless/iwlwifi/pcie/internal.h
-+++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
-@@ -311,6 +311,9 @@ struct iwl_trans_pcie {
-
- /*protect hw register */
- spinlock_t reg_lock;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+ struct compat_threaded_irq irq_compat;
-+#endif
- };
-
- /**
---- a/drivers/net/wireless/iwlwifi/pcie/trans.c
-+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
-@@ -773,12 +773,21 @@ void iwl_trans_pcie_free(struct iwl_tran
- {
- struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
-
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+ compat_synchronize_threaded_irq(&trans_pcie->irq_compat);
-+#else
- synchronize_irq(trans_pcie->pci_dev->irq);
-+#endif
-
- iwl_pcie_tx_free(trans);
- iwl_pcie_rx_free(trans);
-
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+ compat_free_threaded_irq(&trans_pcie->irq_compat);
-+ compat_destroy_threaded_irq(&trans_pcie->irq_compat);
-+#else
- free_irq(trans_pcie->pci_dev->irq, trans);
-+#endif
- iwl_pcie_free_ict(trans);
-
- pci_disable_msi(trans_pcie->pci_dev);
-@@ -1566,9 +1575,16 @@ struct iwl_trans *iwl_trans_pcie_alloc(s
- if (iwl_pcie_alloc_ict(trans))
- goto out_free_cmd_pool;
-
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+ if (compat_request_threaded_irq(&trans_pcie->irq_compat,
-+ pdev->irq, iwl_pcie_isr_ict,
-+ iwl_pcie_irq_handler,
-+ IRQF_SHARED, DRV_NAME, trans)) {
-+#else
- if (request_threaded_irq(pdev->irq, iwl_pcie_isr_ict,
- iwl_pcie_irq_handler,
- IRQF_SHARED, DRV_NAME, trans)) {
-+#endif
- IWL_ERR(trans, "Error allocating IRQ %d\n", pdev->irq);
- goto out_free_ict;
- }
---- a/drivers/net/wireless/ti/wlcore/main.c
-+++ b/drivers/net/wireless/ti/wlcore/main.c
-@@ -6054,13 +6054,24 @@ static void wlcore_nvs_cb(const struct f
- wl->platform_quirks = pdata->platform_quirks;
- wl->if_ops = pdev_data->if_ops;
-
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
-+ irqflags = IRQF_TRIGGER_RISING;
-+#else
- if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
- irqflags = IRQF_TRIGGER_RISING;
- else
- irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
-+#endif
-
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+ ret = compat_request_threaded_irq(&wl->irq_compat, wl->irq,
-+ NULL, wlcore_irq,
-+ irqflags,
-+ pdev->name, wl);
-+#else
- ret = request_threaded_irq(wl->irq, NULL, wlcore_irq,
- irqflags, pdev->name, wl);
-+#endif
- if (ret < 0) {
- wl1271_error("request_irq() failed: %d", ret);
- goto out_free_nvs;
-@@ -6135,7 +6146,11 @@ out_unreg:
- wl1271_unregister_hw(wl);
-
- out_irq:
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+ compat_free_threaded_irq(&wl->irq_compat);
-+#else
- free_irq(wl->irq, wl);
-+#endif
-
- out_free_nvs:
- kfree(wl->nvs);
-@@ -6181,7 +6196,12 @@ int wlcore_remove(struct platform_device
- disable_irq_wake(wl->irq);
- }
- wl1271_unregister_hw(wl);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+ compat_free_threaded_irq(&wl->irq_compat);
-+ compat_destroy_threaded_irq(&wl->irq_compat);
-+#else
- free_irq(wl->irq, wl);
-+#endif
- wlcore_free_hw(wl);
-
- return 0;
---- a/drivers/net/wireless/ti/wlcore/wlcore.h
-+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
-@@ -175,7 +175,9 @@ struct wl1271 {
- bool initialized;
- struct ieee80211_hw *hw;
- bool mac80211_registered;
--
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
-+ struct compat_threaded_irq irq_compat;
-+#endif
- struct device *dev;
- struct platform_device *pdev;
-
--- /dev/null
+The 2.6.31 kernel has threaded IRQ support and b43 is the first
+wireless driver that makes use of it. To support threaded IRSs
+on older kernels we built our own struct compat_threaded_irq
+to queue_work() onto it as the kernel thread be running the
+thread in process context as well.
+
--- /dev/null
+--- a/drivers/net/wireless/b43/b43.h
++++ b/drivers/net/wireless/b43/b43.h
+@@ -872,6 +872,9 @@
+ unsigned int tx_count;
+ unsigned int rx_count;
+ #endif
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++ struct compat_threaded_irq irq_compat;
++#endif
+ };
+
+ /* Data structure for the WLAN parts (802.11 cores) of the b43 chip. */
--- /dev/null
+--- a/drivers/net/wireless/b43/main.c
++++ b/drivers/net/wireless/b43/main.c
+@@ -4243,8 +4243,13 @@
+ if (b43_bus_host_is_sdio(dev->dev)) {
+ b43_sdio_free_irq(dev);
+ } else {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++ compat_synchronize_threaded_irq(&dev->irq_compat);
++ compat_free_threaded_irq(&dev->irq_compat);
++#else
+ synchronize_irq(dev->dev->irq);
+ free_irq(dev->dev->irq, dev);
++#endif
+ }
+ mutex_lock(&wl->mutex);
+ dev = wl->current_dev;
+@@ -4290,9 +4295,17 @@
+ goto out;
+ }
+ } else {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++ err = compat_request_threaded_irq(&dev->irq_compat,
++ dev->dev->irq,
++ b43_interrupt_handler,
++ b43_interrupt_thread_handler,
++ IRQF_SHARED, KBUILD_MODNAME, dev);
++#else
+ err = request_threaded_irq(dev->dev->irq, b43_interrupt_handler,
+ b43_interrupt_thread_handler,
+ IRQF_SHARED, KBUILD_MODNAME, dev);
++#endif
+ if (err) {
+ b43err(dev->wl, "Cannot request IRQ-%d\n",
+ dev->dev->irq);
+@@ -5115,6 +5128,10 @@
+
+ static void b43_wireless_core_detach(struct b43_wldev *dev)
+ {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++ if (dev->dev->sdev->bus->bustype != SSB_BUSTYPE_SDIO)
++ compat_destroy_threaded_irq(&dev->irq_compat);
++#endif
+ /* We release firmware that late to not be required to re-request
+ * is all the time when we reinit the core. */
+ b43_release_firmware(dev);
--- /dev/null
+--- a/drivers/net/wireless/iwlwifi/pcie/internal.h
++++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
+@@ -311,6 +311,9 @@
+
+ /*protect hw register */
+ spinlock_t reg_lock;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++ struct compat_threaded_irq irq_compat;
++#endif
+ };
+
+ /**
--- /dev/null
+--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
++++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
+@@ -773,12 +773,21 @@
+ {
+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++ compat_synchronize_threaded_irq(&trans_pcie->irq_compat);
++#else
+ synchronize_irq(trans_pcie->pci_dev->irq);
++#endif
+
+ iwl_pcie_tx_free(trans);
+ iwl_pcie_rx_free(trans);
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++ compat_free_threaded_irq(&trans_pcie->irq_compat);
++ compat_destroy_threaded_irq(&trans_pcie->irq_compat);
++#else
+ free_irq(trans_pcie->pci_dev->irq, trans);
++#endif
+ iwl_pcie_free_ict(trans);
+
+ pci_disable_msi(trans_pcie->pci_dev);
+@@ -1566,9 +1575,16 @@
+ if (iwl_pcie_alloc_ict(trans))
+ goto out_free_cmd_pool;
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++ if (compat_request_threaded_irq(&trans_pcie->irq_compat,
++ pdev->irq, iwl_pcie_isr_ict,
++ iwl_pcie_irq_handler,
++ IRQF_SHARED, DRV_NAME, trans)) {
++#else
+ if (request_threaded_irq(pdev->irq, iwl_pcie_isr_ict,
+ iwl_pcie_irq_handler,
+ IRQF_SHARED, DRV_NAME, trans)) {
++#endif
+ IWL_ERR(trans, "Error allocating IRQ %d\n", pdev->irq);
+ goto out_free_ict;
+ }
--- /dev/null
+--- a/drivers/net/wireless/ti/wlcore/main.c
++++ b/drivers/net/wireless/ti/wlcore/main.c
+@@ -6054,13 +6054,24 @@
+ wl->platform_quirks = pdata->platform_quirks;
+ wl->if_ops = pdev_data->if_ops;
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
++ irqflags = IRQF_TRIGGER_RISING;
++#else
+ if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
+ irqflags = IRQF_TRIGGER_RISING;
+ else
+ irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
++#endif
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++ ret = compat_request_threaded_irq(&wl->irq_compat, wl->irq,
++ NULL, wlcore_irq,
++ irqflags,
++ pdev->name, wl);
++#else
+ ret = request_threaded_irq(wl->irq, NULL, wlcore_irq,
+ irqflags, pdev->name, wl);
++#endif
+ if (ret < 0) {
+ wl1271_error("request_irq() failed: %d", ret);
+ goto out_free_nvs;
+@@ -6135,7 +6146,11 @@
+ wl1271_unregister_hw(wl);
+
+ out_irq:
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++ compat_free_threaded_irq(&wl->irq_compat);
++#else
+ free_irq(wl->irq, wl);
++#endif
+
+ out_free_nvs:
+ kfree(wl->nvs);
+@@ -6181,7 +6196,12 @@
+ disable_irq_wake(wl->irq);
+ }
+ wl1271_unregister_hw(wl);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++ compat_free_threaded_irq(&wl->irq_compat);
++ compat_destroy_threaded_irq(&wl->irq_compat);
++#else
+ free_irq(wl->irq, wl);
++#endif
+ wlcore_free_hw(wl);
+
+ return 0;
--- /dev/null
+--- a/drivers/net/wireless/ti/wlcore/wlcore.h
++++ b/drivers/net/wireless/ti/wlcore/wlcore.h
+@@ -175,7 +175,9 @@
+ bool initialized;
+ struct ieee80211_hw *hw;
+ bool mac80211_registered;
+-
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++ struct compat_threaded_irq irq_compat;
++#endif
+ struct device *dev;
+ struct platform_device *pdev;
+
+++ /dev/null
-The patch "wext: refactor" by Johannes Berg refactored
-wext code so that new kernels no longer get the wext
-handlers through struct netdevice, instead they get
-it through the struct wiphy which is cfg80211 specific.
-
-For old kernels this means you get not wext handlers
-anymore when backporting code, this adds the wext handler
-back to the netdevice wireless_handlers to let compat
-users use wext again.
-
-We do this for every kernel version because the struct wiphy
-is changing from kernel version to version. At least the
-struct from kernel 2.6.33 and 2.6.34 are incompatible and
-the kernel would dereference some wrong type in the struct
-and oops. The old interface is not affected by this. This
-will cause that CONFIG_CFG80211_WEXT still depends on
-CONFIG_WIRELESS_EXT in compat-drivers.
-
---- a/net/wireless/core.c
-+++ b/net/wireless/core.c
-@@ -373,10 +373,6 @@ struct wiphy *wiphy_new(const struct cfg
- INIT_WORK(&rdev->sched_scan_results_wk, __cfg80211_sched_scan_results);
- INIT_DELAYED_WORK(&rdev->dfs_update_channels_wk,
- cfg80211_dfs_channels_update_work);
--#ifdef CONFIG_CFG80211_WEXT
-- rdev->wiphy.wext = &cfg80211_wext_handler;
--#endif
--
- device_initialize(&rdev->wiphy.dev);
- rdev->wiphy.dev.class = &ieee80211_class;
- rdev->wiphy.dev.platform_data = rdev;
-@@ -947,6 +943,15 @@ static int cfg80211_netdev_notifier_call
- wdev->sme_state = CFG80211_SME_IDLE;
- mutex_unlock(&rdev->devlist_mtx);
- #ifdef CONFIG_CFG80211_WEXT
-+#ifdef CONFIG_WIRELESS_EXT
-+ if (!dev->wireless_handlers)
-+ dev->wireless_handlers = &cfg80211_wext_handler;
-+#else
-+ printk_once(KERN_WARNING "cfg80211: wext will not work because "
-+ "kernel was compiled with CONFIG_WIRELESS_EXT=n. "
-+ "Tools using wext interface, like iwconfig will "
-+ "not work.\n");
-+#endif
- wdev->wext.default_key = -1;
- wdev->wext.default_mgmt_key = -1;
- wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
--- /dev/null
+The patch "wext: refactor" by Johannes Berg refactored
+wext code so that new kernels no longer get the wext
+handlers through struct netdevice, instead they get
+it through the struct wiphy which is cfg80211 specific.
+
+For old kernels this means you get not wext handlers
+anymore when backporting code, this adds the wext handler
+back to the netdevice wireless_handlers to let compat
+users use wext again.
+
+We do this for every kernel version because the struct wiphy
+is changing from kernel version to version. At least the
+struct from kernel 2.6.33 and 2.6.34 are incompatible and
+the kernel would dereference some wrong type in the struct
+and oops. The old interface is not affected by this. This
+will cause that CONFIG_CFG80211_WEXT still depends on
+CONFIG_WIRELESS_EXT in compat-drivers.
+
--- /dev/null
+--- a/net/wireless/core.c
++++ b/net/wireless/core.c
+@@ -373,10 +373,6 @@
+ INIT_WORK(&rdev->sched_scan_results_wk, __cfg80211_sched_scan_results);
+ INIT_DELAYED_WORK(&rdev->dfs_update_channels_wk,
+ cfg80211_dfs_channels_update_work);
+-#ifdef CONFIG_CFG80211_WEXT
+- rdev->wiphy.wext = &cfg80211_wext_handler;
+-#endif
+-
+ device_initialize(&rdev->wiphy.dev);
+ rdev->wiphy.dev.class = &ieee80211_class;
+ rdev->wiphy.dev.platform_data = rdev;
+@@ -947,6 +943,15 @@
+ wdev->sme_state = CFG80211_SME_IDLE;
+ mutex_unlock(&rdev->devlist_mtx);
+ #ifdef CONFIG_CFG80211_WEXT
++#ifdef CONFIG_WIRELESS_EXT
++ if (!dev->wireless_handlers)
++ dev->wireless_handlers = &cfg80211_wext_handler;
++#else
++ printk_once(KERN_WARNING "cfg80211: wext will not work because "
++ "kernel was compiled with CONFIG_WIRELESS_EXT=n. "
++ "Tools using wext interface, like iwconfig will "
++ "not work.\n");
++#endif
+ wdev->wext.default_key = -1;
+ wdev->wext.default_mgmt_key = -1;
+ wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
+++ /dev/null
-The 2.6.29 kernel has new struct dev_pm_ops [1] which are used
-on the pci device to distinguish power management hooks for suspend
-to RAM and hibernation. Older kernels don't have these so we need
-to resort back to the good ol' suspend/resume. Fortunately the calls
-are not so different so it should be possible to resuse the same
-calls on compat code with only slight modifications.
-
-[1] http://lxr.linux.no/#linux+v2.6.29/include/linux/pm.h#L170
-
---- a/drivers/bcma/host_pci.c
-+++ b/drivers/bcma/host_pci.c
-@@ -257,6 +257,9 @@ static int bcma_host_pci_resume(struct d
- return bcma_bus_resume(bus);
- }
-
-+compat_pci_suspend(bcma_host_pci_suspend)
-+compat_pci_resume(bcma_host_pci_resume)
-+
- static SIMPLE_DEV_PM_OPS(bcma_pm_ops, bcma_host_pci_suspend,
- bcma_host_pci_resume);
- #define BCMA_PM_OPS (&bcma_pm_ops)
-@@ -285,7 +288,12 @@ static struct pci_driver bcma_pci_bridge
- .id_table = bcma_pci_bridge_tbl,
- .probe = bcma_host_pci_probe,
- .remove = bcma_host_pci_remove,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = BCMA_PM_OPS,
-+#elif defined(CONFIG_PM_SLEEP)
-+ .suspend = bcma_host_pci_suspend_compat,
-+ .resume = bcma_host_pci_resume_compat,
-+#endif
- };
-
- int __init bcma_host_pci_init(void)
---- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
-+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
-@@ -2743,6 +2743,9 @@ static const struct pci_error_handlers a
- .resume = atl1c_io_resume,
- };
-
-+compat_pci_suspend(atl1c_suspend)
-+compat_pci_resume(atl1c_resume)
-+
- static SIMPLE_DEV_PM_OPS(atl1c_pm_ops, atl1c_suspend, atl1c_resume);
-
- static struct pci_driver atl1c_driver = {
-@@ -2752,7 +2755,12 @@ static struct pci_driver atl1c_driver =
- .remove = atl1c_remove,
- .shutdown = atl1c_shutdown,
- .err_handler = &atl1c_err_handler,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = &atl1c_pm_ops,
-+#elif defined(CONFIG_PM_SLEEP)
-+ .suspend = atl1c_suspend_compat,
-+ .resume = atl1c_resume_compat,
-+#endif
- };
-
- /**
---- a/drivers/net/ethernet/atheros/atlx/atl1.c
-+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
-@@ -2877,6 +2877,9 @@ static int atl1_resume(struct device *de
- return 0;
- }
-
-+compat_pci_suspend(atl1_suspend)
-+compat_pci_resume(atl1_resume)
-+
- static SIMPLE_DEV_PM_OPS(atl1_pm_ops, atl1_suspend, atl1_resume);
- #define ATL1_PM_OPS (&atl1_pm_ops)
-
-@@ -3147,7 +3150,12 @@ static struct pci_driver atl1_driver = {
- .probe = atl1_probe,
- .remove = atl1_remove,
- .shutdown = atl1_shutdown,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = ATL1_PM_OPS,
-+#elif defined(CONFIG_PM_SLEEP)
-+ .suspend = atl1_suspend_compat,
-+ .resume = atl1_resume_compat,
-+#endif
- };
-
- /**
---- a/drivers/net/wireless/ath/ath5k/pci.c
-+++ b/drivers/net/wireless/ath/ath5k/pci.c
-@@ -326,6 +326,9 @@ static int ath5k_pci_resume(struct devic
- return 0;
- }
-
-+compat_pci_suspend(ath5k_pci_suspend)
-+compat_pci_resume(ath5k_pci_resume)
-+
- static SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume);
- #define ATH5K_PM_OPS (&ath5k_pm_ops)
- #else
-@@ -337,7 +340,12 @@ static struct pci_driver ath5k_pci_drive
- .id_table = ath5k_pci_id_table,
- .probe = ath5k_pci_probe,
- .remove = ath5k_pci_remove,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = ATH5K_PM_OPS,
-+#elif defined(CONFIG_PM_SLEEP)
-+ .suspend = ath5k_pci_suspend_compat,
-+ .resume = ath5k_pci_resume_compat,
-+#endif
- };
-
- module_pci_driver(ath5k_pci_driver);
---- a/drivers/net/wireless/ath/ath9k/pci.c
-+++ b/drivers/net/wireless/ath/ath9k/pci.c
-@@ -310,6 +310,9 @@ static int ath_pci_resume(struct device
- return 0;
- }
-
-+compat_pci_suspend(ath_pci_suspend);
-+compat_pci_resume(ath_pci_resume);
-+
- static SIMPLE_DEV_PM_OPS(ath9k_pm_ops, ath_pci_suspend, ath_pci_resume);
-
- #define ATH9K_PM_OPS (&ath9k_pm_ops)
-@@ -328,7 +331,12 @@ static struct pci_driver ath_pci_driver
- .id_table = ath_pci_id_table,
- .probe = ath_pci_probe,
- .remove = ath_pci_remove,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = ATH9K_PM_OPS,
-+#elif defined(CONFIG_PM_SLEEP)
-+ .suspend = ath_pci_suspend_compat,
-+ .resume = ath_pci_resume_compat,
-+#endif
- };
-
- int ath_pci_init(void)
---- a/drivers/net/wireless/iwlegacy/3945-mac.c
-+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
-@@ -3909,7 +3909,12 @@ static struct pci_driver il3945_driver =
- .id_table = il3945_hw_card_ids,
- .probe = il3945_pci_probe,
- .remove = il3945_pci_remove,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = IL_LEGACY_PM_OPS,
-+#elif defined(CONFIG_PM)
-+ .suspend = il_pci_suspend_compat,
-+ .resume = il_pci_resume_compat,
-+#endif
- };
-
- static int __init
---- a/drivers/net/wireless/iwlegacy/4965-mac.c
-+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
-@@ -6803,7 +6803,12 @@ static struct pci_driver il4965_driver =
- .id_table = il4965_hw_card_ids,
- .probe = il4965_pci_probe,
- .remove = il4965_pci_remove,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = IL_LEGACY_PM_OPS,
-+#elif defined(CONFIG_PM)
-+ .suspend = il_pci_suspend_compat,
-+ .resume = il_pci_resume_compat,
-+#endif
- };
-
- static int __init
---- a/drivers/net/wireless/iwlegacy/common.c
-+++ b/drivers/net/wireless/iwlegacy/common.c
-@@ -4935,8 +4935,17 @@ il_pci_resume(struct device *device)
- return 0;
- }
-
-+compat_pci_suspend(il_pci_suspend)
-+compat_pci_resume(il_pci_resume)
-+
- SIMPLE_DEV_PM_OPS(il_pm_ops, il_pci_suspend, il_pci_resume);
-+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- EXPORT_SYMBOL(il_pm_ops);
-+#else
-+EXPORT_SYMBOL(il_pci_suspend_compat);
-+EXPORT_SYMBOL(il_pci_resume_compat);
-+#endif
-
- #endif /* CONFIG_PM_SLEEP */
-
---- a/drivers/net/wireless/iwlegacy/common.h
-+++ b/drivers/net/wireless/iwlegacy/common.h
-@@ -1833,7 +1833,14 @@ __le32 il_add_beacon_time(struct il_priv
- u32 beacon_interval);
-
- #ifdef CONFIG_PM
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
-+int il_pci_suspend_compat(struct pci_dev *pdev, pm_message_t state);
-+int il_pci_resume_compat(struct pci_dev *pdev);
-+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32))
-+extern struct dev_pm_ops il_pm_ops;
-+#else
- extern const struct dev_pm_ops il_pm_ops;
-+#endif
-
- #define IL_LEGACY_PM_OPS (&il_pm_ops)
-
---- a/drivers/net/wireless/iwlwifi/pcie/drv.c
-+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
-@@ -347,6 +347,9 @@ static int iwl_pci_resume(struct device
- return iwl_trans_resume(iwl_trans);
- }
-
-+compat_pci_suspend(iwl_pci_suspend)
-+compat_pci_resume(iwl_pci_resume)
-+
- static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume);
-
- #define IWL_PM_OPS (&iwl_dev_pm_ops)
-@@ -362,7 +365,12 @@ static struct pci_driver iwl_pci_driver
- .id_table = iwl_hw_card_ids,
- .probe = iwl_pci_probe,
- .remove = iwl_pci_remove,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = IWL_PM_OPS,
-+#elif defined(CONFIG_PM_SLEEP)
-+ .suspend = iwl_pci_suspend_compat,
-+ .resume = iwl_pci_resume_compat,
-+#endif
- };
-
- int __must_check iwl_pci_register_driver(void)
---- a/drivers/net/wireless/libertas/if_spi.c
-+++ b/drivers/net/wireless/libertas/if_spi.c
-@@ -1249,6 +1249,7 @@ static int libertas_spi_remove(struct sp
- return 0;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- static int if_spi_suspend(struct device *dev)
- {
- struct spi_device *spi = to_spi_device(dev);
-@@ -1282,6 +1283,7 @@ static const struct dev_pm_ops if_spi_pm
- .suspend = if_spi_suspend,
- .resume = if_spi_resume,
- };
-+#endif
-
- static struct spi_driver libertas_spi_driver = {
- .probe = if_spi_probe,
-@@ -1289,7 +1291,9 @@ static struct spi_driver libertas_spi_dr
- .driver = {
- .name = "libertas_spi",
- .owner = THIS_MODULE,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .pm = &if_spi_pm_ops,
-+#endif
- },
- };
-
---- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
-+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
-@@ -372,6 +372,9 @@ MODULE_PARM_DESC(swlps, "Set to 1 to use
- MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
- MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
-
-+compat_pci_suspend(rtl_pci_suspend);
-+compat_pci_resume(rtl_pci_resume);
-+
- static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
-
- static struct pci_driver rtl92ce_driver = {
-@@ -379,7 +382,12 @@ static struct pci_driver rtl92ce_driver
- .id_table = rtl92ce_pci_ids,
- .probe = rtl_pci_probe,
- .remove = rtl_pci_disconnect,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = &rtlwifi_pm_ops,
-+#elif defined(CONFIG_PM_SLEEP)
-+ .suspend = rtl_pci_suspend_compat,
-+ .resume = rtl_pci_resume_compat,
-+#endif
- };
-
- module_pci_driver(rtl92ce_driver);
---- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
-+++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
-@@ -378,6 +378,9 @@ MODULE_PARM_DESC(swlps, "Set to 1 to use
- MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
- MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
-
-+compat_pci_suspend(rtl_pci_suspend);
-+compat_pci_resume(rtl_pci_resume);
-+
- static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
-
- static struct pci_driver rtl92de_driver = {
-@@ -385,7 +388,12 @@ static struct pci_driver rtl92de_driver
- .id_table = rtl92de_pci_ids,
- .probe = rtl_pci_probe,
- .remove = rtl_pci_disconnect,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = &rtlwifi_pm_ops,
-+#elif defined(CONFIG_PM_SLEEP)
-+ .suspend = rtl_pci_suspend_compat,
-+ .resume = rtl_pci_resume_compat,
-+#endif
- };
-
- /* add global spin lock to solve the problem that
---- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
-+++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
-@@ -429,6 +429,9 @@ MODULE_PARM_DESC(swlps, "Set to 1 to use
- MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
- MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
-
-+compat_pci_suspend(rtl_pci_suspend);
-+compat_pci_resume(rtl_pci_resume);
-+
- static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
-
- static struct pci_driver rtl92se_driver = {
-@@ -436,7 +439,12 @@ static struct pci_driver rtl92se_driver
- .id_table = rtl92se_pci_ids,
- .probe = rtl_pci_probe,
- .remove = rtl_pci_disconnect,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = &rtlwifi_pm_ops,
-+#elif defined(CONFIG_PM_SLEEP)
-+ .suspend = rtl_pci_suspend_compat,
-+ .resume = rtl_pci_resume_compat,
-+#endif
- };
-
- module_pci_driver(rtl92se_driver);
---- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
-+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
-@@ -367,6 +367,9 @@ MODULE_PARM_DESC(swlps, "Set to 1 to use
- MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
- MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
-
-+compat_pci_suspend(rtl_pci_suspend);
-+compat_pci_resume(rtl_pci_resume);
-+
- static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
-
- static struct pci_driver rtl8723ae_driver = {
-@@ -374,7 +377,12 @@ static struct pci_driver rtl8723ae_drive
- .id_table = rtl8723ae_pci_ids,
- .probe = rtl_pci_probe,
- .remove = rtl_pci_disconnect,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = &rtlwifi_pm_ops,
-+#elif defined(CONFIG_PM_SLEEP)
-+ .suspend = rtl_pci_suspend_compat,
-+ .resume = rtl_pci_resume_compat,
-+#endif
- };
-
- module_pci_driver(rtl8723ae_driver);
---- a/drivers/net/wireless/p54/p54pci.c
-+++ b/drivers/net/wireless/p54/p54pci.c
-@@ -684,6 +684,9 @@ static int p54p_resume(struct device *de
- return pci_set_power_state(pdev, PCI_D0);
- }
-
-+compat_pci_suspend(p54p_suspend);
-+compat_pci_resume(p54p_resume);
-+
- static SIMPLE_DEV_PM_OPS(p54pci_pm_ops, p54p_suspend, p54p_resume);
-
- #define P54P_PM_OPS (&p54pci_pm_ops)
-@@ -696,7 +699,12 @@ static struct pci_driver p54p_driver = {
- .id_table = p54p_table,
- .probe = p54p_probe,
- .remove = p54p_remove,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
- .driver.pm = P54P_PM_OPS,
-+#elif defined(CONFIG_PM_SLEEP)
-+ .suspend = p54p_suspend_compat,
-+ .resume = p54p_resume_compat,
-+#endif
- };
-
- module_pci_driver(p54p_driver);
--- /dev/null
+The 2.6.29 kernel has new struct dev_pm_ops [1] which are used
+on the pci device to distinguish power management hooks for suspend
+to RAM and hibernation. Older kernels don't have these so we need
+to resort back to the good ol' suspend/resume. Fortunately the calls
+are not so different so it should be possible to resuse the same
+calls on compat code with only slight modifications.
+
+[1] http://lxr.linux.no/#linux+v2.6.29/include/linux/pm.h#L170
+
--- /dev/null
+--- a/drivers/bcma/host_pci.c
++++ b/drivers/bcma/host_pci.c
+@@ -257,6 +257,9 @@
+ return bcma_bus_resume(bus);
+ }
+
++compat_pci_suspend(bcma_host_pci_suspend)
++compat_pci_resume(bcma_host_pci_resume)
++
+ static SIMPLE_DEV_PM_OPS(bcma_pm_ops, bcma_host_pci_suspend,
+ bcma_host_pci_resume);
+ #define BCMA_PM_OPS (&bcma_pm_ops)
+@@ -285,7 +288,12 @@
+ .id_table = bcma_pci_bridge_tbl,
+ .probe = bcma_host_pci_probe,
+ .remove = bcma_host_pci_remove,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = BCMA_PM_OPS,
++#elif defined(CONFIG_PM_SLEEP)
++ .suspend = bcma_host_pci_suspend_compat,
++ .resume = bcma_host_pci_resume_compat,
++#endif
+ };
+
+ int __init bcma_host_pci_init(void)
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
++++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+@@ -2743,6 +2743,9 @@
+ .resume = atl1c_io_resume,
+ };
+
++compat_pci_suspend(atl1c_suspend)
++compat_pci_resume(atl1c_resume)
++
+ static SIMPLE_DEV_PM_OPS(atl1c_pm_ops, atl1c_suspend, atl1c_resume);
+
+ static struct pci_driver atl1c_driver = {
+@@ -2752,7 +2755,12 @@
+ .remove = atl1c_remove,
+ .shutdown = atl1c_shutdown,
+ .err_handler = &atl1c_err_handler,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = &atl1c_pm_ops,
++#elif defined(CONFIG_PM_SLEEP)
++ .suspend = atl1c_suspend_compat,
++ .resume = atl1c_resume_compat,
++#endif
+ };
+
+ /**
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atlx/atl1.c
++++ b/drivers/net/ethernet/atheros/atlx/atl1.c
+@@ -2877,6 +2877,9 @@
+ return 0;
+ }
+
++compat_pci_suspend(atl1_suspend)
++compat_pci_resume(atl1_resume)
++
+ static SIMPLE_DEV_PM_OPS(atl1_pm_ops, atl1_suspend, atl1_resume);
+ #define ATL1_PM_OPS (&atl1_pm_ops)
+
+@@ -3147,7 +3150,12 @@
+ .probe = atl1_probe,
+ .remove = atl1_remove,
+ .shutdown = atl1_shutdown,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = ATL1_PM_OPS,
++#elif defined(CONFIG_PM_SLEEP)
++ .suspend = atl1_suspend_compat,
++ .resume = atl1_resume_compat,
++#endif
+ };
+
+ /**
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/pci.c
++++ b/drivers/net/wireless/ath/ath5k/pci.c
+@@ -326,6 +326,9 @@
+ return 0;
+ }
+
++compat_pci_suspend(ath5k_pci_suspend)
++compat_pci_resume(ath5k_pci_resume)
++
+ static SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume);
+ #define ATH5K_PM_OPS (&ath5k_pm_ops)
+ #else
+@@ -337,7 +340,12 @@
+ .id_table = ath5k_pci_id_table,
+ .probe = ath5k_pci_probe,
+ .remove = ath5k_pci_remove,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = ATH5K_PM_OPS,
++#elif defined(CONFIG_PM_SLEEP)
++ .suspend = ath5k_pci_suspend_compat,
++ .resume = ath5k_pci_resume_compat,
++#endif
+ };
+
+ module_pci_driver(ath5k_pci_driver);
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/pci.c
++++ b/drivers/net/wireless/ath/ath9k/pci.c
+@@ -310,6 +310,9 @@
+ return 0;
+ }
+
++compat_pci_suspend(ath_pci_suspend);
++compat_pci_resume(ath_pci_resume);
++
+ static SIMPLE_DEV_PM_OPS(ath9k_pm_ops, ath_pci_suspend, ath_pci_resume);
+
+ #define ATH9K_PM_OPS (&ath9k_pm_ops)
+@@ -328,7 +331,12 @@
+ .id_table = ath_pci_id_table,
+ .probe = ath_pci_probe,
+ .remove = ath_pci_remove,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = ATH9K_PM_OPS,
++#elif defined(CONFIG_PM_SLEEP)
++ .suspend = ath_pci_suspend_compat,
++ .resume = ath_pci_resume_compat,
++#endif
+ };
+
+ int ath_pci_init(void)
--- /dev/null
+--- a/drivers/net/wireless/iwlegacy/3945-mac.c
++++ b/drivers/net/wireless/iwlegacy/3945-mac.c
+@@ -3909,7 +3909,12 @@
+ .id_table = il3945_hw_card_ids,
+ .probe = il3945_pci_probe,
+ .remove = il3945_pci_remove,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = IL_LEGACY_PM_OPS,
++#elif defined(CONFIG_PM)
++ .suspend = il_pci_suspend_compat,
++ .resume = il_pci_resume_compat,
++#endif
+ };
+
+ static int __init
--- /dev/null
+--- a/drivers/net/wireless/iwlegacy/4965-mac.c
++++ b/drivers/net/wireless/iwlegacy/4965-mac.c
+@@ -6803,7 +6803,12 @@
+ .id_table = il4965_hw_card_ids,
+ .probe = il4965_pci_probe,
+ .remove = il4965_pci_remove,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = IL_LEGACY_PM_OPS,
++#elif defined(CONFIG_PM)
++ .suspend = il_pci_suspend_compat,
++ .resume = il_pci_resume_compat,
++#endif
+ };
+
+ static int __init
--- /dev/null
+--- a/drivers/net/wireless/iwlegacy/common.c
++++ b/drivers/net/wireless/iwlegacy/common.c
+@@ -4935,8 +4935,17 @@
+ return 0;
+ }
+
++compat_pci_suspend(il_pci_suspend)
++compat_pci_resume(il_pci_resume)
++
+ SIMPLE_DEV_PM_OPS(il_pm_ops, il_pci_suspend, il_pci_resume);
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ EXPORT_SYMBOL(il_pm_ops);
++#else
++EXPORT_SYMBOL(il_pci_suspend_compat);
++EXPORT_SYMBOL(il_pci_resume_compat);
++#endif
+
+ #endif /* CONFIG_PM_SLEEP */
+
--- /dev/null
+--- a/drivers/net/wireless/iwlegacy/common.h
++++ b/drivers/net/wireless/iwlegacy/common.h
+@@ -1833,7 +1833,14 @@
+ u32 beacon_interval);
+
+ #ifdef CONFIG_PM
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
++int il_pci_suspend_compat(struct pci_dev *pdev, pm_message_t state);
++int il_pci_resume_compat(struct pci_dev *pdev);
++#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32))
++extern struct dev_pm_ops il_pm_ops;
++#else
+ extern const struct dev_pm_ops il_pm_ops;
++#endif
+
+ #define IL_LEGACY_PM_OPS (&il_pm_ops)
+
--- /dev/null
+--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
++++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
+@@ -347,6 +347,9 @@
+ return iwl_trans_resume(iwl_trans);
+ }
+
++compat_pci_suspend(iwl_pci_suspend)
++compat_pci_resume(iwl_pci_resume)
++
+ static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume);
+
+ #define IWL_PM_OPS (&iwl_dev_pm_ops)
+@@ -362,7 +365,12 @@
+ .id_table = iwl_hw_card_ids,
+ .probe = iwl_pci_probe,
+ .remove = iwl_pci_remove,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = IWL_PM_OPS,
++#elif defined(CONFIG_PM_SLEEP)
++ .suspend = iwl_pci_suspend_compat,
++ .resume = iwl_pci_resume_compat,
++#endif
+ };
+
+ int __must_check iwl_pci_register_driver(void)
--- /dev/null
+--- a/drivers/net/wireless/libertas/if_spi.c
++++ b/drivers/net/wireless/libertas/if_spi.c
+@@ -1249,6 +1249,7 @@
+ return 0;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ static int if_spi_suspend(struct device *dev)
+ {
+ struct spi_device *spi = to_spi_device(dev);
+@@ -1282,6 +1283,7 @@
+ .suspend = if_spi_suspend,
+ .resume = if_spi_resume,
+ };
++#endif
+
+ static struct spi_driver libertas_spi_driver = {
+ .probe = if_spi_probe,
+@@ -1289,7 +1291,9 @@
+ .driver = {
+ .name = "libertas_spi",
+ .owner = THIS_MODULE,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .pm = &if_spi_pm_ops,
++#endif
+ },
+ };
+
--- /dev/null
+--- a/drivers/net/wireless/p54/p54pci.c
++++ b/drivers/net/wireless/p54/p54pci.c
+@@ -684,6 +684,9 @@
+ return pci_set_power_state(pdev, PCI_D0);
+ }
+
++compat_pci_suspend(p54p_suspend);
++compat_pci_resume(p54p_resume);
++
+ static SIMPLE_DEV_PM_OPS(p54pci_pm_ops, p54p_suspend, p54p_resume);
+
+ #define P54P_PM_OPS (&p54pci_pm_ops)
+@@ -696,7 +699,12 @@
+ .id_table = p54p_table,
+ .probe = p54p_probe,
+ .remove = p54p_remove,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = P54P_PM_OPS,
++#elif defined(CONFIG_PM_SLEEP)
++ .suspend = p54p_suspend_compat,
++ .resume = p54p_resume_compat,
++#endif
+ };
+
+ module_pci_driver(p54p_driver);
--- /dev/null
+--- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
++++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
+@@ -372,6 +372,9 @@
+ MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
+ MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
+
++compat_pci_suspend(rtl_pci_suspend);
++compat_pci_resume(rtl_pci_resume);
++
+ static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
+
+ static struct pci_driver rtl92ce_driver = {
+@@ -379,7 +382,12 @@
+ .id_table = rtl92ce_pci_ids,
+ .probe = rtl_pci_probe,
+ .remove = rtl_pci_disconnect,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = &rtlwifi_pm_ops,
++#elif defined(CONFIG_PM_SLEEP)
++ .suspend = rtl_pci_suspend_compat,
++ .resume = rtl_pci_resume_compat,
++#endif
+ };
+
+ module_pci_driver(rtl92ce_driver);
--- /dev/null
+--- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
++++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
+@@ -378,6 +378,9 @@
+ MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
+ MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
+
++compat_pci_suspend(rtl_pci_suspend);
++compat_pci_resume(rtl_pci_resume);
++
+ static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
+
+ static struct pci_driver rtl92de_driver = {
+@@ -385,7 +388,12 @@
+ .id_table = rtl92de_pci_ids,
+ .probe = rtl_pci_probe,
+ .remove = rtl_pci_disconnect,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = &rtlwifi_pm_ops,
++#elif defined(CONFIG_PM_SLEEP)
++ .suspend = rtl_pci_suspend_compat,
++ .resume = rtl_pci_resume_compat,
++#endif
+ };
+
+ /* add global spin lock to solve the problem that
--- /dev/null
+--- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
++++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
+@@ -429,6 +429,9 @@
+ MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
+ MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
+
++compat_pci_suspend(rtl_pci_suspend);
++compat_pci_resume(rtl_pci_resume);
++
+ static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
+
+ static struct pci_driver rtl92se_driver = {
+@@ -436,7 +439,12 @@
+ .id_table = rtl92se_pci_ids,
+ .probe = rtl_pci_probe,
+ .remove = rtl_pci_disconnect,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = &rtlwifi_pm_ops,
++#elif defined(CONFIG_PM_SLEEP)
++ .suspend = rtl_pci_suspend_compat,
++ .resume = rtl_pci_resume_compat,
++#endif
+ };
+
+ module_pci_driver(rtl92se_driver);
--- /dev/null
+--- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
++++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
+@@ -367,6 +367,9 @@
+ MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
+ MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
+
++compat_pci_suspend(rtl_pci_suspend);
++compat_pci_resume(rtl_pci_resume);
++
+ static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
+
+ static struct pci_driver rtl8723ae_driver = {
+@@ -374,7 +377,12 @@
+ .id_table = rtl8723ae_pci_ids,
+ .probe = rtl_pci_probe,
+ .remove = rtl_pci_disconnect,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
+ .driver.pm = &rtlwifi_pm_ops,
++#elif defined(CONFIG_PM_SLEEP)
++ .suspend = rtl_pci_suspend_compat,
++ .resume = rtl_pci_resume_compat,
++#endif
+ };
+
+ module_pci_driver(rtl8723ae_driver);
+++ /dev/null
---- a/drivers/net/wireless/ipw2x00/ipw2100.c
-+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
-@@ -6089,7 +6089,11 @@ static struct net_device *ipw2100_alloc_
- netdev_attach_ops(dev, &ipw2100_netdev_ops);
- dev->ethtool_ops = &ipw2100_ethtool_ops;
- dev->wireless_handlers = &ipw2100_wx_handler_def;
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
- priv->wireless_data.libipw = priv->ieee;
-+#else
-+ priv->wireless_data.ieee80211 = (struct ieee80211_device *) priv->ieee;
-+#endif
- dev->wireless_data = &priv->wireless_data;
- dev->watchdog_timeo = 3 * HZ;
- dev->irq = 0;
--- /dev/null
+--- a/drivers/net/wireless/ipw2x00/ipw2100.c
++++ b/drivers/net/wireless/ipw2x00/ipw2100.c
+@@ -6089,7 +6089,11 @@
+ netdev_attach_ops(dev, &ipw2100_netdev_ops);
+ dev->ethtool_ops = &ipw2100_ethtool_ops;
+ dev->wireless_handlers = &ipw2100_wx_handler_def;
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ priv->wireless_data.libipw = priv->ieee;
++#else
++ priv->wireless_data.ieee80211 = (struct ieee80211_device *) priv->ieee;
++#endif
+ dev->wireless_data = &priv->wireless_data;
+ dev->watchdog_timeo = 3 * HZ;
+ dev->irq = 0;
+++ /dev/null
-We can't possibly backport the wifi TX status since
-skb_shinfo()->tx_flags used to be a union and there
-is no way to make the & work properly in that case.
-So we need to just ifdef this part out.
-
-
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -2035,6 +2035,7 @@ netdev_tx_t ieee80211_subif_start_xmit(s
- goto fail_rcu;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
- if (unlikely(!multicast && skb->sk &&
- skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) {
- struct sk_buff *orig_skb = skb;
-@@ -2063,6 +2064,7 @@ netdev_tx_t ieee80211_subif_start_xmit(s
- skb = orig_skb;
- }
- }
-+#endif
-
- /*
- * If the skb is shared we need to obtain our own copy.
--- /dev/null
+We can't possibly backport the wifi TX status since
+skb_shinfo()->tx_flags used to be a union and there
+is no way to make the & work properly in that case.
+So we need to just ifdef this part out.
+
+
--- /dev/null
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -2035,6 +2035,7 @@
+ goto fail_rcu;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+ if (unlikely(!multicast && skb->sk &&
+ skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) {
+ struct sk_buff *orig_skb = skb;
+@@ -2063,6 +2064,7 @@
+ skb = orig_skb;
+ }
+ }
++#endif
+
+ /*
+ * If the skb is shared we need to obtain our own copy.
+++ /dev/null
-Kernels >= 2.6.32 can identify the type of device netdevice
-so that sysfs can be used to get this. We never really had a
-systematic way of doing this -- now we do through the
-SET_NETDEV_DEVTYPE() macro. For older kernels we make the
-SET_NETDEV_DEVTYPE() be a no-op this means the wireless type
-we define is unused so we ucomment it simply to avoid a
-compile warning.
-
---- a/net/wireless/core.c
-+++ b/net/wireless/core.c
-@@ -839,9 +839,11 @@ void cfg80211_unregister_wdev(struct wir
- }
- EXPORT_SYMBOL(cfg80211_unregister_wdev);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
- static struct device_type wiphy_type = {
- .name = "wlan",
- };
-+#endif
-
- void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
- enum nl80211_iftype iftype, int num)
---- a/net/bluetooth/bnep/core.c
-+++ b/net/bluetooth/bnep/core.c
-@@ -526,9 +526,11 @@ static struct device *bnep_get_device(st
- return conn ? &conn->dev : NULL;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
- static struct device_type bnep_type = {
- .name = "bluetooth",
- };
-+#endif
-
- int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
- {
---- a/drivers/net/usb/usbnet.c
-+++ b/drivers/net/usb/usbnet.c
-@@ -1363,13 +1363,17 @@ static const struct net_device_ops usbne
-
- // precondition: never called in_interrupt
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
- static struct device_type wlan_type = {
- .name = "wlan",
- };
-+#endif
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
- static struct device_type wwan_type = {
- .name = "wwan",
- };
-+#endif
-
- int
- usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
--- /dev/null
+Kernels >= 2.6.32 can identify the type of device netdevice
+so that sysfs can be used to get this. We never really had a
+systematic way of doing this -- now we do through the
+SET_NETDEV_DEVTYPE() macro. For older kernels we make the
+SET_NETDEV_DEVTYPE() be a no-op this means the wireless type
+we define is unused so we ucomment it simply to avoid a
+compile warning.
+
--- /dev/null
+--- a/drivers/net/usb/usbnet.c
++++ b/drivers/net/usb/usbnet.c
+@@ -1363,13 +1363,17 @@
+
+ // precondition: never called in_interrupt
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+ static struct device_type wlan_type = {
+ .name = "wlan",
+ };
++#endif
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+ static struct device_type wwan_type = {
+ .name = "wwan",
+ };
++#endif
+
+ int
+ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
--- /dev/null
+--- a/net/bluetooth/bnep/core.c
++++ b/net/bluetooth/bnep/core.c
+@@ -526,9 +526,11 @@
+ return conn ? &conn->dev : NULL;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+ static struct device_type bnep_type = {
+ .name = "bluetooth",
+ };
++#endif
+
+ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
+ {
--- /dev/null
+--- a/net/wireless/core.c
++++ b/net/wireless/core.c
+@@ -839,9 +839,11 @@
+ }
+ EXPORT_SYMBOL(cfg80211_unregister_wdev);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+ static struct device_type wiphy_type = {
+ .name = "wlan",
+ };
++#endif
+
+ void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
+ enum nl80211_iftype iftype, int num)
+++ /dev/null
-In kernel < 2.6.32 libipw also exports ieee80211_rx.
-To avoid conflicts with the other export we rename our.
-
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -3317,7 +3317,12 @@ void ieee80211_rx(struct ieee80211_hw *h
- drop:
- kfree_skb(skb);
- }
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
- EXPORT_SYMBOL(ieee80211_rx);
-+#else
-+EXPORT_SYMBOL(mac80211_ieee80211_rx);
-+#endif
-+
-
- /* This is a version of the rx handler that can be called from hard irq
- * context. Post the skb on the queue and schedule the tasklet */
--- /dev/null
+In kernel < 2.6.32 libipw also exports ieee80211_rx.
+To avoid conflicts with the other export we rename our.
+
--- /dev/null
+--- a/net/mac80211/rx.c
++++ b/net/mac80211/rx.c
+@@ -3317,7 +3317,12 @@
+ drop:
+ kfree_skb(skb);
+ }
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+ EXPORT_SYMBOL(ieee80211_rx);
++#else
++EXPORT_SYMBOL(mac80211_ieee80211_rx);
++#endif
++
+
+ /* This is a version of the rx handler that can be called from hard irq
+ * context. Post the skb on the queue and schedule the tasklet */
+++ /dev/null
-These changes are required to backport blueooth. A lot can be optimized
-here still, but for now we keep this here.
-
---- a/drivers/bluetooth/hci_ldisc.c
-+++ b/drivers/bluetooth/hci_ldisc.c
-@@ -297,8 +297,13 @@ static int hci_uart_tty_open(struct tty_
- /* FIXME: why is this needed. Note don't use ldisc_ref here as the
- open path is before the ldisc is referencable */
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30))
- if (tty->ldisc->ops->flush_buffer)
- tty->ldisc->ops->flush_buffer(tty);
-+#else
-+ if (tty->ldisc.ops->flush_buffer)
-+ tty->ldisc.ops->flush_buffer(tty);
-+#endif
- tty_driver_flush_buffer(tty);
-
- return 0;
-@@ -524,7 +529,11 @@ static int hci_uart_tty_ioctl(struct tty
- return hu->hdev_flags;
-
- default:
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
- err = n_tty_ioctl_helper(tty, file, cmd, arg);
-+#else
-+ err = n_tty_ioctl(tty, file, cmd, arg);
-+#endif
- break;
- }
-
---- a/net/bluetooth/af_bluetooth.c
-+++ b/net/bluetooth/af_bluetooth.c
-@@ -103,8 +103,12 @@ void bt_sock_unregister(int proto)
- }
- EXPORT_SYMBOL(bt_sock_unregister);
-
-+#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
- static int bt_sock_create(struct net *net, struct socket *sock, int proto,
- int kern)
-+#else
-+static int bt_sock_create(struct net *net, struct socket *sock, int proto)
-+#endif
- {
- int err;
-
-@@ -122,7 +126,11 @@ static int bt_sock_create(struct net *ne
- read_lock(&bt_proto_lock);
-
- if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) {
-+#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
- err = bt_proto[proto]->create(net, sock, proto, kern);
-+#else
-+ err = bt_proto[proto]->create(net, sock, proto);
-+#endif
- if (!err)
- bt_sock_reclassify_lock(sock->sk, proto);
- module_put(bt_proto[proto]->owner);
-@@ -455,7 +463,11 @@ int bt_sock_ioctl(struct socket *sock, u
- if (sk->sk_state == BT_LISTEN)
- return -EINVAL;
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
- amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk);
-+#else
-+ amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
-+#endif
- if (amount < 0)
- amount = 0;
- err = put_user(amount, (int __user *) arg);
---- a/net/bluetooth/cmtp/capi.c
-+++ b/net/bluetooth/cmtp/capi.c
-@@ -384,7 +384,11 @@ static void cmtp_reset_ctr(struct capi_c
-
- BT_DBG("ctrl %p", ctrl);
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30))
- capi_ctr_down(ctrl);
-+#else
-+ capi_ctr_reseted(ctrl);
-+#endif
-
- atomic_inc(&session->terminate);
- wake_up_process(session->task);
---- a/net/bluetooth/hci_sock.c
-+++ b/net/bluetooth/hci_sock.c
-@@ -884,8 +884,13 @@ drop:
- goto done;
- }
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
- static int hci_sock_setsockopt(struct socket *sock, int level, int optname,
- char __user *optval, unsigned int len)
-+#else
-+static int hci_sock_setsockopt(struct socket *sock, int level, int optname,
-+ char __user *optval, int len)
-+#endif
- {
- struct hci_ufilter uf = { .opcode = 0 };
- struct sock *sk = sock->sk;
-@@ -1059,8 +1064,12 @@ static struct proto hci_sk_proto = {
- .obj_size = sizeof(struct hci_pinfo)
- };
-
-+#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
- static int hci_sock_create(struct net *net, struct socket *sock, int protocol,
- int kern)
-+#else
-+static int hci_sock_create(struct net *net, struct socket *sock, int protocol)
-+#endif
- {
- struct sock *sk;
-
---- a/net/bluetooth/hci_sysfs.c
-+++ b/net/bluetooth/hci_sysfs.c
-@@ -72,7 +72,11 @@ static struct attribute_group bt_link_gr
- .attrs = bt_link_attrs,
- };
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
- static const struct attribute_group *bt_link_groups[] = {
-+#else
-+static struct attribute_group *bt_link_groups[] = {
-+#endif
- &bt_link_group,
- NULL
- };
-@@ -141,7 +145,11 @@ void hci_conn_del_sysfs(struct hci_conn
- dev = device_find_child(&conn->dev, NULL, __match_tty);
- if (!dev)
- break;
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
- device_move(dev, NULL, DPM_ORDER_DEV_LAST);
-+#else
-+ device_move(dev, NULL);
-+#endif
- put_device(dev);
- }
-
-@@ -379,7 +387,11 @@ static struct attribute_group bt_host_gr
- .attrs = bt_host_attrs,
- };
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
- static const struct attribute_group *bt_host_groups[] = {
-+#else
-+static struct attribute_group *bt_host_groups[] = {
-+#endif
- &bt_host_group,
- NULL
- };
---- a/net/bluetooth/hidp/core.c
-+++ b/net/bluetooth/hidp/core.c
-@@ -383,6 +383,7 @@ err:
- return ret;
- }
-
-+#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
- static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count,
- unsigned char report_type)
- {
-@@ -441,6 +442,16 @@ err:
- mutex_unlock(&session->report_mutex);
- return ret;
- }
-+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
-+static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count)
-+{
-+ if (hidp_send_ctrl_message(hid->driver_data,
-+ HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE,
-+ data, count))
-+ return -ENOMEM;
-+ return count;
-+}
-+#endif
-
- static void hidp_idle_timeout(unsigned long arg)
- {
-@@ -743,8 +754,14 @@ static int hidp_session(void *arg)
- }
-
- if (session->hid) {
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
- hid_destroy_device(session->hid);
- session->hid = NULL;
-+#else
-+ if (session->hid->claimed & HID_CLAIMED_INPUT)
-+ hidinput_disconnect(session->hid);
-+ hid_free_device(session->hid);
-+#endif
- }
-
- /* Wakeup user-space polling for socket errors */
-@@ -855,6 +872,70 @@ static void hidp_close(struct hid_device
- {
- }
-
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27))
-+static const struct {
-+ __u16 idVendor;
-+ __u16 idProduct;
-+ unsigned quirks;
-+} hidp_blacklist[] = {
-+ /* Apple wireless Mighty Mouse */
-+ { 0x05ac, 0x030c, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL },
-+
-+ { } /* Terminating entry */
-+};
-+static void hidp_setup_quirks(struct hid_device *hid)
-+{
-+ unsigned int n;
-+
-+ for (n = 0; hidp_blacklist[n].idVendor; n++)
-+ if (hidp_blacklist[n].idVendor == le16_to_cpu(hid->vendor) &&
-+ hidp_blacklist[n].idProduct == le16_to_cpu(hid->product))
-+ hid->quirks = hidp_blacklist[n].quirks;
-+}
-+
-+static void hidp_setup_hid(struct hidp_session *session,
-+ struct hidp_connadd_req *req)
-+{
-+ struct hid_device *hid = session->hid;
-+ struct hid_report *report;
-+ bdaddr_t src, dst;
-+
-+ session->hid = hid;
-+
-+ hid->driver_data = session;
-+
-+ baswap(&src, &bt_sk(session->ctrl_sock->sk)->src);
-+ baswap(&dst, &bt_sk(session->ctrl_sock->sk)->dst);
-+
-+ hid->bus = BUS_BLUETOOTH;
-+ hid->vendor = req->vendor;
-+ hid->product = req->product;
-+ hid->version = req->version;
-+ hid->country = req->country;
-+
-+ strncpy(hid->name, req->name, 128);
-+ strncpy(hid->phys, batostr(&src), 64);
-+ strncpy(hid->uniq, batostr(&dst), 64);
-+
-+ hid->dev = hidp_get_device(session);
-+ hid->hid_open = hidp_open;
-+ hid->hid_close = hidp_close;
-+
-+ hid->hidinput_input_event = hidp_hidinput_event;
-+
-+ hidp_setup_quirks(hid);
-+
-+ list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list)
-+ hidp_send_report(session, report);
-+
-+ list_for_each_entry(report, &hid->report_enum[HID_FEATURE_REPORT].report_list, list)
-+ hidp_send_report(session, report);
-+
-+ if (hidinput_connect(hid) == 0)
-+ hid->claimed |= HID_CLAIMED_INPUT;
-+}
-+#else
-+
- static int hidp_parse(struct hid_device *hid)
- {
- struct hidp_session *session = hid->driver_data;
-@@ -946,7 +1027,9 @@ static int hidp_setup_hid(struct hidp_se
- hid->dev.parent = &session->conn->dev;
- hid->ll_driver = &hidp_hid_driver;
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
- hid->hid_get_raw_report = hidp_get_raw_report;
-+#endif
- hid->hid_output_raw_report = hidp_output_raw_report;
-
- /* True if device is blacklisted in drivers/hid/hid-core.c */
-@@ -964,6 +1047,7 @@ fault:
-
- return err;
- }
-+#endif
-
- int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock)
- {
-@@ -979,6 +1063,39 @@ int hidp_add_connection(struct hidp_conn
-
- BT_DBG("rd_data %p rd_size %d", req->rd_data, req->rd_size);
-
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27))
-+ if (req->rd_size > 0) {
-+ unsigned char *buf = kmalloc(req->rd_size, GFP_KERNEL);
-+
-+ if (!buf) {
-+ kfree(session);
-+ return -ENOMEM;
-+ }
-+
-+ if (copy_from_user(buf, req->rd_data, req->rd_size)) {
-+ kfree(buf);
-+ kfree(session);
-+ return -EFAULT;
-+ }
-+
-+ session->hid = hid_parse_report(buf, req->rd_size);
-+
-+ kfree(buf);
-+
-+ if (!session->hid) {
-+ kfree(session);
-+ return -EINVAL;
-+ }
-+ }
-+
-+ if (!session->hid) {
-+ session->input = input_allocate_device();
-+ if (!session->input) {
-+ kfree(session);
-+ return -ENOMEM;
-+ }
-+ }
-+#endif
- down_write(&hidp_session_sem);
-
- s = __hidp_get_session(&bt_sk(ctrl_sock->sk)->dst);
-@@ -1026,6 +1143,7 @@ int hidp_add_connection(struct hidp_conn
-
- __hidp_link_session(session);
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
- if (req->rd_size > 0) {
- err = hidp_setup_hid(session, req);
- if (err && err != -ENODEV)
-@@ -1037,6 +1155,16 @@ int hidp_add_connection(struct hidp_conn
- if (err < 0)
- goto purge;
- }
-+#else
-+ if (session->input) {
-+ err = hidp_setup_input(session, req);
-+ if (err < 0)
-+ goto failed;
-+ }
-+
-+ if (session->hid)
-+ hidp_setup_hid(session, req);
-+#endif
-
- hidp_set_timer(session);
-
-@@ -1095,6 +1223,7 @@ unlink:
- session->input = NULL;
- }
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
- if (session->hid) {
- hid_destroy_device(session->hid);
- session->hid = NULL;
-@@ -1108,10 +1237,15 @@ purge:
-
- skb_queue_purge(&session->ctrl_transmit);
- skb_queue_purge(&session->intr_transmit);
-+#endif
-
- failed:
- up_write(&hidp_session_sem);
-
-+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27))
-+ if (session->hid)
-+ hid_free_device(session->hid);
-+#endif
- kfree(session);
- return err;
- }
---- a/net/bluetooth/rfcomm/sock.c
-+++ b/net/bluetooth/rfcomm/sock.c
-@@ -304,8 +304,13 @@ static struct sock *rfcomm_sock_alloc(st
- return sk;
- }
-
-+#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
- static int rfcomm_sock_create(struct net *net, struct socket *sock,
- int protocol, int kern)
-+#else
-+static int rfcomm_sock_create(struct net *net, struct socket *sock,
-+ int protocol)
-+#endif
- {
- struct sock *sk;
-
-@@ -660,7 +665,11 @@ static int rfcomm_sock_setsockopt_old(st
- return err;
- }
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
- static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
-+#else
-+static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
-+#endif
- {
- struct sock *sk = sock->sk;
- struct bt_security sec;
---- a/net/bluetooth/rfcomm/tty.c
-+++ b/net/bluetooth/rfcomm/tty.c
-@@ -708,8 +708,12 @@ static int rfcomm_tty_open(struct tty_st
- remove_wait_queue(&dev->wait, &wait);
-
- if (err == 0)
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
- device_move(dev->tty_dev, rfcomm_get_device(dev),
- DPM_ORDER_DEV_AFTER_PARENT);
-+#else
-+ device_move(dev->tty_dev, rfcomm_get_device(dev));
-+#endif
-
- rfcomm_tty_copy_pending(dev);
-
-@@ -733,7 +737,11 @@ static void rfcomm_tty_close(struct tty_
- if (!--dev->port.count) {
- spin_unlock_irqrestore(&dev->port.lock, flags);
- if (dev->tty_dev->parent)
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
- device_move(dev->tty_dev, NULL, DPM_ORDER_DEV_LAST);
-+#else
-+ device_move(dev->tty_dev, NULL);
-+#endif
-
- /* Close DLC and dettach TTY */
- rfcomm_dlc_close(dev->dlc, 0);
-@@ -809,7 +817,11 @@ static int rfcomm_tty_write_room(struct
- return room;
- }
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
- static int rfcomm_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
-+#else
-+static int rfcomm_tty_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, unsigned long arg)
-+#endif
- {
- BT_DBG("tty %p cmd 0x%02x", tty, cmd);
-
-@@ -1068,7 +1080,11 @@ static void rfcomm_tty_hangup(struct tty
- }
- }
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
- static int rfcomm_tty_tiocmget(struct tty_struct *tty)
-+#else
-+static int rfcomm_tty_tiocmget(struct tty_struct *tty, struct file *filp)
-+#endif
- {
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
-
-@@ -1077,7 +1093,11 @@ static int rfcomm_tty_tiocmget(struct tt
- return dev->modem_status;
- }
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
- static int rfcomm_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear)
-+#else
-+static int rfcomm_tty_tiocmset(struct tty_struct *tty, struct file *filp, unsigned int set, unsigned int clear)
-+#endif
- {
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
- struct rfcomm_dlc *dlc = dev->dlc;
---- a/net/bluetooth/sco.c
-+++ b/net/bluetooth/sco.c
-@@ -423,8 +423,12 @@ static struct sock *sco_sock_alloc(struc
- return sk;
- }
-
-+#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
- static int sco_sock_create(struct net *net, struct socket *sock, int protocol,
- int kern)
-+#else
-+static int sco_sock_create(struct net *net, struct socket *sock, int protocol)
-+#endif
- {
- struct sock *sk;
-
-@@ -675,7 +679,11 @@ static int sco_sock_recvmsg(struct kiocb
- return bt_sock_recvmsg(iocb, sock, msg, len, flags);
- }
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
- static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
-+#else
-+static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
-+#endif
- {
- struct sock *sk = sock->sk;
- int err = 0;
---- a/net/bluetooth/bnep/sock.c
-+++ b/net/bluetooth/bnep/sock.c
-@@ -186,8 +186,12 @@ static struct proto bnep_proto = {
- .obj_size = sizeof(struct bt_sock)
- };
-
-+#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
- static int bnep_sock_create(struct net *net, struct socket *sock, int protocol,
- int kern)
-+#else
-+static int bnep_sock_create(struct net *net, struct socket *sock, int protocol)
-+#endif
- {
- struct sock *sk;
-
---- a/net/bluetooth/cmtp/sock.c
-+++ b/net/bluetooth/cmtp/sock.c
-@@ -195,8 +195,12 @@ static struct proto cmtp_proto = {
- .obj_size = sizeof(struct bt_sock)
- };
-
-+#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
- static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol,
- int kern)
-+#else
-+static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol)
-+#endif
- {
- struct sock *sk;
-
---- a/net/bluetooth/hidp/sock.c
-+++ b/net/bluetooth/hidp/sock.c
-@@ -235,8 +235,12 @@ static struct proto hidp_proto = {
- .obj_size = sizeof(struct bt_sock)
- };
-
-+#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
- static int hidp_sock_create(struct net *net, struct socket *sock, int protocol,
- int kern)
-+#else
-+static int hidp_sock_create(struct net *net, struct socket *sock, int protocol)
-+#endif
- {
- struct sock *sk;
-
---- a/net/bluetooth/l2cap_sock.c
-+++ b/net/bluetooth/l2cap_sock.c
-@@ -573,8 +573,13 @@ static int l2cap_sock_setsockopt_old(str
- return err;
- }
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
- static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
- char __user *optval, unsigned int optlen)
-+#else
-+static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
-+ char __user *optval, int optlen)
-+#endif
- {
- struct sock *sk = sock->sk;
- struct l2cap_chan *chan = l2cap_pi(sk)->chan;
-@@ -1225,8 +1230,12 @@ static struct sock *l2cap_sock_alloc(str
- return sk;
- }
-
-+#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
- static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol,
- int kern)
-+#else
-+static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol)
-+#endif
- {
- struct sock *sk;
-
-@@ -1238,7 +1247,11 @@ static int l2cap_sock_create(struct net
- sock->type != SOCK_DGRAM && sock->type != SOCK_RAW)
- return -ESOCKTNOSUPPORT;
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32))
- if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
-+#else
-+ if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW))
-+#endif
- return -EPERM;
-
- sock->ops = &l2cap_sock_ops;
--- /dev/null
+These changes are required to backport blueooth. A lot can be optimized
+here still, but for now we keep this here.
+
--- /dev/null
+--- a/drivers/bluetooth/hci_ldisc.c
++++ b/drivers/bluetooth/hci_ldisc.c
+@@ -297,8 +297,13 @@
+ /* FIXME: why is this needed. Note don't use ldisc_ref here as the
+ open path is before the ldisc is referencable */
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30))
+ if (tty->ldisc->ops->flush_buffer)
+ tty->ldisc->ops->flush_buffer(tty);
++#else
++ if (tty->ldisc.ops->flush_buffer)
++ tty->ldisc.ops->flush_buffer(tty);
++#endif
+ tty_driver_flush_buffer(tty);
+
+ return 0;
+@@ -524,7 +529,11 @@
+ return hu->hdev_flags;
+
+ default:
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
+ err = n_tty_ioctl_helper(tty, file, cmd, arg);
++#else
++ err = n_tty_ioctl(tty, file, cmd, arg);
++#endif
+ break;
+ }
+
--- /dev/null
+--- a/net/bluetooth/af_bluetooth.c
++++ b/net/bluetooth/af_bluetooth.c
+@@ -103,8 +103,12 @@
+ }
+ EXPORT_SYMBOL(bt_sock_unregister);
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int bt_sock_create(struct net *net, struct socket *sock, int proto,
+ int kern)
++#else
++static int bt_sock_create(struct net *net, struct socket *sock, int proto)
++#endif
+ {
+ int err;
+
+@@ -122,7 +126,11 @@
+ read_lock(&bt_proto_lock);
+
+ if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) {
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ err = bt_proto[proto]->create(net, sock, proto, kern);
++#else
++ err = bt_proto[proto]->create(net, sock, proto);
++#endif
+ if (!err)
+ bt_sock_reclassify_lock(sock->sk, proto);
+ module_put(bt_proto[proto]->owner);
+@@ -455,7 +463,11 @@
+ if (sk->sk_state == BT_LISTEN)
+ return -EINVAL;
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk);
++#else
++ amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
++#endif
+ if (amount < 0)
+ amount = 0;
+ err = put_user(amount, (int __user *) arg);
--- /dev/null
+--- a/net/bluetooth/bnep/sock.c
++++ b/net/bluetooth/bnep/sock.c
+@@ -186,8 +186,12 @@
+ .obj_size = sizeof(struct bt_sock)
+ };
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int bnep_sock_create(struct net *net, struct socket *sock, int protocol,
+ int kern)
++#else
++static int bnep_sock_create(struct net *net, struct socket *sock, int protocol)
++#endif
+ {
+ struct sock *sk;
+
--- /dev/null
+--- a/net/bluetooth/cmtp/capi.c
++++ b/net/bluetooth/cmtp/capi.c
+@@ -384,7 +384,11 @@
+
+ BT_DBG("ctrl %p", ctrl);
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30))
+ capi_ctr_down(ctrl);
++#else
++ capi_ctr_reseted(ctrl);
++#endif
+
+ atomic_inc(&session->terminate);
+ wake_up_process(session->task);
--- /dev/null
+--- a/net/bluetooth/cmtp/sock.c
++++ b/net/bluetooth/cmtp/sock.c
+@@ -195,8 +195,12 @@
+ .obj_size = sizeof(struct bt_sock)
+ };
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol,
+ int kern)
++#else
++static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol)
++#endif
+ {
+ struct sock *sk;
+
--- /dev/null
+--- a/net/bluetooth/hci_sock.c
++++ b/net/bluetooth/hci_sock.c
+@@ -884,8 +884,13 @@
+ goto done;
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static int hci_sock_setsockopt(struct socket *sock, int level, int optname,
+ char __user *optval, unsigned int len)
++#else
++static int hci_sock_setsockopt(struct socket *sock, int level, int optname,
++ char __user *optval, int len)
++#endif
+ {
+ struct hci_ufilter uf = { .opcode = 0 };
+ struct sock *sk = sock->sk;
+@@ -1059,8 +1064,12 @@
+ .obj_size = sizeof(struct hci_pinfo)
+ };
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int hci_sock_create(struct net *net, struct socket *sock, int protocol,
+ int kern)
++#else
++static int hci_sock_create(struct net *net, struct socket *sock, int protocol)
++#endif
+ {
+ struct sock *sk;
+
--- /dev/null
+--- a/net/bluetooth/hci_sysfs.c
++++ b/net/bluetooth/hci_sysfs.c
+@@ -72,7 +72,11 @@
+ .attrs = bt_link_attrs,
+ };
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static const struct attribute_group *bt_link_groups[] = {
++#else
++static struct attribute_group *bt_link_groups[] = {
++#endif
+ &bt_link_group,
+ NULL
+ };
+@@ -141,7 +145,11 @@
+ dev = device_find_child(&conn->dev, NULL, __match_tty);
+ if (!dev)
+ break;
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+ device_move(dev, NULL, DPM_ORDER_DEV_LAST);
++#else
++ device_move(dev, NULL);
++#endif
+ put_device(dev);
+ }
+
+@@ -379,7 +387,11 @@
+ .attrs = bt_host_attrs,
+ };
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static const struct attribute_group *bt_host_groups[] = {
++#else
++static struct attribute_group *bt_host_groups[] = {
++#endif
+ &bt_host_group,
+ NULL
+ };
--- /dev/null
+--- a/net/bluetooth/hidp/core.c
++++ b/net/bluetooth/hidp/core.c
+@@ -383,6 +383,7 @@
+ return ret;
+ }
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count,
+ unsigned char report_type)
+ {
+@@ -441,6 +442,16 @@
+ mutex_unlock(&session->report_mutex);
+ return ret;
+ }
++#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
++static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count)
++{
++ if (hidp_send_ctrl_message(hid->driver_data,
++ HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE,
++ data, count))
++ return -ENOMEM;
++ return count;
++}
++#endif
+
+ static void hidp_idle_timeout(unsigned long arg)
+ {
+@@ -743,8 +754,14 @@
+ }
+
+ if (session->hid) {
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
+ hid_destroy_device(session->hid);
+ session->hid = NULL;
++#else
++ if (session->hid->claimed & HID_CLAIMED_INPUT)
++ hidinput_disconnect(session->hid);
++ hid_free_device(session->hid);
++#endif
+ }
+
+ /* Wakeup user-space polling for socket errors */
+@@ -855,6 +872,70 @@
+ {
+ }
+
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27))
++static const struct {
++ __u16 idVendor;
++ __u16 idProduct;
++ unsigned quirks;
++} hidp_blacklist[] = {
++ /* Apple wireless Mighty Mouse */
++ { 0x05ac, 0x030c, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL },
++
++ { } /* Terminating entry */
++};
++static void hidp_setup_quirks(struct hid_device *hid)
++{
++ unsigned int n;
++
++ for (n = 0; hidp_blacklist[n].idVendor; n++)
++ if (hidp_blacklist[n].idVendor == le16_to_cpu(hid->vendor) &&
++ hidp_blacklist[n].idProduct == le16_to_cpu(hid->product))
++ hid->quirks = hidp_blacklist[n].quirks;
++}
++
++static void hidp_setup_hid(struct hidp_session *session,
++ struct hidp_connadd_req *req)
++{
++ struct hid_device *hid = session->hid;
++ struct hid_report *report;
++ bdaddr_t src, dst;
++
++ session->hid = hid;
++
++ hid->driver_data = session;
++
++ baswap(&src, &bt_sk(session->ctrl_sock->sk)->src);
++ baswap(&dst, &bt_sk(session->ctrl_sock->sk)->dst);
++
++ hid->bus = BUS_BLUETOOTH;
++ hid->vendor = req->vendor;
++ hid->product = req->product;
++ hid->version = req->version;
++ hid->country = req->country;
++
++ strncpy(hid->name, req->name, 128);
++ strncpy(hid->phys, batostr(&src), 64);
++ strncpy(hid->uniq, batostr(&dst), 64);
++
++ hid->dev = hidp_get_device(session);
++ hid->hid_open = hidp_open;
++ hid->hid_close = hidp_close;
++
++ hid->hidinput_input_event = hidp_hidinput_event;
++
++ hidp_setup_quirks(hid);
++
++ list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list)
++ hidp_send_report(session, report);
++
++ list_for_each_entry(report, &hid->report_enum[HID_FEATURE_REPORT].report_list, list)
++ hidp_send_report(session, report);
++
++ if (hidinput_connect(hid) == 0)
++ hid->claimed |= HID_CLAIMED_INPUT;
++}
++#else
++
+ static int hidp_parse(struct hid_device *hid)
+ {
+ struct hidp_session *session = hid->driver_data;
+@@ -946,7 +1027,9 @@
+ hid->dev.parent = &session->conn->dev;
+ hid->ll_driver = &hidp_hid_driver;
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
+ hid->hid_get_raw_report = hidp_get_raw_report;
++#endif
+ hid->hid_output_raw_report = hidp_output_raw_report;
+
+ /* True if device is blacklisted in drivers/hid/hid-core.c */
+@@ -964,6 +1047,7 @@
+
+ return err;
+ }
++#endif
+
+ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock)
+ {
+@@ -979,6 +1063,39 @@
+
+ BT_DBG("rd_data %p rd_size %d", req->rd_data, req->rd_size);
+
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27))
++ if (req->rd_size > 0) {
++ unsigned char *buf = kmalloc(req->rd_size, GFP_KERNEL);
++
++ if (!buf) {
++ kfree(session);
++ return -ENOMEM;
++ }
++
++ if (copy_from_user(buf, req->rd_data, req->rd_size)) {
++ kfree(buf);
++ kfree(session);
++ return -EFAULT;
++ }
++
++ session->hid = hid_parse_report(buf, req->rd_size);
++
++ kfree(buf);
++
++ if (!session->hid) {
++ kfree(session);
++ return -EINVAL;
++ }
++ }
++
++ if (!session->hid) {
++ session->input = input_allocate_device();
++ if (!session->input) {
++ kfree(session);
++ return -ENOMEM;
++ }
++ }
++#endif
+ down_write(&hidp_session_sem);
+
+ s = __hidp_get_session(&bt_sk(ctrl_sock->sk)->dst);
+@@ -1026,6 +1143,7 @@
+
+ __hidp_link_session(session);
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
+ if (req->rd_size > 0) {
+ err = hidp_setup_hid(session, req);
+ if (err && err != -ENODEV)
+@@ -1037,6 +1155,16 @@
+ if (err < 0)
+ goto purge;
+ }
++#else
++ if (session->input) {
++ err = hidp_setup_input(session, req);
++ if (err < 0)
++ goto failed;
++ }
++
++ if (session->hid)
++ hidp_setup_hid(session, req);
++#endif
+
+ hidp_set_timer(session);
+
+@@ -1095,6 +1223,7 @@
+ session->input = NULL;
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
+ if (session->hid) {
+ hid_destroy_device(session->hid);
+ session->hid = NULL;
+@@ -1108,10 +1237,15 @@
+
+ skb_queue_purge(&session->ctrl_transmit);
+ skb_queue_purge(&session->intr_transmit);
++#endif
+
+ failed:
+ up_write(&hidp_session_sem);
+
++#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27))
++ if (session->hid)
++ hid_free_device(session->hid);
++#endif
+ kfree(session);
+ return err;
+ }
--- /dev/null
+--- a/net/bluetooth/hidp/sock.c
++++ b/net/bluetooth/hidp/sock.c
+@@ -235,8 +235,12 @@
+ .obj_size = sizeof(struct bt_sock)
+ };
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int hidp_sock_create(struct net *net, struct socket *sock, int protocol,
+ int kern)
++#else
++static int hidp_sock_create(struct net *net, struct socket *sock, int protocol)
++#endif
+ {
+ struct sock *sk;
+
--- /dev/null
+--- a/net/bluetooth/l2cap_sock.c
++++ b/net/bluetooth/l2cap_sock.c
+@@ -573,8 +573,13 @@
+ return err;
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
+ char __user *optval, unsigned int optlen)
++#else
++static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
++ char __user *optval, int optlen)
++#endif
+ {
+ struct sock *sk = sock->sk;
+ struct l2cap_chan *chan = l2cap_pi(sk)->chan;
+@@ -1225,8 +1230,12 @@
+ return sk;
+ }
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol,
+ int kern)
++#else
++static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol)
++#endif
+ {
+ struct sock *sk;
+
+@@ -1238,7 +1247,11 @@
+ sock->type != SOCK_DGRAM && sock->type != SOCK_RAW)
+ return -ESOCKTNOSUPPORT;
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32))
+ if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
++#else
++ if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW))
++#endif
+ return -EPERM;
+
+ sock->ops = &l2cap_sock_ops;
--- /dev/null
+--- a/net/bluetooth/rfcomm/sock.c
++++ b/net/bluetooth/rfcomm/sock.c
+@@ -304,8 +304,13 @@
+ return sk;
+ }
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int rfcomm_sock_create(struct net *net, struct socket *sock,
+ int protocol, int kern)
++#else
++static int rfcomm_sock_create(struct net *net, struct socket *sock,
++ int protocol)
++#endif
+ {
+ struct sock *sk;
+
+@@ -660,7 +665,11 @@
+ return err;
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
++#else
++static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
++#endif
+ {
+ struct sock *sk = sock->sk;
+ struct bt_security sec;
--- /dev/null
+--- a/net/bluetooth/rfcomm/tty.c
++++ b/net/bluetooth/rfcomm/tty.c
+@@ -708,8 +708,12 @@
+ remove_wait_queue(&dev->wait, &wait);
+
+ if (err == 0)
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+ device_move(dev->tty_dev, rfcomm_get_device(dev),
+ DPM_ORDER_DEV_AFTER_PARENT);
++#else
++ device_move(dev->tty_dev, rfcomm_get_device(dev));
++#endif
+
+ rfcomm_tty_copy_pending(dev);
+
+@@ -733,7 +737,11 @@
+ if (!--dev->port.count) {
+ spin_unlock_irqrestore(&dev->port.lock, flags);
+ if (dev->tty_dev->parent)
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+ device_move(dev->tty_dev, NULL, DPM_ORDER_DEV_LAST);
++#else
++ device_move(dev->tty_dev, NULL);
++#endif
+
+ /* Close DLC and dettach TTY */
+ rfcomm_dlc_close(dev->dlc, 0);
+@@ -809,7 +817,11 @@
+ return room;
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
+ static int rfcomm_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
++#else
++static int rfcomm_tty_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, unsigned long arg)
++#endif
+ {
+ BT_DBG("tty %p cmd 0x%02x", tty, cmd);
+
+@@ -1068,7 +1080,11 @@
+ }
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
+ static int rfcomm_tty_tiocmget(struct tty_struct *tty)
++#else
++static int rfcomm_tty_tiocmget(struct tty_struct *tty, struct file *filp)
++#endif
+ {
+ struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+
+@@ -1077,7 +1093,11 @@
+ return dev->modem_status;
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
+ static int rfcomm_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear)
++#else
++static int rfcomm_tty_tiocmset(struct tty_struct *tty, struct file *filp, unsigned int set, unsigned int clear)
++#endif
+ {
+ struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dlc *dlc = dev->dlc;
--- /dev/null
+--- a/net/bluetooth/sco.c
++++ b/net/bluetooth/sco.c
+@@ -423,8 +423,12 @@
+ return sk;
+ }
+
++#if defined(CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN)
+ static int sco_sock_create(struct net *net, struct socket *sock, int protocol,
+ int kern)
++#else
++static int sco_sock_create(struct net *net, struct socket *sock, int protocol)
++#endif
+ {
+ struct sock *sk;
+
+@@ -675,7 +679,11 @@
+ return bt_sock_recvmsg(iocb, sock, msg, len, flags);
+ }
+
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
+ static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
++#else
++static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
++#endif
+ {
+ struct sock *sk = sock->sk;
+ int err = 0;
+++ /dev/null
-This patch addresses changes made by usage of new symbols
-like unregister_netdevice_queue() which are not possible to backport
-due to their reliance on internal symbols on net/core/dev.c
-
-The patch that introduced this on mac80211 was:
-
- mac80211: Speedup ieee80211_remove_interfaces()
-
- Speedup ieee80211_remove_interfaces() by factorizing synchronize_rcu() calls
-
- Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
- Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
- Signed-off-by: John W. Linville <linville@tuxdriver.com>
-
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -1643,6 +1643,7 @@ void ieee80211_sdata_stop(struct ieee802
- * Remove all interfaces, may only be called at hardware unregistration
- * time because it doesn't do RCU-safe list removals.
- */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
- void ieee80211_remove_interfaces(struct ieee80211_local *local)
- {
- struct ieee80211_sub_if_data *sdata, *tmp;
-@@ -1670,6 +1671,22 @@ void ieee80211_remove_interfaces(struct
- kfree(sdata);
- }
- }
-+#else
-+void ieee80211_remove_interfaces(struct ieee80211_local *local)
-+{
-+ struct ieee80211_sub_if_data *sdata, *tmp;
-+
-+ ASSERT_RTNL();
-+
-+ list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
-+ mutex_lock(&local->iflist_mtx);
-+ list_del(&sdata->list);
-+ mutex_unlock(&local->iflist_mtx);
-+
-+ unregister_netdevice(sdata->dev);
-+ }
-+}
-+#endif
-
- static int netdev_notify(struct notifier_block *nb,
- unsigned long state,
--- /dev/null
+This patch addresses changes made by usage of new symbols
+like unregister_netdevice_queue() which are not possible to backport
+due to their reliance on internal symbols on net/core/dev.c
+
+The patch that introduced this on mac80211 was:
+
+ mac80211: Speedup ieee80211_remove_interfaces()
+
+ Speedup ieee80211_remove_interfaces() by factorizing synchronize_rcu() calls
+
+ Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
+ Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
+ Signed-off-by: John W. Linville <linville@tuxdriver.com>
+
--- /dev/null
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -1643,6 +1643,7 @@
+ * Remove all interfaces, may only be called at hardware unregistration
+ * time because it doesn't do RCU-safe list removals.
+ */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
+ void ieee80211_remove_interfaces(struct ieee80211_local *local)
+ {
+ struct ieee80211_sub_if_data *sdata, *tmp;
+@@ -1670,6 +1671,22 @@
+ kfree(sdata);
+ }
+ }
++#else
++void ieee80211_remove_interfaces(struct ieee80211_local *local)
++{
++ struct ieee80211_sub_if_data *sdata, *tmp;
++
++ ASSERT_RTNL();
++
++ list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
++ mutex_lock(&local->iflist_mtx);
++ list_del(&sdata->list);
++ mutex_unlock(&local->iflist_mtx);
++
++ unregister_netdevice(sdata->dev);
++ }
++}
++#endif
+
+ static int netdev_notify(struct notifier_block *nb,
+ unsigned long state,
+++ /dev/null
-Rename config names for usbnet to deactivate them also if activated in
-the main kernel configuration. This is needed because
-usb_autopm_put_interface_async and usb_autopm_get_interface_async are
-not backported to kernel 2.6.28 and earlier.
-Remove this patch if these symbols are backported.
-
---- a/drivers/net/usb/Makefile
-+++ b/drivers/net/usb/Makefile
-@@ -10,7 +10,7 @@ obj-$(CONFIG_USB_HSO) += hso.o
- obj-$(CONFIG_USB_NET_AX8817X) += asix.o
- asix-y := asix_devices.o asix_common.o ax88172a.o
- obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.o
--obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
-+obj-$(CONFIG_USB_NET_COMPAT_CDCETHER) += cdc_ether.o
- obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o
- obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
- obj-$(CONFIG_USB_NET_SMSC75XX) += smsc75xx.o
-@@ -18,11 +18,11 @@ obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95
- obj-$(CONFIG_USB_NET_GL620A) += gl620a.o
- obj-$(CONFIG_USB_NET_NET1080) += net1080.o
- obj-$(CONFIG_USB_NET_PLUSB) += plusb.o
--obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o
-+obj-$(CONFIG_USB_NET_COMPAT_RNDIS_HOST) += rndis_host.o
- obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o
- obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o
- obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o
--obj-$(CONFIG_USB_USBNET) += usbnet.o
-+obj-$(CONFIG_USB_COMPAT_USBNET) += usbnet.o
- obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o
- obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o
- obj-$(CONFIG_USB_NET_KALMIA) += kalmia.o
---- a/drivers/net/usb/cdc_ether.c
-+++ b/drivers/net/usb/cdc_ether.c
-@@ -33,7 +33,7 @@
- #include <linux/usb/usbnet.h>
-
-
--#if defined(CONFIG_USB_NET_RNDIS_HOST) || defined(CONFIG_USB_NET_RNDIS_HOST_MODULE)
-+#if defined(CONFIG_USB_NET_COMPAT_RNDIS_HOST) || defined(CONFIG_USB_NET_COMPAT_RNDIS_HOST_MODULE)
-
- static int is_rndis(struct usb_interface_descriptor *desc)
- {
---- a/drivers/net/wireless/Makefile
-+++ b/drivers/net/wireless/Makefile
-@@ -30,7 +30,7 @@ obj-$(CONFIG_RTLWIFI) += rtlwifi/
- obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o
- obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o
-
--obj-$(CONFIG_USB_NET_RNDIS_WLAN) += rndis_wlan.o
-+obj-$(CONFIG_USB_NET_COMPAT_RNDIS_WLAN) += rndis_wlan.o
-
- obj-$(CONFIG_USB_ZD1201) += zd1201.o
- obj-$(CONFIG_LIBERTAS) += libertas/
--- /dev/null
+Rename config names for usbnet to deactivate them also if activated in
+the main kernel configuration. This is needed because
+usb_autopm_put_interface_async and usb_autopm_get_interface_async are
+not backported to kernel 2.6.28 and earlier.
+Remove this patch if these symbols are backported.
+
--- /dev/null
+--- a/drivers/net/usb/Makefile
++++ b/drivers/net/usb/Makefile
+@@ -10,7 +10,7 @@
+ obj-$(CONFIG_USB_NET_AX8817X) += asix.o
+ asix-y := asix_devices.o asix_common.o ax88172a.o
+ obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.o
+-obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
++obj-$(CONFIG_USB_NET_COMPAT_CDCETHER) += cdc_ether.o
+ obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o
+ obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
+ obj-$(CONFIG_USB_NET_SMSC75XX) += smsc75xx.o
+@@ -18,11 +18,11 @@
+ obj-$(CONFIG_USB_NET_GL620A) += gl620a.o
+ obj-$(CONFIG_USB_NET_NET1080) += net1080.o
+ obj-$(CONFIG_USB_NET_PLUSB) += plusb.o
+-obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o
++obj-$(CONFIG_USB_NET_COMPAT_RNDIS_HOST) += rndis_host.o
+ obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o
+ obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o
+ obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o
+-obj-$(CONFIG_USB_USBNET) += usbnet.o
++obj-$(CONFIG_USB_COMPAT_USBNET) += usbnet.o
+ obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o
+ obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o
+ obj-$(CONFIG_USB_NET_KALMIA) += kalmia.o
--- /dev/null
+--- a/drivers/net/usb/cdc_ether.c
++++ b/drivers/net/usb/cdc_ether.c
+@@ -33,7 +33,7 @@
+ #include <linux/usb/usbnet.h>
+
+
+-#if defined(CONFIG_USB_NET_RNDIS_HOST) || defined(CONFIG_USB_NET_RNDIS_HOST_MODULE)
++#if defined(CONFIG_USB_NET_COMPAT_RNDIS_HOST) || defined(CONFIG_USB_NET_COMPAT_RNDIS_HOST_MODULE)
+
+ static int is_rndis(struct usb_interface_descriptor *desc)
+ {
--- /dev/null
+--- a/drivers/net/wireless/Makefile
++++ b/drivers/net/wireless/Makefile
+@@ -30,7 +30,7 @@
+ obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o
+ obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o
+
+-obj-$(CONFIG_USB_NET_RNDIS_WLAN) += rndis_wlan.o
++obj-$(CONFIG_USB_NET_COMPAT_RNDIS_WLAN) += rndis_wlan.o
+
+ obj-$(CONFIG_USB_ZD1201) += zd1201.o
+ obj-$(CONFIG_LIBERTAS) += libertas/
+++ /dev/null
-Backport kernel patch 9a58a80a701bdb2d220cdab4914218df5b48d781
-proc_fops: convert drivers/isdn/ to seq_file
-
---- a/net/bluetooth/cmtp/capi.c
-+++ b/net/bluetooth/cmtp/capi.c
-@@ -21,8 +21,10 @@
- */
-
- #include <linux/export.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- #include <linux/proc_fs.h>
- #include <linux/seq_file.h>
-+#endif
- #include <linux/types.h>
- #include <linux/errno.h>
- #include <linux/kernel.h>
-@@ -522,6 +524,7 @@ static char *cmtp_procinfo(struct capi_c
- return "CAPI Message Transport Protocol";
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- static int cmtp_proc_show(struct seq_file *m, void *v)
- {
- struct capi_ctr *ctrl = m->private;
-@@ -554,6 +557,36 @@ static const struct file_operations cmtp
- .release = single_release,
- };
-
-+#else
-+
-+static int cmtp_ctr_read_proc(char *page, char **start, off_t off, int count, int *eof, struct capi_ctr *ctrl)
-+{
-+ struct cmtp_session *session = ctrl->driverdata;
-+ struct cmtp_application *app;
-+ struct list_head *p, *n;
-+ int len = 0;
-+
-+ len += sprintf(page + len, "%s\n\n", cmtp_procinfo(ctrl));
-+ len += sprintf(page + len, "addr %s\n", session->name);
-+ len += sprintf(page + len, "ctrl %d\n", session->num);
-+
-+ list_for_each_safe(p, n, &session->applications) {
-+ app = list_entry(p, struct cmtp_application, list);
-+ len += sprintf(page + len, "appl %d -> %d\n", app->appl, app->mapping);
-+ }
-+
-+ if (off + count >= len)
-+ *eof = 1;
-+
-+ if (len < off)
-+ return 0;
-+
-+ *start = page + off;
-+
-+ return ((count < len - off) ? count : len - off);
-+}
-+#endif
-+
- int cmtp_attach_device(struct cmtp_session *session)
- {
- unsigned char buf[4];
-@@ -592,7 +625,11 @@ int cmtp_attach_device(struct cmtp_sessi
- session->ctrl.send_message = cmtp_send_message;
-
- session->ctrl.procinfo = cmtp_procinfo;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- session->ctrl.proc_fops = &cmtp_proc_fops;
-+#else
-+ session->ctrl.ctr_read_proc = cmtp_ctr_read_proc;
-+#endif
-
- if (attach_capi_ctr(&session->ctrl) < 0) {
- BT_ERR("Can't attach new controller");
--- /dev/null
+Backport kernel patch 9a58a80a701bdb2d220cdab4914218df5b48d781
+proc_fops: convert drivers/isdn/ to seq_file
+
--- /dev/null
+--- a/net/bluetooth/cmtp/capi.c
++++ b/net/bluetooth/cmtp/capi.c
+@@ -21,8 +21,10 @@
+ */
+
+ #include <linux/export.h>
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ #include <linux/proc_fs.h>
+ #include <linux/seq_file.h>
++#endif
+ #include <linux/types.h>
+ #include <linux/errno.h>
+ #include <linux/kernel.h>
+@@ -522,6 +524,7 @@
+ return "CAPI Message Transport Protocol";
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ static int cmtp_proc_show(struct seq_file *m, void *v)
+ {
+ struct capi_ctr *ctrl = m->private;
+@@ -554,6 +557,36 @@
+ .release = single_release,
+ };
+
++#else
++
++static int cmtp_ctr_read_proc(char *page, char **start, off_t off, int count, int *eof, struct capi_ctr *ctrl)
++{
++ struct cmtp_session *session = ctrl->driverdata;
++ struct cmtp_application *app;
++ struct list_head *p, *n;
++ int len = 0;
++
++ len += sprintf(page + len, "%s\n\n", cmtp_procinfo(ctrl));
++ len += sprintf(page + len, "addr %s\n", session->name);
++ len += sprintf(page + len, "ctrl %d\n", session->num);
++
++ list_for_each_safe(p, n, &session->applications) {
++ app = list_entry(p, struct cmtp_application, list);
++ len += sprintf(page + len, "appl %d -> %d\n", app->appl, app->mapping);
++ }
++
++ if (off + count >= len)
++ *eof = 1;
++
++ if (len < off)
++ return 0;
++
++ *start = page + off;
++
++ return ((count < len - off) ? count : len - off);
++}
++#endif
++
+ int cmtp_attach_device(struct cmtp_session *session)
+ {
+ unsigned char buf[4];
+@@ -592,7 +625,11 @@
+ session->ctrl.send_message = cmtp_send_message;
+
+ session->ctrl.procinfo = cmtp_procinfo;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ session->ctrl.proc_fops = &cmtp_proc_fops;
++#else
++ session->ctrl.ctr_read_proc = cmtp_ctr_read_proc;
++#endif
+
+ if (attach_capi_ctr(&session->ctrl) < 0) {
+ BT_ERR("Can't attach new controller");
+++ /dev/null
-Backport multiqueue support for kernels 2.6.23-27
-
-The 2.6.23 kernel added some initial multiqueue support.
-That release relied on the on the notion of struct
-net_device_subqueue attached to the netdevice struct
-as an array. The 2.6.27 renamed these to struct netdev_queue,
-and enhanced MQ support by providing locks separately onto
-each queue. MQ support on 2.6.27 also extended each netdev
-to be able to assign a select_queue callback to be used by
-core networking for prior to pushing the skb out to the device
-driver so that queue selection can be dealt with and
-customized internally on the driver.
-
-For kernels 2.6.23..2.6.26 then we backport MQ support by
-using the equivalent calls on the struct netdev_queue to
-the struct net_device_subqueue. The performance penalty
-here is just that all these queues share a common lock
-so stateful operations on one queue would imply a delay
-on other queues.
-
-The select_queue callback was only added as of 2.6.27 via
-commit eae792b7 so for kernels 2.6.23 up to 2.6.27 we must
-ensure we do the selection of the queue once the core
-networking calls mac80211's dev_hard_start_xmit()
-(ndo_start_xmit() callback on newer kernels).
-
-This patch thus only addresses the lack of select_queue on
-kernels older than 2.6.27, naming differences are handled
-in compat.
-
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -1512,6 +1512,10 @@ void ieee80211_xmit(struct ieee80211_sub
- }
- }
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
-+ /* Older kernels do not have the select_queue callback */
-+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb));
-+#endif
- ieee80211_set_qos_hdr(sdata, skb);
- ieee80211_tx(sdata, skb, false, band);
- }
--- /dev/null
+Backport multiqueue support for kernels 2.6.23-27
+
+The 2.6.23 kernel added some initial multiqueue support.
+That release relied on the on the notion of struct
+net_device_subqueue attached to the netdevice struct
+as an array. The 2.6.27 renamed these to struct netdev_queue,
+and enhanced MQ support by providing locks separately onto
+each queue. MQ support on 2.6.27 also extended each netdev
+to be able to assign a select_queue callback to be used by
+core networking for prior to pushing the skb out to the device
+driver so that queue selection can be dealt with and
+customized internally on the driver.
+
+For kernels 2.6.23..2.6.26 then we backport MQ support by
+using the equivalent calls on the struct netdev_queue to
+the struct net_device_subqueue. The performance penalty
+here is just that all these queues share a common lock
+so stateful operations on one queue would imply a delay
+on other queues.
+
+The select_queue callback was only added as of 2.6.27 via
+commit eae792b7 so for kernels 2.6.23 up to 2.6.27 we must
+ensure we do the selection of the queue once the core
+networking calls mac80211's dev_hard_start_xmit()
+(ndo_start_xmit() callback on newer kernels).
+
+This patch thus only addresses the lack of select_queue on
+kernels older than 2.6.27, naming differences are handled
+in compat.
+
--- /dev/null
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -1512,6 +1512,10 @@
+ }
+ }
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
++ /* Older kernels do not have the select_queue callback */
++ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb));
++#endif
+ ieee80211_set_qos_hdr(sdata, skb);
+ ieee80211_tx(sdata, skb, false, band);
+ }
+++ /dev/null
---- a/drivers/bluetooth/bluecard_cs.c
-+++ b/drivers/bluetooth/bluecard_cs.c
-@@ -158,7 +158,12 @@ static void bluecard_detach(struct pcmci
- static void bluecard_activity_led_timeout(u_long arg)
- {
- bluecard_info_t *info = (bluecard_info_t *)arg;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
-+
-
- if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
- return;
-@@ -175,7 +180,11 @@ static void bluecard_activity_led_timeou
-
- static void bluecard_enable_activity_led(bluecard_info_t *info)
- {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
-
- if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
- return;
-@@ -231,7 +240,11 @@ static void bluecard_write_wakeup(blueca
- }
-
- do {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
- unsigned int offset;
- unsigned char command;
- unsigned long ready_bit;
-@@ -378,7 +391,11 @@ static void bluecard_receive(bluecard_in
- return;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- iobase = info->p_dev->resource[0]->start;
-+#else
-+ iobase = info->p_dev->io.BasePort1;
-+#endif
-
- if (test_bit(XMIT_SENDING_READY, &(info->tx_state)))
- bluecard_enable_activity_led(info);
-@@ -507,7 +524,11 @@ static irqreturn_t bluecard_interrupt(in
- if (!test_bit(CARD_READY, &(info->hw_state)))
- return IRQ_HANDLED;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- iobase = info->p_dev->resource[0]->start;
-+#else
-+ iobase = info->p_dev->io.BasePort1;
-+#endif
-
- spin_lock(&(info->lock));
-
-@@ -629,7 +650,11 @@ static int bluecard_hci_open(struct hci_
- return 0;
-
- if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
-
- /* Enable LED */
- outb(0x08 | 0x20, iobase + 0x30);
-@@ -649,7 +674,11 @@ static int bluecard_hci_close(struct hci
- bluecard_hci_flush(hdev);
-
- if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
-
- /* Disable LED */
- outb(0x00, iobase + 0x30);
-@@ -705,7 +734,11 @@ static int bluecard_hci_ioctl(struct hci
-
- static int bluecard_open(bluecard_info_t *info)
- {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
- struct hci_dev *hdev;
- unsigned char id;
-
-@@ -821,7 +854,11 @@ static int bluecard_open(bluecard_info_t
-
- static int bluecard_close(bluecard_info_t *info)
- {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
- struct hci_dev *hdev = info->hdev;
-
- if (!hdev)
-@@ -856,7 +893,18 @@ static int bluecard_probe(struct pcmcia_
- info->p_dev = link;
- link->priv = info;
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
-+ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
-+
-+ link->irq.Handler = bluecard_interrupt;
-+#endif
-+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- link->config_flags |= CONF_ENABLE_IRQ;
-+#else
-+ link->conf.Attributes = CONF_ENABLE_IRQ;
-+ link->conf.IntType = INT_MEMORY_AND_IO;
-+#endif
-
- return bluecard_config(link);
- }
-@@ -873,15 +921,30 @@ static int bluecard_config(struct pcmcia
- bluecard_info_t *info = link->priv;
- int i, n;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- link->config_index = 0x20;
-+#else
-+ link->conf.ConfigIndex = 0x20;
-+#endif
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
- link->resource[0]->end = 64;
- link->io_lines = 6;
-+#else
-+ link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
-+ link->io.NumPorts1 = 64;
-+ link->io.IOAddrLines = 6;
-+#endif
-
- for (n = 0; n < 0x400; n += 0x40) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- link->resource[0]->start = n ^ 0x300;
- i = pcmcia_request_io(link);
-+#else
-+ link->io.BasePort1 = n ^ 0x300;
-+ i = pcmcia_request_io(link, &link->io);
-+#endif
- if (i == 0)
- break;
- }
-@@ -889,9 +952,15 @@ static int bluecard_config(struct pcmcia
- if (i != 0)
- goto failed;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- i = pcmcia_request_irq(link, bluecard_interrupt);
- if (i != 0)
- goto failed;
-+#else
-+ i = pcmcia_request_irq(link, &link->irq);
-+ if (i != 0)
-+ link->irq.AssignedIRQ = 0;
-+#endif
-
- i = pcmcia_enable_device(link);
- if (i != 0)
-@@ -929,7 +998,13 @@ MODULE_DEVICE_TABLE(pcmcia, bluecard_ids
-
- static struct pcmcia_driver bluecard_driver = {
- .owner = THIS_MODULE,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- .name = "bluecard_cs",
-+#else
-+ .drv = {
-+ .name = "bluecard_cs",
-+ },
-+#endif
- .probe = bluecard_probe,
- .remove = bluecard_detach,
- .id_table = bluecard_ids,
---- a/drivers/bluetooth/bt3c_cs.c
-+++ b/drivers/bluetooth/bt3c_cs.c
-@@ -186,7 +186,11 @@ static void bt3c_write_wakeup(bt3c_info_
- return;
-
- do {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
- register struct sk_buff *skb;
- int len;
-
-@@ -224,7 +228,11 @@ static void bt3c_receive(bt3c_info_t *in
- return;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- iobase = info->p_dev->resource[0]->start;
-+#else
-+ iobase = info->p_dev->io.BasePort1;
-+#endif
-
- avail = bt3c_read(iobase, 0x7006);
- //printk("bt3c_cs: receiving %d bytes\n", avail);
-@@ -345,7 +353,11 @@ static irqreturn_t bt3c_interrupt(int ir
- /* our irq handler is shared */
- return IRQ_NONE;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- iobase = info->p_dev->resource[0]->start;
-+#else
-+ iobase = info->p_dev->io.BasePort1;
-+#endif
-
- spin_lock(&(info->lock));
-
-@@ -473,7 +485,11 @@ static int bt3c_load_firmware(bt3c_info_
- unsigned int iobase, size, addr, fcs, tmp;
- int i, err = 0;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- iobase = info->p_dev->resource[0]->start;
-+#else
-+ iobase = info->p_dev->io.BasePort1;
-+#endif
-
- /* Reset */
- bt3c_io_write(iobase, 0x8040, 0x0404);
-@@ -645,8 +661,27 @@ static int bt3c_probe(struct pcmcia_devi
- info->p_dev = link;
- link->priv = info;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
- CONF_AUTO_SET_IO;
-+#else
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-+ link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
-+ link->resource[0]->end = 8;
-+#else
-+ link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
-+ link->io.NumPorts1= 8;
-+#endif
-+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
-+ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
-+
-+ link->irq.Handler = bt3c_interrupt;
-+#endif
-+
-+ link->conf.Attributes = CONF_ENABLE_IRQ;
-+ link->conf.IntType = INT_MEMORY_AND_IO;
-+#endif
-
- return bt3c_config(link);
- }
-@@ -657,6 +692,7 @@ static void bt3c_detach(struct pcmcia_de
- bt3c_release(link);
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data)
- {
- int *try = priv_data;
-@@ -695,6 +731,63 @@ static int bt3c_check_config_notpicky(st
- }
- return -ENODEV;
- }
-+#else
-+static int bt3c_check_config(struct pcmcia_device *p_dev,
-+ cistpl_cftable_entry_t *cf,
-+ cistpl_cftable_entry_t *dflt,
-+ unsigned int vcc,
-+ void *priv_data)
-+{
-+ unsigned long try = (unsigned long) priv_data;
-+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-+ p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
-+#endif
-+
-+ if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
-+ p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
-+ if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
-+ (cf->io.win[0].base != 0)) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-+ p_dev->resource[0]->start = cf->io.win[0].base;
-+ if (!pcmcia_request_io(p_dev))
-+#else
-+ p_dev->io.BasePort1 = cf->io.win[0].base;
-+ p_dev->io.IOAddrLines = (try == 0) ? 16 :
-+ cf->io.flags & CISTPL_IO_LINES_MASK;
-+ if (!pcmcia_request_io(p_dev, &p_dev->io))
-+#endif
-+ return 0;
-+ }
-+ return -ENODEV;
-+}
-+
-+static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
-+ cistpl_cftable_entry_t *cf,
-+ cistpl_cftable_entry_t *dflt,
-+ unsigned int vcc,
-+ void *priv_data)
-+{
-+ static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
-+ int j;
-+
-+ if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
-+ for (j = 0; j < 5; j++) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-+ p_dev->resource[0]->start = base[j];
-+ p_dev->io_lines = base[j] ? 16 : 3;
-+ if (!pcmcia_request_io(p_dev))
-+#else
-+ p_dev->io.BasePort1 = base[j];
-+ p_dev->io.IOAddrLines = base[j] ? 16 : 3;
-+ if (!pcmcia_request_io(p_dev, &p_dev->io))
-+#endif
-+ return 0;
-+ }
-+ }
-+ return -ENODEV;
-+}
-+#endif
-
- static int bt3c_config(struct pcmcia_device *link)
- {
-@@ -718,9 +811,15 @@ static int bt3c_config(struct pcmcia_dev
- goto failed;
-
- found_port:
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- i = pcmcia_request_irq(link, &bt3c_interrupt);
- if (i != 0)
- goto failed;
-+#else
-+ i = pcmcia_request_irq(link, &link->irq);
-+ if (i != 0)
-+ link->irq.AssignedIRQ = 0;
-+#endif
-
- i = pcmcia_enable_device(link);
- if (i != 0)
-@@ -755,7 +854,13 @@ MODULE_DEVICE_TABLE(pcmcia, bt3c_ids);
-
- static struct pcmcia_driver bt3c_driver = {
- .owner = THIS_MODULE,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- .name = "bt3c_cs",
-+#else
-+ .drv = {
-+ .name = "bt3c_cs",
-+ },
-+#endif
- .probe = bt3c_probe,
- .remove = bt3c_detach,
- .id_table = bt3c_ids,
---- a/drivers/bluetooth/btuart_cs.c
-+++ b/drivers/bluetooth/btuart_cs.c
-@@ -140,7 +140,11 @@ static void btuart_write_wakeup(btuart_i
- }
-
- do {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
- register struct sk_buff *skb;
- int len;
-
-@@ -181,7 +185,11 @@ static void btuart_receive(btuart_info_t
- return;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- iobase = info->p_dev->resource[0]->start;
-+#else
-+ iobase = info->p_dev->io.BasePort1;
-+#endif
-
- do {
- info->hdev->stat.byte_rx++;
-@@ -295,7 +303,11 @@ static irqreturn_t btuart_interrupt(int
- /* our irq handler is shared */
- return IRQ_NONE;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- iobase = info->p_dev->resource[0]->start;
-+#else
-+ iobase = info->p_dev->io.BasePort1;
-+#endif
-
- spin_lock(&(info->lock));
-
-@@ -352,7 +364,11 @@ static void btuart_change_speed(btuart_i
- return;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- iobase = info->p_dev->resource[0]->start;
-+#else
-+ iobase = info->p_dev->io.BasePort1;
-+#endif
-
- spin_lock_irqsave(&(info->lock), flags);
-
-@@ -471,7 +487,11 @@ static int btuart_hci_ioctl(struct hci_d
- static int btuart_open(btuart_info_t *info)
- {
- unsigned long flags;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
- struct hci_dev *hdev;
-
- spin_lock_init(&(info->lock));
-@@ -538,7 +558,11 @@ static int btuart_open(btuart_info_t *in
- static int btuart_close(btuart_info_t *info)
- {
- unsigned long flags;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
- struct hci_dev *hdev = info->hdev;
-
- if (!hdev)
-@@ -574,8 +598,27 @@ static int btuart_probe(struct pcmcia_de
- info->p_dev = link;
- link->priv = info;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
- CONF_AUTO_SET_IO;
-+#else
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-+ link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
-+ link->resource[0]->end = 8;
-+#else
-+ link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
-+ link->io.NumPorts1= 8;
-+#endif
-+
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
-+ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
-+
-+ link->irq.Handler = btuart_interrupt;
-+#endif
-+
-+ link->conf.Attributes = CONF_ENABLE_IRQ;
-+ link->conf.IntType = INT_MEMORY_AND_IO;
-+#endif
-
- return btuart_config(link);
- }
-@@ -586,6 +629,7 @@ static void btuart_detach(struct pcmcia_
- btuart_release(link);
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- static int btuart_check_config(struct pcmcia_device *p_dev, void *priv_data)
- {
- int *try = priv_data;
-@@ -624,6 +668,63 @@ static int btuart_check_config_notpicky(
- }
- return -ENODEV;
- }
-+#else
-+static int btuart_check_config(struct pcmcia_device *p_dev,
-+ cistpl_cftable_entry_t *cf,
-+ cistpl_cftable_entry_t *dflt,
-+ unsigned int vcc,
-+ void *priv_data)
-+{
-+ int *try = priv_data;
-+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-+ p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
-+#endif
-+
-+ if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
-+ p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
-+ if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
-+ (cf->io.win[0].base != 0)) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-+ p_dev->resource[0]->start = cf->io.win[0].base;
-+ if (!pcmcia_request_io(p_dev))
-+#else
-+ p_dev->io.BasePort1 = cf->io.win[0].base;
-+ p_dev->io.IOAddrLines = (*try == 0) ? 16 :
-+ cf->io.flags & CISTPL_IO_LINES_MASK;
-+ if (!pcmcia_request_io(p_dev, &p_dev->io))
-+#endif
-+ return 0;
-+ }
-+ return -ENODEV;
-+}
-+
-+static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
-+ cistpl_cftable_entry_t *cf,
-+ cistpl_cftable_entry_t *dflt,
-+ unsigned int vcc,
-+ void *priv_data)
-+{
-+ static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
-+ int j;
-+
-+ if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
-+ for (j = 0; j < 5; j++) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-+ p_dev->resource[0]->start = base[j];
-+ p_dev->io_lines = base[j] ? 16 : 3;
-+ if (!pcmcia_request_io(p_dev))
-+#else
-+ p_dev->io.BasePort1 = base[j];
-+ p_dev->io.IOAddrLines = base[j] ? 16 : 3;
-+ if (!pcmcia_request_io(p_dev, &p_dev->io))
-+#endif
-+ return 0;
-+ }
-+ }
-+ return -ENODEV;
-+}
-+#endif
-
- static int btuart_config(struct pcmcia_device *link)
- {
-@@ -647,9 +748,15 @@ static int btuart_config(struct pcmcia_d
- goto failed;
-
- found_port:
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- i = pcmcia_request_irq(link, btuart_interrupt);
- if (i != 0)
- goto failed;
-+#else
-+ i = pcmcia_request_irq(link, &link->irq);
-+ if (i != 0)
-+ link->irq.AssignedIRQ = 0;
-+#endif
-
- i = pcmcia_enable_device(link);
- if (i != 0)
-@@ -683,7 +790,13 @@ MODULE_DEVICE_TABLE(pcmcia, btuart_ids);
-
- static struct pcmcia_driver btuart_driver = {
- .owner = THIS_MODULE,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- .name = "btuart_cs",
-+#else
-+ .drv = {
-+ .name = "btuart_cs",
-+ },
-+#endif
- .probe = btuart_probe,
- .remove = btuart_detach,
- .id_table = btuart_ids,
---- a/drivers/bluetooth/dtl1_cs.c
-+++ b/drivers/bluetooth/dtl1_cs.c
-@@ -144,7 +144,11 @@ static void dtl1_write_wakeup(dtl1_info_
- }
-
- do {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
- register struct sk_buff *skb;
- int len;
-
-@@ -209,7 +213,11 @@ static void dtl1_receive(dtl1_info_t *in
- return;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- iobase = info->p_dev->resource[0]->start;
-+#else
-+ iobase = info->p_dev->io.BasePort1;
-+#endif
-
- do {
- info->hdev->stat.byte_rx++;
-@@ -296,7 +304,11 @@ static irqreturn_t dtl1_interrupt(int ir
- /* our irq handler is shared */
- return IRQ_NONE;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- iobase = info->p_dev->resource[0]->start;
-+#else
-+ iobase = info->p_dev->io.BasePort1;
-+#endif
-
- spin_lock(&(info->lock));
-
-@@ -451,7 +463,11 @@ static int dtl1_hci_ioctl(struct hci_dev
- static int dtl1_open(dtl1_info_t *info)
- {
- unsigned long flags;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
- struct hci_dev *hdev;
-
- spin_lock_init(&(info->lock));
-@@ -495,8 +511,13 @@ static int dtl1_open(dtl1_info_t *info)
- outb(UART_LCR_WLEN8, iobase + UART_LCR); /* Reset DLAB */
- outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase + UART_MCR);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- info->ri_latch = inb(info->p_dev->resource[0]->start + UART_MSR)
- & UART_MSR_RI;
-+#else
-+ info->ri_latch = inb(info->p_dev->io.BasePort1 + UART_MSR)
-+ & UART_MSR_RI;
-+#endif
-
- /* Turn on interrupts */
- outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
-@@ -521,7 +542,11 @@ static int dtl1_open(dtl1_info_t *info)
- static int dtl1_close(dtl1_info_t *info)
- {
- unsigned long flags;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- unsigned int iobase = info->p_dev->resource[0]->start;
-+#else
-+ unsigned int iobase = info->p_dev->io.BasePort1;
-+#endif
- struct hci_dev *hdev = info->hdev;
-
- if (!hdev)
-@@ -557,7 +582,24 @@ static int dtl1_probe(struct pcmcia_devi
- info->p_dev = link;
- link->priv = info;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
-+#else
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-+ link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
-+ link->resource[0]->end = 8;
-+#else
-+ link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
-+ link->io.NumPorts1= 8;
-+#endif
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
-+ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
-+ link->irq.Handler = dtl1_interrupt;
-+#endif
-+
-+ link->conf.Attributes = CONF_ENABLE_IRQ;
-+ link->conf.IntType = INT_MEMORY_AND_IO;
-+#endif
-
- return dtl1_config(link);
- }
-@@ -571,6 +613,7 @@ static void dtl1_detach(struct pcmcia_de
- pcmcia_disable_device(link);
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data)
- {
- if ((p_dev->resource[1]->end) || (p_dev->resource[1]->end < 8))
-@@ -581,6 +624,29 @@ static int dtl1_confcheck(struct pcmcia_
-
- return pcmcia_request_io(p_dev);
- }
-+#else
-+static int dtl1_confcheck(struct pcmcia_device *p_dev,
-+ cistpl_cftable_entry_t *cf,
-+ cistpl_cftable_entry_t *dflt,
-+ unsigned int vcc,
-+ void *priv_data)
-+{
-+ if ((cf->io.nwin != 1) || (cf->io.win[0].len <= 8))
-+ return -ENODEV;
-+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-+ p_dev->resource[0]->start = cf->io.win[0].base;
-+ p_dev->resource[0]->end = cf->io.win[0].len; /*yo */
-+ p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK;
-+ return pcmcia_request_io(p_dev);
-+#else
-+ p_dev->io.BasePort1 = cf->io.win[0].base;
-+ p_dev->io.NumPorts1 = cf->io.win[0].len; /*yo */
-+ p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
-+ return pcmcia_request_io(p_dev, &p_dev->io);
-+#endif
-+}
-+#endif
-
- static int dtl1_config(struct pcmcia_device *link)
- {
-@@ -588,14 +654,24 @@ static int dtl1_config(struct pcmcia_dev
- int ret;
-
- /* Look for a generic full-sized window */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- link->resource[0]->end = 8;
-+#else
-+ link->io.NumPorts1 = 8;
-+#endif
- ret = pcmcia_loop_config(link, dtl1_confcheck, NULL);
- if (ret)
- goto failed;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- ret = pcmcia_request_irq(link, dtl1_interrupt);
- if (ret)
- goto failed;
-+#else
-+ ret = pcmcia_request_irq(link, &link->irq);
-+ if (ret != 0)
-+ link->irq.AssignedIRQ = 0;
-+#endif
-
- ret = pcmcia_enable_device(link);
- if (ret)
-@@ -623,7 +699,13 @@ MODULE_DEVICE_TABLE(pcmcia, dtl1_ids);
-
- static struct pcmcia_driver dtl1_driver = {
- .owner = THIS_MODULE,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- .name = "dtl1_cs",
-+#else
-+ .drv = {
-+ .name = "dtl1_cs",
-+ },
-+#endif
- .probe = dtl1_probe,
- .remove = dtl1_detach,
- .id_table = dtl1_ids,
---- a/drivers/net/wireless/b43/pcmcia.c
-+++ b/drivers/net/wireless/b43/pcmcia.c
-@@ -63,6 +63,9 @@ static int b43_pcmcia_resume(struct pcmc
- static int b43_pcmcia_probe(struct pcmcia_device *dev)
- {
- struct ssb_bus *ssb;
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
-+ win_req_t win;
-+#endif
- int err = -ENOMEM;
- int res = 0;
-
-@@ -72,6 +75,7 @@ static int b43_pcmcia_probe(struct pcmci
-
- err = -ENODEV;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- dev->config_flags |= CONF_ENABLE_IRQ;
-
- dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 |
-@@ -79,21 +83,46 @@ static int b43_pcmcia_probe(struct pcmci
- dev->resource[2]->start = 0;
- dev->resource[2]->end = SSB_CORE_SIZE;
- res = pcmcia_request_window(dev, dev->resource[2], 250);
-+#else
-+ dev->conf.Attributes = CONF_ENABLE_IRQ;
-+ dev->conf.IntType = INT_MEMORY_AND_IO;
-+
-+ win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 |
-+ WIN_USE_WAIT;
-+ win.Base = 0;
-+ win.Size = SSB_CORE_SIZE;
-+ win.AccessSpeed = 250;
-+ res = pcmcia_request_window(dev, &win, &dev->win);
-+#endif
- if (res != 0)
- goto err_kfree_ssb;
--
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- res = pcmcia_map_mem_page(dev, dev->resource[2], 0);
-+#else
-+ res = pcmcia_map_mem_page(dev, dev->win, 0);
-+#endif
- if (res != 0)
- goto err_disable;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- if (!dev->irq)
-+#else
-+ dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
-+ dev->irq.Handler = NULL; /* The handler is registered later. */
-+ res = pcmcia_request_irq(dev, &dev->irq);
-+ if (res != 0)
-+#endif
- goto err_disable;
-
- res = pcmcia_enable_device(dev);
- if (res != 0)
- goto err_disable;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start);
-+#else
-+ err = ssb_bus_pcmciabus_register(ssb, dev, win.Base);
-+#endif
- if (err)
- goto err_disable;
- dev->priv = ssb;
-@@ -122,7 +151,13 @@ static void b43_pcmcia_remove(struct pcm
-
- static struct pcmcia_driver b43_pcmcia_driver = {
- .owner = THIS_MODULE,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- .name = "b43-pcmcia",
-+#else
-+ .drv = {
-+ .name = "b43-pcmcia",
-+ },
-+#endif
- .id_table = b43_pcmcia_tbl,
- .probe = b43_pcmcia_probe,
- .remove = b43_pcmcia_remove,
---- a/drivers/net/wireless/libertas/if_cs.c
-+++ b/drivers/net/wireless/libertas/if_cs.c
-@@ -757,7 +757,11 @@ static void if_cs_prog_firmware(struct l
- goto out;
-
- /* Now actually get the IRQ */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- ret = request_irq(card->p_dev->irq, if_cs_interrupt,
-+#else
-+ ret = request_irq(card->p_dev->irq.AssignedIRQ, if_cs_interrupt,
-+#endif
- IRQF_SHARED, DRV_NAME, card);
- if (ret) {
- pr_err("error in request_irq\n");
-@@ -775,7 +779,11 @@ static void if_cs_prog_firmware(struct l
- priv->fw_ready = 1;
- if (lbs_start_card(priv) != 0) {
- pr_err("could not activate card\n");
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- free_irq(card->p_dev->irq, card);
-+#else
-+ free_irq(card->p_dev->irq.AssignedIRQ, card);
-+#endif
- }
-
- out:
-@@ -824,7 +832,11 @@ static void if_cs_release(struct pcmcia_
-
- lbs_deb_enter(LBS_DEB_CS);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- free_irq(p_dev->irq, card);
-+#else
-+ free_irq(p_dev->irq.AssignedIRQ, card);
-+#endif
- pcmcia_disable_device(p_dev);
- if (card->iobase)
- ioport_unmap(card->iobase);
-@@ -832,7 +844,7 @@ static void if_cs_release(struct pcmcia_
- lbs_deb_leave(LBS_DEB_CS);
- }
-
--
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data)
- {
- p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
-@@ -842,9 +854,39 @@ static int if_cs_ioprobe(struct pcmcia_d
- pr_err("wrong CIS (check number of IO windows)\n");
- return -ENODEV;
- }
-+#else
-+static int if_cs_ioprobe(struct pcmcia_device *p_dev,
-+ cistpl_cftable_entry_t *cfg,
-+ cistpl_cftable_entry_t *dflt,
-+ unsigned int vcc,
-+ void *priv_data)
-+{
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-+ p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
-+ p_dev->resource[0]->start = cfg->io.win[0].base;
-+ p_dev->resource[0]->end = cfg->io.win[0].len;
-+#else
-+ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
-+ p_dev->io.BasePort1 = cfg->io.win[0].base;
-+ p_dev->io.NumPorts1 = cfg->io.win[0].len;
-+#endif
-+
-+ /* Do we need to allocate an interrupt? */
-+ p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
-+
-+ /* IO window settings */
-+ if (cfg->io.nwin != 1) {
-+ pr_err("wrong CIS (check number of IO windows)\n");
-+ return -ENODEV;
-+ }
-+#endif
-
- /* This reserves IO space but doesn't actually enable it */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- return pcmcia_request_io(p_dev);
-+#else
-+ return pcmcia_request_io(p_dev, &p_dev->io);
-+#endif
- }
-
- static int if_cs_probe(struct pcmcia_device *p_dev)
-@@ -863,7 +905,16 @@ static int if_cs_probe(struct pcmcia_dev
- card->p_dev = p_dev;
- p_dev->priv = card;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
-+#else
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
-+ p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
-+ p_dev->irq.Handler = NULL;
-+#endif
-+ p_dev->conf.Attributes = 0;
-+ p_dev->conf.IntType = INT_MEMORY_AND_IO;
-+#endif
-
- if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) {
- pr_err("error in pcmcia_loop_config\n");
-@@ -875,12 +926,26 @@ static int if_cs_probe(struct pcmcia_dev
- * a handler to the interrupt, unless the 'Handler' member of
- * the irq structure is initialized.
- */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- if (!p_dev->irq)
- goto out1;
-+#else
-+ if (p_dev->conf.Attributes & CONF_ENABLE_IRQ) {
-+ ret = pcmcia_request_irq(p_dev, &p_dev->irq);
-+ if (ret) {
-+ pr_err("error in pcmcia_request_irq\n");
-+ goto out1;
-+ }
-+ }
-+#endif
-
- /* Initialize io access */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- card->iobase = ioport_map(p_dev->resource[0]->start,
- resource_size(p_dev->resource[0]));
-+#else
-+ card->iobase = ioport_map(p_dev->io.BasePort1, p_dev->io.NumPorts1);
-+#endif
- if (!card->iobase) {
- pr_err("error in ioport_map\n");
- ret = -EIO;
-@@ -894,7 +959,17 @@ static int if_cs_probe(struct pcmcia_dev
- }
-
- /* Finally, report what we've done */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- lbs_deb_cs("irq %d, io %pR", p_dev->irq, p_dev->resource[0]);
-+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
-+ lbs_deb_cs("irq %d, io 0x%04x-0x%04x\n",
-+ p_dev->irq, p_dev->io.BasePort1,
-+ p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1);
-+#else
-+ lbs_deb_cs("irq %d, io 0x%04x-0x%04x\n",
-+ p_dev->irq.AssignedIRQ, p_dev->io.BasePort1,
-+ p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1);
-+#endif
-
- /*
- * Most of the libertas cards can do unaligned register access, but some
-@@ -1001,7 +1076,13 @@ MODULE_DEVICE_TABLE(pcmcia, if_cs_ids);
-
- static struct pcmcia_driver lbs_driver = {
- .owner = THIS_MODULE,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- .name = DRV_NAME,
-+#else
-+ .drv = {
-+ .name = DRV_NAME,
-+ },
-+#endif
- .probe = if_cs_probe,
- .remove = if_cs_detach,
- .id_table = if_cs_ids,
---- a/drivers/net/wireless/orinoco/orinoco_cs.c
-+++ b/drivers/net/wireless/orinoco/orinoco_cs.c
-@@ -78,7 +78,11 @@ orinoco_cs_hard_reset(struct orinoco_pri
- /* We need atomic ops here, because we're not holding the lock */
- set_bit(0, &card->hard_reset_in_progress);
-
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27)
-+ err = pcmcia_reset_card(link, NULL);
-+#else
- err = pcmcia_reset_card(link->socket);
-+#endif
- if (err)
- return err;
-
-@@ -108,6 +112,16 @@ orinoco_cs_probe(struct pcmcia_device *l
- card->p_dev = link;
- link->priv = priv;
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
-+ /* Interrupt setup */
-+ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
-+ link->irq.Handler = orinoco_interrupt;
-+#endif
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
-+ link->conf.Attributes = 0;
-+ link->conf.IntType = INT_MEMORY_AND_IO;
-+#endif
-+
- return orinoco_cs_config(link);
- } /* orinoco_cs_attach */
-
-@@ -122,6 +136,7 @@ static void orinoco_cs_detach(struct pcm
- free_orinocodev(priv);
- } /* orinoco_cs_detach */
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- static int orinoco_cs_config_check(struct pcmcia_device *p_dev, void *priv_data)
- {
- if (p_dev->config_index == 0)
-@@ -129,6 +144,98 @@ static int orinoco_cs_config_check(struc
-
- return pcmcia_request_io(p_dev);
- };
-+#else
-+static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
-+ cistpl_cftable_entry_t *cfg,
-+ cistpl_cftable_entry_t *dflt,
-+ unsigned int vcc,
-+ void *priv_data)
-+{
-+ if (cfg->index == 0)
-+ goto next_entry;
-+
-+ /* Use power settings for Vcc and Vpp if present */
-+ /* Note that the CIS values need to be rescaled */
-+ if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
-+ if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
-+ DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
-+ __func__, vcc,
-+ cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
-+ if (!ignore_cis_vcc)
-+ goto next_entry;
-+ }
-+ } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
-+ if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
-+ DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
-+ __func__, vcc,
-+ dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
-+ if (!ignore_cis_vcc)
-+ goto next_entry;
-+ }
-+ }
-+
-+ if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
-+ p_dev->conf.Vpp =
-+ cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
-+ else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
-+ p_dev->conf.Vpp =
-+ dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
-+
-+ /* Do we need to allocate an interrupt? */
-+ p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
-+
-+ /* IO window settings */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
-+ p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
-+#else
-+ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
-+#endif
-+ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
-+ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
-+ p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
-+ p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
-+ p_dev->resource[0]->flags |=
-+ pcmcia_io_cfg_data_width(io->flags);
-+ p_dev->resource[0]->start = io->win[0].base;
-+ p_dev->resource[0]->end = io->win[0].len;
-+#else
-+ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
-+ if (!(io->flags & CISTPL_IO_8BIT))
-+ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
-+ if (!(io->flags & CISTPL_IO_16BIT))
-+ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
-+ p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
-+ p_dev->io.BasePort1 = io->win[0].base;
-+ p_dev->io.NumPorts1 = io->win[0].len;
-+#endif
-+ if (io->nwin > 1) {
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
-+ p_dev->resource[1]->flags = p_dev->resource[0]->flags;
-+ p_dev->resource[1]->start = io->win[1].base;
-+ p_dev->resource[1]->end = io->win[1].len;
-+#else
-+ p_dev->io.Attributes2 = p_dev->io.Attributes1;
-+ p_dev->io.BasePort2 = io->win[1].base;
-+ p_dev->io.NumPorts2 = io->win[1].len;
-+#endif
-+ }
-+
-+ /* This reserves IO space but doesn't actually enable it */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
-+ if (pcmcia_request_io(p_dev) != 0)
-+#else
-+ if (pcmcia_request_io(p_dev, &p_dev->io) != 0)
-+#endif
-+ goto next_entry;
-+ }
-+ return 0;
-+
-+next_entry:
-+ pcmcia_disable_device(p_dev);
-+ return -ENODEV;
-+};
-+#endif
-
- static int
- orinoco_cs_config(struct pcmcia_device *link)
-@@ -138,10 +245,12 @@ orinoco_cs_config(struct pcmcia_device *
- int ret;
- void __iomem *mem;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC |
- CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
- if (ignore_cis_vcc)
- link->config_flags &= ~CONF_AUTO_CHECK_VCC;
-+#endif
- ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL);
- if (ret) {
- if (!ignore_cis_vcc)
-@@ -151,8 +260,12 @@ orinoco_cs_config(struct pcmcia_device *
- goto failed;
- }
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
- mem = ioport_map(link->resource[0]->start,
- resource_size(link->resource[0]));
-+#else
-+ mem = ioport_map(link->io.BasePort1, link->io.NumPorts1);
-+#endif
- if (!mem)
- goto failed;
-
-@@ -161,7 +274,11 @@ orinoco_cs_config(struct pcmcia_device *
- * called. */
- hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- ret = pcmcia_request_irq(link, orinoco_interrupt);
-+#else
-+ ret = pcmcia_request_irq(link, &link->irq);
-+#endif
- if (ret)
- goto failed;
-
-@@ -176,8 +293,16 @@ orinoco_cs_config(struct pcmcia_device *
- }
-
- /* Register an interface with the stack */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- if (orinoco_if_add(priv, link->resource[0]->start,
- link->irq, NULL) != 0) {
-+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
-+ if (orinoco_if_add(priv, link->io.BasePort1,
-+ link->irq, NULL) != 0) {
-+#else
-+ if (orinoco_if_add(priv, link->io.BasePort1,
-+ link->irq.AssignedIRQ, NULL) != 0) {
-+#endif
- printk(KERN_ERR PFX "orinoco_if_add() failed\n");
- goto failed;
- }
-@@ -331,7 +456,13 @@ MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_i
-
- static struct pcmcia_driver orinoco_driver = {
- .owner = THIS_MODULE,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- .name = DRIVER_NAME,
-+#else
-+ .drv = {
-+ .name = DRIVER_NAME,
-+ },
-+#endif
- .probe = orinoco_cs_probe,
- .remove = orinoco_cs_detach,
- .id_table = orinoco_cs_ids,
---- a/drivers/net/wireless/orinoco/spectrum_cs.c
-+++ b/drivers/net/wireless/orinoco/spectrum_cs.c
-@@ -170,6 +170,16 @@ spectrum_cs_probe(struct pcmcia_device *
- card->p_dev = link;
- link->priv = priv;
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
-+ /* Interrupt setup */
-+ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
-+ link->irq.Handler = orinoco_interrupt;
-+#endif
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
-+ link->conf.Attributes = 0;
-+ link->conf.IntType = INT_MEMORY_AND_IO;
-+#endif
-+
- return spectrum_cs_config(link);
- } /* spectrum_cs_attach */
-
-@@ -184,6 +194,7 @@ static void spectrum_cs_detach(struct pc
- free_orinocodev(priv);
- } /* spectrum_cs_detach */
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
- void *priv_data)
- {
-@@ -192,6 +203,98 @@ static int spectrum_cs_config_check(stru
-
- return pcmcia_request_io(p_dev);
- };
-+#else
-+static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
-+ cistpl_cftable_entry_t *cfg,
-+ cistpl_cftable_entry_t *dflt,
-+ unsigned int vcc,
-+ void *priv_data)
-+{
-+ if (cfg->index == 0)
-+ goto next_entry;
-+
-+ /* Use power settings for Vcc and Vpp if present */
-+ /* Note that the CIS values need to be rescaled */
-+ if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
-+ if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
-+ DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
-+ __func__, vcc,
-+ cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
-+ if (!ignore_cis_vcc)
-+ goto next_entry;
-+ }
-+ } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
-+ if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
-+ DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
-+ __func__, vcc,
-+ dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
-+ if (!ignore_cis_vcc)
-+ goto next_entry;
-+ }
-+ }
-+
-+ if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
-+ p_dev->conf.Vpp =
-+ cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
-+ else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
-+ p_dev->conf.Vpp =
-+ dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
-+
-+ /* Do we need to allocate an interrupt? */
-+ p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
-+
-+ /* IO window settings */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
-+ p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
-+#else
-+ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
-+#endif
-+ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
-+ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
-+ p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
-+ p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
-+ p_dev->resource[0]->flags |=
-+ pcmcia_io_cfg_data_width(io->flags);
-+ p_dev->resource[0]->start = io->win[0].base;
-+ p_dev->resource[0]->end = io->win[0].len;
-+#else
-+ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
-+ if (!(io->flags & CISTPL_IO_8BIT))
-+ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
-+ if (!(io->flags & CISTPL_IO_16BIT))
-+ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
-+ p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
-+ p_dev->io.BasePort1 = io->win[0].base;
-+ p_dev->io.NumPorts1 = io->win[0].len;
-+#endif
-+ if (io->nwin > 1) {
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
-+ p_dev->resource[1]->flags = p_dev->resource[0]->flags;
-+ p_dev->resource[1]->start = io->win[1].base;
-+ p_dev->resource[1]->end = io->win[1].len;
-+#else
-+ p_dev->io.Attributes2 = p_dev->io.Attributes1;
-+ p_dev->io.BasePort2 = io->win[1].base;
-+ p_dev->io.NumPorts2 = io->win[1].len;
-+#endif
-+ }
-+
-+ /* This reserves IO space but doesn't actually enable it */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
-+ if (pcmcia_request_io(p_dev) != 0)
-+#else
-+ if (pcmcia_request_io(p_dev, &p_dev->io) != 0)
-+#endif
-+ goto next_entry;
-+ }
-+ return 0;
-+
-+next_entry:
-+ pcmcia_disable_device(p_dev);
-+ return -ENODEV;
-+};
-+#endif
-
- static int
- spectrum_cs_config(struct pcmcia_device *link)
-@@ -201,10 +304,12 @@ spectrum_cs_config(struct pcmcia_device
- int ret;
- void __iomem *mem;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC |
- CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
- if (ignore_cis_vcc)
- link->config_flags &= ~CONF_AUTO_CHECK_VCC;
-+#endif
- ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL);
- if (ret) {
- if (!ignore_cis_vcc)
-@@ -214,8 +319,12 @@ spectrum_cs_config(struct pcmcia_device
- goto failed;
- }
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
- mem = ioport_map(link->resource[0]->start,
- resource_size(link->resource[0]));
-+#else
-+ mem = ioport_map(link->io.BasePort1, link->io.NumPorts1);
-+#endif
- if (!mem)
- goto failed;
-
-@@ -225,7 +334,11 @@ spectrum_cs_config(struct pcmcia_device
- hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
- hw->eeprom_pda = true;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- ret = pcmcia_request_irq(link, orinoco_interrupt);
-+#else
-+ ret = pcmcia_request_irq(link, &link->irq);
-+#endif
- if (ret)
- goto failed;
-
-@@ -244,8 +357,16 @@ spectrum_cs_config(struct pcmcia_device
- }
-
- /* Register an interface with the stack */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- if (orinoco_if_add(priv, link->resource[0]->start,
- link->irq, NULL) != 0) {
-+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
-+ if (orinoco_if_add(priv, link->io.BasePort1,
-+ link->irq, NULL) != 0) {
-+#else
-+ if (orinoco_if_add(priv, link->io.BasePort1,
-+ link->irq.AssignedIRQ, NULL) != 0) {
-+#endif
- printk(KERN_ERR PFX "orinoco_if_add() failed\n");
- goto failed;
- }
-@@ -311,7 +432,13 @@ MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_
-
- static struct pcmcia_driver orinoco_driver = {
- .owner = THIS_MODULE,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- .name = DRIVER_NAME,
-+#else
-+ .drv = {
-+ .name = DRIVER_NAME,
-+ },
-+#endif
- .probe = spectrum_cs_probe,
- .remove = spectrum_cs_detach,
- .suspend = spectrum_cs_suspend,
---- a/drivers/ssb/main.c
-+++ b/drivers/ssb/main.c
-@@ -517,7 +517,11 @@ static int ssb_devices_register(struct s
- break;
- case SSB_BUSTYPE_PCMCIA:
- #ifdef CONFIG_SSB_PCMCIAHOST
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- sdev->irq = bus->host_pcmcia->irq;
-+#else
-+ sdev->irq = bus->host_pcmcia->irq.AssignedIRQ;
-+#endif
- dev->parent = &bus->host_pcmcia->dev;
- #endif
- break;
--- /dev/null
+--- a/drivers/bluetooth/bluecard_cs.c
++++ b/drivers/bluetooth/bluecard_cs.c
+@@ -158,7 +158,12 @@
+ static void bluecard_activity_led_timeout(u_long arg)
+ {
+ bluecard_info_t *info = (bluecard_info_t *)arg;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
++
+
+ if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
+ return;
+@@ -175,7 +180,11 @@
+
+ static void bluecard_enable_activity_led(bluecard_info_t *info)
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+
+ if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
+ return;
+@@ -231,7 +240,11 @@
+ }
+
+ do {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+ unsigned int offset;
+ unsigned char command;
+ unsigned long ready_bit;
+@@ -378,7 +391,11 @@
+ return;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ iobase = info->p_dev->resource[0]->start;
++#else
++ iobase = info->p_dev->io.BasePort1;
++#endif
+
+ if (test_bit(XMIT_SENDING_READY, &(info->tx_state)))
+ bluecard_enable_activity_led(info);
+@@ -507,7 +524,11 @@
+ if (!test_bit(CARD_READY, &(info->hw_state)))
+ return IRQ_HANDLED;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ iobase = info->p_dev->resource[0]->start;
++#else
++ iobase = info->p_dev->io.BasePort1;
++#endif
+
+ spin_lock(&(info->lock));
+
+@@ -629,7 +650,11 @@
+ return 0;
+
+ if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+
+ /* Enable LED */
+ outb(0x08 | 0x20, iobase + 0x30);
+@@ -649,7 +674,11 @@
+ bluecard_hci_flush(hdev);
+
+ if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+
+ /* Disable LED */
+ outb(0x00, iobase + 0x30);
+@@ -705,7 +734,11 @@
+
+ static int bluecard_open(bluecard_info_t *info)
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+ struct hci_dev *hdev;
+ unsigned char id;
+
+@@ -821,7 +854,11 @@
+
+ static int bluecard_close(bluecard_info_t *info)
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+ struct hci_dev *hdev = info->hdev;
+
+ if (!hdev)
+@@ -856,7 +893,18 @@
+ info->p_dev = link;
+ link->priv = info;
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
++ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
++
++ link->irq.Handler = bluecard_interrupt;
++#endif
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ link->config_flags |= CONF_ENABLE_IRQ;
++#else
++ link->conf.Attributes = CONF_ENABLE_IRQ;
++ link->conf.IntType = INT_MEMORY_AND_IO;
++#endif
+
+ return bluecard_config(link);
+ }
+@@ -873,15 +921,30 @@
+ bluecard_info_t *info = link->priv;
+ int i, n;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ link->config_index = 0x20;
++#else
++ link->conf.ConfigIndex = 0x20;
++#endif
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
+ link->resource[0]->end = 64;
+ link->io_lines = 6;
++#else
++ link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
++ link->io.NumPorts1 = 64;
++ link->io.IOAddrLines = 6;
++#endif
+
+ for (n = 0; n < 0x400; n += 0x40) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ link->resource[0]->start = n ^ 0x300;
+ i = pcmcia_request_io(link);
++#else
++ link->io.BasePort1 = n ^ 0x300;
++ i = pcmcia_request_io(link, &link->io);
++#endif
+ if (i == 0)
+ break;
+ }
+@@ -889,9 +952,15 @@
+ if (i != 0)
+ goto failed;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ i = pcmcia_request_irq(link, bluecard_interrupt);
+ if (i != 0)
+ goto failed;
++#else
++ i = pcmcia_request_irq(link, &link->irq);
++ if (i != 0)
++ link->irq.AssignedIRQ = 0;
++#endif
+
+ i = pcmcia_enable_device(link);
+ if (i != 0)
+@@ -929,7 +998,13 @@
+
+ static struct pcmcia_driver bluecard_driver = {
+ .owner = THIS_MODULE,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ .name = "bluecard_cs",
++#else
++ .drv = {
++ .name = "bluecard_cs",
++ },
++#endif
+ .probe = bluecard_probe,
+ .remove = bluecard_detach,
+ .id_table = bluecard_ids,
--- /dev/null
+--- a/drivers/bluetooth/bt3c_cs.c
++++ b/drivers/bluetooth/bt3c_cs.c
+@@ -186,7 +186,11 @@
+ return;
+
+ do {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+ register struct sk_buff *skb;
+ int len;
+
+@@ -224,7 +228,11 @@
+ return;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ iobase = info->p_dev->resource[0]->start;
++#else
++ iobase = info->p_dev->io.BasePort1;
++#endif
+
+ avail = bt3c_read(iobase, 0x7006);
+ //printk("bt3c_cs: receiving %d bytes\n", avail);
+@@ -345,7 +353,11 @@
+ /* our irq handler is shared */
+ return IRQ_NONE;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ iobase = info->p_dev->resource[0]->start;
++#else
++ iobase = info->p_dev->io.BasePort1;
++#endif
+
+ spin_lock(&(info->lock));
+
+@@ -473,7 +485,11 @@
+ unsigned int iobase, size, addr, fcs, tmp;
+ int i, err = 0;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ iobase = info->p_dev->resource[0]->start;
++#else
++ iobase = info->p_dev->io.BasePort1;
++#endif
+
+ /* Reset */
+ bt3c_io_write(iobase, 0x8040, 0x0404);
+@@ -645,8 +661,27 @@
+ info->p_dev = link;
+ link->priv = info;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
+ CONF_AUTO_SET_IO;
++#else
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
++ link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
++ link->resource[0]->end = 8;
++#else
++ link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
++ link->io.NumPorts1= 8;
++#endif
++
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
++ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
++
++ link->irq.Handler = bt3c_interrupt;
++#endif
++
++ link->conf.Attributes = CONF_ENABLE_IRQ;
++ link->conf.IntType = INT_MEMORY_AND_IO;
++#endif
+
+ return bt3c_config(link);
+ }
+@@ -657,6 +692,7 @@
+ bt3c_release(link);
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data)
+ {
+ int *try = priv_data;
+@@ -695,6 +731,63 @@
+ }
+ return -ENODEV;
+ }
++#else
++static int bt3c_check_config(struct pcmcia_device *p_dev,
++ cistpl_cftable_entry_t *cf,
++ cistpl_cftable_entry_t *dflt,
++ unsigned int vcc,
++ void *priv_data)
++{
++ unsigned long try = (unsigned long) priv_data;
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
++ p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
++#endif
++
++ if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
++ p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
++ if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
++ (cf->io.win[0].base != 0)) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
++ p_dev->resource[0]->start = cf->io.win[0].base;
++ if (!pcmcia_request_io(p_dev))
++#else
++ p_dev->io.BasePort1 = cf->io.win[0].base;
++ p_dev->io.IOAddrLines = (try == 0) ? 16 :
++ cf->io.flags & CISTPL_IO_LINES_MASK;
++ if (!pcmcia_request_io(p_dev, &p_dev->io))
++#endif
++ return 0;
++ }
++ return -ENODEV;
++}
++
++static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
++ cistpl_cftable_entry_t *cf,
++ cistpl_cftable_entry_t *dflt,
++ unsigned int vcc,
++ void *priv_data)
++{
++ static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
++ int j;
++
++ if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
++ for (j = 0; j < 5; j++) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
++ p_dev->resource[0]->start = base[j];
++ p_dev->io_lines = base[j] ? 16 : 3;
++ if (!pcmcia_request_io(p_dev))
++#else
++ p_dev->io.BasePort1 = base[j];
++ p_dev->io.IOAddrLines = base[j] ? 16 : 3;
++ if (!pcmcia_request_io(p_dev, &p_dev->io))
++#endif
++ return 0;
++ }
++ }
++ return -ENODEV;
++}
++#endif
+
+ static int bt3c_config(struct pcmcia_device *link)
+ {
+@@ -718,9 +811,15 @@
+ goto failed;
+
+ found_port:
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ i = pcmcia_request_irq(link, &bt3c_interrupt);
+ if (i != 0)
+ goto failed;
++#else
++ i = pcmcia_request_irq(link, &link->irq);
++ if (i != 0)
++ link->irq.AssignedIRQ = 0;
++#endif
+
+ i = pcmcia_enable_device(link);
+ if (i != 0)
+@@ -755,7 +854,13 @@
+
+ static struct pcmcia_driver bt3c_driver = {
+ .owner = THIS_MODULE,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ .name = "bt3c_cs",
++#else
++ .drv = {
++ .name = "bt3c_cs",
++ },
++#endif
+ .probe = bt3c_probe,
+ .remove = bt3c_detach,
+ .id_table = bt3c_ids,
--- /dev/null
+--- a/drivers/bluetooth/btuart_cs.c
++++ b/drivers/bluetooth/btuart_cs.c
+@@ -140,7 +140,11 @@
+ }
+
+ do {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+ register struct sk_buff *skb;
+ int len;
+
+@@ -181,7 +185,11 @@
+ return;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ iobase = info->p_dev->resource[0]->start;
++#else
++ iobase = info->p_dev->io.BasePort1;
++#endif
+
+ do {
+ info->hdev->stat.byte_rx++;
+@@ -295,7 +303,11 @@
+ /* our irq handler is shared */
+ return IRQ_NONE;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ iobase = info->p_dev->resource[0]->start;
++#else
++ iobase = info->p_dev->io.BasePort1;
++#endif
+
+ spin_lock(&(info->lock));
+
+@@ -352,7 +364,11 @@
+ return;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ iobase = info->p_dev->resource[0]->start;
++#else
++ iobase = info->p_dev->io.BasePort1;
++#endif
+
+ spin_lock_irqsave(&(info->lock), flags);
+
+@@ -471,7 +487,11 @@
+ static int btuart_open(btuart_info_t *info)
+ {
+ unsigned long flags;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+ struct hci_dev *hdev;
+
+ spin_lock_init(&(info->lock));
+@@ -538,7 +558,11 @@
+ static int btuart_close(btuart_info_t *info)
+ {
+ unsigned long flags;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+ struct hci_dev *hdev = info->hdev;
+
+ if (!hdev)
+@@ -574,8 +598,27 @@
+ info->p_dev = link;
+ link->priv = info;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
+ CONF_AUTO_SET_IO;
++#else
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
++ link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
++ link->resource[0]->end = 8;
++#else
++ link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
++ link->io.NumPorts1= 8;
++#endif
++
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
++ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
++
++ link->irq.Handler = btuart_interrupt;
++#endif
++
++ link->conf.Attributes = CONF_ENABLE_IRQ;
++ link->conf.IntType = INT_MEMORY_AND_IO;
++#endif
+
+ return btuart_config(link);
+ }
+@@ -586,6 +629,7 @@
+ btuart_release(link);
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ static int btuart_check_config(struct pcmcia_device *p_dev, void *priv_data)
+ {
+ int *try = priv_data;
+@@ -624,6 +668,63 @@
+ }
+ return -ENODEV;
+ }
++#else
++static int btuart_check_config(struct pcmcia_device *p_dev,
++ cistpl_cftable_entry_t *cf,
++ cistpl_cftable_entry_t *dflt,
++ unsigned int vcc,
++ void *priv_data)
++{
++ int *try = priv_data;
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
++ p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
++#endif
++
++ if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
++ p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
++ if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
++ (cf->io.win[0].base != 0)) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
++ p_dev->resource[0]->start = cf->io.win[0].base;
++ if (!pcmcia_request_io(p_dev))
++#else
++ p_dev->io.BasePort1 = cf->io.win[0].base;
++ p_dev->io.IOAddrLines = (*try == 0) ? 16 :
++ cf->io.flags & CISTPL_IO_LINES_MASK;
++ if (!pcmcia_request_io(p_dev, &p_dev->io))
++#endif
++ return 0;
++ }
++ return -ENODEV;
++}
++
++static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
++ cistpl_cftable_entry_t *cf,
++ cistpl_cftable_entry_t *dflt,
++ unsigned int vcc,
++ void *priv_data)
++{
++ static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
++ int j;
++
++ if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
++ for (j = 0; j < 5; j++) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
++ p_dev->resource[0]->start = base[j];
++ p_dev->io_lines = base[j] ? 16 : 3;
++ if (!pcmcia_request_io(p_dev))
++#else
++ p_dev->io.BasePort1 = base[j];
++ p_dev->io.IOAddrLines = base[j] ? 16 : 3;
++ if (!pcmcia_request_io(p_dev, &p_dev->io))
++#endif
++ return 0;
++ }
++ }
++ return -ENODEV;
++}
++#endif
+
+ static int btuart_config(struct pcmcia_device *link)
+ {
+@@ -647,9 +748,15 @@
+ goto failed;
+
+ found_port:
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ i = pcmcia_request_irq(link, btuart_interrupt);
+ if (i != 0)
+ goto failed;
++#else
++ i = pcmcia_request_irq(link, &link->irq);
++ if (i != 0)
++ link->irq.AssignedIRQ = 0;
++#endif
+
+ i = pcmcia_enable_device(link);
+ if (i != 0)
+@@ -683,7 +790,13 @@
+
+ static struct pcmcia_driver btuart_driver = {
+ .owner = THIS_MODULE,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ .name = "btuart_cs",
++#else
++ .drv = {
++ .name = "btuart_cs",
++ },
++#endif
+ .probe = btuart_probe,
+ .remove = btuart_detach,
+ .id_table = btuart_ids,
--- /dev/null
+--- a/drivers/bluetooth/dtl1_cs.c
++++ b/drivers/bluetooth/dtl1_cs.c
+@@ -144,7 +144,11 @@
+ }
+
+ do {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+ register struct sk_buff *skb;
+ int len;
+
+@@ -209,7 +213,11 @@
+ return;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ iobase = info->p_dev->resource[0]->start;
++#else
++ iobase = info->p_dev->io.BasePort1;
++#endif
+
+ do {
+ info->hdev->stat.byte_rx++;
+@@ -296,7 +304,11 @@
+ /* our irq handler is shared */
+ return IRQ_NONE;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ iobase = info->p_dev->resource[0]->start;
++#else
++ iobase = info->p_dev->io.BasePort1;
++#endif
+
+ spin_lock(&(info->lock));
+
+@@ -451,7 +463,11 @@
+ static int dtl1_open(dtl1_info_t *info)
+ {
+ unsigned long flags;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+ struct hci_dev *hdev;
+
+ spin_lock_init(&(info->lock));
+@@ -495,8 +511,13 @@
+ outb(UART_LCR_WLEN8, iobase + UART_LCR); /* Reset DLAB */
+ outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase + UART_MCR);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ info->ri_latch = inb(info->p_dev->resource[0]->start + UART_MSR)
+ & UART_MSR_RI;
++#else
++ info->ri_latch = inb(info->p_dev->io.BasePort1 + UART_MSR)
++ & UART_MSR_RI;
++#endif
+
+ /* Turn on interrupts */
+ outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
+@@ -521,7 +542,11 @@
+ static int dtl1_close(dtl1_info_t *info)
+ {
+ unsigned long flags;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ unsigned int iobase = info->p_dev->resource[0]->start;
++#else
++ unsigned int iobase = info->p_dev->io.BasePort1;
++#endif
+ struct hci_dev *hdev = info->hdev;
+
+ if (!hdev)
+@@ -557,7 +582,24 @@
+ info->p_dev = link;
+ link->priv = info;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
++#else
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
++ link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
++ link->resource[0]->end = 8;
++#else
++ link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
++ link->io.NumPorts1= 8;
++#endif
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
++ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
++ link->irq.Handler = dtl1_interrupt;
++#endif
++
++ link->conf.Attributes = CONF_ENABLE_IRQ;
++ link->conf.IntType = INT_MEMORY_AND_IO;
++#endif
+
+ return dtl1_config(link);
+ }
+@@ -571,6 +613,7 @@
+ pcmcia_disable_device(link);
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data)
+ {
+ if ((p_dev->resource[1]->end) || (p_dev->resource[1]->end < 8))
+@@ -581,6 +624,29 @@
+
+ return pcmcia_request_io(p_dev);
+ }
++#else
++static int dtl1_confcheck(struct pcmcia_device *p_dev,
++ cistpl_cftable_entry_t *cf,
++ cistpl_cftable_entry_t *dflt,
++ unsigned int vcc,
++ void *priv_data)
++{
++ if ((cf->io.nwin != 1) || (cf->io.win[0].len <= 8))
++ return -ENODEV;
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
++ p_dev->resource[0]->start = cf->io.win[0].base;
++ p_dev->resource[0]->end = cf->io.win[0].len; /*yo */
++ p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK;
++ return pcmcia_request_io(p_dev);
++#else
++ p_dev->io.BasePort1 = cf->io.win[0].base;
++ p_dev->io.NumPorts1 = cf->io.win[0].len; /*yo */
++ p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
++ return pcmcia_request_io(p_dev, &p_dev->io);
++#endif
++}
++#endif
+
+ static int dtl1_config(struct pcmcia_device *link)
+ {
+@@ -588,14 +654,24 @@
+ int ret;
+
+ /* Look for a generic full-sized window */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ link->resource[0]->end = 8;
++#else
++ link->io.NumPorts1 = 8;
++#endif
+ ret = pcmcia_loop_config(link, dtl1_confcheck, NULL);
+ if (ret)
+ goto failed;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ ret = pcmcia_request_irq(link, dtl1_interrupt);
+ if (ret)
+ goto failed;
++#else
++ ret = pcmcia_request_irq(link, &link->irq);
++ if (ret != 0)
++ link->irq.AssignedIRQ = 0;
++#endif
+
+ ret = pcmcia_enable_device(link);
+ if (ret)
+@@ -623,7 +699,13 @@
+
+ static struct pcmcia_driver dtl1_driver = {
+ .owner = THIS_MODULE,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ .name = "dtl1_cs",
++#else
++ .drv = {
++ .name = "dtl1_cs",
++ },
++#endif
+ .probe = dtl1_probe,
+ .remove = dtl1_detach,
+ .id_table = dtl1_ids,
--- /dev/null
+--- a/drivers/net/wireless/b43/pcmcia.c
++++ b/drivers/net/wireless/b43/pcmcia.c
+@@ -63,6 +63,9 @@
+ static int b43_pcmcia_probe(struct pcmcia_device *dev)
+ {
+ struct ssb_bus *ssb;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
++ win_req_t win;
++#endif
+ int err = -ENOMEM;
+ int res = 0;
+
+@@ -72,6 +75,7 @@
+
+ err = -ENODEV;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ dev->config_flags |= CONF_ENABLE_IRQ;
+
+ dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 |
+@@ -79,21 +83,46 @@
+ dev->resource[2]->start = 0;
+ dev->resource[2]->end = SSB_CORE_SIZE;
+ res = pcmcia_request_window(dev, dev->resource[2], 250);
++#else
++ dev->conf.Attributes = CONF_ENABLE_IRQ;
++ dev->conf.IntType = INT_MEMORY_AND_IO;
++
++ win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 |
++ WIN_USE_WAIT;
++ win.Base = 0;
++ win.Size = SSB_CORE_SIZE;
++ win.AccessSpeed = 250;
++ res = pcmcia_request_window(dev, &win, &dev->win);
++#endif
+ if (res != 0)
+ goto err_kfree_ssb;
+-
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ res = pcmcia_map_mem_page(dev, dev->resource[2], 0);
++#else
++ res = pcmcia_map_mem_page(dev, dev->win, 0);
++#endif
+ if (res != 0)
+ goto err_disable;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ if (!dev->irq)
++#else
++ dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
++ dev->irq.Handler = NULL; /* The handler is registered later. */
++ res = pcmcia_request_irq(dev, &dev->irq);
++ if (res != 0)
++#endif
+ goto err_disable;
+
+ res = pcmcia_enable_device(dev);
+ if (res != 0)
+ goto err_disable;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start);
++#else
++ err = ssb_bus_pcmciabus_register(ssb, dev, win.Base);
++#endif
+ if (err)
+ goto err_disable;
+ dev->priv = ssb;
+@@ -122,7 +151,13 @@
+
+ static struct pcmcia_driver b43_pcmcia_driver = {
+ .owner = THIS_MODULE,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ .name = "b43-pcmcia",
++#else
++ .drv = {
++ .name = "b43-pcmcia",
++ },
++#endif
+ .id_table = b43_pcmcia_tbl,
+ .probe = b43_pcmcia_probe,
+ .remove = b43_pcmcia_remove,
--- /dev/null
+--- a/drivers/net/wireless/libertas/if_cs.c
++++ b/drivers/net/wireless/libertas/if_cs.c
+@@ -757,7 +757,11 @@
+ goto out;
+
+ /* Now actually get the IRQ */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ ret = request_irq(card->p_dev->irq, if_cs_interrupt,
++#else
++ ret = request_irq(card->p_dev->irq.AssignedIRQ, if_cs_interrupt,
++#endif
+ IRQF_SHARED, DRV_NAME, card);
+ if (ret) {
+ pr_err("error in request_irq\n");
+@@ -775,7 +779,11 @@
+ priv->fw_ready = 1;
+ if (lbs_start_card(priv) != 0) {
+ pr_err("could not activate card\n");
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ free_irq(card->p_dev->irq, card);
++#else
++ free_irq(card->p_dev->irq.AssignedIRQ, card);
++#endif
+ }
+
+ out:
+@@ -824,7 +832,11 @@
+
+ lbs_deb_enter(LBS_DEB_CS);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ free_irq(p_dev->irq, card);
++#else
++ free_irq(p_dev->irq.AssignedIRQ, card);
++#endif
+ pcmcia_disable_device(p_dev);
+ if (card->iobase)
+ ioport_unmap(card->iobase);
+@@ -832,7 +844,7 @@
+ lbs_deb_leave(LBS_DEB_CS);
+ }
+
+-
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data)
+ {
+ p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
+@@ -842,9 +854,39 @@
+ pr_err("wrong CIS (check number of IO windows)\n");
+ return -ENODEV;
+ }
++#else
++static int if_cs_ioprobe(struct pcmcia_device *p_dev,
++ cistpl_cftable_entry_t *cfg,
++ cistpl_cftable_entry_t *dflt,
++ unsigned int vcc,
++ void *priv_data)
++{
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
++ p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
++ p_dev->resource[0]->start = cfg->io.win[0].base;
++ p_dev->resource[0]->end = cfg->io.win[0].len;
++#else
++ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
++ p_dev->io.BasePort1 = cfg->io.win[0].base;
++ p_dev->io.NumPorts1 = cfg->io.win[0].len;
++#endif
++
++ /* Do we need to allocate an interrupt? */
++ p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
++
++ /* IO window settings */
++ if (cfg->io.nwin != 1) {
++ pr_err("wrong CIS (check number of IO windows)\n");
++ return -ENODEV;
++ }
++#endif
+
+ /* This reserves IO space but doesn't actually enable it */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ return pcmcia_request_io(p_dev);
++#else
++ return pcmcia_request_io(p_dev, &p_dev->io);
++#endif
+ }
+
+ static int if_cs_probe(struct pcmcia_device *p_dev)
+@@ -863,7 +905,16 @@
+ card->p_dev = p_dev;
+ p_dev->priv = card;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
++#else
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
++ p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
++ p_dev->irq.Handler = NULL;
++#endif
++ p_dev->conf.Attributes = 0;
++ p_dev->conf.IntType = INT_MEMORY_AND_IO;
++#endif
+
+ if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) {
+ pr_err("error in pcmcia_loop_config\n");
+@@ -875,12 +926,26 @@
+ * a handler to the interrupt, unless the 'Handler' member of
+ * the irq structure is initialized.
+ */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ if (!p_dev->irq)
+ goto out1;
++#else
++ if (p_dev->conf.Attributes & CONF_ENABLE_IRQ) {
++ ret = pcmcia_request_irq(p_dev, &p_dev->irq);
++ if (ret) {
++ pr_err("error in pcmcia_request_irq\n");
++ goto out1;
++ }
++ }
++#endif
+
+ /* Initialize io access */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ card->iobase = ioport_map(p_dev->resource[0]->start,
+ resource_size(p_dev->resource[0]));
++#else
++ card->iobase = ioport_map(p_dev->io.BasePort1, p_dev->io.NumPorts1);
++#endif
+ if (!card->iobase) {
+ pr_err("error in ioport_map\n");
+ ret = -EIO;
+@@ -894,7 +959,17 @@
+ }
+
+ /* Finally, report what we've done */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ lbs_deb_cs("irq %d, io %pR", p_dev->irq, p_dev->resource[0]);
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
++ lbs_deb_cs("irq %d, io 0x%04x-0x%04x\n",
++ p_dev->irq, p_dev->io.BasePort1,
++ p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1);
++#else
++ lbs_deb_cs("irq %d, io 0x%04x-0x%04x\n",
++ p_dev->irq.AssignedIRQ, p_dev->io.BasePort1,
++ p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1);
++#endif
+
+ /*
+ * Most of the libertas cards can do unaligned register access, but some
+@@ -1001,7 +1076,13 @@
+
+ static struct pcmcia_driver lbs_driver = {
+ .owner = THIS_MODULE,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ .name = DRV_NAME,
++#else
++ .drv = {
++ .name = DRV_NAME,
++ },
++#endif
+ .probe = if_cs_probe,
+ .remove = if_cs_detach,
+ .id_table = if_cs_ids,
--- /dev/null
+--- a/drivers/net/wireless/orinoco/orinoco_cs.c
++++ b/drivers/net/wireless/orinoco/orinoco_cs.c
+@@ -78,7 +78,11 @@
+ /* We need atomic ops here, because we're not holding the lock */
+ set_bit(0, &card->hard_reset_in_progress);
+
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,27)
++ err = pcmcia_reset_card(link, NULL);
++#else
+ err = pcmcia_reset_card(link->socket);
++#endif
+ if (err)
+ return err;
+
+@@ -108,6 +112,16 @@
+ card->p_dev = link;
+ link->priv = priv;
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
++ /* Interrupt setup */
++ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
++ link->irq.Handler = orinoco_interrupt;
++#endif
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
++ link->conf.Attributes = 0;
++ link->conf.IntType = INT_MEMORY_AND_IO;
++#endif
++
+ return orinoco_cs_config(link);
+ } /* orinoco_cs_attach */
+
+@@ -122,6 +136,7 @@
+ free_orinocodev(priv);
+ } /* orinoco_cs_detach */
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ static int orinoco_cs_config_check(struct pcmcia_device *p_dev, void *priv_data)
+ {
+ if (p_dev->config_index == 0)
+@@ -129,6 +144,98 @@
+
+ return pcmcia_request_io(p_dev);
+ };
++#else
++static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
++ cistpl_cftable_entry_t *cfg,
++ cistpl_cftable_entry_t *dflt,
++ unsigned int vcc,
++ void *priv_data)
++{
++ if (cfg->index == 0)
++ goto next_entry;
++
++ /* Use power settings for Vcc and Vpp if present */
++ /* Note that the CIS values need to be rescaled */
++ if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
++ if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
++ DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
++ __func__, vcc,
++ cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
++ if (!ignore_cis_vcc)
++ goto next_entry;
++ }
++ } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
++ if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
++ DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
++ __func__, vcc,
++ dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
++ if (!ignore_cis_vcc)
++ goto next_entry;
++ }
++ }
++
++ if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
++ p_dev->conf.Vpp =
++ cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
++ else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
++ p_dev->conf.Vpp =
++ dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
++
++ /* Do we need to allocate an interrupt? */
++ p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
++
++ /* IO window settings */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++ p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
++#else
++ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
++#endif
++ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
++ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++ p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
++ p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
++ p_dev->resource[0]->flags |=
++ pcmcia_io_cfg_data_width(io->flags);
++ p_dev->resource[0]->start = io->win[0].base;
++ p_dev->resource[0]->end = io->win[0].len;
++#else
++ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
++ if (!(io->flags & CISTPL_IO_8BIT))
++ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
++ if (!(io->flags & CISTPL_IO_16BIT))
++ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
++ p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
++ p_dev->io.BasePort1 = io->win[0].base;
++ p_dev->io.NumPorts1 = io->win[0].len;
++#endif
++ if (io->nwin > 1) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++ p_dev->resource[1]->flags = p_dev->resource[0]->flags;
++ p_dev->resource[1]->start = io->win[1].base;
++ p_dev->resource[1]->end = io->win[1].len;
++#else
++ p_dev->io.Attributes2 = p_dev->io.Attributes1;
++ p_dev->io.BasePort2 = io->win[1].base;
++ p_dev->io.NumPorts2 = io->win[1].len;
++#endif
++ }
++
++ /* This reserves IO space but doesn't actually enable it */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++ if (pcmcia_request_io(p_dev) != 0)
++#else
++ if (pcmcia_request_io(p_dev, &p_dev->io) != 0)
++#endif
++ goto next_entry;
++ }
++ return 0;
++
++next_entry:
++ pcmcia_disable_device(p_dev);
++ return -ENODEV;
++};
++#endif
+
+ static int
+ orinoco_cs_config(struct pcmcia_device *link)
+@@ -138,10 +245,12 @@
+ int ret;
+ void __iomem *mem;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC |
+ CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
+ if (ignore_cis_vcc)
+ link->config_flags &= ~CONF_AUTO_CHECK_VCC;
++#endif
+ ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL);
+ if (ret) {
+ if (!ignore_cis_vcc)
+@@ -151,8 +260,12 @@
+ goto failed;
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+ mem = ioport_map(link->resource[0]->start,
+ resource_size(link->resource[0]));
++#else
++ mem = ioport_map(link->io.BasePort1, link->io.NumPorts1);
++#endif
+ if (!mem)
+ goto failed;
+
+@@ -161,7 +274,11 @@
+ * called. */
+ hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ ret = pcmcia_request_irq(link, orinoco_interrupt);
++#else
++ ret = pcmcia_request_irq(link, &link->irq);
++#endif
+ if (ret)
+ goto failed;
+
+@@ -176,8 +293,16 @@
+ }
+
+ /* Register an interface with the stack */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ if (orinoco_if_add(priv, link->resource[0]->start,
+ link->irq, NULL) != 0) {
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
++ if (orinoco_if_add(priv, link->io.BasePort1,
++ link->irq, NULL) != 0) {
++#else
++ if (orinoco_if_add(priv, link->io.BasePort1,
++ link->irq.AssignedIRQ, NULL) != 0) {
++#endif
+ printk(KERN_ERR PFX "orinoco_if_add() failed\n");
+ goto failed;
+ }
+@@ -331,7 +456,13 @@
+
+ static struct pcmcia_driver orinoco_driver = {
+ .owner = THIS_MODULE,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ .name = DRIVER_NAME,
++#else
++ .drv = {
++ .name = DRIVER_NAME,
++ },
++#endif
+ .probe = orinoco_cs_probe,
+ .remove = orinoco_cs_detach,
+ .id_table = orinoco_cs_ids,
--- /dev/null
+--- a/drivers/net/wireless/orinoco/spectrum_cs.c
++++ b/drivers/net/wireless/orinoco/spectrum_cs.c
+@@ -170,6 +170,16 @@
+ card->p_dev = link;
+ link->priv = priv;
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
++ /* Interrupt setup */
++ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
++ link->irq.Handler = orinoco_interrupt;
++#endif
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
++ link->conf.Attributes = 0;
++ link->conf.IntType = INT_MEMORY_AND_IO;
++#endif
++
+ return spectrum_cs_config(link);
+ } /* spectrum_cs_attach */
+
+@@ -184,6 +194,7 @@
+ free_orinocodev(priv);
+ } /* spectrum_cs_detach */
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
+ void *priv_data)
+ {
+@@ -192,6 +203,98 @@
+
+ return pcmcia_request_io(p_dev);
+ };
++#else
++static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
++ cistpl_cftable_entry_t *cfg,
++ cistpl_cftable_entry_t *dflt,
++ unsigned int vcc,
++ void *priv_data)
++{
++ if (cfg->index == 0)
++ goto next_entry;
++
++ /* Use power settings for Vcc and Vpp if present */
++ /* Note that the CIS values need to be rescaled */
++ if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
++ if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
++ DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
++ __func__, vcc,
++ cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
++ if (!ignore_cis_vcc)
++ goto next_entry;
++ }
++ } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
++ if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
++ DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
++ __func__, vcc,
++ dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
++ if (!ignore_cis_vcc)
++ goto next_entry;
++ }
++ }
++
++ if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
++ p_dev->conf.Vpp =
++ cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
++ else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
++ p_dev->conf.Vpp =
++ dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
++
++ /* Do we need to allocate an interrupt? */
++ p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
++
++ /* IO window settings */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++ p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
++#else
++ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
++#endif
++ if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
++ cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++ p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
++ p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
++ p_dev->resource[0]->flags |=
++ pcmcia_io_cfg_data_width(io->flags);
++ p_dev->resource[0]->start = io->win[0].base;
++ p_dev->resource[0]->end = io->win[0].len;
++#else
++ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
++ if (!(io->flags & CISTPL_IO_8BIT))
++ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
++ if (!(io->flags & CISTPL_IO_16BIT))
++ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
++ p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
++ p_dev->io.BasePort1 = io->win[0].base;
++ p_dev->io.NumPorts1 = io->win[0].len;
++#endif
++ if (io->nwin > 1) {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++ p_dev->resource[1]->flags = p_dev->resource[0]->flags;
++ p_dev->resource[1]->start = io->win[1].base;
++ p_dev->resource[1]->end = io->win[1].len;
++#else
++ p_dev->io.Attributes2 = p_dev->io.Attributes1;
++ p_dev->io.BasePort2 = io->win[1].base;
++ p_dev->io.NumPorts2 = io->win[1].len;
++#endif
++ }
++
++ /* This reserves IO space but doesn't actually enable it */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++ if (pcmcia_request_io(p_dev) != 0)
++#else
++ if (pcmcia_request_io(p_dev, &p_dev->io) != 0)
++#endif
++ goto next_entry;
++ }
++ return 0;
++
++next_entry:
++ pcmcia_disable_device(p_dev);
++ return -ENODEV;
++};
++#endif
+
+ static int
+ spectrum_cs_config(struct pcmcia_device *link)
+@@ -201,10 +304,12 @@
+ int ret;
+ void __iomem *mem;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC |
+ CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
+ if (ignore_cis_vcc)
+ link->config_flags &= ~CONF_AUTO_CHECK_VCC;
++#endif
+ ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL);
+ if (ret) {
+ if (!ignore_cis_vcc)
+@@ -214,8 +319,12 @@
+ goto failed;
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+ mem = ioport_map(link->resource[0]->start,
+ resource_size(link->resource[0]));
++#else
++ mem = ioport_map(link->io.BasePort1, link->io.NumPorts1);
++#endif
+ if (!mem)
+ goto failed;
+
+@@ -225,7 +334,11 @@
+ hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
+ hw->eeprom_pda = true;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ ret = pcmcia_request_irq(link, orinoco_interrupt);
++#else
++ ret = pcmcia_request_irq(link, &link->irq);
++#endif
+ if (ret)
+ goto failed;
+
+@@ -244,8 +357,16 @@
+ }
+
+ /* Register an interface with the stack */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ if (orinoco_if_add(priv, link->resource[0]->start,
+ link->irq, NULL) != 0) {
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
++ if (orinoco_if_add(priv, link->io.BasePort1,
++ link->irq, NULL) != 0) {
++#else
++ if (orinoco_if_add(priv, link->io.BasePort1,
++ link->irq.AssignedIRQ, NULL) != 0) {
++#endif
+ printk(KERN_ERR PFX "orinoco_if_add() failed\n");
+ goto failed;
+ }
+@@ -311,7 +432,13 @@
+
+ static struct pcmcia_driver orinoco_driver = {
+ .owner = THIS_MODULE,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ .name = DRIVER_NAME,
++#else
++ .drv = {
++ .name = DRIVER_NAME,
++ },
++#endif
+ .probe = spectrum_cs_probe,
+ .remove = spectrum_cs_detach,
+ .suspend = spectrum_cs_suspend,
--- /dev/null
+--- a/drivers/ssb/main.c
++++ b/drivers/ssb/main.c
+@@ -517,7 +517,11 @@
+ break;
+ case SSB_BUSTYPE_PCMCIA:
+ #ifdef CONFIG_SSB_PCMCIAHOST
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ sdev->irq = bus->host_pcmcia->irq;
++#else
++ sdev->irq = bus->host_pcmcia->irq.AssignedIRQ;
++#endif
+ dev->parent = &bus->host_pcmcia->dev;
+ #endif
+ break;
+++ /dev/null
-Backport commit 22bedad3ce112d5ca1eaf043d4990fa2ed698c87:
- net: convert multicast list to list_head
-
- Converts the list and the core manipulating with it to be the same as uc_list.
-
- +uses two functions for adding/removing mc address (normal and "global"
- variant) instead of a function parameter.
- +removes dev_mcast.c completely.
- +exposes netdev_hw_addr_list_* macros along with __hw_addr_* functions for
- manipulation with lists on a sandbox (used in bonding and 80211 drivers)
-
-This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
-
---- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
-+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
-@@ -410,7 +410,11 @@ static void atl1c_set_multi(struct net_d
-
- /* comoute mc addresses' hash value ,and put it into hash table */
- netdev_for_each_mc_addr(ha, netdev) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- hash_value = atl1c_hash_mc_addr(hw, ha->addr);
-+#else
-+ hash_value = atl1c_hash_mc_addr(hw, ha->dmi_addr);
-+#endif
- atl1c_hash_set(hw, hash_value);
- }
- }
---- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
-+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
-@@ -308,7 +308,11 @@ static void atl1e_set_multi(struct net_d
-
- /* comoute mc addresses' hash value ,and put it into hash table */
- netdev_for_each_mc_addr(ha, netdev) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- hash_value = atl1e_hash_mc_addr(hw, ha->addr);
-+#else
-+ hash_value = atl1e_hash_mc_addr(hw, ha->dmi_addr);
-+#endif
- atl1e_hash_set(hw, hash_value);
- }
- }
---- a/drivers/net/ethernet/atheros/atlx/atl2.c
-+++ b/drivers/net/ethernet/atheros/atlx/atl2.c
-@@ -159,7 +159,11 @@ static void atl2_set_multi(struct net_de
-
- /* comoute mc addresses' hash value ,and put it into hash table */
- netdev_for_each_mc_addr(ha, netdev) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- hash_value = atl2_hash_mc_addr(hw, ha->addr);
-+#else
-+ hash_value = atl2_hash_mc_addr(hw, ha->dmi_addr);
-+#endif
- atl2_hash_set(hw, hash_value);
- }
- }
---- a/drivers/net/ethernet/atheros/atlx/atlx.c
-+++ b/drivers/net/ethernet/atheros/atlx/atlx.c
-@@ -149,7 +149,11 @@ static void atlx_set_multi(struct net_de
-
- /* compute mc addresses' hash value ,and put it into hash table */
- netdev_for_each_mc_addr(ha, netdev) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- hash_value = atlx_hash_mc_addr(hw, ha->addr);
-+#else
-+ hash_value = atlx_hash_mc_addr(hw, ha->dmi_addr);
-+#endif
- atlx_hash_set(hw, hash_value);
- }
- }
---- a/drivers/net/ethernet/broadcom/b44.c
-+++ b/drivers/net/ethernet/broadcom/b44.c
-@@ -1693,7 +1693,11 @@ static int __b44_load_mcast(struct b44 *
- netdev_for_each_mc_addr(ha, dev) {
- if (i == num_ents)
- break;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- __b44_cam_write(bp, ha->addr, i++ + 1);
-+#else
-+ __b44_cam_write(bp, ha->dmi_addr, i++ + 1);
-+#endif
- }
- return i+1;
- }
---- a/drivers/net/wireless/adm8211.c
-+++ b/drivers/net/wireless/adm8211.c
-@@ -1320,19 +1320,37 @@ static void adm8211_bss_info_changed(str
- }
-
- static u64 adm8211_prepare_multicast(struct ieee80211_hw *hw,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr_list *mc_list)
-+#else
-+ int mc_count, struct dev_addr_list *ha)
-+#endif
- {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- unsigned int bit_nr;
-- u32 mc_filter[2];
- struct netdev_hw_addr *ha;
-+#else
-+ unsigned int bit_nr, i;
-+#endif
-+ u32 mc_filter[2];
-
- mc_filter[1] = mc_filter[0] = 0;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- netdev_hw_addr_list_for_each(ha, mc_list) {
- bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
-+#else
-+ for (i = 0; i < mc_count; i++) {
-+ if (!ha)
-+ break;
-+ bit_nr = ether_crc(ETH_ALEN, ha->dmi_addr) >> 26;
-+#endif
-
- bit_nr &= 0x3F;
- mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
-+ ha = ha->next;
-+#endif
- }
-
- return mc_filter[0] | ((u64)(mc_filter[1]) << 32);
---- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
-+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
-@@ -318,20 +318,42 @@ ath5k_bss_info_changed(struct ieee80211_
-
- static u64
- ath5k_prepare_multicast(struct ieee80211_hw *hw,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr_list *mc_list)
-+#else
-+ int mc_count, struct dev_addr_list *ha)
-+#endif
- {
- u32 mfilt[2], val;
- u8 pos;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr *ha;
-+#else
-+ int i;
-+#endif
-
- mfilt[0] = 0;
- mfilt[1] = 1;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- netdev_hw_addr_list_for_each(ha, mc_list) {
-+#else
-+ for (i = 0; i < mc_count; i++) {
-+ if (!ha)
-+ break;
-+#endif
- /* calculate XOR of eight 6-bit values */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- val = get_unaligned_le32(ha->addr + 0);
-+#else
-+ val = get_unaligned_le32(ha->dmi_addr + 0);
-+#endif
- pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- val = get_unaligned_le32(ha->addr + 3);
-+#else
-+ val = get_unaligned_le32(ha->dmi_addr + 3);
-+#endif
- pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
- pos &= 0x3f;
- mfilt[pos / 32] |= (1 << (pos % 32));
-@@ -340,6 +362,9 @@ ath5k_prepare_multicast(struct ieee80211
- * need to inform below not to reset the mcast */
- /* ath5k_hw_set_mcast_filterindex(ah,
- * ha->addr[5]); */
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
-+ ha = ha->next;
-+#endif
- }
-
- return ((u64)(mfilt[1]) << 32) | mfilt[0];
---- a/drivers/net/wireless/ath/carl9170/main.c
-+++ b/drivers/net/wireless/ath/carl9170/main.c
-@@ -967,17 +967,35 @@ out:
- return err;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- static u64 carl9170_op_prepare_multicast(struct ieee80211_hw *hw,
- struct netdev_hw_addr_list *mc_list)
-+#else
-+static u64 carl9170_op_prepare_multicast(struct ieee80211_hw *hw, int mc_count,
-+ struct dev_addr_list *ha)
-+#endif
- {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr *ha;
-+#else
-+ int i;
-+#endif
- u64 mchash;
-
- /* always get broadcast frames */
- mchash = 1ULL << (0xff >> 2);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- netdev_hw_addr_list_for_each(ha, mc_list)
- mchash |= 1ULL << (ha->addr[5] >> 2);
-+#else
-+ for (i = 0; i < mc_count; i++) {
-+ if (WARN_ON(!ha))
-+ break;
-+ mchash |= 1ULL << (ha->dmi_addr[5] >> 2);
-+ ha = ha->next;
-+ }
-+#endif
-
- return mchash;
- }
---- a/drivers/net/wireless/libertas/main.c
-+++ b/drivers/net/wireless/libertas/main.c
-@@ -349,18 +349,34 @@ static int lbs_add_mcast_addrs(struct cm
- netif_addr_lock_bh(dev);
- cnt = netdev_mc_count(dev);
- netdev_for_each_mc_addr(ha, dev) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- if (mac_in_list(cmd->maclist, nr_addrs, ha->addr)) {
-+#else
-+ if (mac_in_list(cmd->maclist, nr_addrs, ha->dmi_addr)) {
-+#endif
- lbs_deb_net("mcast address %s:%pM skipped\n", dev->name,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- ha->addr);
-+#else
-+ ha->dmi_addr);
-+#endif
- cnt--;
- continue;
- }
-
- if (i == MRVDRV_MAX_MULTICAST_LIST_SIZE)
- break;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- memcpy(&cmd->maclist[6*i], ha->addr, ETH_ALEN);
-+#else
-+ memcpy(&cmd->maclist[6*i], ha->dmi_addr, ETH_ALEN);
-+#endif
- lbs_deb_net("mcast address %s:%pM added to filter\n", dev->name,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- ha->addr);
-+#else
-+ ha->dmi_addr);
-+#endif
- i++;
- cnt--;
- }
---- a/drivers/net/wireless/libertas_tf/main.c
-+++ b/drivers/net/wireless/libertas_tf/main.c
-@@ -421,20 +421,36 @@ static int lbtf_op_config(struct ieee802
- }
-
- static u64 lbtf_op_prepare_multicast(struct ieee80211_hw *hw,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr_list *mc_list)
-+#else
-+ int mc_count, struct dev_addr_list *ha)
-+#endif
- {
- struct lbtf_private *priv = hw->priv;
- int i;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr *ha;
- int mc_count = netdev_hw_addr_list_count(mc_list);
-+#endif
-
- if (!mc_count || mc_count > MRVDRV_MAX_MULTICAST_LIST_SIZE)
- return mc_count;
-
- priv->nr_of_multicastmacaddr = mc_count;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- i = 0;
- netdev_hw_addr_list_for_each(ha, mc_list)
- memcpy(&priv->multicastlist[i++], ha->addr, ETH_ALEN);
-+#else
-+ for (i = 0; i < mc_count; i++) {
-+ if (!ha)
-+ break;
-+ memcpy(&priv->multicastlist[i], ha->da_addr,
-+ ETH_ALEN);
-+ ha = ha->next;
-+ }
-+#endif
-
- return mc_count;
- }
---- a/drivers/net/wireless/mwifiex/sta_ioctl.c
-+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
-@@ -43,7 +43,11 @@ int mwifiex_copy_mcast_addr(struct mwifi
- struct netdev_hw_addr *ha;
-
- netdev_for_each_mc_addr(ha, dev)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- memcpy(&mlist->mac_list[i++], ha->addr, ETH_ALEN);
-+#else
-+ memcpy(&mlist->mac_list[i++], ha->dmi_addr, ETH_ALEN);
-+#endif
-
- return i;
- }
---- a/drivers/net/wireless/mwifiex/debugfs.c
-+++ b/drivers/net/wireless/mwifiex/debugfs.c
-@@ -215,7 +215,11 @@ mwifiex_info_read(struct file *file, cha
-
- netdev_for_each_mc_addr(ha, netdev)
- p += sprintf(p, "multicast_address[%d]=\"%pM\"\n",
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- i++, ha->addr);
-+#else
-+ i++, ha->dmi_addr);
-+#endif
- }
-
- p += sprintf(p, "num_tx_bytes = %lu\n", priv->stats.tx_bytes);
---- a/drivers/net/wireless/mwl8k.c
-+++ b/drivers/net/wireless/mwl8k.c
-@@ -2656,15 +2656,21 @@ struct mwl8k_cmd_mac_multicast_adr {
-
- static struct mwl8k_cmd_pkt *
- __mwl8k_cmd_mac_multicast_adr(struct ieee80211_hw *hw, int allmulti,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr_list *mc_list)
-+#else
-+ int mc_count, struct dev_addr_list *ha)
-+#endif
- {
- struct mwl8k_priv *priv = hw->priv;
- struct mwl8k_cmd_mac_multicast_adr *cmd;
- int size;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- int mc_count = 0;
-
- if (mc_list)
- mc_count = netdev_hw_addr_list_count(mc_list);
-+#endif
-
- if (allmulti || mc_count > priv->num_mcaddrs) {
- allmulti = 1;
-@@ -2685,13 +2691,27 @@ __mwl8k_cmd_mac_multicast_adr(struct iee
- if (allmulti) {
- cmd->action |= cpu_to_le16(MWL8K_ENABLE_RX_ALL_MULTICAST);
- } else if (mc_count) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr *ha;
- int i = 0;
-+#else
-+ int i;
-+#endif
-
- cmd->action |= cpu_to_le16(MWL8K_ENABLE_RX_MULTICAST);
- cmd->numaddr = cpu_to_le16(mc_count);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- netdev_hw_addr_list_for_each(ha, mc_list) {
- memcpy(cmd->addr[i], ha->addr, ETH_ALEN);
-+#else
-+ for (i = 0; i < mc_count && ha; i++) {
-+ if (ha->da_addrlen != ETH_ALEN) {
-+ kfree(cmd);
-+ return NULL;
-+ }
-+ memcpy(cmd->addr[i], ha->da_addr, ETH_ALEN);
-+ ha = ha->next;
-+#endif
- }
- }
-
-@@ -5022,7 +5042,11 @@ mwl8k_bss_info_changed(struct ieee80211_
- }
-
- static u64 mwl8k_prepare_multicast(struct ieee80211_hw *hw,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr_list *mc_list)
-+#else
-+ int mc_count, struct dev_addr_list *ha)
-+#endif
- {
- struct mwl8k_cmd_pkt *cmd;
-
-@@ -5033,7 +5057,11 @@ static u64 mwl8k_prepare_multicast(struc
- * we'll end up throwing this packet away and creating a new
- * one in mwl8k_configure_filter().
- */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- cmd = __mwl8k_cmd_mac_multicast_adr(hw, 0, mc_list);
-+#else
-+ cmd = __mwl8k_cmd_mac_multicast_adr(hw, 0, mc_count, ha);
-+#endif
-
- return (unsigned long)cmd;
- }
-@@ -5155,7 +5183,11 @@ static void mwl8k_configure_filter(struc
- */
- if (*total_flags & FIF_ALLMULTI) {
- kfree(cmd);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- cmd = __mwl8k_cmd_mac_multicast_adr(hw, 1, NULL);
-+#else
-+ cmd = __mwl8k_cmd_mac_multicast_adr(hw, 1, 0, NULL);
-+#endif
- }
-
- if (cmd != NULL) {
---- a/drivers/net/wireless/orinoco/hw.c
-+++ b/drivers/net/wireless/orinoco/hw.c
-@@ -1093,7 +1093,11 @@ int __orinoco_hw_set_multicast_list(stru
- netdev_for_each_mc_addr(ha, dev) {
- if (i == mc_count)
- break;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- memcpy(mclist.addr[i++], ha->addr, ETH_ALEN);
-+#else
-+ memcpy(mclist.addr[i++], ha->dmi_addr, ETH_ALEN);
-+#endif
- }
-
- err = hw->ops->write_ltv(hw, USER_BAP,
---- a/drivers/net/wireless/orinoco/hw.h
-+++ b/drivers/net/wireless/orinoco/hw.h
-@@ -22,6 +22,9 @@
-
- /* Forward declarations */
- struct orinoco_private;
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
-+struct dev_addr_list;
-+#endif
-
- int determine_fw_capabilities(struct orinoco_private *priv, char *fw_name,
- size_t fw_name_len, u32 *hw_ver);
---- a/drivers/net/wireless/p54/main.c
-+++ b/drivers/net/wireless/p54/main.c
-@@ -364,11 +364,18 @@ out:
- return ret;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- static u64 p54_prepare_multicast(struct ieee80211_hw *dev,
- struct netdev_hw_addr_list *mc_list)
-+#else
-+static u64 p54_prepare_multicast(struct ieee80211_hw *dev, int mc_count,
-+ struct dev_addr_list *ha)
-+#endif
- {
- struct p54_common *priv = dev->priv;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr *ha;
-+#endif
- int i;
-
- BUILD_BUG_ON(ARRAY_SIZE(priv->mc_maclist) !=
-@@ -378,12 +385,23 @@ static u64 p54_prepare_multicast(struct
- * Otherwise the firmware will drop it and ARP will no longer work.
- */
- i = 1;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- priv->mc_maclist_num = netdev_hw_addr_list_count(mc_list) + i;
- netdev_hw_addr_list_for_each(ha, mc_list) {
- memcpy(&priv->mc_maclist[i], ha->addr, ETH_ALEN);
-+#else
-+ priv->mc_maclist_num = mc_count + i;
-+ while (i <= mc_count) {
-+ if (!ha)
-+ break;
-+ memcpy(&priv->mc_maclist[i], ha->dmi_addr, ETH_ALEN);
-+#endif
- i++;
- if (i >= ARRAY_SIZE(priv->mc_maclist))
- break;
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
-+ ha = ha->next;
-+#endif
- }
-
- return 1; /* update */
---- a/drivers/net/wireless/rndis_wlan.c
-+++ b/drivers/net/wireless/rndis_wlan.c
-@@ -1629,7 +1629,11 @@ static void set_multicast_list(struct us
-
- netdev_for_each_mc_addr(ha, usbdev->net)
- memcpy(mc_addrs + i++ * ETH_ALEN,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- ha->addr, ETH_ALEN);
-+#else
-+ ha->dmi_addr, ETH_ALEN);
-+#endif
- }
- netif_addr_unlock_bh(usbdev->net);
-
---- a/drivers/net/wireless/rtl818x/rtl8180/dev.c
-+++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
-@@ -818,10 +818,19 @@ static void rtl8180_bss_info_changed(str
- }
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- static u64 rtl8180_prepare_multicast(struct ieee80211_hw *dev,
- struct netdev_hw_addr_list *mc_list)
-+#else
-+static u64 rtl8180_prepare_multicast(struct ieee80211_hw *dev, int mc_count,
-+ struct dev_addr_list *mc_list)
-+#endif
- {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- return netdev_hw_addr_list_count(mc_list);
-+#else
-+ return mc_count;
-+#endif
- }
-
- static void rtl8180_configure_filter(struct ieee80211_hw *dev,
---- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
-+++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
-@@ -1290,9 +1290,17 @@ static void rtl8187_bss_info_changed(str
- }
-
- static u64 rtl8187_prepare_multicast(struct ieee80211_hw *dev,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr_list *mc_list)
-+#else
-+ int mc_count, struct dev_addr_list *mc_list)
-+#endif
- {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- return netdev_hw_addr_list_count(mc_list);
-+#else
-+ return mc_count;
-+#endif
- }
-
- static void rtl8187_configure_filter(struct ieee80211_hw *dev,
---- a/drivers/net/wireless/ti/wlcore/main.c
-+++ b/drivers/net/wireless/ti/wlcore/main.c
-@@ -2952,11 +2952,20 @@ struct wl1271_filter_params {
- u8 mc_list[ACX_MC_ADDRESS_GROUP_MAX][ETH_ALEN];
- };
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- static u64 wl1271_op_prepare_multicast(struct ieee80211_hw *hw,
- struct netdev_hw_addr_list *mc_list)
-+#else
-+static u64 wl1271_op_prepare_multicast(struct ieee80211_hw *hw, int mc_count,
-+ struct dev_addr_list *mc_list)
-+#endif
- {
- struct wl1271_filter_params *fp;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr *ha;
-+#else
-+ int i;
-+#endif
-
- fp = kzalloc(sizeof(*fp), GFP_ATOMIC);
- if (!fp) {
-@@ -2965,16 +2974,40 @@ static u64 wl1271_op_prepare_multicast(s
- }
-
- /* update multicast filtering parameters */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- fp->mc_list_length = 0;
- if (netdev_hw_addr_list_count(mc_list) > ACX_MC_ADDRESS_GROUP_MAX) {
-+#else
-+ fp->enabled = true;
-+ if (mc_count > ACX_MC_ADDRESS_GROUP_MAX) {
-+ mc_count = 0;
-+#endif
- fp->enabled = false;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- } else {
- fp->enabled = true;
- netdev_hw_addr_list_for_each(ha, mc_list) {
-+#else
-+ }
-+
-+ fp->mc_list_length = 0;
-+ for (i = 0; i < mc_count; i++) {
-+ if (mc_list->da_addrlen == ETH_ALEN) {
-+#endif
- memcpy(fp->mc_list[fp->mc_list_length],
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- ha->addr, ETH_ALEN);
-+#else
-+ mc_list->da_addr, ETH_ALEN);
-+#endif
- fp->mc_list_length++;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- }
-+#else
-+ } else
-+ wl1271_warning("Unknown mc address length.");
-+ mc_list = mc_list->next;
-+#endif
- }
-
- return (u64)(unsigned long)fp;
---- a/drivers/net/wireless/zd1211rw/zd_mac.c
-+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
-@@ -1215,17 +1215,34 @@ static void zd_process_intr(struct work_
-
-
- static u64 zd_op_prepare_multicast(struct ieee80211_hw *hw,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr_list *mc_list)
-+#else
-+ int mc_count, struct dev_addr_list *ha)
-+#endif
- {
- struct zd_mac *mac = zd_hw_mac(hw);
- struct zd_mc_hash hash;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr *ha;
-+#else
-+ int i;
-+#endif
-
- zd_mc_clear(&hash);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- netdev_hw_addr_list_for_each(ha, mc_list) {
- dev_dbg_f(zd_mac_dev(mac), "mc addr %pM\n", ha->addr);
- zd_mc_add_addr(&hash, ha->addr);
-+#else
-+ for (i = 0; i < mc_count; i++) {
-+ if (!ha)
-+ break;
-+ dev_dbg_f(zd_mac_dev(mac), "mc addr %pM\n", ha->dmi_addr);
-+ zd_mc_add_addr(&hash, ha->dmi_addr);
-+ ha = ha->next;
-+#endif
- }
-
- return hash.low | ((u64)hash.high << 32);
---- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
-+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
-@@ -103,7 +103,11 @@ static void _brcmf_set_multicast_list(st
- netdev_for_each_mc_addr(ha, ndev) {
- if (!cnt)
- break;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- memcpy(bufp, ha->addr, ETH_ALEN);
-+#else
-+ memcpy(bufp, ha->dmi_addr, ETH_ALEN);
-+#endif
- bufp += ETH_ALEN;
- cnt--;
- }
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -2604,14 +2604,24 @@ struct ieee80211_ops {
- void (*stop_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
-
- u64 (*prepare_multicast)(struct ieee80211_hw *hw,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr_list *mc_list);
-+#else
-+ int mc_count, struct dev_addr_list *mc_list);
-+#endif
- void (*configure_filter)(struct ieee80211_hw *hw,
- unsigned int changed_flags,
- unsigned int *total_flags,
- u64 multicast);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- void (*set_multicast_list)(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif, bool allmulti,
- struct netdev_hw_addr_list *mc_list);
-+#else
-+ void (*set_multicast_list)(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif, bool allmulti,
-+ int mc_count, struct dev_addr_list *ha);
-+#endif
-
- int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
- bool set);
---- a/net/bluetooth/bnep/netdev.c
-+++ b/net/bluetooth/bnep/netdev.c
-@@ -93,8 +93,13 @@ static void bnep_net_set_mc_list(struct
- netdev_for_each_mc_addr(ha, dev) {
- if (i == BNEP_MAX_MULTICAST_FILTERS)
- break;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- memcpy(__skb_put(skb, ETH_ALEN), ha->addr, ETH_ALEN);
- memcpy(__skb_put(skb, ETH_ALEN), ha->addr, ETH_ALEN);
-+#else
-+ memcpy(__skb_put(skb, ETH_ALEN), ha->dmi_addr, ETH_ALEN);
-+ memcpy(__skb_put(skb, ETH_ALEN), ha->dmi_addr, ETH_ALEN);
-+#endif
-
- i++;
- }
---- a/net/mac80211/driver-ops.h
-+++ b/net/mac80211/driver-ops.h
-@@ -227,20 +227,35 @@ static inline void drv_bss_info_changed(
- }
-
- static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr_list *mc_list)
-+#else
-+ int mc_count,
-+ struct dev_addr_list *mc_list)
-+#endif
- {
- u64 ret = 0;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- trace_drv_prepare_multicast(local, mc_list->count);
-+#else
-+ trace_drv_prepare_multicast(local, mc_count);
-+#endif
-
- if (local->ops->prepare_multicast)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- ret = local->ops->prepare_multicast(&local->hw, mc_list);
-+#else
-+ ret = local->ops->prepare_multicast(&local->hw, mc_count,
-+ mc_list);
-+#endif
-
- trace_drv_return_u64(local, ret);
-
- return ret;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- static inline void drv_set_multicast_list(struct ieee80211_local *local,
- struct ieee80211_sub_if_data *sdata,
- struct netdev_hw_addr_list *mc_list)
-@@ -256,6 +271,23 @@ static inline void drv_set_multicast_lis
- allmulti, mc_list);
- trace_drv_return_void(local);
- }
-+#else
-+static inline void drv_set_multicast_list(struct ieee80211_local *local,
-+ struct ieee80211_sub_if_data *sdata,
-+ int mc_count, struct dev_addr_list *ha)
-+{
-+ bool allmulti = sdata->flags & IEEE80211_SDATA_ALLMULTI;
-+
-+ trace_drv_set_multicast_list(local, sdata, mc_count);
-+
-+ check_sdata_in_driver(sdata);
-+
-+ if (local->ops->set_multicast_list)
-+ local->ops->set_multicast_list(&local->hw, &sdata->vif,
-+ allmulti, mc_count, ha);
-+ trace_drv_return_void(local);
-+}
-+#endif
-
- static inline void drv_configure_filter(struct ieee80211_local *local,
- unsigned int changed_flags,
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -907,7 +907,12 @@ struct ieee80211_local {
- struct work_struct reconfig_filter;
-
- /* aggregated multicast list */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- struct netdev_hw_addr_list mc_list;
-+#else
-+ struct dev_addr_list *mc_list;
-+ int mc_count;
-+#endif
-
- bool tim_in_locked_section; /* see ieee80211_beacon_get() */
-
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -743,8 +743,13 @@ static void ieee80211_do_stop(struct iee
- if (sdata->dev) {
- netif_addr_lock_bh(sdata->dev);
- spin_lock_bh(&local->filter_lock);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- __hw_addr_unsync(&local->mc_list, &sdata->dev->mc,
- sdata->dev->addr_len);
-+#else
-+ __dev_addr_unsync(&local->mc_list, &local->mc_count,
-+ &sdata->dev->mc_list, &sdata->dev->mc_count);
-+#endif
- spin_unlock_bh(&local->filter_lock);
- netif_addr_unlock_bh(sdata->dev);
-
-@@ -927,10 +932,20 @@ static void ieee80211_set_multicast_list
- if (sdata->vif.type != NL80211_IFTYPE_MONITOR &&
- sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
- sdata->vif.type != NL80211_IFTYPE_AP)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- drv_set_multicast_list(local, sdata, &dev->mc);
-+#else
-+ drv_set_multicast_list(local, sdata, dev->mc_count,
-+ dev->mc_list);
-+#endif
-
- spin_lock_bh(&local->filter_lock);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- __hw_addr_sync(&local->mc_list, &dev->mc, dev->addr_len);
-+#else
-+ __dev_addr_sync(&local->mc_list, &local->mc_count,
-+ &dev->mc_list, &dev->mc_count);
-+#endif
- spin_unlock_bh(&local->filter_lock);
- ieee80211_queue_work(&local->hw, &local->reconfig_filter);
- }
---- a/net/mac80211/main.c
-+++ b/net/mac80211/main.c
-@@ -71,7 +71,11 @@ void ieee80211_configure_filter(struct i
- spin_lock_bh(&local->filter_lock);
- changed_flags = local->filter_flags ^ new_flags;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- mc = drv_prepare_multicast(local, &local->mc_list);
-+#else
-+ mc = drv_prepare_multicast(local, local->mc_count, local->mc_list);
-+#endif
- spin_unlock_bh(&local->filter_lock);
-
- /* be a bit nasty */
-@@ -592,9 +596,11 @@ struct ieee80211_hw *ieee80211_alloc_hw(
- wiphy->vht_capa_mod_mask = &mac80211_vht_capa_mod_mask;
-
- INIT_LIST_HEAD(&local->interfaces);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
-
- __hw_addr_init(&local->mc_list);
-
-+#endif
- mutex_init(&local->iflist_mtx);
- mutex_init(&local->mtx);
-
---- a/drivers/net/wireless/ath/ath6kl/main.c
-+++ b/drivers/net/wireless/ath/ath6kl/main.c
-@@ -1205,7 +1205,11 @@ static void ath6kl_set_multicast_list(st
- list_for_each_entry_safe(mc_filter, tmp, &vif->mc_filter, list) {
- found = false;
- netdev_for_each_mc_addr(ha, ndev) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- if (memcmp(ha->addr, mc_filter->hw_addr,
-+#else
-+ if (memcmp(ha->dmi_addr, mc_filter->hw_addr,
-+#endif
- ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE) == 0) {
- found = true;
- break;
-@@ -1239,7 +1243,11 @@ static void ath6kl_set_multicast_list(st
- netdev_for_each_mc_addr(ha, ndev) {
- found = false;
- list_for_each_entry(mc_filter, &vif->mc_filter, list) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- if (memcmp(ha->addr, mc_filter->hw_addr,
-+#else
-+ if (memcmp(ha->dmi_addr, mc_filter->hw_addr,
-+#endif
- ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE) == 0) {
- found = true;
- break;
-@@ -1254,7 +1262,11 @@ static void ath6kl_set_multicast_list(st
- goto out;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- memcpy(mc_filter->hw_addr, ha->addr,
-+#else
-+ memcpy(mc_filter->hw_addr, ha->dmi_addr,
-+#endif
- ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE);
- /* Set the multicast filter */
- ath6kl_dbg(ATH6KL_DBG_TRC,
--- /dev/null
+Backport commit 22bedad3ce112d5ca1eaf043d4990fa2ed698c87:
+ net: convert multicast list to list_head
+
+ Converts the list and the core manipulating with it to be the same as uc_list.
+
+ +uses two functions for adding/removing mc address (normal and "global"
+ variant) instead of a function parameter.
+ +removes dev_mcast.c completely.
+ +exposes netdev_hw_addr_list_* macros along with __hw_addr_* functions for
+ manipulation with lists on a sandbox (used in bonding and 80211 drivers)
+
+This also backport commit 2f787b0b76bf5de2eaa3ca3a29d89123ae03c856
+
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
++++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+@@ -410,7 +410,11 @@
+
+ /* comoute mc addresses' hash value ,and put it into hash table */
+ netdev_for_each_mc_addr(ha, netdev) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ hash_value = atl1c_hash_mc_addr(hw, ha->addr);
++#else
++ hash_value = atl1c_hash_mc_addr(hw, ha->dmi_addr);
++#endif
+ atl1c_hash_set(hw, hash_value);
+ }
+ }
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
++++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+@@ -308,7 +308,11 @@
+
+ /* comoute mc addresses' hash value ,and put it into hash table */
+ netdev_for_each_mc_addr(ha, netdev) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ hash_value = atl1e_hash_mc_addr(hw, ha->addr);
++#else
++ hash_value = atl1e_hash_mc_addr(hw, ha->dmi_addr);
++#endif
+ atl1e_hash_set(hw, hash_value);
+ }
+ }
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atlx/atl2.c
++++ b/drivers/net/ethernet/atheros/atlx/atl2.c
+@@ -159,7 +159,11 @@
+
+ /* comoute mc addresses' hash value ,and put it into hash table */
+ netdev_for_each_mc_addr(ha, netdev) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ hash_value = atl2_hash_mc_addr(hw, ha->addr);
++#else
++ hash_value = atl2_hash_mc_addr(hw, ha->dmi_addr);
++#endif
+ atl2_hash_set(hw, hash_value);
+ }
+ }
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atlx/atlx.c
++++ b/drivers/net/ethernet/atheros/atlx/atlx.c
+@@ -149,7 +149,11 @@
+
+ /* compute mc addresses' hash value ,and put it into hash table */
+ netdev_for_each_mc_addr(ha, netdev) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ hash_value = atlx_hash_mc_addr(hw, ha->addr);
++#else
++ hash_value = atlx_hash_mc_addr(hw, ha->dmi_addr);
++#endif
+ atlx_hash_set(hw, hash_value);
+ }
+ }
--- /dev/null
+--- a/drivers/net/ethernet/broadcom/b44.c
++++ b/drivers/net/ethernet/broadcom/b44.c
+@@ -1693,7 +1693,11 @@
+ netdev_for_each_mc_addr(ha, dev) {
+ if (i == num_ents)
+ break;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ __b44_cam_write(bp, ha->addr, i++ + 1);
++#else
++ __b44_cam_write(bp, ha->dmi_addr, i++ + 1);
++#endif
+ }
+ return i+1;
+ }
--- /dev/null
+--- a/drivers/net/wireless/adm8211.c
++++ b/drivers/net/wireless/adm8211.c
+@@ -1320,19 +1320,37 @@
+ }
+
+ static u64 adm8211_prepare_multicast(struct ieee80211_hw *hw,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr_list *mc_list)
++#else
++ int mc_count, struct dev_addr_list *ha)
++#endif
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ unsigned int bit_nr;
+- u32 mc_filter[2];
+ struct netdev_hw_addr *ha;
++#else
++ unsigned int bit_nr, i;
++#endif
++ u32 mc_filter[2];
+
+ mc_filter[1] = mc_filter[0] = 0;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ netdev_hw_addr_list_for_each(ha, mc_list) {
+ bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
++#else
++ for (i = 0; i < mc_count; i++) {
++ if (!ha)
++ break;
++ bit_nr = ether_crc(ETH_ALEN, ha->dmi_addr) >> 26;
++#endif
+
+ bit_nr &= 0x3F;
+ mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
++ ha = ha->next;
++#endif
+ }
+
+ return mc_filter[0] | ((u64)(mc_filter[1]) << 32);
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
++++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+@@ -318,20 +318,42 @@
+
+ static u64
+ ath5k_prepare_multicast(struct ieee80211_hw *hw,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr_list *mc_list)
++#else
++ int mc_count, struct dev_addr_list *ha)
++#endif
+ {
+ u32 mfilt[2], val;
+ u8 pos;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr *ha;
++#else
++ int i;
++#endif
+
+ mfilt[0] = 0;
+ mfilt[1] = 1;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ netdev_hw_addr_list_for_each(ha, mc_list) {
++#else
++ for (i = 0; i < mc_count; i++) {
++ if (!ha)
++ break;
++#endif
+ /* calculate XOR of eight 6-bit values */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ val = get_unaligned_le32(ha->addr + 0);
++#else
++ val = get_unaligned_le32(ha->dmi_addr + 0);
++#endif
+ pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ val = get_unaligned_le32(ha->addr + 3);
++#else
++ val = get_unaligned_le32(ha->dmi_addr + 3);
++#endif
+ pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
+ pos &= 0x3f;
+ mfilt[pos / 32] |= (1 << (pos % 32));
+@@ -340,6 +362,9 @@
+ * need to inform below not to reset the mcast */
+ /* ath5k_hw_set_mcast_filterindex(ah,
+ * ha->addr[5]); */
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
++ ha = ha->next;
++#endif
+ }
+
+ return ((u64)(mfilt[1]) << 32) | mfilt[0];
--- /dev/null
+--- a/drivers/net/wireless/ath/ath6kl/main.c
++++ b/drivers/net/wireless/ath/ath6kl/main.c
+@@ -1205,7 +1205,11 @@
+ list_for_each_entry_safe(mc_filter, tmp, &vif->mc_filter, list) {
+ found = false;
+ netdev_for_each_mc_addr(ha, ndev) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ if (memcmp(ha->addr, mc_filter->hw_addr,
++#else
++ if (memcmp(ha->dmi_addr, mc_filter->hw_addr,
++#endif
+ ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE) == 0) {
+ found = true;
+ break;
+@@ -1239,7 +1243,11 @@
+ netdev_for_each_mc_addr(ha, ndev) {
+ found = false;
+ list_for_each_entry(mc_filter, &vif->mc_filter, list) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ if (memcmp(ha->addr, mc_filter->hw_addr,
++#else
++ if (memcmp(ha->dmi_addr, mc_filter->hw_addr,
++#endif
+ ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE) == 0) {
+ found = true;
+ break;
+@@ -1254,7 +1262,11 @@
+ goto out;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ memcpy(mc_filter->hw_addr, ha->addr,
++#else
++ memcpy(mc_filter->hw_addr, ha->dmi_addr,
++#endif
+ ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE);
+ /* Set the multicast filter */
+ ath6kl_dbg(ATH6KL_DBG_TRC,
--- /dev/null
+--- a/drivers/net/wireless/ath/carl9170/main.c
++++ b/drivers/net/wireless/ath/carl9170/main.c
+@@ -967,17 +967,35 @@
+ return err;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ static u64 carl9170_op_prepare_multicast(struct ieee80211_hw *hw,
+ struct netdev_hw_addr_list *mc_list)
++#else
++static u64 carl9170_op_prepare_multicast(struct ieee80211_hw *hw, int mc_count,
++ struct dev_addr_list *ha)
++#endif
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr *ha;
++#else
++ int i;
++#endif
+ u64 mchash;
+
+ /* always get broadcast frames */
+ mchash = 1ULL << (0xff >> 2);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ netdev_hw_addr_list_for_each(ha, mc_list)
+ mchash |= 1ULL << (ha->addr[5] >> 2);
++#else
++ for (i = 0; i < mc_count; i++) {
++ if (WARN_ON(!ha))
++ break;
++ mchash |= 1ULL << (ha->dmi_addr[5] >> 2);
++ ha = ha->next;
++ }
++#endif
+
+ return mchash;
+ }
--- /dev/null
+--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+@@ -103,7 +103,11 @@
+ netdev_for_each_mc_addr(ha, ndev) {
+ if (!cnt)
+ break;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ memcpy(bufp, ha->addr, ETH_ALEN);
++#else
++ memcpy(bufp, ha->dmi_addr, ETH_ALEN);
++#endif
+ bufp += ETH_ALEN;
+ cnt--;
+ }
--- /dev/null
+--- a/drivers/net/wireless/libertas/main.c
++++ b/drivers/net/wireless/libertas/main.c
+@@ -349,18 +349,34 @@
+ netif_addr_lock_bh(dev);
+ cnt = netdev_mc_count(dev);
+ netdev_for_each_mc_addr(ha, dev) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ if (mac_in_list(cmd->maclist, nr_addrs, ha->addr)) {
++#else
++ if (mac_in_list(cmd->maclist, nr_addrs, ha->dmi_addr)) {
++#endif
+ lbs_deb_net("mcast address %s:%pM skipped\n", dev->name,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ ha->addr);
++#else
++ ha->dmi_addr);
++#endif
+ cnt--;
+ continue;
+ }
+
+ if (i == MRVDRV_MAX_MULTICAST_LIST_SIZE)
+ break;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ memcpy(&cmd->maclist[6*i], ha->addr, ETH_ALEN);
++#else
++ memcpy(&cmd->maclist[6*i], ha->dmi_addr, ETH_ALEN);
++#endif
+ lbs_deb_net("mcast address %s:%pM added to filter\n", dev->name,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ ha->addr);
++#else
++ ha->dmi_addr);
++#endif
+ i++;
+ cnt--;
+ }
--- /dev/null
+--- a/drivers/net/wireless/libertas_tf/main.c
++++ b/drivers/net/wireless/libertas_tf/main.c
+@@ -421,20 +421,36 @@
+ }
+
+ static u64 lbtf_op_prepare_multicast(struct ieee80211_hw *hw,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr_list *mc_list)
++#else
++ int mc_count, struct dev_addr_list *ha)
++#endif
+ {
+ struct lbtf_private *priv = hw->priv;
+ int i;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr *ha;
+ int mc_count = netdev_hw_addr_list_count(mc_list);
++#endif
+
+ if (!mc_count || mc_count > MRVDRV_MAX_MULTICAST_LIST_SIZE)
+ return mc_count;
+
+ priv->nr_of_multicastmacaddr = mc_count;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ i = 0;
+ netdev_hw_addr_list_for_each(ha, mc_list)
+ memcpy(&priv->multicastlist[i++], ha->addr, ETH_ALEN);
++#else
++ for (i = 0; i < mc_count; i++) {
++ if (!ha)
++ break;
++ memcpy(&priv->multicastlist[i], ha->da_addr,
++ ETH_ALEN);
++ ha = ha->next;
++ }
++#endif
+
+ return mc_count;
+ }
--- /dev/null
+--- a/drivers/net/wireless/mwifiex/debugfs.c
++++ b/drivers/net/wireless/mwifiex/debugfs.c
+@@ -215,7 +215,11 @@
+
+ netdev_for_each_mc_addr(ha, netdev)
+ p += sprintf(p, "multicast_address[%d]=\"%pM\"\n",
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ i++, ha->addr);
++#else
++ i++, ha->dmi_addr);
++#endif
+ }
+
+ p += sprintf(p, "num_tx_bytes = %lu\n", priv->stats.tx_bytes);
--- /dev/null
+--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
++++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
+@@ -43,7 +43,11 @@
+ struct netdev_hw_addr *ha;
+
+ netdev_for_each_mc_addr(ha, dev)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ memcpy(&mlist->mac_list[i++], ha->addr, ETH_ALEN);
++#else
++ memcpy(&mlist->mac_list[i++], ha->dmi_addr, ETH_ALEN);
++#endif
+
+ return i;
+ }
--- /dev/null
+--- a/drivers/net/wireless/mwl8k.c
++++ b/drivers/net/wireless/mwl8k.c
+@@ -2656,15 +2656,21 @@
+
+ static struct mwl8k_cmd_pkt *
+ __mwl8k_cmd_mac_multicast_adr(struct ieee80211_hw *hw, int allmulti,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr_list *mc_list)
++#else
++ int mc_count, struct dev_addr_list *ha)
++#endif
+ {
+ struct mwl8k_priv *priv = hw->priv;
+ struct mwl8k_cmd_mac_multicast_adr *cmd;
+ int size;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ int mc_count = 0;
+
+ if (mc_list)
+ mc_count = netdev_hw_addr_list_count(mc_list);
++#endif
+
+ if (allmulti || mc_count > priv->num_mcaddrs) {
+ allmulti = 1;
+@@ -2685,13 +2691,27 @@
+ if (allmulti) {
+ cmd->action |= cpu_to_le16(MWL8K_ENABLE_RX_ALL_MULTICAST);
+ } else if (mc_count) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr *ha;
+ int i = 0;
++#else
++ int i;
++#endif
+
+ cmd->action |= cpu_to_le16(MWL8K_ENABLE_RX_MULTICAST);
+ cmd->numaddr = cpu_to_le16(mc_count);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ netdev_hw_addr_list_for_each(ha, mc_list) {
+ memcpy(cmd->addr[i], ha->addr, ETH_ALEN);
++#else
++ for (i = 0; i < mc_count && ha; i++) {
++ if (ha->da_addrlen != ETH_ALEN) {
++ kfree(cmd);
++ return NULL;
++ }
++ memcpy(cmd->addr[i], ha->da_addr, ETH_ALEN);
++ ha = ha->next;
++#endif
+ }
+ }
+
+@@ -5022,7 +5042,11 @@
+ }
+
+ static u64 mwl8k_prepare_multicast(struct ieee80211_hw *hw,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr_list *mc_list)
++#else
++ int mc_count, struct dev_addr_list *ha)
++#endif
+ {
+ struct mwl8k_cmd_pkt *cmd;
+
+@@ -5033,7 +5057,11 @@
+ * we'll end up throwing this packet away and creating a new
+ * one in mwl8k_configure_filter().
+ */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ cmd = __mwl8k_cmd_mac_multicast_adr(hw, 0, mc_list);
++#else
++ cmd = __mwl8k_cmd_mac_multicast_adr(hw, 0, mc_count, ha);
++#endif
+
+ return (unsigned long)cmd;
+ }
+@@ -5155,7 +5183,11 @@
+ */
+ if (*total_flags & FIF_ALLMULTI) {
+ kfree(cmd);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ cmd = __mwl8k_cmd_mac_multicast_adr(hw, 1, NULL);
++#else
++ cmd = __mwl8k_cmd_mac_multicast_adr(hw, 1, 0, NULL);
++#endif
+ }
+
+ if (cmd != NULL) {
--- /dev/null
+--- a/drivers/net/wireless/orinoco/hw.c
++++ b/drivers/net/wireless/orinoco/hw.c
+@@ -1093,7 +1093,11 @@
+ netdev_for_each_mc_addr(ha, dev) {
+ if (i == mc_count)
+ break;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ memcpy(mclist.addr[i++], ha->addr, ETH_ALEN);
++#else
++ memcpy(mclist.addr[i++], ha->dmi_addr, ETH_ALEN);
++#endif
+ }
+
+ err = hw->ops->write_ltv(hw, USER_BAP,
--- /dev/null
+--- a/drivers/net/wireless/orinoco/hw.h
++++ b/drivers/net/wireless/orinoco/hw.h
+@@ -22,6 +22,9 @@
+
+ /* Forward declarations */
+ struct orinoco_private;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
++struct dev_addr_list;
++#endif
+
+ int determine_fw_capabilities(struct orinoco_private *priv, char *fw_name,
+ size_t fw_name_len, u32 *hw_ver);
--- /dev/null
+--- a/drivers/net/wireless/p54/main.c
++++ b/drivers/net/wireless/p54/main.c
+@@ -364,11 +364,18 @@
+ return ret;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ static u64 p54_prepare_multicast(struct ieee80211_hw *dev,
+ struct netdev_hw_addr_list *mc_list)
++#else
++static u64 p54_prepare_multicast(struct ieee80211_hw *dev, int mc_count,
++ struct dev_addr_list *ha)
++#endif
+ {
+ struct p54_common *priv = dev->priv;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr *ha;
++#endif
+ int i;
+
+ BUILD_BUG_ON(ARRAY_SIZE(priv->mc_maclist) !=
+@@ -378,12 +385,23 @@
+ * Otherwise the firmware will drop it and ARP will no longer work.
+ */
+ i = 1;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ priv->mc_maclist_num = netdev_hw_addr_list_count(mc_list) + i;
+ netdev_hw_addr_list_for_each(ha, mc_list) {
+ memcpy(&priv->mc_maclist[i], ha->addr, ETH_ALEN);
++#else
++ priv->mc_maclist_num = mc_count + i;
++ while (i <= mc_count) {
++ if (!ha)
++ break;
++ memcpy(&priv->mc_maclist[i], ha->dmi_addr, ETH_ALEN);
++#endif
+ i++;
+ if (i >= ARRAY_SIZE(priv->mc_maclist))
+ break;
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
++ ha = ha->next;
++#endif
+ }
+
+ return 1; /* update */
--- /dev/null
+--- a/drivers/net/wireless/rndis_wlan.c
++++ b/drivers/net/wireless/rndis_wlan.c
+@@ -1629,7 +1629,11 @@
+
+ netdev_for_each_mc_addr(ha, usbdev->net)
+ memcpy(mc_addrs + i++ * ETH_ALEN,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ ha->addr, ETH_ALEN);
++#else
++ ha->dmi_addr, ETH_ALEN);
++#endif
+ }
+ netif_addr_unlock_bh(usbdev->net);
+
--- /dev/null
+--- a/drivers/net/wireless/rtl818x/rtl8180/dev.c
++++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
+@@ -818,10 +818,19 @@
+ }
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ static u64 rtl8180_prepare_multicast(struct ieee80211_hw *dev,
+ struct netdev_hw_addr_list *mc_list)
++#else
++static u64 rtl8180_prepare_multicast(struct ieee80211_hw *dev, int mc_count,
++ struct dev_addr_list *mc_list)
++#endif
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ return netdev_hw_addr_list_count(mc_list);
++#else
++ return mc_count;
++#endif
+ }
+
+ static void rtl8180_configure_filter(struct ieee80211_hw *dev,
--- /dev/null
+--- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
++++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
+@@ -1290,9 +1290,17 @@
+ }
+
+ static u64 rtl8187_prepare_multicast(struct ieee80211_hw *dev,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr_list *mc_list)
++#else
++ int mc_count, struct dev_addr_list *mc_list)
++#endif
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ return netdev_hw_addr_list_count(mc_list);
++#else
++ return mc_count;
++#endif
+ }
+
+ static void rtl8187_configure_filter(struct ieee80211_hw *dev,
--- /dev/null
+--- a/drivers/net/wireless/ti/wlcore/main.c
++++ b/drivers/net/wireless/ti/wlcore/main.c
+@@ -2952,11 +2952,20 @@
+ u8 mc_list[ACX_MC_ADDRESS_GROUP_MAX][ETH_ALEN];
+ };
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ static u64 wl1271_op_prepare_multicast(struct ieee80211_hw *hw,
+ struct netdev_hw_addr_list *mc_list)
++#else
++static u64 wl1271_op_prepare_multicast(struct ieee80211_hw *hw, int mc_count,
++ struct dev_addr_list *mc_list)
++#endif
+ {
+ struct wl1271_filter_params *fp;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr *ha;
++#else
++ int i;
++#endif
+
+ fp = kzalloc(sizeof(*fp), GFP_ATOMIC);
+ if (!fp) {
+@@ -2965,16 +2974,40 @@
+ }
+
+ /* update multicast filtering parameters */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ fp->mc_list_length = 0;
+ if (netdev_hw_addr_list_count(mc_list) > ACX_MC_ADDRESS_GROUP_MAX) {
++#else
++ fp->enabled = true;
++ if (mc_count > ACX_MC_ADDRESS_GROUP_MAX) {
++ mc_count = 0;
++#endif
+ fp->enabled = false;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ } else {
+ fp->enabled = true;
+ netdev_hw_addr_list_for_each(ha, mc_list) {
++#else
++ }
++
++ fp->mc_list_length = 0;
++ for (i = 0; i < mc_count; i++) {
++ if (mc_list->da_addrlen == ETH_ALEN) {
++#endif
+ memcpy(fp->mc_list[fp->mc_list_length],
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ ha->addr, ETH_ALEN);
++#else
++ mc_list->da_addr, ETH_ALEN);
++#endif
+ fp->mc_list_length++;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ }
++#else
++ } else
++ wl1271_warning("Unknown mc address length.");
++ mc_list = mc_list->next;
++#endif
+ }
+
+ return (u64)(unsigned long)fp;
--- /dev/null
+--- a/drivers/net/wireless/zd1211rw/zd_mac.c
++++ b/drivers/net/wireless/zd1211rw/zd_mac.c
+@@ -1215,17 +1215,34 @@
+
+
+ static u64 zd_op_prepare_multicast(struct ieee80211_hw *hw,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr_list *mc_list)
++#else
++ int mc_count, struct dev_addr_list *ha)
++#endif
+ {
+ struct zd_mac *mac = zd_hw_mac(hw);
+ struct zd_mc_hash hash;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr *ha;
++#else
++ int i;
++#endif
+
+ zd_mc_clear(&hash);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ netdev_hw_addr_list_for_each(ha, mc_list) {
+ dev_dbg_f(zd_mac_dev(mac), "mc addr %pM\n", ha->addr);
+ zd_mc_add_addr(&hash, ha->addr);
++#else
++ for (i = 0; i < mc_count; i++) {
++ if (!ha)
++ break;
++ dev_dbg_f(zd_mac_dev(mac), "mc addr %pM\n", ha->dmi_addr);
++ zd_mc_add_addr(&hash, ha->dmi_addr);
++ ha = ha->next;
++#endif
+ }
+
+ return hash.low | ((u64)hash.high << 32);
--- /dev/null
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -2604,14 +2604,24 @@
+ void (*stop_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
+
+ u64 (*prepare_multicast)(struct ieee80211_hw *hw,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr_list *mc_list);
++#else
++ int mc_count, struct dev_addr_list *mc_list);
++#endif
+ void (*configure_filter)(struct ieee80211_hw *hw,
+ unsigned int changed_flags,
+ unsigned int *total_flags,
+ u64 multicast);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ void (*set_multicast_list)(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif, bool allmulti,
+ struct netdev_hw_addr_list *mc_list);
++#else
++ void (*set_multicast_list)(struct ieee80211_hw *hw,
++ struct ieee80211_vif *vif, bool allmulti,
++ int mc_count, struct dev_addr_list *ha);
++#endif
+
+ int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
+ bool set);
--- /dev/null
+--- a/net/bluetooth/bnep/netdev.c
++++ b/net/bluetooth/bnep/netdev.c
+@@ -93,8 +93,13 @@
+ netdev_for_each_mc_addr(ha, dev) {
+ if (i == BNEP_MAX_MULTICAST_FILTERS)
+ break;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ memcpy(__skb_put(skb, ETH_ALEN), ha->addr, ETH_ALEN);
+ memcpy(__skb_put(skb, ETH_ALEN), ha->addr, ETH_ALEN);
++#else
++ memcpy(__skb_put(skb, ETH_ALEN), ha->dmi_addr, ETH_ALEN);
++ memcpy(__skb_put(skb, ETH_ALEN), ha->dmi_addr, ETH_ALEN);
++#endif
+
+ i++;
+ }
--- /dev/null
+--- a/net/mac80211/driver-ops.h
++++ b/net/mac80211/driver-ops.h
+@@ -227,20 +227,35 @@
+ }
+
+ static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr_list *mc_list)
++#else
++ int mc_count,
++ struct dev_addr_list *mc_list)
++#endif
+ {
+ u64 ret = 0;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ trace_drv_prepare_multicast(local, mc_list->count);
++#else
++ trace_drv_prepare_multicast(local, mc_count);
++#endif
+
+ if (local->ops->prepare_multicast)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ ret = local->ops->prepare_multicast(&local->hw, mc_list);
++#else
++ ret = local->ops->prepare_multicast(&local->hw, mc_count,
++ mc_list);
++#endif
+
+ trace_drv_return_u64(local, ret);
+
+ return ret;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ static inline void drv_set_multicast_list(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct netdev_hw_addr_list *mc_list)
+@@ -256,6 +271,23 @@
+ allmulti, mc_list);
+ trace_drv_return_void(local);
+ }
++#else
++static inline void drv_set_multicast_list(struct ieee80211_local *local,
++ struct ieee80211_sub_if_data *sdata,
++ int mc_count, struct dev_addr_list *ha)
++{
++ bool allmulti = sdata->flags & IEEE80211_SDATA_ALLMULTI;
++
++ trace_drv_set_multicast_list(local, sdata, mc_count);
++
++ check_sdata_in_driver(sdata);
++
++ if (local->ops->set_multicast_list)
++ local->ops->set_multicast_list(&local->hw, &sdata->vif,
++ allmulti, mc_count, ha);
++ trace_drv_return_void(local);
++}
++#endif
+
+ static inline void drv_configure_filter(struct ieee80211_local *local,
+ unsigned int changed_flags,
--- /dev/null
+--- a/net/mac80211/ieee80211_i.h
++++ b/net/mac80211/ieee80211_i.h
+@@ -907,7 +907,12 @@
+ struct work_struct reconfig_filter;
+
+ /* aggregated multicast list */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ struct netdev_hw_addr_list mc_list;
++#else
++ struct dev_addr_list *mc_list;
++ int mc_count;
++#endif
+
+ bool tim_in_locked_section; /* see ieee80211_beacon_get() */
+
--- /dev/null
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -743,8 +743,13 @@
+ if (sdata->dev) {
+ netif_addr_lock_bh(sdata->dev);
+ spin_lock_bh(&local->filter_lock);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ __hw_addr_unsync(&local->mc_list, &sdata->dev->mc,
+ sdata->dev->addr_len);
++#else
++ __dev_addr_unsync(&local->mc_list, &local->mc_count,
++ &sdata->dev->mc_list, &sdata->dev->mc_count);
++#endif
+ spin_unlock_bh(&local->filter_lock);
+ netif_addr_unlock_bh(sdata->dev);
+
+@@ -927,10 +932,20 @@
+ if (sdata->vif.type != NL80211_IFTYPE_MONITOR &&
+ sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
+ sdata->vif.type != NL80211_IFTYPE_AP)
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ drv_set_multicast_list(local, sdata, &dev->mc);
++#else
++ drv_set_multicast_list(local, sdata, dev->mc_count,
++ dev->mc_list);
++#endif
+
+ spin_lock_bh(&local->filter_lock);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ __hw_addr_sync(&local->mc_list, &dev->mc, dev->addr_len);
++#else
++ __dev_addr_sync(&local->mc_list, &local->mc_count,
++ &dev->mc_list, &dev->mc_count);
++#endif
+ spin_unlock_bh(&local->filter_lock);
+ ieee80211_queue_work(&local->hw, &local->reconfig_filter);
+ }
--- /dev/null
+--- a/net/mac80211/main.c
++++ b/net/mac80211/main.c
+@@ -71,7 +71,11 @@
+ spin_lock_bh(&local->filter_lock);
+ changed_flags = local->filter_flags ^ new_flags;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ mc = drv_prepare_multicast(local, &local->mc_list);
++#else
++ mc = drv_prepare_multicast(local, local->mc_count, local->mc_list);
++#endif
+ spin_unlock_bh(&local->filter_lock);
+
+ /* be a bit nasty */
+@@ -592,9 +596,11 @@
+ wiphy->vht_capa_mod_mask = &mac80211_vht_capa_mod_mask;
+
+ INIT_LIST_HEAD(&local->interfaces);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+
+ __hw_addr_init(&local->mc_list);
+
++#endif
+ mutex_init(&local->iflist_mtx);
+ mutex_init(&local->mtx);
+
+++ /dev/null
-The quirks attribute is not available on older kernels.
-
---- a/drivers/net/wireless/libertas/if_sdio.c
-+++ b/drivers/net/wireless/libertas/if_sdio.c
-@@ -877,6 +877,7 @@ static int if_sdio_power_on(struct if_sd
- if (ret)
- goto release;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
- /* For 1-bit transfers to the 8686 model, we need to enable the
- * interrupt flag in the CCCR register. Set the MMC_QUIRK_LENIENT_FN0
- * bit to allow access to non-vendor registers. */
-@@ -895,6 +896,7 @@ static int if_sdio_power_on(struct if_sd
- if (ret)
- goto disable;
- }
-+#endif
-
- card->ioport = sdio_readb(func, IF_SDIO_IOPORT, &ret);
- if (ret)
---- a/drivers/net/wireless/mwifiex/sdio.c
-+++ b/drivers/net/wireless/mwifiex/sdio.c
-@@ -75,7 +75,9 @@ mwifiex_sdio_probe(struct sdio_func *fun
-
- card->func = func;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
-+#endif
-
- sdio_claim_host(func);
- ret = sdio_enable_func(func);
--- /dev/null
+The quirks attribute is not available on older kernels.
+
--- /dev/null
+--- a/drivers/net/wireless/libertas/if_sdio.c
++++ b/drivers/net/wireless/libertas/if_sdio.c
+@@ -877,6 +877,7 @@
+ if (ret)
+ goto release;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+ /* For 1-bit transfers to the 8686 model, we need to enable the
+ * interrupt flag in the CCCR register. Set the MMC_QUIRK_LENIENT_FN0
+ * bit to allow access to non-vendor registers. */
+@@ -895,6 +896,7 @@
+ if (ret)
+ goto disable;
+ }
++#endif
+
+ card->ioport = sdio_readb(func, IF_SDIO_IOPORT, &ret);
+ if (ret)
--- /dev/null
+--- a/drivers/net/wireless/mwifiex/sdio.c
++++ b/drivers/net/wireless/mwifiex/sdio.c
+@@ -75,7 +75,9 @@
+
+ card->func = func;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
++#endif
+
+ sdio_claim_host(func);
+ ret = sdio_enable_func(func);
+++ /dev/null
-Rename read_pda to something else because this symbol is used in a
-define for something else in arch/um/include/asm/pda.h on older kernels.
-
---- a/drivers/net/wireless/orinoco/fw.c
-+++ b/drivers/net/wireless/orinoco/fw.c
-@@ -123,7 +123,7 @@ orinoco_dl_firmware(struct orinoco_priva
- dev_dbg(dev, "Attempting to download firmware %s\n", firmware);
-
- /* Read current plug data */
-- err = hw->ops->read_pda(hw, pda, fw->pda_addr, fw->pda_size);
-+ err = hw->ops->read_pda_h(hw, pda, fw->pda_addr, fw->pda_size);
- dev_dbg(dev, "Read PDA returned %d\n", err);
- if (err)
- goto free;
-@@ -225,7 +225,7 @@ symbol_dl_image(struct orinoco_private *
- if (!pda)
- return -ENOMEM;
-
-- ret = hw->ops->read_pda(hw, pda, fw->pda_addr, fw->pda_size);
-+ ret = hw->ops->read_pda_h(hw, pda, fw->pda_addr, fw->pda_size);
- if (ret)
- goto free;
- }
---- a/drivers/net/wireless/orinoco/hermes.c
-+++ b/drivers/net/wireless/orinoco/hermes.c
-@@ -767,7 +767,7 @@ static const struct hermes_ops hermes_op
- .write_ltv = hermes_write_ltv,
- .bap_pread = hermes_bap_pread,
- .bap_pwrite = hermes_bap_pwrite,
-- .read_pda = hermes_read_pda,
-+ .read_pda_h = hermes_read_pda,
- .program_init = hermesi_program_init,
- .program_end = hermesi_program_end,
- .program = hermes_program_bytes,
---- a/drivers/net/wireless/orinoco/hermes.h
-+++ b/drivers/net/wireless/orinoco/hermes.h
-@@ -393,7 +393,7 @@ struct hermes_ops {
- u16 id, u16 offset);
- int (*bap_pwrite)(struct hermes *hw, int bap, const void *buf,
- int len, u16 id, u16 offset);
-- int (*read_pda)(struct hermes *hw, __le16 *pda,
-+ int (*read_pda_h)(struct hermes *hw, __le16 *pda,
- u32 pda_addr, u16 pda_len);
- int (*program_init)(struct hermes *hw, u32 entry_point);
- int (*program_end)(struct hermes *hw);
---- a/drivers/net/wireless/orinoco/orinoco_usb.c
-+++ b/drivers/net/wireless/orinoco/orinoco_usb.c
-@@ -1553,7 +1553,7 @@ static const struct hermes_ops ezusb_ops
- .read_ltv = ezusb_read_ltv,
- .write_ltv = ezusb_write_ltv,
- .bap_pread = ezusb_bap_pread,
-- .read_pda = ezusb_read_pda,
-+ .read_pda_h = ezusb_read_pda,
- .program_init = ezusb_program_init,
- .program_end = ezusb_program_end,
- .program = ezusb_program,
--- /dev/null
+Rename read_pda to something else because this symbol is used in a
+define for something else in arch/um/include/asm/pda.h on older kernels.
+
--- /dev/null
+--- a/drivers/net/wireless/orinoco/fw.c
++++ b/drivers/net/wireless/orinoco/fw.c
+@@ -123,7 +123,7 @@
+ dev_dbg(dev, "Attempting to download firmware %s\n", firmware);
+
+ /* Read current plug data */
+- err = hw->ops->read_pda(hw, pda, fw->pda_addr, fw->pda_size);
++ err = hw->ops->read_pda_h(hw, pda, fw->pda_addr, fw->pda_size);
+ dev_dbg(dev, "Read PDA returned %d\n", err);
+ if (err)
+ goto free;
+@@ -225,7 +225,7 @@
+ if (!pda)
+ return -ENOMEM;
+
+- ret = hw->ops->read_pda(hw, pda, fw->pda_addr, fw->pda_size);
++ ret = hw->ops->read_pda_h(hw, pda, fw->pda_addr, fw->pda_size);
+ if (ret)
+ goto free;
+ }
--- /dev/null
+--- a/drivers/net/wireless/orinoco/hermes.c
++++ b/drivers/net/wireless/orinoco/hermes.c
+@@ -767,7 +767,7 @@
+ .write_ltv = hermes_write_ltv,
+ .bap_pread = hermes_bap_pread,
+ .bap_pwrite = hermes_bap_pwrite,
+- .read_pda = hermes_read_pda,
++ .read_pda_h = hermes_read_pda,
+ .program_init = hermesi_program_init,
+ .program_end = hermesi_program_end,
+ .program = hermes_program_bytes,
--- /dev/null
+--- a/drivers/net/wireless/orinoco/hermes.h
++++ b/drivers/net/wireless/orinoco/hermes.h
+@@ -393,7 +393,7 @@
+ u16 id, u16 offset);
+ int (*bap_pwrite)(struct hermes *hw, int bap, const void *buf,
+ int len, u16 id, u16 offset);
+- int (*read_pda)(struct hermes *hw, __le16 *pda,
++ int (*read_pda_h)(struct hermes *hw, __le16 *pda,
+ u32 pda_addr, u16 pda_len);
+ int (*program_init)(struct hermes *hw, u32 entry_point);
+ int (*program_end)(struct hermes *hw);
--- /dev/null
+--- a/drivers/net/wireless/orinoco/orinoco_usb.c
++++ b/drivers/net/wireless/orinoco/orinoco_usb.c
+@@ -1553,7 +1553,7 @@
+ .read_ltv = ezusb_read_ltv,
+ .write_ltv = ezusb_write_ltv,
+ .bap_pread = ezusb_bap_pread,
+- .read_pda = ezusb_read_pda,
++ .read_pda_h = ezusb_read_pda,
+ .program_init = ezusb_program_init,
+ .program_end = ezusb_program_end,
+ .program = ezusb_program,
+++ /dev/null
-Starting with commit 66fceb69b72ff7e9cd8da2ca70033982d5376e0e
-"libertas: Added callback functions to support SDIO suspend/resume."
-libertas uses new functions from the in kernel sdio framework for
-suspend and resume that are not backported.
-
---- a/drivers/net/wireless/ath/ath6kl/sdio.c
-+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
-@@ -817,6 +817,7 @@ out:
- return ret;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- static int ath6kl_set_sdio_pm_caps(struct ath6kl *ar)
- {
- struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
-@@ -950,6 +951,17 @@ static int ath6kl_sdio_resume(struct ath
-
- return 0;
- }
-+#else
-+static int ath6kl_sdio_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow)
-+{
-+ return 0;
-+}
-+
-+static int ath6kl_sdio_resume(struct ath6kl *ar)
-+{
-+ return 0;
-+}
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
-
- /* set the window address register (using 4-byte register access ). */
- static int ath6kl_set_addrwin_reg(struct ath6kl *ar, u32 reg_addr, u32 addr)
-@@ -1263,7 +1275,7 @@ static const struct ath6kl_hif_ops ath6k
- .stop = ath6kl_sdio_stop,
- };
-
--#ifdef CONFIG_PM_SLEEP
-+#if defined(CONFIG_PM_SLEEP) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
-
- /*
- * Empty handlers so that mmc subsystem doesn't remove us entirely during
-@@ -1413,7 +1425,9 @@ static struct sdio_driver ath6kl_sdio_dr
- .id_table = ath6kl_sdio_devices,
- .probe = ath6kl_sdio_probe,
- .remove = ath6kl_sdio_remove,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- .drv.pm = ATH6KL_SDIO_PM_OPS,
-+#endif
- };
-
- static int __init ath6kl_sdio_init(void)
---- a/drivers/net/wireless/libertas/if_sdio.c
-+++ b/drivers/net/wireless/libertas/if_sdio.c
-@@ -1345,6 +1345,7 @@ static void if_sdio_remove(struct sdio_f
- lbs_deb_leave(LBS_DEB_SDIO);
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- static int if_sdio_suspend(struct device *dev)
- {
- struct sdio_func *func = dev_to_sdio_func(dev);
-@@ -1403,15 +1404,18 @@ static const struct dev_pm_ops if_sdio_p
- .suspend = if_sdio_suspend,
- .resume = if_sdio_resume,
- };
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
-
- static struct sdio_driver if_sdio_driver = {
- .name = "libertas_sdio",
- .id_table = if_sdio_ids,
- .probe = if_sdio_probe,
- .remove = if_sdio_remove,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- .drv = {
- .pm = &if_sdio_pm_ops,
- },
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
- };
-
- /*******************************************************************/
---- a/drivers/net/wireless/mwifiex/sdio.c
-+++ b/drivers/net/wireless/mwifiex/sdio.c
-@@ -129,8 +129,10 @@ mwifiex_sdio_remove(struct sdio_func *fu
- wait_for_completion(&adapter->fw_load);
-
- if (user_rmmod) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- if (adapter->is_suspended)
- mwifiex_sdio_resume(adapter->dev);
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
-
- for (i = 0; i < adapter->priv_num; i++)
- if ((GET_BSS_ROLE(adapter->priv[i]) ==
-@@ -147,6 +149,7 @@ mwifiex_sdio_remove(struct sdio_func *fu
- kfree(card);
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- /*
- * SDIO suspend.
- *
-@@ -246,6 +249,7 @@ static int mwifiex_sdio_resume(struct de
-
- return 0;
- }
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
-
- /* Device ID for SD8786 */
- #define SDIO_DEVICE_ID_MARVELL_8786 (0x9116)
-@@ -264,10 +268,12 @@ static const struct sdio_device_id mwifi
-
- MODULE_DEVICE_TABLE(sdio, mwifiex_ids);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- static const struct dev_pm_ops mwifiex_sdio_pm_ops = {
- .suspend = mwifiex_sdio_suspend,
- .resume = mwifiex_sdio_resume,
- };
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
-
- static struct sdio_driver mwifiex_sdio = {
- .name = "mwifiex_sdio",
-@@ -276,7 +282,9 @@ static struct sdio_driver mwifiex_sdio =
- .remove = mwifiex_sdio_remove,
- .drv = {
- .owner = THIS_MODULE,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- .pm = &mwifiex_sdio_pm_ops,
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
- }
- };
-
---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
-+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
-@@ -71,7 +71,7 @@ static bool
- brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev)
- {
- bool is_err = false;
--#ifdef CONFIG_PM_SLEEP
-+#if defined(CONFIG_PM_SLEEP) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- is_err = atomic_read(&sdiodev->suspend);
- #endif
- return is_err;
-@@ -80,7 +80,7 @@ brcmf_pm_resume_error(struct brcmf_sdio_
- static void
- brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev, wait_queue_head_t *wq)
- {
--#ifdef CONFIG_PM_SLEEP
-+#if defined(CONFIG_PM_SLEEP) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- int retry = 0;
- while (atomic_read(&sdiodev->suspend) && retry++ != 30)
- wait_event_timeout(*wq, false, HZ/100);
-@@ -546,7 +546,7 @@ static void brcmf_ops_sdio_remove(struct
- brcmf_dbg(TRACE, "Exit\n");
- }
-
--#ifdef CONFIG_PM_SLEEP
-+#if defined(CONFIG_PM_SLEEP) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- static int brcmf_sdio_suspend(struct device *dev)
- {
- mmc_pm_flag_t sdio_flags;
-@@ -596,7 +596,7 @@ static struct sdio_driver brcmf_sdmmc_dr
- .remove = brcmf_ops_sdio_remove,
- .name = "brcmfmac",
- .id_table = brcmf_sdmmc_ids,
--#ifdef CONFIG_PM_SLEEP
-+#if defined(CONFIG_PM_SLEEP) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- .drv = {
- .pm = &brcmf_sdio_pm_ops,
- },
---- a/drivers/bluetooth/btmrvl_sdio.c
-+++ b/drivers/bluetooth/btmrvl_sdio.c
-@@ -1050,6 +1050,7 @@ static void btmrvl_sdio_remove(struct sd
- }
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- static int btmrvl_sdio_suspend(struct device *dev)
- {
- struct sdio_func *func = dev_to_sdio_func(dev);
-@@ -1145,6 +1146,7 @@ static const struct dev_pm_ops btmrvl_sd
- .suspend = btmrvl_sdio_suspend,
- .resume = btmrvl_sdio_resume,
- };
-+#endif
-
- static struct sdio_driver bt_mrvl_sdio = {
- .name = "btmrvl_sdio",
-@@ -1153,7 +1155,9 @@ static struct sdio_driver bt_mrvl_sdio =
- .remove = btmrvl_sdio_remove,
- .drv = {
- .owner = THIS_MODULE,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
- .pm = &btmrvl_sdio_pm_ops,
-+#endif
- }
- };
-
--- /dev/null
+Starting with commit 66fceb69b72ff7e9cd8da2ca70033982d5376e0e
+"libertas: Added callback functions to support SDIO suspend/resume."
+libertas uses new functions from the in kernel sdio framework for
+suspend and resume that are not backported.
+
--- /dev/null
+--- a/drivers/bluetooth/btmrvl_sdio.c
++++ b/drivers/bluetooth/btmrvl_sdio.c
+@@ -1050,6 +1050,7 @@
+ }
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ static int btmrvl_sdio_suspend(struct device *dev)
+ {
+ struct sdio_func *func = dev_to_sdio_func(dev);
+@@ -1145,6 +1146,7 @@
+ .suspend = btmrvl_sdio_suspend,
+ .resume = btmrvl_sdio_resume,
+ };
++#endif
+
+ static struct sdio_driver bt_mrvl_sdio = {
+ .name = "btmrvl_sdio",
+@@ -1153,7 +1155,9 @@
+ .remove = btmrvl_sdio_remove,
+ .drv = {
+ .owner = THIS_MODULE,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ .pm = &btmrvl_sdio_pm_ops,
++#endif
+ }
+ };
+
--- /dev/null
+--- a/drivers/net/wireless/ath/ath6kl/sdio.c
++++ b/drivers/net/wireless/ath/ath6kl/sdio.c
+@@ -817,6 +817,7 @@
+ return ret;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ static int ath6kl_set_sdio_pm_caps(struct ath6kl *ar)
+ {
+ struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
+@@ -950,6 +951,17 @@
+
+ return 0;
+ }
++#else
++static int ath6kl_sdio_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow)
++{
++ return 0;
++}
++
++static int ath6kl_sdio_resume(struct ath6kl *ar)
++{
++ return 0;
++}
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
+
+ /* set the window address register (using 4-byte register access ). */
+ static int ath6kl_set_addrwin_reg(struct ath6kl *ar, u32 reg_addr, u32 addr)
+@@ -1263,7 +1275,7 @@
+ .stop = ath6kl_sdio_stop,
+ };
+
+-#ifdef CONFIG_PM_SLEEP
++#if defined(CONFIG_PM_SLEEP) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+
+ /*
+ * Empty handlers so that mmc subsystem doesn't remove us entirely during
+@@ -1413,7 +1425,9 @@
+ .id_table = ath6kl_sdio_devices,
+ .probe = ath6kl_sdio_probe,
+ .remove = ath6kl_sdio_remove,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ .drv.pm = ATH6KL_SDIO_PM_OPS,
++#endif
+ };
+
+ static int __init ath6kl_sdio_init(void)
--- /dev/null
+--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+@@ -71,7 +71,7 @@
+ brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev)
+ {
+ bool is_err = false;
+-#ifdef CONFIG_PM_SLEEP
++#if defined(CONFIG_PM_SLEEP) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ is_err = atomic_read(&sdiodev->suspend);
+ #endif
+ return is_err;
+@@ -80,7 +80,7 @@
+ static void
+ brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev, wait_queue_head_t *wq)
+ {
+-#ifdef CONFIG_PM_SLEEP
++#if defined(CONFIG_PM_SLEEP) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ int retry = 0;
+ while (atomic_read(&sdiodev->suspend) && retry++ != 30)
+ wait_event_timeout(*wq, false, HZ/100);
+@@ -546,7 +546,7 @@
+ brcmf_dbg(TRACE, "Exit\n");
+ }
+
+-#ifdef CONFIG_PM_SLEEP
++#if defined(CONFIG_PM_SLEEP) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ static int brcmf_sdio_suspend(struct device *dev)
+ {
+ mmc_pm_flag_t sdio_flags;
+@@ -596,7 +596,7 @@
+ .remove = brcmf_ops_sdio_remove,
+ .name = "brcmfmac",
+ .id_table = brcmf_sdmmc_ids,
+-#ifdef CONFIG_PM_SLEEP
++#if defined(CONFIG_PM_SLEEP) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ .drv = {
+ .pm = &brcmf_sdio_pm_ops,
+ },
--- /dev/null
+--- a/drivers/net/wireless/libertas/if_sdio.c
++++ b/drivers/net/wireless/libertas/if_sdio.c
+@@ -1345,6 +1345,7 @@
+ lbs_deb_leave(LBS_DEB_SDIO);
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ static int if_sdio_suspend(struct device *dev)
+ {
+ struct sdio_func *func = dev_to_sdio_func(dev);
+@@ -1403,15 +1404,18 @@
+ .suspend = if_sdio_suspend,
+ .resume = if_sdio_resume,
+ };
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
+
+ static struct sdio_driver if_sdio_driver = {
+ .name = "libertas_sdio",
+ .id_table = if_sdio_ids,
+ .probe = if_sdio_probe,
+ .remove = if_sdio_remove,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ .drv = {
+ .pm = &if_sdio_pm_ops,
+ },
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
+ };
+
+ /*******************************************************************/
--- /dev/null
+--- a/drivers/net/wireless/mwifiex/sdio.c
++++ b/drivers/net/wireless/mwifiex/sdio.c
+@@ -129,8 +129,10 @@
+ wait_for_completion(&adapter->fw_load);
+
+ if (user_rmmod) {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ if (adapter->is_suspended)
+ mwifiex_sdio_resume(adapter->dev);
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
+
+ for (i = 0; i < adapter->priv_num; i++)
+ if ((GET_BSS_ROLE(adapter->priv[i]) ==
+@@ -147,6 +149,7 @@
+ kfree(card);
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ /*
+ * SDIO suspend.
+ *
+@@ -246,6 +249,7 @@
+
+ return 0;
+ }
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
+
+ /* Device ID for SD8786 */
+ #define SDIO_DEVICE_ID_MARVELL_8786 (0x9116)
+@@ -264,10 +268,12 @@
+
+ MODULE_DEVICE_TABLE(sdio, mwifiex_ids);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ static const struct dev_pm_ops mwifiex_sdio_pm_ops = {
+ .suspend = mwifiex_sdio_suspend,
+ .resume = mwifiex_sdio_resume,
+ };
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
+
+ static struct sdio_driver mwifiex_sdio = {
+ .name = "mwifiex_sdio",
+@@ -276,7 +282,9 @@
+ .remove = mwifiex_sdio_remove,
+ .drv = {
+ .owner = THIS_MODULE,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
+ .pm = &mwifiex_sdio_pm_ops,
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */
+ }
+ };
+
+++ /dev/null
-The patch titled:
-
- bridge: use rx_handler_data pointer to store net_bridge_port pointer
-
-by Jiri Pirko <jpirko@redhat.com> moved the br_ports pointer
-out of the netdev which older kernels relied on and then added
-a flag to the netdev to check for it as follows:
-
-- dev->br_port) {
-+ (dev->priv_flags & IFF_BRIDGE_PORT)) {
-
-So to backport this we instead rely on a br_port_exists() call
-which compat.git provides and depending on the kernel it will either
-check for the dev->br_port or the IFF_BRIDGE_PORT flag. A patch
-to get the blow code merged upstream and to use br_port_exists()
-everywhere else will be submitted but not sure if it will be
-accepted.
-
-This patch can be removed once we get br_port_exists() accessible
-to drivers and not just private bridge code. If that patch doesn't
-get accepted upstream we'l have to carry this patch around for
-compat-drivers.
-
---- a/net/wireless/util.c
-+++ b/net/wireless/util.c
-@@ -816,7 +816,7 @@ int cfg80211_change_iface(struct cfg8021
- return -EOPNOTSUPP;
-
- /* if it's part of a bridge, reject changing type to station/ibss */
-- if ((dev->priv_flags & IFF_BRIDGE_PORT) &&
-+ if (br_port_exists(dev) &&
- (ntype == NL80211_IFTYPE_ADHOC ||
- ntype == NL80211_IFTYPE_STATION ||
- ntype == NL80211_IFTYPE_P2P_CLIENT))
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -2298,7 +2298,7 @@ static int nl80211_valid_4addr(struct cf
- enum nl80211_iftype iftype)
- {
- if (!use_4addr) {
-- if (netdev && (netdev->priv_flags & IFF_BRIDGE_PORT))
-+ if (netdev && br_port_exists(netdev))
- return -EBUSY;
- return 0;
- }
--- /dev/null
+The patch titled:
+
+ bridge: use rx_handler_data pointer to store net_bridge_port pointer
+
+by Jiri Pirko <jpirko@redhat.com> moved the br_ports pointer
+out of the netdev which older kernels relied on and then added
+a flag to the netdev to check for it as follows:
+
+- dev->br_port) {
++ (dev->priv_flags & IFF_BRIDGE_PORT)) {
+
+So to backport this we instead rely on a br_port_exists() call
+which compat.git provides and depending on the kernel it will either
+check for the dev->br_port or the IFF_BRIDGE_PORT flag. A patch
+to get the blow code merged upstream and to use br_port_exists()
+everywhere else will be submitted but not sure if it will be
+accepted.
+
+This patch can be removed once we get br_port_exists() accessible
+to drivers and not just private bridge code. If that patch doesn't
+get accepted upstream we'l have to carry this patch around for
+compat-drivers.
+
--- /dev/null
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -2298,7 +2298,7 @@
+ enum nl80211_iftype iftype)
+ {
+ if (!use_4addr) {
+- if (netdev && (netdev->priv_flags & IFF_BRIDGE_PORT))
++ if (netdev && br_port_exists(netdev))
+ return -EBUSY;
+ return 0;
+ }
--- /dev/null
+--- a/net/wireless/util.c
++++ b/net/wireless/util.c
+@@ -816,7 +816,7 @@
+ return -EOPNOTSUPP;
+
+ /* if it's part of a bridge, reject changing type to station/ibss */
+- if ((dev->priv_flags & IFF_BRIDGE_PORT) &&
++ if (br_port_exists(dev) &&
+ (ntype == NL80211_IFTYPE_ADHOC ||
+ ntype == NL80211_IFTYPE_STATION ||
+ ntype == NL80211_IFTYPE_P2P_CLIENT))
+++ /dev/null
---- a/net/wireless/sysfs.c
-+++ b/net/wireless/sysfs.c
-@@ -133,12 +133,14 @@ static int wiphy_resume(struct device *d
- return ret;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- static const void *wiphy_namespace(struct device *d)
- {
- struct wiphy *wiphy = container_of(d, struct wiphy, dev);
-
- return wiphy_net(wiphy);
- }
-+#endif
-
- struct class ieee80211_class = {
- .name = "ieee80211",
-@@ -148,8 +150,10 @@ struct class ieee80211_class = {
- .dev_uevent = wiphy_uevent,
- .suspend = wiphy_suspend,
- .resume = wiphy_resume,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- .ns_type = &net_ns_type_operations,
- .namespace = wiphy_namespace,
-+#endif
- };
-
- int wiphy_sysfs_init(void)
--- /dev/null
+--- a/net/wireless/sysfs.c
++++ b/net/wireless/sysfs.c
+@@ -133,12 +133,14 @@
+ return ret;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ static const void *wiphy_namespace(struct device *d)
+ {
+ struct wiphy *wiphy = container_of(d, struct wiphy, dev);
+
+ return wiphy_net(wiphy);
+ }
++#endif
+
+ struct class ieee80211_class = {
+ .name = "ieee80211",
+@@ -148,8 +150,10 @@
+ .dev_uevent = wiphy_uevent,
+ .suspend = wiphy_suspend,
+ .resume = wiphy_resume,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ .ns_type = &net_ns_type_operations,
+ .namespace = wiphy_namespace,
++#endif
+ };
+
+ int wiphy_sysfs_init(void)
+++ /dev/null
-When some other headers are included in some makefile it must be
-relative to the current object file processed. When giving the full
-path the make process will search in the kernel tree for the headers.
-
---- a/drivers/net/wireless/rtl818x/rtl8180/Makefile
-+++ b/drivers/net/wireless/rtl818x/rtl8180/Makefile
-@@ -2,4 +2,4 @@ rtl8180-objs := dev.o rtl8225.o sa2400.
-
- obj-$(CONFIG_RTL8180) += rtl8180.o
-
--ccflags-y += -Idrivers/net/wireless/rtl818x
-+ccflags-y += -I$(obj)/..
---- a/drivers/net/wireless/rtl818x/rtl8187/Makefile
-+++ b/drivers/net/wireless/rtl818x/rtl8187/Makefile
-@@ -2,4 +2,4 @@ rtl8187-objs := dev.o rtl8225.o leds.o
-
- obj-$(CONFIG_RTL8187) += rtl8187.o
-
--ccflags-y += -Idrivers/net/wireless/rtl818x
-+ccflags-y += -I$(obj)/..
---- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile
-+++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
-@@ -16,8 +16,8 @@
- # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ccflags-y += \
-- -Idrivers/net/wireless/brcm80211/brcmfmac \
-- -Idrivers/net/wireless/brcm80211/include
-+ -I$(obj) \
-+ -I$(obj)/../include
-
- ccflags-y += -D__CHECK_ENDIAN__
-
---- a/drivers/net/wireless/brcm80211/brcmsmac/Makefile
-+++ b/drivers/net/wireless/brcm80211/brcmsmac/Makefile
-@@ -17,9 +17,9 @@
-
- ccflags-y := \
- -D__CHECK_ENDIAN__ \
-- -Idrivers/net/wireless/brcm80211/brcmsmac \
-- -Idrivers/net/wireless/brcm80211/brcmsmac/phy \
-- -Idrivers/net/wireless/brcm80211/include
-+ -I$(obj) \
-+ -I$(obj)/phy \
-+ -I$(obj)/../include
-
- BRCMSMAC_OFILES := \
- mac80211_if.o \
---- a/drivers/net/wireless/brcm80211/brcmutil/Makefile
-+++ b/drivers/net/wireless/brcm80211/brcmutil/Makefile
-@@ -16,8 +16,8 @@
- # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- ccflags-y := \
-- -Idrivers/net/wireless/brcm80211/brcmutil \
-- -Idrivers/net/wireless/brcm80211/include
-+ -I$(obj) \
-+ -I$(obj)/../include
-
- BRCMUTIL_OFILES := \
- utils.o
---- a/net/wireless/Makefile
-+++ b/net/wireless/Makefile
-@@ -20,6 +20,6 @@ CFLAGS_trace.o := -I$(src)
- ccflags-y += -D__CHECK_ENDIAN__
-
- $(obj)/regdb.c: $(src)/db.txt $(src)/genregdb.awk
-- @$(AWK) -f $(srctree)/$(src)/genregdb.awk < $< > $@
-+ @$(AWK) -f $(src)/genregdb.awk < $< > $@
-
- clean-files := regdb.c
--- /dev/null
+When some other headers are included in some makefile it must be
+relative to the current object file processed. When giving the full
+path the make process will search in the kernel tree for the headers.
+
--- /dev/null
+--- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile
++++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
+@@ -16,8 +16,8 @@
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ccflags-y += \
+- -Idrivers/net/wireless/brcm80211/brcmfmac \
+- -Idrivers/net/wireless/brcm80211/include
++ -I$(obj) \
++ -I$(obj)/../include
+
+ ccflags-y += -D__CHECK_ENDIAN__
+
--- /dev/null
+--- a/drivers/net/wireless/brcm80211/brcmsmac/Makefile
++++ b/drivers/net/wireless/brcm80211/brcmsmac/Makefile
+@@ -17,9 +17,9 @@
+
+ ccflags-y := \
+ -D__CHECK_ENDIAN__ \
+- -Idrivers/net/wireless/brcm80211/brcmsmac \
+- -Idrivers/net/wireless/brcm80211/brcmsmac/phy \
+- -Idrivers/net/wireless/brcm80211/include
++ -I$(obj) \
++ -I$(obj)/phy \
++ -I$(obj)/../include
+
+ BRCMSMAC_OFILES := \
+ mac80211_if.o \
--- /dev/null
+--- a/drivers/net/wireless/brcm80211/brcmutil/Makefile
++++ b/drivers/net/wireless/brcm80211/brcmutil/Makefile
+@@ -16,8 +16,8 @@
+ # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ccflags-y := \
+- -Idrivers/net/wireless/brcm80211/brcmutil \
+- -Idrivers/net/wireless/brcm80211/include
++ -I$(obj) \
++ -I$(obj)/../include
+
+ BRCMUTIL_OFILES := \
+ utils.o
--- /dev/null
+--- a/drivers/net/wireless/rtl818x/rtl8180/Makefile
++++ b/drivers/net/wireless/rtl818x/rtl8180/Makefile
+@@ -2,4 +2,4 @@
+
+ obj-$(CONFIG_RTL8180) += rtl8180.o
+
+-ccflags-y += -Idrivers/net/wireless/rtl818x
++ccflags-y += -I$(obj)/..
--- /dev/null
+--- a/drivers/net/wireless/rtl818x/rtl8187/Makefile
++++ b/drivers/net/wireless/rtl818x/rtl8187/Makefile
+@@ -2,4 +2,4 @@
+
+ obj-$(CONFIG_RTL8187) += rtl8187.o
+
+-ccflags-y += -Idrivers/net/wireless/rtl818x
++ccflags-y += -I$(obj)/..
--- /dev/null
+--- a/net/wireless/Makefile
++++ b/net/wireless/Makefile
+@@ -20,6 +20,6 @@
+ ccflags-y += -D__CHECK_ENDIAN__
+
+ $(obj)/regdb.c: $(src)/db.txt $(src)/genregdb.awk
+- @$(AWK) -f $(srctree)/$(src)/genregdb.awk < $< > $@
++ @$(AWK) -f $(src)/genregdb.awk < $< > $@
+
+ clean-files := regdb.c
+++ /dev/null
-Backport commit 99b88a0ecbdbc6df03527292571b2b442965814a
-The rest is backported in include/linux/compat-2.6.37.h
-
---- a/net/mac80211/main.c
-+++ b/net/mac80211/main.c
-@@ -1152,6 +1152,10 @@ static void __exit ieee80211_exit(void)
- rc80211_minstrel_ht_exit();
- rc80211_minstrel_exit();
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
-+ flush_scheduled_work();
-+#endif
-+
- ieee80211s_stop();
-
- ieee80211_iface_exit();
--- /dev/null
+Backport commit 99b88a0ecbdbc6df03527292571b2b442965814a
+The rest is backported in include/linux/compat-2.6.37.h
+
--- /dev/null
+--- a/net/mac80211/main.c
++++ b/net/mac80211/main.c
+@@ -1152,6 +1152,10 @@
+ rc80211_minstrel_ht_exit();
+ rc80211_minstrel_exit();
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
++ flush_scheduled_work();
++#endif
++
+ ieee80211s_stop();
+
+ ieee80211_iface_exit();
+++ /dev/null
---- a/drivers/net/wireless/ath/main.c
-+++ b/drivers/net/wireless/ath/main.c
-@@ -59,6 +59,7 @@ struct sk_buff *ath_rxbuf_alloc(struct a
- }
- EXPORT_SYMBOL(ath_rxbuf_alloc);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- void ath_printk(const char *level, const struct ath_common* common,
- const char *fmt, ...)
- {
-@@ -78,4 +79,24 @@ void ath_printk(const char *level, const
-
- va_end(args);
- }
-+#else
-+void ath_printk(const char *level, const struct ath_common* common,
-+ const char *fmt, ...)
-+{
-+ va_list args;
-+
-+ va_start(args, fmt);
-+
-+ if (common && common->hw && common->hw->wiphy)
-+ printk("%sath: %s: ",
-+ level, wiphy_name(common->hw->wiphy));
-+ else
-+ printk("%sath: ", level);
-+
-+ vprintk(fmt, args);
-+
-+ va_end(args);
-+}
-+#endif
-+
- EXPORT_SYMBOL(ath_printk);
--- /dev/null
+--- a/drivers/net/wireless/ath/main.c
++++ b/drivers/net/wireless/ath/main.c
+@@ -59,6 +59,7 @@
+ }
+ EXPORT_SYMBOL(ath_rxbuf_alloc);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ void ath_printk(const char *level, const struct ath_common* common,
+ const char *fmt, ...)
+ {
+@@ -78,4 +79,24 @@
+
+ va_end(args);
+ }
++#else
++void ath_printk(const char *level, const struct ath_common* common,
++ const char *fmt, ...)
++{
++ va_list args;
++
++ va_start(args, fmt);
++
++ if (common && common->hw && common->hw->wiphy)
++ printk("%sath: %s: ",
++ level, wiphy_name(common->hw->wiphy));
++ else
++ printk("%sath: ", level);
++
++ vprintk(fmt, args);
++
++ va_end(args);
++}
++#endif
++
+ EXPORT_SYMBOL(ath_printk);
+++ /dev/null
---- a/drivers/net/wireless/iwlegacy/common.c
-+++ b/drivers/net/wireless/iwlegacy/common.c
-@@ -562,7 +562,9 @@ il_leds_init(struct il_priv *il)
- kasprintf(GFP_KERNEL, "%s-led", wiphy_name(il->hw->wiphy));
- il->led.brightness_set = il_led_brightness_set;
- il->led.blink_set = il_led_blink_set;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
- il->led.max_brightness = 1;
-+#endif
-
- switch (mode) {
- case IL_LED_DEFAULT:
---- a/drivers/net/wireless/iwlwifi/dvm/led.c
-+++ b/drivers/net/wireless/iwlwifi/dvm/led.c
-@@ -187,7 +187,9 @@ void iwl_leds_init(struct iwl_priv *priv
- wiphy_name(priv->hw->wiphy));
- priv->led.brightness_set = iwl_led_brightness_set;
- priv->led.blink_set = iwl_led_blink_set;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
- priv->led.max_brightness = 1;
-+#endif
-
- switch (mode) {
- case IWL_LED_DEFAULT:
---- a/drivers/net/wireless/iwlwifi/mvm/led.c
-+++ b/drivers/net/wireless/iwlwifi/mvm/led.c
-@@ -108,7 +108,9 @@ int iwl_mvm_leds_init(struct iwl_mvm *mv
- mvm->led.name = kasprintf(GFP_KERNEL, "%s-led",
- wiphy_name(mvm->hw->wiphy));
- mvm->led.brightness_set = iwl_led_brightness_set;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
- mvm->led.max_brightness = 1;
-+#endif
-
- if (mode == IWL_LED_RF_STATE)
- mvm->led.default_trigger =
--- /dev/null
+--- a/drivers/net/wireless/iwlegacy/common.c
++++ b/drivers/net/wireless/iwlegacy/common.c
+@@ -562,7 +562,9 @@
+ kasprintf(GFP_KERNEL, "%s-led", wiphy_name(il->hw->wiphy));
+ il->led.brightness_set = il_led_brightness_set;
+ il->led.blink_set = il_led_blink_set;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
+ il->led.max_brightness = 1;
++#endif
+
+ switch (mode) {
+ case IL_LED_DEFAULT:
--- /dev/null
+--- a/drivers/net/wireless/iwlwifi/dvm/led.c
++++ b/drivers/net/wireless/iwlwifi/dvm/led.c
+@@ -187,7 +187,9 @@
+ wiphy_name(priv->hw->wiphy));
+ priv->led.brightness_set = iwl_led_brightness_set;
+ priv->led.blink_set = iwl_led_blink_set;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
+ priv->led.max_brightness = 1;
++#endif
+
+ switch (mode) {
+ case IWL_LED_DEFAULT:
--- /dev/null
+--- a/drivers/net/wireless/iwlwifi/mvm/led.c
++++ b/drivers/net/wireless/iwlwifi/mvm/led.c
+@@ -108,7 +108,9 @@
+ mvm->led.name = kasprintf(GFP_KERNEL, "%s-led",
+ wiphy_name(mvm->hw->wiphy));
+ mvm->led.brightness_set = iwl_led_brightness_set;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
+ mvm->led.max_brightness = 1;
++#endif
+
+ if (mode == IWL_LED_RF_STATE)
+ mvm->led.default_trigger =
+++ /dev/null
---- a/drivers/net/wireless/iwlegacy/common.c
-+++ b/drivers/net/wireless/iwlegacy/common.c
-@@ -540,6 +540,7 @@ il_led_brightness_set(struct led_classde
- il_led_cmd(il, on, 0);
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
- static int
- il_led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on,
- unsigned long *delay_off)
-@@ -548,6 +549,7 @@ il_led_blink_set(struct led_classdev *le
-
- return il_led_cmd(il, *delay_on, *delay_off);
- }
-+#endif
-
- void
- il_leds_init(struct il_priv *il)
-@@ -561,7 +563,9 @@ il_leds_init(struct il_priv *il)
- il->led.name =
- kasprintf(GFP_KERNEL, "%s-led", wiphy_name(il->hw->wiphy));
- il->led.brightness_set = il_led_brightness_set;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
- il->led.blink_set = il_led_blink_set;
-+#endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
- il->led.max_brightness = 1;
- #endif
---- a/drivers/net/wireless/iwlwifi/dvm/led.c
-+++ b/drivers/net/wireless/iwlwifi/dvm/led.c
-@@ -162,6 +162,7 @@ static void iwl_led_brightness_set(struc
- iwl_led_cmd(priv, on, 0);
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
- static int iwl_led_blink_set(struct led_classdev *led_cdev,
- unsigned long *delay_on,
- unsigned long *delay_off)
-@@ -170,6 +171,7 @@ static int iwl_led_blink_set(struct led_
-
- return iwl_led_cmd(priv, *delay_on, *delay_off);
- }
-+#endif
-
- void iwl_leds_init(struct iwl_priv *priv)
- {
-@@ -186,7 +188,9 @@ void iwl_leds_init(struct iwl_priv *priv
- priv->led.name = kasprintf(GFP_KERNEL, "%s-led",
- wiphy_name(priv->hw->wiphy));
- priv->led.brightness_set = iwl_led_brightness_set;
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
- priv->led.blink_set = iwl_led_blink_set;
-+#endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
- priv->led.max_brightness = 1;
- #endif
--- /dev/null
+--- a/drivers/net/wireless/iwlegacy/common.c
++++ b/drivers/net/wireless/iwlegacy/common.c
+@@ -540,6 +540,7 @@
+ il_led_cmd(il, on, 0);
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
+ static int
+ il_led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on,
+ unsigned long *delay_off)
+@@ -548,6 +549,7 @@
+
+ return il_led_cmd(il, *delay_on, *delay_off);
+ }
++#endif
+
+ void
+ il_leds_init(struct il_priv *il)
+@@ -561,7 +563,9 @@
+ il->led.name =
+ kasprintf(GFP_KERNEL, "%s-led", wiphy_name(il->hw->wiphy));
+ il->led.brightness_set = il_led_brightness_set;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
+ il->led.blink_set = il_led_blink_set;
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
+ il->led.max_brightness = 1;
+ #endif
--- /dev/null
+--- a/drivers/net/wireless/iwlwifi/dvm/led.c
++++ b/drivers/net/wireless/iwlwifi/dvm/led.c
+@@ -162,6 +162,7 @@
+ iwl_led_cmd(priv, on, 0);
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
+ static int iwl_led_blink_set(struct led_classdev *led_cdev,
+ unsigned long *delay_on,
+ unsigned long *delay_off)
+@@ -170,6 +171,7 @@
+
+ return iwl_led_cmd(priv, *delay_on, *delay_off);
+ }
++#endif
+
+ void iwl_leds_init(struct iwl_priv *priv)
+ {
+@@ -186,7 +188,9 @@
+ priv->led.name = kasprintf(GFP_KERNEL, "%s-led",
+ wiphy_name(priv->hw->wiphy));
+ priv->led.brightness_set = iwl_led_brightness_set;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
+ priv->led.blink_set = iwl_led_blink_set;
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
+ priv->led.max_brightness = 1;
+ #endif
+++ /dev/null
-This reverts the commits that deal with hw_features and
-set_features, fix_features for kernels < 2.6.39.
-
-Below is one example commit being reverted, but we also do
-this for ath6kl and any driver that uses this in this file.
-
-commit 782d640afd15af7a1faf01cfe566ca4ac511319d
-Author: Michał Mirosław <mirq-linux@rere.qmqm.pl>
-Date: Thu Apr 7 07:32:18 2011 +0000
-
- net: atl*: convert to hw_features
-
- Things left as they were:
- - atl1: is RX checksum really enabled?
- - atl2: copy-paste from atl1, with-errors-on-modify I presume
- - atl1c: there's a bug: MTU can't be changed if device is not up
-
- Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
- Signed-off-by: David S. Miller <davem@davemloft.net>
-
---- a/drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c
-+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c
-@@ -114,6 +114,13 @@ static int atl1c_set_settings(struct net
- return 0;
- }
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
-+static u32 atl1c_get_tx_csum(struct net_device *netdev)
-+{
-+ return (netdev->features & NETIF_F_HW_CSUM) != 0;
-+}
-+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
-+
- static u32 atl1c_get_msglevel(struct net_device *netdev)
- {
- struct atl1c_adapter *adapter = netdev_priv(netdev);
-@@ -301,6 +308,11 @@ static const struct ethtool_ops atl1c_et
- .get_link = ethtool_op_get_link,
- .get_eeprom_len = atl1c_get_eeprom_len,
- .get_eeprom = atl1c_get_eeprom,
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
-+ .get_tx_csum = atl1c_get_tx_csum,
-+ .get_sg = ethtool_op_get_sg,
-+ .set_sg = ethtool_op_set_sg,
-+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
- };
-
- void atl1c_set_ethtool_ops(struct net_device *netdev)
---- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
-+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
-@@ -491,6 +491,7 @@ static void atl1c_set_rxbufsize(struct a
- roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- static netdev_features_t atl1c_fix_features(struct net_device *netdev,
- netdev_features_t features)
- {
-@@ -519,6 +520,7 @@ static int atl1c_set_features(struct net
-
- return 0;
- }
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
-
- /**
- * atl1c_change_mtu - Change the Maximum Transfer Unit
-@@ -551,8 +553,19 @@ static int atl1c_change_mtu(struct net_d
- netdev->mtu = new_mtu;
- adapter->hw.max_frame_size = new_mtu;
- atl1c_set_rxbufsize(adapter, netdev);
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
-+ if (new_mtu > MAX_TSO_FRAME_SIZE) {
-+ adapter->netdev->features &= ~NETIF_F_TSO;
-+ adapter->netdev->features &= ~NETIF_F_TSO6;
-+ } else {
-+ adapter->netdev->features |= NETIF_F_TSO;
-+ adapter->netdev->features |= NETIF_F_TSO6;
-+ }
-+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
- atl1c_down(adapter);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- netdev_update_features(netdev);
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
- atl1c_up(adapter);
- clear_bit(__AT_RESETTING, &adapter->flags);
- }
-@@ -2459,8 +2472,10 @@ static const struct net_device_ops atl1c
- .ndo_set_mac_address = atl1c_set_mac_addr,
- .ndo_set_rx_mode = atl1c_set_multi,
- .ndo_change_mtu = atl1c_change_mtu,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- .ndo_fix_features = atl1c_fix_features,
- .ndo_set_features = atl1c_set_features,
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
- .ndo_do_ioctl = atl1c_ioctl,
- .ndo_tx_timeout = atl1c_tx_timeout,
- .ndo_get_stats = atl1c_get_stats,
-@@ -2479,6 +2494,7 @@ static int atl1c_init_netdev(struct net_
- atl1c_set_ethtool_ops(netdev);
-
- /* TODO: add when ready */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- netdev->hw_features = NETIF_F_SG |
- NETIF_F_HW_CSUM |
- NETIF_F_HW_VLAN_RX |
-@@ -2486,6 +2502,14 @@ static int atl1c_init_netdev(struct net_
- NETIF_F_TSO6;
- netdev->features = netdev->hw_features |
- NETIF_F_HW_VLAN_TX;
-+#else
-+ netdev->features = NETIF_F_SG |
-+ NETIF_F_HW_CSUM |
-+ NETIF_F_HW_VLAN_TX |
-+ NETIF_F_HW_VLAN_RX |
-+ NETIF_F_TSO |
-+ NETIF_F_TSO6;
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
- return 0;
- }
-
---- a/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c
-+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c
-@@ -384,6 +384,11 @@ static const struct ethtool_ops atl1e_et
- .get_eeprom_len = atl1e_get_eeprom_len,
- .get_eeprom = atl1e_get_eeprom,
- .set_eeprom = atl1e_set_eeprom,
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
-+ .set_tx_csum = ethtool_op_set_tx_hw_csum,
-+ .set_sg = ethtool_op_set_sg,
-+ .set_tso = ethtool_op_set_tso,
-+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
- };
-
- void atl1e_set_ethtool_ops(struct net_device *netdev)
---- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
-+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
-@@ -375,6 +375,7 @@ static int atl1e_set_mac_addr(struct net
- return 0;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- static netdev_features_t atl1e_fix_features(struct net_device *netdev,
- netdev_features_t features)
- {
-@@ -400,6 +401,7 @@ static int atl1e_set_features(struct net
-
- return 0;
- }
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
-
- /**
- * atl1e_change_mtu - Change the Maximum Transfer Unit
-@@ -1925,7 +1927,11 @@ void atl1e_down(struct atl1e_adapter *ad
- * reschedule our watchdog timer */
- set_bit(__AT_DOWN, &adapter->flags);
-
-+#if defined(NETIF_F_LLTX) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- netif_stop_queue(netdev);
-+#else
-+ netif_tx_disable(netdev);
-+#endif
-
- /* reset MAC to disable all RX/TX */
- atl1e_reset_hw(&adapter->hw);
-@@ -2195,8 +2201,10 @@ static const struct net_device_ops atl1e
- .ndo_set_rx_mode = atl1e_set_multi,
- .ndo_validate_addr = eth_validate_addr,
- .ndo_set_mac_address = atl1e_set_mac_addr,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- .ndo_fix_features = atl1e_fix_features,
- .ndo_set_features = atl1e_set_features,
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
- .ndo_change_mtu = atl1e_change_mtu,
- .ndo_do_ioctl = atl1e_ioctl,
- .ndo_tx_timeout = atl1e_tx_timeout,
-@@ -2216,10 +2224,15 @@ static int atl1e_init_netdev(struct net_
- netdev->watchdog_timeo = AT_TX_WATCHDOG;
- atl1e_set_ethtool_ops(netdev);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- netdev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |
- NETIF_F_HW_VLAN_RX;
- netdev->features = netdev->hw_features | NETIF_F_LLTX |
- NETIF_F_HW_VLAN_TX;
-+#else
-+ netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |
-+ NETIF_F_HW_VLAN_RX | NETIF_F_LLTX | NETIF_F_HW_VLAN_TX;
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
-
- return 0;
- }
---- a/drivers/net/ethernet/atheros/atlx/atl1.c
-+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
-@@ -2917,8 +2917,10 @@ static const struct net_device_ops atl1_
- .ndo_validate_addr = eth_validate_addr,
- .ndo_set_mac_address = atl1_set_mac,
- .ndo_change_mtu = atl1_change_mtu,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- .ndo_fix_features = atlx_fix_features,
- .ndo_set_features = atlx_set_features,
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
- .ndo_do_ioctl = atlx_ioctl,
- .ndo_tx_timeout = atlx_tx_timeout,
- #ifdef CONFIG_NET_POLL_CONTROLLER
-@@ -3028,11 +3030,13 @@ static int atl1_probe(struct pci_dev *pd
- netdev->features |= NETIF_F_SG;
- netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- netdev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_TSO |
- NETIF_F_HW_VLAN_RX;
-
- /* is this valid? see atl1_setup_mac_ctrl() */
- netdev->features |= NETIF_F_RXCSUM;
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
-
- /*
- * patch for some L1 of old version,
-@@ -3645,6 +3649,14 @@ static int atl1_set_pauseparam(struct ne
- return 0;
- }
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
-+/* FIXME: is this right? -- CHS */
-+static u32 atl1_get_rx_csum(struct net_device *netdev)
-+{
-+ return 1;
-+}
-+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
-+
- static void atl1_get_strings(struct net_device *netdev, u32 stringset,
- u8 *data)
- {
-@@ -3717,4 +3729,10 @@ static const struct ethtool_ops atl1_eth
- .nway_reset = atl1_nway_reset,
- .get_ethtool_stats = atl1_get_ethtool_stats,
- .get_sset_count = atl1_get_sset_count,
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
-+ .get_rx_csum = atl1_get_rx_csum,
-+ .set_tx_csum = ethtool_op_set_tx_hw_csum,
-+ .set_sg = ethtool_op_set_sg,
-+ .set_tso = ethtool_op_set_tso,
-+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
- };
---- a/drivers/net/ethernet/atheros/atlx/atl2.c
-+++ b/drivers/net/ethernet/atheros/atlx/atl2.c
-@@ -396,6 +396,7 @@ static void atl2_restore_vlan(struct atl
- atl2_vlan_mode(adapter->netdev, adapter->netdev->features);
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- static netdev_features_t atl2_fix_features(struct net_device *netdev,
- netdev_features_t features)
- {
-@@ -421,6 +422,7 @@ static int atl2_set_features(struct net_
-
- return 0;
- }
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
-
- static void atl2_intr_rx(struct atl2_adapter *adapter)
- {
-@@ -1319,8 +1321,10 @@ static const struct net_device_ops atl2_
- .ndo_validate_addr = eth_validate_addr,
- .ndo_set_mac_address = atl2_set_mac,
- .ndo_change_mtu = atl2_change_mtu,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- .ndo_fix_features = atl2_fix_features,
- .ndo_set_features = atl2_set_features,
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
- .ndo_do_ioctl = atl2_ioctl,
- .ndo_tx_timeout = atl2_tx_timeout,
- #ifdef CONFIG_NET_POLL_CONTROLLER
-@@ -1417,8 +1421,12 @@ static int atl2_probe(struct pci_dev *pd
-
- err = -EIO;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- netdev->hw_features = NETIF_F_SG | NETIF_F_HW_VLAN_RX;
-+#endif
-+#if defined(NETIF_F_HW_VLAN_TX) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
-+#endif
-
- /* Init PHY as early as possible due to power saving issue */
- atl2_phy_init(&adapter->hw);
-@@ -1838,6 +1846,13 @@ static int atl2_set_settings(struct net_
- return 0;
- }
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
-+static u32 atl2_get_tx_csum(struct net_device *netdev)
-+{
-+ return (netdev->features & NETIF_F_HW_CSUM) != 0;
-+}
-+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
-+
- static u32 atl2_get_msglevel(struct net_device *netdev)
- {
- return 0;
-@@ -2107,6 +2122,14 @@ static const struct ethtool_ops atl2_eth
- .get_eeprom_len = atl2_get_eeprom_len,
- .get_eeprom = atl2_get_eeprom,
- .set_eeprom = atl2_set_eeprom,
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
-+ .get_tx_csum = atl2_get_tx_csum,
-+ .get_sg = ethtool_op_get_sg,
-+ .set_sg = ethtool_op_set_sg,
-+#ifdef NETIF_F_TSO
-+ .get_tso = ethtool_op_get_tso,
-+#endif
-+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
- };
-
- static void atl2_set_ethtool_ops(struct net_device *netdev)
---- a/drivers/net/ethernet/atheros/atlx/atlx.c
-+++ b/drivers/net/ethernet/atheros/atlx/atlx.c
-@@ -254,6 +254,7 @@ static void atlx_restore_vlan(struct atl
- atlx_vlan_mode(adapter->netdev, adapter->netdev->features);
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- static netdev_features_t atlx_fix_features(struct net_device *netdev,
- netdev_features_t features)
- {
-@@ -279,5 +280,6 @@ static int atlx_set_features(struct net_
-
- return 0;
- }
-+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
-
- #endif /* ATLX_C */
---- a/drivers/net/wireless/ath/ath6kl/main.c
-+++ b/drivers/net/wireless/ath/ath6kl/main.c
-@@ -1116,6 +1116,7 @@ static struct net_device_stats *ath6kl_g
- return &vif->net_stats;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- static int ath6kl_set_features(struct net_device *dev,
- netdev_features_t features)
- {
-@@ -1148,6 +1149,7 @@ static int ath6kl_set_features(struct ne
-
- return err;
- }
-+#endif
-
- static void ath6kl_set_multicast_list(struct net_device *ndev)
- {
-@@ -1295,7 +1297,9 @@ static const struct net_device_ops ath6k
- .ndo_stop = ath6kl_close,
- .ndo_start_xmit = ath6kl_data_tx,
- .ndo_get_stats = ath6kl_get_stats,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- .ndo_set_features = ath6kl_set_features,
-+#endif
- .ndo_set_rx_mode = ath6kl_set_multicast_list,
- };
-
-@@ -1312,7 +1316,11 @@ void init_netdev(struct net_device *dev)
- WMI_MAX_TX_META_SZ +
- ATH6KL_HTC_ALIGN_BYTES, 4);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
- dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
-+#else
-+ dev->features |= NETIF_F_IP_CSUM;
-+#endif
-
- return;
- }
--- /dev/null
+This reverts the commits that deal with hw_features and
+set_features, fix_features for kernels < 2.6.39.
+
+Below is one example commit being reverted, but we also do
+this for ath6kl and any driver that uses this in this file.
+
+commit 782d640afd15af7a1faf01cfe566ca4ac511319d
+Author: Michał Mirosław <mirq-linux@rere.qmqm.pl>
+Date: Thu Apr 7 07:32:18 2011 +0000
+
+ net: atl*: convert to hw_features
+
+ Things left as they were:
+ - atl1: is RX checksum really enabled?
+ - atl2: copy-paste from atl1, with-errors-on-modify I presume
+ - atl1c: there's a bug: MTU can't be changed if device is not up
+
+ Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
+ Signed-off-by: David S. Miller <davem@davemloft.net>
+
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c
++++ b/drivers/net/ethernet/atheros/atl1c/atl1c_ethtool.c
+@@ -114,6 +114,13 @@
+ return 0;
+ }
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
++static u32 atl1c_get_tx_csum(struct net_device *netdev)
++{
++ return (netdev->features & NETIF_F_HW_CSUM) != 0;
++}
++#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
++
+ static u32 atl1c_get_msglevel(struct net_device *netdev)
+ {
+ struct atl1c_adapter *adapter = netdev_priv(netdev);
+@@ -301,6 +308,11 @@
+ .get_link = ethtool_op_get_link,
+ .get_eeprom_len = atl1c_get_eeprom_len,
+ .get_eeprom = atl1c_get_eeprom,
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
++ .get_tx_csum = atl1c_get_tx_csum,
++ .get_sg = ethtool_op_get_sg,
++ .set_sg = ethtool_op_set_sg,
++#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
+ };
+
+ void atl1c_set_ethtool_ops(struct net_device *netdev)
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
++++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+@@ -491,6 +491,7 @@
+ roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ static netdev_features_t atl1c_fix_features(struct net_device *netdev,
+ netdev_features_t features)
+ {
+@@ -519,6 +520,7 @@
+
+ return 0;
+ }
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
+
+ /**
+ * atl1c_change_mtu - Change the Maximum Transfer Unit
+@@ -551,8 +553,19 @@
+ netdev->mtu = new_mtu;
+ adapter->hw.max_frame_size = new_mtu;
+ atl1c_set_rxbufsize(adapter, netdev);
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
++ if (new_mtu > MAX_TSO_FRAME_SIZE) {
++ adapter->netdev->features &= ~NETIF_F_TSO;
++ adapter->netdev->features &= ~NETIF_F_TSO6;
++ } else {
++ adapter->netdev->features |= NETIF_F_TSO;
++ adapter->netdev->features |= NETIF_F_TSO6;
++ }
++#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
+ atl1c_down(adapter);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ netdev_update_features(netdev);
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
+ atl1c_up(adapter);
+ clear_bit(__AT_RESETTING, &adapter->flags);
+ }
+@@ -2459,8 +2472,10 @@
+ .ndo_set_mac_address = atl1c_set_mac_addr,
+ .ndo_set_rx_mode = atl1c_set_multi,
+ .ndo_change_mtu = atl1c_change_mtu,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ .ndo_fix_features = atl1c_fix_features,
+ .ndo_set_features = atl1c_set_features,
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
+ .ndo_do_ioctl = atl1c_ioctl,
+ .ndo_tx_timeout = atl1c_tx_timeout,
+ .ndo_get_stats = atl1c_get_stats,
+@@ -2479,6 +2494,7 @@
+ atl1c_set_ethtool_ops(netdev);
+
+ /* TODO: add when ready */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ netdev->hw_features = NETIF_F_SG |
+ NETIF_F_HW_CSUM |
+ NETIF_F_HW_VLAN_RX |
+@@ -2486,6 +2502,14 @@
+ NETIF_F_TSO6;
+ netdev->features = netdev->hw_features |
+ NETIF_F_HW_VLAN_TX;
++#else
++ netdev->features = NETIF_F_SG |
++ NETIF_F_HW_CSUM |
++ NETIF_F_HW_VLAN_TX |
++ NETIF_F_HW_VLAN_RX |
++ NETIF_F_TSO |
++ NETIF_F_TSO6;
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
+ return 0;
+ }
+
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c
++++ b/drivers/net/ethernet/atheros/atl1e/atl1e_ethtool.c
+@@ -384,6 +384,11 @@
+ .get_eeprom_len = atl1e_get_eeprom_len,
+ .get_eeprom = atl1e_get_eeprom,
+ .set_eeprom = atl1e_set_eeprom,
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
++ .set_tx_csum = ethtool_op_set_tx_hw_csum,
++ .set_sg = ethtool_op_set_sg,
++ .set_tso = ethtool_op_set_tso,
++#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
+ };
+
+ void atl1e_set_ethtool_ops(struct net_device *netdev)
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
++++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+@@ -375,6 +375,7 @@
+ return 0;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ static netdev_features_t atl1e_fix_features(struct net_device *netdev,
+ netdev_features_t features)
+ {
+@@ -400,6 +401,7 @@
+
+ return 0;
+ }
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
+
+ /**
+ * atl1e_change_mtu - Change the Maximum Transfer Unit
+@@ -1925,7 +1927,11 @@
+ * reschedule our watchdog timer */
+ set_bit(__AT_DOWN, &adapter->flags);
+
++#if defined(NETIF_F_LLTX) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ netif_stop_queue(netdev);
++#else
++ netif_tx_disable(netdev);
++#endif
+
+ /* reset MAC to disable all RX/TX */
+ atl1e_reset_hw(&adapter->hw);
+@@ -2195,8 +2201,10 @@
+ .ndo_set_rx_mode = atl1e_set_multi,
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_set_mac_address = atl1e_set_mac_addr,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ .ndo_fix_features = atl1e_fix_features,
+ .ndo_set_features = atl1e_set_features,
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
+ .ndo_change_mtu = atl1e_change_mtu,
+ .ndo_do_ioctl = atl1e_ioctl,
+ .ndo_tx_timeout = atl1e_tx_timeout,
+@@ -2216,10 +2224,15 @@
+ netdev->watchdog_timeo = AT_TX_WATCHDOG;
+ atl1e_set_ethtool_ops(netdev);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ netdev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |
+ NETIF_F_HW_VLAN_RX;
+ netdev->features = netdev->hw_features | NETIF_F_LLTX |
+ NETIF_F_HW_VLAN_TX;
++#else
++ netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO |
++ NETIF_F_HW_VLAN_RX | NETIF_F_LLTX | NETIF_F_HW_VLAN_TX;
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
+
+ return 0;
+ }
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atlx/atl1.c
++++ b/drivers/net/ethernet/atheros/atlx/atl1.c
+@@ -2917,8 +2917,10 @@
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_set_mac_address = atl1_set_mac,
+ .ndo_change_mtu = atl1_change_mtu,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ .ndo_fix_features = atlx_fix_features,
+ .ndo_set_features = atlx_set_features,
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
+ .ndo_do_ioctl = atlx_ioctl,
+ .ndo_tx_timeout = atlx_tx_timeout,
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+@@ -3028,11 +3030,13 @@
+ netdev->features |= NETIF_F_SG;
+ netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ netdev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_TSO |
+ NETIF_F_HW_VLAN_RX;
+
+ /* is this valid? see atl1_setup_mac_ctrl() */
+ netdev->features |= NETIF_F_RXCSUM;
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
+
+ /*
+ * patch for some L1 of old version,
+@@ -3645,6 +3649,14 @@
+ return 0;
+ }
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
++/* FIXME: is this right? -- CHS */
++static u32 atl1_get_rx_csum(struct net_device *netdev)
++{
++ return 1;
++}
++#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
++
+ static void atl1_get_strings(struct net_device *netdev, u32 stringset,
+ u8 *data)
+ {
+@@ -3717,4 +3729,10 @@
+ .nway_reset = atl1_nway_reset,
+ .get_ethtool_stats = atl1_get_ethtool_stats,
+ .get_sset_count = atl1_get_sset_count,
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
++ .get_rx_csum = atl1_get_rx_csum,
++ .set_tx_csum = ethtool_op_set_tx_hw_csum,
++ .set_sg = ethtool_op_set_sg,
++ .set_tso = ethtool_op_set_tso,
++#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
+ };
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atlx/atl2.c
++++ b/drivers/net/ethernet/atheros/atlx/atl2.c
+@@ -396,6 +396,7 @@
+ atl2_vlan_mode(adapter->netdev, adapter->netdev->features);
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ static netdev_features_t atl2_fix_features(struct net_device *netdev,
+ netdev_features_t features)
+ {
+@@ -421,6 +422,7 @@
+
+ return 0;
+ }
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
+
+ static void atl2_intr_rx(struct atl2_adapter *adapter)
+ {
+@@ -1319,8 +1321,10 @@
+ .ndo_validate_addr = eth_validate_addr,
+ .ndo_set_mac_address = atl2_set_mac,
+ .ndo_change_mtu = atl2_change_mtu,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ .ndo_fix_features = atl2_fix_features,
+ .ndo_set_features = atl2_set_features,
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
+ .ndo_do_ioctl = atl2_ioctl,
+ .ndo_tx_timeout = atl2_tx_timeout,
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+@@ -1417,8 +1421,12 @@
+
+ err = -EIO;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ netdev->hw_features = NETIF_F_SG | NETIF_F_HW_VLAN_RX;
++#endif
++#if defined(NETIF_F_HW_VLAN_TX) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
++#endif
+
+ /* Init PHY as early as possible due to power saving issue */
+ atl2_phy_init(&adapter->hw);
+@@ -1838,6 +1846,13 @@
+ return 0;
+ }
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
++static u32 atl2_get_tx_csum(struct net_device *netdev)
++{
++ return (netdev->features & NETIF_F_HW_CSUM) != 0;
++}
++#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
++
+ static u32 atl2_get_msglevel(struct net_device *netdev)
+ {
+ return 0;
+@@ -2107,6 +2122,14 @@
+ .get_eeprom_len = atl2_get_eeprom_len,
+ .get_eeprom = atl2_get_eeprom,
+ .set_eeprom = atl2_set_eeprom,
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
++ .get_tx_csum = atl2_get_tx_csum,
++ .get_sg = ethtool_op_get_sg,
++ .set_sg = ethtool_op_set_sg,
++#ifdef NETIF_F_TSO
++ .get_tso = ethtool_op_get_tso,
++#endif
++#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
+ };
+
+ static void atl2_set_ethtool_ops(struct net_device *netdev)
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atlx/atlx.c
++++ b/drivers/net/ethernet/atheros/atlx/atlx.c
+@@ -254,6 +254,7 @@
+ atlx_vlan_mode(adapter->netdev, adapter->netdev->features);
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ static netdev_features_t atlx_fix_features(struct net_device *netdev,
+ netdev_features_t features)
+ {
+@@ -279,5 +280,6 @@
+
+ return 0;
+ }
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
+
+ #endif /* ATLX_C */
--- /dev/null
+--- a/drivers/net/wireless/ath/ath6kl/main.c
++++ b/drivers/net/wireless/ath/ath6kl/main.c
+@@ -1116,6 +1116,7 @@
+ return &vif->net_stats;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ static int ath6kl_set_features(struct net_device *dev,
+ netdev_features_t features)
+ {
+@@ -1148,6 +1149,7 @@
+
+ return err;
+ }
++#endif
+
+ static void ath6kl_set_multicast_list(struct net_device *ndev)
+ {
+@@ -1295,7 +1297,9 @@
+ .ndo_stop = ath6kl_close,
+ .ndo_start_xmit = ath6kl_data_tx,
+ .ndo_get_stats = ath6kl_get_stats,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ .ndo_set_features = ath6kl_set_features,
++#endif
+ .ndo_set_rx_mode = ath6kl_set_multicast_list,
+ };
+
+@@ -1312,7 +1316,11 @@
+ WMI_MAX_TX_META_SZ +
+ ATH6KL_HTC_ALIGN_BYTES, 4);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
+ dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
++#else
++ dev->features |= NETIF_F_IP_CSUM;
++#endif
+
+ return;
+ }
+++ /dev/null
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -5669,7 +5669,9 @@ static int nl80211_dump_scan(struct sk_b
- spin_lock_bh(&rdev->bss_lock);
- cfg80211_bss_expire(rdev);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
- cb->seq = rdev->bss_generation;
-+#endif
-
- list_for_each_entry(scan, &rdev->bss_list, list) {
- if (++idx <= start)
--- /dev/null
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -5669,7 +5669,9 @@
+ spin_lock_bh(&rdev->bss_lock);
+ cfg80211_bss_expire(rdev);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
+ cb->seq = rdev->bss_generation;
++#endif
+
+ list_for_each_entry(scan, &rdev->bss_list, list) {
+ if (++idx <= start)
+++ /dev/null
---- a/drivers/net/wireless/ipw2x00/ipw2100.c
-+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
-@@ -175,7 +175,11 @@ that only one external action is invoked
- #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver"
- #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation"
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0))
-+static struct pm_qos_request_list ipw2100_pm_qos_req;
-+#else
- static struct pm_qos_request ipw2100_pm_qos_req;
-+#endif
-
- /* Debugging stuff */
- #ifdef CONFIG_IPW2100_DEBUG
--- /dev/null
+--- a/drivers/net/wireless/ipw2x00/ipw2100.c
++++ b/drivers/net/wireless/ipw2x00/ipw2100.c
+@@ -175,7 +175,11 @@
+ #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver"
+ #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation"
+
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0))
++static struct pm_qos_request_list ipw2100_pm_qos_req;
++#else
+ static struct pm_qos_request ipw2100_pm_qos_req;
++#endif
+
+ /* Debugging stuff */
+ #ifdef CONFIG_IPW2100_DEBUG
+++ /dev/null
-Do not activate the mac80211 tracing for kernels <= 2.6.32
-
---- a/net/mac80211/Makefile
-+++ b/net/mac80211/Makefile
-@@ -25,7 +25,9 @@ mac80211-y := \
- wme.o \
- event.o \
- chan.o \
-- trace.o mlme.o
-+ mlme.o
-+
-+mac80211-$(CONFIG_COMPAT_MAC80211_DRIVER_API_TRACER) += trace.o
-
- mac80211-$(CONFIG_MAC80211_LEDS) += led.o
- mac80211-$(CONFIG_MAC80211_DEBUGFS) += \
---- a/net/wireless/Makefile
-+++ b/net/wireless/Makefile
-@@ -10,7 +10,8 @@ obj-$(CONFIG_WEXT_SPY) += wext-spy.o
- obj-$(CONFIG_WEXT_PRIV) += wext-priv.o
-
- cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o
--cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o trace.o
-+cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o
-+cfg80211-$(CONFIG_COMPAT_CFG80211_DRIVER_API_TRACER) += trace.o
- cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o
- cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o
- cfg80211-$(CONFIG_CFG80211_INTERNAL_REGDB) += regdb.o
--- /dev/null
+Do not activate the mac80211 tracing for kernels <= 2.6.32
+
--- /dev/null
+--- a/net/mac80211/Makefile
++++ b/net/mac80211/Makefile
+@@ -25,7 +25,9 @@
+ wme.o \
+ event.o \
+ chan.o \
+- trace.o mlme.o
++ mlme.o
++
++mac80211-$(CONFIG_COMPAT_MAC80211_DRIVER_API_TRACER) += trace.o
+
+ mac80211-$(CONFIG_MAC80211_LEDS) += led.o
+ mac80211-$(CONFIG_MAC80211_DEBUGFS) += \
--- /dev/null
+--- a/net/wireless/Makefile
++++ b/net/wireless/Makefile
+@@ -10,7 +10,8 @@
+ obj-$(CONFIG_WEXT_PRIV) += wext-priv.o
+
+ cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o
+-cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o trace.o
++cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o
++cfg80211-$(CONFIG_COMPAT_CFG80211_DRIVER_API_TRACER) += trace.o
+ cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o
+ cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o
+ cfg80211-$(CONFIG_CFG80211_INTERNAL_REGDB) += regdb.o
+++ /dev/null
---- a/drivers/net/wireless/ti/wl12xx/main.c
-+++ b/drivers/net/wireless/ti/wl12xx/main.c
-@@ -1815,16 +1815,20 @@ out:
- return wlcore_remove(pdev);
- }
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
- static const struct platform_device_id wl12xx_id_table[] = {
- { "wl12xx", 0 },
- { } /* Terminating Entry */
- };
- MODULE_DEVICE_TABLE(platform, wl12xx_id_table);
-+#endif
-
- static struct platform_driver wl12xx_driver = {
- .probe = wl12xx_probe,
- .remove = wl12xx_remove,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
- .id_table = wl12xx_id_table,
-+#endif
- .driver = {
- .name = "wl12xx_driver",
- .owner = THIS_MODULE,
--- /dev/null
+--- a/drivers/net/wireless/ti/wl12xx/main.c
++++ b/drivers/net/wireless/ti/wl12xx/main.c
+@@ -1815,16 +1815,20 @@
+ return wlcore_remove(pdev);
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
+ static const struct platform_device_id wl12xx_id_table[] = {
+ { "wl12xx", 0 },
+ { } /* Terminating Entry */
+ };
+ MODULE_DEVICE_TABLE(platform, wl12xx_id_table);
++#endif
+
+ static struct platform_driver wl12xx_driver = {
+ .probe = wl12xx_probe,
+ .remove = wl12xx_remove,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
+ .id_table = wl12xx_id_table,
++#endif
+ .driver = {
+ .name = "wl12xx_driver",
+ .owner = THIS_MODULE,
+++ /dev/null
-Old kernel versions do not support WQ_HIGHPRI and WQ_MEM_RECLAIM so we
-should use create_singlethread_workqueue() which was used at this
-position before.
-
---- a/net/bluetooth/hci_core.c
-+++ b/net/bluetooth/hci_core.c
-@@ -2066,16 +2066,24 @@ int hci_register_dev(struct hci_dev *hde
- list_add(&hdev->list, &hci_dev_list);
- write_unlock(&hci_dev_list_lock);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- hdev->workqueue = alloc_workqueue(hdev->name, WQ_HIGHPRI | WQ_UNBOUND |
- WQ_MEM_RECLAIM, 1);
-+#else
-+ hdev->workqueue = create_singlethread_workqueue(hdev->name);
-+#endif
- if (!hdev->workqueue) {
- error = -ENOMEM;
- goto err;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- hdev->req_workqueue = alloc_workqueue(hdev->name,
- WQ_HIGHPRI | WQ_UNBOUND |
- WQ_MEM_RECLAIM, 1);
-+#else
-+ hdev->req_workqueue = create_singlethread_workqueue(hdev->name);
-+#endif
- if (!hdev->req_workqueue) {
- destroy_workqueue(hdev->workqueue);
- error = -ENOMEM;
--- /dev/null
+Old kernel versions do not support WQ_HIGHPRI and WQ_MEM_RECLAIM so we
+should use create_singlethread_workqueue() which was used at this
+position before.
+
--- /dev/null
+--- a/net/bluetooth/hci_core.c
++++ b/net/bluetooth/hci_core.c
+@@ -2066,16 +2066,24 @@
+ list_add(&hdev->list, &hci_dev_list);
+ write_unlock(&hci_dev_list_lock);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ hdev->workqueue = alloc_workqueue(hdev->name, WQ_HIGHPRI | WQ_UNBOUND |
+ WQ_MEM_RECLAIM, 1);
++#else
++ hdev->workqueue = create_singlethread_workqueue(hdev->name);
++#endif
+ if (!hdev->workqueue) {
+ error = -ENOMEM;
+ goto err;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ hdev->req_workqueue = alloc_workqueue(hdev->name,
+ WQ_HIGHPRI | WQ_UNBOUND |
+ WQ_MEM_RECLAIM, 1);
++#else
++ hdev->req_workqueue = create_singlethread_workqueue(hdev->name);
++#endif
+ if (!hdev->req_workqueue) {
+ destroy_workqueue(hdev->workqueue);
+ error = -ENOMEM;
+++ /dev/null
-The struct netdev_queue does not have the attribute trans_start in
-kernel < 2.6.31. trans_start on struct net_device does the same
-on older kernels.
-
---- a/drivers/net/wireless/mwifiex/init.c
-+++ b/drivers/net/wireless/mwifiex/init.c
-@@ -371,8 +371,10 @@ void mwifiex_set_trans_start(struct net_
- {
- int i;
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
- for (i = 0; i < dev->num_tx_queues; i++)
- netdev_get_tx_queue(dev, i)->trans_start = jiffies;
-+#endif
-
- dev->trans_start = jiffies;
- }
--- /dev/null
+The struct netdev_queue does not have the attribute trans_start in
+kernel < 2.6.31. trans_start on struct net_device does the same
+on older kernels.
+
--- /dev/null
+--- a/drivers/net/wireless/mwifiex/init.c
++++ b/drivers/net/wireless/mwifiex/init.c
+@@ -371,8 +371,10 @@
+ {
+ int i;
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
+ for (i = 0; i < dev->num_tx_queues; i++)
+ netdev_get_tx_queue(dev, i)->trans_start = jiffies;
++#endif
+
+ dev->trans_start = jiffies;
+ }
+++ /dev/null
-Use skb_get_queue_mapping() for getting the queue_mapping member of
-skb. Some old kernels do not have the member queue_mapping, but this
-function always returns something.
-
---- a/drivers/net/wireless/b43/main.c
-+++ b/drivers/net/wireless/b43/main.c
-@@ -3456,11 +3456,11 @@ static void b43_op_tx(struct ieee80211_h
- }
- B43_WARN_ON(skb_shinfo(skb)->nr_frags);
-
-- skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb);
-- if (!wl->tx_queue_stopped[skb->queue_mapping]) {
-+ skb_queue_tail(&wl->tx_queue[skb_get_queue_mapping(skb)], skb);
-+ if (!wl->tx_queue_stopped[skb_get_queue_mapping(skb)]) {
- ieee80211_queue_work(wl->hw, &wl->tx_work);
- } else {
-- ieee80211_stop_queue(wl->hw, skb->queue_mapping);
-+ ieee80211_stop_queue(wl->hw, skb_get_queue_mapping(skb));
- }
- }
-
---- a/drivers/net/wireless/b43legacy/main.c
-+++ b/drivers/net/wireless/b43legacy/main.c
-@@ -2529,11 +2529,11 @@ static void b43legacy_op_tx(struct ieee8
- }
- B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags);
-
-- skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb);
-- if (!wl->tx_queue_stopped[skb->queue_mapping])
-+ skb_queue_tail(&wl->tx_queue[skb_get_queue_mapping(skb)], skb);
-+ if (!wl->tx_queue_stopped[skb_get_queue_mapping(skb)])
- ieee80211_queue_work(wl->hw, &wl->tx_work);
- else
-- ieee80211_stop_queue(wl->hw, skb->queue_mapping);
-+ ieee80211_stop_queue(wl->hw, skb_get_queue_mapping(skb));
- }
-
- static int b43legacy_op_conf_tx(struct ieee80211_hw *hw,
--- /dev/null
+Use skb_get_queue_mapping() for getting the queue_mapping member of
+skb. Some old kernels do not have the member queue_mapping, but this
+function always returns something.
+
--- /dev/null
+--- a/drivers/net/wireless/b43/main.c
++++ b/drivers/net/wireless/b43/main.c
+@@ -3456,11 +3456,11 @@
+ }
+ B43_WARN_ON(skb_shinfo(skb)->nr_frags);
+
+- skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb);
+- if (!wl->tx_queue_stopped[skb->queue_mapping]) {
++ skb_queue_tail(&wl->tx_queue[skb_get_queue_mapping(skb)], skb);
++ if (!wl->tx_queue_stopped[skb_get_queue_mapping(skb)]) {
+ ieee80211_queue_work(wl->hw, &wl->tx_work);
+ } else {
+- ieee80211_stop_queue(wl->hw, skb->queue_mapping);
++ ieee80211_stop_queue(wl->hw, skb_get_queue_mapping(skb));
+ }
+ }
+
--- /dev/null
+--- a/drivers/net/wireless/b43legacy/main.c
++++ b/drivers/net/wireless/b43legacy/main.c
+@@ -2529,11 +2529,11 @@
+ }
+ B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags);
+
+- skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb);
+- if (!wl->tx_queue_stopped[skb->queue_mapping])
++ skb_queue_tail(&wl->tx_queue[skb_get_queue_mapping(skb)], skb);
++ if (!wl->tx_queue_stopped[skb_get_queue_mapping(skb)])
+ ieee80211_queue_work(wl->hw, &wl->tx_work);
+ else
+- ieee80211_stop_queue(wl->hw, skb->queue_mapping);
++ ieee80211_stop_queue(wl->hw, skb_get_queue_mapping(skb));
+ }
+
+ static int b43legacy_op_conf_tx(struct ieee80211_hw *hw,
+++ /dev/null
-This section of the libertas driver calls functions that simply don't
-exist before the release of 3.1. This code in question was an addition,
-not a change from any existing code. It is safe to simply remove it for
-older kernels.
-
---- a/drivers/net/wireless/libertas/if_usb.c
-+++ b/drivers/net/wireless/libertas/if_usb.c
-@@ -962,6 +962,7 @@ static int if_usb_suspend(struct usb_int
- goto out;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
- #ifdef CONFIG_OLPC
- if (machine_is_olpc()) {
- if (priv->wol_criteria == EHS_REMOVE_WAKEUP)
-@@ -970,6 +971,7 @@ static int if_usb_suspend(struct usb_int
- olpc_ec_wakeup_set(EC_SCI_SRC_WLAN);
- }
- #endif
-+#endif
-
- ret = lbs_suspend(priv);
- if (ret)
--- /dev/null
+This section of the libertas driver calls functions that simply don't
+exist before the release of 3.1. This code in question was an addition,
+not a change from any existing code. It is safe to simply remove it for
+older kernels.
+
--- /dev/null
+--- a/drivers/net/wireless/libertas/if_usb.c
++++ b/drivers/net/wireless/libertas/if_usb.c
+@@ -962,6 +962,7 @@
+ goto out;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
+ #ifdef CONFIG_OLPC
+ if (machine_is_olpc()) {
+ if (priv->wol_criteria == EHS_REMOVE_WAKEUP)
+@@ -970,6 +971,7 @@
+ olpc_ec_wakeup_set(EC_SCI_SRC_WLAN);
+ }
+ #endif
++#endif
+
+ ret = lbs_suspend(priv);
+ if (ret)
+++ /dev/null
-
-tty->dev does not exist until 2.6.37. Typically
-subsystems will assign the tty device to a child
-to make a symlink under /sys/class/foobar. An example
-is the bluetooth subsystem.
-
-commit 7f4b2b04c88377af30c022f36c060190182850fb
-Author: Andrei Warkentin <andreiw@motorola.com>
-Date: Fri Feb 11 17:19:26 2011 -0600
-
- Bluetooth: Make hci a child of the corresponding tty device.
-
- Make /sys/class/bluetooth/hciX a symlink to
- path under corresponding tty.
-
- Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
- Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-
-
---- a/drivers/bluetooth/hci_ldisc.c
-+++ b/drivers/bluetooth/hci_ldisc.c
-@@ -421,7 +421,10 @@ static int hci_uart_register_dev(struct
- hdev->close = hci_uart_close;
- hdev->flush = hci_uart_flush;
- hdev->send = hci_uart_send_frame;
-+
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
- SET_HCIDEV_DEV(hdev, hu->tty->dev);
-+#endif
-
- if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags))
- set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
--- /dev/null
+
+tty->dev does not exist until 2.6.37. Typically
+subsystems will assign the tty device to a child
+to make a symlink under /sys/class/foobar. An example
+is the bluetooth subsystem.
+
+commit 7f4b2b04c88377af30c022f36c060190182850fb
+Author: Andrei Warkentin <andreiw@motorola.com>
+Date: Fri Feb 11 17:19:26 2011 -0600
+
+ Bluetooth: Make hci a child of the corresponding tty device.
+
+ Make /sys/class/bluetooth/hciX a symlink to
+ path under corresponding tty.
+
+ Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
+ Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
+
+
--- /dev/null
+--- a/drivers/bluetooth/hci_ldisc.c
++++ b/drivers/bluetooth/hci_ldisc.c
+@@ -421,7 +421,10 @@
+ hdev->close = hci_uart_close;
+ hdev->flush = hci_uart_flush;
+ hdev->send = hci_uart_send_frame;
++
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
+ SET_HCIDEV_DEV(hdev, hu->tty->dev);
++#endif
+
+ if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags))
+ set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
+++ /dev/null
-This is the correct way to use pr_fmt. This helps avoid
-compiler warnings. This is going to be sent upstream.
-
---- a/drivers/bcma/bcma_private.h
-+++ b/drivers/bcma/bcma_private.h
-@@ -1,10 +1,10 @@
- #ifndef LINUX_BCMA_PRIVATE_H_
- #define LINUX_BCMA_PRIVATE_H_
-
--#ifndef pr_fmt
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
--#endif
-
-+#include <linux/printk.h>
- #include <linux/bcma/bcma.h>
- #include <linux/delay.h>
-
---- a/drivers/net/ethernet/broadcom/b44.c
-+++ b/drivers/net/ethernet/broadcom/b44.c
-@@ -10,9 +10,11 @@
- * Distribute under GPL.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include <linux/kernel.h>
-+#include <linux/printk.h>
- #include <linux/module.h>
- #include <linux/moduleparam.h>
- #include <linux/types.h>
---- a/drivers/net/wireless/iwlegacy/3945-mac.c
-+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
-@@ -27,9 +27,11 @@
- *
- *****************************************************************************/
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include <linux/kernel.h>
-+#include <linux/printk.h>
- #include <linux/module.h>
- #include <linux/init.h>
- #include <linux/pci.h>
---- a/drivers/net/wireless/iwlegacy/4965-mac.c
-+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
-@@ -27,9 +27,11 @@
- *
- *****************************************************************************/
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include <linux/kernel.h>
-+#include <linux/printk.h>
- #include <linux/module.h>
- #include <linux/init.h>
- #include <linux/pci.h>
---- a/drivers/net/wireless/libertas/cfg.c
-+++ b/drivers/net/wireless/libertas/cfg.c
-@@ -6,8 +6,10 @@
- *
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/hardirq.h>
- #include <linux/sched.h>
- #include <linux/wait.h>
---- a/drivers/net/wireless/libertas/if_usb.c
-+++ b/drivers/net/wireless/libertas/if_usb.c
-@@ -2,8 +2,10 @@
- * This file contains functions used in USB interface module.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/delay.h>
- #include <linux/module.h>
- #include <linux/firmware.h>
---- a/drivers/net/wireless/libertas/if_sdio.c
-+++ b/drivers/net/wireless/libertas/if_sdio.c
-@@ -26,9 +26,11 @@
- * if_sdio_card_to_host() to pad the data.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include <linux/kernel.h>
-+#include <linux/printk.h>
- #include <linux/module.h>
- #include <linux/slab.h>
- #include <linux/firmware.h>
---- a/drivers/net/wireless/libertas/if_spi.c
-+++ b/drivers/net/wireless/libertas/if_spi.c
-@@ -17,8 +17,10 @@
- * (at your option) any later version.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/hardirq.h>
- #include <linux/interrupt.h>
- #include <linux/module.h>
---- a/drivers/net/wireless/libertas/rx.c
-+++ b/drivers/net/wireless/libertas/rx.c
-@@ -2,8 +2,10 @@
- * This file contains the handling of RX in wlan driver.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/etherdevice.h>
- #include <linux/hardirq.h>
- #include <linux/slab.h>
---- a/drivers/net/wireless/libertas/if_cs.c
-+++ b/drivers/net/wireless/libertas/if_cs.c
-@@ -21,8 +21,10 @@
-
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/module.h>
- #include <linux/slab.h>
- #include <linux/delay.h>
---- a/drivers/net/wireless/libertas/mesh.c
-+++ b/drivers/net/wireless/libertas/mesh.c
-@@ -1,5 +1,7 @@
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/delay.h>
- #include <linux/etherdevice.h>
- #include <linux/hardirq.h>
---- a/drivers/net/wireless/libertas/main.c
-+++ b/drivers/net/wireless/libertas/main.c
-@@ -4,8 +4,10 @@
- * thread etc..
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/module.h>
- #include <linux/delay.h>
- #include <linux/etherdevice.h>
---- a/drivers/net/wireless/libertas_tf/cmd.c
-+++ b/drivers/net/wireless/libertas_tf/cmd.c
-@@ -7,8 +7,10 @@
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- */
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/hardirq.h>
- #include <linux/slab.h>
- #include <linux/export.h>
---- a/drivers/net/wireless/libertas_tf/if_usb.c
-+++ b/drivers/net/wireless/libertas_tf/if_usb.c
-@@ -9,11 +9,13 @@
- */
- #define DRV_NAME "lbtf_usb"
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include "libertas_tf.h"
- #include "if_usb.h"
-
-+#include <linux/printk.h>
- #include <linux/delay.h>
- #include <linux/module.h>
- #include <linux/firmware.h>
---- a/drivers/net/wireless/libertas_tf/main.c
-+++ b/drivers/net/wireless/libertas_tf/main.c
-@@ -7,8 +7,10 @@
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- */
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/hardirq.h>
- #include <linux/slab.h>
-
---- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
-+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
-@@ -14,9 +14,11 @@
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include <linux/kernel.h>
-+#include <linux/printk.h>
- #include <linux/delay.h>
- #include <linux/cordic.h>
-
---- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
-+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
-@@ -16,8 +16,10 @@
- */
-
- #define __UNDEF_NO_VERSION__
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/etherdevice.h>
- #include <linux/sched.h>
- #include <linux/firmware.h>
---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
-+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
-@@ -15,8 +15,10 @@
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/pci_ids.h>
- #include <linux/if_ether.h>
- #include <net/cfg80211.h>
---- a/drivers/net/wireless/brcm80211/brcmutil/utils.c
-+++ b/drivers/net/wireless/brcm80211/brcmutil/utils.c
-@@ -14,8 +14,10 @@
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/netdevice.h>
- #include <linux/module.h>
-
---- a/net/bluetooth/lib.c
-+++ b/net/bluetooth/lib.c
-@@ -24,9 +24,11 @@
-
- /* Bluetooth kernel library. */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) "Bluetooth: " fmt
-
- #include <linux/export.h>
-+#include <linux/printk.h>
-
- #include <net/bluetooth/bluetooth.h>
-
---- a/net/wireless/lib80211.c
-+++ b/net/wireless/lib80211.c
-@@ -13,8 +13,10 @@
- *
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/module.h>
- #include <linux/ctype.h>
- #include <linux/ieee80211.h>
---- a/net/wireless/reg.c
-+++ b/net/wireless/reg.c
-@@ -42,9 +42,11 @@
- *
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include <linux/kernel.h>
-+#include <linux/printk.h>
- #include <linux/export.h>
- #include <linux/slab.h>
- #include <linux/list.h>
---- a/net/wireless/core.c
-+++ b/net/wireless/core.c
-@@ -4,8 +4,10 @@
- * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/if.h>
- #include <linux/module.h>
- #include <linux/err.h>
---- a/net/wireless/lib80211_crypt_tkip.c
-+++ b/net/wireless/lib80211_crypt_tkip.c
-@@ -10,8 +10,10 @@
- * more details.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/err.h>
- #include <linux/module.h>
- #include <linux/init.h>
---- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
-+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
-@@ -16,8 +16,10 @@
- * File contents: support functions for PCI/PCIe
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/delay.h>
-
- #include <defs.h>
---- a/drivers/net/wireless/rtlwifi/wifi.h
-+++ b/drivers/net/wireless/rtlwifi/wifi.h
-@@ -30,8 +30,10 @@
- #ifndef __RTL_WIFI_H__
- #define __RTL_WIFI_H__
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/sched.h>
- #include <linux/firmware.h>
- #include <linux/etherdevice.h>
---- a/drivers/net/wireless/ath/main.c
-+++ b/drivers/net/wireless/ath/main.c
-@@ -14,9 +14,11 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include <linux/kernel.h>
-+#include <linux/printk.h>
- #include <linux/module.h>
-
- #include "ath.h"
---- a/drivers/net/wireless/ath/regd.c
-+++ b/drivers/net/wireless/ath/regd.c
-@@ -14,9 +14,11 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include <linux/kernel.h>
-+#include <linux/printk.h>
- #include <linux/export.h>
- #include <net/cfg80211.h>
- #include <net/mac80211.h>
---- a/drivers/net/wireless/ath/ath5k/initvals.c
-+++ b/drivers/net/wireless/ath/ath5k/initvals.c
-@@ -19,8 +19,11 @@
- *
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
-+
- #include "ath5k.h"
- #include "reg.h"
- #include "debug.h"
---- a/drivers/net/wireless/ath/ath5k/desc.c
-+++ b/drivers/net/wireless/ath/ath5k/desc.c
-@@ -21,8 +21,11 @@
- Hardware Descriptor Functions
- \******************************/
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
-+
- #include "ath5k.h"
- #include "reg.h"
- #include "debug.h"
---- a/drivers/net/wireless/ath/ath5k/dma.c
-+++ b/drivers/net/wireless/ath/ath5k/dma.c
-@@ -29,8 +29,11 @@
- * status registers (ISR).
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
-+
- #include "ath5k.h"
- #include "reg.h"
- #include "debug.h"
---- a/drivers/net/wireless/ath/ath5k/qcu.c
-+++ b/drivers/net/wireless/ath/ath5k/qcu.c
-@@ -20,8 +20,11 @@
- Queue Control Unit, DCF Control Unit Functions
- \********************************************/
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
-+
- #include "ath5k.h"
- #include "reg.h"
- #include "debug.h"
---- a/drivers/net/wireless/ath/ath5k/phy.c
-+++ b/drivers/net/wireless/ath/ath5k/phy.c
-@@ -22,8 +22,10 @@
- * PHY related functions *
- \***********************/
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/delay.h>
- #include <linux/slab.h>
- #include <asm/unaligned.h>
---- a/drivers/net/wireless/ath/ath5k/reset.c
-+++ b/drivers/net/wireless/ath/ath5k/reset.c
-@@ -23,10 +23,12 @@
- Reset function and helpers
- \****************************/
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include <asm/unaligned.h>
-
-+#include <linux/printk.h>
- #include <linux/pci.h> /* To determine if a card is pci-e */
- #include <linux/log2.h>
- #include <linux/platform_device.h>
---- a/drivers/net/wireless/ath/ath5k/attach.c
-+++ b/drivers/net/wireless/ath/ath5k/attach.c
-@@ -20,8 +20,10 @@
- * Attach/Detach Functions and helpers *
- \*************************************/
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/pci.h>
- #include <linux/slab.h>
- #include "ath5k.h"
---- a/drivers/net/wireless/ath/ath5k/base.c
-+++ b/drivers/net/wireless/ath/ath5k/base.c
-@@ -40,8 +40,10 @@
- *
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/module.h>
- #include <linux/delay.h>
- #include <linux/dma-mapping.h>
---- a/drivers/net/wireless/ath/ath5k/led.c
-+++ b/drivers/net/wireless/ath/ath5k/led.c
-@@ -39,8 +39,10 @@
- *
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/pci.h>
- #include "ath5k.h"
-
---- a/drivers/net/wireless/ath/ath5k/ani.c
-+++ b/drivers/net/wireless/ath/ath5k/ani.c
-@@ -14,8 +14,11 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
-+
- #include "ath5k.h"
- #include "reg.h"
- #include "debug.h"
---- a/drivers/net/wireless/ath/ath5k/sysfs.c
-+++ b/drivers/net/wireless/ath/ath5k/sysfs.c
-@@ -1,5 +1,7 @@
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/device.h>
- #include <linux/pci.h>
-
---- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
-+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
-@@ -41,11 +41,14 @@
- *
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
- #include <net/mac80211.h>
- #include <asm/unaligned.h>
-
-+#include <linux/printk.h>
-+
- #include "ath5k.h"
- #include "base.h"
- #include "reg.h"
---- a/drivers/net/wireless/ath/ath5k/pci.c
-+++ b/drivers/net/wireless/ath/ath5k/pci.c
-@@ -14,8 +14,10 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/nl80211.h>
- #include <linux/pci.h>
- #include <linux/pci-aspm.h>
---- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
-+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
-@@ -15,8 +15,10 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/moduleparam.h>
- #include <linux/inetdevice.h>
- #include <linux/export.h>
---- a/drivers/net/wireless/ath/ath6kl/init.c
-+++ b/drivers/net/wireless/ath/ath6kl/init.c
-@@ -16,8 +16,10 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/moduleparam.h>
- #include <linux/errno.h>
- #include <linux/export.h>
---- a/drivers/net/wireless/ath/ath6kl/main.c
-+++ b/drivers/net/wireless/ath/ath6kl/main.c
-@@ -15,8 +15,11 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
-+
- #include "core.h"
- #include "hif-ops.h"
- #include "cfg80211.h"
---- a/drivers/net/wireless/ath/ath6kl/txrx.c
-+++ b/drivers/net/wireless/ath/ath6kl/txrx.c
-@@ -15,8 +15,11 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
-+
- #include "core.h"
- #include "debug.h"
- #include "htc-ops.h"
---- a/drivers/net/wireless/ath/ath9k/init.c
-+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -14,8 +14,10 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/dma-mapping.h>
- #include <linux/slab.h>
- #include <linux/ath9k_platform.h>
---- a/drivers/net/wireless/ath/ath9k/pci.c
-+++ b/drivers/net/wireless/ath/ath9k/pci.c
-@@ -14,8 +14,10 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/nl80211.h>
- #include <linux/pci.h>
- #include <linux/pci-aspm.h>
---- a/drivers/net/wireless/ath/ath9k/htc_hst.c
-+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
-@@ -14,8 +14,11 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
-+
- #include "htc.h"
-
- static int htc_issue_send(struct htc_target *target, struct sk_buff* skb,
---- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
-+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
-@@ -14,8 +14,11 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
-+
- #include "htc.h"
-
- MODULE_AUTHOR("Atheros Communications");
---- a/drivers/net/wireless/iwlwifi/dvm/main.c
-+++ b/drivers/net/wireless/iwlwifi/dvm/main.c
-@@ -27,8 +27,10 @@
- *
- *****************************************************************************/
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/init.h>
---- a/drivers/net/wireless/iwlwifi/pcie/drv.c
-+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
-@@ -61,8 +61,10 @@
- *
- *****************************************************************************/
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/module.h>
- #include <linux/pci.h>
- #include <linux/pci-aspm.h>
---- a/drivers/net/wireless/ath/ath5k/eeprom.c
-+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
-@@ -21,8 +21,10 @@
- * EEPROM access functions and helpers *
- \*************************************/
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/slab.h>
-
- #include "ath5k.h"
---- a/drivers/net/wireless/ath/ath5k/debug.c
-+++ b/drivers/net/wireless/ath/ath5k/debug.c
-@@ -58,8 +58,10 @@
- * THE POSSIBILITY OF SUCH DAMAGES.
- */
-
-+#undef pr_fmt
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-+#include <linux/printk.h>
- #include <linux/export.h>
- #include <linux/moduleparam.h>
-
--- /dev/null
+This is the correct way to use pr_fmt. This helps avoid
+compiler warnings. This is going to be sent upstream.
+
--- /dev/null
+--- a/drivers/bcma/bcma_private.h
++++ b/drivers/bcma/bcma_private.h
+@@ -1,10 +1,10 @@
+ #ifndef LINUX_BCMA_PRIVATE_H_
+ #define LINUX_BCMA_PRIVATE_H_
+
+-#ifndef pr_fmt
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+-#endif
+
++#include <linux/printk.h>
+ #include <linux/bcma/bcma.h>
+ #include <linux/delay.h>
+
--- /dev/null
+--- a/drivers/net/ethernet/broadcom/b44.c
++++ b/drivers/net/ethernet/broadcom/b44.c
+@@ -10,9 +10,11 @@
+ * Distribute under GPL.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/moduleparam.h>
+ #include <linux/types.h>
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/ani.c
++++ b/drivers/net/wireless/ath/ath5k/ani.c
+@@ -14,8 +14,11 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
++
+ #include "ath5k.h"
+ #include "reg.h"
+ #include "debug.h"
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/attach.c
++++ b/drivers/net/wireless/ath/ath5k/attach.c
+@@ -20,8 +20,10 @@
+ * Attach/Detach Functions and helpers *
+ \*************************************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/pci.h>
+ #include <linux/slab.h>
+ #include "ath5k.h"
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/base.c
++++ b/drivers/net/wireless/ath/ath5k/base.c
+@@ -40,8 +40,10 @@
+ *
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/delay.h>
+ #include <linux/dma-mapping.h>
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/debug.c
++++ b/drivers/net/wireless/ath/ath5k/debug.c
+@@ -58,8 +58,10 @@
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/export.h>
+ #include <linux/moduleparam.h>
+
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/desc.c
++++ b/drivers/net/wireless/ath/ath5k/desc.c
+@@ -21,8 +21,11 @@
+ Hardware Descriptor Functions
+ \******************************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
++
+ #include "ath5k.h"
+ #include "reg.h"
+ #include "debug.h"
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/dma.c
++++ b/drivers/net/wireless/ath/ath5k/dma.c
+@@ -29,8 +29,11 @@
+ * status registers (ISR).
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
++
+ #include "ath5k.h"
+ #include "reg.h"
+ #include "debug.h"
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/eeprom.c
++++ b/drivers/net/wireless/ath/ath5k/eeprom.c
+@@ -21,8 +21,10 @@
+ * EEPROM access functions and helpers *
+ \*************************************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/slab.h>
+
+ #include "ath5k.h"
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/initvals.c
++++ b/drivers/net/wireless/ath/ath5k/initvals.c
+@@ -19,8 +19,11 @@
+ *
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
++
+ #include "ath5k.h"
+ #include "reg.h"
+ #include "debug.h"
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/led.c
++++ b/drivers/net/wireless/ath/ath5k/led.c
+@@ -39,8 +39,10 @@
+ *
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/pci.h>
+ #include "ath5k.h"
+
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
++++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+@@ -41,11 +41,14 @@
+ *
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <net/mac80211.h>
+ #include <asm/unaligned.h>
+
++#include <linux/printk.h>
++
+ #include "ath5k.h"
+ #include "base.h"
+ #include "reg.h"
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/pci.c
++++ b/drivers/net/wireless/ath/ath5k/pci.c
+@@ -14,8 +14,10 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/nl80211.h>
+ #include <linux/pci.h>
+ #include <linux/pci-aspm.h>
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/phy.c
++++ b/drivers/net/wireless/ath/ath5k/phy.c
+@@ -22,8 +22,10 @@
+ * PHY related functions *
+ \***********************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/delay.h>
+ #include <linux/slab.h>
+ #include <asm/unaligned.h>
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/qcu.c
++++ b/drivers/net/wireless/ath/ath5k/qcu.c
+@@ -20,8 +20,11 @@
+ Queue Control Unit, DCF Control Unit Functions
+ \********************************************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
++
+ #include "ath5k.h"
+ #include "reg.h"
+ #include "debug.h"
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/reset.c
++++ b/drivers/net/wireless/ath/ath5k/reset.c
+@@ -23,10 +23,12 @@
+ Reset function and helpers
+ \****************************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <asm/unaligned.h>
+
++#include <linux/printk.h>
+ #include <linux/pci.h> /* To determine if a card is pci-e */
+ #include <linux/log2.h>
+ #include <linux/platform_device.h>
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/sysfs.c
++++ b/drivers/net/wireless/ath/ath5k/sysfs.c
+@@ -1,5 +1,7 @@
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/device.h>
+ #include <linux/pci.h>
+
--- /dev/null
+--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
++++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
+@@ -15,8 +15,10 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/moduleparam.h>
+ #include <linux/inetdevice.h>
+ #include <linux/export.h>
--- /dev/null
+--- a/drivers/net/wireless/ath/ath6kl/init.c
++++ b/drivers/net/wireless/ath/ath6kl/init.c
+@@ -16,8 +16,10 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/moduleparam.h>
+ #include <linux/errno.h>
+ #include <linux/export.h>
--- /dev/null
+--- a/drivers/net/wireless/ath/ath6kl/main.c
++++ b/drivers/net/wireless/ath/ath6kl/main.c
+@@ -15,8 +15,11 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
++
+ #include "core.h"
+ #include "hif-ops.h"
+ #include "cfg80211.h"
--- /dev/null
+--- a/drivers/net/wireless/ath/ath6kl/txrx.c
++++ b/drivers/net/wireless/ath/ath6kl/txrx.c
+@@ -15,8 +15,11 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
++
+ #include "core.h"
+ #include "debug.h"
+ #include "htc-ops.h"
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+@@ -14,8 +14,11 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
++
+ #include "htc.h"
+
+ MODULE_AUTHOR("Atheros Communications");
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
++++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
+@@ -14,8 +14,11 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
++
+ #include "htc.h"
+
+ static int htc_issue_send(struct htc_target *target, struct sk_buff* skb,
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/init.c
++++ b/drivers/net/wireless/ath/ath9k/init.c
+@@ -14,8 +14,10 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/slab.h>
+ #include <linux/ath9k_platform.h>
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/pci.c
++++ b/drivers/net/wireless/ath/ath9k/pci.c
+@@ -14,8 +14,10 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/nl80211.h>
+ #include <linux/pci.h>
+ #include <linux/pci-aspm.h>
--- /dev/null
+--- a/drivers/net/wireless/ath/main.c
++++ b/drivers/net/wireless/ath/main.c
+@@ -14,9 +14,11 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/module.h>
+
+ #include "ath.h"
--- /dev/null
+--- a/drivers/net/wireless/ath/regd.c
++++ b/drivers/net/wireless/ath/regd.c
+@@ -14,9 +14,11 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/export.h>
+ #include <net/cfg80211.h>
+ #include <net/mac80211.h>
--- /dev/null
+--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
++++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+@@ -16,8 +16,10 @@
+ * File contents: support functions for PCI/PCIe
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/delay.h>
+
+ #include <defs.h>
--- /dev/null
+--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
++++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+@@ -16,8 +16,10 @@
+ */
+
+ #define __UNDEF_NO_VERSION__
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/etherdevice.h>
+ #include <linux/sched.h>
+ #include <linux/firmware.h>
--- /dev/null
+--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
++++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
+@@ -15,8 +15,10 @@
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/pci_ids.h>
+ #include <linux/if_ether.h>
+ #include <net/cfg80211.h>
--- /dev/null
+--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
++++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
+@@ -14,9 +14,11 @@
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/delay.h>
+ #include <linux/cordic.h>
+
--- /dev/null
+--- a/drivers/net/wireless/brcm80211/brcmutil/utils.c
++++ b/drivers/net/wireless/brcm80211/brcmutil/utils.c
+@@ -14,8 +14,10 @@
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/netdevice.h>
+ #include <linux/module.h>
+
--- /dev/null
+--- a/drivers/net/wireless/iwlegacy/3945-mac.c
++++ b/drivers/net/wireless/iwlegacy/3945-mac.c
+@@ -27,9 +27,11 @@
+ *
+ *****************************************************************************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/init.h>
+ #include <linux/pci.h>
--- /dev/null
+--- a/drivers/net/wireless/iwlegacy/4965-mac.c
++++ b/drivers/net/wireless/iwlegacy/4965-mac.c
+@@ -27,9 +27,11 @@
+ *
+ *****************************************************************************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/init.h>
+ #include <linux/pci.h>
--- /dev/null
+--- a/drivers/net/wireless/iwlwifi/dvm/main.c
++++ b/drivers/net/wireless/iwlwifi/dvm/main.c
+@@ -27,8 +27,10 @@
+ *
+ *****************************************************************************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/init.h>
--- /dev/null
+--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
++++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
+@@ -61,8 +61,10 @@
+ *
+ *****************************************************************************/
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/pci.h>
+ #include <linux/pci-aspm.h>
--- /dev/null
+--- a/drivers/net/wireless/libertas/cfg.c
++++ b/drivers/net/wireless/libertas/cfg.c
+@@ -6,8 +6,10 @@
+ *
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/hardirq.h>
+ #include <linux/sched.h>
+ #include <linux/wait.h>
--- /dev/null
+--- a/drivers/net/wireless/libertas/if_cs.c
++++ b/drivers/net/wireless/libertas/if_cs.c
+@@ -21,8 +21,10 @@
+
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/slab.h>
+ #include <linux/delay.h>
--- /dev/null
+--- a/drivers/net/wireless/libertas/if_sdio.c
++++ b/drivers/net/wireless/libertas/if_sdio.c
+@@ -26,9 +26,11 @@
+ * if_sdio_card_to_host() to pad the data.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/slab.h>
+ #include <linux/firmware.h>
--- /dev/null
+--- a/drivers/net/wireless/libertas/if_spi.c
++++ b/drivers/net/wireless/libertas/if_spi.c
+@@ -17,8 +17,10 @@
+ * (at your option) any later version.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/hardirq.h>
+ #include <linux/interrupt.h>
+ #include <linux/module.h>
--- /dev/null
+--- a/drivers/net/wireless/libertas/if_usb.c
++++ b/drivers/net/wireless/libertas/if_usb.c
+@@ -2,8 +2,10 @@
+ * This file contains functions used in USB interface module.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/delay.h>
+ #include <linux/module.h>
+ #include <linux/firmware.h>
--- /dev/null
+--- a/drivers/net/wireless/libertas/main.c
++++ b/drivers/net/wireless/libertas/main.c
+@@ -4,8 +4,10 @@
+ * thread etc..
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/delay.h>
+ #include <linux/etherdevice.h>
--- /dev/null
+--- a/drivers/net/wireless/libertas/mesh.c
++++ b/drivers/net/wireless/libertas/mesh.c
+@@ -1,5 +1,7 @@
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/delay.h>
+ #include <linux/etherdevice.h>
+ #include <linux/hardirq.h>
--- /dev/null
+--- a/drivers/net/wireless/libertas/rx.c
++++ b/drivers/net/wireless/libertas/rx.c
+@@ -2,8 +2,10 @@
+ * This file contains the handling of RX in wlan driver.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/etherdevice.h>
+ #include <linux/hardirq.h>
+ #include <linux/slab.h>
--- /dev/null
+--- a/drivers/net/wireless/libertas_tf/cmd.c
++++ b/drivers/net/wireless/libertas_tf/cmd.c
+@@ -7,8 +7,10 @@
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/hardirq.h>
+ #include <linux/slab.h>
+ #include <linux/export.h>
--- /dev/null
+--- a/drivers/net/wireless/libertas_tf/if_usb.c
++++ b/drivers/net/wireless/libertas_tf/if_usb.c
+@@ -9,11 +9,13 @@
+ */
+ #define DRV_NAME "lbtf_usb"
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include "libertas_tf.h"
+ #include "if_usb.h"
+
++#include <linux/printk.h>
+ #include <linux/delay.h>
+ #include <linux/module.h>
+ #include <linux/firmware.h>
--- /dev/null
+--- a/drivers/net/wireless/libertas_tf/main.c
++++ b/drivers/net/wireless/libertas_tf/main.c
+@@ -7,8 +7,10 @@
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/hardirq.h>
+ #include <linux/slab.h>
+
--- /dev/null
+--- a/drivers/net/wireless/rtlwifi/wifi.h
++++ b/drivers/net/wireless/rtlwifi/wifi.h
+@@ -30,8 +30,10 @@
+ #ifndef __RTL_WIFI_H__
+ #define __RTL_WIFI_H__
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/sched.h>
+ #include <linux/firmware.h>
+ #include <linux/etherdevice.h>
--- /dev/null
+--- a/net/bluetooth/lib.c
++++ b/net/bluetooth/lib.c
+@@ -24,9 +24,11 @@
+
+ /* Bluetooth kernel library. */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) "Bluetooth: " fmt
+
+ #include <linux/export.h>
++#include <linux/printk.h>
+
+ #include <net/bluetooth/bluetooth.h>
+
--- /dev/null
+--- a/net/wireless/core.c
++++ b/net/wireless/core.c
+@@ -4,8 +4,10 @@
+ * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/if.h>
+ #include <linux/module.h>
+ #include <linux/err.h>
--- /dev/null
+--- a/net/wireless/lib80211.c
++++ b/net/wireless/lib80211.c
+@@ -13,8 +13,10 @@
+ *
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/ctype.h>
+ #include <linux/ieee80211.h>
--- /dev/null
+--- a/net/wireless/lib80211_crypt_tkip.c
++++ b/net/wireless/lib80211_crypt_tkip.c
+@@ -10,8 +10,10 @@
+ * more details.
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
++#include <linux/printk.h>
+ #include <linux/err.h>
+ #include <linux/module.h>
+ #include <linux/init.h>
--- /dev/null
+--- a/net/wireless/reg.c
++++ b/net/wireless/reg.c
+@@ -42,9 +42,11 @@
+ *
+ */
+
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/export.h>
+ #include <linux/slab.h>
+ #include <linux/list.h>
+++ /dev/null
-Linux 3.5 will have get_ts_info to support the Precision Time Protocol.
-
-http://linuxptp.sourceforge.net/
-http://en.wikipedia.org/wiki/Precision_Time_Protocol
-
-We cannot backport this support given that this introduces
-a data structure change on the ethtool_ops.
-
-commit c8f3a8c31069137fe0100e6920558f1a7487ef3c
-Author: Richard Cochran <richardcochran@gmail.com>
-Date: Tue Apr 3 22:59:17 2012 +0000
-
- ethtool: Introduce a method for getting time stamping capabilities.
-
- This commit adds a new ethtool ioctl that exposes the SO_TIMESTAMPING
- capabilities of a network interface. In addition, user space programs
- can use this ioctl to discover the PTP Hardware Clock (PHC) device
- associated with the interface.
-
- Since software receive time stamps are handled by the stack, the generic
- ethtool code can answer the query correctly in case the MAC or PHY
- drivers lack special time stamping features.
-
- Signed-off-by: Richard Cochran <richardcochran@gmail.com>
- Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
- Signed-off-by: David S. Miller <davem@davemloft.net>
-
---- a/drivers/net/usb/usbnet.c
-+++ b/drivers/net/usb/usbnet.c
-@@ -933,7 +933,9 @@ static const struct ethtool_ops usbnet_e
- .get_drvinfo = usbnet_get_drvinfo,
- .get_msglevel = usbnet_get_msglevel,
- .set_msglevel = usbnet_set_msglevel,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .get_ts_info = ethtool_op_get_ts_info,
-+#endif
- };
-
- /*-------------------------------------------------------------------------*/
--- /dev/null
+Linux 3.5 will have get_ts_info to support the Precision Time Protocol.
+
+http://linuxptp.sourceforge.net/
+http://en.wikipedia.org/wiki/Precision_Time_Protocol
+
+We cannot backport this support given that this introduces
+a data structure change on the ethtool_ops.
+
+commit c8f3a8c31069137fe0100e6920558f1a7487ef3c
+Author: Richard Cochran <richardcochran@gmail.com>
+Date: Tue Apr 3 22:59:17 2012 +0000
+
+ ethtool: Introduce a method for getting time stamping capabilities.
+
+ This commit adds a new ethtool ioctl that exposes the SO_TIMESTAMPING
+ capabilities of a network interface. In addition, user space programs
+ can use this ioctl to discover the PTP Hardware Clock (PHC) device
+ associated with the interface.
+
+ Since software receive time stamps are handled by the stack, the generic
+ ethtool code can answer the query correctly in case the MAC or PHY
+ drivers lack special time stamping features.
+
+ Signed-off-by: Richard Cochran <richardcochran@gmail.com>
+ Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
+ Signed-off-by: David S. Miller <davem@davemloft.net>
+
--- /dev/null
+--- a/drivers/net/usb/usbnet.c
++++ b/drivers/net/usb/usbnet.c
+@@ -933,7 +933,9 @@
+ .get_drvinfo = usbnet_get_drvinfo,
+ .get_msglevel = usbnet_get_msglevel,
+ .set_msglevel = usbnet_set_msglevel,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .get_ts_info = ethtool_op_get_ts_info,
++#endif
+ };
+
+ /*-------------------------------------------------------------------------*/
+++ /dev/null
-In recent kernels, %pV will copy the va_list before using it.
-This isn't true for all kernels, so copy the va_list for use
-by the dev_*() functions, otherwise the kernel will crash if
-the message is printed and traced.
-
---- a/drivers/net/wireless/iwlwifi/iwl-debug.c
-+++ b/drivers/net/wireless/iwlwifi/iwl-debug.c
-@@ -76,13 +76,16 @@ void __iwl_ ##fn(struct device *dev, con
- struct va_format vaf = { \
- .fmt = fmt, \
- }; \
-- va_list args; \
-+ va_list args1, args2; \
- \
-- va_start(args, fmt); \
-- vaf.va = &args; \
-+ va_start(args1, fmt); \
-+ va_copy(args2, args1); \
-+ vaf.va = &args2; \
- dev_ ##fn(dev, "%pV", &vaf); \
-+ va_end(args2); \
-+ vaf.va = &args1; \
- trace_iwlwifi_ ##fn(&vaf); \
-- va_end(args); \
-+ va_end(args1); \
- }
-
- __iwl_fn(warn)
-@@ -101,13 +104,18 @@ void __iwl_err(struct device *dev, bool
- va_list args;
-
- va_start(args, fmt);
-- vaf.va = &args;
- if (!trace_only) {
-+ va_list args2;
-+
-+ va_copy(args2, args);
-+ vaf.va = &args2;
- if (rfkill_prefix)
- dev_err(dev, "(RFKILL) %pV", &vaf);
- else
- dev_err(dev, "%pV", &vaf);
-+ va_end(args2);
- }
-+ vaf.va = &args;
- trace_iwlwifi_err(&vaf);
- va_end(args);
- }
-@@ -124,13 +132,19 @@ void __iwl_dbg(struct device *dev,
- va_list args;
-
- va_start(args, fmt);
-- vaf.va = &args;
- #ifdef CONFIG_IWLWIFI_DEBUG
- if (iwl_have_debug_level(level) &&
-- (!limit || net_ratelimit()))
-+ (!limit || net_ratelimit())) {
-+ va_list args2;
-+
-+ va_copy(args2, args);
-+ vaf.va = &args2;
- dev_dbg(dev, "%c %s %pV", in_interrupt() ? 'I' : 'U',
- function, &vaf);
-+ va_end(args2);
-+ }
- #endif
-+ vaf.va = &args;
- trace_iwlwifi_dbg(level, in_interrupt(), function, &vaf);
- va_end(args);
- }
--- /dev/null
+In recent kernels, %pV will copy the va_list before using it.
+This isn't true for all kernels, so copy the va_list for use
+by the dev_*() functions, otherwise the kernel will crash if
+the message is printed and traced.
+
--- /dev/null
+--- a/drivers/net/wireless/iwlwifi/iwl-debug.c
++++ b/drivers/net/wireless/iwlwifi/iwl-debug.c
+@@ -76,13 +76,16 @@
+ struct va_format vaf = { \
+ .fmt = fmt, \
+ }; \
+- va_list args; \
++ va_list args1, args2; \
+ \
+- va_start(args, fmt); \
+- vaf.va = &args; \
++ va_start(args1, fmt); \
++ va_copy(args2, args1); \
++ vaf.va = &args2; \
+ dev_ ##fn(dev, "%pV", &vaf); \
++ va_end(args2); \
++ vaf.va = &args1; \
+ trace_iwlwifi_ ##fn(&vaf); \
+- va_end(args); \
++ va_end(args1); \
+ }
+
+ __iwl_fn(warn)
+@@ -101,13 +104,18 @@
+ va_list args;
+
+ va_start(args, fmt);
+- vaf.va = &args;
+ if (!trace_only) {
++ va_list args2;
++
++ va_copy(args2, args);
++ vaf.va = &args2;
+ if (rfkill_prefix)
+ dev_err(dev, "(RFKILL) %pV", &vaf);
+ else
+ dev_err(dev, "%pV", &vaf);
++ va_end(args2);
+ }
++ vaf.va = &args;
+ trace_iwlwifi_err(&vaf);
+ va_end(args);
+ }
+@@ -124,13 +132,19 @@
+ va_list args;
+
+ va_start(args, fmt);
+- vaf.va = &args;
+ #ifdef CONFIG_IWLWIFI_DEBUG
+ if (iwl_have_debug_level(level) &&
+- (!limit || net_ratelimit()))
++ (!limit || net_ratelimit())) {
++ va_list args2;
++
++ va_copy(args2, args);
++ vaf.va = &args2;
+ dev_dbg(dev, "%c %s %pV", in_interrupt() ? 'I' : 'U',
+ function, &vaf);
++ va_end(args2);
++ }
+ #endif
++ vaf.va = &args;
+ trace_iwlwifi_dbg(level, in_interrupt(), function, &vaf);
+ va_end(args);
+ }
+++ /dev/null
---- a/net/mac80211/trace.c
-+++ b/net/mac80211/trace.c
-@@ -15,12 +15,16 @@ void __sdata_info(const char *fmt, ...)
- struct va_format vaf = {
- .fmt = fmt,
- };
-- va_list args;
-+ va_list args, args2;
-
- va_start(args, fmt);
-- vaf.va = &args;
-
-+ va_copy(args2, args);
-+ vaf.va = &args2;
- pr_info("%pV", &vaf);
-+ va_end(args2);
-+
-+ vaf.va = &args;
- trace_mac80211_info(&vaf);
- va_end(args);
- }
-@@ -33,10 +37,16 @@ void __sdata_dbg(bool print, const char
- va_list args;
-
- va_start(args, fmt);
-- vaf.va = &args;
-
-- if (print)
-+ if (print) {
-+ va_list args2;
-+
-+ va_copy(args2, args);
-+ vaf.va = &args2;
- pr_debug("%pV", &vaf);
-+ va_end(args2);
-+ }
-+ vaf.va = &args;
- trace_mac80211_dbg(&vaf);
- va_end(args);
- }
-@@ -46,12 +56,16 @@ void __sdata_err(const char *fmt, ...)
- struct va_format vaf = {
- .fmt = fmt,
- };
-- va_list args;
-+ va_list args, args2;
-
- va_start(args, fmt);
-- vaf.va = &args;
-
-+ va_copy(args2, args);
-+ vaf.va = &args2;
- pr_err("%pV", &vaf);
-+ va_end(args2);
-+
-+ vaf.va = &args;
- trace_mac80211_err(&vaf);
- va_end(args);
- }
-@@ -64,10 +78,16 @@ void __wiphy_dbg(struct wiphy *wiphy, bo
- va_list args;
-
- va_start(args, fmt);
-- vaf.va = &args;
-
-- if (print)
-- wiphy_dbg(wiphy, "%pV", &vaf);
-+ if (print) {
-+ va_list args2;
-+
-+ va_copy(args2, args);
-+ vaf.va = &args2;
-+ pr_debug("%pV", &vaf);
-+ va_end(args2);
-+ }
-+ vaf.va = &args;
- trace_mac80211_dbg(&vaf);
- va_end(args);
- }
--- /dev/null
+--- a/net/mac80211/trace.c
++++ b/net/mac80211/trace.c
+@@ -15,12 +15,16 @@
+ struct va_format vaf = {
+ .fmt = fmt,
+ };
+- va_list args;
++ va_list args, args2;
+
+ va_start(args, fmt);
+- vaf.va = &args;
+
++ va_copy(args2, args);
++ vaf.va = &args2;
+ pr_info("%pV", &vaf);
++ va_end(args2);
++
++ vaf.va = &args;
+ trace_mac80211_info(&vaf);
+ va_end(args);
+ }
+@@ -33,10 +37,16 @@
+ va_list args;
+
+ va_start(args, fmt);
+- vaf.va = &args;
+
+- if (print)
++ if (print) {
++ va_list args2;
++
++ va_copy(args2, args);
++ vaf.va = &args2;
+ pr_debug("%pV", &vaf);
++ va_end(args2);
++ }
++ vaf.va = &args;
+ trace_mac80211_dbg(&vaf);
+ va_end(args);
+ }
+@@ -46,12 +56,16 @@
+ struct va_format vaf = {
+ .fmt = fmt,
+ };
+- va_list args;
++ va_list args, args2;
+
+ va_start(args, fmt);
+- vaf.va = &args;
+
++ va_copy(args2, args);
++ vaf.va = &args2;
+ pr_err("%pV", &vaf);
++ va_end(args2);
++
++ vaf.va = &args;
+ trace_mac80211_err(&vaf);
+ va_end(args);
+ }
+@@ -64,10 +78,16 @@
+ va_list args;
+
+ va_start(args, fmt);
+- vaf.va = &args;
+
+- if (print)
+- wiphy_dbg(wiphy, "%pV", &vaf);
++ if (print) {
++ va_list args2;
++
++ va_copy(args2, args);
++ vaf.va = &args2;
++ pr_debug("%pV", &vaf);
++ va_end(args2);
++ }
++ vaf.va = &args;
+ trace_mac80211_dbg(&vaf);
+ va_end(args);
+ }
+++ /dev/null
-Due to compat including linux/device.h before we do,
-we don't get a chance to #define DEBUG to get our
-debugging prints. This patch replaces dev_dbg with
-dev_printk to make them show up again.
-
---- a/drivers/net/wireless/iwlwifi/iwl-debug.c
-+++ b/drivers/net/wireless/iwlwifi/iwl-debug.c
-@@ -139,8 +139,9 @@ void __iwl_dbg(struct device *dev,
-
- va_copy(args2, args);
- vaf.va = &args2;
-- dev_dbg(dev, "%c %s %pV", in_interrupt() ? 'I' : 'U',
-- function, &vaf);
-+ dev_printk(KERN_DEBUG, dev, "%c %s %pV",
-+ in_interrupt() ? 'I' : 'U',
-+ function, &vaf);
- va_end(args2);
- }
- #endif
--- /dev/null
+Due to compat including linux/device.h before we do,
+we don't get a chance to #define DEBUG to get our
+debugging prints. This patch replaces dev_dbg with
+dev_printk to make them show up again.
+
--- /dev/null
+--- a/drivers/net/wireless/iwlwifi/iwl-debug.c
++++ b/drivers/net/wireless/iwlwifi/iwl-debug.c
+@@ -139,8 +139,9 @@
+
+ va_copy(args2, args);
+ vaf.va = &args2;
+- dev_dbg(dev, "%c %s %pV", in_interrupt() ? 'I' : 'U',
+- function, &vaf);
++ dev_printk(KERN_DEBUG, dev, "%c %s %pV",
++ in_interrupt() ? 'I' : 'U',
++ function, &vaf);
+ va_end(args2);
+ }
+ #endif
+++ /dev/null
-You cannot backport assignment of netdev->addr_assign_type
-given that its part of the netdev data structure only in future
-kernels.
-
-mcgrof@tux ~/linux-next (git::master)$ git describe --contains c1f79426
-v2.6.36-rc1~571^2~104
-
---- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
-+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
-@@ -2622,7 +2622,9 @@ static int atl1c_probe(struct pci_dev *p
- }
- if (atl1c_read_mac_addr(&adapter->hw)) {
- /* got a random MAC address, set NET_ADDR_RANDOM to netdev */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- netdev->addr_assign_type = NET_ADDR_RANDOM;
-+#endif
- }
- memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
- if (netif_msg_probe(adapter))
---- a/drivers/net/ethernet/atheros/atlx/atl1.c
-+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
-@@ -3060,7 +3060,9 @@ static int atl1_probe(struct pci_dev *pd
- /* copy the MAC address out of the EEPROM */
- if (atl1_read_mac_addr(&adapter->hw)) {
- /* mark random mac */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- netdev->addr_assign_type = NET_ADDR_RANDOM;
-+#endif
- }
- memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
-
--- /dev/null
+You cannot backport assignment of netdev->addr_assign_type
+given that its part of the netdev data structure only in future
+kernels.
+
+mcgrof@tux ~/linux-next (git::master)$ git describe --contains c1f79426
+v2.6.36-rc1~571^2~104
+
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
++++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+@@ -2622,7 +2622,9 @@
+ }
+ if (atl1c_read_mac_addr(&adapter->hw)) {
+ /* got a random MAC address, set NET_ADDR_RANDOM to netdev */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ netdev->addr_assign_type = NET_ADDR_RANDOM;
++#endif
+ }
+ memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
+ if (netif_msg_probe(adapter))
--- /dev/null
+--- a/drivers/net/ethernet/atheros/atlx/atl1.c
++++ b/drivers/net/ethernet/atheros/atlx/atl1.c
+@@ -3060,7 +3060,9 @@
+ /* copy the MAC address out of the EEPROM */
+ if (atl1_read_mac_addr(&adapter->hw)) {
+ /* mark random mac */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ netdev->addr_assign_type = NET_ADDR_RANDOM;
++#endif
+ }
+ memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
+
+++ /dev/null
---- a/drivers/bluetooth/ath3k.c
-+++ b/drivers/bluetooth/ath3k.c
-@@ -473,7 +473,9 @@ static struct usb_driver ath3k_driver =
- .probe = ath3k_probe,
- .disconnect = ath3k_disconnect,
- .id_table = ath3k_table,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(ath3k_driver);
---- a/drivers/bluetooth/bcm203x.c
-+++ b/drivers/bluetooth/bcm203x.c
-@@ -273,7 +273,9 @@ static struct usb_driver bcm203x_driver
- .probe = bcm203x_probe,
- .disconnect = bcm203x_disconnect,
- .id_table = bcm203x_table,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(bcm203x_driver);
---- a/drivers/bluetooth/bfusb.c
-+++ b/drivers/bluetooth/bfusb.c
-@@ -745,7 +745,9 @@ static struct usb_driver bfusb_driver =
- .probe = bfusb_probe,
- .disconnect = bfusb_disconnect,
- .id_table = bfusb_table,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(bfusb_driver);
---- a/drivers/bluetooth/bpa10x.c
-+++ b/drivers/bluetooth/bpa10x.c
-@@ -504,7 +504,9 @@ static struct usb_driver bpa10x_driver =
- .probe = bpa10x_probe,
- .disconnect = bpa10x_disconnect,
- .id_table = bpa10x_table,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(bpa10x_driver);
---- a/drivers/bluetooth/btusb.c
-+++ b/drivers/bluetooth/btusb.c
-@@ -1234,7 +1234,9 @@ static struct usb_driver btusb_driver =
- #endif
- .id_table = btusb_table,
- .supports_autosuspend = 1,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(btusb_driver);
---- a/drivers/net/usb/cdc_ether.c
-+++ b/drivers/net/usb/cdc_ether.c
-@@ -720,7 +720,9 @@ static struct usb_driver cdc_driver = {
- .resume = usbnet_resume,
- .reset_resume = usbnet_resume,
- .supports_autosuspend = 1,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(cdc_driver);
---- a/drivers/net/usb/rndis_host.c
-+++ b/drivers/net/usb/rndis_host.c
-@@ -642,7 +642,9 @@ static struct usb_driver rndis_driver =
- .disconnect = usbnet_disconnect,
- .suspend = usbnet_suspend,
- .resume = usbnet_resume,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(rndis_driver);
---- a/drivers/net/wireless/at76c50x-usb.c
-+++ b/drivers/net/wireless/at76c50x-usb.c
-@@ -2451,7 +2451,9 @@ static struct usb_driver at76_driver = {
- .probe = at76_probe,
- .disconnect = at76_disconnect,
- .id_table = dev_table,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- static int __init at76_mod_init(void)
---- a/drivers/net/wireless/ath/ath6kl/usb.c
-+++ b/drivers/net/wireless/ath/ath6kl/usb.c
-@@ -1207,7 +1207,9 @@ static struct usb_driver ath6kl_usb_driv
- .disconnect = ath6kl_usb_remove,
- .id_table = ath6kl_usb_ids,
- .supports_autosuspend = true,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- static int ath6kl_usb_init(void)
---- a/drivers/net/wireless/ath/ath9k/hif_usb.c
-+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
-@@ -1373,7 +1373,9 @@ static struct usb_driver ath9k_hif_usb_d
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
- .soft_unbind = 1,
- #endif
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- int ath9k_hif_usb_init(void)
---- a/drivers/net/wireless/ath/carl9170/usb.c
-+++ b/drivers/net/wireless/ath/carl9170/usb.c
-@@ -1166,7 +1166,9 @@ static struct usb_driver carl9170_driver
- .resume = carl9170_usb_resume,
- .reset_resume = carl9170_usb_resume,
- #endif /* CONFIG_PM */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(carl9170_driver);
---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
-+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
-@@ -1498,7 +1498,9 @@ static struct usb_driver brcmf_usbdrvr =
- .resume = brcmf_usb_resume,
- .reset_resume = brcmf_usb_reset_resume,
- .supports_autosuspend = 1,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- static void brcmf_release_fw(struct list_head *q)
---- a/drivers/net/wireless/libertas/if_usb.c
-+++ b/drivers/net/wireless/libertas/if_usb.c
-@@ -1015,7 +1015,9 @@ static struct usb_driver if_usb_driver =
- .suspend = if_usb_suspend,
- .resume = if_usb_resume,
- .reset_resume = if_usb_resume,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(if_usb_driver);
---- a/drivers/net/wireless/libertas_tf/if_usb.c
-+++ b/drivers/net/wireless/libertas_tf/if_usb.c
-@@ -922,7 +922,9 @@ static struct usb_driver if_usb_driver =
- .id_table = if_usb_table,
- .suspend = if_usb_suspend,
- .resume = if_usb_resume,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(if_usb_driver);
---- a/drivers/net/wireless/orinoco/orinoco_usb.c
-+++ b/drivers/net/wireless/orinoco/orinoco_usb.c
-@@ -1758,7 +1758,9 @@ static struct usb_driver orinoco_driver
- .probe = ezusb_probe,
- .disconnect = ezusb_disconnect,
- .id_table = ezusb_table,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(orinoco_driver);
---- a/drivers/net/wireless/p54/p54usb.c
-+++ b/drivers/net/wireless/p54/p54usb.c
-@@ -1140,7 +1140,9 @@ static struct usb_driver p54u_driver = {
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
- .soft_unbind = 1,
- #endif
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(p54u_driver);
---- a/drivers/net/wireless/rndis_wlan.c
-+++ b/drivers/net/wireless/rndis_wlan.c
-@@ -3757,7 +3757,9 @@ static struct usb_driver rndis_wlan_driv
- .disconnect = usbnet_disconnect,
- .suspend = usbnet_suspend,
- .resume = usbnet_resume,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(rndis_wlan_driver);
---- a/drivers/net/wireless/rt2x00/rt2500usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
-@@ -1989,7 +1989,9 @@ static struct usb_driver rt2500usb_drive
- .suspend = rt2x00usb_suspend,
- .resume = rt2x00usb_resume,
- .reset_resume = rt2x00usb_resume,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(rt2500usb_driver);
---- a/drivers/net/wireless/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
-@@ -1375,7 +1375,9 @@ static struct usb_driver rt2800usb_drive
- .suspend = rt2x00usb_suspend,
- .resume = rt2x00usb_resume,
- .reset_resume = rt2x00usb_resume,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(rt2800usb_driver);
---- a/drivers/net/wireless/rt2x00/rt73usb.c
-+++ b/drivers/net/wireless/rt2x00/rt73usb.c
-@@ -2536,7 +2536,9 @@ static struct usb_driver rt73usb_driver
- .suspend = rt2x00usb_suspend,
- .resume = rt2x00usb_resume,
- .reset_resume = rt2x00usb_resume,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(rt73usb_driver);
---- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
-+++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
-@@ -1673,7 +1673,9 @@ static struct usb_driver rtl8187_driver
- .id_table = rtl8187_table,
- .probe = rtl8187_probe,
- .disconnect = rtl8187_disconnect,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(rtl8187_driver);
---- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
-+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
-@@ -384,7 +384,9 @@ static struct usb_driver rtl8192cu_drive
- #ifdef CONFIG_AUTOSUSPEND
- .supports_autosuspend = 1,
- #endif
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- module_usb_driver(rtl8192cu_driver);
---- a/drivers/net/wireless/zd1211rw/zd_usb.c
-+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
-@@ -1540,7 +1540,9 @@ static struct usb_driver driver = {
- .disconnect = disconnect,
- .pre_reset = pre_reset,
- .post_reset = post_reset,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
- .disable_hub_initiated_lpm = 1,
-+#endif
- };
-
- struct workqueue_struct *zd_workqueue;
--- /dev/null
+--- a/drivers/bluetooth/ath3k.c
++++ b/drivers/bluetooth/ath3k.c
+@@ -473,7 +473,9 @@
+ .probe = ath3k_probe,
+ .disconnect = ath3k_disconnect,
+ .id_table = ath3k_table,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(ath3k_driver);
--- /dev/null
+--- a/drivers/bluetooth/bcm203x.c
++++ b/drivers/bluetooth/bcm203x.c
+@@ -273,7 +273,9 @@
+ .probe = bcm203x_probe,
+ .disconnect = bcm203x_disconnect,
+ .id_table = bcm203x_table,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(bcm203x_driver);
--- /dev/null
+--- a/drivers/bluetooth/bfusb.c
++++ b/drivers/bluetooth/bfusb.c
+@@ -745,7 +745,9 @@
+ .probe = bfusb_probe,
+ .disconnect = bfusb_disconnect,
+ .id_table = bfusb_table,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(bfusb_driver);
--- /dev/null
+--- a/drivers/bluetooth/bpa10x.c
++++ b/drivers/bluetooth/bpa10x.c
+@@ -504,7 +504,9 @@
+ .probe = bpa10x_probe,
+ .disconnect = bpa10x_disconnect,
+ .id_table = bpa10x_table,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(bpa10x_driver);
--- /dev/null
+--- a/drivers/bluetooth/btusb.c
++++ b/drivers/bluetooth/btusb.c
+@@ -1234,7 +1234,9 @@
+ #endif
+ .id_table = btusb_table,
+ .supports_autosuspend = 1,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(btusb_driver);
--- /dev/null
+--- a/drivers/net/usb/cdc_ether.c
++++ b/drivers/net/usb/cdc_ether.c
+@@ -720,7 +720,9 @@
+ .resume = usbnet_resume,
+ .reset_resume = usbnet_resume,
+ .supports_autosuspend = 1,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(cdc_driver);
--- /dev/null
+--- a/drivers/net/usb/rndis_host.c
++++ b/drivers/net/usb/rndis_host.c
+@@ -642,7 +642,9 @@
+ .disconnect = usbnet_disconnect,
+ .suspend = usbnet_suspend,
+ .resume = usbnet_resume,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(rndis_driver);
--- /dev/null
+--- a/drivers/net/wireless/at76c50x-usb.c
++++ b/drivers/net/wireless/at76c50x-usb.c
+@@ -2451,7 +2451,9 @@
+ .probe = at76_probe,
+ .disconnect = at76_disconnect,
+ .id_table = dev_table,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ static int __init at76_mod_init(void)
--- /dev/null
+--- a/drivers/net/wireless/ath/ath6kl/usb.c
++++ b/drivers/net/wireless/ath/ath6kl/usb.c
+@@ -1207,7 +1207,9 @@
+ .disconnect = ath6kl_usb_remove,
+ .id_table = ath6kl_usb_ids,
+ .supports_autosuspend = true,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ static int ath6kl_usb_init(void)
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
+@@ -1373,7 +1373,9 @@
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+ .soft_unbind = 1,
+ #endif
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ int ath9k_hif_usb_init(void)
--- /dev/null
+--- a/drivers/net/wireless/ath/carl9170/usb.c
++++ b/drivers/net/wireless/ath/carl9170/usb.c
+@@ -1166,7 +1166,9 @@
+ .resume = carl9170_usb_resume,
+ .reset_resume = carl9170_usb_resume,
+ #endif /* CONFIG_PM */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(carl9170_driver);
--- /dev/null
+--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+@@ -1498,7 +1498,9 @@
+ .resume = brcmf_usb_resume,
+ .reset_resume = brcmf_usb_reset_resume,
+ .supports_autosuspend = 1,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ static void brcmf_release_fw(struct list_head *q)
--- /dev/null
+--- a/drivers/net/wireless/libertas/if_usb.c
++++ b/drivers/net/wireless/libertas/if_usb.c
+@@ -1015,7 +1015,9 @@
+ .suspend = if_usb_suspend,
+ .resume = if_usb_resume,
+ .reset_resume = if_usb_resume,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(if_usb_driver);
--- /dev/null
+--- a/drivers/net/wireless/libertas_tf/if_usb.c
++++ b/drivers/net/wireless/libertas_tf/if_usb.c
+@@ -922,7 +922,9 @@
+ .id_table = if_usb_table,
+ .suspend = if_usb_suspend,
+ .resume = if_usb_resume,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(if_usb_driver);
--- /dev/null
+--- a/drivers/net/wireless/orinoco/orinoco_usb.c
++++ b/drivers/net/wireless/orinoco/orinoco_usb.c
+@@ -1758,7 +1758,9 @@
+ .probe = ezusb_probe,
+ .disconnect = ezusb_disconnect,
+ .id_table = ezusb_table,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(orinoco_driver);
--- /dev/null
+--- a/drivers/net/wireless/p54/p54usb.c
++++ b/drivers/net/wireless/p54/p54usb.c
+@@ -1140,7 +1140,9 @@
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+ .soft_unbind = 1,
+ #endif
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(p54u_driver);
--- /dev/null
+--- a/drivers/net/wireless/rndis_wlan.c
++++ b/drivers/net/wireless/rndis_wlan.c
+@@ -3757,7 +3757,9 @@
+ .disconnect = usbnet_disconnect,
+ .suspend = usbnet_suspend,
+ .resume = usbnet_resume,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(rndis_wlan_driver);
--- /dev/null
+--- a/drivers/net/wireless/rt2x00/rt2500usb.c
++++ b/drivers/net/wireless/rt2x00/rt2500usb.c
+@@ -1989,7 +1989,9 @@
+ .suspend = rt2x00usb_suspend,
+ .resume = rt2x00usb_resume,
+ .reset_resume = rt2x00usb_resume,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(rt2500usb_driver);
--- /dev/null
+--- a/drivers/net/wireless/rt2x00/rt2800usb.c
++++ b/drivers/net/wireless/rt2x00/rt2800usb.c
+@@ -1375,7 +1375,9 @@
+ .suspend = rt2x00usb_suspend,
+ .resume = rt2x00usb_resume,
+ .reset_resume = rt2x00usb_resume,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(rt2800usb_driver);
--- /dev/null
+--- a/drivers/net/wireless/rt2x00/rt73usb.c
++++ b/drivers/net/wireless/rt2x00/rt73usb.c
+@@ -2536,7 +2536,9 @@
+ .suspend = rt2x00usb_suspend,
+ .resume = rt2x00usb_resume,
+ .reset_resume = rt2x00usb_resume,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(rt73usb_driver);
--- /dev/null
+--- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
++++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
+@@ -1673,7 +1673,9 @@
+ .id_table = rtl8187_table,
+ .probe = rtl8187_probe,
+ .disconnect = rtl8187_disconnect,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(rtl8187_driver);
--- /dev/null
+--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+@@ -384,7 +384,9 @@
+ #ifdef CONFIG_AUTOSUSPEND
+ .supports_autosuspend = 1,
+ #endif
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ module_usb_driver(rtl8192cu_driver);
--- /dev/null
+--- a/drivers/net/wireless/zd1211rw/zd_usb.c
++++ b/drivers/net/wireless/zd1211rw/zd_usb.c
+@@ -1540,7 +1540,9 @@
+ .disconnect = disconnect,
+ .pre_reset = pre_reset,
+ .post_reset = post_reset,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+ .disable_hub_initiated_lpm = 1,
++#endif
+ };
+
+ struct workqueue_struct *zd_workqueue;
+++ /dev/null
-This patch requires a manual backport:
-
-commit adc8d746caa67fff4b53ba3e5163a6cbacc3b523
-Author: Alan Cox <alan@linux.intel.com>
-Date: Sat Jul 14 15:31:47 2012 +0100
-
- tty: move the termios object into the tty
-
- This will let us sort out a whole pile of tty related races. The
- alternative would be to keep points and refcount the termios objects.
- However
- 1. They are tiny anyway
- 2. Many devices don't use the stored copies
- 3. We can remove a pty special case
-
- Signed-off-by: Alan Cox <alan@linux.intel.com>
- Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
-We cannot use compat.git for this given that the assignment
-was not done through a static inline helper.
-
---- a/drivers/bluetooth/hci_ath.c
-+++ b/drivers/bluetooth/hci_ath.c
-@@ -58,7 +58,11 @@ static int ath_wakeup_ar3k(struct tty_st
- return status;
-
- /* Disable Automatic RTSCTS */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
- ktermios = tty->termios;
-+#else
-+ memcpy(&ktermios, tty->termios, sizeof(ktermios));
-+#endif
- ktermios.c_cflag &= ~CRTSCTS;
- tty_set_termios(tty, &ktermios);
-
---- a/net/bluetooth/rfcomm/tty.c
-+++ b/net/bluetooth/rfcomm/tty.c
-@@ -868,7 +868,11 @@ static int rfcomm_tty_ioctl(struct tty_s
-
- static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
- {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
- struct ktermios *new = &tty->termios;
-+#else
-+ struct ktermios *new = tty->termios;
-+#endif
- int old_baud_rate = tty_termios_baud_rate(old);
- int new_baud_rate = tty_termios_baud_rate(new);
-
--- /dev/null
+This patch requires a manual backport:
+
+commit adc8d746caa67fff4b53ba3e5163a6cbacc3b523
+Author: Alan Cox <alan@linux.intel.com>
+Date: Sat Jul 14 15:31:47 2012 +0100
+
+ tty: move the termios object into the tty
+
+ This will let us sort out a whole pile of tty related races. The
+ alternative would be to keep points and refcount the termios objects.
+ However
+ 1. They are tiny anyway
+ 2. Many devices don't use the stored copies
+ 3. We can remove a pty special case
+
+ Signed-off-by: Alan Cox <alan@linux.intel.com>
+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+We cannot use compat.git for this given that the assignment
+was not done through a static inline helper.
+
--- /dev/null
+--- a/drivers/bluetooth/hci_ath.c
++++ b/drivers/bluetooth/hci_ath.c
+@@ -58,7 +58,11 @@
+ return status;
+
+ /* Disable Automatic RTSCTS */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
+ ktermios = tty->termios;
++#else
++ memcpy(&ktermios, tty->termios, sizeof(ktermios));
++#endif
+ ktermios.c_cflag &= ~CRTSCTS;
+ tty_set_termios(tty, &ktermios);
+
--- /dev/null
+--- a/net/bluetooth/rfcomm/tty.c
++++ b/net/bluetooth/rfcomm/tty.c
+@@ -868,7 +868,11 @@
+
+ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0))
+ struct ktermios *new = &tty->termios;
++#else
++ struct ktermios *new = tty->termios;
++#endif
+ int old_baud_rate = tty_termios_baud_rate(old);
+ int new_baud_rate = tty_termios_baud_rate(new);
+
+++ /dev/null
-This patch requires a manual backport:
-
-commit eeda8585522bcc173f91d6254dfa63e871087c54
-Author: Kevin Groeneveld <kgroeneveld@gmail.com>
-Date: Tue Jul 17 17:46:01 2012 +0000
-
- b44: add 64 bit stats
-
- Add support for 64 bit stats to Broadcom b44 ethernet driver.
-
- Signed-off-by: Kevin Groeneveld <kgroeneveld@gmail.com>
- Signed-off-by: Eric Dumazet <edumazet@google.com>
- Signed-off-by: David S. Miller <davem@davemloft.net>
-
---- a/drivers/net/ethernet/broadcom/b44.c
-+++ b/drivers/net/ethernet/broadcom/b44.c
-@@ -31,6 +31,7 @@
- #include <linux/dma-mapping.h>
- #include <linux/ssb/ssb.h>
- #include <linux/slab.h>
-+#include <linux/u64_stats_sync.h>
-
- #include <asm/uaccess.h>
- #include <asm/io.h>
-@@ -1638,10 +1639,17 @@ static int b44_close(struct net_device *
- return 0;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- static struct rtnl_link_stats64 *b44_get_stats64(struct net_device *dev,
- struct rtnl_link_stats64 *nstat)
-+#else
-+static struct net_device_stats *b44_get_stats(struct net_device *dev)
-+#endif
- {
- struct b44 *bp = netdev_priv(dev);
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
-+ struct net_device_stats *nstat = &dev->stats;
-+#endif
- struct b44_hw_stats *hwstat = &bp->hw_stats;
- unsigned int start;
-
-@@ -2130,7 +2138,11 @@ static const struct net_device_ops b44_n
- .ndo_open = b44_open,
- .ndo_stop = b44_close,
- .ndo_start_xmit = b44_start_xmit,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
- .ndo_get_stats64 = b44_get_stats64,
-+#else
-+ .ndo_get_stats = b44_get_stats,
-+#endif
- .ndo_set_rx_mode = b44_set_rx_mode,
- .ndo_set_mac_address = b44_set_mac_addr,
- .ndo_validate_addr = eth_validate_addr,
--- /dev/null
+This patch requires a manual backport:
+
+commit eeda8585522bcc173f91d6254dfa63e871087c54
+Author: Kevin Groeneveld <kgroeneveld@gmail.com>
+Date: Tue Jul 17 17:46:01 2012 +0000
+
+ b44: add 64 bit stats
+
+ Add support for 64 bit stats to Broadcom b44 ethernet driver.
+
+ Signed-off-by: Kevin Groeneveld <kgroeneveld@gmail.com>
+ Signed-off-by: Eric Dumazet <edumazet@google.com>
+ Signed-off-by: David S. Miller <davem@davemloft.net>
+
--- /dev/null
+--- a/drivers/net/ethernet/broadcom/b44.c
++++ b/drivers/net/ethernet/broadcom/b44.c
+@@ -31,6 +31,7 @@
+ #include <linux/dma-mapping.h>
+ #include <linux/ssb/ssb.h>
+ #include <linux/slab.h>
++#include <linux/u64_stats_sync.h>
+
+ #include <asm/uaccess.h>
+ #include <asm/io.h>
+@@ -1638,10 +1639,17 @@
+ return 0;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ static struct rtnl_link_stats64 *b44_get_stats64(struct net_device *dev,
+ struct rtnl_link_stats64 *nstat)
++#else
++static struct net_device_stats *b44_get_stats(struct net_device *dev)
++#endif
+ {
+ struct b44 *bp = netdev_priv(dev);
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
++ struct net_device_stats *nstat = &dev->stats;
++#endif
+ struct b44_hw_stats *hwstat = &bp->hw_stats;
+ unsigned int start;
+
+@@ -2130,7 +2138,11 @@
+ .ndo_open = b44_open,
+ .ndo_stop = b44_close,
+ .ndo_start_xmit = b44_start_xmit,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ .ndo_get_stats64 = b44_get_stats64,
++#else
++ .ndo_get_stats = b44_get_stats,
++#endif
+ .ndo_set_rx_mode = b44_set_rx_mode,
+ .ndo_set_mac_address = b44_set_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
+++ /dev/null
-The following patch makes use of the dismantle member in struct
-net_device, this patch removes that access on older kernels.
-
-commit 9d5d496c3464b7ad0ba942b4ada5f27c07e07079
-Author: Daniel Drake <dsd@laptop.org>
-Date: Mon Jul 30 22:58:04 2012 +0100
-
- libertas: don't reset card on error when it is being removed
-
---- a/drivers/net/wireless/libertas/main.c
-+++ b/drivers/net/wireless/libertas/main.c
-@@ -592,7 +592,11 @@ static int lbs_thread(void *data)
-
- /* Reset card, but only when it isn't in the process
- * of being shutdown anyway. */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0))
- if (!dev->dismantle && priv->reset_card)
-+#else
-+ if (priv->reset_card)
-+#endif
- priv->reset_card(priv);
- }
- priv->cmd_timed_out = 0;
--- /dev/null
+The following patch makes use of the dismantle member in struct
+net_device, this patch removes that access on older kernels.
+
+commit 9d5d496c3464b7ad0ba942b4ada5f27c07e07079
+Author: Daniel Drake <dsd@laptop.org>
+Date: Mon Jul 30 22:58:04 2012 +0100
+
+ libertas: don't reset card on error when it is being removed
+
--- /dev/null
+--- a/drivers/net/wireless/libertas/main.c
++++ b/drivers/net/wireless/libertas/main.c
+@@ -592,7 +592,11 @@
+
+ /* Reset card, but only when it isn't in the process
+ * of being shutdown anyway. */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0))
+ if (!dev->dismantle && priv->reset_card)
++#else
++ if (priv->reset_card)
++#endif
+ priv->reset_card(priv);
+ }
+ priv->cmd_timed_out = 0;
+++ /dev/null
-The UAPI changes split up the kernel and userspace API
-headers into separate directories. We provide backport
-support for the new rfkill module to kernels older than
-2.6.31. To allow us to dynamically provide only backport
-support for those kernels we have a trick within compat
-to provide its own include/linux/rfkill.h header which
-then will include either your own kernel's rkfill.h or
-include the one we are taking from linux-next. The one
-we take from linux-next is renamed to rfkill_backport.h.
-In order to allow the call to include your own kernel's
-rfkill.h the compat rfkill.h uses include_next. The UAPI
-changes would mean though that instead of getting your
-own kernel's rfkill.h you'd end up getting the UAPI
-header file. Fix this by ensuring that for new kernels
-we linux_next into the user's kernels rfkill.h and if
-the kernel is old we still to the rfkill_backport.h
-naming scheme.
-
---- a/include/linux/rfkill_backport.h
-+++ b/include/linux/rfkill_backport.h
-@@ -18,7 +18,7 @@
- #ifndef __RFKILL_H
- #define __RFKILL_H
-
--#include <uapi/linux/rfkill.h>
-+#include <uapi/linux/rfkill_backport.h>
-
- /* don't allow anyone to use these in the kernel */
- enum rfkill_user_states {
--- /dev/null
+The UAPI changes split up the kernel and userspace API
+headers into separate directories. We provide backport
+support for the new rfkill module to kernels older than
+2.6.31. To allow us to dynamically provide only backport
+support for those kernels we have a trick within compat
+to provide its own include/linux/rfkill.h header which
+then will include either your own kernel's rkfill.h or
+include the one we are taking from linux-next. The one
+we take from linux-next is renamed to rfkill_backport.h.
+In order to allow the call to include your own kernel's
+rfkill.h the compat rfkill.h uses include_next. The UAPI
+changes would mean though that instead of getting your
+own kernel's rfkill.h you'd end up getting the UAPI
+header file. Fix this by ensuring that for new kernels
+we linux_next into the user's kernels rfkill.h and if
+the kernel is old we still to the rfkill_backport.h
+naming scheme.
+
--- /dev/null
+--- a/include/linux/rfkill_backport.h
++++ b/include/linux/rfkill_backport.h
+@@ -18,7 +18,7 @@
+ #ifndef __RFKILL_H
+ #define __RFKILL_H
+
+-#include <uapi/linux/rfkill.h>
++#include <uapi/linux/rfkill_backport.h>
+
+ /* don't allow anyone to use these in the kernel */
+ enum rfkill_user_states {
+++ /dev/null
---- a/drivers/net/wireless/ath/ath5k/led.c
-+++ b/drivers/net/wireless/ath/ath5k/led.c
-@@ -55,7 +55,7 @@
- #define ATH_POLARITY(data) ((data) & 0xff)
-
- /* Devices we match on for LED config info (typically laptops) */
--static DEFINE_PCI_DEVICE_TABLE(ath5k_led_devices) = {
-+static const struct pci_device_id ath5k_led_devices[] = {
- /* AR5211 */
- { PCI_VDEVICE(ATHEROS, PCI_DEVICE_ID_ATHEROS_AR5211), ATH_LED(0, 0) },
- /* HP Compaq nc6xx, nc4000, nx6000 */
--- /dev/null
+--- a/drivers/net/wireless/ath/ath5k/led.c
++++ b/drivers/net/wireless/ath/ath5k/led.c
+@@ -55,7 +55,7 @@
+ #define ATH_POLARITY(data) ((data) & 0xff)
+
+ /* Devices we match on for LED config info (typically laptops) */
+-static DEFINE_PCI_DEVICE_TABLE(ath5k_led_devices) = {
++static const struct pci_device_id ath5k_led_devices[] = {
+ /* AR5211 */
+ { PCI_VDEVICE(ATHEROS, PCI_DEVICE_ID_ATHEROS_AR5211), ATH_LED(0, 0) },
+ /* HP Compaq nc6xx, nc4000, nx6000 */
+++ /dev/null
-This backports:
-
-commit 502a2ffd7376ae27cfde6172257db0ff9d8cfec2
-Author: stephen hemminger <shemminger@vyatta.com>
-Date: Wed Mar 17 20:31:13 2010 +0000
-
- ipv6: convert idev_list to list macros
-
---- a/drivers/net/wireless/iwlwifi/mvm/d3.c
-+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
-@@ -101,7 +101,11 @@ void iwl_mvm_ipv6_addr_change(struct iee
- int idx = 0;
-
- read_lock_bh(&idev->lock);
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- list_for_each_entry(ifa, &idev->addr_list, if_list) {
-+#else
-+ for (ifa = idev->addr_list; ifa; ifa = ifa->if_next) {
-+#endif
- mvmvif->target_ipv6_addrs[idx] = ifa->addr;
- idx++;
- if (idx >= IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS)
--- /dev/null
+This backports:
+
+commit 502a2ffd7376ae27cfde6172257db0ff9d8cfec2
+Author: stephen hemminger <shemminger@vyatta.com>
+Date: Wed Mar 17 20:31:13 2010 +0000
+
+ ipv6: convert idev_list to list macros
+
--- /dev/null
+--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
++++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
+@@ -101,7 +101,11 @@
+ int idx = 0;
+
+ read_lock_bh(&idev->lock);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ list_for_each_entry(ifa, &idev->addr_list, if_list) {
++#else
++ for (ifa = idev->addr_list; ifa; ifa = ifa->if_next) {
++#endif
+ mvmvif->target_ipv6_addrs[idx] = ifa->addr;
+ idx++;
+ if (idx >= IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS)
+++ /dev/null
-__sock_create() is not available on kernel version < 2.6.37.
-
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -7728,7 +7728,7 @@ static int nl80211_parse_wowlan_tcp(stru
- port = nla_get_u16(tb[NL80211_WOWLAN_TCP_SRC_PORT]);
- else
- port = 0;
--#ifdef CONFIG_INET
-+#if defined(CONFIG_INET) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
- /* allocate a socket and port for it and use it */
- err = __sock_create(wiphy_net(&rdev->wiphy), PF_INET, SOCK_STREAM,
- IPPROTO_TCP, &cfg->sock, 1);
--- /dev/null
+__sock_create() is not available on kernel version < 2.6.37.
+
--- /dev/null
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -7728,7 +7728,7 @@
+ port = nla_get_u16(tb[NL80211_WOWLAN_TCP_SRC_PORT]);
+ else
+ port = 0;
+-#ifdef CONFIG_INET
++#if defined(CONFIG_INET) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ /* allocate a socket and port for it and use it */
+ err = __sock_create(wiphy_net(&rdev->wiphy), PF_INET, SOCK_STREAM,
+ IPPROTO_TCP, &cfg->sock, 1);
+++ /dev/null
---- a/drivers/net/wireless/ath/ath9k/debug.c
-+++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -1217,7 +1217,11 @@ static const struct file_operations fops
-
- static struct dentry *create_buf_file_handler(const char *filename,
- struct dentry *parent,
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
- umode_t mode,
-+#else
-+ int mode,
-+#endif
- struct rchan_buf *buf,
- int *is_global)
- {
---- a/drivers/gpu/drm/drm_sysfs.c
-+++ b/drivers/gpu/drm/drm_sysfs.c
-@@ -72,7 +72,11 @@ static int drm_class_resume(struct devic
- return 0;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
- static char *drm_devnode(struct device *dev, umode_t *mode)
-+#else
-+static char *drm_devnode(struct device *dev, mode_t *mode)
-+#endif
- {
- return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev));
- }
--- /dev/null
+--- a/drivers/gpu/drm/drm_sysfs.c
++++ b/drivers/gpu/drm/drm_sysfs.c
+@@ -72,7 +72,11 @@
+ return 0;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+ static char *drm_devnode(struct device *dev, umode_t *mode)
++#else
++static char *drm_devnode(struct device *dev, mode_t *mode)
++#endif
+ {
+ return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev));
+ }
--- /dev/null
+--- a/drivers/net/wireless/ath/ath9k/debug.c
++++ b/drivers/net/wireless/ath/ath9k/debug.c
+@@ -1217,7 +1217,11 @@
+
+ static struct dentry *create_buf_file_handler(const char *filename,
+ struct dentry *parent,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
+ umode_t mode,
++#else
++ int mode,
++#endif
+ struct rchan_buf *buf,
+ int *is_global)
+ {
+++ /dev/null
---- a/drivers/net/wireless/ti/wlcore/main.c
-+++ b/drivers/net/wireless/ti/wlcore/main.c
-@@ -5518,7 +5518,11 @@ static ssize_t wl1271_sysfs_show_hw_pg_v
- static DEVICE_ATTR(hw_pg_ver, S_IRUGO,
- wl1271_sysfs_show_hw_pg_ver, NULL);
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
- static ssize_t wl1271_sysfs_read_fwlog(struct file *filp, struct kobject *kobj,
-+#else
-+static ssize_t wl1271_sysfs_read_fwlog(struct kobject *kobj,
-+#endif
- struct bin_attribute *bin_attr,
- char *buffer, loff_t pos, size_t count)
- {
--- /dev/null
+--- a/drivers/net/wireless/ti/wlcore/main.c
++++ b/drivers/net/wireless/ti/wlcore/main.c
+@@ -5518,7 +5518,11 @@
+ static DEVICE_ATTR(hw_pg_ver, S_IRUGO,
+ wl1271_sysfs_show_hw_pg_ver, NULL);
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+ static ssize_t wl1271_sysfs_read_fwlog(struct file *filp, struct kobject *kobj,
++#else
++static ssize_t wl1271_sysfs_read_fwlog(struct kobject *kobj,
++#endif
+ struct bin_attribute *bin_attr,
+ char *buffer, loff_t pos, size_t count)
+ {
+++ /dev/null
-
-This patch removes all drivers we do not support
-or do not want to support. This lets us build
-only the wireless stuff.
-
---- a/drivers/misc/eeprom/Makefile
-+++ b/drivers/misc/eeprom/Makefile
-@@ -1,7 +1 @@
--obj-$(CONFIG_EEPROM_AT24) += at24.o
--obj-$(CONFIG_EEPROM_AT25) += at25.o
--obj-$(CONFIG_EEPROM_LEGACY) += eeprom.o
--obj-$(CONFIG_EEPROM_MAX6875) += max6875.o
- obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o
--obj-$(CONFIG_EEPROM_93XX46) += eeprom_93xx46.o
--obj-$(CONFIG_EEPROM_DIGSY_MTC_CFG) += digsy_mtc_eeprom.o
---- a/drivers/net/usb/Makefile
-+++ b/drivers/net/usb/Makefile
-@@ -2,35 +2,7 @@
- # Makefile for USB Network drivers
- #
-
--obj-$(CONFIG_USB_CATC) += catc.o
--obj-$(CONFIG_USB_KAWETH) += kaweth.o
--obj-$(CONFIG_USB_PEGASUS) += pegasus.o
--obj-$(CONFIG_USB_RTL8150) += rtl8150.o
--obj-$(CONFIG_USB_HSO) += hso.o
--obj-$(CONFIG_USB_NET_AX8817X) += asix.o
--asix-y := asix_devices.o asix_common.o ax88172a.o
--obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.o
- obj-$(CONFIG_USB_NET_COMPAT_CDCETHER) += cdc_ether.o
--obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o
--obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
--obj-$(CONFIG_USB_NET_SMSC75XX) += smsc75xx.o
--obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o
--obj-$(CONFIG_USB_NET_GL620A) += gl620a.o
--obj-$(CONFIG_USB_NET_NET1080) += net1080.o
--obj-$(CONFIG_USB_NET_PLUSB) += plusb.o
- obj-$(CONFIG_USB_NET_COMPAT_RNDIS_HOST) += rndis_host.o
--obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o
--obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o
--obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o
- obj-$(CONFIG_USB_COMPAT_USBNET) += usbnet.o
--obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o
--obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o
--obj-$(CONFIG_USB_NET_KALMIA) += kalmia.o
--obj-$(CONFIG_USB_IPHETH) += ipheth.o
--obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o
--obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o
--obj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o
--obj-$(CONFIG_USB_VL600) += lg-vl600.o
--obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan.o
--obj-$(CONFIG_USB_NET_CDC_MBIM) += cdc_mbim.o
-
---- a/drivers/net/wireless/Makefile
-+++ b/drivers/net/wireless/Makefile
-@@ -7,18 +7,8 @@ obj-$(CONFIG_IPW2200) += ipw2x00/
-
- obj-$(CONFIG_HERMES) += orinoco/
-
--obj-$(CONFIG_AIRO) += airo.o
--obj-$(CONFIG_AIRO_CS) += airo_cs.o airo.o
--
--obj-$(CONFIG_ATMEL) += atmel.o
--obj-$(CONFIG_PCI_ATMEL) += atmel_pci.o
--obj-$(CONFIG_PCMCIA_ATMEL) += atmel_cs.o
--
- obj-$(CONFIG_AT76C50X_USB) += at76c50x-usb.o
-
--obj-$(CONFIG_PRISM54) += prism54/
--
--obj-$(CONFIG_HOSTAP) += hostap/
- obj-$(CONFIG_B43) += b43/
- obj-$(CONFIG_B43LEGACY) += b43legacy/
- obj-$(CONFIG_COMPAT_ZD1211RW) += zd1211rw/
-@@ -26,13 +16,8 @@ obj-$(CONFIG_RTL8180) += rtl818x/
- obj-$(CONFIG_RTL8187) += rtl818x/
- obj-$(CONFIG_RTLWIFI) += rtlwifi/
-
--# 16-bit wireless PCMCIA client drivers
--obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o
--obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o
--
- obj-$(CONFIG_USB_NET_COMPAT_RNDIS_WLAN) += rndis_wlan.o
-
--obj-$(CONFIG_USB_ZD1201) += zd1201.o
- obj-$(CONFIG_LIBERTAS) += libertas/
-
- obj-$(CONFIG_LIBERTAS_THINFIRM) += libertas_tf/
---- a/net/wireless/Makefile
-+++ b/net/wireless/Makefile
-@@ -4,11 +4,6 @@ obj-$(CONFIG_LIB80211_CRYPT_WEP) += lib8
- obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o
- obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o
-
--obj-$(CONFIG_WEXT_CORE) += wext-core.o
--obj-$(CONFIG_WEXT_PROC) += wext-proc.o
--obj-$(CONFIG_WEXT_SPY) += wext-spy.o
--obj-$(CONFIG_WEXT_PRIV) += wext-priv.o
--
- cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o
- cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o
- cfg80211-$(CONFIG_COMPAT_CFG80211_DRIVER_API_TRACER) += trace.o
--- /dev/null
+
+This patch removes all drivers we do not support
+or do not want to support. This lets us build
+only the wireless stuff.
+
--- /dev/null
+--- a/drivers/misc/eeprom/Makefile
++++ b/drivers/misc/eeprom/Makefile
+@@ -1,7 +1,1 @@
+-obj-$(CONFIG_EEPROM_AT24) += at24.o
+-obj-$(CONFIG_EEPROM_AT25) += at25.o
+-obj-$(CONFIG_EEPROM_LEGACY) += eeprom.o
+-obj-$(CONFIG_EEPROM_MAX6875) += max6875.o
+ obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o
+-obj-$(CONFIG_EEPROM_93XX46) += eeprom_93xx46.o
+-obj-$(CONFIG_EEPROM_DIGSY_MTC_CFG) += digsy_mtc_eeprom.o
--- /dev/null
+--- a/drivers/net/usb/Makefile
++++ b/drivers/net/usb/Makefile
+@@ -2,35 +2,7 @@
+ # Makefile for USB Network drivers
+ #
+
+-obj-$(CONFIG_USB_CATC) += catc.o
+-obj-$(CONFIG_USB_KAWETH) += kaweth.o
+-obj-$(CONFIG_USB_PEGASUS) += pegasus.o
+-obj-$(CONFIG_USB_RTL8150) += rtl8150.o
+-obj-$(CONFIG_USB_HSO) += hso.o
+-obj-$(CONFIG_USB_NET_AX8817X) += asix.o
+-asix-y := asix_devices.o asix_common.o ax88172a.o
+-obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.o
+ obj-$(CONFIG_USB_NET_COMPAT_CDCETHER) += cdc_ether.o
+-obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o
+-obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
+-obj-$(CONFIG_USB_NET_SMSC75XX) += smsc75xx.o
+-obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o
+-obj-$(CONFIG_USB_NET_GL620A) += gl620a.o
+-obj-$(CONFIG_USB_NET_NET1080) += net1080.o
+-obj-$(CONFIG_USB_NET_PLUSB) += plusb.o
+ obj-$(CONFIG_USB_NET_COMPAT_RNDIS_HOST) += rndis_host.o
+-obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o
+-obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o
+-obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o
+ obj-$(CONFIG_USB_COMPAT_USBNET) += usbnet.o
+-obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o
+-obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o
+-obj-$(CONFIG_USB_NET_KALMIA) += kalmia.o
+-obj-$(CONFIG_USB_IPHETH) += ipheth.o
+-obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o
+-obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o
+-obj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o
+-obj-$(CONFIG_USB_VL600) += lg-vl600.o
+-obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan.o
+-obj-$(CONFIG_USB_NET_CDC_MBIM) += cdc_mbim.o
+
--- /dev/null
+--- a/drivers/net/wireless/Makefile
++++ b/drivers/net/wireless/Makefile
+@@ -7,18 +7,8 @@
+
+ obj-$(CONFIG_HERMES) += orinoco/
+
+-obj-$(CONFIG_AIRO) += airo.o
+-obj-$(CONFIG_AIRO_CS) += airo_cs.o airo.o
+-
+-obj-$(CONFIG_ATMEL) += atmel.o
+-obj-$(CONFIG_PCI_ATMEL) += atmel_pci.o
+-obj-$(CONFIG_PCMCIA_ATMEL) += atmel_cs.o
+-
+ obj-$(CONFIG_AT76C50X_USB) += at76c50x-usb.o
+
+-obj-$(CONFIG_PRISM54) += prism54/
+-
+-obj-$(CONFIG_HOSTAP) += hostap/
+ obj-$(CONFIG_B43) += b43/
+ obj-$(CONFIG_B43LEGACY) += b43legacy/
+ obj-$(CONFIG_COMPAT_ZD1211RW) += zd1211rw/
+@@ -26,13 +16,8 @@
+ obj-$(CONFIG_RTL8187) += rtl818x/
+ obj-$(CONFIG_RTLWIFI) += rtlwifi/
+
+-# 16-bit wireless PCMCIA client drivers
+-obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o
+-obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o
+-
+ obj-$(CONFIG_USB_NET_COMPAT_RNDIS_WLAN) += rndis_wlan.o
+
+-obj-$(CONFIG_USB_ZD1201) += zd1201.o
+ obj-$(CONFIG_LIBERTAS) += libertas/
+
+ obj-$(CONFIG_LIBERTAS_THINFIRM) += libertas_tf/
--- /dev/null
+--- a/net/wireless/Makefile
++++ b/net/wireless/Makefile
+@@ -4,11 +4,6 @@
+ obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o
+ obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o
+
+-obj-$(CONFIG_WEXT_CORE) += wext-core.o
+-obj-$(CONFIG_WEXT_PROC) += wext-proc.o
+-obj-$(CONFIG_WEXT_SPY) += wext-spy.o
+-obj-$(CONFIG_WEXT_PRIV) += wext-priv.o
+-
+ cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o
+ cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o
+ cfg80211-$(CONFIG_COMPAT_CFG80211_DRIVER_API_TRACER) += trace.o