Loading drivers/usb/gadget/function/f_qdss.c +33 −26 Original line number Diff line number Diff line Loading @@ -225,7 +225,7 @@ static void qdss_write_complete(struct usb_ep *ep, enum qdss_state state; unsigned long flags; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); if (qdss->debug_inface_enabled) { in = qdss->port.ctrl_in; Loading Loading @@ -259,7 +259,7 @@ static void qdss_ctrl_read_complete(struct usb_ep *ep, struct qdss_request *d_req = req->context; unsigned long flags; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); d_req->actual = req->actual; d_req->status = req->status; Loading @@ -279,14 +279,14 @@ void usb_qdss_free_req(struct usb_qdss_ch *ch) struct usb_request *req; struct list_head *act, *tmp; pr_debug("%s\n", __func__); qdss = ch->priv_usb; if (!qdss) { pr_err("%s: qdss ctx is NULL\n", __func__); return; } qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); list_for_each_safe(act, tmp, &qdss->data_write_pool) { req = list_entry(act, struct usb_request, list); list_del(&req->list); Loading Loading @@ -316,7 +316,7 @@ int usb_qdss_alloc_req(struct usb_qdss_ch *ch, int no_write_buf, struct list_head *list_pool; int i; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); if (!qdss) { pr_err("%s: %s closed\n", __func__, ch->name); Loading Loading @@ -371,7 +371,7 @@ static void clear_eps(struct usb_function *f) { struct f_qdss *qdss = func_to_qdss(f); pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); if (qdss->port.ctrl_in) qdss->port.ctrl_in->driver_data = NULL; Loading @@ -383,7 +383,9 @@ static void clear_eps(struct usb_function *f) static void clear_desc(struct usb_gadget *gadget, struct usb_function *f) { pr_debug("%s\n", __func__); struct f_qdss *qdss = func_to_qdss(f); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); usb_free_all_descriptors(f); } Loading @@ -395,7 +397,7 @@ static int qdss_bind(struct usb_configuration *c, struct usb_function *f) struct usb_ep *ep; int iface, id, ret; pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); /* Allocate data I/F */ iface = usb_interface_id(c, f); Loading Loading @@ -529,7 +531,7 @@ static void qdss_unbind(struct usb_configuration *c, struct usb_function *f) struct f_qdss *qdss = func_to_qdss(f); struct usb_gadget *gadget = c->cdev->gadget; pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); flush_workqueue(qdss->wq); Loading @@ -553,7 +555,7 @@ static void qdss_eps_disable(struct usb_function *f) { struct f_qdss *qdss = func_to_qdss(f); pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); if (qdss->ctrl_in_enabled) { usb_ep_disable(qdss->port.ctrl_in); Loading @@ -578,7 +580,7 @@ static void usb_qdss_disconnect_work(struct work_struct *work) int status; qdss = container_of(work, struct f_qdss, disconnect_w); pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); /* Notify qdss to cancel all active transfers */ Loading Loading @@ -611,7 +613,7 @@ static void qdss_disable(struct usb_function *f) struct f_qdss *qdss = func_to_qdss(f); unsigned long flags; pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); spin_lock_irqsave(&qdss->lock, flags); if (!qdss->usb_connected) { spin_unlock_irqrestore(&qdss->lock, flags); Loading @@ -636,12 +638,12 @@ static void usb_qdss_connect_work(struct work_struct *work) /* If cable is already removed, discard connect_work */ if (qdss->usb_connected == 0) { pr_debug("%s: discard connect_work\n", __func__); qdss_log("%s: discard connect_work\n", __func__); cancel_work_sync(&qdss->disconnect_w); return; } pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); if (!strcmp(qdss->ch.name, USB_QDSS_CH_MDM)) goto notify; Loading Loading @@ -678,7 +680,7 @@ static int qdss_set_alt(struct usb_function *f, unsigned int intf, struct usb_qdss_ch *ch = &qdss->ch; int ret = 0; pr_debug("%s qdss pointer = %pK\n", __func__, qdss); qdss_log("%s qdss pointer = %pK\n", __func__, qdss); qdss->gadget = gadget; if (alt != 0) Loading Loading @@ -744,12 +746,12 @@ static int qdss_set_alt(struct usb_function *f, unsigned int intf, if (qdss->ctrl_out_enabled && qdss->ctrl_in_enabled && qdss->data_enabled) { qdss->usb_connected = 1; pr_debug("%s usb_connected INTF enabled\n", __func__); qdss_log("%s usb_connected INTF enabled\n", __func__); } } else { if (qdss->data_enabled) { qdss->usb_connected = 1; pr_debug("%s usb_connected INTF disabled\n", __func__); qdss_log("%s usb_connected INTF disabled\n", __func__); } } Loading Loading @@ -824,7 +826,7 @@ int usb_qdss_ctrl_read(struct usb_qdss_ch *ch, struct qdss_request *d_req) unsigned long flags; struct usb_request *req = NULL; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); if (!qdss) return -ENODEV; Loading Loading @@ -869,7 +871,7 @@ int usb_qdss_ctrl_write(struct usb_qdss_ch *ch, struct qdss_request *d_req) unsigned long flags; struct usb_request *req = NULL; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); if (!qdss) return -ENODEV; Loading Loading @@ -913,7 +915,7 @@ int usb_qdss_write(struct usb_qdss_ch *ch, struct qdss_request *d_req) unsigned long flags; struct usb_request *req = NULL; pr_debug("usb_qdss_data_write\n"); qdss_log("usb_qdss_data_write\n"); if (!qdss) return -ENODEV; Loading Loading @@ -966,7 +968,7 @@ struct usb_qdss_ch *usb_qdss_open(const char *name, void *priv, unsigned long flags; int found = 0; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); if (!notify) { pr_err("%s: notification func is missing\n", __func__); Loading @@ -984,11 +986,11 @@ struct usb_qdss_ch *usb_qdss_open(const char *name, void *priv, if (!found) { spin_unlock_irqrestore(&qdss_lock, flags); pr_debug("%s failed as %s not found\n", __func__, name); qdss_log("%s failed as %s not found\n", __func__, name); return NULL; } pr_debug("%s: qdss ctx found\n", __func__); qdss_log("%s: qdss ctx found\n", __func__); qdss = container_of(ch, struct f_qdss, ch); ch->priv_usb = qdss; ch->priv = priv; Loading @@ -1014,7 +1016,7 @@ void usb_qdss_close(struct usb_qdss_ch *ch) struct usb_request *req; struct qdss_request *d_req; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); spin_lock_irqsave(&qdss_lock, flags); if (!qdss) Loading Loading @@ -1065,7 +1067,7 @@ static void qdss_cleanup(void) struct usb_qdss_ch *_ch; unsigned long flags; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); list_for_each_safe(act, tmp, &usb_qdss_ch_list) { _ch = list_entry(act, struct usb_qdss_ch, list); Loading Loading @@ -1177,7 +1179,7 @@ static int usb_qdss_set_inst_name(struct usb_function_instance *f, } opts->channel_name = ptr; pr_debug("qdss: channel_name:%s\n", opts->channel_name); qdss_log("qdss: channel_name:%s\n", opts->channel_name); usb_qdss = alloc_usb_qdss(opts->channel_name); if (IS_ERR(usb_qdss)) { Loading Loading @@ -1230,6 +1232,10 @@ static int __init usb_qdss_init(void) { int ret; _qdss_ipc_log = ipc_log_context_create(NUM_PAGES, "usb_qdss", 0); if (IS_ERR_OR_NULL(_qdss_ipc_log)) _qdss_ipc_log = NULL; INIT_LIST_HEAD(&usb_qdss_ch_list); ret = usb_function_register(&qdssusb_func); if (ret) { Loading @@ -1241,6 +1247,7 @@ static int __init usb_qdss_init(void) static void __exit usb_qdss_exit(void) { ipc_log_context_destroy(_qdss_ipc_log); usb_function_unregister(&qdssusb_func); qdss_cleanup(); } Loading drivers/usb/gadget/function/f_qdss.h +15 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ #define _F_QDSS_H #include <linux/kernel.h> #include <linux/ipc_logging.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> #include <linux/usb/composite.h> Loading Loading @@ -66,6 +67,20 @@ struct f_qdss { bool qdss_close; }; static void *_qdss_ipc_log; #define NUM_PAGES 10 /* # of pages for ipc logging */ #ifdef CONFIG_DYNAMIC_DEBUG #define qdss_log(fmt, ...) do { \ ipc_log_string(_qdss_ipc_log, "%s: " fmt, __func__, ##__VA_ARGS__); \ dynamic_pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \ } while (0) #else #define qdss_log(fmt, ...) \ ipc_log_string(_qdss_ipc_log, "%s: " fmt, __func__, ##__VA_ARGS__) #endif struct usb_qdss_opts { struct usb_function_instance func_inst; struct f_qdss *usb_qdss; Loading Loading
drivers/usb/gadget/function/f_qdss.c +33 −26 Original line number Diff line number Diff line Loading @@ -225,7 +225,7 @@ static void qdss_write_complete(struct usb_ep *ep, enum qdss_state state; unsigned long flags; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); if (qdss->debug_inface_enabled) { in = qdss->port.ctrl_in; Loading Loading @@ -259,7 +259,7 @@ static void qdss_ctrl_read_complete(struct usb_ep *ep, struct qdss_request *d_req = req->context; unsigned long flags; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); d_req->actual = req->actual; d_req->status = req->status; Loading @@ -279,14 +279,14 @@ void usb_qdss_free_req(struct usb_qdss_ch *ch) struct usb_request *req; struct list_head *act, *tmp; pr_debug("%s\n", __func__); qdss = ch->priv_usb; if (!qdss) { pr_err("%s: qdss ctx is NULL\n", __func__); return; } qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); list_for_each_safe(act, tmp, &qdss->data_write_pool) { req = list_entry(act, struct usb_request, list); list_del(&req->list); Loading Loading @@ -316,7 +316,7 @@ int usb_qdss_alloc_req(struct usb_qdss_ch *ch, int no_write_buf, struct list_head *list_pool; int i; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); if (!qdss) { pr_err("%s: %s closed\n", __func__, ch->name); Loading Loading @@ -371,7 +371,7 @@ static void clear_eps(struct usb_function *f) { struct f_qdss *qdss = func_to_qdss(f); pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); if (qdss->port.ctrl_in) qdss->port.ctrl_in->driver_data = NULL; Loading @@ -383,7 +383,9 @@ static void clear_eps(struct usb_function *f) static void clear_desc(struct usb_gadget *gadget, struct usb_function *f) { pr_debug("%s\n", __func__); struct f_qdss *qdss = func_to_qdss(f); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); usb_free_all_descriptors(f); } Loading @@ -395,7 +397,7 @@ static int qdss_bind(struct usb_configuration *c, struct usb_function *f) struct usb_ep *ep; int iface, id, ret; pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); /* Allocate data I/F */ iface = usb_interface_id(c, f); Loading Loading @@ -529,7 +531,7 @@ static void qdss_unbind(struct usb_configuration *c, struct usb_function *f) struct f_qdss *qdss = func_to_qdss(f); struct usb_gadget *gadget = c->cdev->gadget; pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); flush_workqueue(qdss->wq); Loading @@ -553,7 +555,7 @@ static void qdss_eps_disable(struct usb_function *f) { struct f_qdss *qdss = func_to_qdss(f); pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); if (qdss->ctrl_in_enabled) { usb_ep_disable(qdss->port.ctrl_in); Loading @@ -578,7 +580,7 @@ static void usb_qdss_disconnect_work(struct work_struct *work) int status; qdss = container_of(work, struct f_qdss, disconnect_w); pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); /* Notify qdss to cancel all active transfers */ Loading Loading @@ -611,7 +613,7 @@ static void qdss_disable(struct usb_function *f) struct f_qdss *qdss = func_to_qdss(f); unsigned long flags; pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); spin_lock_irqsave(&qdss->lock, flags); if (!qdss->usb_connected) { spin_unlock_irqrestore(&qdss->lock, flags); Loading @@ -636,12 +638,12 @@ static void usb_qdss_connect_work(struct work_struct *work) /* If cable is already removed, discard connect_work */ if (qdss->usb_connected == 0) { pr_debug("%s: discard connect_work\n", __func__); qdss_log("%s: discard connect_work\n", __func__); cancel_work_sync(&qdss->disconnect_w); return; } pr_debug("%s\n", __func__); qdss_log("%s: channel name = %s\n", __func__, qdss->ch.name); if (!strcmp(qdss->ch.name, USB_QDSS_CH_MDM)) goto notify; Loading Loading @@ -678,7 +680,7 @@ static int qdss_set_alt(struct usb_function *f, unsigned int intf, struct usb_qdss_ch *ch = &qdss->ch; int ret = 0; pr_debug("%s qdss pointer = %pK\n", __func__, qdss); qdss_log("%s qdss pointer = %pK\n", __func__, qdss); qdss->gadget = gadget; if (alt != 0) Loading Loading @@ -744,12 +746,12 @@ static int qdss_set_alt(struct usb_function *f, unsigned int intf, if (qdss->ctrl_out_enabled && qdss->ctrl_in_enabled && qdss->data_enabled) { qdss->usb_connected = 1; pr_debug("%s usb_connected INTF enabled\n", __func__); qdss_log("%s usb_connected INTF enabled\n", __func__); } } else { if (qdss->data_enabled) { qdss->usb_connected = 1; pr_debug("%s usb_connected INTF disabled\n", __func__); qdss_log("%s usb_connected INTF disabled\n", __func__); } } Loading Loading @@ -824,7 +826,7 @@ int usb_qdss_ctrl_read(struct usb_qdss_ch *ch, struct qdss_request *d_req) unsigned long flags; struct usb_request *req = NULL; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); if (!qdss) return -ENODEV; Loading Loading @@ -869,7 +871,7 @@ int usb_qdss_ctrl_write(struct usb_qdss_ch *ch, struct qdss_request *d_req) unsigned long flags; struct usb_request *req = NULL; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); if (!qdss) return -ENODEV; Loading Loading @@ -913,7 +915,7 @@ int usb_qdss_write(struct usb_qdss_ch *ch, struct qdss_request *d_req) unsigned long flags; struct usb_request *req = NULL; pr_debug("usb_qdss_data_write\n"); qdss_log("usb_qdss_data_write\n"); if (!qdss) return -ENODEV; Loading Loading @@ -966,7 +968,7 @@ struct usb_qdss_ch *usb_qdss_open(const char *name, void *priv, unsigned long flags; int found = 0; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); if (!notify) { pr_err("%s: notification func is missing\n", __func__); Loading @@ -984,11 +986,11 @@ struct usb_qdss_ch *usb_qdss_open(const char *name, void *priv, if (!found) { spin_unlock_irqrestore(&qdss_lock, flags); pr_debug("%s failed as %s not found\n", __func__, name); qdss_log("%s failed as %s not found\n", __func__, name); return NULL; } pr_debug("%s: qdss ctx found\n", __func__); qdss_log("%s: qdss ctx found\n", __func__); qdss = container_of(ch, struct f_qdss, ch); ch->priv_usb = qdss; ch->priv = priv; Loading @@ -1014,7 +1016,7 @@ void usb_qdss_close(struct usb_qdss_ch *ch) struct usb_request *req; struct qdss_request *d_req; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); spin_lock_irqsave(&qdss_lock, flags); if (!qdss) Loading Loading @@ -1065,7 +1067,7 @@ static void qdss_cleanup(void) struct usb_qdss_ch *_ch; unsigned long flags; pr_debug("%s\n", __func__); qdss_log("%s\n", __func__); list_for_each_safe(act, tmp, &usb_qdss_ch_list) { _ch = list_entry(act, struct usb_qdss_ch, list); Loading Loading @@ -1177,7 +1179,7 @@ static int usb_qdss_set_inst_name(struct usb_function_instance *f, } opts->channel_name = ptr; pr_debug("qdss: channel_name:%s\n", opts->channel_name); qdss_log("qdss: channel_name:%s\n", opts->channel_name); usb_qdss = alloc_usb_qdss(opts->channel_name); if (IS_ERR(usb_qdss)) { Loading Loading @@ -1230,6 +1232,10 @@ static int __init usb_qdss_init(void) { int ret; _qdss_ipc_log = ipc_log_context_create(NUM_PAGES, "usb_qdss", 0); if (IS_ERR_OR_NULL(_qdss_ipc_log)) _qdss_ipc_log = NULL; INIT_LIST_HEAD(&usb_qdss_ch_list); ret = usb_function_register(&qdssusb_func); if (ret) { Loading @@ -1241,6 +1247,7 @@ static int __init usb_qdss_init(void) static void __exit usb_qdss_exit(void) { ipc_log_context_destroy(_qdss_ipc_log); usb_function_unregister(&qdssusb_func); qdss_cleanup(); } Loading
drivers/usb/gadget/function/f_qdss.h +15 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ #define _F_QDSS_H #include <linux/kernel.h> #include <linux/ipc_logging.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> #include <linux/usb/composite.h> Loading Loading @@ -66,6 +67,20 @@ struct f_qdss { bool qdss_close; }; static void *_qdss_ipc_log; #define NUM_PAGES 10 /* # of pages for ipc logging */ #ifdef CONFIG_DYNAMIC_DEBUG #define qdss_log(fmt, ...) do { \ ipc_log_string(_qdss_ipc_log, "%s: " fmt, __func__, ##__VA_ARGS__); \ dynamic_pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \ } while (0) #else #define qdss_log(fmt, ...) \ ipc_log_string(_qdss_ipc_log, "%s: " fmt, __func__, ##__VA_ARGS__) #endif struct usb_qdss_opts { struct usb_function_instance func_inst; struct f_qdss *usb_qdss; Loading