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/module.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");
