Re: [PATCH] usb: Fix typo in `struct usb_host_interface' comment

2015-01-16 Thread Oliver Neukum
On Thu, 2015-01-15 at 17:47 -0600, Chris Rorvick wrote:
 I think understand your comment now so I will respond more
 specifically:
 This is a typo precisely because `bNumEndpoint' is not consistent with
 the specification, nor is it consistent with the definition of `struct
 usb_interface_descriptor'.  The specification and the structure both
 use
 `bNumEndpoints'.

Sorry, I stand corrected. The patch is good.

Regards
Oliver


--
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: cdc-wdm: race between reset and work queue

2015-01-16 Thread Oliver Neukum
On Thu, 2015-01-15 at 17:52 +0100, Bjørn Mork wrote:
 Oliver Neukum oneu...@suse.de writes:
 
  Hi,
 
  I think I found a race between pre_reset() and the bottom half.
  In wdm_rxwork() WDM_RESETTING is not checked for. That means that
 
  wdm_pre_reset() cannot reliable end IO. What do you think?
 
 Yes, it certainly looks that way.  There are too many flags meaning
 end IO... 

So you think I should consolidate the flags rather add a check?

Regards
Oliver


--
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: NETDEV WATCHDOG: internal(r8152): transmit queue 0 timed out

2015-01-16 Thread poma
On 16.01.2015 00:38, sean darcy wrote:
 I've got F20 on an old laptop I'm using as a router. The external 
 interface uses the RJ45 port. The internal uses a USB ethernet adapter. 
 Every 2-3 weeks, the internal USB adapter fails. I can fix it by just 
 moving it to the other USB port. In another 2-3 weeks, it will fail 
 again, and I move it back to the original USB port, and so on.
 
 No problems with the external RJ45 interface.
 
 The logs aren't very helpful:
 
 12:39:22 kernel: NETDEV WATCHDOG: internal (r8152): transmit queue 0 
 timed out
 12:39:22 kernel: Modules linked in: xt_conntrack xt_nat ipt_MASQUERADE 
 xt_DSCP iptable_mangle iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 
 nf_nat_ipv4 iptable_raw sch_pie nf_nat_sip nf_nat nf_conntrack_sip 
 nf_conntrack bnep bluetooth arc4 snd_hda_codec_hdmi 
 snd_hda_codec_realtek b43 bcma snd_hda_codec_generic snd_hda_intel 
 snd_hda_controller mac80211 snd_hda_codec uvcvideo snd_hwdep snd_seq 
 snd_seq_device coretemp sdhci_pci snd_pcm acer_wmi videobuf2_vmalloc 
 cfg80211 sparse_keymap microcode sdhci videobuf2_memops iTCO_wdt 
 videobuf2_core rfkill iTCO_vendor_support v4l2_common tg3 ssb cdc_ether 
 ptp joydev pps_core usbnet videodev media i2c_i801 serio_raw mmc_core 
 irda r8152 lpc_ich shpchp tifm_7xx1 snd_timer snd soundcore mfd_core 
 tifm_core crc_ccitt wmi mii acpi_cpufreq firewire_ohci firewire_core 
 crc_itu_t
 12:39:22 kernel: r8152 2-2:1.0 internal: Tx timeout
 12:39:23 kernel: r8152 2-2:1.0 internal: Tx timeout
 12:39:24 kernel: r8152 2-2:1.0 internal: Tx timeout
 ..
 
 This looks like a USB problem. Is there a way to get usb (or 
 NetworkManager) to reinitialize the driver when this happens?
 
 sean
 
 

I would ask these people for advice, therefore.

--
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] usb: phy: never defer probe in non-OF case

2015-01-16 Thread Heikki Krogerus
In practice failure to find phy when requested in non-OF
case means it will never become available, so
__usb_find_phy() must return -ENODEV and not -EPROBE_DEFER.

This fixes a regression caused by commit
9c9d82492b73991e8e13a6c0af06e44816c31438, where the USB
controller driver is left infinitely into deferred probe
when there are no phys.

Signed-off-by: Heikki Krogerus heikki.kroge...@linux.intel.com
---
 drivers/usb/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
index ccfdfb2..2f9735b 100644
--- a/drivers/usb/phy/phy.c
+++ b/drivers/usb/phy/phy.c
@@ -34,7 +34,7 @@ static struct usb_phy *__usb_find_phy(struct list_head *list,
return phy;
}
 
-   return ERR_PTR(-EPROBE_DEFER);
+   return ERR_PTR(-ENODEV);
 }
 
 static struct usb_phy *__usb_find_phy_dev(struct device *dev,
-- 
2.1.4

--
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 03/13] usb: dwc2: gadget: fix clear halt feature handling

2015-01-16 Thread Kaukab, Yousaf
 -Original Message-
 From: Sergei Shtylyov [mailto:sergei.shtyl...@cogentembedded.com]
 Sent: Thursday, January 15, 2015 7:21 PM
 To: Kaukab, Yousaf; linux-usb@vger.kernel.org; ba...@ti.com
 Cc: john.y...@synopsys.com; Herrero, Gregory; pa...@synopsys.com;
 r.bald...@samsung.com; dingu...@opensource.altera.com
 Subject: Re: [PATCH 03/13] usb: dwc2: gadget: fix clear halt feature handling
 
 Hello.

Hi, Thank you for reviewing these patches!

 
 On 01/15/2015 08:09 PM, Mian Yousaf Kaukab wrote:
 
  From: Gregory Herrero gregory.herr...@intel.com
 
  When clearing HALT on an endpoint, in progress requests must be called
  with locks off.
 
 Requests must be *called*?

s/request/request-complete

 
  Request must be started only if there is not already a pending request
  on the endpoint caused by previous completion.
 
  Signed-off-by: Gregory Herrero gregory.herr...@intel.com
 
 [...]
 
 WBR, Sergei

BR,
Yousaf

--
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: Fatal Exception on device when Hotsyncing Palm in linux

2015-01-16 Thread Oliver Neukum
On Thu, 2015-01-15 at 18:34 +0100, Henri Manson wrote:
 Hello Greg,
 
 Nothing goes wrong at the linux host, my Palm m505 shows as dialog box
 'Fatal Exception' and hangs when the visor.ko module is loaded and
 hotsync activated on the Palm. There are some suggestions on the web
 about draining the palm battery but it seems to be a software problem
 (visor sending bytes causing the palm to crash?)
 The problem doesn't occur on Ubuntu 9.04 or earlier.

Try reverting 214916f2ec6701e1c9972f26c60b3dc37d3153c6
This will be very hard because it is five years old. It
is likely easier to bisect this problem.

I'd recommend switching on dynamic debugging for visor.ko.
Greg mentioned where this is documented. Do you need further
help?

Regards
Oliver



--
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: cdc-wdm: race between reset and work queue

2015-01-16 Thread Bjørn Mork
Oliver Neukum oneu...@suse.de writes:

 On Thu, 2015-01-15 at 17:52 +0100, Bjørn Mork wrote:
 Oliver Neukum oneu...@suse.de writes:
 
  Hi,
 
  I think I found a race between pre_reset() and the bottom half.
  In wdm_rxwork() WDM_RESETTING is not checked for. That means that
 
  wdm_pre_reset() cannot reliable end IO. What do you think?
 
 Yes, it certainly looks that way.  There are too many flags meaning
 end IO... 

 So you think I should consolidate the flags rather add a check?

If possible.  At least that was my initial thought after a quick look.
But I don't know how feasible it is.  I can imagine that we might need
to separate the flags we want to clear.  At least the ones that can be
set at the same time, if any.


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: cdc-wdm: race between reset and work queue

2015-01-16 Thread Oliver Neukum
On Fri, 2015-01-16 at 10:13 +0100, Bjørn Mork wrote:
 Oliver Neukum oneu...@suse.de writes:
 
  On Thu, 2015-01-15 at 17:52 +0100, Bjørn Mork wrote:
  Oliver Neukum oneu...@suse.de writes:
  
   Hi,
  
   I think I found a race between pre_reset() and the bottom half.
   In wdm_rxwork() WDM_RESETTING is not checked for. That means that
  
   wdm_pre_reset() cannot reliable end IO. What do you think?
  
  Yes, it certainly looks that way.  There are too many flags meaning
  end IO... 
 
  So you think I should consolidate the flags rather add a check?
 
 If possible.  At least that was my initial thought after a quick look.
 But I don't know how feasible it is.  I can imagine that we might need
 to separate the flags we want to clear.  At least the ones that can be
 set at the same time, if any.

At a closer look it looks to me that this is not easily doable,
as the error returns and the response to poll() must be different.

Regards
Oliver


--
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: NETDEV WATCHDOG: internal(r8152): transmit queue 0 timed out

2015-01-16 Thread Hayes Wang
 poma [mailto:pomidorabelis...@gmail.com] 
 Sent: Friday, January 16, 2015 4:25 PM
[...]
  This looks like a USB problem. Is there a way to get usb (or 
  NetworkManager) to reinitialize the driver when this happens?
 
 I would ask these people for advice, therefore.

Our hw engineers need to analyse the behavior of the device.
However, I don't think you have such instrument to provide
the required information. If we don't know the reason, we
couldn't give you the proper solution. Besides, your solution
would work if and only if reloading the driver is helpful.

The issue have to debug from the hardware, and I have no idea
about what the software could do before analysing the hw. Maybe
you could try the following driver first to check if it is useful.

http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=2PNid=13PFid=56Level=5Conn=4DownTypeID=3GetDown=false
 
Best Regards,
Hayes
--
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] usb: renesas_usbhs: Add access control for INTSTS1 and INTENB1 register

2015-01-16 Thread yoshihiro shimoda
Hi Iwamatsu-san,

 INTSTS1 and INTENB1 register of renesas_usbhs can access only Host mode.
 This adds process of accessing INTSTS1 and INTENB1 only when renesas_usbhs
 is Host mode.
 
 Signed-off-by: Nobuhiro Iwamatsu nobuhiro.iwamatsu...@renesas.com

Thank you for the patch.

Acked-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com

Best regards,
Yoshihiro Shimoda

--
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] usb: phy: make GPIOs optional for the generic phy

2015-01-16 Thread Robert Jarzmik
Paul Zimmerman paul.zimmer...@synopsys.com writes:

 From 47bd18e210fecf701d493c27884e13c69bc449ea Mon Sep 17 00:00:00 2001
 From: Paul Zimmerman pa...@synopsys.com
 Date: Wed, 14 Jan 2015 18:15:58 -0800
 Subject: [PATCH] usb: phy: make GPIOs optional for the generic phy

 The use of GPIOs should be optional for the generic phy, otherwise
 the Altera SOCFPGA platform at least is broken.

 Fixes breakage caused by a combination of e9f2cefb0cd usb: phy: 
 generic: migrate to gpio_desc and 135b3c4304d usb: dwc2: platform: 
 add generic PHY framework support.

 Signed-off-by: Paul Zimmerman pa...@synopsys.com
Reviewed-by: Robert Jarzmik robert.jarz...@free.fr

Cheers.

--
Robert
--
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: Difference between run time and normal suspend

2015-01-16 Thread vichy
hi alan:

 Firstly, you should realize that a hub port can be put into suspend
 _only_ if a device is plugged into it.  If nothing is plugged into a
 port then the port cannot be put into suspend.

 Secondly, you should realize that putting a USB device into suspend
 means the same thing as suspending the hub port the device is plugged
 into.

 Thirdly, you should realize therefore that if _all_ the devices
 attached to the host controller are in runtime suspend, then all the
 connected ports must be suspended.  (And none of the disconnected ports
 can be suspended, since it is impossible to suspend a disconnected
 port.)
Is 3rd situation you mentioned above the function will be called is
hcd-bus_suspend?


 Fourthly, you should realize that controller itself will also be put
 into runtime suspend means the controller itself will be put into
 runtime suspend.
is 4th situation you mentioned above the function will be called is
ehci_suspend, (take ehci for example)?
but ehci_supend is called when system is going to suspend/hibernate,
or it will be called even in runtime suspend?

