[PATCH 2/6] usb: gadget: fsl_udc_core: delete __init marker for probe

2014-05-18 Thread Peter Chen
The probe function may be probed deferal and called after .init
section has freed.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/fsl_udc_core.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/fsl_udc_core.c 
b/drivers/usb/gadget/fsl_udc_core.c
index a2f26cd..dd9ff29 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2246,7 +2246,7 @@ static void fsl_udc_release(struct device *dev)
  * init resource for globle controller
  * Return the udc handle on success or NULL on failure
  --*/
-static int __init struct_udc_setup(struct fsl_udc *udc,
+static int struct_udc_setup(struct fsl_udc *udc,
struct platform_device *pdev)
 {
struct fsl_usb2_platform_data *pdata;
@@ -2300,7 +2300,7 @@ static int __init struct_udc_setup(struct fsl_udc *udc,
  * ep0out is not used so do nothing here
  * ep0in should be taken care
  *--*/
-static int __init struct_ep_setup(struct fsl_udc *udc, unsigned char index,
+static int struct_ep_setup(struct fsl_udc *udc, unsigned char index,
char *name, int link)
 {
struct fsl_ep *ep = udc-eps[index];
@@ -2333,7 +2333,7 @@ static int __init struct_ep_setup(struct fsl_udc *udc, 
unsigned char index,
  * all intialization operations implemented here except enabling usb_intr reg
  * board setup should have been done in the platform code
  */
-static int __init fsl_udc_probe(struct platform_device *pdev)
+static int fsl_udc_probe(struct platform_device *pdev)
 {
struct fsl_usb2_platform_data *pdata;
struct resource *res;
-- 
1.7.8

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] usb: gadget: atmel_usba_udc: delete __init marker for probe

2014-05-18 Thread Peter Chen
The probe function may be probed deferal and called after .init
section has freed.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/atmel_usba_udc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
b/drivers/usb/gadget/atmel_usba_udc.c
index 9f65324..736f72a 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1979,7 +1979,7 @@ static struct usba_ep * usba_udc_pdata(struct 
platform_device *pdev,
return eps;
 }
 
-static int __init usba_udc_probe(struct platform_device *pdev)
+static int usba_udc_probe(struct platform_device *pdev)
 {
struct resource *regs, *fifo;
struct clk *pclk, *hclk;
-- 
1.7.8

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] usb: gadget: m66592-udc: delete __init marker for probe

2014-05-18 Thread Peter Chen
The probe function may be probed deferal and called after .init
section has freed.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/m66592-udc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 8cae01d..5396b24 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -1553,7 +1553,7 @@ static void nop_completion(struct usb_ep *ep, struct 
usb_request *r)
 {
 }
 
-static int __init m66592_probe(struct platform_device *pdev)
+static int m66592_probe(struct platform_device *pdev)
 {
struct resource *res, *ires;
void __iomem *reg = NULL;
-- 
1.7.8

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] usb: gadget: r8a66597-udc: delete __init marker for probe

2014-05-18 Thread Peter Chen
The probe function may be probed deferal and called after .init
section has freed.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/r8a66597-udc.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/r8a66597-udc.c 
b/drivers/usb/gadget/r8a66597-udc.c
index aff0a67..f3b347f 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1845,7 +1845,7 @@ static void nop_completion(struct usb_ep *ep, struct 
usb_request *r)
 {
 }
 
-static int __init r8a66597_sudmac_ioremap(struct r8a66597 *r8a66597,
+static int r8a66597_sudmac_ioremap(struct r8a66597 *r8a66597,
  struct platform_device *pdev)
 {
struct resource *res;
@@ -1865,7 +1865,7 @@ static int __init r8a66597_sudmac_ioremap(struct r8a66597 
*r8a66597,
return 0;
 }
 
-static int __init r8a66597_probe(struct platform_device *pdev)
+static int r8a66597_probe(struct platform_device *pdev)
 {
char clk_name[8];
struct resource *res, *ires;
-- 
1.7.8

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] usb: gadget: fusb300_udc: delete __init marker for probe

2014-05-18 Thread Peter Chen
The probe function may be probed deferal and called after .init
section has freed.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/fusb300_udc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/fusb300_udc.c b/drivers/usb/gadget/fusb300_udc.c
index 6423f18..90d2836 100644
--- a/drivers/usb/gadget/fusb300_udc.c
+++ b/drivers/usb/gadget/fusb300_udc.c
@@ -1359,7 +1359,7 @@ static int __exit fusb300_remove(struct platform_device 
*pdev)
return 0;
 }
 
-static int __init fusb300_probe(struct platform_device *pdev)
+static int fusb300_probe(struct platform_device *pdev)
 {
struct resource *res, *ires, *ires1;
void __iomem *reg = NULL;
-- 
1.7.8

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/6] usb: gadget: Delete __init marker for probe

2014-05-18 Thread Peter Chen
The probe function may be probed deferal and called after .init
section has freed.

Peter Chen (6):
  usb: gadget: atmel_usba_udc: delete __init marker for probe
  usb: gadget: fsl_udc_core: delete __init marker for probe
  usb: gadget: lpc32xx: delete __init marker for probe
  usb: gadget: m66592-udc: delete __init marker for probe
  usb: gadget: fusb300_udc: delete __init marker for probe
  usb: gadget: r8a66597-udc: delete __init marker for probe

 drivers/usb/gadget/atmel_usba_udc.c |2 +-
 drivers/usb/gadget/fsl_udc_core.c   |6 +++---
 drivers/usb/gadget/fusb300_udc.c|2 +-
 drivers/usb/gadget/lpc32xx_udc.c|2 +-
 drivers/usb/gadget/m66592-udc.c |2 +-
 drivers/usb/gadget/r8a66597-udc.c   |4 ++--
 6 files changed, 9 insertions(+), 9 deletions(-)

-- 
1.7.8

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] usb: gadget: lpc32xx: delete __init marker for probe

2014-05-18 Thread Peter Chen
The probe function may be probed deferal and called after .init
section has freed.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/lpc32xx_udc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index e471580..18f6e01 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -3036,7 +3036,7 @@ struct lpc32xx_usbd_cfg lpc32xx_usbddata = {
 
 static u64 lpc32xx_usbd_dmamask = ~(u32) 0x7F;
 
-static int __init lpc32xx_udc_probe(struct platform_device *pdev)
+static int lpc32xx_udc_probe(struct platform_device *pdev)
 {
struct device *dev = pdev-dev;
struct lpc32xx_udc *udc;
-- 
1.7.8

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v2 00/12] cdc_ncm: add buffer tuning and stats using ethtool

2014-05-18 Thread Enrico Mioso
Or a set of module parameters, allowing them to be tuned at run-time via (e.g.) 
the param directory of the module in sysfs?
Yes, I imagine it's not the best solution.

On Sun, 18 May 2014, Peter Stuge wrote:

==Date: Sun, 18 May 2014 03:19:17
==From: Peter Stuge pe...@stuge.se
==Reply-To: Bjørn Mork bj...@mork.no, David Miller da...@davemloft.net,
==net...@vger.kernel.org, linux-usb@vger.kernel.org,
==alexey.oris...@gmail.com, oli...@neukum.org, mrkiko...@gmail.com,
==david.lai...@aculab.com
==To: Bjørn Mork bj...@mork.no
==Cc: David Miller da...@davemloft.net, net...@vger.kernel.org,
==linux-usb@vger.kernel.org, alexey.oris...@gmail.com, oli...@neukum.org,
==mrkiko...@gmail.com, david.lai...@aculab.com
==Subject: Re: [PATCH net-next v2 00/12] cdc_ncm: add buffer tuning and stats
==using ethtool
==
==Bjørn Mork wrote:
==  Just make doubly sure that you will be ok, for a long time, with using
==  the ethtool coalescing interface for configuring this because you'll
==  really be stuck with this forever.
== 
== Yes, I am painfull aware of that.  So I was hoping someone would jump at
== this and say something like That's not the way to do it.  Use the foo
== interface instead. It's made for stuff like this.
==
==sysfs?
==
==
==//Peter
==

Re: [PATCH net-next v2 00/12] cdc_ncm: add buffer tuning and stats using ethtool

2014-05-18 Thread Bjørn Mork
I could be wrong, but my impression is that the userspace API
preferences for network devices are

 1. ethtool
 2. sysfs
 3. module param
 ..
 99. ioctl

This is the primary reason why I was looking for someplace to put this
within the existing ethtool API.  Using sysfs would have worked fine
too, I guess.  But is there any real advantage, making it worth a
switch?  I am all open to change to sysfs instead before v3.16 is
released, *if* there are good reasons to do it. And no objections.  But
I do want more of a reason than the fact that it can be done.  Maybe I
got the preferred order wrong?

I ruled out module parameters early because I believe there are real use
cases requiring different settings per device.  The limited host system
resources will of course affect all devices on a single host the same
way.  But not all devices can cope with the reduced buffers. So there
should be some way to tune two devices connected to the same host
differently.

I am not going to say anything about ioctls :-)


Bjørn
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v2 00/12] cdc_ncm: add buffer tuning and stats using ethtool

2014-05-18 Thread Lars Melin

On 2014-05-18 21:50, Bjørn Mork wrote:

I could be wrong, but my impression is that the userspace API
preferences for network devices are

  1. ethtool
  2. sysfs
  3. module param
  ..
  99. ioctl

This is the primary reason why I was looking for someplace to put this
within the existing ethtool API.  Using sysfs would have worked fine
too, I guess.  But is there any real advantage, making it worth a
switch?  I am all open to change to sysfs instead before v3.16 is
released, *if* there are good reasons to do it. And no objections.  But
I do want more of a reason than the fact that it can be done.  Maybe I
got the preferred order wrong?

I ruled out module parameters early because I believe there are real use
cases requiring different settings per device.  The limited host system
resources will of course affect all devices on a single host the same
way.  But not all devices can cope with the reduced buffers. So there
should be some way to tune two devices connected to the same host
differently.

I am not going to say anything about ioctls :-)


Bjørn
--


Your target audience is embedded systems with limited cpu power and 
buffer memory, right?
If so, then you can't expect them to have ethtool included and their 
developers are not likely to be happy over having to waste another 
100KB in order to tune a 20KB driver.

My vote goes for sysfs.

/Lars

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[no subject]

2014-05-18 Thread Michael Durkin
Im not sure if im even looking in the right resource ...

I have a Fresco Logic USB3/2 to VGA adapter and im not sure if there
is support for it in the kernel ...

Vender id is 1d5c and the producet is 2000
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v2 00/12] cdc_ncm: add buffer tuning and stats using ethtool

2014-05-18 Thread David Miller
From: Bjørn Mork bj...@mork.no
Date: Sun, 18 May 2014 16:50:30 +0200

 I could be wrong, but my impression is that the userspace API
 preferences for network devices are
 
  1. ethtool
  2. sysfs
  3. module param
  ..
  99. ioctl

I would swap module param and ioctl, module params are the least
desirable interface and strongly discouraged.
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[no subject]

2014-05-18 Thread lin du
subscribe linux-usb
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/13] make return of 0 explicit

2014-05-18 Thread Julia Lawall
Sometimes a local variable is used as a return value in a case where the
return value is always 0.  The result is more apparent if this variable is
just replaced by 0.  This is done by the following semantic patch, although
some cleanups may be needed. (http://coccinelle.lip6.fr/)

// smpl
@r exists@
local idexpression ret;
identifier reti;
expression e;
position p;
@@

ret@reti = 0;
... when != \(ret = e\|ret = e\|ret |= e\|ret += e\|ret -= e\|ret *= e\|ret ^= 
e\)
when != \(++ret\|--ret\|ret++\|ret--\)
when != ret
return ret;@p

@bad1 exists@
expression e != 0;
local idexpression r.ret;
position r.p;
@@

 \(ret = e\|ret = e\|ret |= e\|ret += e\|ret -= e\|ret *= e\|ret ^= 
e\|++ret\|--ret\|ret++\|ret--\|ret\)
 ...
 return ret;@p

@bad2 exists@
identifier r.reti;
position r.p;
identifier f;
type T;
@@

f(...,T reti,...) {
 ...
 return reti;@p
}

@change depends on !bad1  !bad2@
position r.p;
local idexpression r.ret;
identifier f;
@@

f(...) { +...
return 
-ret
+0
;@p
...+ }

@rewrite@
local idexpression r.ret;
expression e;
position p;
identifier change.f;
@@

f(...) { +...
 \(ret@p = e\|ret@p\)
...+ }

@depends on change@
local idexpression r.ret;
position p != rewrite.p;
identifier change.f;
@@

f(...) { +...
(
break;
|
ret = 0;
... when exists
ret@p
... when any
|
- ret = 0;
)
...+ }

@depends on change@
identifier r.reti;
type T;
constant C;
identifier change.f;
@@

f(...) { ... when any
-T reti = C;
 ... when != reti
 when strict
 }

@depends on change@
identifier r.reti;
type T;
identifier change.f;
@@

f(...) { ... when any
-T reti;
 ... when != reti
 when strict
 }
// /smpl

The first four rules detect cases where only 0 reaches a return.  The
remaining rules clean up any variable initializations or declarations that
are made unnecessary by this change.

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/13] usb: gadget: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr

Delete unnecessary local variable whose value is always 0 and that hides
the fact that the result is always 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// /smpl

Signed-off-by: Julia Lawall julia.law...@lip6.fr

---
 drivers/usb/gadget/composite.c |6 ++
 drivers/usb/gadget/dummy_hcd.c |4 +---
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 042c66b..f801519 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1312,9 +1312,7 @@ static void fill_ext_compat(struct usb_configuration *c, 
u8 *buf)
 static int count_ext_prop(struct usb_configuration *c, int interface)
 {
struct usb_function *f;
-   int j, res;
-
-   res = 0;
+   int j;
 
f = c-interface[interface];
for (j = 0; j  f-os_desc_n; ++j) {
@@ -1326,7 +1324,7 @@ static int count_ext_prop(struct usb_configuration *c, 
int interface)
if (d  d-ext_compat_id)
return d-ext_prop_count;
}
-   return res;
+   return 0;
 }
 
 static int len_ext_prop(struct usb_configuration *c, int interface)
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 8c06430..2b54955 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -561,7 +561,6 @@ static int dummy_disable(struct usb_ep *_ep)
struct dummy_ep *ep;
struct dummy*dum;
unsigned long   flags;
-   int retval;
 
ep = usb_ep_to_dummy_ep(_ep);
if (!_ep || !ep-desc || _ep-name == ep0name)
@@ -571,12 +570,11 @@ static int dummy_disable(struct usb_ep *_ep)
spin_lock_irqsave(dum-lock, flags);
ep-desc = NULL;
ep-stream_en = 0;
-   retval = 0;
nuke(dum, ep);
spin_unlock_irqrestore(dum-lock, flags);
 
dev_dbg(udc_dev(dum), disabled %s\n, _ep-name);
-   return retval;
+   return 0;
 }
 
 static struct usb_request *dummy_alloc_request(struct usb_ep *_ep,

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PROBLEM] USB problem causes the HW hang

2014-05-18 Thread lin du
Add linux-usb in loop.

Hello,

When reload the xhci_hcd.ko continuously as following, we will see
many error messages, even HW hang! (almost  300 times;
if no sleep between rmmod and modprobe driver, the value should be smaller).

# rmmod xhci_hcd; modprobe xhci_hcd

By the way, our kernel version is 2.6.32.358 (v3.15-rc2 also tested,
similar situation), and the machine’s PCH is Intel Lynx-Point.

After tracing the source code, we found:

In kernel source:
linux-2.6.32-358.el6.x86_64/drivers/usb/host/xhci.c

  54 int handshake(struct xhci_hcd *xhci, void __iomem *ptr,
  55   u32 mask, u32 done, int usec)
  56 {
  57 u32 result;
  58
  59 do {
  60 result = xhci_readl(xhci, ptr);
  61 if (result == ~(u32)0)  /* card removed */
  62 return -ENODEV;
  63 result = mask;
  64 if (result == done)
  65 return 0;
  66 udelay(10);//udelay(1);
  67 usec -= 10;//usec--;
  68 } while (usec  0);
  69 return -ETIMEDOUT;
  70 }

In this function, it will be called for some USB commands to issue
out, and trying to read HW register until it matching “done” value,
At Lynx-Point, we wonder this will make HW unstable because of
frequently access, so we reduce the access rate,

Old:  udelay(1)   usec --
New: udelay(10)  usec -= 10

= =  After patch,
Reload xhci_hcd driver for 1000 times, no problem, so the patch fix
the problem for us.

Look forward to your response. Thanks!

Best Regards,
Lin Du
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html