| From 7b3bcbfe0aeedeec64c83cf9655273e8f42f1c54 Mon Sep 17 00:00:00 2001 |
| From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| Date: Tue, 29 May 2018 10:36:11 +0200 |
| Subject: [PATCH] usb: debugfs cleanup |
| |
| Fix up all of the debugfs calls, no need to check the return values at |
| all. This cleans up lots of unneeded code. |
| |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| --- |
| drivers/usb/chipidea/ci.h | 2 +- |
| drivers/usb/chipidea/core.c | 4 +- |
| drivers/usb/chipidea/debug.c | 56 +++++------------- |
| drivers/usb/core/usb.c | 26 ++------- |
| drivers/usb/dwc2/debugfs.c | 78 +++++-------------------- |
| drivers/usb/dwc3/debugfs.c | 43 ++++---------- |
| drivers/usb/gadget/udc/atmel_usba_udc.c | 71 ++++------------------ |
| drivers/usb/gadget/udc/atmel_usba_udc.h | 4 -- |
| drivers/usb/gadget/udc/bcm63xx_udc.c | 37 ++---------- |
| drivers/usb/gadget/udc/gr_udc.c | 7 +-- |
| drivers/usb/gadget/udc/gr_udc.h | 1 - |
| drivers/usb/gadget/udc/pxa27x_udc.c | 43 ++------------ |
| drivers/usb/gadget/udc/pxa27x_udc.h | 3 - |
| drivers/usb/gadget/udc/renesas_usb3.c | 18 +----- |
| drivers/usb/gadget/udc/s3c2410_udc.c | 17 ++---- |
| drivers/usb/host/ehci-dbg.c | 30 +++------- |
| drivers/usb/host/ehci-hcd.c | 5 -- |
| drivers/usb/host/fhci-dbg.c | 23 ++------ |
| drivers/usb/host/fhci.h | 2 - |
| drivers/usb/host/fotg210-hcd.c | 34 +++-------- |
| drivers/usb/host/imx21-dbg.c | 44 ++++---------- |
| drivers/usb/host/isp116x-hcd.c | 17 ++---- |
| drivers/usb/host/ohci-dbg.c | 45 +++----------- |
| drivers/usb/host/ohci-hcd.c | 5 -- |
| drivers/usb/host/ohci.h | 3 - |
| drivers/usb/host/uhci-hcd.c | 15 ++--- |
| drivers/usb/mon/mon_text.c | 37 +++--------- |
| drivers/usb/mtu3/mtu3_dr.c | 4 -- |
| drivers/usb/musb/musb_core.c | 5 +- |
| drivers/usb/musb/musb_debug.h | 5 +- |
| drivers/usb/musb/musb_debugfs.c | 44 +++----------- |
| drivers/usb/musb/musb_dsps.c | 9 +-- |
| drivers/usb/typec/fusb302/fusb302.c | 24 +++----- |
| drivers/usb/typec/tcpm.c | 9 +-- |
| 34 files changed, 157 insertions(+), 613 deletions(-) |
| |
| diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h |
| index 98b7cb3d0064..0bf244d50544 100644 |
| --- a/drivers/usb/chipidea/ci.h |
| +++ b/drivers/usb/chipidea/ci.h |
| @@ -450,7 +450,7 @@ void hw_phymode_configure(struct ci_hdrc *ci); |
| |
| void ci_platform_configure(struct ci_hdrc *ci); |
| |
| -int dbg_create_files(struct ci_hdrc *ci); |
| +void dbg_create_files(struct ci_hdrc *ci); |
| |
| void dbg_remove_files(struct ci_hdrc *ci); |
| #endif /* __DRIVERS_USB_CHIPIDEA_CI_H */ |
| diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c |
| index 33ae87fa3ff3..85fc6db48e44 100644 |
| --- a/drivers/usb/chipidea/core.c |
| +++ b/drivers/usb/chipidea/core.c |
| @@ -1062,9 +1062,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) |
| ci_hdrc_otg_fsm_start(ci); |
| |
| device_set_wakeup_capable(&pdev->dev, true); |
| - ret = dbg_create_files(ci); |
| - if (ret) |
| - goto stop; |
| + dbg_create_files(ci); |
| |
| ret = sysfs_create_group(&dev->kobj, &ci_attr_group); |
| if (ret) |
| diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c |
| index ce648cb3ed94..fcc91a338875 100644 |
| --- a/drivers/usb/chipidea/debug.c |
| +++ b/drivers/usb/chipidea/debug.c |
| @@ -340,54 +340,28 @@ DEFINE_SHOW_ATTRIBUTE(ci_registers); |
| * |
| * This function returns an error code |
| */ |
| -int dbg_create_files(struct ci_hdrc *ci) |
| +void dbg_create_files(struct ci_hdrc *ci) |
| { |
| - struct dentry *dent; |
| - |
| ci->debugfs = debugfs_create_dir(dev_name(ci->dev), NULL); |
| - if (!ci->debugfs) |
| - return -ENOMEM; |
| - |
| - dent = debugfs_create_file("device", S_IRUGO, ci->debugfs, ci, |
| - &ci_device_fops); |
| - if (!dent) |
| - goto err; |
| - |
| - dent = debugfs_create_file("port_test", S_IRUGO | S_IWUSR, ci->debugfs, |
| - ci, &ci_port_test_fops); |
| - if (!dent) |
| - goto err; |
| - |
| - dent = debugfs_create_file("qheads", S_IRUGO, ci->debugfs, ci, |
| - &ci_qheads_fops); |
| - if (!dent) |
| - goto err; |
| |
| - dent = debugfs_create_file("requests", S_IRUGO, ci->debugfs, ci, |
| - &ci_requests_fops); |
| - if (!dent) |
| - goto err; |
| + debugfs_create_file("device", S_IRUGO, ci->debugfs, ci, |
| + &ci_device_fops); |
| + debugfs_create_file("port_test", S_IRUGO | S_IWUSR, ci->debugfs, ci, |
| + &ci_port_test_fops); |
| + debugfs_create_file("qheads", S_IRUGO, ci->debugfs, ci, |
| + &ci_qheads_fops); |
| + debugfs_create_file("requests", S_IRUGO, ci->debugfs, ci, |
| + &ci_requests_fops); |
| |
| if (ci_otg_is_fsm_mode(ci)) { |
| - dent = debugfs_create_file("otg", S_IRUGO, ci->debugfs, ci, |
| - &ci_otg_fops); |
| - if (!dent) |
| - goto err; |
| + debugfs_create_file("otg", S_IRUGO, ci->debugfs, ci, |
| + &ci_otg_fops); |
| } |
| |
| - dent = debugfs_create_file("role", S_IRUGO | S_IWUSR, ci->debugfs, ci, |
| - &ci_role_fops); |
| - if (!dent) |
| - goto err; |
| - |
| - dent = debugfs_create_file("registers", S_IRUGO, ci->debugfs, ci, |
| - &ci_registers_fops); |
| - |
| - if (dent) |
| - return 0; |
| -err: |
| - debugfs_remove_recursive(ci->debugfs); |
| - return -ENOMEM; |
| + debugfs_create_file("role", S_IRUGO | S_IWUSR, ci->debugfs, ci, |
| + &ci_role_fops); |
| + debugfs_create_file("registers", S_IRUGO, ci->debugfs, ci, |
| + &ci_registers_fops); |
| } |
| |
| /** |
| diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c |
| index 0adb6345ff2e..623be3174fb3 100644 |
| --- a/drivers/usb/core/usb.c |
| +++ b/drivers/usb/core/usb.c |
| @@ -1167,30 +1167,16 @@ static struct notifier_block usb_bus_nb = { |
| struct dentry *usb_debug_root; |
| EXPORT_SYMBOL_GPL(usb_debug_root); |
| |
| -static struct dentry *usb_debug_devices; |
| - |
| -static int usb_debugfs_init(void) |
| +static void usb_debugfs_init(void) |
| { |
| usb_debug_root = debugfs_create_dir("usb", NULL); |
| - if (!usb_debug_root) |
| - return -ENOENT; |
| - |
| - usb_debug_devices = debugfs_create_file("devices", 0444, |
| - usb_debug_root, NULL, |
| - &usbfs_devices_fops); |
| - if (!usb_debug_devices) { |
| - debugfs_remove(usb_debug_root); |
| - usb_debug_root = NULL; |
| - return -ENOENT; |
| - } |
| - |
| - return 0; |
| + debugfs_create_file("devices", 0444, usb_debug_root, NULL, |
| + &usbfs_devices_fops); |
| } |
| |
| static void usb_debugfs_cleanup(void) |
| { |
| - debugfs_remove(usb_debug_devices); |
| - debugfs_remove(usb_debug_root); |
| + debugfs_remove_recursive(usb_debug_root); |
| } |
| |
| /* |
| @@ -1205,9 +1191,7 @@ static int __init usb_init(void) |
| } |
| usb_init_pool_max(); |
| |
| - retval = usb_debugfs_init(); |
| - if (retval) |
| - goto out; |
| + usb_debugfs_init(); |
| |
| usb_acpi_register(); |
| retval = bus_register(&usb_bus_type); |
| diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c |
| index 7e6618ad9f21..d0bdb7997557 100644 |
| --- a/drivers/usb/dwc2/debugfs.c |
| +++ b/drivers/usb/dwc2/debugfs.c |
| @@ -294,52 +294,30 @@ DEFINE_SHOW_ATTRIBUTE(ep); |
| static void dwc2_hsotg_create_debug(struct dwc2_hsotg *hsotg) |
| { |
| struct dentry *root; |
| - struct dentry *file; |
| unsigned int epidx; |
| |
| root = hsotg->debug_root; |
| |
| /* create general state file */ |
| - |
| - file = debugfs_create_file("state", 0444, root, hsotg, &state_fops); |
| - if (IS_ERR(file)) |
| - dev_err(hsotg->dev, "%s: failed to create state\n", __func__); |
| - |
| - file = debugfs_create_file("testmode", 0644, root, hsotg, |
| - &testmode_fops); |
| - if (IS_ERR(file)) |
| - dev_err(hsotg->dev, "%s: failed to create testmode\n", |
| - __func__); |
| - |
| - file = debugfs_create_file("fifo", 0444, root, hsotg, &fifo_fops); |
| - if (IS_ERR(file)) |
| - dev_err(hsotg->dev, "%s: failed to create fifo\n", __func__); |
| + debugfs_create_file("state", 0444, root, hsotg, &state_fops); |
| + debugfs_create_file("testmode", 0644, root, hsotg, &testmode_fops); |
| + debugfs_create_file("fifo", 0444, root, hsotg, &fifo_fops); |
| |
| /* Create one file for each out endpoint */ |
| for (epidx = 0; epidx < hsotg->num_of_eps; epidx++) { |
| struct dwc2_hsotg_ep *ep; |
| |
| ep = hsotg->eps_out[epidx]; |
| - if (ep) { |
| - file = debugfs_create_file(ep->name, 0444, |
| - root, ep, &ep_fops); |
| - if (IS_ERR(file)) |
| - dev_err(hsotg->dev, "failed to create %s debug file\n", |
| - ep->name); |
| - } |
| + if (ep) |
| + debugfs_create_file(ep->name, 0444, root, ep, &ep_fops); |
| } |
| /* Create one file for each in endpoint. EP0 is handled with out eps */ |
| for (epidx = 1; epidx < hsotg->num_of_eps; epidx++) { |
| struct dwc2_hsotg_ep *ep; |
| |
| ep = hsotg->eps_in[epidx]; |
| - if (ep) { |
| - file = debugfs_create_file(ep->name, 0444, |
| - root, ep, &ep_fops); |
| - if (IS_ERR(file)) |
| - dev_err(hsotg->dev, "failed to create %s debug file\n", |
| - ep->name); |
| - } |
| + if (ep) |
| + debugfs_create_file(ep->name, 0444, root, ep, &ep_fops); |
| } |
| } |
| #else |
| @@ -792,32 +770,14 @@ DEFINE_SHOW_ATTRIBUTE(dr_mode); |
| int dwc2_debugfs_init(struct dwc2_hsotg *hsotg) |
| { |
| int ret; |
| - struct dentry *file; |
| + struct dentry *root; |
| |
| - hsotg->debug_root = debugfs_create_dir(dev_name(hsotg->dev), NULL); |
| - if (!hsotg->debug_root) { |
| - ret = -ENOMEM; |
| - goto err0; |
| - } |
| + root = debugfs_create_dir(dev_name(hsotg->dev), NULL); |
| + hsotg->debug_root = root; |
| |
| - file = debugfs_create_file("params", 0444, |
| - hsotg->debug_root, |
| - hsotg, ¶ms_fops); |
| - if (IS_ERR(file)) |
| - dev_err(hsotg->dev, "%s: failed to create params\n", __func__); |
| - |
| - file = debugfs_create_file("hw_params", 0444, |
| - hsotg->debug_root, |
| - hsotg, &hw_params_fops); |
| - if (IS_ERR(file)) |
| - dev_err(hsotg->dev, "%s: failed to create hw_params\n", |
| - __func__); |
| - |
| - file = debugfs_create_file("dr_mode", 0444, |
| - hsotg->debug_root, |
| - hsotg, &dr_mode_fops); |
| - if (IS_ERR(file)) |
| - dev_err(hsotg->dev, "%s: failed to create dr_mode\n", __func__); |
| + debugfs_create_file("params", 0444, root, hsotg, ¶ms_fops); |
| + debugfs_create_file("hw_params", 0444, root, hsotg, &hw_params_fops); |
| + debugfs_create_file("dr_mode", 0444, root, hsotg, &dr_mode_fops); |
| |
| /* Add gadget debugfs nodes */ |
| dwc2_hsotg_create_debug(hsotg); |
| @@ -826,24 +786,18 @@ int dwc2_debugfs_init(struct dwc2_hsotg *hsotg) |
| GFP_KERNEL); |
| if (!hsotg->regset) { |
| ret = -ENOMEM; |
| - goto err1; |
| + goto err; |
| } |
| |
| hsotg->regset->regs = dwc2_regs; |
| hsotg->regset->nregs = ARRAY_SIZE(dwc2_regs); |
| hsotg->regset->base = hsotg->regs; |
| |
| - file = debugfs_create_regset32("regdump", 0444, hsotg->debug_root, |
| - hsotg->regset); |
| - if (!file) { |
| - ret = -ENOMEM; |
| - goto err1; |
| - } |
| + debugfs_create_regset32("regdump", 0444, root, hsotg->regset); |
| |
| return 0; |
| -err1: |
| +err: |
| debugfs_remove_recursive(hsotg->debug_root); |
| -err0: |
| return ret; |
| } |
| |
| diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c |
| index 2f07be1e1f31..df8e73ec3342 100644 |
| --- a/drivers/usb/dwc3/debugfs.c |
| +++ b/drivers/usb/dwc3/debugfs.c |
| @@ -716,9 +716,6 @@ static void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep, |
| struct dentry *dir; |
| |
| dir = debugfs_create_dir(dep->name, parent); |
| - if (IS_ERR_OR_NULL(dir)) |
| - return; |
| - |
| dwc3_debugfs_create_endpoint_files(dep, dir); |
| } |
| |
| @@ -740,49 +737,31 @@ static void dwc3_debugfs_create_endpoint_dirs(struct dwc3 *dwc, |
| void dwc3_debugfs_init(struct dwc3 *dwc) |
| { |
| struct dentry *root; |
| - struct dentry *file; |
| - |
| - root = debugfs_create_dir(dev_name(dwc->dev), NULL); |
| - if (IS_ERR_OR_NULL(root)) { |
| - if (!root) |
| - dev_err(dwc->dev, "Can't create debugfs root\n"); |
| - return; |
| - } |
| - dwc->root = root; |
| |
| dwc->regset = kzalloc(sizeof(*dwc->regset), GFP_KERNEL); |
| - if (!dwc->regset) { |
| - debugfs_remove_recursive(root); |
| + if (!dwc->regset) |
| return; |
| - } |
| |
| dwc->regset->regs = dwc3_regs; |
| dwc->regset->nregs = ARRAY_SIZE(dwc3_regs); |
| dwc->regset->base = dwc->regs - DWC3_GLOBALS_REGS_START; |
| |
| - file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); |
| - if (!file) |
| - dev_dbg(dwc->dev, "Can't create debugfs regdump\n"); |
| + root = debugfs_create_dir(dev_name(dwc->dev), NULL); |
| + dwc->root = root; |
| + |
| + debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); |
| |
| if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) { |
| - file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, |
| - dwc, &dwc3_mode_fops); |
| - if (!file) |
| - dev_dbg(dwc->dev, "Can't create debugfs mode\n"); |
| + debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, dwc, |
| + &dwc3_mode_fops); |
| } |
| |
| if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) || |
| IS_ENABLED(CONFIG_USB_DWC3_GADGET)) { |
| - file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, |
| - dwc, &dwc3_testmode_fops); |
| - if (!file) |
| - dev_dbg(dwc->dev, "Can't create debugfs testmode\n"); |
| - |
| - file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, |
| - root, dwc, &dwc3_link_state_fops); |
| - if (!file) |
| - dev_dbg(dwc->dev, "Can't create debugfs link_state\n"); |
| - |
| + debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, dwc, |
| + &dwc3_testmode_fops); |
| + debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, dwc, |
| + &dwc3_link_state_fops); |
| dwc3_debugfs_create_endpoint_dirs(dwc, root); |
| } |
| } |
| diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c |
| index 2f586f2bda7e..a4d99bf50f2f 100644 |
| --- a/drivers/usb/gadget/udc/atmel_usba_udc.c |
| +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c |
| @@ -206,94 +206,45 @@ static void usba_ep_init_debugfs(struct usba_udc *udc, |
| struct dentry *ep_root; |
| |
| ep_root = debugfs_create_dir(ep->ep.name, udc->debugfs_root); |
| - if (!ep_root) |
| - goto err_root; |
| ep->debugfs_dir = ep_root; |
| |
| - ep->debugfs_queue = debugfs_create_file("queue", 0400, ep_root, |
| - ep, &queue_dbg_fops); |
| - if (!ep->debugfs_queue) |
| - goto err_queue; |
| - |
| - if (ep->can_dma) { |
| - ep->debugfs_dma_status |
| - = debugfs_create_u32("dma_status", 0400, ep_root, |
| - &ep->last_dma_status); |
| - if (!ep->debugfs_dma_status) |
| - goto err_dma_status; |
| - } |
| - if (ep_is_control(ep)) { |
| - ep->debugfs_state |
| - = debugfs_create_u32("state", 0400, ep_root, |
| - &ep->state); |
| - if (!ep->debugfs_state) |
| - goto err_state; |
| - } |
| - |
| - return; |
| - |
| -err_state: |
| + debugfs_create_file("queue", 0400, ep_root, ep, &queue_dbg_fops); |
| if (ep->can_dma) |
| - debugfs_remove(ep->debugfs_dma_status); |
| -err_dma_status: |
| - debugfs_remove(ep->debugfs_queue); |
| -err_queue: |
| - debugfs_remove(ep_root); |
| -err_root: |
| - dev_err(&ep->udc->pdev->dev, |
| - "failed to create debugfs directory for %s\n", ep->ep.name); |
| + debugfs_create_u32("dma_status", 0400, ep_root, |
| + &ep->last_dma_status); |
| + if (ep_is_control(ep)) |
| + debugfs_create_u32("state", 0400, ep_root, &ep->state); |
| } |
| |
| static void usba_ep_cleanup_debugfs(struct usba_ep *ep) |
| { |
| - debugfs_remove(ep->debugfs_queue); |
| - debugfs_remove(ep->debugfs_dma_status); |
| - debugfs_remove(ep->debugfs_state); |
| - debugfs_remove(ep->debugfs_dir); |
| - ep->debugfs_dma_status = NULL; |
| - ep->debugfs_dir = NULL; |
| + debugfs_remove_recursive(ep->debugfs_dir); |
| } |
| |
| static void usba_init_debugfs(struct usba_udc *udc) |
| { |
| - struct dentry *root, *regs; |
| + struct dentry *root; |
| struct resource *regs_resource; |
| |
| root = debugfs_create_dir(udc->gadget.name, NULL); |
| - if (IS_ERR(root) || !root) |
| - goto err_root; |
| udc->debugfs_root = root; |
| |
| regs_resource = platform_get_resource(udc->pdev, IORESOURCE_MEM, |
| CTRL_IOMEM_ID); |
| |
| if (regs_resource) { |
| - regs = debugfs_create_file_size("regs", 0400, root, udc, |
| - ®s_dbg_fops, |
| - resource_size(regs_resource)); |
| - if (!regs) |
| - goto err_regs; |
| - udc->debugfs_regs = regs; |
| + debugfs_create_file_size("regs", 0400, root, udc, |
| + ®s_dbg_fops, |
| + resource_size(regs_resource)); |
| } |
| |
| usba_ep_init_debugfs(udc, to_usba_ep(udc->gadget.ep0)); |
| - |
| - return; |
| - |
| -err_regs: |
| - debugfs_remove(root); |
| -err_root: |
| - udc->debugfs_root = NULL; |
| - dev_err(&udc->pdev->dev, "debugfs is not available\n"); |
| } |
| |
| static void usba_cleanup_debugfs(struct usba_udc *udc) |
| { |
| usba_ep_cleanup_debugfs(to_usba_ep(udc->gadget.ep0)); |
| - debugfs_remove(udc->debugfs_regs); |
| - debugfs_remove(udc->debugfs_root); |
| - udc->debugfs_regs = NULL; |
| - udc->debugfs_root = NULL; |
| + debugfs_remove_recursive(udc->debugfs_root); |
| } |
| #else |
| static inline void usba_ep_init_debugfs(struct usba_udc *udc, |
| diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h |
| index d7eb7cf4fd5c..030bf797cd25 100644 |
| --- a/drivers/usb/gadget/udc/atmel_usba_udc.h |
| +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h |
| @@ -287,9 +287,6 @@ struct usba_ep { |
| #ifdef CONFIG_USB_GADGET_DEBUG_FS |
| u32 last_dma_status; |
| struct dentry *debugfs_dir; |
| - struct dentry *debugfs_queue; |
| - struct dentry *debugfs_dma_status; |
| - struct dentry *debugfs_state; |
| #endif |
| }; |
| |
| @@ -344,7 +341,6 @@ struct usba_udc { |
| |
| #ifdef CONFIG_USB_GADGET_DEBUG_FS |
| struct dentry *debugfs_root; |
| - struct dentry *debugfs_regs; |
| #endif |
| |
| struct regmap *pmc; |
| diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c |
| index 3a8df8601074..c1fcc77403ea 100644 |
| --- a/drivers/usb/gadget/udc/bcm63xx_udc.c |
| +++ b/drivers/usb/gadget/udc/bcm63xx_udc.c |
| @@ -288,8 +288,6 @@ struct bcm63xx_req { |
| * @ep0_reply: Pending reply from gadget driver. |
| * @ep0_request: Outstanding ep0 request. |
| * @debugfs_root: debugfs directory: /sys/kernel/debug/<DRV_MODULE_NAME>. |
| - * @debugfs_usbd: debugfs file "usbd" for controller state. |
| - * @debugfs_iudma: debugfs file "usbd" for IUDMA state. |
| */ |
| struct bcm63xx_udc { |
| spinlock_t lock; |
| @@ -330,8 +328,6 @@ struct bcm63xx_udc { |
| struct usb_request *ep0_request; |
| |
| struct dentry *debugfs_root; |
| - struct dentry *debugfs_usbd; |
| - struct dentry *debugfs_iudma; |
| }; |
| |
| static const struct usb_ep_ops bcm63xx_udc_ep_ops; |
| @@ -2247,34 +2243,16 @@ DEFINE_SHOW_ATTRIBUTE(bcm63xx_iudma_dbg); |
| */ |
| static void bcm63xx_udc_init_debugfs(struct bcm63xx_udc *udc) |
| { |
| - struct dentry *root, *usbd, *iudma; |
| + struct dentry *root; |
| |
| if (!IS_ENABLED(CONFIG_USB_GADGET_DEBUG_FS)) |
| return; |
| |
| root = debugfs_create_dir(udc->gadget.name, NULL); |
| - if (IS_ERR(root) || !root) |
| - goto err_root; |
| - |
| - usbd = debugfs_create_file("usbd", 0400, root, udc, |
| - &bcm63xx_usbd_dbg_fops); |
| - if (!usbd) |
| - goto err_usbd; |
| - iudma = debugfs_create_file("iudma", 0400, root, udc, |
| - &bcm63xx_iudma_dbg_fops); |
| - if (!iudma) |
| - goto err_iudma; |
| - |
| udc->debugfs_root = root; |
| - udc->debugfs_usbd = usbd; |
| - udc->debugfs_iudma = iudma; |
| - return; |
| -err_iudma: |
| - debugfs_remove(usbd); |
| -err_usbd: |
| - debugfs_remove(root); |
| -err_root: |
| - dev_err(udc->dev, "debugfs is not available\n"); |
| + |
| + debugfs_create_file("usbd", 0400, root, udc, &bcm63xx_usbd_dbg_fops); |
| + debugfs_create_file("iudma", 0400, root, udc, &bcm63xx_iudma_dbg_fops); |
| } |
| |
| /** |
| @@ -2285,12 +2263,7 @@ static void bcm63xx_udc_init_debugfs(struct bcm63xx_udc *udc) |
| */ |
| static void bcm63xx_udc_cleanup_debugfs(struct bcm63xx_udc *udc) |
| { |
| - debugfs_remove(udc->debugfs_iudma); |
| - debugfs_remove(udc->debugfs_usbd); |
| - debugfs_remove(udc->debugfs_root); |
| - udc->debugfs_iudma = NULL; |
| - udc->debugfs_usbd = NULL; |
| - udc->debugfs_root = NULL; |
| + debugfs_remove_recursive(udc->debugfs_root); |
| } |
| |
| /*********************************************************************** |
| diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c |
| index ca83c15d8ea4..729e60e49564 100644 |
| --- a/drivers/usb/gadget/udc/gr_udc.c |
| +++ b/drivers/usb/gadget/udc/gr_udc.c |
| @@ -209,15 +209,12 @@ static void gr_dfs_create(struct gr_udc *dev) |
| const char *name = "gr_udc_state"; |
| |
| dev->dfs_root = debugfs_create_dir(dev_name(dev->dev), NULL); |
| - dev->dfs_state = debugfs_create_file(name, 0444, dev->dfs_root, dev, |
| - &gr_dfs_fops); |
| + debugfs_create_file(name, 0444, dev->dfs_root, dev, &gr_dfs_fops); |
| } |
| |
| static void gr_dfs_delete(struct gr_udc *dev) |
| { |
| - /* Handles NULL and ERR pointers internally */ |
| - debugfs_remove(dev->dfs_state); |
| - debugfs_remove(dev->dfs_root); |
| + debugfs_remove_recursive(dev->dfs_root); |
| } |
| |
| #else /* !CONFIG_USB_GADGET_DEBUG_FS */ |
| diff --git a/drivers/usb/gadget/udc/gr_udc.h b/drivers/usb/gadget/udc/gr_udc.h |
| index 3e913268c8c5..417ad2aa2cc7 100644 |
| --- a/drivers/usb/gadget/udc/gr_udc.h |
| +++ b/drivers/usb/gadget/udc/gr_udc.h |
| @@ -217,7 +217,6 @@ struct gr_udc { |
| spinlock_t lock; /* General lock, a.k.a. "dev->lock" in comments */ |
| |
| struct dentry *dfs_root; |
| - struct dentry *dfs_state; |
| }; |
| |
| #define to_gr_udc(gadget) (container_of((gadget), struct gr_udc, gadget)) |
| diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c |
| index a58242e901df..014233252299 100644 |
| --- a/drivers/usb/gadget/udc/pxa27x_udc.c |
| +++ b/drivers/usb/gadget/udc/pxa27x_udc.c |
| @@ -205,50 +205,19 @@ DEFINE_SHOW_ATTRIBUTE(eps_dbg); |
| |
| static void pxa_init_debugfs(struct pxa_udc *udc) |
| { |
| - struct dentry *root, *state, *queues, *eps; |
| + struct dentry *root; |
| |
| root = debugfs_create_dir(udc->gadget.name, NULL); |
| - if (IS_ERR(root) || !root) |
| - goto err_root; |
| - |
| - state = debugfs_create_file("udcstate", 0400, root, udc, |
| - &state_dbg_fops); |
| - if (!state) |
| - goto err_state; |
| - queues = debugfs_create_file("queues", 0400, root, udc, |
| - &queues_dbg_fops); |
| - if (!queues) |
| - goto err_queues; |
| - eps = debugfs_create_file("epstate", 0400, root, udc, |
| - &eps_dbg_fops); |
| - if (!eps) |
| - goto err_eps; |
| - |
| udc->debugfs_root = root; |
| - udc->debugfs_state = state; |
| - udc->debugfs_queues = queues; |
| - udc->debugfs_eps = eps; |
| - return; |
| -err_eps: |
| - debugfs_remove(eps); |
| -err_queues: |
| - debugfs_remove(queues); |
| -err_state: |
| - debugfs_remove(root); |
| -err_root: |
| - dev_err(udc->dev, "debugfs is not available\n"); |
| + |
| + debugfs_create_file("udcstate", 0400, root, udc, &state_dbg_fops); |
| + debugfs_create_file("queues", 0400, root, udc, &queues_dbg_fops); |
| + debugfs_create_file("epstate", 0400, root, udc, &eps_dbg_fops); |
| } |
| |
| static void pxa_cleanup_debugfs(struct pxa_udc *udc) |
| { |
| - debugfs_remove(udc->debugfs_eps); |
| - debugfs_remove(udc->debugfs_queues); |
| - debugfs_remove(udc->debugfs_state); |
| - debugfs_remove(udc->debugfs_root); |
| - udc->debugfs_eps = NULL; |
| - udc->debugfs_queues = NULL; |
| - udc->debugfs_state = NULL; |
| - udc->debugfs_root = NULL; |
| + debugfs_remove_recursive(udc->debugfs_root); |
| } |
| |
| #else |
| diff --git a/drivers/usb/gadget/udc/pxa27x_udc.h b/drivers/usb/gadget/udc/pxa27x_udc.h |
| index 1128d39a4255..13b2977399ab 100644 |
| --- a/drivers/usb/gadget/udc/pxa27x_udc.h |
| +++ b/drivers/usb/gadget/udc/pxa27x_udc.h |
| @@ -476,9 +476,6 @@ struct pxa_udc { |
| #endif |
| #ifdef CONFIG_USB_GADGET_DEBUG_FS |
| struct dentry *debugfs_root; |
| - struct dentry *debugfs_state; |
| - struct dentry *debugfs_queues; |
| - struct dentry *debugfs_eps; |
| #endif |
| }; |
| #define to_pxa(g) (container_of((g), struct pxa_udc, gadget)) |
| diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c |
| index 5caf78bbbf7c..977ea1a02cf9 100644 |
| --- a/drivers/usb/gadget/udc/renesas_usb3.c |
| +++ b/drivers/usb/gadget/udc/renesas_usb3.c |
| @@ -2391,22 +2391,10 @@ static const struct file_operations renesas_usb3_b_device_fops = { |
| static void renesas_usb3_debugfs_init(struct renesas_usb3 *usb3, |
| struct device *dev) |
| { |
| - struct dentry *root, *file; |
| + usb3->dentry = debugfs_create_dir(dev_name(dev), NULL); |
| |
| - root = debugfs_create_dir(dev_name(dev), NULL); |
| - if (IS_ERR_OR_NULL(root)) { |
| - dev_info(dev, "%s: Can't create the root\n", __func__); |
| - return; |
| - } |
| - |
| - file = debugfs_create_file("b_device", 0644, root, usb3, |
| - &renesas_usb3_b_device_fops); |
| - if (!file) { |
| - dev_info(dev, "%s: Can't create debugfs mode\n", __func__); |
| - debugfs_remove_recursive(root); |
| - } else { |
| - usb3->dentry = root; |
| - } |
| + debugfs_create_file("b_device", 0644, usb3->dentry, usb3, |
| + &renesas_usb3_b_device_fops); |
| } |
| |
| /*------- platform_driver ------------------------------------------------*/ |
| diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c |
| index f154f49e98c8..8bf5ad7a59ad 100644 |
| --- a/drivers/usb/gadget/udc/s3c2410_udc.c |
| +++ b/drivers/usb/gadget/udc/s3c2410_udc.c |
| @@ -1871,13 +1871,9 @@ static int s3c2410_udc_probe(struct platform_device *pdev) |
| if (retval) |
| goto err_add_udc; |
| |
| - if (s3c2410_udc_debugfs_root) { |
| - udc->regs_info = debugfs_create_file("registers", S_IRUGO, |
| - s3c2410_udc_debugfs_root, |
| - udc, &s3c2410_udc_debugfs_fops); |
| - if (!udc->regs_info) |
| - dev_warn(dev, "debugfs file creation failed\n"); |
| - } |
| + udc->regs_info = debugfs_create_file("registers", S_IRUGO, |
| + s3c2410_udc_debugfs_root, udc, |
| + &s3c2410_udc_debugfs_fops); |
| |
| dev_dbg(dev, "probe ok\n"); |
| |
| @@ -1994,11 +1990,6 @@ static int __init udc_init(void) |
| dprintk(DEBUG_NORMAL, "%s\n", gadget_name); |
| |
| s3c2410_udc_debugfs_root = debugfs_create_dir(gadget_name, NULL); |
| - if (IS_ERR(s3c2410_udc_debugfs_root)) { |
| - pr_err("%s: debugfs dir creation failed %ld\n", |
| - gadget_name, PTR_ERR(s3c2410_udc_debugfs_root)); |
| - s3c2410_udc_debugfs_root = NULL; |
| - } |
| |
| retval = platform_driver_register(&udc_driver_24x0); |
| if (retval) |
| @@ -2014,7 +2005,7 @@ static int __init udc_init(void) |
| static void __exit udc_exit(void) |
| { |
| platform_driver_unregister(&udc_driver_24x0); |
| - debugfs_remove(s3c2410_udc_debugfs_root); |
| + debugfs_remove_recursive(s3c2410_udc_debugfs_root); |
| } |
| |
| module_init(udc_init); |
| diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c |
| index 3ed75aaa09d9..7619cfb06883 100644 |
| --- a/drivers/usb/host/ehci-dbg.c |
| +++ b/drivers/usb/host/ehci-dbg.c |
| @@ -1028,29 +1028,15 @@ static inline void create_debug_files(struct ehci_hcd *ehci) |
| struct usb_bus *bus = &ehci_to_hcd(ehci)->self; |
| |
| ehci->debug_dir = debugfs_create_dir(bus->bus_name, ehci_debug_root); |
| - if (!ehci->debug_dir) |
| - return; |
| |
| - if (!debugfs_create_file("async", S_IRUGO, ehci->debug_dir, bus, |
| - &debug_async_fops)) |
| - goto file_error; |
| - |
| - if (!debugfs_create_file("bandwidth", S_IRUGO, ehci->debug_dir, bus, |
| - &debug_bandwidth_fops)) |
| - goto file_error; |
| - |
| - if (!debugfs_create_file("periodic", S_IRUGO, ehci->debug_dir, bus, |
| - &debug_periodic_fops)) |
| - goto file_error; |
| - |
| - if (!debugfs_create_file("registers", S_IRUGO, ehci->debug_dir, bus, |
| - &debug_registers_fops)) |
| - goto file_error; |
| - |
| - return; |
| - |
| -file_error: |
| - debugfs_remove_recursive(ehci->debug_dir); |
| + debugfs_create_file("async", S_IRUGO, ehci->debug_dir, bus, |
| + &debug_async_fops); |
| + debugfs_create_file("bandwidth", S_IRUGO, ehci->debug_dir, bus, |
| + &debug_bandwidth_fops); |
| + debugfs_create_file("periodic", S_IRUGO, ehci->debug_dir, bus, |
| + &debug_periodic_fops); |
| + debugfs_create_file("registers", S_IRUGO, ehci->debug_dir, bus, |
| + &debug_registers_fops); |
| } |
| |
| static inline void remove_debug_files(struct ehci_hcd *ehci) |
| diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c |
| index d927adf3afcd..89c47ae5c7d3 100644 |
| --- a/drivers/usb/host/ehci-hcd.c |
| +++ b/drivers/usb/host/ehci-hcd.c |
| @@ -1311,10 +1311,6 @@ static int __init ehci_hcd_init(void) |
| |
| #ifdef CONFIG_DYNAMIC_DEBUG |
| ehci_debug_root = debugfs_create_dir("ehci", usb_debug_root); |
| - if (!ehci_debug_root) { |
| - retval = -ENOENT; |
| - goto err_debug; |
| - } |
| #endif |
| |
| #ifdef PLATFORM_DRIVER |
| @@ -1361,7 +1357,6 @@ static int __init ehci_hcd_init(void) |
| #ifdef CONFIG_DYNAMIC_DEBUG |
| debugfs_remove(ehci_debug_root); |
| ehci_debug_root = NULL; |
| -err_debug: |
| #endif |
| clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded); |
| return retval; |
| diff --git a/drivers/usb/host/fhci-dbg.c b/drivers/usb/host/fhci-dbg.c |
| index ebf9bb219f75..100048b3bd17 100644 |
| --- a/drivers/usb/host/fhci-dbg.c |
| +++ b/drivers/usb/host/fhci-dbg.c |
| @@ -83,27 +83,14 @@ void fhci_dfs_create(struct fhci_hcd *fhci) |
| struct device *dev = fhci_to_hcd(fhci)->self.controller; |
| |
| fhci->dfs_root = debugfs_create_dir(dev_name(dev), usb_debug_root); |
| - if (!fhci->dfs_root) { |
| - WARN_ON(1); |
| - return; |
| - } |
| - |
| - fhci->dfs_regs = debugfs_create_file("regs", S_IFREG | S_IRUGO, |
| - fhci->dfs_root, fhci, &fhci_dfs_regs_fops); |
| |
| - fhci->dfs_irq_stat = debugfs_create_file("irq_stat", |
| - S_IFREG | S_IRUGO, fhci->dfs_root, fhci, |
| - &fhci_dfs_irq_stat_fops); |
| - |
| - WARN_ON(!fhci->dfs_regs || !fhci->dfs_irq_stat); |
| + debugfs_create_file("regs", S_IFREG | S_IRUGO, fhci->dfs_root, fhci, |
| + &fhci_dfs_regs_fops); |
| + debugfs_create_file("irq_stat", S_IFREG | S_IRUGO, fhci->dfs_root, fhci, |
| + &fhci_dfs_irq_stat_fops); |
| } |
| |
| void fhci_dfs_destroy(struct fhci_hcd *fhci) |
| { |
| - if (!fhci->dfs_root) |
| - return; |
| - |
| - debugfs_remove(fhci->dfs_irq_stat); |
| - debugfs_remove(fhci->dfs_regs); |
| - debugfs_remove(fhci->dfs_root); |
| + debugfs_remove_recursive(fhci->dfs_root); |
| } |
| diff --git a/drivers/usb/host/fhci.h b/drivers/usb/host/fhci.h |
| index e7ec41d62410..2ce5031d866d 100644 |
| --- a/drivers/usb/host/fhci.h |
| +++ b/drivers/usb/host/fhci.h |
| @@ -262,8 +262,6 @@ struct fhci_hcd { |
| #ifdef CONFIG_FHCI_DEBUG |
| int usb_irq_stat[13]; |
| struct dentry *dfs_root; |
| - struct dentry *dfs_regs; |
| - struct dentry *dfs_irq_stat; |
| #endif |
| }; |
| |
| diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c |
| index d8abf401918a..e64eb47770c8 100644 |
| --- a/drivers/usb/host/fotg210-hcd.c |
| +++ b/drivers/usb/host/fotg210-hcd.c |
| @@ -844,28 +844,16 @@ static int debug_registers_open(struct inode *inode, struct file *file) |
| static inline void create_debug_files(struct fotg210_hcd *fotg210) |
| { |
| struct usb_bus *bus = &fotg210_to_hcd(fotg210)->self; |
| + struct dentry *root; |
| |
| - fotg210->debug_dir = debugfs_create_dir(bus->bus_name, |
| - fotg210_debug_root); |
| - if (!fotg210->debug_dir) |
| - return; |
| - |
| - if (!debugfs_create_file("async", S_IRUGO, fotg210->debug_dir, bus, |
| - &debug_async_fops)) |
| - goto file_error; |
| - |
| - if (!debugfs_create_file("periodic", S_IRUGO, fotg210->debug_dir, bus, |
| - &debug_periodic_fops)) |
| - goto file_error; |
| + root = debugfs_create_dir(bus->bus_name, fotg210_debug_root); |
| + fotg210->debug_dir = root; |
| |
| - if (!debugfs_create_file("registers", S_IRUGO, fotg210->debug_dir, bus, |
| - &debug_registers_fops)) |
| - goto file_error; |
| - |
| - return; |
| - |
| -file_error: |
| - debugfs_remove_recursive(fotg210->debug_dir); |
| + debugfs_create_file("async", S_IRUGO, root, bus, &debug_async_fops); |
| + debugfs_create_file("periodic", S_IRUGO, root, bus, |
| + &debug_periodic_fops); |
| + debugfs_create_file("registers", S_IRUGO, root, bus, |
| + &debug_registers_fops); |
| } |
| |
| static inline void remove_debug_files(struct fotg210_hcd *fotg210) |
| @@ -5686,10 +5674,6 @@ static int __init fotg210_hcd_init(void) |
| sizeof(struct fotg210_itd)); |
| |
| fotg210_debug_root = debugfs_create_dir("fotg210", usb_debug_root); |
| - if (!fotg210_debug_root) { |
| - retval = -ENOENT; |
| - goto err_debug; |
| - } |
| |
| retval = platform_driver_register(&fotg210_hcd_driver); |
| if (retval < 0) |
| @@ -5699,7 +5683,7 @@ static int __init fotg210_hcd_init(void) |
| clean: |
| debugfs_remove(fotg210_debug_root); |
| fotg210_debug_root = NULL; |
| -err_debug: |
| + |
| clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded); |
| return retval; |
| } |
| diff --git a/drivers/usb/host/imx21-dbg.c b/drivers/usb/host/imx21-dbg.c |
| index a213ed6f07b5..7fcf1d9dd7f3 100644 |
| --- a/drivers/usb/host/imx21-dbg.c |
| +++ b/drivers/usb/host/imx21-dbg.c |
| @@ -417,46 +417,22 @@ DEFINE_SHOW_ATTRIBUTE(debug_isoc); |
| |
| static void create_debug_files(struct imx21 *imx21) |
| { |
| - imx21->debug_root = debugfs_create_dir(dev_name(imx21->dev), NULL); |
| - if (!imx21->debug_root) |
| - goto failed_create_rootdir; |
| + struct dentry *root; |
| |
| - if (!debugfs_create_file("status", S_IRUGO, |
| - imx21->debug_root, imx21, &debug_status_fops)) |
| - goto failed_create; |
| + root = debugfs_create_dir(dev_name(imx21->dev), NULL); |
| + imx21->debug_root = root; |
| |
| - if (!debugfs_create_file("dmem", S_IRUGO, |
| - imx21->debug_root, imx21, &debug_dmem_fops)) |
| - goto failed_create; |
| - |
| - if (!debugfs_create_file("etd", S_IRUGO, |
| - imx21->debug_root, imx21, &debug_etd_fops)) |
| - goto failed_create; |
| - |
| - if (!debugfs_create_file("statistics", S_IRUGO, |
| - imx21->debug_root, imx21, &debug_statistics_fops)) |
| - goto failed_create; |
| - |
| - if (!debugfs_create_file("isoc", S_IRUGO, |
| - imx21->debug_root, imx21, &debug_isoc_fops)) |
| - goto failed_create; |
| - |
| - return; |
| - |
| -failed_create: |
| - debugfs_remove_recursive(imx21->debug_root); |
| - |
| -failed_create_rootdir: |
| - imx21->debug_root = NULL; |
| + debugfs_create_file("status", S_IRUGO, root, imx21, &debug_status_fops); |
| + debugfs_create_file("dmem", S_IRUGO, root, imx21, &debug_dmem_fops); |
| + debugfs_create_file("etd", S_IRUGO, root, imx21, &debug_etd_fops); |
| + debugfs_create_file("statistics", S_IRUGO, root, imx21, |
| + &debug_statistics_fops); |
| + debugfs_create_file("isoc", S_IRUGO, root, imx21, &debug_isoc_fops); |
| } |
| |
| - |
| static void remove_debug_files(struct imx21 *imx21) |
| { |
| - if (imx21->debug_root) { |
| - debugfs_remove_recursive(imx21->debug_root); |
| - imx21->debug_root = NULL; |
| - } |
| + debugfs_remove_recursive(imx21->debug_root); |
| } |
| |
| #endif |
| diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c |
| index 4602ed801f0a..74da136d322a 100644 |
| --- a/drivers/usb/host/isp116x-hcd.c |
| +++ b/drivers/usb/host/isp116x-hcd.c |
| @@ -1198,14 +1198,11 @@ static int isp116x_debug_show(struct seq_file *s, void *unused) |
| } |
| DEFINE_SHOW_ATTRIBUTE(isp116x_debug); |
| |
| -static int create_debug_file(struct isp116x *isp116x) |
| +static void create_debug_file(struct isp116x *isp116x) |
| { |
| isp116x->dentry = debugfs_create_file(hcd_name, |
| S_IRUGO, NULL, isp116x, |
| &isp116x_debug_fops); |
| - if (!isp116x->dentry) |
| - return -ENOMEM; |
| - return 0; |
| } |
| |
| static void remove_debug_file(struct isp116x *isp116x) |
| @@ -1215,8 +1212,8 @@ static void remove_debug_file(struct isp116x *isp116x) |
| |
| #else |
| |
| -#define create_debug_file(d) 0 |
| -#define remove_debug_file(d) do{}while(0) |
| +static inline void create_debug_file(struct isp116x *isp116x) { } |
| +static inline void remove_debug_file(struct isp116x *isp116x) { } |
| |
| #endif /* CONFIG_DEBUG_FS */ |
| |
| @@ -1643,16 +1640,10 @@ static int isp116x_probe(struct platform_device *pdev) |
| |
| device_wakeup_enable(hcd->self.controller); |
| |
| - ret = create_debug_file(isp116x); |
| - if (ret) { |
| - ERR("Couldn't create debugfs entry\n"); |
| - goto err7; |
| - } |
| + create_debug_file(isp116x); |
| |
| return 0; |
| |
| - err7: |
| - usb_remove_hcd(hcd); |
| err6: |
| usb_put_hcd(hcd); |
| err5: |
| diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c |
| index ac7d4ac34b02..d3ee1f52aaab 100644 |
| --- a/drivers/usb/host/ohci-dbg.c |
| +++ b/drivers/usb/host/ohci-dbg.c |
| @@ -762,50 +762,23 @@ static int debug_registers_open(struct inode *inode, struct file *file) |
| static inline void create_debug_files (struct ohci_hcd *ohci) |
| { |
| struct usb_bus *bus = &ohci_to_hcd(ohci)->self; |
| + struct dentry *root; |
| |
| - ohci->debug_dir = debugfs_create_dir(bus->bus_name, ohci_debug_root); |
| - if (!ohci->debug_dir) |
| - goto dir_error; |
| + root = debugfs_create_dir(bus->bus_name, ohci_debug_root); |
| + ohci->debug_dir = root; |
| |
| - ohci->debug_async = debugfs_create_file("async", S_IRUGO, |
| - ohci->debug_dir, ohci, |
| - &debug_async_fops); |
| - if (!ohci->debug_async) |
| - goto async_error; |
| - |
| - ohci->debug_periodic = debugfs_create_file("periodic", S_IRUGO, |
| - ohci->debug_dir, ohci, |
| - &debug_periodic_fops); |
| - if (!ohci->debug_periodic) |
| - goto periodic_error; |
| - |
| - ohci->debug_registers = debugfs_create_file("registers", S_IRUGO, |
| - ohci->debug_dir, ohci, |
| - &debug_registers_fops); |
| - if (!ohci->debug_registers) |
| - goto registers_error; |
| + debugfs_create_file("async", S_IRUGO, root, ohci, &debug_async_fops); |
| + debugfs_create_file("periodic", S_IRUGO, root, ohci, |
| + &debug_periodic_fops); |
| + debugfs_create_file("registers", S_IRUGO, root, ohci, |
| + &debug_registers_fops); |
| |
| ohci_dbg (ohci, "created debug files\n"); |
| - return; |
| - |
| -registers_error: |
| - debugfs_remove(ohci->debug_periodic); |
| -periodic_error: |
| - debugfs_remove(ohci->debug_async); |
| -async_error: |
| - debugfs_remove(ohci->debug_dir); |
| -dir_error: |
| - ohci->debug_periodic = NULL; |
| - ohci->debug_async = NULL; |
| - ohci->debug_dir = NULL; |
| } |
| |
| static inline void remove_debug_files (struct ohci_hcd *ohci) |
| { |
| - debugfs_remove(ohci->debug_registers); |
| - debugfs_remove(ohci->debug_periodic); |
| - debugfs_remove(ohci->debug_async); |
| - debugfs_remove(ohci->debug_dir); |
| + debugfs_remove_recursive(ohci->debug_dir); |
| } |
| |
| /*-------------------------------------------------------------------------*/ |
| diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c |
| index 4806e0f9e8d4..210181fd98d2 100644 |
| --- a/drivers/usb/host/ohci-hcd.c |
| +++ b/drivers/usb/host/ohci-hcd.c |
| @@ -1258,10 +1258,6 @@ static int __init ohci_hcd_mod_init(void) |
| set_bit(USB_OHCI_LOADED, &usb_hcds_loaded); |
| |
| ohci_debug_root = debugfs_create_dir("ohci", usb_debug_root); |
| - if (!ohci_debug_root) { |
| - retval = -ENOENT; |
| - goto error_debug; |
| - } |
| |
| #ifdef PS3_SYSTEM_BUS_DRIVER |
| retval = ps3_ohci_driver_register(&PS3_SYSTEM_BUS_DRIVER); |
| @@ -1318,7 +1314,6 @@ static int __init ohci_hcd_mod_init(void) |
| #endif |
| debugfs_remove(ohci_debug_root); |
| ohci_debug_root = NULL; |
| - error_debug: |
| |
| clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded); |
| return retval; |
| diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h |
| index 508a803139dd..ef4813bfc5bf 100644 |
| --- a/drivers/usb/host/ohci.h |
| +++ b/drivers/usb/host/ohci.h |
| @@ -431,9 +431,6 @@ struct ohci_hcd { |
| struct work_struct nec_work; /* Worker for NEC quirk */ |
| |
| struct dentry *debug_dir; |
| - struct dentry *debug_async; |
| - struct dentry *debug_periodic; |
| - struct dentry *debug_registers; |
| |
| /* platform-specific data -- must come last */ |
| unsigned long priv[0] __aligned(sizeof(s64)); |
| diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c |
| index f9c3947577fc..6218bfe54f52 100644 |
| --- a/drivers/usb/host/uhci-hcd.c |
| +++ b/drivers/usb/host/uhci-hcd.c |
| @@ -590,14 +590,10 @@ static int uhci_start(struct usb_hcd *hcd) |
| init_waitqueue_head(&uhci->waitqh); |
| |
| #ifdef UHCI_DEBUG_OPS |
| - dentry = debugfs_create_file(hcd->self.bus_name, |
| - S_IFREG|S_IRUGO|S_IWUSR, uhci_debugfs_root, |
| - uhci, &uhci_debug_operations); |
| - if (!dentry) { |
| - dev_err(uhci_dev(uhci), "couldn't create uhci debugfs entry\n"); |
| - return -ENOMEM; |
| - } |
| - uhci->dentry = dentry; |
| + uhci->dentry = debugfs_create_file(hcd->self.bus_name, |
| + S_IFREG|S_IRUGO|S_IWUSR, |
| + uhci_debugfs_root, uhci, |
| + &uhci_debug_operations); |
| #endif |
| |
| uhci->frame = dma_zalloc_coherent(uhci_dev(uhci), |
| @@ -882,8 +878,6 @@ static int __init uhci_hcd_init(void) |
| if (!errbuf) |
| goto errbuf_failed; |
| uhci_debugfs_root = debugfs_create_dir("uhci", usb_debug_root); |
| - if (!uhci_debugfs_root) |
| - goto debug_failed; |
| #endif |
| |
| uhci_up_cachep = kmem_cache_create("uhci_urb_priv", |
| @@ -918,7 +912,6 @@ static int __init uhci_hcd_init(void) |
| #if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG) |
| debugfs_remove(uhci_debugfs_root); |
| |
| -debug_failed: |
| kfree(errbuf); |
| |
| errbuf_failed: |
| diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c |
| index 984f7e12a6a5..bc5ecd5ff565 100644 |
| --- a/drivers/usb/mon/mon_text.c |
| +++ b/drivers/usb/mon/mon_text.c |
| @@ -700,7 +700,6 @@ static const struct file_operations mon_fops_text_u = { |
| |
| int mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus) |
| { |
| - struct dentry *d; |
| enum { NAMESZ = 10 }; |
| char name[NAMESZ]; |
| int busnum = ubus? ubus->busnum: 0; |
| @@ -713,42 +712,32 @@ int mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus) |
| rc = snprintf(name, NAMESZ, "%dt", busnum); |
| if (rc <= 0 || rc >= NAMESZ) |
| goto err_print_t; |
| - d = debugfs_create_file(name, 0600, mon_dir, mbus, |
| + mbus->dent_t = debugfs_create_file(name, 0600, mon_dir, mbus, |
| &mon_fops_text_t); |
| - if (d == NULL) |
| - goto err_create_t; |
| - mbus->dent_t = d; |
| } |
| |
| rc = snprintf(name, NAMESZ, "%du", busnum); |
| if (rc <= 0 || rc >= NAMESZ) |
| goto err_print_u; |
| - d = debugfs_create_file(name, 0600, mon_dir, mbus, &mon_fops_text_u); |
| - if (d == NULL) |
| - goto err_create_u; |
| - mbus->dent_u = d; |
| + mbus->dent_u = debugfs_create_file(name, 0600, mon_dir, mbus, |
| + &mon_fops_text_u); |
| |
| rc = snprintf(name, NAMESZ, "%ds", busnum); |
| if (rc <= 0 || rc >= NAMESZ) |
| goto err_print_s; |
| - d = debugfs_create_file(name, 0600, mon_dir, mbus, &mon_fops_stat); |
| - if (d == NULL) |
| - goto err_create_s; |
| - mbus->dent_s = d; |
| + mbus->dent_s = debugfs_create_file(name, 0600, mon_dir, mbus, |
| + &mon_fops_stat); |
| |
| return 1; |
| |
| -err_create_s: |
| err_print_s: |
| debugfs_remove(mbus->dent_u); |
| mbus->dent_u = NULL; |
| -err_create_u: |
| err_print_u: |
| if (ubus != NULL) { |
| debugfs_remove(mbus->dent_t); |
| mbus->dent_t = NULL; |
| } |
| -err_create_t: |
| err_print_t: |
| return 0; |
| } |
| @@ -756,8 +745,7 @@ int mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus) |
| void mon_text_del(struct mon_bus *mbus) |
| { |
| debugfs_remove(mbus->dent_u); |
| - if (mbus->dent_t != NULL) |
| - debugfs_remove(mbus->dent_t); |
| + debugfs_remove(mbus->dent_t); |
| debugfs_remove(mbus->dent_s); |
| } |
| |
| @@ -775,18 +763,7 @@ static void mon_text_ctor(void *mem) |
| |
| int __init mon_text_init(void) |
| { |
| - struct dentry *mondir; |
| - |
| - mondir = debugfs_create_dir("usbmon", usb_debug_root); |
| - if (IS_ERR(mondir)) { |
| - /* debugfs not available, but we can use usbmon without it */ |
| - return 0; |
| - } |
| - if (mondir == NULL) { |
| - printk(KERN_NOTICE TAG ": unable to create usbmon directory\n"); |
| - return -ENOMEM; |
| - } |
| - mon_dir = mondir; |
| + mon_dir = debugfs_create_dir("usbmon", usb_debug_root); |
| return 0; |
| } |
| |
| diff --git a/drivers/usb/mtu3/mtu3_dr.c b/drivers/usb/mtu3/mtu3_dr.c |
| index 8c3bbf732bc4..ac60e9c8564e 100644 |
| --- a/drivers/usb/mtu3/mtu3_dr.c |
| +++ b/drivers/usb/mtu3/mtu3_dr.c |
| @@ -378,10 +378,6 @@ static void ssusb_debugfs_init(struct ssusb_mtk *ssusb) |
| struct dentry *root; |
| |
| root = debugfs_create_dir(dev_name(ssusb->dev), usb_debug_root); |
| - if (!root) { |
| - dev_err(ssusb->dev, "create debugfs root failed\n"); |
| - return; |
| - } |
| ssusb->dbgfs_root = root; |
| |
| debugfs_create_file("mode", 0644, root, ssusb, &ssusb_mode_fops); |
| diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c |
| index 5cc64980058b..b7d56272f9d1 100644 |
| --- a/drivers/usb/musb/musb_core.c |
| +++ b/drivers/usb/musb/musb_core.c |
| @@ -2387,9 +2387,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) |
| if (status < 0) |
| goto fail3; |
| |
| - status = musb_init_debugfs(musb); |
| - if (status < 0) |
| - goto fail4; |
| + musb_init_debugfs(musb); |
| |
| status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); |
| if (status) |
| @@ -2404,7 +2402,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) |
| fail5: |
| musb_exit_debugfs(musb); |
| |
| -fail4: |
| musb_gadget_cleanup(musb); |
| musb_host_cleanup(musb); |
| |
| diff --git a/drivers/usb/musb/musb_debug.h b/drivers/usb/musb/musb_debug.h |
| index 5e0f079dde21..c444a80fe1da 100644 |
| --- a/drivers/usb/musb/musb_debug.h |
| +++ b/drivers/usb/musb/musb_debug.h |
| @@ -20,12 +20,11 @@ |
| void musb_dbg(struct musb *musb, const char *fmt, ...); |
| |
| #ifdef CONFIG_DEBUG_FS |
| -int musb_init_debugfs(struct musb *musb); |
| +void musb_init_debugfs(struct musb *musb); |
| void musb_exit_debugfs(struct musb *musb); |
| #else |
| -static inline int musb_init_debugfs(struct musb *musb) |
| +static inline void musb_init_debugfs(struct musb *musb) |
| { |
| - return 0; |
| } |
| static inline void musb_exit_debugfs(struct musb *musb) |
| { |
| diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c |
| index e2050cac3eae..f42858e2b54c 100644 |
| --- a/drivers/usb/musb/musb_debugfs.c |
| +++ b/drivers/usb/musb/musb_debugfs.c |
| @@ -321,48 +321,18 @@ static const struct file_operations musb_softconnect_fops = { |
| .release = single_release, |
| }; |
| |
| -int musb_init_debugfs(struct musb *musb) |
| +void musb_init_debugfs(struct musb *musb) |
| { |
| - struct dentry *root; |
| - struct dentry *file; |
| - int ret; |
| + struct dentry *root; |
| |
| root = debugfs_create_dir(dev_name(musb->controller), NULL); |
| - if (!root) { |
| - ret = -ENOMEM; |
| - goto err0; |
| - } |
| - |
| - file = debugfs_create_file("regdump", S_IRUGO, root, musb, |
| - &musb_regdump_fops); |
| - if (!file) { |
| - ret = -ENOMEM; |
| - goto err1; |
| - } |
| - |
| - file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, |
| - root, musb, &musb_test_mode_fops); |
| - if (!file) { |
| - ret = -ENOMEM; |
| - goto err1; |
| - } |
| - |
| - file = debugfs_create_file("softconnect", S_IRUGO | S_IWUSR, |
| - root, musb, &musb_softconnect_fops); |
| - if (!file) { |
| - ret = -ENOMEM; |
| - goto err1; |
| - } |
| - |
| musb->debugfs_root = root; |
| |
| - return 0; |
| - |
| -err1: |
| - debugfs_remove_recursive(root); |
| - |
| -err0: |
| - return ret; |
| + debugfs_create_file("regdump", S_IRUGO, root, musb, &musb_regdump_fops); |
| + debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, musb, |
| + &musb_test_mode_fops); |
| + debugfs_create_file("softconnect", S_IRUGO | S_IWUSR, root, musb, |
| + &musb_softconnect_fops); |
| } |
| |
| void /* __init_or_exit */ musb_exit_debugfs(struct musb *musb) |
| diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c |
| index cfe6bfcbeb5d..fb871eabcc10 100644 |
| --- a/drivers/usb/musb/musb_dsps.c |
| +++ b/drivers/usb/musb/musb_dsps.c |
| @@ -399,24 +399,17 @@ static irqreturn_t dsps_interrupt(int irq, void *hci) |
| static int dsps_musb_dbg_init(struct musb *musb, struct dsps_glue *glue) |
| { |
| struct dentry *root; |
| - struct dentry *file; |
| char buf[128]; |
| |
| sprintf(buf, "%s.dsps", dev_name(musb->controller)); |
| root = debugfs_create_dir(buf, NULL); |
| - if (!root) |
| - return -ENOMEM; |
| glue->dbgfs_root = root; |
| |
| glue->regset.regs = dsps_musb_regs; |
| glue->regset.nregs = ARRAY_SIZE(dsps_musb_regs); |
| glue->regset.base = musb->ctrl_base; |
| |
| - file = debugfs_create_regset32("regdump", S_IRUGO, root, &glue->regset); |
| - if (!file) { |
| - debugfs_remove_recursive(root); |
| - return -ENOMEM; |
| - } |
| + debugfs_create_regset32("regdump", S_IRUGO, root, &glue->regset); |
| return 0; |
| } |
| |
| diff --git a/drivers/usb/typec/fusb302/fusb302.c b/drivers/usb/typec/fusb302/fusb302.c |
| index 9c1eba9ea004..07b07ddf6af0 100644 |
| --- a/drivers/usb/typec/fusb302/fusb302.c |
| +++ b/drivers/usb/typec/fusb302/fusb302.c |
| @@ -117,7 +117,6 @@ struct fusb302_chip { |
| u32 snk_pdo[PDO_MAX_OBJECTS]; |
| |
| #ifdef CONFIG_DEBUG_FS |
| - struct dentry *dentry; |
| /* lock for log buffer access */ |
| struct mutex logbuffer_lock; |
| int logbuffer_head; |
| @@ -215,33 +214,26 @@ DEFINE_SHOW_ATTRIBUTE(fusb302_debug); |
| |
| static struct dentry *rootdir; |
| |
| -static int fusb302_debugfs_init(struct fusb302_chip *chip) |
| +static void fusb302_debugfs_init(struct fusb302_chip *chip) |
| { |
| mutex_init(&chip->logbuffer_lock); |
| - if (!rootdir) { |
| + if (!rootdir) |
| rootdir = debugfs_create_dir("fusb302", NULL); |
| - if (!rootdir) |
| - return -ENOMEM; |
| - } |
| - |
| - chip->dentry = debugfs_create_file(dev_name(chip->dev), |
| - S_IFREG | 0444, rootdir, |
| - chip, &fusb302_debug_fops); |
| |
| - return 0; |
| + debugfs_create_file(dev_name(chip->dev), S_IFREG | 0444, rootdir, chip, |
| + &fusb302_debug_fops); |
| } |
| |
| static void fusb302_debugfs_exit(struct fusb302_chip *chip) |
| { |
| - debugfs_remove(chip->dentry); |
| - debugfs_remove(rootdir); |
| + debugfs_remove_recursive(rootdir); |
| } |
| |
| #else |
| |
| static void fusb302_log(const struct fusb302_chip *chip, |
| const char *fmt, ...) { } |
| -static int fusb302_debugfs_init(const struct fusb302_chip *chip) { return 0; } |
| +static void fusb302_debugfs_init(const struct fusb302_chip *chip) { } |
| static void fusb302_debugfs_exit(const struct fusb302_chip *chip) { } |
| |
| #endif |
| @@ -1773,9 +1765,7 @@ static int fusb302_probe(struct i2c_client *client, |
| return -EPROBE_DEFER; |
| } |
| |
| - ret = fusb302_debugfs_init(chip); |
| - if (ret < 0) |
| - return ret; |
| + fusb302_debugfs_init(chip); |
| |
| chip->wq = create_singlethread_workqueue(dev_name(chip->dev)); |
| if (!chip->wq) { |
| diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c |
| index 0ccd2ce1eb59..1443b3233371 100644 |
| --- a/drivers/usb/typec/tcpm.c |
| +++ b/drivers/usb/typec/tcpm.c |
| @@ -566,15 +566,12 @@ DEFINE_SHOW_ATTRIBUTE(tcpm_debug); |
| |
| static struct dentry *rootdir; |
| |
| -static int tcpm_debugfs_init(struct tcpm_port *port) |
| +static void tcpm_debugfs_init(struct tcpm_port *port) |
| { |
| mutex_init(&port->logbuffer_lock); |
| /* /sys/kernel/debug/tcpm/usbcX */ |
| - if (!rootdir) { |
| + if (!rootdir) |
| rootdir = debugfs_create_dir("tcpm", NULL); |
| - if (!rootdir) |
| - return -ENOMEM; |
| - } |
| |
| port->dentry = debugfs_create_file(dev_name(port->dev), |
| S_IFREG | 0444, rootdir, |
| @@ -595,7 +592,7 @@ static void tcpm_log(const struct tcpm_port *port, const char *fmt, ...) { } |
| __printf(2, 3) |
| static void tcpm_log_force(struct tcpm_port *port, const char *fmt, ...) { } |
| static void tcpm_log_source_caps(struct tcpm_port *port) { } |
| -static int tcpm_debugfs_init(const struct tcpm_port *port) { return 0; } |
| +static void tcpm_debugfs_init(const struct tcpm_port *port) { return 0; } |
| static void tcpm_debugfs_exit(const struct tcpm_port *port) { } |
| |
| #endif |
| -- |
| 2.17.0 |
| |