USB: gr_udc: remove dentry storage for debugfs file
There is no need to store the dentry pointer for a debugfs file that we only use to remove it when the device goes away. debugfs can do the lookup for us instead, saving us some trouble, and making things smaller overall. Cc: Felipe Balbi <balbi@kernel.org> Link: https://lore.kernel.org/r/20210527101426.3283214-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7f7d0afe1d
commit
425de3182c
|
@ -207,14 +207,15 @@ DEFINE_SHOW_ATTRIBUTE(gr_dfs);
|
||||||
static void gr_dfs_create(struct gr_udc *dev)
|
static void gr_dfs_create(struct gr_udc *dev)
|
||||||
{
|
{
|
||||||
const char *name = "gr_udc_state";
|
const char *name = "gr_udc_state";
|
||||||
|
struct dentry *root;
|
||||||
|
|
||||||
dev->dfs_root = debugfs_create_dir(dev_name(dev->dev), usb_debug_root);
|
root = debugfs_create_dir(dev_name(dev->dev), usb_debug_root);
|
||||||
debugfs_create_file(name, 0444, dev->dfs_root, dev, &gr_dfs_fops);
|
debugfs_create_file(name, 0444, root, dev, &gr_dfs_fops);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gr_dfs_delete(struct gr_udc *dev)
|
static void gr_dfs_delete(struct gr_udc *dev)
|
||||||
{
|
{
|
||||||
debugfs_remove_recursive(dev->dfs_root);
|
debugfs_remove(debugfs_lookup(dev_name(dev->dev), usb_debug_root));
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !CONFIG_USB_GADGET_DEBUG_FS */
|
#else /* !CONFIG_USB_GADGET_DEBUG_FS */
|
||||||
|
|
|
@ -215,8 +215,6 @@ struct gr_udc {
|
||||||
struct list_head ep_list;
|
struct list_head ep_list;
|
||||||
|
|
||||||
spinlock_t lock; /* General lock, a.k.a. "dev->lock" in comments */
|
spinlock_t lock; /* General lock, a.k.a. "dev->lock" in comments */
|
||||||
|
|
||||||
struct dentry *dfs_root;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define to_gr_udc(gadget) (container_of((gadget), struct gr_udc, gadget))
|
#define to_gr_udc(gadget) (container_of((gadget), struct gr_udc, gadget))
|
||||||
|
|
Loading…
Reference in New Issue