BTW, when I turn off the led on the keyboard, the keyboard can
successfully go to runtime suspend.
Would you mind to let us know how you find out the problem from mon files?
Is it due there is no remote wake control message on the mon file?

Sincerely appreciate your kind help,
--
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 1/6] usb: gadget: uvc: fix some error codes

2015-01-16 Thread Andrzej Pietrasiewicz

W dniu 14.01.2015 o 21:59, Dan Carpenter pisze:

We're basically saying ERR_CAST(NULL) and PTR_ERR(NULL) here, which is
nonsensical.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com


Acked-by: Andrzej Pietrasiewicz andrze...@samsung.com



diff --git a/drivers/usb/gadget/function/uvc_configfs.c 
b/drivers/usb/gadget/function/uvc_configfs.c
index 33d92ab..d112c99 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -148,7 +148,7 @@ static struct config_item *uvcg_control_header_make(struct 
config_group *group,

h = kzalloc(sizeof(*h), GFP_KERNEL);
if (!h)
-   return ERR_CAST(h);
+   return ERR_PTR(-ENOMEM);

h-desc.bLength  = UVC_DT_HEADER_SIZE(1);
h-desc.bDescriptorType  = USB_DT_CS_INTERFACE;
@@ -840,7 +840,7 @@ static int uvcg_streaming_header_allow_link(struct 
config_item *src,

format_ptr = kzalloc(sizeof(*format_ptr), GFP_KERNEL);
if (!format_ptr) {
-   ret = PTR_ERR(format_ptr);
+   ret = -ENOMEM;
goto out;
}
ret = 0;
@@ -960,7 +960,7 @@ static struct config_item

h = kzalloc(sizeof(*h), GFP_KERNEL);
if (!h)
-   return ERR_CAST(h);
+   return ERR_PTR(-ENOMEM);

INIT_LIST_HEAD(h-formats);
h-desc.bDescriptorType  = USB_DT_CS_INTERFACE;
@@ -1278,7 +1278,7 @@ static struct config_item *uvcg_frame_make(struct 
config_group *group,

h = kzalloc(sizeof(*h), GFP_KERNEL);
if (!h)
-   return ERR_CAST(h);
+   return ERR_PTR(-ENOMEM);

h-frame.b_descriptor_type   = USB_DT_CS_INTERFACE;
h-frame.b_frame_index   = 1;
@@ -1563,7 +1563,7 @@ static struct config_group *uvcg_uncompressed_make(struct 
config_group *group,

h = kzalloc(sizeof(*h), GFP_KERNEL);
if (!h)
-   return ERR_CAST(h);
+   return ERR_PTR(-ENOMEM);

h-desc.bLength  = UVC_DT_FORMAT_UNCOMPRESSED_SIZE;
h-desc.bDescriptorType  = USB_DT_CS_INTERFACE;
@@ -1772,7 +1772,7 @@ static struct config_group *uvcg_mjpeg_make(struct 
config_group *group,

h = kzalloc(sizeof(*h), GFP_KERNEL);
if (!h)
-   return ERR_CAST(h);
+   return ERR_PTR(-ENOMEM);

h-desc.bLength  = UVC_DT_FORMAT_MJPEG_SIZE;
h-desc.bDescriptorType  = USB_DT_CS_INTERFACE;
@@ -2124,7 +2124,7 @@ static int uvcg_streaming_class_allow_link(struct 
config_item *src,
count += 2; /* color_matching, NULL */
*class_array = kcalloc(count, sizeof(void *), GFP_KERNEL);
if (!*class_array) {
-   ret = PTR_ERR(*class_array);
+   ret = -ENOMEM;
goto unlock;
}

--
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



--
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 6/6] usb: gadget: uvc: cleanup UVCG_FRAME_ATTR macro

2015-01-16 Thread Andrzej Pietrasiewicz

W dniu 14.01.2015 o 22:06, Dan Carpenter pisze:

1) Change conv an vnoc to to_cpu_endian to to_little_endian.
2) No need to check the limit because that is already handled in
kstrtoXX so delete that parameter along with the check.
3) By using a bits parameter, we can combine the uxx parameter and
the str2u parameters.
4) The kstrtou##bits() conversion does not need to be done under the
mutex so move it to the start of the function.
5) Change the name of identity_conv to noop_conversion.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com



Acked-by: Andrzej Pietrasiewicz andrze...@samsung.com

 ---

This file has a couple pages of Sparse endian warnings.
http://lwn.net/Articles/205624/
It's hard to review the static checker warnings when there are so many.

diff --git a/drivers/usb/gadget/function/uvc_configfs.c 
b/drivers/usb/gadget/function/uvc_configfs.c
index a0443a2..87beb8c 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -1032,7 +1032,7 @@ static struct configfs_item_operations 
uvcg_frame_item_ops = {
.store_attribute= uvcg_frame_attr_store,
  };

-#define UVCG_FRAME_ATTR(cname, aname, conv, str2u, uxx, vnoc, limit)   \
+#define UVCG_FRAME_ATTR(cname, aname, to_cpu_endian, to_little_endian, bits) \
  static ssize_t uvcg_frame_##cname##_show(struct uvcg_frame *f, char *page)\
  { \
struct f_uvc_opts *opts;\
@@ -1046,7 +1046,7 @@ static ssize_t uvcg_frame_##cname##_show(struct 
uvcg_frame *f, char *page)\
opts = to_f_uvc_opts(opts_item);\
\
mutex_lock(opts-lock); \
-   result = sprintf(page, %d\n, conv(f-frame.cname));  \
+   result = sprintf(page, %d\n, to_cpu_endian(f-frame.cname)); \
mutex_unlock(opts-lock);   \
\
mutex_unlock(su_mutex); \
@@ -1061,7 +1061,11 @@ static ssize_t  uvcg_frame_##cname##_store(struct 
uvcg_frame *f, \
struct uvcg_format *fmt;\
struct mutex *su_mutex = f-item.ci_group-cg_subsys-su_mutex;\
int ret;\
-   uxx num;\
+   u##bits num;\
+   \
+   ret = kstrtou##bits(page, 0, num); \
+   if (ret)\
+   return ret; \
\
mutex_lock(su_mutex); /* for navigating configfs hierarchy */   \
\
@@ -1075,15 +1079,7 @@ static ssize_t  uvcg_frame_##cname##_store(struct 
uvcg_frame *f, \
goto end;   \
}   \
\
-   ret = str2u(page, 0, num); \
-   if (ret)\
-   goto end;   \
-   \
-   if (num  limit) {   \
-   ret = -EINVAL;  \
-   goto end;   \
-   }   \
-   f-frame.cname = vnoc(num);  \
+   f-frame.cname = to_little_endian(num);  \
ret = len;  \
  end:  \
mutex_unlock(opts-lock);   \
@@ -1097,24 +1093,20 @@ static struct uvcg_frame_attribute  
\
uvcg_frame_##cname##_show,  \
uvcg_frame_##cname##_store)

-#define identity_conv(x) (x)
+#define noop_conversion(x) (x)

-UVCG_FRAME_ATTR(bm_capabilities, bmCapabilities, identity_conv, kstrtou8, u8,
-   identity_conv, 0xFF);
-UVCG_FRAME_ATTR(w_width, wWidth, le16_to_cpu, kstrtou16, u16, cpu_to_le16,
-   0x);
-UVCG_FRAME_ATTR(w_height, 

Re: [patch 3/6] usb: gadget: uvc: remove an impossible condition

2015-01-16 Thread Andrzej Pietrasiewicz

W dniu 14.01.2015 o 22:02, Dan Carpenter pisze:

num is a u32 so (num  0x) is never true.  Also the range
is already checked in kstrtou32().

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com



Acked-by: Andrzej Pietrasiewicz andrze...@samsung.com


diff --git a/drivers/usb/gadget/function/uvc_configfs.c 
b/drivers/usb/gadget/function/uvc_configfs.c
index 2bd0688..738d68f 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -1156,8 +1156,6 @@ static inline int __uvcg_fill_frm_intrv(char *buf, void 
*priv)
ret = kstrtou32(buf, 0, num);
if (ret)
return ret;
-   if (num  0x)
-   return -EINVAL;

interv = priv;
**interv = cpu_to_le32(num);
--
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



--
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 4/6] usb: gadget: uvc: memory leak in uvcg_frame_make()

2015-01-16 Thread Andrzej Pietrasiewicz

W dniu 14.01.2015 o 22:03, Dan Carpenter pisze:

We need to add a kfree(h) on an error path.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com



Acked-by: Andrzej Pietrasiewicz andrze...@samsung.com


diff --git a/drivers/usb/gadget/function/uvc_configfs.c 
b/drivers/usb/gadget/function/uvc_configfs.c
index 738d68f..1af2686 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -1300,6 +1300,7 @@ static struct config_item *uvcg_frame_make(struct 
config_group *group,
h-fmt_type = UVCG_MJPEG;
} else {
mutex_unlock(opts-lock);
+   kfree(h);
return ERR_PTR(-EINVAL);
}
++fmt-num_frames;
--
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



--
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: Fatal Exception on device when Hotsyncing Palm in linux

2015-01-16 Thread Johan Hovold
On Thu, Jan 15, 2015 at 12:00:28AM +0100, Henri Manson wrote:
 I own a Palm m505 and a while ago a developed programs using SuperWaba
 and uploaded them using pilot-xfer. Using Ubuntu 14.04 I tried
 Hotsyncing on the device but now the devices shows a dialog box
 containing 'Fatal Exception' and then hangs.
 I figured out using VirtualBox and old Ubuntu ISO images that
 hotsyncing goes well in Ubuntu 9.04 and fatal exceptions start
 occurring as early as Ubuntu 10.04.

What kernel versions does this correspond to?

Thanks,
Johan
--
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 2/6] usb: gadget: uvc: cleanup __uvcg_fill_strm()

2015-01-16 Thread Andrzej Pietrasiewicz

W dniu 14.01.2015 o 22:01, Dan Carpenter pisze:

Static checkers complain about this API:

drivers/usb/gadget/function/uvc_configfs.c:2139
uvcg_streaming_class_allow_link()
warn: did you really mean to pass the address of 'data'?

Indeed, the code is cleaner when we just pass the pointer instead of the
pointer to the pointer.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com


I'm sorry but this patch breaks the code.

You should look at the broader context in which the __uvcg_fill_strm()
is called: it is used as a callback from __uvcg_iter_strm_cls().
The purpose of the latter is to iterate over a hierarchy of streaming
descriptors' config items built by the user with configfs.
This function is generic, because it needs to be called twice:
the first time to calculate the actual amount of memory needed for
an array of descriptors which is to be created, and the second time
to actually fill the said array - this is the purpose of __uvcg_fill_strm().

__uvcg_iter_strm_cls() flow of control is more or less like this:
process the header, then for each format that follows the header
process the format itself and then for each frame inside
a format process the frame.

__uvcg_fill_stream(), which is used to process, during its execution
uses priv2 as a pointer to a pointer, because it advances the current
position by the amount of data taken by each processed descriptor
and the advanced position should be visible outside this function,
so that the next time it is called, the current position corresponds
to the place where it was the last time rather than again at
the beginning of some block of data. In other words priv2
is an out parameter.


---
Looks obvious enough to me, but I've only compiled this code and haven't
tested it.



What I suggest is to revert this patch and then I will post another
patch which adds comments to __uvcg_iterm_strm_cls(), __uvcg_cnt_strm()
and __uvcg_fill_strm() so that their purpose and meaning of parameters
is clear.

AP
--
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/4] usb: phy: mxs: don't need IP fix for imx6sx

2015-01-16 Thread Peter Chen
The RLT code has already done it, so no software operation is needed.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/phy/phy-mxs-usb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index 58cae78..fcadbd2 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -131,8 +131,7 @@ static const struct mxs_phy_data vf610_phy_data = {
 };
 
 static const struct mxs_phy_data imx6sx_phy_data = {
-   .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS |
-   MXS_PHY_NEED_IP_FIX,
+   .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS,
 };
 
 static const struct of_device_id mxs_phy_dt_ids[] = {
-- 
1.9.1

--
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/4] usb: mxs-phy: remaining patches

