diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-29 10:37:40 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-29 10:37:40 +0200 |
| commit | ffad0c8695eb61e151a1095cb140b7c804f7b889 (patch) | |
| tree | f2a91928d3365c74b0b7257a95ce9f490c9fd49f /usb-debugfs.patch | |
| parent | 4f5efdd3c8ea0888db32f21f3bde0d3c9a144dac (diff) | |
| download | patches-ffad0c8695eb61e151a1095cb140b7c804f7b889.tar.gz | |
new usb patches
Diffstat (limited to 'usb-debugfs.patch')
| -rw-r--r-- | usb-debugfs.patch | 476 |
1 files changed, 476 insertions, 0 deletions
diff --git a/usb-debugfs.patch b/usb-debugfs.patch new file mode 100644 index 00000000000000..79ef25f0ea42d2 --- /dev/null +++ b/usb-debugfs.patch @@ -0,0 +1,476 @@ +--- + 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 | 33 +++--------------- + drivers/usb/host/ehci-dbg.c | 30 ++++------------ + drivers/usb/mon/mon_text.c | 37 +++----------------- + 8 files changed, 60 insertions(+), 206 deletions(-) + +--- a/drivers/usb/chipidea/ci.h ++++ b/drivers/usb/chipidea/ci.h +@@ -450,7 +450,7 @@ void hw_phymode_configure(struct ci_hdrc + + 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 */ +--- a/drivers/usb/chipidea/core.c ++++ b/drivers/usb/chipidea/core.c +@@ -1062,9 +1062,7 @@ static int ci_hdrc_probe(struct platform + 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) +--- 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); + } + + /** +--- 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); +--- a/drivers/usb/dwc2/debugfs.c ++++ b/drivers/usb/dwc2/debugfs.c +@@ -293,52 +293,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 +@@ -790,32 +768,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); +@@ -824,24 +784,18 @@ int dwc2_debugfs_init(struct dwc2_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; + } + +--- a/drivers/usb/dwc3/debugfs.c ++++ b/drivers/usb/dwc3/debugfs.c +@@ -716,9 +716,6 @@ static void dwc3_debugfs_create_endpoint + 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,14 +737,8 @@ static void dwc3_debugfs_create_endpoint + 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); +@@ -760,29 +751,19 @@ void dwc3_debugfs_init(struct dwc3 *dwc) + 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"); ++ 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); + } + } +--- a/drivers/usb/host/ehci-dbg.c ++++ b/drivers/usb/host/ehci-dbg.c +@@ -1028,29 +1028,15 @@ static inline void create_debug_files(st + 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) +--- a/drivers/usb/mon/mon_text.c ++++ b/drivers/usb/mon/mon_text.c +@@ -700,7 +700,6 @@ static const struct file_operations mon_ + + 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, c + 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 @@ err_print_t: + 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; + } + |
