usb: dwc3: debugfs: improve debugfs file creation
when commit 388e5c5 (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: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
4ec0ddb1b4
commit
dbfff05d7c
@ -667,28 +667,31 @@ int dwc3_debugfs_init(struct dwc3 *dwc)
|
|||||||
goto err1;
|
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,
|
file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root,
|
||||||
dwc, &dwc3_mode_fops);
|
dwc, &dwc3_mode_fops);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto err1;
|
goto err1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root,
|
if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) ||
|
||||||
dwc, &dwc3_testmode_fops);
|
IS_ENABLED(CONFIG_USB_DWC3_GADGET)) {
|
||||||
if (!file) {
|
file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root,
|
||||||
ret = -ENOMEM;
|
dwc, &dwc3_testmode_fops);
|
||||||
goto err1;
|
if (!file) {
|
||||||
}
|
ret = -ENOMEM;
|
||||||
|
goto err1;
|
||||||
|
}
|
||||||
|
|
||||||
file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root,
|
file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root,
|
||||||
dwc, &dwc3_link_state_fops);
|
dwc, &dwc3_link_state_fops);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto err1;
|
goto err1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user