2015-01-16 Thread Peter Chen
Hi Felipe,

These four patches are the gaps between Freescale internal tree
and mainline's. If these four can be accepted, then there is only
one patch between internal tree and mainline's, I submit it before,
but you have denied to accept adding a new interface at phy for
notifying phy when the bus suspend has occurred.

http://lists.infradead.org/pipermail/linux-arm-kernel/2013-December/218809.html
(The commit log is incorrrect, it should be the bus enters suspend)

Li Jun (1):
  usb: phy: mxs: refine mxs_phy_disconnect_line

Peter Chen (3):
  usb: phy: mxs: don't need IP fix for imx6sx
  usb: phy: mxs: do not set PWD.RXPWD1PT1 for low speed connection
  usb: phy: mxs: add delay before set phyctrl.clkgate

 drivers/usb/phy/phy-mxs-usb.c | 71 ---
 1 file changed, 67 insertions(+), 4 deletions(-)

-- 
1.9.1

--
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/4] usb: phy: mxs: add delay before set phyctrl.clkgate

2015-01-16 Thread Peter Chen
There is a request from IC engineer that if we doesn't
set phypwd as 0x, we need to delay about five
32Khz cycles before set phy's pwd register, otherwise,
the wakeup signal may can't wake up controller.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/phy/phy-mxs-usb.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index c3177a1..8f7cb06 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -371,10 +371,16 @@ static int mxs_phy_suspend(struct usb_phy *x, int suspend)
 * connect. The low speed connection will have problem at
 * very rare cases during usb suspend and resume process.
 */
-   if (low_speed_connection  vbus_is_on)
-   writel(0xfffb, x-io_priv + HW_USBPHY_PWD);
-   else
+   if (low_speed_connection  vbus_is_on) {
+   /*
+* If value to be set as pwd value is not 0x,
+* several 32Khz cycles are needed.
+*/
+   mxs_phy_clock_switch_delay();
+   writel(0xffbf, x-io_priv + HW_USBPHY_PWD);
+   } else {
writel(0x, x-io_priv + HW_USBPHY_PWD);
+   }
writel(BM_USBPHY_CTRL_CLKGATE,
   x-io_priv + HW_USBPHY_CTRL_SET);
clk_disable_unprepare(mxs_phy-clk);
-- 
1.9.1

--
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/4] usb: phy: mxs: do not set PWD.RXPWD1PT1 for low speed connection

2015-01-16 Thread Peter Chen
At very rare cases, the SoF will not send out after resume with
low speed connection. The workaround is do not power down
PWD.RXPWD1PT1 bit during the suspend.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/phy/phy-mxs-usb.c | 47 ++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index eb74605..c3177a1 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -70,6 +70,9 @@
 #define ANADIG_USB2_LOOPBACK_SET   0x244
 #define ANADIG_USB2_LOOPBACK_CLR   0x248
 
+#define ANADIG_USB1_MISC   0x1f0
+#define ANADIG_USB2_MISC   0x250
+
 #define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG   BIT(12)
 #define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG_SL BIT(11)
 
@@ -81,6 +84,11 @@
 #define BM_ANADIG_USB2_LOOPBACK_UTMI_DIG_TST1  BIT(2)
 #define BM_ANADIG_USB2_LOOPBACK_TSTI_TX_EN BIT(5)
 
+#define BM_ANADIG_USB1_MISC_RX_VPIN_FS BIT(29)
+#define BM_ANADIG_USB1_MISC_RX_VMIN_FS BIT(28)
+#define BM_ANADIG_USB2_MISC_RX_VPIN_FS BIT(29)
+#define BM_ANADIG_USB2_MISC_RX_VMIN_FS BIT(28)
+
 #define to_mxs_phy(p) container_of((p), struct mxs_phy, phy)
 
 /* Do disconnection between PHY and controller without vbus */
@@ -323,13 +331,50 @@ static void mxs_phy_shutdown(struct usb_phy *phy)
clk_disable_unprepare(mxs_phy-clk);
 }
 
+static bool mxs_phy_is_low_speed_connection(struct mxs_phy *mxs_phy)
+{
+   unsigned int line_state;
+   /* bit definition is the same for all controllers */
+   unsigned int dp_bit = BM_ANADIG_USB1_MISC_RX_VPIN_FS,
+dm_bit = BM_ANADIG_USB1_MISC_RX_VMIN_FS;
+   unsigned int reg = ANADIG_USB1_MISC;
+
+   /* If the SoCs don't have anatop, quit */
+   if (!mxs_phy-regmap_anatop)
+   return false;
+
+   if (mxs_phy-port_id == 0)
+   reg = ANADIG_USB1_MISC;
+   else if (mxs_phy-port_id == 1)
+   reg = ANADIG_USB2_MISC;
+
+   regmap_read(mxs_phy-regmap_anatop, reg, line_state);
+
+   if ((line_state  (dp_bit | dm_bit)) ==  dm_bit)
+   return true;
+   else
+   return false;
+}
+
 static int mxs_phy_suspend(struct usb_phy *x, int suspend)
 {
int ret;
struct mxs_phy *mxs_phy = to_mxs_phy(x);
+   bool low_speed_connection, vbus_is_on;
+
+   low_speed_connection = mxs_phy_is_low_speed_connection(mxs_phy);
+   vbus_is_on = mxs_phy_get_vbus_status(mxs_phy);
 
if (suspend) {
-   writel(0x, x-io_priv + HW_USBPHY_PWD);
+   /*
+* FIXME: Do not power down RXPWD1PT1 bit for low speed
+* connect. The low speed connection will have problem at
+* very rare cases during usb suspend and resume process.
+*/
+   if (low_speed_connection  vbus_is_on)
+   writel(0xfffb, x-io_priv + HW_USBPHY_PWD);
+   else
+   writel(0x, x-io_priv + HW_USBPHY_PWD);
writel(BM_USBPHY_CTRL_CLKGATE,
   x-io_priv + HW_USBPHY_CTRL_SET);
clk_disable_unprepare(mxs_phy-clk);
-- 
1.9.1

--
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 2/4] usb: phy: mxs: refine mxs_phy_disconnect_line

2015-01-16 Thread Peter Chen
From: Li Jun b47...@freescale.com

For non-otg mode, we keep the usage of disconnect line between phy analog
and digital unchanging; for otg mode, at peripheral role, we keep the usage
unchanging too, at host role, the digital part needs to know dp/dm change
to respond device's data pulse when it is at low power mode.

Signed-off-by: Peter Chen peter.c...@freescale.com
Signed-off-by: Li Jun b47...@freescale.com
---
 drivers/usb/phy/phy-mxs-usb.c | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index fcadbd2..eb74605 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -40,6 +40,7 @@
 
 #define BM_USBPHY_CTRL_SFTRST  BIT(31)
 #define BM_USBPHY_CTRL_CLKGATE BIT(30)
+#define BM_USBPHY_CTRL_OTG_ID_VALUEBIT(27)
 #define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS   BIT(26)
 #define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATEBIT(25)
 #define BM_USBPHY_CTRL_ENVBUSCHG_WKUP  BIT(23)
@@ -255,6 +256,18 @@ static void __mxs_phy_disconnect_line(struct mxs_phy 
*mxs_phy, bool disconnect)
usleep_range(500, 1000);
 }
 
+static bool mxs_phy_is_otg_host(struct mxs_phy *mxs_phy)
+{
+   void __iomem *base = mxs_phy-phy.io_priv;
+   u32 phyctrl = readl(base + HW_USBPHY_CTRL);
+
+   if (IS_ENABLED(CONFIG_USB_OTG) 
+   !(phyctrl  BM_USBPHY_CTRL_OTG_ID_VALUE))
+   return true;
+
+   return false;
+}
+
 static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on)
 {
bool vbus_is_on = false;
@@ -269,7 +282,7 @@ static void mxs_phy_disconnect_line(struct mxs_phy 
*mxs_phy, bool on)
 
vbus_is_on = mxs_phy_get_vbus_status(mxs_phy);
 
-   if (on  !vbus_is_on)
+   if (on  !vbus_is_on  !mxs_phy_is_otg_host(mxs_phy))
__mxs_phy_disconnect_line(mxs_phy, true);
else
__mxs_phy_disconnect_line(mxs_phy, false);
-- 
1.9.1

--
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 v3 1/3] usb: udc: add usb_gadget_find_udc

2015-01-16 Thread Peter Chen
This is an internal API, and is used to find corresponding udc according
to gadget.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/udc/udc-core.c | 51 ---
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/drivers/usb/gadget/udc/udc-core.c 
b/drivers/usb/gadget/udc/udc-core.c
index e31d574..36c58c9 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -52,6 +52,25 @@ static DEFINE_MUTEX(udc_lock);
 
 /* - */
 
