Loading drivers/usb/gadget/function/u_data_bridge.c +43 −1 Original line number Diff line number Diff line /* * Copyright (c) 2011, 2013-2015, The Linux Foundation. All rights reserved. * Copyright (c) 2011, 2013-2016, The Linux Foundation. All rights reserved. * Linux Foundation chooses to take subject only to the GPLv2 license terms, * and distributes only under these terms. * Loading Loading @@ -818,6 +818,40 @@ static ssize_t debug_gbridge_reset_stats(struct file *file, return count; } static ssize_t gbridge_rw_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { struct gbridge_port *ui_dev = ports[0]; struct gserial *gser; struct usb_function *func; struct usb_gadget *gadget; if (!ui_dev) { pr_err("%s ui_dev is NULL\n", __func__); return -EINVAL; } gser = ui_dev->port_usb; if (!gser) { pr_err("%s gser is NULL\n", __func__); return -EINVAL; } func = &gser->func; if (!func) { pr_err("%s func is NULL\n", __func__); return -EINVAL; } gadget = gser->func.config->cdev->gadget; if ((gadget->speed == USB_SPEED_SUPER) && (func->func_is_suspended)) { pr_debug("%s Calling usb_func_wakeup\n", __func__); usb_func_wakeup(func); } return count; } static int debug_gbridge_open(struct inode *inode, struct file *file) { return 0; Loading @@ -829,6 +863,11 @@ static const struct file_operations debug_gbridge_ops = { .write = debug_gbridge_reset_stats, }; const struct file_operations gbridge_rem_wakeup_fops = { .open = debug_gbridge_open, .write = gbridge_rw_write, }; static void gbridge_debugfs_init(void) { struct dentry *dent; Loading @@ -838,7 +877,10 @@ static void gbridge_debugfs_init(void) return; debugfs_create_file("status", 0444, dent, 0, &debug_gbridge_ops); debugfs_create_file("remote_wakeup", S_IWUSR, dent, 0, &gbridge_rem_wakeup_fops); } #else static void gbridge_debugfs_init(void) {} #endif Loading drivers/usb/gadget/function/u_serial.c +43 −4 Original line number Diff line number Diff line Loading @@ -1355,6 +1355,45 @@ const struct file_operations debug_adb_ops = { .read = debug_read_status, }; static ssize_t usb_gser_rw_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { struct gs_port *ui_dev = file->private_data; struct gserial *gser; struct usb_function *func; struct usb_gadget *gadget; if (!ui_dev) { pr_err("%s ui_dev is NULL\n", __func__); return -EINVAL; } gser = ui_dev->port_usb; if (!gser) { pr_err("%s gser is NULL\n", __func__); return -EINVAL; } func = &gser->func; if (!func) { pr_err("%s func is NULL\n", __func__); return -EINVAL; } gadget = gser->func.config->cdev->gadget; if ((gadget->speed == USB_SPEED_SUPER) && (func->func_is_suspended)) { pr_debug("%s Calling usb_func_wakeup\n", __func__); usb_func_wakeup(func); } return count; } const struct file_operations debug_rem_wakeup_fops = { .open = serial_debug_open, .write = usb_gser_rw_write, }; struct dentry *gs_dent; static void usb_debugfs_init(struct gs_port *ui_dev, int port_num) { Loading @@ -1372,6 +1411,8 @@ static void usb_debugfs_init(struct gs_port *ui_dev, int port_num) &debug_adb_ops); debugfs_create_file("reset", S_IRUGO | S_IWUSR, gs_dent, ui_dev, &debug_rst_ops); debugfs_create_file("remote_wakeup", S_IWUSR, gs_dent, ui_dev, &debug_rem_wakeup_fops); } static void usb_debugfs_remove(void) Loading Loading @@ -1407,6 +1448,7 @@ void gserial_free_line(unsigned char port_num) { struct gs_port *port; usb_debugfs_remove(); mutex_lock(&ports[port_num].lock); if (WARN_ON(!ports[port_num].port)) { mutex_unlock(&ports[port_num].lock); Loading Loading @@ -1439,6 +1481,7 @@ int gserial_alloc_line(unsigned char *line_num) continue; if (ret) return ret; usb_debugfs_init(ports[port_num].port, port_num); break; } if (ret) Loading Loading @@ -1661,9 +1704,6 @@ static int userial_init(void) goto fail; } for (i = 0; i < MAX_U_SERIAL_PORTS; i++) usb_debugfs_init(ports[i].port, i); pr_debug("%s: registered %d ttyGS* device%s\n", __func__, MAX_U_SERIAL_PORTS, (MAX_U_SERIAL_PORTS == 1) ? "" : "s"); Loading @@ -1680,7 +1720,6 @@ module_init(userial_init); static void userial_cleanup(void) { usb_debugfs_remove(); destroy_workqueue(gserial_wq); tty_unregister_driver(gs_tty_driver); put_tty_driver(gs_tty_driver); Loading Loading
drivers/usb/gadget/function/u_data_bridge.c +43 −1 Original line number Diff line number Diff line /* * Copyright (c) 2011, 2013-2015, The Linux Foundation. All rights reserved. * Copyright (c) 2011, 2013-2016, The Linux Foundation. All rights reserved. * Linux Foundation chooses to take subject only to the GPLv2 license terms, * and distributes only under these terms. * Loading Loading @@ -818,6 +818,40 @@ static ssize_t debug_gbridge_reset_stats(struct file *file, return count; } static ssize_t gbridge_rw_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { struct gbridge_port *ui_dev = ports[0]; struct gserial *gser; struct usb_function *func; struct usb_gadget *gadget; if (!ui_dev) { pr_err("%s ui_dev is NULL\n", __func__); return -EINVAL; } gser = ui_dev->port_usb; if (!gser) { pr_err("%s gser is NULL\n", __func__); return -EINVAL; } func = &gser->func; if (!func) { pr_err("%s func is NULL\n", __func__); return -EINVAL; } gadget = gser->func.config->cdev->gadget; if ((gadget->speed == USB_SPEED_SUPER) && (func->func_is_suspended)) { pr_debug("%s Calling usb_func_wakeup\n", __func__); usb_func_wakeup(func); } return count; } static int debug_gbridge_open(struct inode *inode, struct file *file) { return 0; Loading @@ -829,6 +863,11 @@ static const struct file_operations debug_gbridge_ops = { .write = debug_gbridge_reset_stats, }; const struct file_operations gbridge_rem_wakeup_fops = { .open = debug_gbridge_open, .write = gbridge_rw_write, }; static void gbridge_debugfs_init(void) { struct dentry *dent; Loading @@ -838,7 +877,10 @@ static void gbridge_debugfs_init(void) return; debugfs_create_file("status", 0444, dent, 0, &debug_gbridge_ops); debugfs_create_file("remote_wakeup", S_IWUSR, dent, 0, &gbridge_rem_wakeup_fops); } #else static void gbridge_debugfs_init(void) {} #endif Loading
drivers/usb/gadget/function/u_serial.c +43 −4 Original line number Diff line number Diff line Loading @@ -1355,6 +1355,45 @@ const struct file_operations debug_adb_ops = { .read = debug_read_status, }; static ssize_t usb_gser_rw_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) { struct gs_port *ui_dev = file->private_data; struct gserial *gser; struct usb_function *func; struct usb_gadget *gadget; if (!ui_dev) { pr_err("%s ui_dev is NULL\n", __func__); return -EINVAL; } gser = ui_dev->port_usb; if (!gser) { pr_err("%s gser is NULL\n", __func__); return -EINVAL; } func = &gser->func; if (!func) { pr_err("%s func is NULL\n", __func__); return -EINVAL; } gadget = gser->func.config->cdev->gadget; if ((gadget->speed == USB_SPEED_SUPER) && (func->func_is_suspended)) { pr_debug("%s Calling usb_func_wakeup\n", __func__); usb_func_wakeup(func); } return count; } const struct file_operations debug_rem_wakeup_fops = { .open = serial_debug_open, .write = usb_gser_rw_write, }; struct dentry *gs_dent; static void usb_debugfs_init(struct gs_port *ui_dev, int port_num) { Loading @@ -1372,6 +1411,8 @@ static void usb_debugfs_init(struct gs_port *ui_dev, int port_num) &debug_adb_ops); debugfs_create_file("reset", S_IRUGO | S_IWUSR, gs_dent, ui_dev, &debug_rst_ops); debugfs_create_file("remote_wakeup", S_IWUSR, gs_dent, ui_dev, &debug_rem_wakeup_fops); } static void usb_debugfs_remove(void) Loading Loading @@ -1407,6 +1448,7 @@ void gserial_free_line(unsigned char port_num) { struct gs_port *port; usb_debugfs_remove(); mutex_lock(&ports[port_num].lock); if (WARN_ON(!ports[port_num].port)) { mutex_unlock(&ports[port_num].lock); Loading Loading @@ -1439,6 +1481,7 @@ int gserial_alloc_line(unsigned char *line_num) continue; if (ret) return ret; usb_debugfs_init(ports[port_num].port, port_num); break; } if (ret) Loading Loading @@ -1661,9 +1704,6 @@ static int userial_init(void) goto fail; } for (i = 0; i < MAX_U_SERIAL_PORTS; i++) usb_debugfs_init(ports[i].port, i); pr_debug("%s: registered %d ttyGS* device%s\n", __func__, MAX_U_SERIAL_PORTS, (MAX_U_SERIAL_PORTS == 1) ? "" : "s"); Loading @@ -1680,7 +1720,6 @@ module_init(userial_init); static void userial_cleanup(void) { usb_debugfs_remove(); destroy_workqueue(gserial_wq); tty_unregister_driver(gs_tty_driver); put_tty_driver(gs_tty_driver); Loading