All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	viro@zeniv.linux.org.uk
Subject: Re: [PATCH 23/28] ppc: Clean up scanlog [RFC]
Date: Thu, 25 Apr 2013 20:31:23 +0530	[thread overview]
Message-ID: <51794543.8060005@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130416182722.27773.32105.stgit@warthog.procyon.org.uk>

On 04/16/2013 11:57 PM, David Howells wrote:
> Clean up the pseries scanlog driver's use of procfs:
>
>   (1) Don't need to save the proc_dir_entry pointer as we have the filename to
>       remove with.
>
>   (2) Save the scan log buffer pointer in a static variable (there is only one
>       of it) and don't save it in the PDE (which doesn't have a destructor).

Changes looks good.

-Vasant

>
> Signed-off-by: David Howells<dhowells@redhat.com>
> cc: Benjamin Herrenschmidt<benh@kernel.crashing.org>
> cc: Paul Mackerras<paulus@samba.org>
> cc: linuxppc-dev@lists.ozlabs.org
> ---
>
>   arch/powerpc/platforms/pseries/scanlog.c |   29 +++++++++++------------------
>   1 file changed, 11 insertions(+), 18 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
> index cc220d2..b502ab6 100644
> --- a/arch/powerpc/platforms/pseries/scanlog.c
> +++ b/arch/powerpc/platforms/pseries/scanlog.c
> @@ -41,12 +41,12 @@
>
>
>   static unsigned int ibm_scan_log_dump;			/* RTAS token */
> -static struct proc_dir_entry *proc_ppc64_scan_log_dump;	/* The proc file */
> +static unsigned int *scanlog_buffer;			/* The data buffer */
>
>   static ssize_t scanlog_read(struct file *file, char __user *buf,
>   			    size_t count, loff_t *ppos)
>   {
> -	unsigned int *data = PDE_DATA(file_inode(file));
> +	unsigned int *data = scanlog_buffer;
>   	int status;
>   	unsigned long len, off;
>   	unsigned int wait_time;
> @@ -134,7 +134,7 @@ static ssize_t scanlog_write(struct file * file, const char __user * buf,
>
>   static int scanlog_open(struct inode * inode, struct file * file)
>   {
> -	unsigned int *data = PDE_DATA(file_inode(file));
> +	unsigned int *data = scanlog_buffer;
>
>   	if (data[0] != 0) {
>   		/* This imperfect test stops a second copy of the
> @@ -150,10 +150,9 @@ static int scanlog_open(struct inode * inode, struct file * file)
>
>   static int scanlog_release(struct inode * inode, struct file * file)
>   {
> -	unsigned int *data = PDE_DATA(file_inode(file));
> +	unsigned int *data = scanlog_buffer;
>
>   	data[0] = 0;
> -
>   	return 0;
>   }
>
> @@ -169,7 +168,6 @@ const struct file_operations scanlog_fops = {
>   static int __init scanlog_init(void)
>   {
>   	struct proc_dir_entry *ent;
> -	void *data;
>   	int err = -ENOMEM;
>
>   	ibm_scan_log_dump = rtas_token("ibm,scan-log-dump");
> @@ -177,29 +175,24 @@ static int __init scanlog_init(void)
>   		return -ENODEV;
>
>   	/* Ideally we could allocate a buffer<  4G */
> -	data = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
> -	if (!data)
> +	scanlog_buffer = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
> +	if (!scanlog_buffer)
>   		goto err;
>
> -	ent = proc_create_data("powerpc/rtas/scan-log-dump", S_IRUSR, NULL,
> -			&scanlog_fops, data);
> +	ent = proc_create("powerpc/rtas/scan-log-dump", S_IRUSR, NULL,
> +			&scanlog_fops);
>   	if (!ent)
>   		goto err;
> -
> -	proc_ppc64_scan_log_dump = ent;
> -
>   	return 0;
>   err:
> -	kfree(data);
> +	kfree(scanlog_buffer);
>   	return err;
>   }
>
>   static void __exit scanlog_cleanup(void)
>   {
> -	if (proc_ppc64_scan_log_dump) {
> -		kfree(proc_ppc64_scan_log_dump->data);
> -		remove_proc_entry("scan-log-dump", proc_ppc64_scan_log_dump->parent);
> -	}
> +	remove_proc_entry("powerpc/rtas/scan-log-dump", NULL);
> +	kfree(scanlog_buffer);
>   }
>
>   module_init(scanlog_init);
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>

WARNING: multiple messages have this Message-ID (diff)
From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, viro@zeniv.linux.org.uk,
	Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH 23/28] ppc: Clean up scanlog [RFC]
Date: Thu, 25 Apr 2013 20:31:23 +0530	[thread overview]
Message-ID: <51794543.8060005@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130416182722.27773.32105.stgit@warthog.procyon.org.uk>

On 04/16/2013 11:57 PM, David Howells wrote:
> Clean up the pseries scanlog driver's use of procfs:
>
>   (1) Don't need to save the proc_dir_entry pointer as we have the filename to
>       remove with.
>
>   (2) Save the scan log buffer pointer in a static variable (there is only one
>       of it) and don't save it in the PDE (which doesn't have a destructor).

Changes looks good.

-Vasant

>
> Signed-off-by: David Howells<dhowells@redhat.com>
> cc: Benjamin Herrenschmidt<benh@kernel.crashing.org>
> cc: Paul Mackerras<paulus@samba.org>
> cc: linuxppc-dev@lists.ozlabs.org
> ---
>
>   arch/powerpc/platforms/pseries/scanlog.c |   29 +++++++++++------------------
>   1 file changed, 11 insertions(+), 18 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
> index cc220d2..b502ab6 100644
> --- a/arch/powerpc/platforms/pseries/scanlog.c
> +++ b/arch/powerpc/platforms/pseries/scanlog.c
> @@ -41,12 +41,12 @@
>
>
>   static unsigned int ibm_scan_log_dump;			/* RTAS token */
> -static struct proc_dir_entry *proc_ppc64_scan_log_dump;	/* The proc file */
> +static unsigned int *scanlog_buffer;			/* The data buffer */
>
>   static ssize_t scanlog_read(struct file *file, char __user *buf,
>   			    size_t count, loff_t *ppos)
>   {
> -	unsigned int *data = PDE_DATA(file_inode(file));
> +	unsigned int *data = scanlog_buffer;
>   	int status;
>   	unsigned long len, off;
>   	unsigned int wait_time;
> @@ -134,7 +134,7 @@ static ssize_t scanlog_write(struct file * file, const char __user * buf,
>
>   static int scanlog_open(struct inode * inode, struct file * file)
>   {
> -	unsigned int *data = PDE_DATA(file_inode(file));
> +	unsigned int *data = scanlog_buffer;
>
>   	if (data[0] != 0) {
>   		/* This imperfect test stops a second copy of the
> @@ -150,10 +150,9 @@ static int scanlog_open(struct inode * inode, struct file * file)
>
>   static int scanlog_release(struct inode * inode, struct file * file)
>   {
> -	unsigned int *data = PDE_DATA(file_inode(file));
> +	unsigned int *data = scanlog_buffer;
>
>   	data[0] = 0;
> -
>   	return 0;
>   }
>
> @@ -169,7 +168,6 @@ const struct file_operations scanlog_fops = {
>   static int __init scanlog_init(void)
>   {
>   	struct proc_dir_entry *ent;
> -	void *data;
>   	int err = -ENOMEM;
>
>   	ibm_scan_log_dump = rtas_token("ibm,scan-log-dump");
> @@ -177,29 +175,24 @@ static int __init scanlog_init(void)
>   		return -ENODEV;
>
>   	/* Ideally we could allocate a buffer<  4G */
> -	data = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
> -	if (!data)
> +	scanlog_buffer = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
> +	if (!scanlog_buffer)
>   		goto err;
>
> -	ent = proc_create_data("powerpc/rtas/scan-log-dump", S_IRUSR, NULL,
> -			&scanlog_fops, data);
> +	ent = proc_create("powerpc/rtas/scan-log-dump", S_IRUSR, NULL,
> +			&scanlog_fops);
>   	if (!ent)
>   		goto err;
> -
> -	proc_ppc64_scan_log_dump = ent;
> -
>   	return 0;
>   err:
> -	kfree(data);
> +	kfree(scanlog_buffer);
>   	return err;
>   }
>
>   static void __exit scanlog_cleanup(void)
>   {
> -	if (proc_ppc64_scan_log_dump) {
> -		kfree(proc_ppc64_scan_log_dump->data);
> -		remove_proc_entry("scan-log-dump", proc_ppc64_scan_log_dump->parent);
> -	}
> +	remove_proc_entry("powerpc/rtas/scan-log-dump", NULL);
> +	kfree(scanlog_buffer);
>   }
>
>   module_init(scanlog_init);
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>

  reply	other threads:[~2013-04-25 15:01 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-16 18:25 [PATCH 00/28] Privatise procfs internals [RFC] David Howells
2013-04-16 18:25 ` [PATCH 01/28] Include missing linux/slab.h inclusions [RFC] David Howells
2013-04-16 18:25   ` David Howells
2013-04-16 18:25   ` David Howells
     [not found]   ` <20130416182554.27773.86004.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2013-04-17  0:56     ` Greg KH
2013-04-17  0:56       ` Greg KH
2013-04-17  0:56       ` Greg KH
2013-04-17  0:56       ` Greg KH
2013-04-16 18:25 ` [PATCH 02/28] Include missing linux/magic.h " David Howells
2013-04-16 18:26 ` [PATCH 03/28] proc: Split kcore bits from linux/procfs.h into linux/kcore.h [RFC] David Howells
2013-04-16 18:26   ` David Howells
2013-04-16 18:26   ` David Howells
2013-04-16 21:37   ` KOSAKI Motohiro
2013-04-16 21:37     ` KOSAKI Motohiro
2013-04-16 21:37     ` KOSAKI Motohiro
2013-04-16 22:07     ` David Howells
2013-04-16 22:07       ` David Howells
2013-04-16 22:07       ` David Howells
2013-04-16 22:13       ` KOSAKI Motohiro
2013-04-16 22:13         ` KOSAKI Motohiro
2013-04-16 22:13         ` KOSAKI Motohiro
2013-04-17  9:13   ` Ralf Baechle
2013-04-17  9:13     ` Ralf Baechle
2013-04-17  9:13     ` Ralf Baechle
2013-04-16 18:26 ` [PATCH 04/28] proc: Supply PDE attribute setting accessor functions [RFC] David Howells
2013-04-16 18:26   ` David Howells
2013-04-16 21:37   ` Mauro Carvalho Chehab
2013-04-16 21:37     ` Mauro Carvalho Chehab
2013-04-18 16:42   ` Bjorn Helgaas
2013-04-18 16:42     ` Bjorn Helgaas
     [not found]   ` <20130416182606.27773.55054.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2013-04-25 15:22     ` Vasant Hegde
2013-04-25 15:22       ` Vasant Hegde
2013-04-25 15:22       ` Vasant Hegde
2013-04-16 18:26 ` [PATCH 05/28] proc: Uninline pid_delete_dentry() [RFC] David Howells
2013-04-16 18:26 ` [PATCH 06/28] proc: Move proc_fd() to fs/proc/fd.h [RFC] David Howells
2013-04-16 18:26 ` [PATCH 07/28] proc: Split the namespace stuff out into linux/proc_ns.h [RFC] David Howells
2013-04-16 18:26 ` [PATCH 08/28] proc: Move PDE_NET() to fs/proc/proc_net.c [RFC] David Howells
2013-04-16 18:26 ` [PATCH 09/28] proc: Move some bits from linux/proc_fs.h to linux/{of.h, signal.h, tty.h} [RFC] David Howells
2013-04-17  0:57   ` Greg Kroah-Hartman
2013-04-17 14:59   ` Grant Likely
2013-04-16 18:26 ` [PATCH 10/28] proc: Add proc_mkdir_data() [RFC] David Howells
2013-04-16 21:39   ` Mauro Carvalho Chehab
2013-04-17  0:58   ` Greg KH
2013-04-17  0:58     ` Greg KH
2013-04-16 18:26 ` [PATCH 11/28] rtl8187se: Use a dir under /proc/net/r8180/ [RFC] David Howells
2013-04-17  0:59   ` Greg KH
2013-04-17  0:59     ` Greg KH
2013-04-16 18:26 ` [PATCH 12/28] rtl8192u: Don't need to save device proc dir PDE [RFC] David Howells
2013-04-17  1:00   ` Greg KH
2013-04-17  1:00     ` Greg KH
2013-04-16 18:26 ` [PATCH 13/28] airo: Use remove_proc_subtree() [RFC] David Howells
2013-04-16 18:26 ` [PATCH 14/28] proc: Supply an accessor for getting the data from a PDE's parent [RFC] David Howells
2013-04-17  1:01   ` Greg KH
2013-04-16 18:26 ` [PATCH 15/28] reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show() [RFC] David Howells
2013-04-16 18:26 ` [PATCH 16/28] zoran: Don't print proc_dir_entry data in debug [RFC] David Howells
2013-04-16 21:32   ` Mauro Carvalho Chehab
2013-04-16 18:26 ` [PATCH 17/28] drm: Constify drm_proc_list[] [RFC] David Howells
2013-04-16 18:27 ` [PATCH 18/28] drm: proc: Use minor->index to label things, not PDE->name [RFC] David Howells
2013-04-16 18:27 ` [PATCH 19/28] drm: proc: Use remove_proc_subtree() [RFC] David Howells
2013-04-16 18:27 ` [PATCH 20/28] hostap: " David Howells
2013-04-16 18:27   ` David Howells
2013-04-16 18:27 ` [PATCH 21/28] dgrp: Clean up the use of procfs [RFC] David Howells
2013-04-16 18:27   ` David Howells
2013-04-17  1:02   ` Greg KH
2013-04-16 18:27 ` [PATCH 22/28] ppc: Clean up rtas_flash driver somewhat [RFC] David Howells
2013-04-16 18:27   ` David Howells
2013-04-25 14:33   ` Vasant Hegde
2013-04-25 14:33     ` Vasant Hegde
2013-04-16 18:27 ` [PATCH 23/28] ppc: Clean up scanlog [RFC] David Howells
2013-04-16 18:27   ` David Howells
2013-04-25 15:01   ` Vasant Hegde [this message]
2013-04-25 15:01     ` Vasant Hegde
2013-04-16 18:27 ` [PATCH 24/28] proc: Supply an accessor to get the name in a proc_dir_entry struct [RFC] David Howells
2013-04-16 22:20   ` Harald Welte
     [not found] ` <20130416182550.27773.89310.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2013-04-16 18:27   ` [PATCH 25/28] proc: Supply an accessor to get the process ID associated with some proc files [RFC] David Howells
2013-04-16 18:27     ` David Howells
     [not found]     ` <20130416182730.27773.88726.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2013-04-17  1:53       ` Li Zefan
2013-04-17  1:53         ` Li Zefan
2013-04-18 18:39       ` Tejun Heo
2013-04-18 18:39         ` Tejun Heo
2013-04-16 18:27 ` [PATCH 26/28] proc: Supply a function to remove a proc entry by PDE [RFC] David Howells
2013-04-17 15:03   ` Grant Likely
2013-04-18 16:41   ` Bjorn Helgaas
2013-04-18 20:34     ` David Howells
2013-04-21 22:01   ` Rafael J. Wysocki
2013-04-16 18:27 ` [PATCH 27/28] proc: Make the PROC_I() and PDE() macros internal to procfs [RFC] David Howells
2013-04-16 18:27 ` [PATCH 28/28] proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h [RFC] David Howells
2013-05-01 20:51 ` [PATCH 00/28] Privatise procfs internals [RFC] Geert Uytterhoeven
2013-05-03 20:27   ` Geert Uytterhoeven

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=51794543.8060005@linux.vnet.ibm.com \
    --to=hegdevasant@linux.vnet.ibm.com \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.