--- af9035.c.orig 2009-09-26 20:56:12.000000000 +0200
+++ af9035.c 2012-01-29 14:59:01.000000000 +0100
@@ -4,6 +4,8 @@
* Copyright (C) 2008 Afatech
* Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
*
+ * Kernel 3.2 Patch by Federico Quagliata <federico at quagliata dot org>
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -27,6 +29,8 @@
#include "af9033.h"
#include "tua9001.h"
+#include "linux/version.h"
+
static int dvb_usb_af9035_debug;
module_param_named(debug, dvb_usb_af9035_debug, int, 0644);
MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
@@ -550,13 +554,21 @@
for (i = 0; i < af9035_properties_count; i++) {
/* USB1.1 set smaller buffersize and disable 2nd adapter */
if (udev->speed == USB_SPEED_FULL) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+ af9035_properties[i].adapter[0].fe[0].stream.u.bulk.buffersize
+#else
af9035_properties[i].adapter[0].stream.u.bulk.buffersize
+#endif
= TS_USB11_MAX_PACKET_SIZE;
/* disable 2nd adapter because we don't have
PID-filters */
af9035_config.dual_mode = 0;
} else {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+ af9035_properties[i].adapter[0].fe[0].stream.u.bulk.buffersize
+#else
af9035_properties[i].adapter[0].stream.u.bulk.buffersize
+#endif
= TS_USB20_MAX_PACKET_SIZE;
}
}
@@ -711,10 +723,18 @@
}
/* attach demodulator */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+ adap->fe_adap[0].fe = dvb_attach(af9033_attach, &af9035_af9033_config[adap->id],
+#else
adap->fe = dvb_attach(af9033_attach, &af9035_af9033_config[adap->id],
+#endif
&adap->dev->i2c_adap);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+ return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
+#else
return adap->fe == NULL ? -ENODEV : 0;
+#endif
error:
return ret;
@@ -756,8 +776,11 @@
/* activate tuner - TODO: do that like I2C gate control */
ret = af9035_write_reg_bits(adap->dev, LINK, p_reg_top_gpiot2_o,
reg_top_gpiot2_o_pos, reg_top_gpiot2_o_len, 1);
-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+ ret = dvb_attach(tua9001_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap,
+#else
ret = dvb_attach(tua9001_attach, adap->fe, &adap->dev->i2c_adap,
+#endif
&af9035_tua9001_config) == NULL ? -ENODEV : 0;
break;
default:
@@ -795,6 +818,10 @@
.adapter = {
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+ .num_frontends = 1,
+ .fe = {{
+#endif
.frontend_attach =
af9035_af9033_frontend_attach,
.tuner_attach = af9035_tuner_attach,
@@ -803,8 +830,15 @@
.count = 6,
.endpoint = 0x84,
},
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+ }},
+#endif
},
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+ .num_frontends = 1,
+ .fe = {{
+#endif
.frontend_attach =
af9035_af9033_frontend_attach,
.tuner_attach = af9035_tuner_attach,
@@ -819,6 +853,9 @@
}
}
},
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+ }},
+#endif
}
},