* [PATCH 19/26] sh: Don't use create_proc_read_entry() [RFC]
[not found] <20130411132739.32763.82609.stgit@warthog.procyon.org.uk>
@ 2013-04-11 13:30 ` David Howells
2013-04-16 6:11 ` Simon Horman
0 siblings, 1 reply; 5+ messages in thread
From: David Howells @ 2013-04-11 13:30 UTC (permalink / raw)
To: linux-kernel; +Cc: Paul Mundt, viro, linux-sh
Don't use create_proc_read_entry() as that is deprecated, but rather use
proc_create_data() and seq_file instead.
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(®istered_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);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 19/26] sh: Don't use create_proc_read_entry() [RFC]
2013-04-11 13:30 ` [PATCH 19/26] sh: Don't use create_proc_read_entry() [RFC] David Howells
@ 2013-04-16 6:11 ` Simon Horman
2013-04-16 6:28 ` Al Viro
0 siblings, 1 reply; 5+ messages in thread
From: Simon Horman @ 2013-04-16 6:11 UTC (permalink / raw)
To: David Howells; +Cc: linux-kernel, Paul Mundt, viro, linux-sh
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(®istered_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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 19/26] sh: Don't use create_proc_read_entry() [RFC]
2013-04-16 6:11 ` Simon Horman
@ 2013-04-16 6:28 ` Al Viro
2013-04-16 18:42 ` Paul Mundt
0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2013-04-16 6:28 UTC (permalink / raw)
To: Simon Horman; +Cc: David Howells, linux-kernel, Paul Mundt, linux-sh
On Tue, Apr 16, 2013 at 03:11:13PM +0900, Simon Horman wrote:
> 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?
FWIW, I can pick that stuff via vfs.git - not a problem and I've already got
shitloads of procfs-related patches in that queue...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 19/26] sh: Don't use create_proc_read_entry() [RFC]
2013-04-16 6:28 ` Al Viro
@ 2013-04-16 18:42 ` Paul Mundt
2013-04-17 0:41 ` Simon Horman
0 siblings, 1 reply; 5+ messages in thread
From: Paul Mundt @ 2013-04-16 18:42 UTC (permalink / raw)
To: Al Viro; +Cc: Simon Horman, David Howells, linux-kernel, linux-sh
On Tue, Apr 16, 2013 at 07:28:42AM +0100, Al Viro wrote:
> On Tue, Apr 16, 2013 at 03:11:13PM +0900, Simon Horman wrote:
> > 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?
>
> FWIW, I can pick that stuff via vfs.git - not a problem and I've already got
> shitloads of procfs-related patches in that queue...
That works for me.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 19/26] sh: Don't use create_proc_read_entry() [RFC]
2013-04-16 18:42 ` Paul Mundt
@ 2013-04-17 0:41 ` Simon Horman
0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2013-04-17 0:41 UTC (permalink / raw)
To: Paul Mundt; +Cc: Al Viro, David Howells, linux-kernel, linux-sh
On Wed, Apr 17, 2013 at 03:42:03AM +0900, Paul Mundt wrote:
> On Tue, Apr 16, 2013 at 07:28:42AM +0100, Al Viro wrote:
> > On Tue, Apr 16, 2013 at 03:11:13PM +0900, Simon Horman wrote:
> > > 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?
> >
> > FWIW, I can pick that stuff via vfs.git - not a problem and I've already got
> > shitloads of procfs-related patches in that queue...
>
> That works for me.
Great.
Acked-by: Simon Horman <horms+renesas@verge.net.au>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-17 0:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20130411132739.32763.82609.stgit@warthog.procyon.org.uk>
2013-04-11 13:30 ` [PATCH 19/26] sh: Don't use create_proc_read_entry() [RFC] David Howells
2013-04-16 6:11 ` Simon Horman
2013-04-16 6:28 ` Al Viro
2013-04-16 18:42 ` Paul Mundt
2013-04-17 0:41 ` Simon Horman
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).