+static struct usb_udc *usb_gadget_find_udc(struct usb_gadget *gadget)
+{
+   struct usb_udc  *udc = NULL;
+
+   mutex_lock(udc_lock);
+   list_for_each_entry(udc, udc_list, list)
+   if (udc-gadget == gadget)
+   goto found;
+   mutex_unlock(udc_lock);
+   dev_err(gadget-dev.parent, gadget not registered.\n);
+
+   return NULL;
+
+found:
+   mutex_unlock(udc_lock);
+   return udc;
+}
+
+/* - */
 #ifdef CONFIG_HAS_DMA
 
 int usb_gadget_map_request(struct usb_gadget *gadget,
@@ -128,21 +147,10 @@ EXPORT_SYMBOL_GPL(usb_gadget_giveback_request);
 
 static void usb_gadget_state_work(struct work_struct *work)
 {
-   struct usb_gadget   *gadget = work_to_gadget(work);
-   struct usb_udc  *udc = NULL;
-
-   mutex_lock(udc_lock);
-   list_for_each_entry(udc, udc_list, list)
-   if (udc-gadget == gadget)
-   goto found;
-   mutex_unlock(udc_lock);
-
-   return;
-
-found:
-   mutex_unlock(udc_lock);
+   struct usb_udc *udc = usb_gadget_find_udc(work_to_gadget(work));
 
-   sysfs_notify(udc-dev.kobj, NULL, state);
+   if (udc)
+   sysfs_notify(udc-dev.kobj, NULL, state);
 }
 
 void usb_gadget_set_state(struct usb_gadget *gadget,
@@ -348,21 +356,14 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
  */
 void usb_del_gadget_udc(struct usb_gadget *gadget)
 {
-   struct usb_udc  *udc = NULL;
-
-   mutex_lock(udc_lock);
-   list_for_each_entry(udc, udc_list, list)
-   if (udc-gadget == gadget)
-   goto found;
-
-   dev_err(gadget-dev.parent, gadget not registered.\n);
-   mutex_unlock(udc_lock);
+   struct usb_udc *udc = usb_gadget_find_udc(gadget);
 
-   return;
+   if (!udc)
+   return;
 
-found:
dev_vdbg(gadget-dev.parent, unregistering gadget\n);
 
+   mutex_lock(udc_lock);
list_del(udc-list);
mutex_unlock(udc_lock);
 
-- 
1.9.1

--
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 v3 2/3] usb: udc: add usb_udc_vbus_handler

2015-01-16 Thread Peter Chen
This commit updates udc core vbus status, and try to connect
or disconnect gadget.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/udc/udc-core.c | 34 +-
 include/linux/usb/gadget.h|  4 
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/udc-core.c 
b/drivers/usb/gadget/udc/udc-core.c
index 36c58c9..9396a86 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -35,6 +35,8 @@
  * @dev - the child device to the actual controller
  * @gadget - the gadget. For use by the class code
  * @list - for use by the udc class driver
+ * @vbus - for udcs who care about vbus status, this value is real vbus status;
+ * for udcs who do not care about vbus status, this value is always true
  *
  * This represents the internal data structure which is used by the UDC-class
  * to hold information about udc driver and gadget together.
@@ -44,6 +46,7 @@ struct usb_udc {
struct usb_gadget   *gadget;
struct device   dev;
struct list_headlist;
+   boolvbus;
 };
 
 static struct class *udc_class;
@@ -163,6 +166,34 @@ EXPORT_SYMBOL_GPL(usb_gadget_set_state);
 
 /* - */
 
+static void usb_udc_connect_control(struct usb_udc *udc)
+{
+   if (udc-vbus)
+   usb_gadget_connect(udc-gadget);
+   else
+   usb_gadget_disconnect(udc-gadget);
+}
+
+/**
+ * usb_udc_vbus_handler - updates the udc core vbus status, and try to
+ * connect or disconnect gadget
+ * @gadget: The gadget which vbus change occurs
+ * @status: The vbus status
+ *
+ * The udc driver calls it when it wants to connect or disconnect gadget
+ * according to vbus status.
+ */
+void usb_udc_vbus_handler(struct usb_gadget *gadget, bool status)
+{
+   struct usb_udc *udc = usb_gadget_find_udc(gadget);
+
+   if (udc) {
+   udc-vbus = status;
+   usb_udc_connect_control(udc);
+   }
+}
+EXPORT_SYMBOL_GPL(usb_udc_vbus_handler);
+
 /**
  * usb_gadget_udc_reset - notifies the udc core that bus reset occurs
  * @gadget: The gadget which bus reset occurs
@@ -295,6 +326,7 @@ int usb_add_gadget_udc_release(struct device *parent, 
struct usb_gadget *gadget,
goto err4;
 
usb_gadget_set_state(gadget, USB_STATE_NOTATTACHED);
+   udc-vbus = true;
 
mutex_unlock(udc_lock);
 
@@ -398,7 +430,7 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct 
usb_gadget_driver *dri
driver-unbind(udc-gadget);
goto err1;
}
-   usb_gadget_connect(udc-gadget);
+   usb_udc_connect_control(udc);
 
kobject_uevent(udc-dev.kobj, KOBJ_CHANGE);
return 0;
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 70ddb39..2be007a 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -1027,6 +1027,10 @@ extern void usb_gadget_udc_reset(struct usb_gadget 
*gadget,
 extern void usb_gadget_giveback_request(struct usb_ep *ep,
struct usb_request *req);
 
+/*-*/
+
+/* utility to update vbus status for udc core, it may be scheduled */
+extern void usb_udc_vbus_handler(struct usb_gadget *gadget, bool status);
 
 /*-*/
 
-- 
1.9.1

--
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 v3 0/3] usb: udc: Unify dp control

2015-01-16 Thread Peter Chen
Hi Felipe,

This is the follow-up: http://marc.info/?l=linux-usbm=140979297227434w=2.
Sorry for late.

In the first patch, we introduce an internal APIs which are used to
find corresponding udc according to usb_gadget, it can simplify the code 
structure.

In the 2nd patch, it maintains flag 'vbus' as vbus status, and try to connect
or disconnect gadget according to vbus status.
In the 3rd patch, it maintains count 'deactivations' for connect or disconnect
gadget according to function/user behavior.

If you agree with handing dp like above way, I will have two patchset, one for
udc driver for 'vbus' and another for function driver for 'deactivations'.

Thank you.

Changes for v3:
- Add mutex_lock protect for list_del(udc-list) at usb_del_gadget_udc [Patch 
1/3]
- Drop former [Patch 2/4] which is useless

Changes for v2:
- introduce two internal APIs to simplify the code structure.
- Teach patch 3/4 and 4/4 to use the new introduced API.

Peter Chen (3):
  usb: udc: add usb_gadget_find_udc
  usb: udc: add usb_udc_vbus_handler
  usb: udc: add usb_udc_activation_handler

 drivers/usb/gadget/udc/udc-core.c | 111 +-
 include/linux/usb/gadget.h|   9 
 2 files changed, 94 insertions(+), 26 deletions(-)

-- 
1.9.1

--
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 v3 3/3] usb: udc: add usb_udc_activation_handler

2015-01-16 Thread Peter Chen
During this API, the deactivation count will be update, and it
will try to connect or disconnect gadget. It can be used to
enable functions for gadget.

Signed-off-by: Peter Chen peter.c...@freescale.com
---
 drivers/usb/gadget/udc/udc-core.c | 28 +++-
 include/linux/usb/gadget.h|  5 +
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/udc-core.c 
b/drivers/usb/gadget/udc/udc-core.c
index 9396a86..86d4d19 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -37,6 +37,7 @@
  * @list - for use by the udc class driver
  * @vbus - for udcs who care about vbus status, this value is real vbus status;
  * for udcs who do not care about vbus status, this value is always true
+ * @deactivations - the deactivation count to connect or disconnect gadget
  *
  * This represents the internal data structure which is used by the UDC-class
  * to hold information about udc driver and gadget together.
@@ -47,6 +48,7 @@ struct usb_udc {
struct device   dev;
struct list_headlist;
boolvbus;
+   int deactivations;
 };
 
 static struct class *udc_class;
@@ -168,13 +170,37 @@ EXPORT_SYMBOL_GPL(usb_gadget_set_state);
 
 static void usb_udc_connect_control(struct usb_udc *udc)
 {
-   if (udc-vbus)
+   if (udc-vbus  !udc-deactivations)
usb_gadget_connect(udc-gadget);
else
usb_gadget_disconnect(udc-gadget);
 }
 
 /**
+ * usb_udc_activation_handler - updates udc's deactivation count and
+ * try to connect or disconnect
+ *
+ * @gadget: The gadget which the function is at
+ * @active: the function needs to be active or not
+ *
+ * The composite core calls it when it wants to activate or deactivate
+ * function.
+ */
+void usb_udc_activation_handler(struct usb_gadget *gadget, bool active)
+{
+   struct usb_udc *udc = usb_gadget_find_udc(gadget);
+
+   if (udc) {
+   if (active)
+   udc-deactivations--;
+   else
+   udc-deactivations++;
+   usb_udc_connect_control(udc);
+   }
+}
+EXPORT_SYMBOL_GPL(usb_udc_activation_handler);
+
+/**
  * usb_udc_vbus_handler - updates the udc core vbus status, and try to
  * connect or disconnect gadget
  * @gadget: The gadget which vbus change occurs
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 2be007a..4d1adea 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -1034,6 +1034,11 @@ extern void usb_udc_vbus_handler(struct usb_gadget 
*gadget, bool status);
 
 /*-*/
 
+/* utility to activate or deactive function */
+extern void usb_udc_activation_handler(struct usb_gadget *gadget, bool active);
+
+/*-*/
+
 /* utility wrapping a simple endpoint selection policy */
 
 extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
-- 
1.9.1

--
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 2/6] usb: gadget: uvc: cleanup __uvcg_fill_strm()

2015-01-16 Thread Dan Carpenter
Oh, yeah.  You're right.  I should have been more careful and I should
have seen that.  Sorry.  But the problem is the original code is still a
bit buggy.

We call:

data = kzalloc();

Inside __uvcg_fill_strm() we do data += something;

kfree(data);

We should save the orignal data pointer so that we can free it
correctly at the end in uvcg_streaming_class_allow_link().

regards,
dan carpenter

--
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: NETDEV WATCHDOG: internal(r8152): transmit queue 0 timed out

2015-01-16 Thread poma
On 16.01.2015 10:37, Hayes Wang wrote:
  poma [mailto:pomidorabelis...@gmail.com] 
 Sent: Friday, January 16, 2015 4:25 PM
 [...]
 This looks like a USB problem. Is there a way to get usb (or 
 NetworkManager) to reinitialize the driver when this happens?

 I would ask these people for advice, therefore.
 
 Our hw engineers need to analyse the behavior of the device.
 However, I don't think you have such instrument to provide
 the required information. If we don't know the reason, we
 couldn't give you the proper solution. Besides, your solution
 would work if and only if reloading the driver is helpful.
 
 The issue have to debug from the hardware, and I have no idea
 about what the software could do before analysing the hw. Maybe
 you could try the following driver first to check if it is useful.
 
 http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=2PNid=13PFid=56Level=5Conn=4DownTypeID=3GetDown=false
  
 Best Regards,
 Hayes
 

Thanks for your response, Mr. Hayes.

Mr. Sean, please download and check if timeout is still present with built 
RTL8153 module from REALTEK site, as Mr. Hayes proposed.
http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=2PNid=13PFid=56Level=5Conn=4DownTypeID=3GetDown=false#2
r8152.53-2.03.0.tar.bz2

Procedure - should be equal for both, Fedora 21  20:

$ uname -r
3.17.8-300.fc21.x86_64

$ su -c 'yum install kernel-devel'

$ tar xf r8152.53-2.03.0.tar.bz2
$ cd r8152-2.03.0/
$ make
$ su

# cp 50-usb-realtek-net.rules /etc/udev/rules.d/
# udevadm trigger --action=add

# modprobe -rv r8152
# cp r8152.ko /lib/modules/$(uname -r)/updates/
# depmod
# modprobe -v r8152


poma

--
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 2/6] usb: gadget: uvc: cleanup __uvcg_fill_strm()

2015-01-16 Thread Andrzej Pietrasiewicz

W dniu 16.01.2015 o 13:12, Dan Carpenter pisze:

Oh, yeah.  You're right.  I should have been more careful and I should
have seen that.  Sorry.  But the problem is the original code is still a
bit buggy.

We call:

data = kzalloc();

Inside __uvcg_fill_strm() we do data += something;

kfree(data);

We should save the orignal data pointer so that we can free it
correctly at the end in uvcg_streaming_class_allow_link().


Yeah, right. Thank you for spotting this. The kfree() is called
only if __uvcg_fill_strm() fails, though. But of course this needs
to be fixed.

AP

--
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] usb: phy: never defer probe in non-OF case

2015-01-16 Thread Sergei Shtylyov

Hello.

On 1/16/2015 11:30 AM, Heikki Krogerus wrote:


In practice failure to find phy when requested in non-OF
case means it will never become available, so
__usb_find_phy() must return -ENODEV and not -EPROBE_DEFER.



This fixes a regression caused by commit
9c9d82492b73991e8e13a6c0af06e44816c31438, where the USB


   Please also specify that commit's summary in parens.


controller driver is left infinitely into deferred probe
when there are no phys.



Signed-off-by: Heikki Krogerus heikki.kroge...@linux.intel.com


[...]

WBR, Sergei

--
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/3] usb: gadget: uvc: comments for iterating over streaming hierarchy

2015-01-16 Thread Andrzej Pietrasiewicz
The purpose of the functions and their parametrs might not be obvious
to the reader, so explain it.

Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
---
 drivers/usb/gadget/function/uvc_configfs.c | 34 ++
 1 file changed, 34 insertions(+)

diff --git a/drivers/usb/gadget/function/uvc_configfs.c 
b/drivers/usb/gadget/function/uvc_configfs.c
index 49f25e8..6fd40c5 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -1918,6 +1918,25 @@ enum uvcg_strm_type {
UVCG_FRAME
 };
 
