From: Josh Boyer <jdub@us.ibm.com>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org, linux-usb-devel@lists.sourceforge.net
Subject: Re: [RFC PATCH] convert uhci-hcd to use debugfs
Date: Fri, 10 Dec 2004 08:15:18 -0600 [thread overview]
Message-ID: <1102688117.26320.7.camel@weaponx.rchland.ibm.com> (raw)
In-Reply-To: <20041210005514.GB17822@kroah.com>
On Thu, 2004-12-09 at 18:55, Greg KH wrote:
> diff -Nru a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
> --- a/drivers/usb/host/uhci-debug.c 2004-12-09 16:32:17 -08:00
> +++ b/drivers/usb/host/uhci-debug.c 2004-12-09 16:32:17 -08:00
> @@ -11,7 +11,7 @@
>
> #include <linux/config.h>
> #include <linux/kernel.h>
> -#include <linux/proc_fs.h>
> +#include <linux/debugfs.h>
> #include <linux/smp_lock.h>
> #include <asm/io.h>
>
> @@ -507,7 +496,7 @@
>
> #define MAX_OUTPUT (64 * 1024)
>
> -static struct proc_dir_entry *uhci_proc_root = NULL;
> +static struct dentry *uhci_debugfs_root = NULL;
>
> struct uhci_proc {
> int size;
> @@ -517,8 +506,7 @@
>
> static int uhci_proc_open(struct inode *inode, struct file *file)
> {
Didn't want to rename this uhci_debug_open?
> - const struct proc_dir_entry *dp = PDE(inode);
> - struct uhci_hcd *uhci = dp->data;
> + struct uhci_hcd *uhci = inode->u.generic_ip;
> struct uhci_proc *up;
> int ret = -ENOMEM;
>
> diff -Nru a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
> --- a/drivers/usb/host/uhci-hcd.c 2004-12-09 16:32:31 -08:00
> +++ b/drivers/usb/host/uhci-hcd.c 2004-12-09 16:32:31 -08:00
> @@ -46,7 +46,7 @@
> #include <linux/unistd.h>
> #include <linux/interrupt.h>
> #include <linux/spinlock.h>
> -#include <linux/proc_fs.h>
> +#include <linux/debugfs.h>
> #include <linux/pm.h>
> #include <linux/dmapool.h>
> #include <linux/dma-mapping.h>
> @@ -1927,12 +1927,10 @@
> uhci->fl = NULL;
> }
>
> -#ifdef CONFIG_PROC_FS
> - if (uhci->proc_entry) {
> - remove_proc_entry(uhci->hcd.self.bus_name, uhci_proc_root);
> - uhci->proc_entry = NULL;
> + if (uhci->dentry) {
> + debugfs_remove(uhci->dentry);
> + uhci->dentry = NULL;
> }
> -#endif
> }
>
> static int uhci_reset(struct usb_hcd *hcd)
> @@ -1972,25 +1970,17 @@
> unsigned io_size;
> dma_addr_t dma_handle;
> struct usb_device *udev;
> -#ifdef CONFIG_PROC_FS
> - struct proc_dir_entry *ent;
> -#endif
> + struct dentry *dentry;
>
> io_size = pci_resource_len(to_pci_dev(uhci_dev(uhci)), hcd->region);
>
> -#ifdef CONFIG_PROC_FS
> - ent = create_proc_entry(hcd->self.bus_name, S_IFREG|S_IRUGO|S_IWUSR, uhci_proc_root);
> - if (!ent) {
> - dev_err(uhci_dev(uhci), "couldn't create uhci proc entry\n");
> + dentry = debugfs_create_file(hcd->self.bus_name, S_IFREG|S_IRUGO|S_IWUSR, uhci_debugfs_root, uhci, &uhci_proc_operations);
> + if (!dentry) {
That won't work if debugfs is not configured. You'll get back (void *)
-ENODEV, which is not NULL.
> + dev_err(uhci_dev(uhci), "couldn't create uhci debugfs entry\n");
> retval = -ENOMEM;
> goto err_create_proc_entry;
> }
> -
> - ent->data = uhci;
> - ent->proc_fops = &uhci_proc_operations;
> - ent->size = 0;
> - uhci->proc_entry = ent;
> -#endif
> + uhci->dentry = dentry;
>
> uhci->fsbr = 0;
> uhci->fsbrtimeout = 0;
> @@ -2192,13 +2182,10 @@
> uhci->fl = NULL;
>
> err_alloc_fl:
> -#ifdef CONFIG_PROC_FS
> - remove_proc_entry(hcd->self.bus_name, uhci_proc_root);
> - uhci->proc_entry = NULL;
> + debugfs_remove(uhci->dentry);
> + uhci->dentry = NULL;
>
> err_create_proc_entry:
> -#endif
> -
> return retval;
> }
>
> @@ -2405,11 +2392,9 @@
> goto errbuf_failed;
> }
>
> -#ifdef CONFIG_PROC_FS
> - uhci_proc_root = create_proc_entry("driver/uhci", S_IFDIR, NULL);
> - if (!uhci_proc_root)
> + uhci_debugfs_root = debugfs_create_dir("uhci", NULL);
> + if (!uhci_debugfs_root)
Same thing here.
> goto proc_failed;
> -#endif
>
> uhci_up_cachep = kmem_cache_create("uhci_urb_priv",
> sizeof(struct urb_priv), 0, 0, NULL, NULL);
josh
next prev parent reply other threads:[~2004-12-10 14:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-10 0:50 [RFC PATCH] debugfs - yet another in-kernel file system Greg KH
2004-12-10 0:55 ` [RFC PATCH] convert uhci-hcd to use debugfs Greg KH
2004-12-10 14:15 ` Josh Boyer [this message]
2004-12-10 15:27 ` Greg KH
2004-12-10 16:21 ` Josh Boyer
2004-12-10 17:17 ` Comments on new kernel dev. model Peter Karlsson
2004-12-10 23:44 ` Greg KH
2004-12-10 7:07 ` [RFC PATCH] debugfs - yet another in-kernel file system Jan Engelhardt
2004-12-10 7:54 ` Greg KH
2004-12-10 8:00 ` Jan Engelhardt
2004-12-10 16:02 ` Greg KH
2004-12-10 14:46 ` Josh Boyer
2004-12-10 15:30 ` Greg KH
2004-12-10 16:26 ` Josh Boyer
2004-12-10 17:21 ` Jörn Engel
2004-12-10 17:35 ` Greg KH
2004-12-10 18:29 ` Jörn Engel
2004-12-10 19:38 ` Roland Dreier
2004-12-11 1:29 ` [linux-usb-devel] " David Brownell
2004-12-11 1:39 ` Greg KH
2004-12-11 2:02 ` David Brownell
2004-12-11 2:05 ` Greg KH
2004-12-11 2:26 ` Roland Dreier
2004-12-11 2:32 ` Greg KH
2004-12-11 13:23 ` Roland Dreier
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=1102688117.26320.7.camel@weaponx.rchland.ibm.com \
--to=jdub@us.ibm.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
/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®