proc_fops: convert drivers/isdn/ to seq_file
Subsystems (2)
PATCH 1/1 proc_fops: convert drivers/isdn/ to seq_file
---
Documentation/isdn/INTERFACE.CAPI | 4 drivers/isdn/capi/capi.c | 99 +++++----------- drivers/isdn/capi/capidrv.c | 54 ++------ drivers/isdn/capi/kcapi.c | 8 - drivers/isdn/hardware/avm/avmcard.h | 6 drivers/isdn/hardware/avm/b1.c | 54 +++++--- drivers/isdn/hardware/avm/b1dma.c | 71 +++++------ drivers/isdn/hardware/avm/b1isa.c | 2 drivers/isdn/hardware/avm/b1pci.c | 4 drivers/isdn/hardware/avm/b1pcmcia.c | 2 drivers/isdn/hardware/avm/c4.c | 53 +++++--- drivers/isdn/hardware/avm/t1isa.c | 2 drivers/isdn/hardware/avm/t1pci.c | 2 drivers/isdn/hardware/eicon/capimain.c | 40 +++--- drivers/isdn/hardware/eicon/diva_didd.c | 44 +++---- drivers/isdn/hardware/eicon/divasi.c | 48 ++++--- drivers/isdn/hardware/eicon/divasproc.c | 198 ++++++++++++++------------------ drivers/isdn/hysdn/hycapi.c | 54 ++++---- include/linux/isdn/capilli.h | 3 net/bluetooth/cmtp/capi.c | 37 +++-- 20 files changed, 368 insertions(+), 417 deletions(-)
Documentation/isdn/INTERFACE.CAPI +2 -2
@@ -149,8 +149,8 @@ char *(*procinfo)(struct capi_ctr *ctrlr) pointer to a callback function returning the entry for the device in the CAPI controller info table, /proc/capi/controller -read_proc_t *ctr_read_proc - pointer to the read_proc callback function for the device's proc file +const struct file_operations *proc_fops + pointers to callback functions for the device's proc file system entry, /proc/capi/controllers/<n>; will be called with a pointer to the device's capi_ctr structure as the last (data) argument
drivers/isdn/capi/capi.c +35 -64
155 lines not on this page · raw message
drivers/isdn/capi/capidrv.c +16 -38
75 lines not on this page · raw message
drivers/isdn/capi/kcapi.c +1 -7
@@ -490,13 +490,7 @@ attach_capi_ctr(struct capi_ctr *card) card->traceflag = showcapimsgs;sprintf (card->procfn,"capi/controllers/%d" , card->cnr); - card->procent =create_proc_entry (card->procfn,0 ,NULL ); -if (card->procent) { - card->procent->read_proc = - (int (*)(char *,char **,off_t ,int ,int *,void *)) - card->ctr_read_proc; - card->procent->data = card; - } + card->procent =proc_create_data (card->procfn,0 ,NULL , card->proc_fops, card); ncards++; printk(KERN_NOTICE "kcapi: Controller [%03d]: %s attached\n",
drivers/isdn/hardware/avm/avmcard.h +2 -4
@@ -556,8 +556,7 @@ u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);void b1_parse_version (avmctrl_info *card);irqreturn_t b1_interrupt (int interrupt,void *devptr); -int b1ctl_read_proc (char *page,char **start,off_t off, -int count,int *eof,struct capi_ctr *ctrl); +extern const struct file_operations b1ctl_proc_fops;avmcard_dmainfo *avmcard_dma_alloc (char *name,struct pci_dev *,long rsize,long ssize);
@@ -577,7 +576,6 @@ void b1dma_register_appl(struct capi_ctr *ctrl, capi_register_params *rp);void b1dma_release_appl (struct capi_ctr *ctrl,u16 appl);u16 b1dma_send_message (struct capi_ctr *ctrl,struct sk_buff *skb); -int b1dmactl_read_proc (char *page,char **start,off_t off, -int count,int *eof,struct capi_ctr *ctrl); +extern const struct file_operations b1dmactl_proc_fops;#endif /* _AVMCARD_H_ */
drivers/isdn/hardware/avm/b1.c +31 -23
106 lines not on this page · raw message
drivers/isdn/hardware/avm/b1dma.c +37 -34
130 lines not on this page · raw message
drivers/isdn/hardware/avm/b1isa.c +1 -1
@@ -121,7 +121,7 @@ static int b1isa_probe(struct pci_dev *pdev) cinfo->capi_ctrl.load_firmware = b1_load_firmware; cinfo->capi_ctrl.reset_ctr = b1_reset_ctr; cinfo->capi_ctrl.procinfo = b1isa_procinfo; - cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc; + cinfo->capi_ctrl.proc_fops = &b1ctl_proc_fops;strcpy (cinfo->capi_ctrl.name, card->name); retval =attach_capi_ctr (&cinfo->capi_ctrl);
drivers/isdn/hardware/avm/b1pci.c +2 -2
@@ -112,7 +112,7 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev) cinfo->capi_ctrl.load_firmware = b1_load_firmware; cinfo->capi_ctrl.reset_ctr = b1_reset_ctr; cinfo->capi_ctrl.procinfo = b1pci_procinfo; - cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc; + cinfo->capi_ctrl.proc_fops = &b1ctl_proc_fops;strcpy (cinfo->capi_ctrl.name, card->name); cinfo->capi_ctrl.owner =THIS_MODULE ;
@@ -251,7 +251,7 @@ static int b1pciv4_probe(struct capicardparams *p, struct pci_dev *pdev) cinfo->capi_ctrl.load_firmware = b1dma_load_firmware; cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr; cinfo->capi_ctrl.procinfo = b1pciv4_procinfo; - cinfo->capi_ctrl.ctr_read_proc = b1dmactl_read_proc; + cinfo->capi_ctrl.proc_fops = &b1dmactl_proc_fops;strcpy (cinfo->capi_ctrl.name, card->name); retval =attach_capi_ctr (&cinfo->capi_ctrl);
drivers/isdn/hardware/avm/b1pcmcia.c +1 -1
@@ -108,7 +108,7 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq, cinfo->capi_ctrl.load_firmware = b1_load_firmware; cinfo->capi_ctrl.reset_ctr = b1_reset_ctr; cinfo->capi_ctrl.procinfo = b1pcmcia_procinfo; - cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc; + cinfo->capi_ctrl.proc_fops = &b1ctl_proc_fops;strcpy (cinfo->capi_ctrl.name, card->name); retval =attach_capi_ctr (&cinfo->capi_ctrl);
drivers/isdn/hardware/avm/c4.c +31 -22
104 lines not on this page · raw message
drivers/isdn/hardware/avm/t1isa.c +1 -1
@@ -429,7 +429,7 @@ static int t1isa_probe(struct pci_dev *pdev, int cardnr) cinfo->capi_ctrl.load_firmware = t1isa_load_firmware; cinfo->capi_ctrl.reset_ctr = t1isa_reset_ctr; cinfo->capi_ctrl.procinfo = t1isa_procinfo; - cinfo->capi_ctrl.ctr_read_proc = b1ctl_read_proc; + cinfo->capi_ctrl.proc_fops = &b1ctl_proc_fops;strcpy (cinfo->capi_ctrl.name, card->name); retval =attach_capi_ctr (&cinfo->capi_ctrl);
drivers/isdn/hardware/avm/t1pci.c +1 -1
@@ -119,7 +119,7 @@ static int t1pci_add_card(struct capicardparams *p, struct pci_dev *pdev) cinfo->capi_ctrl.load_firmware = b1dma_load_firmware; cinfo->capi_ctrl.reset_ctr = b1dma_reset_ctr; cinfo->capi_ctrl.procinfo = t1pci_procinfo; - cinfo->capi_ctrl.ctr_read_proc = b1dmactl_read_proc; + cinfo->capi_ctrl.proc_fops = &b1dmactl_proc_fops;strcpy (cinfo->capi_ctrl.name, card->name); retval =attach_capi_ctr (&cinfo->capi_ctrl);
drivers/isdn/hardware/eicon/capimain.c +24 -16
@@ -13,6 +13,7 @@#include <linux/module.h> #include <linux/init.h> #include <asm/uaccess.h> +#include <linux/seq_file.h> #include <linux/skbuff.h> #include "os_capi.h"
@@ -75,25 +76,32 @@ void diva_os_free_message_buffer(diva_os_message_buffer_s * dmb)/* * proc function for controller info */ -static int diva_ctl_read_proc (char *page,char **start,off_t off, -int count,int *eof,struct capi_ctr *ctrl) +static int diva_ctl_proc_show (struct seq_file *m,void *v) { +struct capi_ctr *ctrl = m->private;diva_card *card = (diva_card *) ctrl->driverdata; -int len =0 ; - - len +=sprintf (page + len,"%s\n" , ctrl->name); - len +=sprintf (page + len,"Serial No. : %s\n" , ctrl->serial); - len +=sprintf (page + len,"Id : %d\n" , card->Id); - len +=sprintf (page + len,"Channels : %d\n" , card->d.channels); - -if (off + count >= len) - *eof =1 ; -if (len < off) -return 0 ; - *start = page + off; -return ((count < len - off) ? count : len - off); + +seq_printf (m,"%s\n" , ctrl->name); +seq_printf (m,"Serial No. : %s\n" , ctrl->serial); +seq_printf (m,"Id : %d\n" , card->Id); +seq_printf (m,"Channels : %d\n" , card->d.channels); + +return 0 ; +} + +static int diva_ctl_proc_open (struct inode *inode,struct file *file) +{ +return single_open (file, diva_ctl_proc_show,NULL ); } +static const struct file_operations diva_ctl_proc_fops = { + .owner =THIS_MODULE , + .open = diva_ctl_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +/* * set additional os settings in capi_ctr struct */
@@ -102,7 +110,7 @@ void diva_os_set_controller_struct(struct capi_ctr *ctrl) ctrl->driver_name =DRIVERLNAME ; ctrl->load_firmware =NULL ; ctrl->reset_ctr =NULL ; - ctrl->ctr_read_proc = diva_ctl_read_proc; + ctrl->proc_fops = &diva_ctl_proc_fops; ctrl->owner =THIS_MODULE ; }
drivers/isdn/hardware/eicon/diva_didd.c +23 -21
62 lines not on this page · raw message
drivers/isdn/hardware/eicon/divasi.c +25 -23
70 lines not on this page · raw message
drivers/isdn/hardware/eicon/divasproc.c +87 -111
291 lines not on this page · raw message
drivers/isdn/hysdn/hycapi.c +26 -28
83 lines not on this page · raw message
include/linux/isdn/capilli.h +1 -2
@@ -50,8 +50,7 @@ struct capi_ctr {u16 (*send_message)(struct capi_ctr *,struct sk_buff *skb);char *(*procinfo)(struct capi_ctr *); -int (*ctr_read_proc)(char *page,char **start,off_t off, -int count,int *eof,struct capi_ctr *card); +const struct file_operations *proc_fops;/* filled in before calling ready callback */ u8 manu[CAPI_MANUFACTURER_LEN ];/* CAPI_GET_MANUFACTURER */
net/bluetooth/cmtp/capi.c +21 -16
@@ -21,7 +21,8 @@*/ #include <linux/module.h> - +#include <linux/proc_fs.h> +#include <linux/seq_file.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/kernel.h>
@@ -516,33 +517,37 @@ static char *cmtp_procinfo(struct capi_ctr *ctrl)return "CAPI Message Transport Protocol" ; } -static int cmtp_ctr_read_proc (char *page,char **start,off_t off,int count,int *eof,struct capi_ctr *ctrl) +static int cmtp_proc_show (struct seq_file *m,void *v) { +struct capi_ctr *ctrl = m->private;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); +seq_printf (m,"%s\n\n" ,cmtp_procinfo (ctrl)); +seq_printf (m,"addr %s\n" , session->name); +seq_printf (m,"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); +seq_printf (m,"appl %d -> %d\n" , app->appl, app->mapping); } -if (off + count >= len) - *eof =1 ; - -if (len < off) -return 0 ; - - *start = page + off; +return 0 ; +} -return ((count < len - off) ? count : len - off); +static int cmtp_proc_open (struct inode *inode,struct file *file) +{ +return single_open (file, cmtp_proc_show,PDE (inode)->data); } +static const struct file_operations cmtp_proc_fops = { + .owner =THIS_MODULE , + .open = cmtp_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +};int cmtp_attach_device (struct cmtp_session *session) {
@@ -582,7 +587,7 @@ int cmtp_attach_device(struct cmtp_session *session) session->ctrl.send_message = cmtp_send_message; session->ctrl.procinfo = cmtp_procinfo; - session->ctrl.ctr_read_proc = cmtp_ctr_read_proc; + session->ctrl.proc_fops = &cmtp_proc_fops;if (attach_capi_ctr (&session->ctrl) <0 ) {BT_ERR ("Can't attach new controller" );
Quoted 16 lines · On Mon, 23 Nov 2009 04:56:25 +0300 Alexey Dobriyan <[email protected]> wrote:
Signed-off-by Alexey Dobriyan <[email protected]>---
Documentation/isdn/INTERFACE.CAPI | 4 drivers/isdn/capi/capi.c | 99 +++++----------- drivers/isdn/capi/capidrv.c | 54 ++------ drivers/isdn/capi/kcapi.c | 8 - drivers/isdn/hardware/avm/avmcard.h | 6 drivers/isdn/hardware/avm/b1.c | 54 +++++--- drivers/isdn/hardware/avm/b1dma.c | 71 +++++------ drivers/isdn/hardware/avm/b1isa.c | 2 drivers/isdn/hardware/avm/b1pci.c | 4 drivers/isdn/hardware/avm/b1pcmcia.c | 2 drivers/isdn/hardware/avm/c4.c | 53 +++++--- drivers/isdn/hardware/avm/t1isa.c | 2 drivers/isdn/hardware/avm/t1pci.c | 2
Quoted 8 lines
drivers/isdn/hardware/eicon/capimain.c | 40 +++--- drivers/isdn/hardware/eicon/diva_didd.c | 44 +++---- drivers/isdn/hardware/eicon/divasi.c | 48 ++++--- drivers/isdn/hardware/eicon/divasproc.c | 198 ++++++++++++++------------------ drivers/isdn/hysdn/hycapi.c | 54 ++++---- include/linux/isdn/capilli.h | 3 net/bluetooth/cmtp/capi.c | 37 +++-- 20 files changed, 368 insertions(+), 417 deletions(-)
linux-next collision:
drivers/isdn/gigaset/capi.c: In function 'gigaset_isdn_register':drivers/isdn/gigaset/capi.c:2259: error: 'struct capi_ctr' has no member named 'ctr_read_proc'
Quoted 7 lines · Andrew Morton
On Mon, 23 Nov 2009 04:56:25 +0300
Alexey Dobriyan <[email protected]> wrote:linux-next collision:
drivers/isdn/gigaset/capi.c: In function 'gigaset_isdn_register':drivers/isdn/gigaset/capi.c:2259: error: 'structcapi_ctr' has no member named 'ctr_read_proc'
Please, fold into my patch:
drivers/isdn/gigaset/capi.c +35 -35
@@ -2106,35 +2106,22 @@ static char *gigaset_procinfo(struct capi_ctr *ctr)return ctr->name;/* ToDo: more? */ } -/** -* gigaset_ctr_read_proc() - build controller proc file entry -* @page: buffer of PAGE_SIZE bytes for receiving the entry. -* @start: unused. -* @off: unused. -* @count: unused. -* @eof: unused. -* @ctr: controller descriptor structure. -* -* Return value: length of generated entry -*/ -static int gigaset_ctr_read_proc (char *page,char **start,off_t off, -int count,int *eof,struct capi_ctr *ctr) +static int gigaset_proc_show (struct seq_file *m,void *v) { +struct capi_ctr *ctr = m->private;struct cardstate *cs = ctr->driverdata;char *s;int i; -int len =0 ; - len +=sprintf (page+len,"%-16s %s\n" ,"name" , ctr->name); - len +=sprintf (page+len,"%-16s %s %s\n" ,"dev" , + +seq_printf (m,"%-16s %s\n" ,"name" , ctr->name); +seq_printf (m,"%-16s %s %s\n" ,"dev" ,dev_driver_string (cs->dev),dev_name (cs->dev)); - len +=sprintf (page+len,"%-16s %d\n" ,"id" , cs->myid); +seq_printf (m,"%-16s %d\n" ,"id" , cs->myid);if (cs->gotfwver) - len +=sprintf (page+len,"%-16s %d.%d.%d.%d\n" ,"firmware" , +seq_printf (m,"%-16s %d.%d.%d.%d\n" ,"firmware" , cs->fwver[0 ], cs->fwver[1 ], cs->fwver[2 ], cs->fwver[3 ]); - len +=sprintf (page+len,"%-16s %d\n" ,"channels" , - cs->channels); - len +=sprintf (page+len,"%-16s %s\n" ,"onechannel" , - cs->onechannel ?"yes" :"no" ); +seq_printf (m,"%-16s %d\n" ,"channels" , cs->channels); +seq_printf (m,"%-16s %s\n" ,"onechannel" , cs->onechannel ?"yes" :"no" );switch (cs->mode) {case M_UNKNOWN :
@@ -2152,7 +2139,7 @@ static int gigaset_ctr_read_proc(char *page, char **start, off_t off,default : s ="??" ; } - len +=sprintf (page+len,"%-16s %s\n" ,"mode" , s); +seq_printf (m,"%-16s %s\n" ,"mode" , s);switch (cs->mstate) {case MS_UNINITIALIZED :
@@ -2176,25 +2163,25 @@ static int gigaset_ctr_read_proc(char *page, char **start, off_t off,default : s ="??" ; } - len +=sprintf (page+len,"%-16s %s\n" ,"mstate" , s); +seq_printf (m,"%-16s %s\n" ,"mstate" , s); - len +=sprintf (page+len,"%-16s %s\n" ,"running" , +seq_printf (m,"%-16s %s\n" ,"running" , cs->running ?"yes" :"no" ); - len +=sprintf (page+len,"%-16s %s\n" ,"connected" , +seq_printf (m,"%-16s %s\n" ,"connected" , cs->connected ?"yes" :"no" ); - len +=sprintf (page+len,"%-16s %s\n" ,"isdn_up" , +seq_printf (m,"%-16s %s\n" ,"isdn_up" , cs->isdn_up ?"yes" :"no" ); - len +=sprintf (page+len,"%-16s %s\n" ,"cidmode" , +seq_printf (m,"%-16s %s\n" ,"cidmode" , cs->cidmode ?"yes" :"no" );for (i =0 ; i < cs->channels; i++) { - len +=sprintf (page+len,"[%d]%-13s %d\n" , i,"corrupted" , +seq_printf (m,"[%d]%-13s %d\n" , i,"corrupted" , cs->bcs[i].corrupted); - len +=sprintf (page+len,"[%d]%-13s %d\n" , i,"trans_down" , +seq_printf (m,"[%d]%-13s %d\n" , i,"trans_down" , cs->bcs[i].trans_down); - len +=sprintf (page+len,"[%d]%-13s %d\n" , i,"trans_up" , +seq_printf (m,"[%d]%-13s %d\n" , i,"trans_up" , cs->bcs[i].trans_up); - len +=sprintf (page+len,"[%d]%-13s %d\n" , i,"chstate" , +seq_printf (m,"[%d]%-13s %d\n" , i,"chstate" , cs->bcs[i].chstate);switch (cs->bcs[i].proto2) {case L2_BITSYNC :
@@ -2209,11 +2196,24 @@ static int gigaset_ctr_read_proc(char *page, char **start, off_t off,default : s ="??" ; } - len +=sprintf (page+len,"[%d]%-13s %s\n" , i,"proto2" , s); +seq_printf (m,"[%d]%-13s %s\n" , i,"proto2" , s); } -return len; +return 0 ; } +static int gigaset_proc_open (struct inode *inode,struct file *file) +{ +return single_open (file, gigaset_proc_show,PDE (inode)->data); +} + +static const struct file_operations gigaset_proc_fops = { + .owner =THIS_MODULE , + .open = gigaset_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +static struct capi_driver capi_driver_gigaset = { .name ="gigaset" ,
@@ -2256,7 +2256,7 @@ int gigaset_isdn_register(struct cardstate *cs, const char *isdnid) iif->ctr.release_appl = gigaset_release_appl; iif->ctr.send_message = gigaset_send_message; iif->ctr.procinfo = gigaset_procinfo; - iif->ctr.ctr_read_proc = gigaset_ctr_read_proc; + iif->ctr.proc_fops = &gigaset_proc_fops;INIT_LIST_HEAD (&iif->appls);skb_queue_head_init (&iif->sendqueue);atomic_set (&iif->sendqlen,0 );
Am 25.11.2009 05:59 schrieb Alexey Dobriyan:
Quoted 10 lines
drivers/isdn/gigaset/capi.c +0
-4@@ -2106,35 +2106,22 @@ static char *gigaset_procinfo(struct capi_ctr *ctr)return ctr->name;/* ToDo: more? */ } -/** -* gigaset_ctr_read_proc() - build controller proc file entry -* @page: buffer of PAGE_SIZE bytes for receiving the entry. -* @start: unused.
drivers/isdn/gigaset/capi.c static char *gigaset_procinfo(struct capi_ctr *ctr) · line 2109
Quoted 10 lines
drivers/isdn/gigaset/capi.c +1
-9-* @off: unused. -* @count: unused. -* @eof: unused. -* @ctr: controller descriptor structure. -* -* Return value: length of generated entry -*/ -static int gigaset_ctr_read_proc (char *page,char **start,off_t off, -int count,int *eof,struct capi_ctr *ctr) +static int gigaset_proc_show (struct seq_file *m,void *v)
I would prefer that, instead of throwing the kerneldoc comment away, you adapted it to the new function. Specifically, I would like to know what the second argument "void *v" is for.
drivers/isdn/gigaset/capi.c static char *gigaset_procinfo(struct capi_ctr *ctr) · line 2111
Quoted 2 lines
drivers/isdn/gigaset/capi.c +1
-0{ +struct capi_ctr *ctr = m->private;
See below.
drivers/isdn/gigaset/capi.c static int gigaset_ctr_read_proc(char *page, char **start, off_t off, · line 2206
Quoted 3 lines
drivers/isdn/gigaset/capi.c +3
-0+static int gigaset_proc_open (struct inode *inode,struct file *file) +{ +return single_open (file, gigaset_proc_show,PDE (inode)->data);
I'd like to understand how that works.
According to Documentation/filesystems/seq_file.txt, the value of the last argument will be passed to the proc_show function in the private field of the seq_file structure. Your gigaset_proc_show() function assumes that this will be the capi_ctr pointer for the device.
So what is PDE(inode)->data and where does it get set to the capi_ctr pointer for the device?
Thanks,
Tilman
Signature · 4 lines
Tilman Schmidt E-Mail: [email protected] Bonn, Germany Diese Nachricht besteht zu 100% aus wiederverwerteten Bits. Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
Quoted 17 lines · Tilman Schmidt
Am 25.11.2009 05:59 schrieb Alexey Dobriyan:
Quoted 16 lines
drivers/isdn/gigaset/capi.c +0
-10@@ -2106,35 +2106,22 @@ static char *gigaset_procinfo(struct capi_ctr *ctr)return ctr->name;/* ToDo: more? */ } -/** -* gigaset_ctr_read_proc() - build controller proc file entry -* @page: buffer of PAGE_SIZE bytes for receiving the entry. -* @start: unused. -* @off: unused. -* @count: unused. -* @eof: unused. -* @ctr: controller descriptor structure. -* -* Return value: length of generated entry
Quoted 8 lines
drivers/isdn/gigaset/capi.c static char *gigaset_procinfo(struct capi_ctr *ctr) · line 2109
Quoted 4 lines
drivers/isdn/gigaset/capi.c +1
-3-*/ -static int gigaset_ctr_read_proc (char *page,char **start,off_t off, -int count,int *eof,struct capi_ctr *ctr) +static int gigaset_proc_show (struct seq_file *m,void *v)I would prefer that, instead of throwing the kerneldoc comment away, you adapted it to the new function. Specifically, I would like to know what the second argument "void *v" is for.
Sorry, no.
I personally find the corellation between kernel-docness and useleness to be highly positive.
Comment is removed because after removal of parameters "description", nothing is left.
Quoted 11 lines
drivers/isdn/gigaset/capi.c static char *gigaset_procinfo(struct capi_ctr *ctr) · line 2111
Quoted 2 lines
drivers/isdn/gigaset/capi.c +1
-0{ +struct capi_ctr *ctr = m->private;See below.
drivers/isdn/gigaset/capi.c static int gigaset_ctr_read_proc(char *page, char **start, off_t off, · line 2206
Quoted 3 lines
drivers/isdn/gigaset/capi.c +3
-0+static int gigaset_proc_open (struct inode *inode,struct file *file) +{ +return single_open (file, gigaset_proc_show,PDE (inode)->data);I'd like to understand how that works.
Quoted 8 lines
According to
Documentation/filesystems/seq_file.txt, the value of the last argument will be passed to theproc_showfunction in the private field of theseq_filestructure. Yourgigaset_proc_show()function assumes that this will be thecapi_ctrpointer for the device.So what is PDE(inode)->data and where does it get set to the
capi_ctrpointer for the device?
When you create proc entry, you set ->data for proc entry,
it's accessible as PDE(inode)->data.
Now you need to pass it doen to actual hook.
It got stashed eventually into struct seq_file::private (see single_open())
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 2009-11-30 21:17 schrieb Alexey Dobriyan:
Quoted 26 lines · Tilman Schmidt
Quoted 16 lines
Am 25.11.2009 05:59 schrieb Alexey Dobriyan:
Quoted 15 lines
drivers/isdn/gigaset/capi.c +0
-9@@ -2106,35 +2106,22 @@ static char *gigaset_procinfo(struct capi_ctr *ctr)return ctr->name;/* ToDo: more? */ } -/** -* gigaset_ctr_read_proc() - build controller proc file entry -* @page: buffer of PAGE_SIZE bytes for receiving the entry. -* @start: unused. -* @off: unused. -* @count: unused. -* @eof: unused. -* @ctr: controller descriptor structure. -* Quoted 8 lines
drivers/isdn/gigaset/capi.c static char *gigaset_procinfo(struct capi_ctr *ctr) · line 2109
Quoted 5 lines
drivers/isdn/gigaset/capi.c +1
-4-* Return value: length of generated entry -*/ -static int gigaset_ctr_read_proc (char *page,char **start,off_t off, -int count,int *eof,struct capi_ctr *ctr) +static int gigaset_proc_show (struct seq_file *m,void *v)I would prefer that, instead of throwing the kerneldoc comment away, you adapted it to the new function. Specifically, I would like to know what the second argument "void *v" is for.
Quoted 1 line
Sorry, no.
Ok, if you don't want to do it, I'll wait whether this is merged and see if I can come up with something sensible as a follow-up. I guess that's part of the job of a driver maintainer.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/isdn/gigaset/capi.c +3
-0+static int gigaset_proc_open (struct inode *inode,struct file *file) +{ +return single_open (file, gigaset_proc_show,PDE (inode)->data);
[...]
Quoted 5 lines
Quoted 2 lines
So what is PDE(inode)->data and where does it get set to the
capi_ctrpointer for the device?When you create proc entry, you set ->data for proc entry, it's accessible as PDE(inode)->data.
I see. So in the context of CAPI subsystem - CAPI driver relations, it's the CAPI subsystem that assures this. You should mention that in your patch to Documentation/isdn/INTERFACE.CAPI.
Thanks,
Tilman
- --
Tilman Schmidt E-Mail: [email protected]
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits. Ungeöffnet mindestens haltbar bis: (siehe Rückseite) -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFLFizkQ3+did9BuFsRAqOEAJ9hHkwjQoPZUEw1ivKI3J+c2/lgigCgmH0j Y3t7ifiCcLpr9Gqb8gnNhe4=
=HlV+
-----END PGP SIGNATURE-----
Am 23.11.2009 02:56 schrieb Alexey Dobriyan:
Documentation/isdn/INTERFACE.CAPI char *(*procinfo)(struct capi_ctr *ctrlr) · line 156
Quoted 13 lines
Documentation/isdn/INTERFACE.CAPI +2
-2@@ -149,8 +149,8 @@ char *(*procinfo)(struct capi_ctr *ctrlr) pointer to a callback function returning the entry for the device in the CAPI controller info table, /proc/capi/controller -read_proc_t *ctr_read_proc - pointer to the read_proc callback function for the device's proc file +const struct file_operations *proc_fops + pointers to callback functions for the device's proc file system entry, /proc/capi/controllers/<n>; will be called with a pointer to the device's capi_ctr structure as the last (data) argument
This doesn't look correct. AFACIS, most of the callback functions in proc_fops don't have a last argument named data or looking as if it might lend itself to passing a pointer to the device's capi_ctr structure. In fact, later in your patch you replace uses of that last argument by accesses to the m->private member of the struct seq_file *m argument, like here:
Quoted 2 lines
drivers/isdn/hardware/avm/b1.c +0
-0
[...]
drivers/isdn/hardware/avm/b1.c irqreturn_t b1_interrupt(int interrupt, void *devptr) · line 644
Quoted 12 lines
drivers/isdn/hardware/avm/b1.c +2
-2@@ -634,18 +636,17 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) }/* ------------------------------------------------------------- */ -int b1ctl_read_proc (char *page,char **start,off_t off, -int count,int *eof,struct capi_ctr *ctrl) +static int b1ctl_proc_show (struct seq_file *m,void *v) { +struct capi_ctr *ctrl = m->private;avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);avmcard *card = cinfo->card;u8 flag;
[...]
So I guess the paragraph Documentation/isdn/INTERFACE.CAPI needs to be adapted to describe correctly where the callbacks will find their controller data structure after that change.
OTOH, the new proc_show functions sport a second argument void *v that doesn't appear to get used anywhere. It would be nice if that could be explained a bit somewhere.
Thanks,
Tilman
Signature · 4 lines
Tilman Schmidt E-Mail: [email protected] Bonn, Germany Diese Nachricht besteht zu 100% aus wiederverwerteten Bits. Ungeöffnet mindestens haltbar bis: (siehe Rückseite)