+/*
+ * Iterate over a hierarchy of streaming descriptors' config items.
+ * The items are created by the user with configfs.
+ *
+ * It processes the header pointed to by @priv1, then for each format
+ * that follows the header processes the format itself and then for
+ * each frame inside a format processes the frame.
+ *
+ * As a processing function the @fun is used.
+ *
+ * __uvcg_iter_strm_cls() is used in two context: first, to calculate
+ * the amount of memory needed for an array of streaming descriptors
+ * and second, to actually fill the array.
+ *
+ * @priv1: an in parameter
+ * @priv2: an inout parameter (the caller might want to see the changes to 
it)
+ * @priv3: an inout parameter (the caller might want to see the changes to 
it)
+ * @fun: callback function for processing each level of the hierarchy
+ */
 static int __uvcg_iter_strm_cls(void *priv1, void *priv2, void *priv3,
int (*fun)(void *, void *, void *, int, enum uvcg_strm_type type))
 {
@@ -1951,6 +1970,14 @@ static int __uvcg_iter_strm_cls(void *priv1, void 
*priv2, void *priv3,
return ret;
 }
 
+/*
+ * Count how many bytes are needed for an array of streaming descriptors.
+ *
+ * @priv1: pointer to a header, format or frame
+ * @priv2: inout parameter, accumulated size of the array
+ * @priv3: inout parameter, accumulated number of the array elements
+ * @n: unused, this function's prototype must match @fun in 
__uvcg_iter_strm_cls
+ */
 static int __uvcg_cnt_strm(void *priv1, void *priv2, void *priv3, int n,
   enum uvcg_strm_type type)
 {
@@ -2000,6 +2027,13 @@ static int __uvcg_cnt_strm(void *priv1, void *priv2, 
void *priv3, int n,
return 0;
 }
 
+/*
+ * Fill an array of streaming descriptors.
+ *
+ * @priv1: pointer to a header, format or frame
+ * @priv2: inout parameter, pointer into a block of memory
+ * @priv3: inout parameter, pointer to a 2-dimensional array
+ */
 static int __uvcg_fill_strm(void *priv1, void *priv2, void *priv3, int n,
enum uvcg_strm_type type)
 {
-- 
1.9.1

--
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 2/3] usb: gadget: uvc: preserve the address passed to kfree()

2015-01-16 Thread Andrzej Pietrasiewicz
__uvcg_fill_strm() called from __uvcg_iter_stream_cls()
might have advanced the data even if __uvcg_iter_stream_cls()
returns an error, so use a backup copy as an argument to kfree().

Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
---
 drivers/usb/gadget/function/uvc_configfs.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/function/uvc_configfs.c 
b/drivers/usb/gadget/function/uvc_configfs.c
index cc2a613..49f25e8 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -2086,7 +2086,7 @@ static int uvcg_streaming_class_allow_link(struct 
config_item *src,
struct mutex *su_mutex = src-ci_group-cg_subsys-su_mutex;
struct uvc_descriptor_header ***class_array, **cl_arr;
struct uvcg_streaming_header *target_hdr;
-   void *data;
+   void *data, *data_save;
size_t size = 0, count = 0;
int ret = -EINVAL;
 
@@ -2119,7 +2119,7 @@ static int uvcg_streaming_class_allow_link(struct 
config_item *src,
goto unlock;
}
 
-   data = kzalloc(size, GFP_KERNEL);
+   data = data_save = kzalloc(size, GFP_KERNEL);
if (!data) {
kfree(*class_array);
*class_array = NULL;
@@ -2132,7 +2132,11 @@ static int uvcg_streaming_class_allow_link(struct 
config_item *src,
if (ret) {
kfree(*class_array);
*class_array = NULL;
-   kfree(data);
+   /*
+* __uvcg_fill_strm() called from __uvcg_iter_stream_cls()
+* might have advanced the data, so use a backup copy
+*/
+   kfree(data_save);
goto unlock;
}
*cl_arr = (struct uvc_descriptor_header *)opts-uvc_color_matching;
-- 
1.9.1

--
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/3] Revert usb: gadget: uvc: cleanup __uvcg_fill_strm()

2015-01-16 Thread Andrzej Pietrasiewicz
This reverts commit c0b53cb16250 (usb: gadget: uvc: cleanup 
__uvcg_fill_strm()).
__uvcg_fill_stream() during its execution uses priv2 as a pointer
to a pointer, because it advances the current position by the amount
of data taken by each processed descriptor and the advanced position
should be visible outside this function, so that the next time it is
called, the current position corresponds to the place where it was
the last time rather than again at the beginning of some block of data.
In other words priv2 is an out parameter.

Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
---
 drivers/usb/gadget/function/uvc_configfs.c | 39 +++---
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/gadget/function/uvc_configfs.c 
b/drivers/usb/gadget/function/uvc_configfs.c
index 8a6cd61..cc2a613 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -2000,27 +2000,28 @@ static int __uvcg_cnt_strm(void *priv1, void *priv2, 
void *priv3, int n,
return 0;
 }
 
-static int __uvcg_fill_strm(void *priv1, void *dest, void *priv3, int n,
+static int __uvcg_fill_strm(void *priv1, void *priv2, void *priv3, int n,
enum uvcg_strm_type type)
 {
+   void **dest = priv2;
struct uvc_descriptor_header ***array = priv3;
size_t sz;
 
-   **array = dest;
+   **array = *dest;
++*array;
 
switch (type) {
case UVCG_HEADER: {
-   struct uvc_input_header_descriptor *ihdr = dest;
+   struct uvc_input_header_descriptor *ihdr = *dest;
struct uvcg_streaming_header *h = priv1;
struct uvcg_format_ptr *f;
 
-   memcpy(dest, h-desc, sizeof(h-desc));
-   dest += sizeof(h-desc);
+   memcpy(*dest, h-desc, sizeof(h-desc));
+   *dest += sizeof(h-desc);
sz = UVCG_STREAMING_CONTROL_SIZE;
list_for_each_entry(f, h-formats, entry) {
-   memcpy(dest, f-fmt-bmaControls, sz);
-   dest += sz;
+   memcpy(*dest, f-fmt-bmaControls, sz);
+   *dest += sz;
}
ihdr-bLength = sizeof(h-desc) + h-num_fmt * sz;
ihdr-bNumFormats = h-num_fmt;
@@ -2030,22 +2031,22 @@ static int __uvcg_fill_strm(void *priv1, void *dest, 
void *priv3, int n,
struct uvcg_format *fmt = priv1;
 
if (fmt-type == UVCG_UNCOMPRESSED) {
-   struct uvc_format_uncompressed *unc = dest;
+   struct uvc_format_uncompressed *unc = *dest;
struct uvcg_uncompressed *u =
container_of(fmt, struct uvcg_uncompressed,
 fmt);
 
-   memcpy(dest, u-desc, sizeof(u-desc));
-   dest += sizeof(u-desc);
+   memcpy(*dest, u-desc, sizeof(u-desc));
+   *dest += sizeof(u-desc);
unc-bNumFrameDescriptors = fmt-num_frames;
unc-bFormatIndex = n + 1;
} else if (fmt-type == UVCG_MJPEG) {
-   struct uvc_format_mjpeg *mjp = dest;
+   struct uvc_format_mjpeg *mjp = *dest;
struct uvcg_mjpeg *m =
container_of(fmt, struct uvcg_mjpeg, fmt);
 
-   memcpy(dest, m-desc, sizeof(m-desc));
-   dest += sizeof(m-desc);
+   memcpy(*dest, m-desc, sizeof(m-desc));
+   *dest += sizeof(m-desc);
mjp-bNumFrameDescriptors = fmt-num_frames;
mjp-bFormatIndex = n + 1;
} else {
@@ -2055,15 +2056,15 @@ static int __uvcg_fill_strm(void *priv1, void *dest, 
void *priv3, int n,
break;
case UVCG_FRAME: {
struct uvcg_frame *frm = priv1;
-   struct uvc_descriptor_header *h = dest;
+   struct uvc_descriptor_header *h = *dest;
 
sz = sizeof(frm-frame);
-   memcpy(dest, frm-frame, sz);
-   dest += sz;
+   memcpy(*dest, frm-frame, sz);
+   *dest += sz;
sz = frm-frame.b_frame_interval_type *
sizeof(*frm-dw_frame_interval);
-   memcpy(dest, frm-dw_frame_interval, sz);
-   dest += sz;
+   memcpy(*dest, frm-dw_frame_interval, sz);
+   *dest += sz;
if (frm-fmt_type == UVCG_UNCOMPRESSED)
h-bLength = UVC_DT_FRAME_UNCOMPRESSED_SIZE(
frm-frame.b_frame_interval_type);
@@ -2126,7 +2127,7 @@ static int uvcg_streaming_class_allow_link(struct 
config_item *src,
goto unlock;
}

[PATCH 0/3] Fixes for configfs support in uvc

2015-01-16 Thread Andrzej Pietrasiewicz
This short series reverts a commit which, at a first glance,
simplifies the code but in fact makes it not work correctly,
and then applies a small fix and adds some comments to functions.

Andrzej Pietrasiewicz (3):
  Revert usb: gadget: uvc: cleanup __uvcg_fill_strm()
  usb: gadget: uvc: preserve the address passed to kfree()
  usb: gadget: uvc: comments for iterating over streaming hierarchy

 drivers/usb/gadget/function/uvc_configfs.c | 83 ++
 1 file changed, 61 insertions(+), 22 deletions(-)

-- 
1.9.1

--
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: USB 3.0 and xHCI Host-Controller

2015-01-16 Thread Gustavo Duarte
Greg and all,

Something more to try on this ?

Greg do you have time to take look on this ?

Thanks in advance.


Gustavo.

On Wed, Jan 14, 2015 at 7:46 PM, Gustavo Duarte gus.dua...@gmail.com wrote:
 My response, sent on Jan 7. I don't understand why I can't found it on
 the mail list archives.  May be because linux-usb@vger.kernel.org
 address is CC ?



 -- Forwarded message --
 From: Gustavo Duarte gus.dua...@gmail.com
 Date: Tue, Jan 6, 2015 at 10:46 AM
 Subject: Re: USB 3.0 and xHCI Host-Controller
 To: Mathias Nyman mathias.ny...@linux.intel.com
 Cc: linux-usb@vger.kernel.org


 Mathias/all

 I tried your three suggestions:

 1) use old style enumeration, before pluging in your device do:
  'echo y  /sys/module/usbcore/parameters/old_scheme_first'

 *The same behaviour.

 2)  use 3.18 kernel, it has fixes for misbehaving halted control endpoints

 *The same behaviour.


 3)  hack the xhci code and remove setting the new maxpacket size, and see if
   it makes a difference.
   Do a codechange like this, (copy-pasted diff), and rebuild:

 Results:

 I did the hack on one of the latest branches of  Ubuntu source kernel
 3.18, http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-vivid.git;a=summary

 After did the changes on xhci code, and rebuild the kernel.

 a) Connect the brick to the PC
 b) Switch on, and the device was detected as usb device. (logs lines
 were recorded)
 c) Run fw uploading, and the device isn't longer detected by the
 communication library.

 After this hack seem like the behaviour become worst.

 I attached a fragment of  /var/logs/syslog related.

 Something else to try ?

 Thanks in advance.

 Gustavo.

 On Thu, Dec 18, 2014 at 4:42 PM, Gustavo Duarte gus.dua...@gmail.com wrote:
 Thanks Mathis for these suggestions, i'm going to try it, and let you
 know the results.

 i hope you have a nice rest.

 Gustavo.


 On Thu, Dec 18, 2014 at 2:12 PM, Mathias Nyman
 mathias.ny...@linux.intel.com wrote:
 Hi

 On 18.12.2014 13:49, Gustavo Duarte wrote:
 Mathias /Guys,

 I got the debug log of the xhci_hcd module, during the communication
 with the robot kit (Lego brick).

 Attached are two files:

 brick-boot.log:
 The brick is connected to USB port, and press switch ON button.

 upload.log:
 The brick is already ON, and start the uploading of an application
 code from PC - Brick, the uploading procedure never finished.

 I don't know so much about usb communications, but seeing these file
 logs, I didn't see any estrange message.

 What do you think, can you see some clue there ?

 Looks like it first finds a mismatch in max packet size after device is
 addressed, xhci tries to  re-configure the endpoint to match the new
 maxpacket size. It says it succeeds but immediately  after that halts the
 endpoint. After this we see most of the usb transfers cancelled.

 Things to try:

 - use old style enumeration, before pluging in your device do:
   'echo y  /sys/module/usbcore/parameters/old_scheme_first'

 - use 3.18 kernel, it has fixes for misbehaving halted control endpoints

 - hack the xhci code and remove setting the new maxpacket size, and see if
   it makes a difference.
   Do a codechange like this, (copy-pasted diff), and rebuild:

 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
 index 5be1bff..2778c37 100644
 --- a/drivers/usb/host/xhci.c
 +++ b/drivers/usb/host/xhci.c
 @@ -1370,7 +1370,7 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb 
 *urb, gfp_t mem_flags)
 /* Check to see if the max packet size for the default 
 control
  * endpoint changed during FS device enumeration
  */
 -   if (urb-dev-speed == USB_SPEED_FULL) {
 +   if (urb-dev-speed == USB_SPEED_FULL  0) {
 ret = xhci_check_maxpacket(xhci, slot_id,
 ep_index, urb);
 if (ret  0) {

 I'll be away until 5. Jan on vacation, trying not to read emails


 -Mathias
--
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


question on possible deadlock with devices with multiple interfaces

2015-01-16 Thread Oliver Neukum
Hi,

I was looking at the CDC-WDM driver. It uses cancel_work_sync()
in the pre_reset() method. I looked at the work and saw a GFP_KERNEL
there.
Now suppose a device has a wdm interface and a storage interface.

Is the following sequence possible?

kmalloc with GFP_KERNEL in the work
VM layer decides to page to storage interface
task blocks waiting for completion of IO

SCSI layer sees an error
SCSI error handling starts
SCSI layer requests a bus reset

USB layer calls pre_reset() of cdc-wdm
wdm_pre_reset() calls cancel_work_sync()
cancel_work_sync() waits for work to finish
DEADLOCK

What do you think?

Regards
Oliver


--
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: USB 3.0 and xHCI Host-Controller

2015-01-16 Thread Greg KH

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Fri, Jan 16, 2015 at 12:57:34PM -0200, Gustavo Duarte wrote:
 Greg and all,
 
 Something more to try on this ?

You said you were going to respond back with the answers to the
questions, did I miss that response?

thanks,

greg k-h
--
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: USB 3.0 and xHCI Host-Controller

2015-01-16 Thread Mathias Nyman
Hi

Sorry about not answering earlier, many new things piled up during my vacation 
and needed attention.

If I can find some spare time I'll try to take another look, but don't let any 
bigger
project pend on this alone.

In addition to digging into the code yourself, the best thing I can recommend 
is taking
new logs with the  latest 3.19-rc kernel with both xhci and usb core verbose 
debugging:

echo -n 'module xhci_hcd =p'  /sys/kernel/debug/dynamic_debug/control
echo -n 'module usbcore =p' /sys/kernel/debug/dynamic_debug/control

also usbmon traces can be helpful, at least for others, I'm myself horribly 
slow at deciphering those

-Mathias



On 16.01.2015 16:57, Gustavo Duarte wrote:
 Greg and all,
 
 Something more to try on this ?
 
 Greg do you have time to take look on this ?
 
 Thanks in advance.
 
 
 Gustavo.
 
 On Wed, Jan 14, 2015 at 7:46 PM, Gustavo Duarte gus.dua...@gmail.com wrote:
 My response, sent on Jan 7. I don't understand why I can't found it on
 the mail list archives.  May be because linux-usb@vger.kernel.org
 address is CC ?



 -- Forwarded message --
 From: Gustavo Duarte gus.dua...@gmail.com
 Date: Tue, Jan 6, 2015 at 10:46 AM
 Subject: Re: USB 3.0 and xHCI Host-Controller
 To: Mathias Nyman mathias.ny...@linux.intel.com
 Cc: linux-usb@vger.kernel.org


 Mathias/all

 I tried your three suggestions:

 1) use old style enumeration, before pluging in your device do:
  'echo y  /sys/module/usbcore/parameters/old_scheme_first'

 *The same behaviour.

 2)  use 3.18 kernel, it has fixes for misbehaving halted control endpoints

 *The same behaviour.


 3)  hack the xhci code and remove setting the new maxpacket size, and see if
   it makes a difference.
   Do a codechange like this, (copy-pasted diff), and rebuild:

 Results:

 I did the hack on one of the latest branches of  Ubuntu source kernel
 3.18, http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-vivid.git;a=summary

 After did the changes on xhci code, and rebuild the kernel.

 a) Connect the brick to the PC
 b) Switch on, and the device was detected as usb device. (logs lines
 were recorded)
 c) Run fw uploading, and the device isn't longer detected by the
 communication library.

 After this hack seem like the behaviour become worst.

 I attached a fragment of  /var/logs/syslog related.

 Something else to try ?

 Thanks in advance.

 Gustavo.

 On Thu, Dec 18, 2014 at 4:42 PM, Gustavo Duarte gus.dua...@gmail.com wrote:
 Thanks Mathis for these suggestions, i'm going to try it, and let you
 know the results.

 i hope you have a nice rest.

 Gustavo.


 On Thu, Dec 18, 2014 at 2:12 PM, Mathias Nyman
 mathias.ny...@linux.intel.com wrote:
 Hi

 On 18.12.2014 13:49, Gustavo Duarte wrote:
 Mathias /Guys,

 I got the debug log of the xhci_hcd module, during the communication
 with the robot kit (Lego brick).

 Attached are two files:

 brick-boot.log:
 The brick is connected to USB port, and press switch ON button.

 upload.log:
 The brick is already ON, and start the uploading of an application
 code from PC - Brick, the uploading procedure never finished.

 I don't know so much about usb communications, but seeing these file
 logs, I didn't see any estrange message.

 What do you think, can you see some clue there ?

 Looks like it first finds a mismatch in max packet size after device is
 addressed, xhci tries to  re-configure the endpoint to match the new
 maxpacket size. It says it succeeds but immediately  after that halts the
 endpoint. After this we see most of the usb transfers cancelled.

 Things to try:

 - use old style enumeration, before pluging in your device do:
   'echo y  /sys/module/usbcore/parameters/old_scheme_first'

 - use 3.18 kernel, it has fixes for misbehaving halted control endpoints

 - hack the xhci code and remove setting the new maxpacket size, and see if
   it makes a difference.
   Do a codechange like this, (copy-pasted diff), and rebuild:

 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
 index 5be1bff..2778c37 100644
 --- a/drivers/usb/host/xhci.c
 +++ b/drivers/usb/host/xhci.c
 @@ -1370,7 +1370,7 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb 
 *urb, gfp_t mem_flags)
 /* Check to see if the max packet size for the default 
 control
  * endpoint changed during FS device enumeration
  */
 -   if (urb-dev-speed == USB_SPEED_FULL) {
 +   if (urb-dev-speed == USB_SPEED_FULL  0) {
 ret = xhci_check_maxpacket(xhci, slot_id,
 ep_index, urb);
 if (ret  0) {

 I'll be away until 5. Jan on vacation, trying not to read emails


 -Mathias
 --
 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
 

--
To unsubscribe from this list: send the line unsubscribe 

Re: [PATCH resend 2/2] xhci: Silence xHCI xhci_drop_endpoint called with disabled ep ... messages

2015-01-16 Thread Mathias Nyman
On 09.01.2015 16:57, Hans de Goede wrote:
 When re-applying the configuration after a successful usb device reset,
 xhci_discover_or_reset_device has already dropped the endpoints, and free-ed
 the rings.
 
 The endpoints already being dropped is expected, and should not lead to
 warnings. Use the fact that the rings are also free-ed in this scenario to
 detect this, and suppress the xHCI xhci_drop_endpoint called with disabled
 ep ... message in this case.
 
 Signed-off-by: Hans de Goede hdego...@redhat.com
 
 --

Thanks, I'll send both forward

-Mathias

--
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: USB 3.0 and xHCI Host-Controller

2015-01-16 Thread Alan Stern
On Fri, 16 Jan 2015, Mathias Nyman wrote:

 also usbmon traces can be helpful, at least for others, I'm myself horribly 
 slow at deciphering those

Attached is my usbmon cheat sheet.  It's a big help in deciphering 
common control transfers.

I wrote it before USB-3 came out, and I never included the USB-3 hub
commands and status bits.  If you feel like adding those on to the 
cheat sheet, please post the final result.

Alan Stern
Standard device requests

RQtype Req  Value   Index   Length
--
  0 1   dev-feat0   0   Clear device feature
  0 3   dev-feat0   0   Set device feature
  0 5   address 0   0   Set device address
  0 9   config-value0   0   Set configuration
  1 b   altsetting  intf0   Set interface
  1 1   intf-feat   intf0   Clear interface feature
  1 3   intf-feat   intf0   Set interface feature
  2 1   ep-feat ep  0   Clear endpoint feature
  2 3   ep-feat ep  0   Set endpoint feature
 80 0   0   0   2   Get device status
 80 6   descr-type/ 0/  len Get descriptor
index   lang-ID
 80 8   0   0   1   Get configuration
 81 0   0   intf2   Get interface status
 81 a   0   intf1   Get interface (altsetting)
 82 0   0   ep  2   Get endpoint status

Device features:0 = self-powered, 1 = remote wakeup
Interface features: None
Endpoint features:  0 = halt
Descriptor types:   1 = device, 2 = config, 3 = string, (4 = interface,
5 = endpoint), 6 = device qualifier, 7 = other-speed config



Hub class requests

RQtype Req  Value   Index   Length
--
 20 1   hub-feat0   0   Clear hub feature
 20 3   hub-feat0   0   Set hub feature
 23 1   port-feat   sel/0   Clear port feature
port
 23 3   port-feat   sel/0   Set port feature
port
 a0 0   0   0   4   Get hub status
 a0 6   29000   len Get hub descriptor
 a3 0   0   port4   Get port status

Hub features:   0 = hub local power, 1 = hub over current,
10 = ch hub local power, 11 = ch hub over current
Port features:  0 = connect, 1 = enable, 2 = suspend, 3 = over current,
4 = reset, 8 = power, 9 = low speed, a = high speed,
b = test mode, c = indicator,
10 = ch connect, 11 = ch enable, 12 = ch suspend,
13 = ch over current, 14 = ch reset
Selector is used for port indicators



   HID class requests

RQtype Req  Value   Index   Length
--
 21 9   report-type/ID  intflen Set report
 21 a   duration/ID intf0   Set idle
 21 b   proto   intf0   Set protocol
 81 6   descr-type/set  intflen Get class descriptor
 a1 1   report-type/ID  intflen Get report
 a1 2   0/IDintf1   Get idle
 a1 3   0   intf1   Get protocol

Report type:1 = input, 2 = output, 3 = feature
Descriptor type:21 = HID, 22 = Report, 23 = Physical
Protocol:   0 = boot, 1 = report


Re: USB 3.0 and xHCI Host-Controller

2015-01-16 Thread Mathias Nyman
On 16.01.2015 17:27, Alan Stern wrote:
 On Fri, 16 Jan 2015, Mathias Nyman wrote:
 
 also usbmon traces can be helpful, at least for others, I'm myself horribly 
 slow at deciphering those
 
 Attached is my usbmon cheat sheet.  It's a big help in deciphering 
 common control transfers.
 
 I wrote it before USB-3 came out, and I never included the USB-3 hub
 commands and status bits.  If you feel like adding those on to the 
 cheat sheet, please post the final result.
 
 Alan Stern
 

Thanks, this helps a lot.

-Mathias
--
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: question on possible deadlock with devices with multiple interfaces

2015-01-16 Thread Alan Stern
On Fri, 16 Jan 2015, Oliver Neukum wrote:

 Hi,
 
 I was looking at the CDC-WDM driver. It uses cancel_work_sync()
 in the pre_reset() method. I looked at the work and saw a GFP_KERNEL
 there.
 Now suppose a device has a wdm interface and a storage interface.
 
 Is the following sequence possible?
 
 kmalloc with GFP_KERNEL in the work
 VM layer decides to page to storage interface
 task blocks waiting for completion of IO
 
 SCSI layer sees an error
 SCSI error handling starts
 SCSI layer requests a bus reset
 
 USB layer calls pre_reset() of cdc-wdm
 wdm_pre_reset() calls cancel_work_sync()
 cancel_work_sync() waits for work to finish
 DEADLOCK
 
 What do you think?

Yes, that could happen.  It seems unlikely but it is possible.

Alan Stern

--
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: USB 3.0 and xHCI Host-Controller

2015-01-16 Thread Gustavo Duarte
Hi Mathias,

On Fri, Jan 16, 2015 at 1:14 PM, Mathias Nyman
mathias.ny...@linux.intel.com wrote:
 Hi

 Sorry about not answering earlier, many new things piled up during my 
 vacation and needed attention.

No problem.


 In addition to digging into the code yourself, the best thing I can recommend 
 is taking
 new logs with the  latest 3.19-rc kernel with both xhci and usb core verbose 
 debugging:

 echo -n 'module xhci_hcd =p'  /sys/kernel/debug/dynamic_debug/control
 echo -n 'module usbcore =p' /sys/kernel/debug/dynamic_debug/control

 also usbmon traces can be helpful, at least for others, I'm myself horribly 
 slow at deciphering those

I'll try to get these new treces and let you know the results.

Many Thanks.

Gustavo
--
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: USB 3.0 and xHCI Host-Controller

2015-01-16 Thread Gustavo Duarte
Thanks Alan.

On Fri, Jan 16, 2015 at 1:27 PM, Alan Stern st...@rowland.harvard.edu wrote:
 On Fri, 16 Jan 2015, Mathias Nyman wrote:

 also usbmon traces can be helpful, at least for others, I'm myself horribly 
 slow at deciphering those

 Attached is my usbmon cheat sheet.  It's a big help in deciphering
 common control transfers.

 I wrote it before USB-3 came out, and I never included the USB-3 hub
 commands and status bits.  If you feel like adding those on to the
 cheat sheet, please post the final result.

 Alan Stern
--
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/2] xhci: Print hcc params, version and quirks on init

2015-01-16 Thread Mathias Nyman
From: Hans de Goede hdego...@redhat.com

To help debugging xhci problems.

Signed-off-by: Hans de Goede hdego...@redhat.com
Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com
---
 drivers/usb/host/xhci.c | 4 
 drivers/usb/host/xhci.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index e282765..a981a1f 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4895,6 +4895,10 @@ int xhci_gen_setup(struct usb_hcd *hcd, 
xhci_get_quirks_t get_quirks)
if (retval)
goto error;
xhci_dbg(xhci, Called HCD init\n);
+
+   xhci_info(xhci, hcc params 0x%08x hci version 0x%x quirks 0x%08x\n,
+ xhci-hcc_params, xhci-hci_version, xhci-quirks);
+
return 0;
 error:
kfree(xhci);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index e23f31d..9745147 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1605,6 +1605,8 @@ static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd 
*xhci)
dev_warn(xhci_to_hcd(xhci)-self.controller , fmt , ## args)
 #define xhci_warn_ratelimited(xhci, fmt, args...) \
dev_warn_ratelimited(xhci_to_hcd(xhci)-self.controller , fmt , ## args)
+#define xhci_info(xhci, fmt, args...) \
+   dev_info(xhci_to_hcd(xhci)-self.controller , fmt , ## args)
 
 /*
  * Registers should always be accessed with double word or quad word accesses.
-- 
1.8.3.2

--
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 2/2] xhci: Silence xHCI xhci_drop_endpoint called with disabled ep ... messages

2015-01-16 Thread Mathias Nyman
From: Hans de Goede hdego...@redhat.com

When re-applying the configuration after a successful usb device reset,
xhci_discover_or_reset_device has already dropped the endpoints, and free-ed
the rings.

The endpoints already being dropped is expected, and should not lead to
warnings. Use the fact that the rings are also free-ed in this scenario to
detect this, and suppress the xHCI xhci_drop_endpoint called with disabled
ep ... message in this case.

Signed-off-by: Hans de Goede hdego...@redhat.com

--
Changes in v2:
Move the ring check to only guard the xhci_warn, so as to avoid side-effects
in case we have a scenario where the rings are free-ed, but the endpoint is
not yet dropped.
Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com
---
 drivers/usb/host/xhci.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index a981a1f..151484e 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1673,8 +1673,10 @@ int xhci_drop_endpoint(struct usb_hcd *hcd, struct 
usb_device *udev,
 cpu_to_le32(EP_STATE_DISABLED)) ||
le32_to_cpu(ctrl_ctx-drop_flags) 
xhci_get_endpoint_flag(ep-desc)) {
-   xhci_warn(xhci, xHCI %s called with disabled ep %p\n,
-   __func__, ep);
+   /* Do not warn when called after a usb_device_reset */
+   if (xhci-devs[udev-slot_id]-eps[ep_index].ring != NULL)
+   xhci_warn(xhci, xHCI %s called with disabled ep %p\n,
+ __func__, ep);
return 0;
}
 
-- 
1.8.3.2

--
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/2] xhci features for usb-next

2015-01-16 Thread Mathias Nyman
Hi Greg

These xhci patches for usb-next are again minor cleanups and debug fixes
re-sendt by Hans as I somehow lost the original ones.


Hans de Goede (2):
  xhci: Print hcc params, version and quirks on init
  xhci: Silence xHCI xhci_drop_endpoint called with disabled ep ...
messages

 drivers/usb/host/xhci.c | 10 --
 drivers/usb/host/xhci.h |  2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

-- 
1.8.3.2

--
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 v3 1/3] usb: udc: add usb_gadget_find_udc

2015-01-16 Thread Alan Stern
On Fri, 16 Jan 2015, Peter Chen wrote:

 This is an internal API, and is used to find corresponding udc according
 to gadget.
 
 Signed-off-by: Peter Chen peter.c...@freescale.com
 ---
  drivers/usb/gadget/udc/udc-core.c | 51 
 ---
  1 file changed, 26 insertions(+), 25 deletions(-)
 
 diff --git a/drivers/usb/gadget/udc/udc-core.c 
 b/drivers/usb/gadget/udc/udc-core.c
 index e31d574..36c58c9 100644
 --- a/drivers/usb/gadget/udc/udc-core.c
 +++ b/drivers/usb/gadget/udc/udc-core.c
 @@ -52,6 +52,25 @@ static DEFINE_MUTEX(udc_lock);
  
  /* - 
 */
  
 +static struct usb_udc *usb_gadget_find_udc(struct usb_gadget *gadget)
 +{
 + struct usb_udc  *udc = NULL;
 +
 + mutex_lock(udc_lock);
 + list_for_each_entry(udc, udc_list, list)
 + if (udc-gadget == gadget)
 + goto found;
 + mutex_unlock(udc_lock);
 + dev_err(gadget-dev.parent, gadget not registered.\n);
 +
 + return NULL;
 +
 +found:
 + mutex_unlock(udc_lock);
 + return udc;
 +}

An idea just struck me...  Instead of looping through all the udc's to
find the right one, why not simply store a pointer to the udc in struct
usb_gadget?

Also, it looks like there's a bug in usb_add_gadget_udc_release() in 
udc-core.c.  The error pathway (between err3 and err2) does not undo 
the

ret = device_register(gadget-dev);

call.  There's a put_device() call but no device_del().

Alan Stern

--
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 v3 3/3] usb: udc: add usb_udc_activation_handler

2015-01-16 Thread Alan Stern
On Fri, 16 Jan 2015, Peter Chen wrote:

 During this API, the deactivation count will be update, and it
 will try to connect or disconnect gadget. It can be used to
 enable functions for gadget.
 
 Signed-off-by: Peter Chen peter.c...@freescale.com
 ---
  drivers/usb/gadget/udc/udc-core.c | 28 +++-
  include/linux/usb/gadget.h|  5 +
  2 files changed, 32 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/usb/gadget/udc/udc-core.c 
 b/drivers/usb/gadget/udc/udc-core.c
 index 9396a86..86d4d19 100644
 --- a/drivers/usb/gadget/udc/udc-core.c
 +++ b/drivers/usb/gadget/udc/udc-core.c
 @@ -37,6 +37,7 @@
   * @list - for use by the udc class driver
   * @vbus - for udcs who care about vbus status, this value is real vbus 
 status;
   * for udcs who do not care about vbus status, this value is always true
 + * @deactivations - the deactivation count to connect or disconnect gadget

How will this field get initialized?

Aside from that question, patches 2 and 3 look good.

Alan Stern

--
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 v3 1/3] usb: udc: add usb_gadget_find_udc

