mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: David Howells <dhowells@redhat.com>
Cc: linux-kernel@vger.kernel.org, Paul Mundt <lethal@linux-sh.org>,
	viro@ZenIV.linux.org.uk, linux-sh@vger.kernel.org
Subject: Re: [PATCH 19/26] sh: Don't use create_proc_read_entry() [RFC]
Date: Tue, 16 Apr 2013 15:11:13 +0900	[thread overview]
Message-ID: <20130416061113.GA27462@verge.net.au> (raw)
In-Reply-To: <20130411133009.32763.71122.stgit@warthog.procyon.org.uk>

On Thu, Apr 11, 2013 at 02:30:09PM +0100, David Howells wrote:
> Don't use create_proc_read_entry() as that is deprecated, but rather use
> proc_create_data() and seq_file instead.

Paul, do you want me to handle this?

> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Paul Mundt <lethal@linux-sh.org>
> cc: linux-sh@vger.kernel.org
> ---
> 
>  arch/sh/drivers/dma/dma-api.c |   28 +++++++++++++++++++---------
>  1 file changed, 19 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
> index f46848f..851e510 100644
> --- a/arch/sh/drivers/dma/dma-api.c
> +++ b/arch/sh/drivers/dma/dma-api.c
> @@ -13,6 +13,7 @@
>  #include <linux/module.h>
>  #include <linux/spinlock.h>
>  #include <linux/proc_fs.h>
> +#include <linux/seq_file.h>
>  #include <linux/list.h>
>  #include <linux/platform_device.h>
>  #include <linux/mm.h>
> @@ -308,11 +309,9 @@ int dma_extend(unsigned int chan, unsigned long op, void *param)
>  }
>  EXPORT_SYMBOL(dma_extend);
>  
> -static int dma_read_proc(char *buf, char **start, off_t off,
> -			 int len, int *eof, void *data)
> +static int dma_proc_show(struct seq_file *m, void *v)
>  {
> -	struct dma_info *info;
> -	char *p = buf;
> +	struct dma_info *info = v;
>  
>  	if (list_empty(&registered_dmac_list))
>  		return 0;
> @@ -332,14 +331,26 @@ static int dma_read_proc(char *buf, char **start, off_t off,
>  			if (!(channel->flags & DMA_CONFIGURED))
>  				continue;
>  
> -			p += sprintf(p, "%2d: %14s    %s\n", i,
> -				     info->name, channel->dev_id);
> +			seq_printf(m, "%2d: %14s    %s\n", i,
> +				   info->name, channel->dev_id);
>  		}
>  	}
>  
> -	return p - buf;
> +	return 0;
> +}
> +
> +static int dma_proc_open(struct inode *inode, struct file *file)
> +{
> +	return single_open(file, dma_proc_show, NULL);
>  }
>  
> +static const struct file_operations dma_proc_fops = {
> +	.open		= dma_proc_open,
> +	.read		= seq_read,
> +	.llseek		= seq_lseek,
> +	.release	= seq_release,
> +};
> +
>  int register_dmac(struct dma_info *info)
>  {
>  	unsigned int total_channels, i;
> @@ -412,8 +423,7 @@ EXPORT_SYMBOL(unregister_dmac);
>  static int __init dma_api_init(void)
>  {
>  	printk(KERN_NOTICE "DMA: Registering DMA API.\n");
> -	return create_proc_read_entry("dma", 0, 0, dma_read_proc, 0)
> -		    ? 0 : -ENOMEM;
> +	return proc_create("dma", 0, NULL, &dma_proc_fops) ? 0 : -ENOMEM;
>  }
>  subsys_initcall(dma_api_init);
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2013-04-16  6:11 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-11 13:27 [PATCH 00/26] Eliminate " David Howells
2013-04-11 13:27 ` [PATCH 01/26] procfs: Mark create_proc_read_entry deprecated [RFC] David Howells
2013-04-11 13:27 ` [PATCH 02/26] rtl8192u: Don't use create_proc_read_entry() [RFC] David Howells
2013-04-11 13:28 ` [PATCH 03/26] rtl8187se: " David Howells
2013-04-11 13:28 ` [PATCH 04/26] ft1000: " David Howells
2013-04-11 13:28 ` [PATCH 05/26] comedi: " David Howells
2013-04-11 15:07   ` Ian Abbott
2013-04-11 15:15   ` David Howells
2013-04-11 19:05     ` Greg Kroah-Hartman
2013-04-12 10:56       ` Ian Abbott
2013-04-11 13:28 ` [PATCH 06/26] csr: " David Howells
2013-04-11 13:28 ` [PATCH 07/26] cxt1e1: " David Howells
2013-04-11 13:28 ` [PATCH 08/26] wlags49_h2: " David Howells
2013-04-11 13:28 ` [PATCH 09/26] goku_udc: " David Howells
2013-04-11 13:29 ` [PATCH 10/26] fsl_udc: " David Howells
2013-04-11 13:29 ` [PATCH 11/26] nubus: " David Howells
2013-04-11 13:29 ` [PATCH 12/26] hp_sdc_rtc: " David Howells
2013-04-11 13:29 ` [PATCH 13/26] genrtc: " David Howells
2013-04-11 13:29 ` [PATCH 14/26] efirtc: " David Howells
2013-04-11 13:29 ` [PATCH 15/26] ds1620: " David Howells
2013-04-11 13:29 ` [PATCH 16/26] atmel: " David Howells
2013-04-11 13:30 ` [PATCH 18/26] megaraid: " David Howells
2013-04-12  8:56   ` Hannes Reinecke
2013-04-11 13:30 ` [PATCH 19/26] sh: " David Howells
2013-04-16  6:11   ` Simon Horman [this message]
2013-04-16  6:28     ` Al Viro
2013-04-16 18:42       ` Paul Mundt
2013-04-17  0:41         ` Simon Horman
2013-04-11 13:30 ` [PATCH 20/26] parisc: " David Howells
2013-04-11 13:30 ` [PATCH 21/26] mips: " David Howells
2013-04-11 13:30 ` [PATCH 22/26] ia64: " David Howells
2013-04-11 13:30 ` [PATCH 23/26] h8300: " David Howells
2013-04-11 13:30 ` [PATCH 24/26] cris: " David Howells
2013-04-12 10:58   ` Jesper Nilsson
2013-04-11 13:30 ` [PATCH 25/26] arm: " David Howells
2013-04-11 15:48   ` Tony Lindgren
2013-04-11 16:45   ` David Howells
2013-04-11 16:57     ` Tony Lindgren
2013-04-11 18:03       ` Tony Lindgren
2013-04-11 13:31 ` [PATCH 26/26] proc: Delete " David Howells
2013-04-11 14:11 ` [PATCH 00/26] Eliminate " Arnd Bergmann
     [not found] ` <20130411132952.32763.3184.stgit@warthog.procyon.org.uk>
2013-04-11 19:06   ` [PATCH 17/26] hostap: Don't use " Greg Kroah-Hartman
2013-04-11 19:07 ` [PATCH 00/26] Eliminate " Greg KH
2013-04-11 22:34 ` David Howells
2013-04-12 20:12   ` Greg KH

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=20130416061113.GA27462@verge.net.au \
    --to=horms@verge.net.au \
    --cc=dhowells@redhat.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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

all inboxes | Powered by JetHome®