Commit dbfff05d authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: debugfs: improve debugfs file creation

when commit 388e5c51 (usb: dwc3: remove dwc3
dependency on host AND gadget.) changed the
way debugfs files are created, it failed to
note that 'mode' is necessary in Dual Role
mode only while 'testmode' and 'link_state'
are valid in Dual Role and Peripheral-only
builds. Fix this while also converting pre-
processor conditional to C conditionals.
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 4ec0ddb1
......@@ -667,14 +667,17 @@ int dwc3_debugfs_init(struct dwc3 *dwc)
goto err1;
}
#if IS_ENABLED(CONFIG_USB_DWC3_GADGET)
if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) {
file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root,
dwc, &dwc3_mode_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
}
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) {
......@@ -688,7 +691,7 @@ int dwc3_debugfs_init(struct dwc3 *dwc)
ret = -ENOMEM;
goto err1;
}
#endif
}
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment