[PATCH v2] debugobjects: insulate non-fixup logic related to static obj from fixup callbacks

2016-05-09 Thread changbin . du
From: "Du, Changbin" When activate a static object, we need make sure that the object is tracked in the object tracker. If it is a non-static object, then the activation illegal. In previous implementation, each subsystem need take care of this in their fixup callbacks. Actually we can put it in

[PATCH] debugobjects: insulate non-fixup logic related to static obj from fixup callbacks

2016-05-06 Thread changbin . du
From: "Du, Changbin" When activate a static object, we need make sure that the object is tracked in the object tracker. If it is a non-static object, then the activation illegal. In previous implementation, each subsystem need take care of this in their fixup callbacks. Actually we can put it in

[PATCH 1/2] usb: configfs: allow UDC binding rule configured as binding to *any* UDC

2016-05-02 Thread changbin . du
From: "Du, Changbin" On most platforms, there is only one device controller available. In this case, we desn't care the UDC's name. So let's ignore the name by setting 'UDC' to 'any'. And also we can change UDC name at any time if it is not binded (no need set to "" first). Signed-off-by: Du, Ch

[PATCH 0/2] Add binding rule *any* support for USB Gadget Configfs

2016-05-02 Thread changbin . du
From: "Du, Changbin" When I am configuring Gadget Configfs, I need found a exactly UDC name before I can start my gadget. But, really I doesn't care about which UDC name is used, because I have only controller. "any" is a good option. Du, Changbin (2): usb: configfs: allow UDC binding rule con

[PATCH 2/2] Documentation: gadget_configfs: update UDC binding

2016-05-02 Thread changbin . du
From: "Du, Changbin" Add the usage of new binding mode 'any'. $ echo any > UDC Signed-off-by: Du, Changbin Signed-off-by: Du, Changbin --- Documentation/usb/gadget_configfs.txt | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/usb/gadget_configfs.txt b/D

[PATCH] usb: dwc3: usb/dwc3: fake dissconnect event when turn off pullup

2016-04-27 Thread changbin . du
From: "Du, Changbin" The dwc3 controller can't generate a disconnect event after it is stopped. Thus gadget dissconnect callback is not invoked when do soft dissconnect. Call dissconnect here to workaround this issue. Note, most time we still see disconnect be called that because it is invoked b

[PATCH] checkpatch.pl: add support for checking patch from git repository

2016-04-24 Thread changbin . du
From: "Du, Changbin" This patch add "-g, --git" option that tread FILE as git commits expression. You can specify the git commit hash ID expressions, then these commits from your git repository will be checked. This feature allows you can check your patches but no need to generate temporary patc

[PATCH 2/7] debugobjects: correct the usage of fixup call results

2016-04-22 Thread changbin . du
From: "Du, Changbin" If debug_object_fixup() return non-zero when problem has been fixed. But the code got it backwards, it taks 0 as fixup successfully. So fix it. Signed-off-by: Du, Changbin --- lib/debugobjects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/debugo

[PATCH 3/7] workqueue: update debugobjects fixup callbacks return type

2016-04-22 Thread changbin . du
From: "Du, Changbin" Update the return type to use bool instead of int, corresponding to cheange (debugobjects: make fixup functions return bool instead of int) Signed-off-by: Du, Changbin --- kernel/workqueue.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff

[PATCH 6/7] percpu_counter: update debugobjects fixup callbacks return type

2016-04-22 Thread changbin . du
From: "Du, Changbin" Update the return type to use bool instead of int, corresponding to cheange (debugobjects: make fixup functions return bool instead of int). Signed-off-by: Du, Changbin --- lib/percpu_counter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/p

[PATCH 7/7] Documentation: update debugobjects doc

2016-04-22 Thread changbin . du
From: "Du, Changbin" Update documentation creangponding to change(debugobjects: make fixup functions return bool instead of int). Signed-off-by: Du, Changbin --- Documentation/DocBook/debugobjects.tmpl | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-) diff --g

[PATCH 5/7] rcu: update debugobjects fixup callbacks return type

2016-04-22 Thread changbin . du
From: "Du, Changbin" Update the return type to use bool instead of int, corresponding to cheange (debugobjects: make fixup functions return bool instead of int). Signed-off-by: Du, Changbin --- kernel/rcu/update.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel

[PATCH 4/7] timer: update debugobjects fixup callbacks return type

2016-04-22 Thread changbin . du
From: "Du, Changbin" Update the return type to use bool instead of int, corresponding to cheange (debugobjects: make fixup functions return bool instead of int). Signed-off-by: Du, Changbin --- kernel/time/hrtimer.c | 18 +- kernel/time/timer.c | 30 +++---

[PATCH 0/7] Make debugobjects fixup functions return bool type

2016-04-22 Thread changbin . du
From: "Du, Changbin" Hello, I am going to introduce debugobjects infrastructure to USB subsystem. But before this, I found the code of debugobjects could be improved. This patchset will make fixup functions return bool type instead of int. Because fixup only need report success or no. boolean is

[PATCH 1/7] debugobjects: make fixup functions return bool instead of int

2016-04-22 Thread changbin . du
From: "Du, Changbin" The object debugging infrastructure core provides some fixup callbacks for the subsystem who use it. These callbacks are called from the debug code whenever a problem in debug_object_init is detected. And debugobjects core suppose them returns 1 when the fixup was successful,

[PATCH v4 0/2] Add a new debugfs entry to dump FIFO/Queue available space

2016-04-12 Thread changbin . du
From: "Du, Changbin" FIFO/Queue available space info can be used to debug dwc3 issues. First we remove unnecessary checking for debugfs api call, then add the new entry. Du, Changbin (2): usb: dwc3: make dwc3_debugfs_init return value be void usb: dwc3: add debugfs node to dump FIFO/Queue av

[PATCH v4 1/2] usb: dwc3: make dwc3_debugfs_init return value be void

2016-04-12 Thread changbin . du
From: "Du, Changbin" Debugfs init failure is not so important. We can continue our job on this failure. Also no break need for debugfs_create_file call failure. Signed-off-by: Du, Changbin --- v4: Do not fail silently, but print error. --- drivers/usb/dwc3/core.c| 10 + drivers/

[PATCH v4 2/2] usb: dwc3: add debugfs node to dump FIFO/Queue available space

2016-04-12 Thread changbin . du
From: "Du, Changbin" For DWC3 USB controller, the Global Debug Queue/FIFO Space Available Register(GDBGFIFOSPACE) can be used to dump FIFO/Queue available space. This can be used to check some special issues, like whether data is successfully copied from memory to fifo when a trb is blocked. Sig

[PATCH v3] usb: dwc3: fix memory leak of dwc->regset

2016-04-12 Thread changbin . du
From: "Du, Changbin" dwc->regset is allocated on dwc3_debugfs_init, and should be released on init failure or dwc3_debugfs_exit. Btw, The line "dwc->root = NULL" is unnecessary, so remove it. Signed-off-by: Du, Changbin --- v3: remove unnecessary if(!NULL) for free v2: Title changed; free

[PATCH v2] usb: dwc3: fix memory leak of dwc->regset

2016-04-12 Thread changbin . du
From: "Du, Changbin" dwc->regset is allocated on dwc3_debugfs_init, and should be released on init failure or dwc3_debugfs_exit. Btw, The line "dwc->root = NULL" is unnecessary, so remove it. Signed-off-by: Du, Changbin --- v2: Title changed; free dwc->regset on failure path. --- drivers/

[PATCH] usb: dwc3: free dwc->regset on dwc3_debugfs_exit

2016-04-08 Thread changbin . du
From: "Du, Changbin" dwc->regset is allocated on dwc3_debugfs_init, and should be released on dwc3_debugfs_exit. Signed-off-by: Du, Changbin --- This patch is seperated from patch set: [PATCH v2 0/3] Improvement, fix and new entry for dwc3 debugfs Because it is not related to other 2 patches.

[PATCH v3 0/2] Add a new debugfs entry to dump FIFO/Queue available space

2016-04-08 Thread changbin . du
From: "Du, Changbin" FIFO/Queue available space info can be used to debug dwc3 issues. First we remove unnecessary checking for debugfs api call, then add the new entry. changes from v2: 1. Remove commit "usb: dwc3: free dwc->regset on dwc3_debugfs_exit" Du, Changbin (2): usb: dwc3: make d

[PATCH v3 1/2] usb: dwc3: make dwc3_debugfs_init return value be void

2016-04-08 Thread changbin . du
From: "Du, Changbin" Debugfs init failure is not so important. We can continue our job on this failure. Also no need to check debugfs_create_file call results. Signed-off-by: Du, Changbin --- changes from v2: no changes --- drivers/usb/dwc3/core.c| 10 +- drivers/usb/dwc3/debug.

[PATCH v3 2/2] usb: dwc3: add debugfs node to dump FIFO/Queue available space

2016-04-08 Thread changbin . du
From: "Du, Changbin" For DWC3 USB controller, the Global Debug Queue/FIFO Space Available Register(GDBGFIFOSPACE) can be used to dump FIFO/Queue available space. This can be used to check some special issues, like whether data is successfully copied from memory to fifo when a trb is blocked. Sig

[PATCH v2 3/3] usb: dwc3: add debugfs node to dump FIFO/Queue available space

2016-04-06 Thread changbin . du
From: "Du, Changbin" For DWC3 USB controller, the Global Debug Queue/FIFO Space Available Register(GDBGFIFOSPACE) can be used to dump FIFO/Queue available space. This can be used to check some special issues, like whether data is successfully copied from memory to fifo when a trb is blocked. Sig

[PATCH v2 0/3] Improvement, fix and new entry for dwc3 debugfs

2016-04-06 Thread changbin . du
From: "Du, Changbin" The first patch removed unnecessary checking for debugfs api call; The second patch fix a memory leak issue; The third patch add one new entry to debufs. Du, Changbin (3): usb: dwc3: make dwc3_debugfs_init return value be void usb: dwc3: free dwc->regset on dwc3_debugfs_

[PATCH v2 2/3] usb: dwc3: free dwc->regset on dwc3_debugfs_exit

2016-04-06 Thread changbin . du
From: "Du, Changbin" Signed-off-by: Du, Changbin --- drivers/usb/dwc3/debugfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index 071b286..2d4f397 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c @@ -657,

[PATCH v2 1/3] usb: dwc3: make dwc3_debugfs_init return value be void

2016-04-06 Thread changbin . du
From: "Du, Changbin" Debugfs init failure is not so important. We can continue our job on this failure. Also no need to check debugfs_create_file call results. Signed-off-by: Du, Changbin --- drivers/usb/dwc3/core.c| 10 +- drivers/usb/dwc3/debug.h | 6 +++--- drivers/usb/dwc3/d

[PATCH] usb: dwc3: add debugfs node to dump FIFO/Queue available space

2016-04-06 Thread changbin . du
From: "Du, Changbin" For DWC3 USB controller, the Global Debug Queue/FIFO Space Available Register(GDBGFIFOSPACE) can be used to dump FIFO/Queue available space. This can be used to check some special issues, like whether data is successfully copied from memory to fifo when a trb is blocked. Sig

[PATCH] usb: dwc3: rename __dwc3_cleanup_done_trbs to __dwc3_cleanup_one_trb

2016-03-30 Thread changbin . du
From: "Du, Changbin" Actually, the function only clean one trb. So rename the function. Signed-off-by: Du, Changbin --- drivers/usb/dwc3/gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 3ac170f..f84be3d

[PATCH] usb: hub: fix panic caused by NULL bos pointer during reset device

2016-03-08 Thread changbin . du
From: "Du, Changbin" This is a reworked patch based on reverted commit d8f00cd685f5 ("usb: hub: do not clear BOS field during reset device"). The privious one caused double mem-free if run to re_enumerate label. New patch title changed to distinguish from old one. And I have tested it with memor

[PATCH] usb: f_fs: avoid race condition with ffs_epfile_io_complete

2015-12-28 Thread changbin . du
From: "Du, Changbin" ffs_epfile_io and ffs_epfile_io_complete runs in different context, but there is no synchronization between them. consider the following scenario: 1) ffs_epfile_io interrupted by sigal while wait_for_completion_interruptible 2) then ffs_epfile_io set ret to -EINTR 3) just be

[PATCH v2] usb: gadget: fix double mem free for usb_request caused by wild pointers

