netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tilman Schmidt <tilman@imap.cc>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: akpm@linux-foundation.org, isdn@linux-pingi.de, netdev@vger.kernel.org
Subject: Re: [patch 1/2] proc_fops: convert drivers/isdn/ to seq_file
Date: Sun, 10 Jan 2010 19:42:49 +0100	[thread overview]
Message-ID: <4B4A1FA9.7030505@imap.cc> (raw)
In-Reply-To: <20100105211934.GA21210@x200>

[-- Attachment #1: Type: text/plain, Size: 7969 bytes --]

Am 05.01.2010 22:19 schrieb Alexey Dobriyan:
> Here is hopefully last version and sorry for delay.

Looks good. Thanks.

> [PATCH] proc_fops: convert drivers/isdn/ to seq_file
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Tilman Schmidt <tilman@imap.cc>

for the Documentation and drivers/isdn/gigaset parts.

> ---
> 
>  Documentation/isdn/INTERFACE.CAPI       |    9 -
>  drivers/isdn/capi/capi.c                |   99 +++++-----------
>  drivers/isdn/capi/capidrv.c             |   55 ++------
>  drivers/isdn/capi/kcapi.c               |    8 -
>  drivers/isdn/gigaset/capi.c             |   75 +++++-------
>  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 |   45 +++----
>  drivers/isdn/hardware/eicon/divasi.c    |   48 ++++---
>  drivers/isdn/hardware/eicon/divasproc.c |  198 ++++++++++++++------------------
>  drivers/isdn/hysdn/hycapi.c             |   56 ++++-----
>  include/linux/isdn/capilli.h            |    3 
>  net/bluetooth/cmtp/capi.c               |   37 +++--
>  21 files changed, 411 insertions(+), 458 deletions(-)
> 
> --- a/Documentation/isdn/INTERFACE.CAPI
> +++ b/Documentation/isdn/INTERFACE.CAPI
> @@ -149,10 +149,11 @@ 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
> -	system entry, /proc/capi/controllers/<n>; will be called with a
> -	pointer to the device's capi_ctr structure as the last (data) argument
> +const struct file_operations *proc_fops
> +	pointers to callback functions for the device's proc file
> +	system entry, /proc/capi/controllers/<n>; pointer to the device's
> +	capi_ctr structure is available from struct proc_dir_entry::data
> +	which is available from struct inode.
>  
>  Note: Callback functions except send_message() are never called in interrupt
>  context.
[...]
> --- a/drivers/isdn/gigaset/capi.c
> +++ b/drivers/isdn/gigaset/capi.c
> @@ -13,6 +13,8 @@
>  
>  #include "gigaset.h"
>  #include <linux/ctype.h>
> +#include <linux/proc_fs.h>
> +#include <linux/seq_file.h>
>  #include <linux/isdn/capilli.h>
>  #include <linux/isdn/capicmd.h>
>  #include <linux/isdn/capiutil.h>
> @@ -2106,35 +2108,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 +2141,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 +2165,21 @@ 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",
> -			cs->running ? "yes" : "no");
> -	len += sprintf(page+len, "%-16s %s\n", "connected",
> -			cs->connected ? "yes" : "no");
> -	len += sprintf(page+len, "%-16s %s\n", "isdn_up",
> -			cs->isdn_up ? "yes" : "no");
> -	len += sprintf(page+len, "%-16s %s\n", "cidmode",
> -			cs->cidmode ? "yes" : "no");
> +	seq_printf(m, "%-16s %s\n", "running", cs->running ? "yes" : "no");
> +	seq_printf(m, "%-16s %s\n", "connected", cs->connected ? "yes" : "no");
> +	seq_printf(m, "%-16s %s\n", "isdn_up", cs->isdn_up ? "yes" : "no");
> +	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 +2194,23 @@ 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 +2253,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);

-- 
Tilman Schmidt                    E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

  reply	other threads:[~2010-01-10 18:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-22  0:25 [patch 1/2] proc_fops: convert drivers/isdn/ to seq_file akpm
2009-12-23 12:30 ` Tilman Schmidt
2010-01-05 21:19   ` Alexey Dobriyan
2010-01-10 18:42     ` Tilman Schmidt [this message]
2010-01-10 21:29       ` David Miller
2010-01-10 23:33         ` Karsten Keil
2010-01-14  1:37         ` [ISDN] " Karsten Keil
2010-01-14  1:53           ` David Miller
2010-01-14  2:39             ` Karsten Keil
2010-01-14  2:43               ` David Miller
2010-01-14  4:29           ` David Miller
2010-01-14 11:01             ` David Miller
2010-01-04  5:26 ` [patch 1/2] " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B4A1FA9.7030505@imap.cc \
    --to=tilman@imap.cc \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=isdn@linux-pingi.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).