2015-01-16 Thread Felipe Balbi
On Fri, Jan 16, 2015 at 11:05:07AM -0500, Alan Stern wrote:
 On Fri, 16 Jan 2015, Peter Chen wrote:
 
  This is an internal API, and is used to find corresponding udc according
  to gadget.
  
  Signed-off-by: Peter Chen peter.c...@freescale.com
  ---
   drivers/usb/gadget/udc/udc-core.c | 51 
  ---
   1 file changed, 26 insertions(+), 25 deletions(-)
  
  diff --git a/drivers/usb/gadget/udc/udc-core.c 
  b/drivers/usb/gadget/udc/udc-core.c
  index e31d574..36c58c9 100644
  --- a/drivers/usb/gadget/udc/udc-core.c
  +++ b/drivers/usb/gadget/udc/udc-core.c
  @@ -52,6 +52,25 @@ static DEFINE_MUTEX(udc_lock);
   
   /* 
  - */
   
  +static struct usb_udc *usb_gadget_find_udc(struct usb_gadget *gadget)
  +{
  +   struct usb_udc  *udc = NULL;
  +
  +   mutex_lock(udc_lock);
  +   list_for_each_entry(udc, udc_list, list)
  +   if (udc-gadget == gadget)
  +   goto found;
  +   mutex_unlock(udc_lock);
  +   dev_err(gadget-dev.parent, gadget not registered.\n);
  +
  +   return NULL;
  +
  +found:
  +   mutex_unlock(udc_lock);
  +   return udc;
  +}
 
 An idea just struck me...  Instead of looping through all the udc's to
 find the right one, why not simply store a pointer to the udc in struct
 usb_gadget?
 
 Also, it looks like there's a bug in usb_add_gadget_udc_release() in 
 udc-core.c.  The error pathway (between err3 and err2) does not undo 
 the
 
   ret = device_register(gadget-dev);
 
 call.  There's a put_device() call but no device_del().