2015-12-27 Thread changbin . du
From: "Du, Changbin" acm, ecm, hid, ncm, phonet, rndis and uvc functions all have double memory free issue. Set pointers to NULL after freed to avoid this. Here explain how it happen on acm function, others has analogical case. If acm_bind fails before allocate notification and acm->notify_req

[PATCH] usb: gadget: acm: set notify_req to NULL after freed to avoid double free

2015-12-25 Thread changbin . du
From: "Du, Changbin" If acm_bind fails before allocate notification and acm->notify_req is not set to NULL after freed last time, double free will happen. kernel BUG at mm/slub.c:3392! invalid opcode: [#1] PREEMPT SMP EIP is at kfree+0x172/0x180 Call Trace: [<80c0e3b6>] ? usb_ep_autoconfig_

[PATCH v4] usb: gadget: forbid queuing request to a disabled ep

2015-12-17 Thread changbin . du
From: "Du, Changbin" Queue a request to disabled ep doesn't make sense, and induce caller make mistakes. Here is a example for the android mtp gadget function driver. A mem corruption can happen on below senario. 1) On disconnect, mtp driver disable its EPs, 2) During send_file_work and receive

[PATCH v3] usb: gadget: forbid queuing request to a disabled ep

2015-12-17 Thread changbin . du
From: "Du, Changbin" Queue a request to disabled ep doesn't make sense, and induce caller make mistakes. Here is a example for the android mtp gadget function driver. A mem corruption can happen on below senario. 1) On disconnect, mtp driver disable its EPs, 2) During send_file_work and receive

[PATCH v2] usb: gadget: forbid queuing request to a disabled ep

2015-12-13 Thread changbin . du
From: "Du, Changbin" Queue a request to disabled ep doesn't make sense, and induce caller make mistakes. Here is a example for the android mtp gadget function driver. A mem corruption can happen on below senario. 1) On disconnect, mtp driver disable its EPs, 2) During send_file_work and receive

[PATCH v2] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled

2015-12-13 Thread changbin . du
From: "Du, Changbin" When usb_ep_enable on a enabled ep, the configuration of the ep probably has changed. In this scenario, the ep configuration in hw should be reprogrammed by udc driver. Hence, it is better to return an error to inform the caller. Signed-off-by: Du, Changbin --- change from

[PATCH] usb: dwc2: fix transfer stop programming for out endpoint

2015-12-03 Thread changbin . du
From: "Du, Changbin" To stop an out endpoint, software should set sets the Global OUT NAK, but not the Global Non-periodic IN NAK. This driver bug leads the out-ep failed be in disabled state with below error. dwc2_hsotg_ep_stop_xfr: timeout DOEPCTL.EPDisable Signed-off-by: Du, Changbin --- d

[PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled

2015-12-03 Thread changbin . du
From: "Du, Changbin" When usb_ep_enable on a enabled ep, the configuration of the ep probably has changed. In this scenario, the ep configuration in hw should be reprogrammed by udc driver. Hence, it is better to return an error to inform the caller. Signed-off-by: Du, Changbin --- include/lin

[PATCH] usb: gadget: forbid queuing request to a disabled ep

2015-12-03 Thread changbin . du
From: "Du, Changbin" Queue a request to disabled ep doesn't make sense, and induce caller make mistakes. Here is a example for the android mtp gadget function driver. A mem corruption can happen on below senario. 1) On disconnect, mtp driver disable its EPs, 2) During send_file_work and receive

[PATCH 1/2] usb: dwc2: add ep enabled flag to avoid double enable/disable

2015-11-29 Thread changbin . du
From: "Du, Changbin" Enabling a already enabled ep is illegal, because the ep may has trbs running. Reprogram the ep may break running transfer. So udc driver must avoid this happening by return an error -EBUSY. Gadget function driver also should avoid such things, but that is out of udc driver.

[PATCH 2/2] usb: dwc2: forbid queuing request to a disabled ep

2015-11-29 Thread changbin . du
From: "Du, Changbin" Queue a request to disabled ep doesn't make sense, and induce caller make mistakes. Here is a example for the android mtp gadget function driver. A mem corruption can happen on below senario. 1) On disconnect, mtp driver disable its EPs, 2) During send_file_work and receive

[PATCH 0/2] Two fix for dwc2 gadget driver

2015-11-29 Thread changbin . du
From: "Du, Changbin" With the first patch, enable a enabled ep will return -EBUSY. The second patch forbid queuing on disabled ep to avoid panic. Du, Changbin (2): usb: dwc2: add ep enabled flag to avoid double enable/disable usb: dwc2: forbid queuing request to a disabled ep drivers/usb/d

Re: [PATCH v2] dynamic_debug: add wildcard support to filter files/functions/modules

2013-11-14 Thread Changbin Du
2013/11/7 Joe Perches : > On Thu, 2013-11-07 at 11:11 +0800, Changbin Du wrote: >> 2013/11/1 Joe Perches : >> match_ functions in lib/parser.c just do simple match, they >> doesn't support wildcards. >> So it's not useful for us. > > It's not meant

Re: [PATCH v2] dynamic_debug: add wildcard support to filter files/functions/modules

2013-11-06 Thread Changbin Du
2013/11/1 Joe Perches : > On Thu, 2013-10-31 at 15:52 -0700, Andrew Morton wrote: >> On Mon, 28 Oct 2013 23:29:10 +0800 "Du, Changbin" >> wrote: > [] >> > +/* check if the string matches given pattern which includes wildcards */ >> > +static int match_pattern(const char *pattern, const char *stri

Re: [PATCH v2] dynamic_debug: add wildcard support to filter files/functions/modules

2013-11-06 Thread Changbin Du
2013/11/1 Joe Perches : > On Thu, 2013-10-31 at 15:52 -0700, Andrew Morton wrote: >> On Mon, 28 Oct 2013 23:29:10 +0800 "Du, Changbin" >> wrote: > [] >> > +/* check if the string matches given pattern which includes wildcards */ >> > +static int match_pattern(const char *pattern, const char *stri

Re: [PATCH v3] dynamic_debug: add wildcard support to filter files/functions/modules

2013-10-30 Thread Changbin Du
2013/10/30 Changbin Du : > 2013/10/30 Joe Perches : >> On Tue, 2013-10-29 at 21:33 +0800, Du, Changbin wrote: >>> This patch add wildcard '*'(matches zero or more characters) and '?' >>> (matches one character) support when qurying debug flags. >

Re: [PATCH v3] dynamic_debug: add wildcard support to filter files/functions/modules

2013-10-29 Thread Changbin Du
2013/10/30 Joe Perches : > On Tue, 2013-10-29 at 21:33 +0800, Du, Changbin wrote: >> This patch add wildcard '*'(matches zero or more characters) and '?' >> (matches one character) support when qurying debug flags. > > Hi again. Some trivial notes and a possible logic error: > >> +/* check if the

Re: [PATCH v3] dynamic_debug: add wildcard support to filter files/functions/modules

2013-10-29 Thread Changbin Du
2013/10/30 Marcel Holtmann : > Hi Changbin, > >> This patch add wildcard '*'(matches zero or more characters) and '?' >> (matches one character) support when qurying debug flags. >> >> Now we can open debug messages using keywords. eg: >> 1. open debug logs in all usb drivers >>echo "file drive

Re: [PATCH v2] dynamic_debug: add wildcard support to filter files/functions/modules

2013-10-29 Thread Changbin Du
Hello, Joe, Thanks for your comments. I will update the patch. And now I am trying to remove all the two goto statements. Agree with you, we can use a while statement instead. I will send you the new patch for you to review when it's done. 2013/10/29 Joe Perches > > On Mon, 2013-10-28 at 23:29

Re: [RFC PATCH] [media] rc: filter out not allowed protocols when decoding

2012-09-06 Thread Changbin Du
Sean , many thanks for your help. I know much more about IR framwork now. I'll try to work out a patch to remove "allowed_protocols". Thanks again! [Du, Changbin] 2012/9/4 Sean Young : > On Tue, Sep 04, 2012 at 11:06:07AM +0800, Changbin Du wrote: >> >

Re: [RFC PATCH] [media] rc: filter out not allowed protocols when decoding

2012-09-03 Thread Changbin Du
> > mutex_lock(&ir_raw_handler_lock); > > - list_for_each_entry(handler, &ir_raw_handler_list, list) > > - handler->decode(raw->dev, ev); > > + list_for_each_entry(handler, &ir_raw_handler_list, list) { > > + /* use all p

<    2   3   4   5   6   7