Loading drivers/usb/gadget/function/f_cdev.c +10 −14 Original line number Diff line number Diff line /* * Copyright (c) 2011, 2013-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2011, 2013-2019, 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 @@ -136,6 +136,8 @@ struct f_cdev { unsigned long nbytes_to_port_bridge; unsigned long nbytes_from_port_bridge; struct dentry *debugfs_root; /* To test remote wakeup using debugfs */ u8 debugfs_rw_enable; }; Loading @@ -147,12 +149,6 @@ struct f_cdev_opts { u8 port_num; }; struct usb_cser_debugfs { struct dentry *debugfs_root; }; static struct usb_cser_debugfs debugfs; static int major, minors; struct class *fcdev_classp; static DEFINE_IDA(chardev_ida); Loading @@ -165,7 +161,7 @@ static int usb_cser_connect(struct f_cdev *port); static void usb_cser_disconnect(struct f_cdev *port); static struct f_cdev *f_cdev_alloc(char *func_name, int portno); static void usb_cser_free_req(struct usb_ep *ep, struct usb_request *req); static void usb_cser_debugfs_exit(void); static void usb_cser_debugfs_exit(struct f_cdev *port); static struct usb_interface_descriptor cser_interface_desc = { .bLength = USB_DT_INTERFACE_SIZE, Loading Loading @@ -883,9 +879,9 @@ static void cser_free_inst(struct usb_function_instance *fi) if (opts->port) { device_destroy(fcdev_classp, MKDEV(major, opts->port->minor)); cdev_del(&opts->port->fcdev_cdev); usb_cser_debugfs_exit(opts->port); } usb_cser_chardev_deinit(); usb_cser_debugfs_exit(); kfree(opts->func_name); kfree(opts->port); kfree(opts); Loading Loading @@ -1703,17 +1699,17 @@ static const struct file_operations cser_rem_wakeup_fops = { static void usb_cser_debugfs_init(struct f_cdev *port) { debugfs.debugfs_root = debugfs_create_dir(port->name, NULL); if (IS_ERR(debugfs.debugfs_root)) port->debugfs_root = debugfs_create_dir(port->name, NULL); if (IS_ERR(port->debugfs_root)) return; debugfs_create_file("remote_wakeup", 0600, debugfs.debugfs_root, port, &cser_rem_wakeup_fops); port->debugfs_root, port, &cser_rem_wakeup_fops); } static void usb_cser_debugfs_exit(void) static void usb_cser_debugfs_exit(struct f_cdev *port) { debugfs_remove_recursive(debugfs.debugfs_root); debugfs_remove_recursive(port->debugfs_root); } static struct f_cdev *f_cdev_alloc(char *func_name, int portno) Loading Loading
drivers/usb/gadget/function/f_cdev.c +10 −14 Original line number Diff line number Diff line /* * Copyright (c) 2011, 2013-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2011, 2013-2019, 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 @@ -136,6 +136,8 @@ struct f_cdev { unsigned long nbytes_to_port_bridge; unsigned long nbytes_from_port_bridge; struct dentry *debugfs_root; /* To test remote wakeup using debugfs */ u8 debugfs_rw_enable; }; Loading @@ -147,12 +149,6 @@ struct f_cdev_opts { u8 port_num; }; struct usb_cser_debugfs { struct dentry *debugfs_root; }; static struct usb_cser_debugfs debugfs; static int major, minors; struct class *fcdev_classp; static DEFINE_IDA(chardev_ida); Loading @@ -165,7 +161,7 @@ static int usb_cser_connect(struct f_cdev *port); static void usb_cser_disconnect(struct f_cdev *port); static struct f_cdev *f_cdev_alloc(char *func_name, int portno); static void usb_cser_free_req(struct usb_ep *ep, struct usb_request *req); static void usb_cser_debugfs_exit(void); static void usb_cser_debugfs_exit(struct f_cdev *port); static struct usb_interface_descriptor cser_interface_desc = { .bLength = USB_DT_INTERFACE_SIZE, Loading Loading @@ -883,9 +879,9 @@ static void cser_free_inst(struct usb_function_instance *fi) if (opts->port) { device_destroy(fcdev_classp, MKDEV(major, opts->port->minor)); cdev_del(&opts->port->fcdev_cdev); usb_cser_debugfs_exit(opts->port); } usb_cser_chardev_deinit(); usb_cser_debugfs_exit(); kfree(opts->func_name); kfree(opts->port); kfree(opts); Loading Loading @@ -1703,17 +1699,17 @@ static const struct file_operations cser_rem_wakeup_fops = { static void usb_cser_debugfs_init(struct f_cdev *port) { debugfs.debugfs_root = debugfs_create_dir(port->name, NULL); if (IS_ERR(debugfs.debugfs_root)) port->debugfs_root = debugfs_create_dir(port->name, NULL); if (IS_ERR(port->debugfs_root)) return; debugfs_create_file("remote_wakeup", 0600, debugfs.debugfs_root, port, &cser_rem_wakeup_fops); port->debugfs_root, port, &cser_rem_wakeup_fops); } static void usb_cser_debugfs_exit(void) static void usb_cser_debugfs_exit(struct f_cdev *port) { debugfs_remove_recursive(debugfs.debugfs_root); debugfs_remove_recursive(port->debugfs_root); } static struct f_cdev *f_cdev_alloc(char *func_name, int portno) Loading