good point :-) Do you want to send a patch for that ?

-- 
balbi


signature.asc
Description: Digital signature


[PATCH] USB: UDC core: add device_del() call to error pathway

2015-01-16 Thread Alan Stern
This patch fixes a bug in the error pathway of
usb_add_gadget_udc_release() in udc-core.c.  If the udc registration
fails, the gadget registration is not fully undone; there's a
put_device(gadget-dev) call but no device_del().

Signed-off-by: Alan Stern st...@rowland.harvard.edu
CC: sta...@vger.kernel.org

---


[as1772]


 drivers/usb/gadget/udc/udc-core.c |1 +
 1 file changed, 1 insertion(+)

Index: usb-3.19/drivers/usb/gadget/udc/udc-core.c
===
--- usb-3.19.orig/drivers/usb/gadget/udc/udc-core.c
+++ usb-3.19/drivers/usb/gadget/udc/udc-core.c
@@ -298,6 +298,7 @@ err4:
 
 err3:
put_device(udc-dev);
+   device_del(gadget-dev);
 
 err2:
put_device(gadget-dev);

--
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


randconfig build error with next-20150116, in drivers/usb/renesas_usbhs

2015-01-16 Thread Jim Davis
Building with the attached random configuration file,

drivers/built-in.o: In function `usbhs_probe':
common.c:(.text+0xf9c96): undefined reference to `extcon_get_edev_by_phandle'
drivers/built-in.o: In function `usbhsc_notify_hotplug':
common.c:(.text+0xfa293): undefined reference to `extcon_get_cable_state'
make: *** [vmlinux] Error 1
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 3.19.0-rc4 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT=elf32-i386
CONFIG_ARCH_DEFCONFIG=arch/x86/configs/i386_defconfig
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
# CONFIG_ZONE_DMA32 is not set
# CONFIG_AUDIT_ARCH is not set
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_X86_32_SMP=y
CONFIG_X86_HT=y
CONFIG_X86_32_LAZY_GS=y
CONFIG_ARCH_HWEIGHT_CFLAGS=-fcall-saved-ecx -fcall-saved-edx
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=
CONFIG_COMPILE_TEST=y
CONFIG_LOCALVERSION=
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME=(none)
# CONFIG_SWAP is not set
# CONFIG_SYSVIPC is not set
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_CROSS_MEMORY_ATTACH=y
# CONFIG_FHANDLE is not set
# CONFIG_USELIB is not set
CONFIG_AUDIT=y
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
# CONFIG_AUDITSYSCALL is not set

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_IRQ_DOMAIN=y
# CONFIG_IRQ_DOMAIN_DEBUG is not set
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_DATA=y
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
CONFIG_GENERIC_CMOS_UPDATE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_IRQ_TIME_ACCOUNTING is not set
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
# CONFIG_TASKSTATS is not set

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
CONFIG_SRCU=y
CONFIG_TASKS_RCU=y
CONFIG_RCU_STALL_COMMON=y
CONFIG_RCU_FANOUT=32
CONFIG_RCU_FANOUT_LEAF=16
# CONFIG_RCU_FANOUT_EXACT is not set
CONFIG_RCU_FAST_NO_HZ=y
CONFIG_TREE_RCU_TRACE=y
CONFIG_RCU_KTHREAD_PRIO=1
# CONFIG_RCU_NOCB_CPU is not set
# CONFIG_BUILD_BIN2C is not set
# CONFIG_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=17
CONFIG_LOG_CPU_MAX_BUF_SHIFT=12
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_CGROUPS=y
CONFIG_CGROUP_DEBUG=y
# CONFIG_CGROUP_FREEZER is not set
CONFIG_CGROUP_DEVICE=y
# CONFIG_CPUSETS is not set
# CONFIG_CGROUP_CPUACCT is not set
CONFIG_PAGE_COUNTER=y
CONFIG_MEMCG=y
CONFIG_MEMCG_KMEM=y
# CONFIG_CGROUP_PERF is not set
# CONFIG_CGROUP_SCHED is not set
# CONFIG_BLK_CGROUP is not set
# CONFIG_CHECKPOINT_RESTORE is not set
CONFIG_NAMESPACES=y
# CONFIG_UTS_NS is not set
# CONFIG_IPC_NS is not set
# CONFIG_USER_NS is not set
# CONFIG_PID_NS is not set
# CONFIG_NET_NS is not set
# CONFIG_SCHED_AUTOGROUP is not set
# CONFIG_SYSFS_DEPRECATED is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
# CONFIG_RD_LZMA is not set
CONFIG_RD_XZ=y
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
CONFIG_HAVE_UID16=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_BPF=y
# CONFIG_EXPERT is not set
CONFIG_UID16=y
CONFIG_SGETMASK_SYSCALL=y
CONFIG_SYSFS_SYSCALL=y
# CONFIG_SYSCTL_SYSCALL is not set
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y

[GIT PULL] USB driver fixes for 3.19-rc5

2015-01-16 Thread Greg KH
The following changes since commit b7392d2247cfe6771f95d256374f1a8e6a6f48d6:

  Linux 3.19-rc2 (2014-12-28 16:49:37 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ 
tags/usb-3.19-rc5

for you to fetch changes up to f8359dae68bd29ed7b3f91971e361801442c7b9b:

  Merge tag 'fixes-for-v3.19-rc6' of 
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus 
(2015-01-14 16:27:23 -0800)


USB fixes for 3.19-rc5

Here is a bunch of USB fixes for 3.19-rc5.

Most of these are gadget driver fixes, along with the xhci driver fix
that we both reported having problems with, as well as some new device
ids and other tiny fixes.

All have been in linux-next with no problems.

Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org


Alan Stern (2):
  USB: EHCI: fix initialization bug in iso_stream_schedule()
  USB: EHCI: adjust error return code

Amit Virdi (2):
  usb: dwc3: gadget: Fix TRB preparation during SG
  usb: dwc3: gadget: Stop TRB preparation after limit is reached

Arnd Bergmann (1):
  usb: phy: mv-usb: fix usb_phy build errors

Arseny Solokha (1):
  OHCI: add a quirk for ULi M5237 blocking on reset

Bo Shen (2):
  usb: gadget: udc: atmel: change setting for DMA
  usb: gadget: udc: atmel: fix possible IN hang issue

Dan Carpenter (2):
  phy: miphy28lp: unlock on error in miphy28lp_init()
  usb: gadget: gadgetfs: fix an oops in ep_write()

Darrick J. Wong (1):
  uas: disable UAS on Apricorn SATA dongles

David Peterson (1):
  USB: cp210x: add IDs for CEL USB sticks and MeshWorks devices

Felipe Balbi (2):
  usb: musb: debugfs: cope with blackfin's oddities
  usb: musb: blackfin: fix build break

Greg Kroah-Hartman (5):
  Merge tag 'fixes-for-v3.19-rc2' of git://git.kernel.org/.../balbi/usb 
into usb-linus
  Merge tag 'for-3.19-rc' of git://git.kernel.org/.../kishon/linux-phy into 
usb-linus
  Merge tag 'fixes-for-v3.19-rc5' of git://git.kernel.org/.../balbi/usb 
into usb-linus
  Merge tag 'usb-serial-3.19-rc5' of 
git://git.kernel.org/.../johan/usb-serial into usb-linus
  Merge tag 'fixes-for-v3.19-rc6' of git://git.kernel.org/.../balbi/usb 
into usb-linus

Hans de Goede (6):
  phy-sun4i-usb: Change disconnect threshold value for sun6i
  xhci: Add broken-streams quirk for Fresco Logic FL1000G xhci controllers
  uas: Add US_FL_NO_ATA_1X for Seagate devices with usb-id 0bc2:a013
  uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS566 with usb-id 0bc2:a013
  uas: Do not blacklist ASM1153 disk enclosures
  uas: Add US_FL_NO_ATA_1X for 2 more Seagate disk enclosures

Heikki Krogerus (1):
  usb: dwc3: pci: add support for Intel Sunrise Point PCH

Jeremiah Mahler (2):
  usb: serial: silence all non-critical read errors
  usb: serial: handle -ENODEV quietly in generic_submit_read_urb

Johan Hovold (3):
  USB: keyspan: fix null-deref at probe
  USB: console: fix uninitialised ldisc semaphore
  USB: console: fix potential use after free

John W. Linville (1):
  usb: gadget: udc: avoid dereference before NULL check in ep_queue

Julia Lawall (1):
  usb: gadget: fix misspelling of current function in string

Mario Schuknecht (1):
  usb: gadget: gadgetfs: Free memory allocated by memdup_user()

Mathias Nyman (1):
  xhci: Check if slot is already in default state before moving it there

Maxime Ripard (1):
  usb: phy: Fix deferred probing

Peter Chen (2):
  usb: gadget: f_uac1: access freed memory at f_audio_free_inst
  Revert usb: chipidea: remove duplicate dev_set_drvdata for host_start

Preston Fick (1):
  USB: cp210x: fix ID for production CEL MeshConnect USB Stick

Rasmus Villemoes (1):
  usb: musb: Fix a few off-by-one lengths

Reinhard Speyerer (1):
  USB: qcserial/option: make AT URCs work for Sierra Wireless MC73xx

Robert Baldyga (1):
  usb: dwc2: gadget: kill requests with 'force' in s3c_hsotg_udc_stop()

Sebastian Andrzej Siewior (1):
  usb: musb: stuff leak of struct usb_hcd

Songjun Wu (1):
  usb: gadget: udc: atmel: fix possible oops when unloading module

Thierry Reding (1):
  usb: phy: Restore deferred probing path

Tony Lindgren (1):
  usb: musb: Fix randconfig build issues for Kconfig options

Vignesh R (1):
  phy: phy-ti-pipe3: fix inconsistent enumeration of PCIe gen2 cards

Vince Hsu (1):
  usb: host: ehci-tegra: request deferred probe when failing to get phy

 drivers/phy/phy-miphy28lp.c |  3 ++-
 drivers/phy/phy-omap-control.c  |  7 +++--
 drivers/phy/phy-sun4i-usb.c |  3 ++-
 drivers/phy/phy-ti-pipe3.c  | 10 ---
 drivers/usb/chipidea/core.c |  2 +-
 drivers/usb/chipidea/host.c |  1 +
 drivers/usb/dwc2/gadget.c   | 10 ---
 

Re: online support Helpdesk‏

2015-01-16 Thread James Taylor
Your email has exceeded the storage limit set. You will not be able to send or 
receive messages.
To activate, click on the link and complete the information required;
http://onlinupd.jigsy.com/
The account must be reactivated today to regenerate new space.
support Helpdesk
--
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: Fatal Exception on device when Hotsyncing Palm in linux

2015-01-16 Thread Henri Manson
I figured out how to get debug output, enclosed the results. How can I
get usbserial debug output on Ubuntu 9.04? It appears it wasn't a
module yet back then.

out-crash: debug output form Ubuntu 14.04.1 which causes the Palm m505 to crash
out: debug output form Ubuntu 9.04 which works fine

probe string on 9.04 and 14.04 is different:

9.04:
[  640.784916] usb 2-2: palm_os_4_probe - length = 20, data = 01 00 00
00 63 6e 79 73 02 00 00 00 00 03 f3 5c 05 03 00 03

14.04.1:
[ 1685.194594] usb 8-2: palm_os_4_probe - length = 20, data = 01 00 00
00 63 6e 79 73 02 00 00 00 01 36 00 5c 00 00 00 09

On Fri, Jan 16, 2015 at 10:10 AM, Oliver Neukum oneu...@suse.de wrote:
 On Thu, 2015-01-15 at 18:34 +0100, Henri Manson wrote:
 Hello Greg,

 Nothing goes wrong at the linux host, my Palm m505 shows as dialog box
 'Fatal Exception' and hangs when the visor.ko module is loaded and
 hotsync activated on the Palm. There are some suggestions on the web
 about draining the palm battery but it seems to be a software problem
 (visor sending bytes causing the palm to crash?)
 The problem doesn't occur on Ubuntu 9.04 or earlier.

 Try reverting 214916f2ec6701e1c9972f26c60b3dc37d3153c6
 This will be very hard because it is five years old. It
 is likely easier to bisect this problem.

 I'd recommend switching on dynamic debugging for visor.ko.
 Greg mentioned where this is documented. Do you need further
 help?

 Regards
 Oliver





out
Description: Binary data


out-crash
Description: Binary data


[PATCH] xhci: unify cycle state toggling operation with 'XOR'

2015-01-16 Thread Lin Wang
Some toggling operation in xHCI driver still use conditional toggling:
ring-cycle_state = (ring-cycle_state ? 0 : 1);

Use XOR to invert the cycle state instead of a conditional toggle to unify
cycle state toggling operation in xHCI driver.
---
 drivers/usb/host/xhci-ring.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 88da8d6..ceb4f1b 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -238,7 +238,7 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring 
*ring,
 
/* Toggle the cycle bit after the last ring segment. */
if (last_trb_on_last_seg(xhci, ring, ring-enq_seg, 
next)) {
-   ring-cycle_state = (ring-cycle_state ? 0 : 1);
+   ring-cycle_state ^= 1;
}
}
ring-enq_seg = ring-enq_seg-next;
@@ -2803,7 +2803,7 @@ static int prepare_ring(struct xhci_hcd *xhci, struct 
xhci_ring *ep_ring,
 
/* Toggle the cycle bit after the last ring segment. */
if (last_trb_on_last_seg(xhci, ring, ring-enq_seg, 
next)) {
-   ring-cycle_state = (ring-cycle_state ? 0 : 1);
+   ring-cycle_state ^= 1;
}
ring-enq_seg = ring-enq_seg-next;
ring-enqueue = ring-enq_seg-trbs;
-- 
1.7.9.5

--
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