You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-dialup/fcpci/files/fcpci-kernel-2.6.34.patch

127 lines
4.3 KiB

--- fritz/src/driver.c.orig 2010-12-09 16:47:24.552314553 +0100
+++ fritz/src/driver.c 2010-12-09 16:53:16.040981703 +0100
@@ -48,6 +48,8 @@
#include "defs.h"
#include "lib.h"
#include "driver.h"
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
@@ -220,16 +220,6 @@
} /* kill_version */
/*---------------------------------------------------------------------------*\
-\*---------------------------------------------------------------------------*/
-static void pprintf (char * page, int * len, const char * fmt, ...) {
- va_list args;
-
- va_start (args, fmt);
- *len += vsprintf (page + *len, fmt, args);
- va_end (args);
-} /* pprintf */
-
-/*---------------------------------------------------------------------------*\
\*-C-------------------------------------------------------------------------*/
static inline int in_critical (void) {
@@ -490,39 +480,33 @@
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
-static int __kcapi ctr_info (
- char * page,
- char ** start,
- off_t ofs,
- int count,
- int * eof,
- struct capi_ctr * ctrl
-) {
+static int __kcapi ctr_info (struct seq_file *m, void *v)
+{
+ struct capi_ctr *ctrl = m->private;
card_t * card;
char * temp;
unsigned char flag;
- int len = 0;
assert (ctrl != NULL);
card = (card_t *) ctrl->driverdata;
assert (card != NULL);
- pprintf (page, &len, "%-16s %s\n", "name", SHORT_LOGO);
- pprintf (page, &len, "%-16s 0x%04x\n", "io", card->base);
- pprintf (page, &len, "%-16s %d\n", "irq", card->irq);
+ seq_printf(m, "%-16s %s\n", "name", SHORT_LOGO);
+ seq_printf(m, "%-16s 0x%04x\n", "io", card->base);
+ seq_printf(m, "%-16s %d\n", "irq", card->irq);
temp = card->version ? card->string[1] : "A1";
- pprintf (page, &len, "%-16s %s\n", "type", temp);
+ seq_printf(m, "%-16s %s\n", "type", temp);
temp = card->version ? card->string[0] : "-";
#if defined (__fcclassic__) || defined (__fcpcmcia__)
- pprintf (page, &len, "%-16s 0x%04x\n", "revision", card->info);
+ seq_printf(m, "%-16s 0x%04x\n", "revision", card->info);
#elif defined (__fcpci__)
- pprintf (page, &len, "%-16s %d\n", "class", card_id);
+ seq_printf(m, "%-16s %d\n", "class", card_id);
#endif
- pprintf (page, &len, "%-16s %s\n", "ver_driver", temp);
- pprintf (page, &len, "%-16s %s\n", "ver_cardtype", SHORT_LOGO);
+ seq_printf(m, "%-16s %s\n", "ver_driver", temp);
+ seq_printf(m, "%-16s %s\n", "ver_cardtype", SHORT_LOGO);
flag = ((unsigned char *) (ctrl->profile.manu))[3];
if (flag) {
- pprintf(page, &len, "%-16s%s%s%s%s%s%s%s\n", "protocol",
+ seq_printf(m, "%-16s%s%s%s%s%s%s%s\n", "protocol",
(flag & 0x01) ? " DSS1" : "",
(flag & 0x02) ? " CT1" : "",
(flag & 0x04) ? " VN3" : "",
@@ -534,21 +518,29 @@
}
flag = ((unsigned char *) (ctrl->profile.manu))[5];
if (flag) {
- pprintf(page, &len, "%-16s%s%s%s%s\n", "linetype",
+ seq_printf(m, "%-16s%s%s%s%s\n", "linetype",
(flag & 0x01) ? " point to point" : "",
(flag & 0x02) ? " point to multipoint" : "",
(flag & 0x08) ? " leased line without D-channel" : "",
(flag & 0x04) ? " leased line with D-channel" : ""
);
}
- if (len < ofs) {
- return 0;
- }
- *eof = 1;
- *start = page - ofs;
- return ((count < len - ofs) ? count : len - ofs);
+ return 0;
} /* ctr_info */
+static int ctr_proc_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, ctr_info, PDE(inode)->data);
+}
+
+const struct file_operations ctr_proc_fops = {
+ .owner = THIS_MODULE,
+ .open = ctr_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
static void __kcapi reset_ctrl (struct capi_ctr * ctrl) {
@@ -626,7 +618,7 @@
ctrl->release_appl = release_appl;
ctrl->send_message = send_msg;
ctrl->procinfo = proc_info;
- ctrl->ctr_read_proc = ctr_info;
+ ctrl->proc_fops = &ctr_proc_fops;
if (0 != (res = attach_capi_ctr (ctrl))) {
dec_use_count ();
stop (card);