Re: [PATCH 2/2] usb; dwc3: of-simple: Add support to get resets for the device

2017-03-15 Thread Vivek Gautam

Hi,


On 03/15/2017 04:15 PM, Philipp Zabel wrote:

On Wed, 2017-02-22 at 10:54 +0530, Vivek Gautam wrote:

Add support to get a list of resets available for the device.
These resets must be kept de-asserted until the device is
in use.

Cc: Felipe Balbi 
Signed-off-by: Vivek Gautam 
---

Based on torvald's master branch.

  drivers/usb/dwc3/dwc3-of-simple.c | 49 +++
  1 file changed, 49 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-of-simple.c 
b/drivers/usb/dwc3/dwc3-of-simple.c
index fe414e7a9c78..025de7342d28 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -29,13 +29,52 @@
  #include 
  #include 
  #include 
+#include 
  
  struct dwc3_of_simple {

struct device   *dev;
struct clk  **clks;
int num_clocks;
+   struct reset_control**resets;
+   int num_resets;
  };
  
+static int dwc3_of_simple_reset_init(struct dwc3_of_simple *simple, int count)

+{
+   struct device   *dev = simple->dev;
+   int i;
+
+   simple->num_resets = count;
+
+   if (!count)
+   return 0;
+
+   simple->resets = devm_kcalloc(dev, simple->num_resets,
+   sizeof(struct reset_control *), GFP_KERNEL);
+   if (!simple->resets)
+   return -ENOMEM;
+
+   for (i = 0; i < simple->num_resets; i++) {
+   struct reset_control *reset;
+   int ret;
+
+   reset = devm_reset_control_get_by_index(dev, i);

Please use devm_reset_control_get_exclusive_by_index instead. See
include/linux/reset.h for details.


Sure, will make use of *exclusive version of the api.




+   if (IS_ERR(reset))
+   return PTR_ERR(reset);
+
+   simple->resets[i] = reset;
+
+   ret = reset_control_deassert(reset);
+   if (ret) {
+   while (--i >= 0)
+   reset_control_assert(reset);
+   return ret;
+   }
+   }
+
+   return 0;
+}

This looks rather generic. Should we have a
reset_control_get/assert/deassert_array functionality at the reset API
level?


Yes, i think we should. Something on the lines of 'regulator_bulk_*' 
interface?





  static int dwc3_of_simple_clk_init(struct dwc3_of_simple *simple, int count)
  {
struct device   *dev = simple->dev;
@@ -100,6 +139,10 @@ static int dwc3_of_simple_probe(struct platform_device 
*pdev)
if (ret)
return ret;
  
+	ret = dwc3_of_simple_reset_init(simple, of_reset_control_get_count(np));

+   if (ret)
+   return ret;
+

Not a blocker, but it seems a bit inconsistent to count the reset
controls via the device node (of_...), but then get them via the device
(devm_reset_control_get_... instead of of_reset_control_get_...).


You are right, it looks inconsistent. I thought of using a resource
managed API. But now i think it doesn't make much sense.


Best Regards
Vivek



regards
Philipp



--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

--
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/2] reset: Add API to count number of reset available with device

2017-03-15 Thread Vivek Gautam
Hi Philipp,


On Wed, Mar 15, 2017 at 4:10 PM, Philipp Zabel  wrote:
> Hi Vivek,
>
> On Fri, 2017-03-10 at 20:10 +0530, Vivek Gautam wrote:
>> Hi Philipp,
>>
>>
>> On Wed, Feb 22, 2017 at 10:54 AM, Vivek Gautam
>>  wrote:
>> > Count number of reset phandles available with the device node
>> > to know the resets a given device has.
>> >
>> > Cc: Philipp Zabel 
>> > Signed-off-by: Vivek Gautam 
>> > ---
>>
>> Any thoughts on this change?
>> A small addition that seems useful.
>
> Sorry I missed this one earlier.
>
>> >
>> > Based on torvald's master branch.
>> >
>> >  include/linux/reset.h | 16 
>> >  1 file changed, 16 insertions(+)
>> >
>> > diff --git a/include/linux/reset.h b/include/linux/reset.h
>> > index 5daff15722d3..88f63a640153 100644
>> > --- a/include/linux/reset.h
>> > +++ b/include/linux/reset.h
>> > @@ -2,6 +2,7 @@
>> >  #define _LINUX_RESET_H_
>> >
>> >  #include 
>> > +#include 
>> >
>> >  struct reset_control;
>> >
>> > @@ -234,6 +235,21 @@ static inline struct reset_control 
>> > *of_reset_control_get_shared_by_index(
>> >  }
>> >
>> >  /**
>> > + * of_reset_control_get_count - Count number of resets available with a 
>> > device
>> > + * @node: device to be reset by the controller
>> > + */
>> > +static inline unsigned int of_reset_control_get_count(struct device_node 
>> > *node)
>> > +{
>> > +   int count;
>> > +
>> > +   count = of_count_phandle_with_args(node, "resets", "#reset-cells");
>> > +   if (count < 0)
>> > +   return 0;
>
> Please don't silently ignore errors. gpiod_count doesn't ignore errors
> either. tegra_powergate_of_resets in drivers/soc/tegra/pmc.c open codes
> this, too. This should be changed so it can be used there, too.

Sure, will change this. I can prepare a patch for tegra/pmc.c as well
using this.

Best regards
Vivek

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



-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
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 v2 3/4] doc: dt-bindings: usb251xb: mark reg as required

2017-03-15 Thread Rob Herring
On Mon, Mar 06, 2017 at 09:24:22AM +0100, Richard Leitner wrote:
> Mark the reg property as required and furthermore fix some typos and
> spellings in the documentation.
> 
> Signed-off-by: Richard Leitner 
> ---
>  Documentation/devicetree/bindings/usb/usb251xb.txt | 23 
> +++---
>  1 file changed, 12 insertions(+), 11 deletions(-)

Acked-by: Rob Herring 
--
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 v2 2/4] usb: usb251xb: dt: add unit suffix to oc-delay and power-on-time

2017-03-15 Thread Rob Herring
On Mon, Mar 06, 2017 at 09:24:21AM +0100, Richard Leitner wrote:
> Rename oc-delay-* to oc-delay-us and make it expect a time value.
> Furthermore add -ms suffix to power-on-time. There changes were
> suggested by Rob Herring in https://lkml.org/lkml/2017/2/15/1283.
> 
> Signed-off-by: Richard Leitner 
> ---
>  Documentation/devicetree/bindings/usb/usb251xb.txt | 10 ---

Acked-by: Rob Herring 

>  drivers/usb/misc/usb251xb.c| 35 
> --
>  2 files changed, 26 insertions(+), 19 deletions(-)
--
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 2/3] dt-bindings: phy: add DT bindings for usb2-phy grf

2017-03-15 Thread Rob Herring
On Mon, Mar 06, 2017 at 09:29:37AM +0800, Meng Dongyang wrote:
> Adds the device tree bindings description for usb2-phy grf
> of RK3328 platform.
> 
> Changes in v2:
>  - add usb2-phy grf specification
> Chagnes in v3:
>  - remove the example of usb2-phy grf
> 
> Signed-off-by: Meng Dongyang 
> ---
>  Documentation/devicetree/bindings/soc/rockchip/grf.txt | 4 
>  1 file changed, 4 insertions(+)

Acked-by: Rob Herring 
--
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: [RFC PATCH v2] usb: hub: Fix error loop seen after hub communication errors

2017-03-15 Thread Alan Stern
On Wed, 15 Mar 2017, Guenter Roeck wrote:

> While stress testing a usb controller using a bind/unbind looop, the
> following error loop was observed.
> 
> usb 7-1.2: new low-speed USB device number 3 using xhci-hcd
> usb 7-1.2: hub failed to enable device, error -108
> usb 7-1-port2: cannot disable (err = -22)
> usb 7-1-port2: couldn't allocate usb_device
> usb 7-1-port2: cannot disable (err = -22)
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: activate --> -22
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: activate --> -22
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: activate --> -22
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: activate --> -22
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: activate --> -22
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: activate --> -22
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: activate --> -22
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: activate --> -22
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> hub 7-1:1.0: hub_ext_port_status failed (err = -22)
> ** 57 printk messages dropped ** hub 7-1:1.0: activate --> -22
> ** 82 printk messages dropped ** hub 7-1:1.0: hub_ext_port_status failed (err 
> = -22)
> 
> This continues forever. After adding tracebacks into the code,
> the call sequence leading to this is found to be as follows.
> 
> [] hub_activate+0x368/0x7b8
> [] hub_resume+0x2c/0x3c
> [] usb_resume_interface.isra.6+0x128/0x158
> [] usb_suspend_both+0x1e8/0x288
> [] usb_runtime_suspend+0x3c/0x98
> [] __rpm_callback+0x48/0x7c
> [] rpm_callback+0xa8/0xd4
> [] rpm_suspend+0x84/0x758
> [] rpm_idle+0x2c8/0x498
> [] __pm_runtime_idle+0x60/0xac
> [] usb_autopm_put_interface+0x6c/0x7c
> [] hub_event+0x10ac/0x12ac
> [] process_one_work+0x390/0x6b8
> [] worker_thread+0x480/0x610
> [] kthread+0x164/0x178
> [] ret_from_fork+0x10/0x40
> 
> kick_hub_wq() is called from hub_activate() even after failures to
> communicate with the hub. This results in an endless sequence of
> hub event -> hub activate -> wq trigger -> hub event -> ...
> 
> Provide two solutions for the problem.
> 
> - Only trigger the hub event queue if communication with the hub
>   is successful.
> - After a suspend failure, only resume already suspended interfaces
>   if the communication with the device is still possible.
> 
> Each of the changes fixes the observed problem.
> 
> Signed-off-by: Guenter Roeck 
> ---
> v2: Instead of not triggering the hub wq after an error to submit an urb,
> implement a more complex error detection and handling. Do it in two
> places. Marked as RFC to determine if one (or both) of those solutions
> are viable.

This seems like a good approach, and adding both checks should provide 
a valuable extra layer of security.

>  drivers/usb/core/driver.c | 14 ++
>  drivers/usb/core/hub.c| 15 ++-
>  2 files changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
> index cdee5130638b..40a0ab395d82 100644
> --- a/drivers/usb/core/driver.c
> +++ b/drivers/usb/core/driver.c
> @@ -1331,6 +1331,20 @@ static int usb_suspend_both(struct usb_device *udev, 
> pm_message_t msg)
>*/
>   if (udev->parent && !PMSG_IS_AUTO(msg))
>   status = 0;
> +
> + /*
> +  * If the device is inaccessible, don't try to resume
> +  * suspended interfaces and just return the error.
> +  */
> + if (status) {
> + int err;
> + u16 devstat;
> +
> + err = usb_get_status(udev, USB_RECIP_DEVICE, 0,
> +  );
> + if (err)

Putting a log message here would be a good idea.

For example, suppose a device spontaneously stops working.  The driver,
not receiving any data from the device, might decide to suspend it.  
The only clue we would have that something has gone wrong would be
right here.

> + goto done;
> + }
>   }
>  
>   /* If the suspend failed, resume interfaces that did get suspended */
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 5a420657f9f7..8a74f483cfef 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -1066,6 +1066,19 @@ static void hub_activate(struct usb_hub 

[RFC PATCH v2] usb: hub: Fix error loop seen after hub communication errors

2017-03-15 Thread Guenter Roeck
While stress testing a usb controller using a bind/unbind looop, the
following error loop was observed.

usb 7-1.2: new low-speed USB device number 3 using xhci-hcd
usb 7-1.2: hub failed to enable device, error -108
usb 7-1-port2: cannot disable (err = -22)
usb 7-1-port2: couldn't allocate usb_device
usb 7-1-port2: cannot disable (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
** 57 printk messages dropped ** hub 7-1:1.0: activate --> -22
** 82 printk messages dropped ** hub 7-1:1.0: hub_ext_port_status failed (err = 
-22)

This continues forever. After adding tracebacks into the code,
the call sequence leading to this is found to be as follows.

[] hub_activate+0x368/0x7b8
[] hub_resume+0x2c/0x3c
[] usb_resume_interface.isra.6+0x128/0x158
[] usb_suspend_both+0x1e8/0x288
[] usb_runtime_suspend+0x3c/0x98
[] __rpm_callback+0x48/0x7c
[] rpm_callback+0xa8/0xd4
[] rpm_suspend+0x84/0x758
[] rpm_idle+0x2c8/0x498
[] __pm_runtime_idle+0x60/0xac
[] usb_autopm_put_interface+0x6c/0x7c
[] hub_event+0x10ac/0x12ac
[] process_one_work+0x390/0x6b8
[] worker_thread+0x480/0x610
[] kthread+0x164/0x178
[] ret_from_fork+0x10/0x40

kick_hub_wq() is called from hub_activate() even after failures to
communicate with the hub. This results in an endless sequence of
hub event -> hub activate -> wq trigger -> hub event -> ...

Provide two solutions for the problem.

- Only trigger the hub event queue if communication with the hub
  is successful.
- After a suspend failure, only resume already suspended interfaces
  if the communication with the device is still possible.

Each of the changes fixes the observed problem.

Signed-off-by: Guenter Roeck 
---
v2: Instead of not triggering the hub wq after an error to submit an urb,
implement a more complex error detection and handling. Do it in two
places. Marked as RFC to determine if one (or both) of those solutions
are viable.

 drivers/usb/core/driver.c | 14 ++
 drivers/usb/core/hub.c| 15 ++-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index cdee5130638b..40a0ab395d82 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1331,6 +1331,20 @@ static int usb_suspend_both(struct usb_device *udev, 
pm_message_t msg)
 */
if (udev->parent && !PMSG_IS_AUTO(msg))
status = 0;
+
+   /*
+* If the device is inaccessible, don't try to resume
+* suspended interfaces and just return the error.
+*/
+   if (status) {
+   int err;
+   u16 devstat;
+
+   err = usb_get_status(udev, USB_RECIP_DEVICE, 0,
+);
+   if (err)
+   goto done;
+   }
}
 
/* If the suspend failed, resume interfaces that did get suspended */
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 5a420657f9f7..8a74f483cfef 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1066,6 +1066,19 @@ static void hub_activate(struct usb_hub *hub, enum 
hub_activation_type type)
 
portstatus = portchange = 0;
status = hub_port_status(hub, port1, , );
+   if (status) {
+   u16 hubstatus;
+
+   ret = usb_get_status(hdev, USB_RECIP_DEVICE, 0,
+);
+   if (ret < 0) {
+   dev_err(>dev,
+   "Failed to read hub status (%d)\n",
+   ret);
+   goto abort;
+   }
+   

Re: [PATCH 02/16] USB: core: add helpers to retrieve endpoints in reverse order

2017-03-15 Thread Bjørn Mork
Johan Hovold  writes:

> + if ((!bulk_in || *bulk_in) && (!bulk_out || *bulk_out) &&
> + (!int_in || *int_in) && (!int_out || *int_out)) {
> + return true;
> + }
> +
> + return false;
> +}


Maybe I asked this before and got a good answer?  I don't remember...

But why not

  return (!bulk_in || *bulk_in) && (!bulk_out || *bulk_out) &&
 (!int_in || *int_in) && (!int_out || *int_out);


?



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


Re: [PATCH 00/21] USB: serial: refactor endpoint sanity checks

2017-03-15 Thread Johan Hovold
On Mon, Mar 06, 2017 at 04:56:31PM +0100, Johan Hovold wrote:
> On Mon, Mar 06, 2017 at 04:01:36PM +0100, Johan Hovold wrote:
> > On Mon, Mar 06, 2017 at 02:14:51PM +0100, Oliver Neukum wrote:
> > > Am Montag, den 06.03.2017, 12:27 +0100 schrieb Johan Hovold:
> > > > On Mon, Mar 06, 2017 at 10:54:44AM +0100, Oliver Neukum wrote:
> 
> > > > > True, but again not specific to serial drivers. DVB-T will face
> > > > > the same issues.
> > > > 
> > > > Certainly, and I should have elaborated a bit more on the
> > > > differences here. For USB-serial endpoint-resources are allocated
> > > > only after subdriver probe returns, while for most (all) other USB
> > > > driver this would need to be done in the USB probe callback
> > > > directly. In that case, checking before probe might be too soon (fw
> > > > download, altsetting) and checking after would be too late (endpoint
> > > > resources would already need to have been setup).
> > > 
> > > Now that argues for usbserial to trigger the check itself, but not for
> > > the code doing the check living in usbserial. In other words put 
> > > 
> > > struct usb_serial_endpoints and find_endpoints into usbcore and
> > > call it from usbserial. Add a flag to tell usbcore to not check
> > > this by itself and you are done. (With some generic name changes)
> > > 
> > > That way everybody can use it almost for free.
> > 
> > An idea would be to always construct the endpoint-data struct (as a
> > member of usb_interface) when setting an alternate setting (or always
> > keep it around in usb_host_interface), and provide minimal constraints
> > per usb_driver which core verified before probe unless a flag is set.
> > 
> > Would the overhead for this be acceptable? I guess some more memory
> > would be required for control and isochronous endpoints too.
> 
> A variant would be to always store the endpoint-type counts in struct
> usb_host_interface. That's often all that's needed to do the sanity
> checks (including the cdc-acm case) and only adds 7 bytes per
> altsetting.
> 
> Then a find_endpoints helper can be added to partition the endpoints of
> a given altsetting.

After surveying most USB drivers, I decided against generalising the
usb-serial endpoint helper that this series adds simply because
basically no other driver would require it in its present form (and
should therefore not need to allocate the memory needed to hold all the
descriptors, etc).

Instead I just posted a series that adds a few basic helpers to look-up
endpoints (typically 1-3 endpoints of distinct types) that should cover
the vast majority of drivers.

As for having USB core verify endpoint counts before calling driver
probe, I'm not sure whether it is worth the effort. Sure adding the
endpoint counts to each altsetting and checking against minimal
constraints in struct usb_driver when matching is easy enough, but the
value of this is limited.

Firstly, it would not cover drivers that switch altsettings (although,
such drivers could possibly use the counts themselves).

Secondly, and perhaps most importantly, it would only amount to a small
reduction of time spent when probing *malicious* devices (and the odd
interface which cannot be matched on other attributes). Specifically,
you'd still require the drivers to look up the endpoints they need (and
bail out if not found).

In the end I think it's more preferred to have an explicit check where
the endpoints are first dereferenced (e.g. probe) than to have a
constraint set in some static struct somewhere (which could get out of
sync with the code, and would not cover optional endpoints, etc).

Now, usb-serial is special in that usb-serial core allocates resources
for the subdrivers, which do not deal with the descriptors directly
themselves. So here, such static constraints, which can even be
specified for several classes per driver, has its value.

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 v2 13/14] usb: host: ehci-st: simplify optional reset handling

2017-03-15 Thread Philipp Zabel
Hi Alan,

On Wed, 2017-03-15 at 10:35 -0400, Alan Stern wrote:
> On Wed, 15 Mar 2017, Philipp Zabel wrote:
> 
> > As of commit bb475230b8e5 ("reset: make optional functions really
> > optional"), the reset framework API calls use NULL pointers to describe
> > optional, non-present reset controls.
> 
> What does it use to describe genuine errors?

Negative error pointers, as before. The only difference is that instead
of returning -ENOENT if no resets are specified in the device tree, the
optional reset_control_get variants now return NULL.

> > This allows to return errors from devm_reset_control_get_optional_shared
> > unconditionally.
> > 
> > Signed-off-by: Philipp Zabel 
> > ---
> >  drivers/usb/host/ehci-st.c | 8 ++--
> >  1 file changed, 2 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/usb/host/ehci-st.c b/drivers/usb/host/ehci-st.c
> > index be4a2788fc582..12e803d2c98df 100644
> > --- a/drivers/usb/host/ehci-st.c
> > +++ b/drivers/usb/host/ehci-st.c
> > @@ -210,18 +210,14 @@ static int st_ehci_platform_probe(struct 
> > platform_device *dev)
> > devm_reset_control_get_optional_shared(>dev, "power");
> > if (IS_ERR(priv->pwr)) {
> > err = PTR_ERR(priv->pwr);
> > -   if (err == -EPROBE_DEFER)
> > -   goto err_put_clks;
> > -   priv->pwr = NULL;
> > +   goto err_put_clks;
> > }
> >  
> > priv->rst =
> > devm_reset_control_get_optional_shared(>dev, "softreset");
> > if (IS_ERR(priv->rst)) {
> > err = PTR_ERR(priv->rst);
> > -   if (err == -EPROBE_DEFER)
> > -   goto err_put_clks;
> > -   priv->rst = NULL;
> > +   goto err_put_clks;
> > }
> >  
> > if (pdata->power_on) {
> 
> These changes do not agree with the patch description.  If any sort of 
> error besides EPROBE_DEFER occurs then:
>
>   the old code sets priv->pwr or priv->rst to NULL and continues;
> 
>   the new code returns with an error.
> 
> The only way the patch could be equivalent to the existing code would
> be if devm_reset_control_get_optional_shared() returns no errors other
> than EPROBE_DEFER.  But the patch description doesn't say this.
> 
> Alan Stern

You are right, devm_reset_control_get_optional_shared can return:

-ENOMEM, returned by devres_alloc in __devm_reset_control_get,

-EILSEQ, returned by of_property_match_string in __of_reset_control_get
if the "reset-names" DT property is broken,

-EINVAL, returned by of_parse_phandle_with_args in
__of_reset_control_get, if there is a reset phandle specified in the
device tree but it is pointing to an invalid reset controller node
(missing "#reset-cells" property or number of phandle arguments does not
match).

-EINVAL, returned by the reset controller driver's choice of of_xlate,
also if the reset is specified but somehow invalid.

So yes, if there was a genuine error in the device tree, we would now
return the error instead of silently ignoring it as before. I assume
that these errors were never intended to be ignored, it just happened to
be a hassle to separate them from the -ENOENT condition with the old
API.

regards
Philipp


--
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 11/16] USB: lvstest: tighten endpoint sanity check

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required interrupt-in
endpoint.

Note that this in fact both loosens and tightens the endpoint sanity
check by accepting any interface with an interrupt-in endpoint rather
than always using the first endpoint without verifying its type.

Signed-off-by: Johan Hovold 
---
 drivers/usb/misc/lvstest.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c
index d3d124753266..b3bd32f0f202 100644
--- a/drivers/usb/misc/lvstest.c
+++ b/drivers/usb/misc/lvstest.c
@@ -367,10 +367,9 @@ static int lvs_rh_probe(struct usb_interface *intf,
hdev = interface_to_usbdev(intf);
desc = intf->cur_altsetting;
 
-   if (desc->desc.bNumEndpoints < 1)
-   return -ENODEV;
-
-   endpoint = >endpoint[0].desc;
+   ret = usb_find_int_in_endpoint(desc, );
+   if (ret)
+   return ret;
 
/* valid only for SS root hub */
if (hdev->descriptor.bDeviceProtocol != USB_HUB_PR_SS || hdev->parent) {
-- 
2.12.0

--
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 03/16] USB: adutux: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required interrupt-in and
interrupt-out endpoints.

Also make sure to return -ENOMEM on all allocation failures and -EIO on
a string-retrieval error (instead of returning -ENODEV for these errors).

Note that the descriptors are searched in reverse order to avoid any
regressions.

Signed-off-by: Johan Hovold 
---
 drivers/usb/misc/adutux.c | 38 +++---
 1 file changed, 11 insertions(+), 27 deletions(-)

diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index db9a9e6ff6be..42f5f94adf3c 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -655,12 +655,9 @@ static int adu_probe(struct usb_interface *interface,
 {
struct usb_device *udev = interface_to_usbdev(interface);
struct adu_device *dev = NULL;
-   struct usb_host_interface *iface_desc;
-   struct usb_endpoint_descriptor *endpoint;
int retval = -ENODEV;
int in_end_size;
int out_end_size;
-   int i;
 
if (udev == NULL) {
dev_err(>dev, "udev is NULL.\n");
@@ -680,35 +677,23 @@ static int adu_probe(struct usb_interface *interface,
init_waitqueue_head(>read_wait);
init_waitqueue_head(>write_wait);
 
-   iface_desc = >altsetting[0];
-
-   /* set up the endpoint information */
-   for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
-   endpoint = _desc->endpoint[i].desc;
-
-   if (usb_endpoint_is_int_in(endpoint))
-   dev->interrupt_in_endpoint = endpoint;
-
-   if (usb_endpoint_is_int_out(endpoint))
-   dev->interrupt_out_endpoint = endpoint;
-   }
-   if (dev->interrupt_in_endpoint == NULL) {
-   dev_err(>dev, "interrupt in endpoint not found\n");
-   goto error;
-   }
-   if (dev->interrupt_out_endpoint == NULL) {
-   dev_err(>dev, "interrupt out endpoint not found\n");
+   retval = usb_find_common_endpoints_reverse(>altsetting[0],
+   NULL, NULL,
+   >interrupt_in_endpoint,
+   >interrupt_out_endpoint);
+   if (retval) {
+   dev_err(>dev, "interrupt endpoints not found\n");
goto error;
}
 
in_end_size = usb_endpoint_maxp(dev->interrupt_in_endpoint);
out_end_size = usb_endpoint_maxp(dev->interrupt_out_endpoint);
 
+   retval = -ENOMEM;
+
dev->read_buffer_primary = kmalloc((4 * in_end_size), GFP_KERNEL);
-   if (!dev->read_buffer_primary) {
-   retval = -ENOMEM;
+   if (!dev->read_buffer_primary)
goto error;
-   }
 
/* debug code prime the buffer */
memset(dev->read_buffer_primary, 'a', in_end_size);
@@ -717,10 +702,8 @@ static int adu_probe(struct usb_interface *interface,
memset(dev->read_buffer_primary + (3 * in_end_size), 'd', in_end_size);
 
dev->read_buffer_secondary = kmalloc((4 * in_end_size), GFP_KERNEL);
-   if (!dev->read_buffer_secondary) {
-   retval = -ENOMEM;
+   if (!dev->read_buffer_secondary)
goto error;
-   }
 
/* debug code prime the buffer */
memset(dev->read_buffer_secondary, 'e', in_end_size);
@@ -748,6 +731,7 @@ static int adu_probe(struct usb_interface *interface,
if (!usb_string(udev, udev->descriptor.iSerialNumber, 
dev->serial_number,
sizeof(dev->serial_number))) {
dev_err(>dev, "Could not retrieve serial number\n");
+   retval = -EIO;
goto error;
}
dev_dbg(>dev,"serial_number=%s", dev->serial_number);
-- 
2.12.0

--
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 12/16] USB: usblcd: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required bulk-in and bulk-out
endpoints.

Signed-off-by: Johan Hovold 
---
 drivers/usb/misc/usblcd.c | 47 ++-
 1 file changed, 18 insertions(+), 29 deletions(-)

diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index 9f48419abc46..0f5ad896c7e3 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -313,16 +313,15 @@ static int lcd_probe(struct usb_interface *interface,
 const struct usb_device_id *id)
 {
struct usb_lcd *dev = NULL;
-   struct usb_host_interface *iface_desc;
-   struct usb_endpoint_descriptor *endpoint;
-   size_t buffer_size;
+   struct usb_endpoint_descriptor *bulk_in, *bulk_out;
int i;
-   int retval = -ENOMEM;
+   int retval;
 
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev)
-   goto error;
+   return -ENOMEM;
+
kref_init(>kref);
sema_init(>limit_sem, USB_LCD_CONCURRENT_WRITES);
init_usb_anchor(>submitted);
@@ -338,33 +337,24 @@ static int lcd_probe(struct usb_interface *interface,
 
/* set up the endpoint information */
/* use only the first bulk-in and bulk-out endpoints */
-   iface_desc = interface->cur_altsetting;
-   for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
-   endpoint = _desc->endpoint[i].desc;
-
-   if (!dev->bulk_in_endpointAddr &&
-   usb_endpoint_is_bulk_in(endpoint)) {
-   /* we found a bulk in endpoint */
-   buffer_size = usb_endpoint_maxp(endpoint);
-   dev->bulk_in_size = buffer_size;
-   dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
-   dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-   if (!dev->bulk_in_buffer)
-   goto error;
-   }
-
-   if (!dev->bulk_out_endpointAddr &&
-   usb_endpoint_is_bulk_out(endpoint)) {
-   /* we found a bulk out endpoint */
-   dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
-   }
-   }
-   if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr)) {
+   retval = usb_find_common_endpoints(interface->cur_altsetting,
+   _in, _out, NULL, NULL);
+   if (retval) {
dev_err(>dev,
"Could not find both bulk-in and bulk-out endpoints\n");
goto error;
}
 
+   dev->bulk_in_size = usb_endpoint_maxp(bulk_in);
+   dev->bulk_in_endpointAddr = bulk_in->bEndpointAddress;
+   dev->bulk_in_buffer = kmalloc(dev->bulk_in_size, GFP_KERNEL);
+   if (!dev->bulk_in_buffer) {
+   retval = -ENOMEM;
+   goto error;
+   }
+
+   dev->bulk_out_endpointAddr = bulk_out->bEndpointAddress;
+
/* save our data pointer in this interface device */
usb_set_intfdata(interface, dev);
 
@@ -390,8 +380,7 @@ static int lcd_probe(struct usb_interface *interface,
return 0;
 
 error:
-   if (dev)
-   kref_put(>kref, lcd_delete);
+   kref_put(>kref, lcd_delete);
return retval;
 }
 
-- 
2.12.0

--
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 02/16] USB: core: add helpers to retrieve endpoints in reverse order

2017-03-15 Thread Johan Hovold
Several drivers have implemented their endpoint look-up loops in such a
way that they have picked the last endpoint descriptor of the specified
type should more than one such descriptor exist.

To avoid any regressions, add corresponding helpers to lookup endpoints
by searching the endpoint descriptors in reverse order.

Signed-off-by: Johan Hovold 
---
 drivers/usb/core/usb.c | 116 ++---
 include/linux/usb.h|  35 +++
 2 files changed, 115 insertions(+), 36 deletions(-)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 4d074233d526..aacf22be2a07 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -74,6 +74,52 @@ MODULE_PARM_DESC(autosuspend, "default autosuspend delay");
 #define usb_autosuspend_delay  0
 #endif
 
+static bool match_endpoint(struct usb_endpoint_descriptor *epd,
+   struct usb_endpoint_descriptor **bulk_in,
+   struct usb_endpoint_descriptor **bulk_out,
+   struct usb_endpoint_descriptor **int_in,
+   struct usb_endpoint_descriptor **int_out)
+{
+   switch (usb_endpoint_type(epd)) {
+   case USB_ENDPOINT_XFER_BULK:
+   if (usb_endpoint_dir_in(epd)) {
+   if (bulk_in && !*bulk_in) {
+   *bulk_in = epd;
+   break;
+   }
+   } else {
+   if (bulk_out && !*bulk_out) {
+   *bulk_out = epd;
+   break;
+   }
+   }
+
+   return false;
+   case USB_ENDPOINT_XFER_INT:
+   if (usb_endpoint_dir_in(epd)) {
+   if (int_in && !*int_in) {
+   *int_in = epd;
+   break;
+   }
+   } else {
+   if (int_out && !*int_out) {
+   *int_out = epd;
+   break;
+   }
+   }
+
+   return false;
+   default:
+   return false;
+   }
+
+   if ((!bulk_in || *bulk_in) && (!bulk_out || *bulk_out) &&
+   (!int_in || *int_in) && (!int_out || *int_out)) {
+   return true;
+   }
+
+   return false;
+}
 
 /**
  * usb_find_common_endpoints() -- lookup common endpoint descriptors
@@ -113,50 +159,48 @@ int usb_find_common_endpoints(struct usb_host_interface 
*alt,
for (i = 0; i < alt->desc.bNumEndpoints; ++i) {
epd = >endpoint[i].desc;
 
-   switch (usb_endpoint_type(epd)) {
-   case USB_ENDPOINT_XFER_BULK:
-   if (usb_endpoint_dir_in(epd)) {
-   if (bulk_in && !*bulk_in) {
-   *bulk_in = epd;
-   break;
-   }
-   } else {
-   if (bulk_out && !*bulk_out) {
-   *bulk_out = epd;
-   break;
-   }
-   }
+   if (match_endpoint(epd, bulk_in, bulk_out, int_in, int_out))
+   return 0;
+   }
 
-   continue;
-   case USB_ENDPOINT_XFER_INT:
-   if (usb_endpoint_dir_in(epd)) {
-   if (int_in && !*int_in) {
-   *int_in = epd;
-   break;
-   }
-   } else {
-   if (int_out && !*int_out) {
-   *int_out = epd;
-   break;
-   }
-   }
+   return -ENXIO;
+}
+EXPORT_SYMBOL_GPL(usb_find_common_endpoints);
 
-   continue;
-   default:
-   continue;
-   }
+/**
+ * usb_find_common_endpoints_reverse() -- lookup common endpoint descriptors
+ *
+ * Same as usb_find_common_endpoints(), but the endpoint descriptors are
+ * searched in reverse order (see usb_find_common_endpoints() for details).
+ */
+int usb_find_common_endpoints_reverse(struct usb_host_interface *alt,
+   struct usb_endpoint_descriptor **bulk_in,
+   struct usb_endpoint_descriptor **bulk_out,
+   struct usb_endpoint_descriptor **int_in,
+   struct usb_endpoint_descriptor **int_out)
+{
+   struct usb_endpoint_descriptor *epd;
+   int i;
 
-   if ((!bulk_in || *bulk_in) &&
-   (!bulk_out || *bulk_out) &&
-   (!int_in || *int_in) &&
-   

[PATCH 01/16] USB: core: add helpers to retrieve endpoints

2017-03-15 Thread Johan Hovold
Many USB drivers iterate over the available endpoints to find required
endpoints of a specific type and direction. Typically the endpoints are
required for proper function and a missing endpoint should abort probe.

To facilitate code reuse, add a helper to retrieve common endpoints
(bulk or interrupt, in or out) and four wrappers to find a single
endpoint.

Note that the helpers are marked as __must_check to serve as a reminder
to always verify that all expected endpoints are indeed present. This
also means that any optional endpoints, typically need to be looked up
through separate calls.

Signed-off-by: Johan Hovold 
---
 drivers/usb/core/usb.c | 83 ++
 include/linux/usb.h| 35 +
 2 files changed, 118 insertions(+)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index a2ccc69fb45c..4d074233d526 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -76,6 +76,89 @@ MODULE_PARM_DESC(autosuspend, "default autosuspend delay");
 
 
 /**
+ * usb_find_common_endpoints() -- lookup common endpoint descriptors
+ * @alt:   alternate setting to search
+ * @bulk_in:   pointer to descriptor pointer, or NULL
+ * @bulk_out:  pointer to descriptor pointer, or NULL
+ * @int_in:pointer to descriptor pointer, or NULL
+ * @int_out:   pointer to descriptor pointer, or NULL
+ *
+ * Search the alternate setting's endpoint descriptors for the first bulk-in,
+ * bulk-out, interrupt-in and interrupt-out endpoints and return them in the
+ * provided pointers (unless they are NULL).
+ *
+ * If a requested endpoint is not found, the corresponding pointer is set to
+ * NULL.
+ *
+ * Return: Zero if all requested descriptors were found, or -ENXIO otherwise.
+ */
+int usb_find_common_endpoints(struct usb_host_interface *alt,
+   struct usb_endpoint_descriptor **bulk_in,
+   struct usb_endpoint_descriptor **bulk_out,
+   struct usb_endpoint_descriptor **int_in,
+   struct usb_endpoint_descriptor **int_out)
+{
+   struct usb_endpoint_descriptor *epd;
+   int i;
+
+   if (bulk_in)
+   *bulk_in = NULL;
+   if (bulk_out)
+   *bulk_out = NULL;
+   if (int_in)
+   *int_in = NULL;
+   if (int_out)
+   *int_out = NULL;
+
+   for (i = 0; i < alt->desc.bNumEndpoints; ++i) {
+   epd = >endpoint[i].desc;
+
+   switch (usb_endpoint_type(epd)) {
+   case USB_ENDPOINT_XFER_BULK:
+   if (usb_endpoint_dir_in(epd)) {
+   if (bulk_in && !*bulk_in) {
+   *bulk_in = epd;
+   break;
+   }
+   } else {
+   if (bulk_out && !*bulk_out) {
+   *bulk_out = epd;
+   break;
+   }
+   }
+
+   continue;
+   case USB_ENDPOINT_XFER_INT:
+   if (usb_endpoint_dir_in(epd)) {
+   if (int_in && !*int_in) {
+   *int_in = epd;
+   break;
+   }
+   } else {
+   if (int_out && !*int_out) {
+   *int_out = epd;
+   break;
+   }
+   }
+
+   continue;
+   default:
+   continue;
+   }
+
+   if ((!bulk_in || *bulk_in) &&
+   (!bulk_out || *bulk_out) &&
+   (!int_in || *int_in) &&
+   (!int_out || *int_out)) {
+   return 0;
+   }
+   }
+
+   return -ENXIO;
+}
+EXPORT_SYMBOL_GPL(usb_find_common_endpoints);
+
+/**
  * usb_find_alt_setting() - Given a configuration, find the alternate setting
  * for the given interface.
  * @config: the configuration to search (not necessarily the current config).
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 7e68259360de..82e7d52b4ad9 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -99,6 +99,41 @@ enum usb_interface_condition {
USB_INTERFACE_UNBINDING,
 };
 
+int __must_check
+usb_find_common_endpoints(struct usb_host_interface *alt,
+   struct usb_endpoint_descriptor **bulk_in,
+   struct usb_endpoint_descriptor **bulk_out,
+   struct usb_endpoint_descriptor **int_in,
+   struct usb_endpoint_descriptor **int_out);
+
+static inline int __must_check
+usb_find_bulk_in_endpoint(struct usb_host_interface *alt,
+   struct 

[PATCH 00/16] USB: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Many USB drivers iterate over the available endpoints to find required
endpoints of a specific type and direction. Typically the endpoints are
required for proper function and a missing endpoint should abort probe.

To facilitate code reuse, this series adds a helper to retrieve common
endpoints (bulk or interrupt, in or out) and four wrappers to find a
single endpoint (which should cover the vast majority of drivers).

This typically saves about 10-15 lines of code per driver, so even if
this series result in a net gain in terms of lines due to the helpers
being added to core, there will be further reductions when applied to
other subsystems.

Note that the helpers are marked as __must_check to serve as a reminder
to always verify that all expected endpoints are indeed present.

Also note that some drivers have implemented their endpoint look-up
loops in such a way that they have picked the last endpoint descriptor
of the specified type should more than one such descriptor exist. To
avoid any regressions, the second patch therefore adds corresponding
helpers to lookup endpoints by searching the endpoint descriptors in
reverse order. In almost all cases, I expect it would be safe to simply
pick the first matching descriptor instead (i.e. there is only one
endpoint descriptor per type).

Note that this series applies on top of the two USBTMC fixes I submitted
yesterday.

Johan


Johan Hovold (16):
  USB: core: add helpers to retrieve endpoints
  USB: core: add helpers to retrieve endpoints in reverse order
  USB: adutux: refactor endpoint retrieval
  USB: appledisplay: refactor endpoint retrieval
  USB: chaoskey: refactor endpoint retrieval
  USB: ftdi-elan: refactor endpoint retrieval
  USB: idmouse: refactor endpoint retrieval
  USB: iowarrior: refactor endpoint retrieval
  USB: ldusb: refactor endpoint retrieval
  USB: legousbtower: refactor endpoint retrieval
  USB: lvstest: tighten endpoint sanity check
  USB: usblcd: refactor endpoint retrieval
  USB: uss720: add debug endpoint-type check
  USB: yurex: refactor endpoint retrieval
  USB: usbtmc: refactor endpoint retrieval
  USB: usb-skeleton: refactor endpoint retrieval

 drivers/usb/class/usbtmc.c  |  56 ++
 drivers/usb/core/usb.c  | 127 
 drivers/usb/misc/adutux.c   |  38 
 drivers/usb/misc/appledisplay.c |  19 ++
 drivers/usb/misc/chaoskey.c |  23 
 drivers/usb/misc/ftdi-elan.c|  42 ++---
 drivers/usb/misc/idmouse.c  |  31 --
 drivers/usb/misc/iowarrior.c|  24 +++-
 drivers/usb/misc/ldusb.c|  23 +++-
 drivers/usb/misc/legousbtower.c |  29 +++--
 drivers/usb/misc/lvstest.c  |   7 +--
 drivers/usb/misc/usblcd.c   |  47 ++-
 drivers/usb/misc/uss720.c   |  10 ++--
 drivers/usb/misc/yurex.c|  15 ++---
 drivers/usb/usb-skeleton.c  |  59 ---
 include/linux/usb.h |  70 ++
 16 files changed, 351 insertions(+), 269 deletions(-)

-- 
2.12.0

--
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 15/16] USB: usbtmc: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required bulk-in and bulk-out
endpoints, and the optional interrupt-in endpoint.

Signed-off-by: Johan Hovold 
---
 drivers/usb/class/usbtmc.c | 56 +++---
 1 file changed, 18 insertions(+), 38 deletions(-)

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 8fb309a0ff6b..578f424decc2 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -1375,7 +1375,7 @@ static int usbtmc_probe(struct usb_interface *intf,
 {
struct usbtmc_device_data *data;
struct usb_host_interface *iface_desc;
-   struct usb_endpoint_descriptor *endpoint;
+   struct usb_endpoint_descriptor *bulk_in, *bulk_out, *int_in;
int n;
int retcode;
 
@@ -1421,49 +1421,29 @@ static int usbtmc_probe(struct usb_interface *intf,
iface_desc = data->intf->cur_altsetting;
data->ifnum = iface_desc->desc.bInterfaceNumber;
 
-   /* Find bulk in endpoint */
-   for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) {
-   endpoint = _desc->endpoint[n].desc;
-
-   if (usb_endpoint_is_bulk_in(endpoint)) {
-   data->bulk_in = endpoint->bEndpointAddress;
-   dev_dbg(>dev, "Found bulk in endpoint at %u\n",
-   data->bulk_in);
-   break;
-   }
-   }
-
-   /* Find bulk out endpoint */
-   for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) {
-   endpoint = _desc->endpoint[n].desc;
-
-   if (usb_endpoint_is_bulk_out(endpoint)) {
-   data->bulk_out = endpoint->bEndpointAddress;
-   dev_dbg(>dev, "Found Bulk out endpoint at %u\n",
-   data->bulk_out);
-   break;
-   }
-   }
-
-   if (!data->bulk_out || !data->bulk_in) {
+   /* Find bulk endpoints */
+   retcode = usb_find_common_endpoints(iface_desc,
+   _in, _out, NULL, NULL);
+   if (retcode) {
dev_err(>dev, "bulk endpoints not found\n");
-   retcode = -ENODEV;
goto err_put;
}
 
+   data->bulk_in = bulk_in->bEndpointAddress;
+   dev_dbg(>dev, "Found bulk in endpoint at %u\n", data->bulk_in);
+
+   data->bulk_out = bulk_out->bEndpointAddress;
+   dev_dbg(>dev, "Found Bulk out endpoint at %u\n", data->bulk_out);
+
/* Find int endpoint */
-   for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) {
-   endpoint = _desc->endpoint[n].desc;
-
-   if (usb_endpoint_is_int_in(endpoint)) {
-   data->iin_ep_present = 1;
-   data->iin_ep = endpoint->bEndpointAddress;
-   data->iin_wMaxPacketSize = usb_endpoint_maxp(endpoint);
-   data->iin_interval = endpoint->bInterval;
-   dev_dbg(>dev, "Found Int in endpoint at %u\n",
+   retcode = usb_find_int_in_endpoint(iface_desc, _in);
+   if (!retcode) {
+   data->iin_ep_present = 1;
+   data->iin_ep = int_in->bEndpointAddress;
+   data->iin_wMaxPacketSize = usb_endpoint_maxp(int_in);
+   data->iin_interval = int_in->bInterval;
+   dev_dbg(>dev, "Found Int in endpoint at %u\n",
data->iin_ep);
-   break;
-   }
}
 
retcode = get_capabilities(data);
-- 
2.12.0

--
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 04/16] USB: appledisplay: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required interrupt-in
endpoint.

Signed-off-by: Johan Hovold 
---
 drivers/usb/misc/appledisplay.c | 19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
index da5ff401a354..8efdc500e790 100644
--- a/drivers/usb/misc/appledisplay.c
+++ b/drivers/usb/misc/appledisplay.c
@@ -212,28 +212,21 @@ static int appledisplay_probe(struct usb_interface *iface,
struct backlight_properties props;
struct appledisplay *pdata;
struct usb_device *udev = interface_to_usbdev(iface);
-   struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
int int_in_endpointAddr = 0;
-   int i, retval = -ENOMEM, brightness;
+   int retval, brightness;
char bl_name[20];
 
/* set up the endpoint information */
/* use only the first interrupt-in endpoint */
-   iface_desc = iface->cur_altsetting;
-   for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
-   endpoint = _desc->endpoint[i].desc;
-   if (!int_in_endpointAddr && usb_endpoint_is_int_in(endpoint)) {
-   /* we found an interrupt in endpoint */
-   int_in_endpointAddr = endpoint->bEndpointAddress;
-   break;
-   }
-   }
-   if (!int_in_endpointAddr) {
+   retval = usb_find_int_in_endpoint(iface->cur_altsetting, );
+   if (retval) {
dev_err(>dev, "Could not find int-in endpoint\n");
-   return -EIO;
+   return retval;
}
 
+   int_in_endpointAddr = endpoint->bEndpointAddress;
+
/* allocate memory for our device state and initialize it */
pdata = kzalloc(sizeof(struct appledisplay), GFP_KERNEL);
if (!pdata) {
-- 
2.12.0

--
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 07/16] USB: idmouse: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required bulk-in endpoint.

Note that we now pick the first bulk-in endpoint regardless of whether
it happens to be the first descriptor.

Signed-off-by: Johan Hovold 
---
 drivers/usb/misc/idmouse.c | 31 ---
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index 502bfe30a077..d185f49c353e 100644
--- a/drivers/usb/misc/idmouse.c
+++ b/drivers/usb/misc/idmouse.c
@@ -347,9 +347,6 @@ static int idmouse_probe(struct usb_interface *interface,
if (iface_desc->desc.bInterfaceClass != 0x0A)
return -ENODEV;
 
-   if (iface_desc->desc.bNumEndpoints < 1)
-   return -ENODEV;
-
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL)
@@ -360,26 +357,22 @@ static int idmouse_probe(struct usb_interface *interface,
dev->interface = interface;
 
/* set up the endpoint information - use only the first bulk-in 
endpoint */
-   endpoint = _desc->endpoint[0].desc;
-   if (!dev->bulk_in_endpointAddr && usb_endpoint_is_bulk_in(endpoint)) {
-   /* we found a bulk in endpoint */
-   dev->orig_bi_size = usb_endpoint_maxp(endpoint);
-   dev->bulk_in_size = 0x200; /* works _much_ faster */
-   dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
-   dev->bulk_in_buffer =
-   kmalloc(IMGSIZE + dev->bulk_in_size, GFP_KERNEL);
-
-   if (!dev->bulk_in_buffer) {
-   idmouse_delete(dev);
-   return -ENOMEM;
-   }
+   result = usb_find_bulk_in_endpoint(iface_desc, );
+   if (result) {
+   dev_err(>dev, "Unable to find bulk-in endpoint.\n");
+   idmouse_delete(dev);
+   return result;
}
 
-   if (!(dev->bulk_in_endpointAddr)) {
-   dev_err(>dev, "Unable to find bulk-in endpoint.\n");
+   dev->orig_bi_size = usb_endpoint_maxp(endpoint);
+   dev->bulk_in_size = 0x200; /* works _much_ faster */
+   dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
+   dev->bulk_in_buffer = kmalloc(IMGSIZE + dev->bulk_in_size, GFP_KERNEL);
+   if (!dev->bulk_in_buffer) {
idmouse_delete(dev);
-   return -ENODEV;
+   return -ENOMEM;
}
+
/* allow device read, write and ioctl */
dev->present = 1;
 
-- 
2.12.0

--
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 10/16] USB: legousbtower: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required interrupt-in and
interrupt-out endpoints.

Note that the descriptors are searched in reverse order to avoid any
regressions.

Signed-off-by: Johan Hovold 
---
 drivers/usb/misc/legousbtower.c | 29 +++--
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 322a042d6e59..201c9c3effbb 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -806,10 +806,7 @@ static int tower_probe (struct usb_interface *interface, 
const struct usb_device
struct device *idev = >dev;
struct usb_device *udev = interface_to_usbdev(interface);
struct lego_usb_tower *dev = NULL;
-   struct usb_host_interface *iface_desc;
-   struct usb_endpoint_descriptor* endpoint;
struct tower_get_version_reply get_version_reply;
-   int i;
int retval = -ENOMEM;
int result;
 
@@ -846,25 +843,13 @@ static int tower_probe (struct usb_interface *interface, 
const struct usb_device
dev->interrupt_out_urb = NULL;
dev->interrupt_out_busy = 0;
 
-   iface_desc = interface->cur_altsetting;
-
-   /* set up the endpoint information */
-   for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
-   endpoint = _desc->endpoint[i].desc;
-
-   if (usb_endpoint_xfer_int(endpoint)) {
-   if (usb_endpoint_dir_in(endpoint))
-   dev->interrupt_in_endpoint = endpoint;
-   else
-   dev->interrupt_out_endpoint = endpoint;
-   }
-   }
-   if(dev->interrupt_in_endpoint == NULL) {
-   dev_err(idev, "interrupt in endpoint not found\n");
-   goto error;
-   }
-   if (dev->interrupt_out_endpoint == NULL) {
-   dev_err(idev, "interrupt out endpoint not found\n");
+   result = usb_find_common_endpoints_reverse(interface->cur_altsetting,
+   NULL, NULL,
+   >interrupt_in_endpoint,
+   >interrupt_out_endpoint);
+   if (result) {
+   dev_err(idev, "interrupt endpoints not found\n");
+   retval = result;
goto error;
}
 
-- 
2.12.0

--
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 05/16] USB: chaoskey: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required bulk-in endpoint.

Signed-off-by: Johan Hovold 
---
 drivers/usb/misc/chaoskey.c | 23 ++-
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c
index aa350dc9eb25..9adfbb351eb7 100644
--- a/drivers/usb/misc/chaoskey.c
+++ b/drivers/usb/misc/chaoskey.c
@@ -117,28 +117,25 @@ static int chaoskey_probe(struct usb_interface *interface,
 {
struct usb_device *udev = interface_to_usbdev(interface);
struct usb_host_interface *altsetting = interface->cur_altsetting;
-   int i;
+   struct usb_endpoint_descriptor *epd;
int in_ep = -1;
struct chaoskey *dev;
-   int result = -ENOMEM;
+   int result;
int size;
 
usb_dbg(interface, "probe %s-%s", udev->product, udev->serial);
 
/* Find the first bulk IN endpoint and its packet size */
-   for (i = 0; i < altsetting->desc.bNumEndpoints; i++) {
-   if (usb_endpoint_is_bulk_in(>endpoint[i].desc)) {
-   in_ep = usb_endpoint_num(>endpoint[i].desc);
-   size = usb_endpoint_maxp(>endpoint[i].desc);
-   break;
-   }
+   result = usb_find_bulk_in_endpoint(altsetting, );
+   if (result) {
+   usb_dbg(interface, "no IN endpoint found");
+   return result;
}
 
+   in_ep = usb_endpoint_num(epd);
+   size = usb_endpoint_maxp(epd);
+
/* Validate endpoint and size */
-   if (in_ep == -1) {
-   usb_dbg(interface, "no IN endpoint found");
-   return -ENODEV;
-   }
if (size <= 0) {
usb_dbg(interface, "invalid size (%d)", size);
return -ENODEV;
@@ -151,7 +148,7 @@ static int chaoskey_probe(struct usb_interface *interface,
}
 
/* Looks good, allocate and initialize */
-
+   result = -ENOMEM;
dev = kzalloc(sizeof(struct chaoskey), GFP_KERNEL);
 
if (dev == NULL)
-- 
2.12.0

--
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 16/16] USB: usb-skeleton: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required bulk-in and bulk-out
endpoints.

Signed-off-by: Johan Hovold 
---
 drivers/usb/usb-skeleton.c | 59 --
 1 file changed, 25 insertions(+), 34 deletions(-)

diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
index 5133a0792eb0..bb0bd732e29a 100644
--- a/drivers/usb/usb-skeleton.c
+++ b/drivers/usb/usb-skeleton.c
@@ -491,16 +491,14 @@ static int skel_probe(struct usb_interface *interface,
  const struct usb_device_id *id)
 {
struct usb_skel *dev;
-   struct usb_host_interface *iface_desc;
-   struct usb_endpoint_descriptor *endpoint;
-   size_t buffer_size;
-   int i;
-   int retval = -ENOMEM;
+   struct usb_endpoint_descriptor *bulk_in, *bulk_out;
+   int retval;
 
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev)
-   goto error;
+   return -ENOMEM;
+
kref_init(>kref);
sema_init(>limit_sem, WRITES_IN_FLIGHT);
mutex_init(>io_mutex);
@@ -513,36 +511,29 @@ static int skel_probe(struct usb_interface *interface,
 
/* set up the endpoint information */
/* use only the first bulk-in and bulk-out endpoints */
-   iface_desc = interface->cur_altsetting;
-   for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
-   endpoint = _desc->endpoint[i].desc;
-
-   if (!dev->bulk_in_endpointAddr &&
-   usb_endpoint_is_bulk_in(endpoint)) {
-   /* we found a bulk in endpoint */
-   buffer_size = usb_endpoint_maxp(endpoint);
-   dev->bulk_in_size = buffer_size;
-   dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
-   dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-   if (!dev->bulk_in_buffer)
-   goto error;
-   dev->bulk_in_urb = usb_alloc_urb(0, GFP_KERNEL);
-   if (!dev->bulk_in_urb)
-   goto error;
-   }
-
-   if (!dev->bulk_out_endpointAddr &&
-   usb_endpoint_is_bulk_out(endpoint)) {
-   /* we found a bulk out endpoint */
-   dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
-   }
-   }
-   if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr)) {
+   retval = usb_find_common_endpoints(interface->cur_altsetting,
+   _in, _out, NULL, NULL);
+   if (retval) {
dev_err(>dev,
"Could not find both bulk-in and bulk-out endpoints\n");
goto error;
}
 
+   dev->bulk_in_size = usb_endpoint_maxp(bulk_in);
+   dev->bulk_in_endpointAddr = bulk_in->bEndpointAddress;
+   dev->bulk_in_buffer = kmalloc(dev->bulk_in_size, GFP_KERNEL);
+   if (!dev->bulk_in_buffer) {
+   retval = -ENOMEM;
+   goto error;
+   }
+   dev->bulk_in_urb = usb_alloc_urb(0, GFP_KERNEL);
+   if (!dev->bulk_in_urb) {
+   retval = -ENOMEM;
+   goto error;
+   }
+
+   dev->bulk_out_endpointAddr = bulk_out->bEndpointAddress;
+
/* save our data pointer in this interface device */
usb_set_intfdata(interface, dev);
 
@@ -563,9 +554,9 @@ static int skel_probe(struct usb_interface *interface,
return 0;
 
 error:
-   if (dev)
-   /* this frees allocated memory */
-   kref_put(>kref, skel_delete);
+   /* this frees allocated memory */
+   kref_put(>kref, skel_delete);
+
return retval;
 }
 
-- 
2.12.0

--
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 13/16] USB: uss720: add debug endpoint-type check

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the interrupt-in endpoint,
and only print the corresponding debugging information in case it is
found.

Note that the descriptors are searched in reverse order to avoid any
regressions.

Signed-off-by: Johan Hovold 
---
 drivers/usb/misc/uss720.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
index 07014cad6dbe..5947373700a1 100644
--- a/drivers/usb/misc/uss720.c
+++ b/drivers/usb/misc/uss720.c
@@ -689,7 +689,7 @@ static int uss720_probe(struct usb_interface *intf,
 {
struct usb_device *usbdev = usb_get_dev(interface_to_usbdev(intf));
struct usb_host_interface *interface;
-   struct usb_host_endpoint *endpoint;
+   struct usb_endpoint_descriptor *epd;
struct parport_uss720_private *priv;
struct parport *pp;
unsigned char reg;
@@ -745,9 +745,11 @@ static int uss720_probe(struct usb_interface *intf,
get_1284_register(pp, 0, , GFP_KERNEL);
dev_dbg(>dev, "reg: %7ph\n", priv->reg);
 
-   endpoint = >endpoint[2];
-   dev_dbg(>dev, "epaddr %d interval %d\n",
-   endpoint->desc.bEndpointAddress, endpoint->desc.bInterval);
+   i = usb_find_last_int_in_endpoint(interface, );
+   if (!i) {
+   dev_dbg(>dev, "epaddr %d interval %d\n",
+   epd->bEndpointAddress, epd->bInterval);
+   }
parport_announce_port(pp);
 
usb_set_intfdata(intf, pp);
-- 
2.12.0

--
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 09/16] USB: ldusb: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required interrupt-in
endpoint and optional interrupt-out endpoint.

Note that the descriptors are searched in reverse order to avoid any
regressions.

Signed-off-by: Johan Hovold 
---
 drivers/usb/misc/ldusb.c | 23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 3bc5356832db..7a94f95bdec6 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -650,9 +650,7 @@ static int ld_usb_probe(struct usb_interface *intf, const 
struct usb_device_id *
struct usb_device *udev = interface_to_usbdev(intf);
struct ld_usb *dev = NULL;
struct usb_host_interface *iface_desc;
-   struct usb_endpoint_descriptor *endpoint;
char *buffer;
-   int i;
int retval = -ENOMEM;
 
/* allocate memory for our device state and initialize it */
@@ -681,23 +679,20 @@ static int ld_usb_probe(struct usb_interface *intf, const 
struct usb_device_id *
 
iface_desc = intf->cur_altsetting;
 
-   /* set up the endpoint information */
-   for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
-   endpoint = _desc->endpoint[i].desc;
-
-   if (usb_endpoint_is_int_in(endpoint))
-   dev->interrupt_in_endpoint = endpoint;
-
-   if (usb_endpoint_is_int_out(endpoint))
-   dev->interrupt_out_endpoint = endpoint;
-   }
-   if (dev->interrupt_in_endpoint == NULL) {
+   retval = usb_find_last_int_in_endpoint(iface_desc,
+   >interrupt_in_endpoint);
+   if (retval) {
dev_err(>dev, "Interrupt in endpoint not found\n");
goto error;
}
-   if (dev->interrupt_out_endpoint == NULL)
+
+   retval = usb_find_last_int_out_endpoint(iface_desc,
+   >interrupt_out_endpoint);
+   if (retval)
dev_warn(>dev, "Interrupt out endpoint not found (using 
control endpoint instead)\n");
 
+   retval = -ENOMEM;
+
dev->interrupt_in_endpoint_size = 
usb_endpoint_maxp(dev->interrupt_in_endpoint);
dev->ring_buffer = 
kmalloc(ring_buffer_size*(sizeof(size_t)+dev->interrupt_in_endpoint_size), 
GFP_KERNEL);
if (!dev->ring_buffer)
-- 
2.12.0

--
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 06/16] USB: ftdi-elan: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required bulk-in and bulk-out
endpoints.

Signed-off-by: Johan Hovold 
---
 drivers/usb/misc/ftdi-elan.c | 42 +-
 1 file changed, 17 insertions(+), 25 deletions(-)

diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index 01a9373b7e18..8291499d0581 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -2700,10 +2700,8 @@ static int ftdi_elan_probe(struct usb_interface 
*interface,
   const struct usb_device_id *id)
 {
struct usb_host_interface *iface_desc;
-   struct usb_endpoint_descriptor *endpoint;
-   size_t buffer_size;
-   int i;
-   int retval = -ENOMEM;
+   struct usb_endpoint_descriptor *bulk_in, *bulk_out;
+   int retval;
struct usb_ftdi *ftdi;
 
ftdi = kzalloc(sizeof(struct usb_ftdi), GFP_KERNEL);
@@ -2720,31 +2718,25 @@ static int ftdi_elan_probe(struct usb_interface 
*interface,
ftdi->interface = interface;
mutex_init(>u132_lock);
ftdi->expected = 4;
+
iface_desc = interface->cur_altsetting;
-   for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
-   endpoint = _desc->endpoint[i].desc;
-   if (!ftdi->bulk_in_endpointAddr &&
-   usb_endpoint_is_bulk_in(endpoint)) {
-   buffer_size = usb_endpoint_maxp(endpoint);
-   ftdi->bulk_in_size = buffer_size;
-   ftdi->bulk_in_endpointAddr = endpoint->bEndpointAddress;
-   ftdi->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-   if (!ftdi->bulk_in_buffer) {
-   retval = -ENOMEM;
-   goto error;
-   }
-   }
-   if (!ftdi->bulk_out_endpointAddr &&
-   usb_endpoint_is_bulk_out(endpoint)) {
-   ftdi->bulk_out_endpointAddr =
-   endpoint->bEndpointAddress;
-   }
-   }
-   if (!(ftdi->bulk_in_endpointAddr && ftdi->bulk_out_endpointAddr)) {
+   retval = usb_find_common_endpoints(iface_desc,
+   _in, _out, NULL, NULL);
+   if (retval) {
dev_err(>udev->dev, "Could not find both bulk-in and 
bulk-out endpoints\n");
-   retval = -ENODEV;
goto error;
}
+
+   ftdi->bulk_in_size = usb_endpoint_maxp(bulk_in);
+   ftdi->bulk_in_endpointAddr = bulk_in->bEndpointAddress;
+   ftdi->bulk_in_buffer = kmalloc(ftdi->bulk_in_size, GFP_KERNEL);
+   if (!ftdi->bulk_in_buffer) {
+   retval = -ENOMEM;
+   goto error;
+   }
+
+   ftdi->bulk_out_endpointAddr = bulk_out->bEndpointAddress;
+
dev_info(>udev->dev, "interface %d has I=%02X O=%02X\n",
 iface_desc->desc.bInterfaceNumber, ftdi->bulk_in_endpointAddr,
 ftdi->bulk_out_endpointAddr);
-- 
2.12.0

--
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 14/16] USB: yurex: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required interrupt-in
endpoint.

Signed-off-by: Johan Hovold 
---
 drivers/usb/misc/yurex.c | 15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
index 54e53ac4c08f..9853df669b0f 100644
--- a/drivers/usb/misc/yurex.c
+++ b/drivers/usb/misc/yurex.c
@@ -195,7 +195,6 @@ static int yurex_probe(struct usb_interface *interface, 
const struct usb_device_
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
int retval = -ENOMEM;
-   int i;
DEFINE_WAIT(wait);
 
/* allocate memory for our device state and initialize it */
@@ -212,22 +211,16 @@ static int yurex_probe(struct usb_interface *interface, 
const struct usb_device_
 
/* set up the endpoint information */
iface_desc = interface->cur_altsetting;
-   for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
-   endpoint = _desc->endpoint[i].desc;
-
-   if (usb_endpoint_is_int_in(endpoint)) {
-   dev->int_in_endpointAddr = endpoint->bEndpointAddress;
-   break;
-   }
-   }
-   if (!dev->int_in_endpointAddr) {
-   retval = -ENODEV;
+   retval = usb_find_int_in_endpoint(iface_desc, );
+   if (retval) {
dev_err(>dev, "Could not find endpoints\n");
goto error;
}
 
+   dev->int_in_endpointAddr = endpoint->bEndpointAddress;
 
/* allocate control URB */
+   retval = -ENOMEM;
dev->cntl_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->cntl_urb)
goto error;
-- 
2.12.0

--
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 08/16] USB: iowarrior: refactor endpoint retrieval

2017-03-15 Thread Johan Hovold
Use the new endpoint helpers to lookup the required interrupt-in
endpoint.

IOWarror56 devices also requires an interrupt-out endpoint, which is
looked up in a second call.

Note that the descriptors are searched in reverse order to avoid any
regressions.

Signed-off-by: Johan Hovold 
---
 drivers/usb/misc/iowarrior.c | 24 
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 37c63cb39714..c3d069a4a9b9 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -757,7 +757,6 @@ static int iowarrior_probe(struct usb_interface *interface,
struct iowarrior *dev = NULL;
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
-   int i;
int retval = -ENOMEM;
 
/* allocate memory for our device state and initialize it */
@@ -781,29 +780,21 @@ static int iowarrior_probe(struct usb_interface 
*interface,
iface_desc = interface->cur_altsetting;
dev->product_id = le16_to_cpu(udev->descriptor.idProduct);
 
-   /* set up the endpoint information */
-   for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
-   endpoint = _desc->endpoint[i].desc;
-
-   if (usb_endpoint_is_int_in(endpoint))
-   dev->int_in_endpoint = endpoint;
-   if (usb_endpoint_is_int_out(endpoint))
-   /* this one will match for the IOWarrior56 only */
-   dev->int_out_endpoint = endpoint;
-   }
-
-   if (!dev->int_in_endpoint) {
+   retval = usb_find_last_int_in_endpoint(iface_desc, );
+   if (retval) {
dev_err(>dev, "no interrupt-in endpoint found\n");
-   retval = -ENODEV;
goto error;
}
 
+   dev->int_in_endpoint = endpoint;
+
if (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56) {
-   if (!dev->int_out_endpoint) {
+   retval = usb_find_last_int_out_endpoint(iface_desc, );
+   if (retval) {
dev_err(>dev, "no interrupt-out endpoint 
found\n");
-   retval = -ENODEV;
goto error;
}
+   dev->int_out_endpoint = endpoint;
}
 
/* we have to check the report_size often, so remember it in the 
endianness suitable for our machine */
@@ -813,6 +804,7 @@ static int iowarrior_probe(struct usb_interface *interface,
/* IOWarrior56 has wMaxPacketSize different from report size */
dev->report_size = 7;
 
+   retval = -ENOMEM;
/* create the urb and buffer for reading */
dev->int_in_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->int_in_urb)
-- 
2.12.0

--
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: [RESEND PATCH v3 2/2] phy: Group vendor specific phy drivers

2017-03-15 Thread Vivek Gautam
On Wed, Mar 15, 2017 at 1:38 PM, Heiko Stübner  wrote:
> Am Dienstag, 14. März 2017, 11:52:50 CET schrieb Vivek Gautam:
>> Adding vendor specific directories in phy to group
>> phy drivers under their respective vendor umbrella.
>>
>> Also updated the MAINTAINERS file to reflect the correct
>> directory structure for phy drivers.
>>
>> Signed-off-by: Vivek Gautam 
>> Acked-by: Heiko Stuebner 
>> Acked-by: Viresh Kumar 
>> Cc: Kishon Vijay Abraham I 
>> Cc: David S. Miller 
>> Cc: Geert Uytterhoeven 
>> Cc: Yoshihiro Shimoda 
>> Cc: Guenter Roeck 
>> Cc: Heiko Stuebner 
>> Cc: Viresh Kumar 
>> Cc: Maxime Ripard 
>> Cc: Chen-Yu Tsai 
>> Cc: Sylwester Nawrocki 
>> Cc: Krzysztof Kozlowski 
>> Cc: Jaehoon Chung 
>> Cc: linux-arm-ker...@lists.infradead.org
>> Cc: linux-arm-...@vger.kernel.org
>> Cc: linux-ker...@vger.kernel.org
>> Cc: linux-o...@vger.kernel.org
>> Cc: linux-renesas-...@vger.kernel.org
>> Cc: linux-rockc...@lists.infradead.org
>> Cc: linux-samsung-...@vger.kernel.org
>> Cc: linux-usb@vger.kernel.org
>> ---
>>
>> Corrected Krzysztof's email-id. Added linux-arm-msm.
>>
>> Hi Heiko, Viresh,
>> It's been a year since the last version of this patch was posted.
>> Kishon has agreed to pull this change now. I am carrying forward
>> your Acks since there are no functional changes.
>> I have taken care of the drivers that were added/removed since
>> the last version.
>> Please feel free to jump in if you have any concerns.
>
> still looks all good and I gave that a try on 4.11-rc2 yesterday as well.

Thanks Heiko for testing this patch.

Best Regards
Vivek
>
>
> Heiko
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
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-musb: keep VBUS on when device is disconnected

2017-03-15 Thread Moreno Bartalucci
With usb-musb port in host mode, when the device
is disconnected, either logically (because of a mode switch) or
physically (by pulling the cable), the USB port should keep
suppling VBUS, with no interruption, to prevent power loss on
USB powered devices.

Signed-off-by: Moreno Bartalucci 
---
 drivers/usb/musb/musb_dsps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 7c047c4..5d9986b 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -245,7 +245,7 @@ static int dsps_check_status(struct musb *musb, void 
*unused)
dsps_mod_timer_optional(glue);
break;
case OTG_STATE_A_WAIT_BCON:
-   musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
+   musb_writeb(musb->mregs, MUSB_DEVCTL, MUSB_DEVCTL_SESSION);
skip_session = 1;
/* fall */
 
-- 
2.10.1 (Apple Git-78)

--
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 v2 13/14] usb: host: ehci-st: simplify optional reset handling

2017-03-15 Thread Alan Stern
On Wed, 15 Mar 2017, Philipp Zabel wrote:

> As of commit bb475230b8e5 ("reset: make optional functions really
> optional"), the reset framework API calls use NULL pointers to describe
> optional, non-present reset controls.

What does it use to describe genuine errors?

> This allows to return errors from devm_reset_control_get_optional_shared
> unconditionally.
> 
> Signed-off-by: Philipp Zabel 
> ---
>  drivers/usb/host/ehci-st.c | 8 ++--
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-st.c b/drivers/usb/host/ehci-st.c
> index be4a2788fc582..12e803d2c98df 100644
> --- a/drivers/usb/host/ehci-st.c
> +++ b/drivers/usb/host/ehci-st.c
> @@ -210,18 +210,14 @@ static int st_ehci_platform_probe(struct 
> platform_device *dev)
>   devm_reset_control_get_optional_shared(>dev, "power");
>   if (IS_ERR(priv->pwr)) {
>   err = PTR_ERR(priv->pwr);
> - if (err == -EPROBE_DEFER)
> - goto err_put_clks;
> - priv->pwr = NULL;
> + goto err_put_clks;
>   }
>  
>   priv->rst =
>   devm_reset_control_get_optional_shared(>dev, "softreset");
>   if (IS_ERR(priv->rst)) {
>   err = PTR_ERR(priv->rst);
> - if (err == -EPROBE_DEFER)
> - goto err_put_clks;
> - priv->rst = NULL;
> + goto err_put_clks;
>   }
>  
>   if (pdata->power_on) {

These changes do not agree with the patch description.  If any sort of 
error besides EPROBE_DEFER occurs then:

the old code sets priv->pwr or priv->rst to NULL and continues;

the new code returns with an error.

The only way the patch could be equivalent to the existing code would
be if devm_reset_control_get_optional_shared() returns no errors other
than EPROBE_DEFER.  But the patch description doesn't say this.

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: Dell Inspiron 5558/0VNM2T hangs at resume from suspend when USB 3 is enabled

2017-03-15 Thread Diego Viola
On Tue, Mar 14, 2017 at 4:15 PM, Diego Viola  wrote:
> On Tue, Mar 14, 2017 at 2:20 PM, Diego Viola  wrote:
>> On Thu, Mar 9, 2017 at 2:15 PM, Diego Viola  wrote:
>>> On Thu, Mar 9, 2017 at 11:11 AM, Diego Viola  wrote:
 On Wed, Mar 8, 2017 at 5:40 PM, Diego Viola  wrote:
> Hi Greg,
>
> On Wed, Mar 8, 2017 at 5:15 PM, Greg KH  
> wrote:
>> On Wed, Mar 08, 2017 at 03:49:19PM -0300, Diego Viola wrote:
>>> It hangs on resume from suspend if I have USB 3.0 enabled on the BIOS,
>>> it works fine with ehci_hcd or USB 2.0.
>>>
>>> The way I reproduce the problem is with this command:
>>>
>>> $ i3lock && systemctl suspend
>>>
>>> This is what I see on the screen when it hangs:
>>>
>>> https://dl.dropboxusercontent.com/u/6005119/dell/IMG_20170308_095000.jpg
>>> https://dl.dropboxusercontent.com/u/6005119/dell/IMG_20170307_133928.jpg
>>>
>>> Some logs:
>>>
>>> https://dl.dropboxusercontent.com/u/6005119/dell/dmesg1.txt
>>> https://dl.dropboxusercontent.com/u/6005119/dell/dmesg2.txt
>>>
>>> I'm on Arch Linux x86_64, kernel 4.9.11-1-ARCH.
>>>
>>> I also tried Linux 4.10.1 and I could reproduce this problem there as 
>>> well.
>>>
>>> Please let me know if I could provide more info.
>>
>> Has any previous kernel ever worked properly before?  If so, any chance
>> you can use 'git bisect' to find the offending commit?
>
> I'm not sure, this is my work machine and I've only started using it
> recently (since about a month ago or so).
>
> I will try older kernels and see if I get any different results, I
> will report back in any case.
>
>>
>> And are you sure you have updated your bios to the latest version?
>
> Yes.
>
>>
>> thanks,
>>
>> greg k-h
>
> Thanks,
> Diego

 I found another workaround, I can suspend/resume fine with `i3lock &&
 systemctl suspend` if I disconnect/unplug all my USB devices
 (keyboard, mouse, etc). This with the default settings in the BIOS
 (both USB 2.0 and 3.0 enabled).

 I'm also seeing some messages like this in dmesg:

 [   16.172190] usb 2-6: device descriptor read/64, error -110

 Would this indicate a hardware/firmware/power issue?

 Thanks,
 Diego
>>>
>>> OK, I've built Linux 4.4.52 (I did a localmodconfig) and rebooted into
>>> it, I did a suspend/resume and it hanged the first time I tried to
>>> resume, which isn't much different than using the latest kernel.
>>>
>>> My dmesg is still being spammed with these messages:
>>>
>>> [  260.043673] usb 2-1: Device not responding to setup address.
>>> [  260.246918] usb 2-1: device not accepting address 15, error -71
>>> [  260.633662] usb 2-1: new high-speed USB device number 17 using xhci_hcd
>>> [  261.341340] usb 2-1: USB disconnect, device number 17
>>>
>>> I guess it's safe to assume at this point that this is a hardware problem?
>>>
>>> Thanks,
>>> Diego
>>
>> Hello,
>>
>> I've found something interesting and what it seems to be the cause of
>> my problem.
>>
>> As soon as I boot my system I can see this process being in the D-state:
>>
>> [root@myhost ~]# ps aux | grep " D"
>> root   269  0.0  0.0  0 0 ?D14:11   0:00 
>> [rtsx_usb_ms_2]
>> root  1424  0.0  0.0  10788  2172 pts/2S+   14:19   0:00 grep  D
>> [root@myhost ~]#
>>
>> I'm not exactly sure why that is, but if I do a 'rmmod rtsx_usb_ms'
>> the problem is gone. I already tried suspending/resuming ~40 times
>> after I disabled the module and the suspend/resume problem is gone.
>>
>> Diego
>
> Adding Roger Tseng to the CC also.
>
> Diego

According to this document:

http://downloads.dell.com/manuals/all-products/esuprt_laptop/esuprt_inspiron_laptop/inspiron-15-5558-laptop_reference%20guide_en-us.pdf

My computer only has a SD card slot and no MEMSTICK slot.

lsusb says this though:

Bus 001 Device 005: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129
Card Reader Controller

Maybe the driver gets locked up looking for the MEMSTICK slot?

Diego
--
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: unexpected TRB Type 4, Disable of device-initiated U1 failed

2017-03-15 Thread Mathias Nyman

Hi

On 14.03.2017 18:16, Nathan Shearer wrote:

I have been archiving data from old hard drives, and I have a drive that
spins up, but does not finish detecting (the drive is faulty). When this
happens on kernel 4.10.1 there is some kind of a timeout, and the usb
port that my dock is plugged into is permanently disabled until I
reboot. Disconnecting the usb dock and power cycling the dock does not
fix the usb port. Below is my kernel messages log when I power up the dock:


Does earlier kernels work better? 4.10 has a change in USB 3 port disabling
which is also called when usb core fails to address a device.

37be6676 usb: hub: Fix auto-remount of safely removed or ejected USB-3 devices

Older kernels would re-enable usb3 ports immediately after port disable.
Does dock work in other ports after power cycle?
does disabled port react to other USB devices?




Mar 14 09:51:38 varws03 kernel: usb 4-4: new SuperSpeed USB device
number 26 using xhci_hcd
Mar 14 09:51:38 varws03 kernel: usb 4-4: New USB device found,
idVendor=0480, idProduct=a006
Mar 14 09:51:38 varws03 kernel: usb 4-4: New USB device strings: Mfr=2,
Product=3, SerialNumber=1
Mar 14 09:51:38 varws03 kernel: usb 4-4: Product: ASM1351
Mar 14 09:51:38 varws03 kernel: usb 4-4: Manufacturer: Asmedia
Mar 14 09:51:38 varws03 kernel: usb 4-4: SerialNumber: 123456789116
Mar 14 09:51:38 varws03 kernel: scsi host6: uas
Mar 14 09:51:38 varws03 kernel: scsi 6:0:0:0: Direct-Access ASMT
2135 0PQ: 0 ANSI: 6
Mar 14 09:51:39 varws03 kernel: sd 6:0:0:0: Attached scsi generic sg1 type 0
Mar 14 09:51:39 varws03 kernel: sd 6:0:0:0: [sdb] Spinning up disk...
Mar 14 09:51:41 varws03 kernel: .
Mar 14 09:51:42 varws03 kernel: .
Mar 14 09:51:43 varws03 kernel: .
Mar 14 09:51:44 varws03 kernel: .
Mar 14 09:51:45 varws03 kernel: .
Mar 14 09:51:45 varws03 kernel: .
Mar 14 09:51:45 varws03 kernel: ready
Mar 14 09:52:15 varws03 kernel: sd 6:0:0:0: tag#0 uas_eh_abort_handler 0
uas-tag 1 inflight: CMD IN
Mar 14 09:52:15 varws03 kernel: sd 6:0:0:0: tag#0 CDB: Read capacity(16)
9e 10 00 00 00 00 00 00 00 00 00 00 00 20 00 00
Mar 14 09:52:15 varws03 kernel: scsi host6: uas_eh_bus_reset_handler start



Mar 14 09:52:20 varws03 kernel: xhci_hcd :00:14.0: WARN: unexpected
TRB Type 4


This shouldn't be unexpected, it's a status stage of a control transfer.

This means a control transfer was stopped at the status stage, either because
the command timed out, or URB was canceled (killed, dequeued) by class driver.

I'm guessing timeout as it's 5 seconds since last log entry.


Mar 14 09:52:20 varws03 kernel: usb 4-4: Disable of device-initiated U1
failed.
Mar 14 09:52:26 varws03 kernel: xhci_hcd :00:14.0: WARN: unexpected
TRB Type 4
Mar 14 09:52:26 varws03 kernel: usb 4-4: Disable of device-initiated U2
failed.
Mar 14 09:52:31 varws03 kernel: xhci_hcd :00:14.0: Timeout while
waiting for setup device command
Mar 14 09:52:37 varws03 kernel: xhci_hcd :00:14.0: Timeout while
waiting for setup device command
Mar 14 09:52:37 varws03 kernel: usb 4-4: device not accepting address
26, error -62  
Mar 14 09:52:42 varws03 kernel: xhci_hcd :00:14.0: Timeout while

waiting for setup device command
Mar 14 09:52:48 varws03 kernel: xhci_hcd :00:14.0: Timeout while
waiting for setup device command
Mar 14 09:52:48 varws03 kernel: usb 4-4: device not accepting address
26, error -62
Mar 14 09:52:54 varws03 kernel: xhci_hcd :00:14.0: Timeout while
waiting for setup device command
Mar 14 09:52:59 varws03 kernel: xhci_hcd :00:14.0: Timeout while
waiting for setup device command
Mar 14 09:53:00 varws03 kernel: usb 4-4: device not accepting address
26, error -62
Mar 14 09:53:05 varws03 kernel: xhci_hcd :00:14.0: Timeout while
waiting for setup device command
Mar 14 09:53:11 varws03 kernel: xhci_hcd :00:14.0: Timeout while
waiting for setup device command
Mar 14 09:53:11 varws03 kernel: usb 4-4: device not accepting address
26, error -62
Mar 14 09:53:11 varws03 kernel: scsi host6: uas_post_reset: alloc
streams error -19 after reset
Mar 14 09:53:11 varws03 kernel: usb 4-4: USB disconnect, device number 26

Is this a kernel bug? Should I report it here or at
https://bugzilla.kernel.org/ ?



here is fine, but bugzilla could be useful to keep logs and patches etc in as 
well.

Can you take logs with xhci debugging enabled? Actully both traces and debug 
messages:

before plugging in the dock:
echo -n 'module xhci_hcd =p' > /sys/kernel/debug/dynamic_debug/control
echo xhci-hcd >> /sys/kernel/debug/tracing/set_event

Then send both the output of dmesg and /sys/kernel/debug/tracing/trace

-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


[PATCH v2 12/14] usb: dwc2: simplify optional reset handling

2017-03-15 Thread Philipp Zabel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.

This allows to return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.

Signed-off-by: Philipp Zabel 
Acked-by: John Youn 
---
 drivers/usb/dwc2/platform.c | 18 --
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 9564bc76c56f3..daf0d37acb37f 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -214,20 +214,11 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
hsotg->reset = devm_reset_control_get_optional(hsotg->dev, "dwc2");
if (IS_ERR(hsotg->reset)) {
ret = PTR_ERR(hsotg->reset);
-   switch (ret) {
-   case -ENOENT:
-   case -ENOTSUPP:
-   hsotg->reset = NULL;
-   break;
-   default:
-   dev_err(hsotg->dev, "error getting reset control %d\n",
-   ret);
-   return ret;
-   }
+   dev_err(hsotg->dev, "error getting reset control %d\n", ret);
+   return ret;
}
 
-   if (hsotg->reset)
-   reset_control_deassert(hsotg->reset);
+   reset_control_deassert(hsotg->reset);
 
/* Set default UTMI width */
hsotg->phyif = GUSBCFG_PHYIF16;
@@ -326,8 +317,7 @@ static int dwc2_driver_remove(struct platform_device *dev)
if (hsotg->ll_hw_enabled)
dwc2_lowlevel_hw_disable(hsotg);
 
-   if (hsotg->reset)
-   reset_control_assert(hsotg->reset);
+   reset_control_assert(hsotg->reset);
 
return 0;
 }
-- 
2.11.0

--
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 v2 13/14] usb: host: ehci-st: simplify optional reset handling

2017-03-15 Thread Philipp Zabel
As of commit bb475230b8e5 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.

This allows to return errors from devm_reset_control_get_optional_shared
unconditionally.

Signed-off-by: Philipp Zabel 
---
 drivers/usb/host/ehci-st.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/ehci-st.c b/drivers/usb/host/ehci-st.c
index be4a2788fc582..12e803d2c98df 100644
--- a/drivers/usb/host/ehci-st.c
+++ b/drivers/usb/host/ehci-st.c
@@ -210,18 +210,14 @@ static int st_ehci_platform_probe(struct platform_device 
*dev)
devm_reset_control_get_optional_shared(>dev, "power");
if (IS_ERR(priv->pwr)) {
err = PTR_ERR(priv->pwr);
-   if (err == -EPROBE_DEFER)
-   goto err_put_clks;
-   priv->pwr = NULL;
+   goto err_put_clks;
}
 
priv->rst =
devm_reset_control_get_optional_shared(>dev, "softreset");
if (IS_ERR(priv->rst)) {
err = PTR_ERR(priv->rst);
-   if (err == -EPROBE_DEFER)
-   goto err_put_clks;
-   priv->rst = NULL;
+   goto err_put_clks;
}
 
if (pdata->power_on) {
-- 
2.11.0

--
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/1] sisusb_con: fix coccinelle warning

2017-03-15 Thread Jiri Slaby
After commit d705ff3818 (tty: vt, cleanup and document con_scroll), in
the coccinelle output, we can see:
drivers/usb/misc/sisusbvga/sisusb_con.c:852:8-9: WARNING: return of 0/1 in 
function 'sisusbcon_scroll_area' with return type bool

Return true instead of 1 in the function returning bool which was
intended to do in d705ff3818 but omitted.

Signed-off-by: Jiri Slaby 
Fixes: d705ff3818 (tty: vt, cleanup and document con_scroll)
Cc: Thomas Winischhofer 
Cc: Greg Kroah-Hartman 
Cc: linux-usb@vger.kernel.org
Cc: co...@systeme.lip6.fr
---
 drivers/usb/misc/sisusbvga/sisusb_con.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c 
b/drivers/usb/misc/sisusbvga/sisusb_con.c
index 4b5777ec1501..3c6948af726a 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -816,7 +816,7 @@ sisusbcon_scroll_area(struct vc_data *c, struct 
sisusb_usb_data *sisusb,
 
mutex_unlock(>lock);
 
-   return 1;
+   return true;
 }
 
 /* Interface routine */
-- 
2.12.0

--
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/2] usb; dwc3: of-simple: Add support to get resets for the device

2017-03-15 Thread Philipp Zabel
On Wed, 2017-02-22 at 10:54 +0530, Vivek Gautam wrote:
> Add support to get a list of resets available for the device.
> These resets must be kept de-asserted until the device is
> in use.
> 
> Cc: Felipe Balbi 
> Signed-off-by: Vivek Gautam 
> ---
> 
> Based on torvald's master branch.
> 
>  drivers/usb/dwc3/dwc3-of-simple.c | 49 
> +++
>  1 file changed, 49 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-of-simple.c 
> b/drivers/usb/dwc3/dwc3-of-simple.c
> index fe414e7a9c78..025de7342d28 100644
> --- a/drivers/usb/dwc3/dwc3-of-simple.c
> +++ b/drivers/usb/dwc3/dwc3-of-simple.c
> @@ -29,13 +29,52 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  struct dwc3_of_simple {
>   struct device   *dev;
>   struct clk  **clks;
>   int num_clocks;
> + struct reset_control**resets;
> + int num_resets;
>  };
>  
> +static int dwc3_of_simple_reset_init(struct dwc3_of_simple *simple, int 
> count)
> +{
> + struct device   *dev = simple->dev;
> + int i;
> +
> + simple->num_resets = count;
> +
> + if (!count)
> + return 0;
> +
> + simple->resets = devm_kcalloc(dev, simple->num_resets,
> + sizeof(struct reset_control *), GFP_KERNEL);
> + if (!simple->resets)
> + return -ENOMEM;
> +
> + for (i = 0; i < simple->num_resets; i++) {
> + struct reset_control *reset;
> + int ret;
> +
> + reset = devm_reset_control_get_by_index(dev, i);

Please use devm_reset_control_get_exclusive_by_index instead. See
include/linux/reset.h for details.

> + if (IS_ERR(reset))
> + return PTR_ERR(reset);
> +
> + simple->resets[i] = reset;
> +
> + ret = reset_control_deassert(reset);
> + if (ret) {
> + while (--i >= 0)
> + reset_control_assert(reset);
> + return ret;
> + }
> + }
> +
> + return 0;
> +}

This looks rather generic. Should we have a
reset_control_get/assert/deassert_array functionality at the reset API
level?

>  static int dwc3_of_simple_clk_init(struct dwc3_of_simple *simple, int count)
>  {
>   struct device   *dev = simple->dev;
> @@ -100,6 +139,10 @@ static int dwc3_of_simple_probe(struct platform_device 
> *pdev)
>   if (ret)
>   return ret;
>  
> + ret = dwc3_of_simple_reset_init(simple, of_reset_control_get_count(np));
> + if (ret)
> + return ret;
> +

Not a blocker, but it seems a bit inconsistent to count the reset
controls via the device node (of_...), but then get them via the device
(devm_reset_control_get_... instead of of_reset_control_get_...).

regards
Philipp

--
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/2] reset: Add API to count number of reset available with device

2017-03-15 Thread Philipp Zabel
Hi Vivek,

On Fri, 2017-03-10 at 20:10 +0530, Vivek Gautam wrote:
> Hi Philipp,
> 
> 
> On Wed, Feb 22, 2017 at 10:54 AM, Vivek Gautam
>  wrote:
> > Count number of reset phandles available with the device node
> > to know the resets a given device has.
> >
> > Cc: Philipp Zabel 
> > Signed-off-by: Vivek Gautam 
> > ---
> 
> Any thoughts on this change?
> A small addition that seems useful.

Sorry I missed this one earlier.

> >
> > Based on torvald's master branch.
> >
> >  include/linux/reset.h | 16 
> >  1 file changed, 16 insertions(+)
> >
> > diff --git a/include/linux/reset.h b/include/linux/reset.h
> > index 5daff15722d3..88f63a640153 100644
> > --- a/include/linux/reset.h
> > +++ b/include/linux/reset.h
> > @@ -2,6 +2,7 @@
> >  #define _LINUX_RESET_H_
> >
> >  #include 
> > +#include 
> >
> >  struct reset_control;
> >
> > @@ -234,6 +235,21 @@ static inline struct reset_control 
> > *of_reset_control_get_shared_by_index(
> >  }
> >
> >  /**
> > + * of_reset_control_get_count - Count number of resets available with a 
> > device
> > + * @node: device to be reset by the controller
> > + */
> > +static inline unsigned int of_reset_control_get_count(struct device_node 
> > *node)
> > +{
> > +   int count;
> > +
> > +   count = of_count_phandle_with_args(node, "resets", "#reset-cells");
> > +   if (count < 0)
> > +   return 0;

Please don't silently ignore errors. gpiod_count doesn't ignore errors
either. tegra_powergate_of_resets in drivers/soc/tegra/pmc.c open codes
this, too. This should be changed so it can be used there, too.

regards
Philipp

--
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/4] cdc-acm: fix possible invalid access when processing notification

2017-03-15 Thread Oliver Neukum
Am Dienstag, den 14.03.2017, 21:14 +0100 schrieb Tobias Herzog:
> Notifications may only be 8 bytes so long. Accessing the 9th and
> 10th byte of unimplemented/unknown notifications may be insecure.
> Also check the length of known notifications before accessing anything
> behind the 8th byte.
> 
> Signed-off-by: Tobias Herzog 
> ---
>  drivers/usb/class/cdc-acm.c | 11 ---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
> index 40714fe..b99127e 100644
> --- a/drivers/usb/class/cdc-acm.c
> +++ b/drivers/usb/class/cdc-acm.c
> @@ -296,6 +296,12 @@ static void acm_process_notification(struct acm *acm, 
> unsigned char *buf)
>   break;
>  
>   case USB_CDC_NOTIFY_SERIAL_STATE:
> + if (dr->wLength != 2) {

Endianness

> + dev_dbg(>control->dev,
> + "%s - malformed serial state\n", __func__);
> + break;
> + }
> +
>   newctrl = get_unaligned_le16(data);
>  
>   if (!acm->clocal && (acm->ctrlin & ~newctrl & ACM_CTRL_DCD)) {
> @@ -332,11 +338,10 @@ static void acm_process_notification(struct acm *acm, 
> unsigned char *buf)
>  
>   default:
>   dev_dbg(>control->dev,
> - "%s - unknown notification %d received: index %d "
> - "len %d data0 %d data1 %d\n",
> + "%s - unknown notification %d received: index %d len 
> %d\n",
>   __func__,
>   dr->bNotificationType, dr->wIndex,
> - dr->wLength, data[0], data[1]);
> + dr->wLength);
>   }
>  }
>  

--
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/4] cdc-acm: reassemble fragmented notifications

2017-03-15 Thread Oliver Neukum
Am Dienstag, den 14.03.2017, 21:14 +0100 schrieb Tobias Herzog:
> USB devices may have very limitited endpoint packet sizes, so that
> notifications can not be transferred within one single usb packet.
> Reassembling of multiple packages may be necessary.

Hi,

thank you for the patch. Unfortunately it has some issue.
Please see the comments inside.

Regards
Oliver

> 
> Signed-off-by: Tobias Herzog 
> ---
>  drivers/usb/class/cdc-acm.c | 102 
> +++-
>  drivers/usb/class/cdc-acm.h |   2 +
>  2 files changed, 75 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
> index e35b150..40714fe 100644
> --- a/drivers/usb/class/cdc-acm.c
> +++ b/drivers/usb/class/cdc-acm.c
> @@ -282,39 +282,13 @@ static DEVICE_ATTR(iCountryCodeRelDate, S_IRUGO, 
> show_country_rel_date, NULL);
>   * Interrupt handlers for various ACM device responses
>   */
>  
> -/* control interface reports status changes with "interrupt" transfers */
> -static void acm_ctrl_irq(struct urb *urb)
> +static void acm_process_notification(struct acm *acm, unsigned char *buf)
>  {
> - struct acm *acm = urb->context;
> - struct usb_cdc_notification *dr = urb->transfer_buffer;
> - unsigned char *data;
>   int newctrl;
>   int difference;
> - int retval;
> - int status = urb->status;
> + struct usb_cdc_notification *dr = (struct usb_cdc_notification *)buf;
> + unsigned char *data = (unsigned char *)(dr + 1);
>  
> - switch (status) {
> - case 0:
> - /* success */
> - break;
> - case -ECONNRESET:
> - case -ENOENT:
> - case -ESHUTDOWN:
> - /* this urb is terminated, clean up */
> - dev_dbg(>control->dev,
> - "%s - urb shutting down with status: %d\n",
> - __func__, status);
> - return;
> - default:
> - dev_dbg(>control->dev,
> - "%s - nonzero urb status received: %d\n",
> - __func__, status);
> - goto exit;
> - }
> -
> - usb_mark_last_busy(acm->dev);
> -
> - data = (unsigned char *)(dr + 1);
>   switch (dr->bNotificationType) {
>   case USB_CDC_NOTIFY_NETWORK_CONNECTION:
>   dev_dbg(>control->dev,
> @@ -363,8 +337,74 @@ static void acm_ctrl_irq(struct urb *urb)
>   __func__,
>   dr->bNotificationType, dr->wIndex,
>   dr->wLength, data[0], data[1]);
> + }
> +}
> +
> +/* control interface reports status changes with "interrupt" transfers */
> +static void acm_ctrl_irq(struct urb *urb)
> +{
> + struct acm *acm = urb->context;
> + struct usb_cdc_notification *dr = urb->transfer_buffer;
> + unsigned int current_size = urb->actual_length;
> + unsigned int expected_size, copy_size;
> + int retval;
> + int status = urb->status;
> +
> + switch (status) {
> + case 0:
> + /* success */
>   break;
> + case -ECONNRESET:
> + case -ENOENT:
> + case -ESHUTDOWN:
> + /* this urb is terminated, clean up */
> + kfree(acm->notification_buffer);
> + acm->notification_buffer = NULL;

Why? Disconnect() will free it anyway. It should be enough
to discard the content.

> + dev_dbg(>control->dev,
> + "%s - urb shutting down with status: %d\n",
> + __func__, status);
> + return;
> + default:
> + dev_dbg(>control->dev,
> + "%s - nonzero urb status received: %d\n",
> + __func__, status);
> + goto exit;
>   }
> +
> + usb_mark_last_busy(acm->dev);
> +
> + if (acm->notification_buffer)
> + dr = (struct usb_cdc_notification *)acm->notification_buffer;
> +
> + /* assume the first package contains at least two bytes */
> + expected_size = dr->wLength + 8;

You need the explain where you got the 8 from. In fact a define would
be best.

> +
> + if (current_size < expected_size) {
> + /* notification is transmitted framented, reassemble */

Please fix the typo.

> + if (!acm->notification_buffer) {
> + acm->notification_buffer =
> + kmalloc(expected_size, GFP_ATOMIC);

This can fail. You _must_ check for that.

> + acm->nb_index = 0;
> + }
> +
> + copy_size = min(current_size,
> + expected_size - acm->nb_index);
> +
> + memcpy(>notification_buffer[acm->nb_index],
> +urb->transfer_buffer, copy_size);
> + acm->nb_index += copy_size;
> + current_size = acm->nb_index;
> + }
> +
> + if (current_size < expected_size)
> + goto exit;

This is an unneeded goto.

> 

Re: Fwd: dwc2 and ping protocol

2017-03-15 Thread Minas Harutyunyan
Hi Nick,

In DMA mode handling NAKs internally by hardware performing starting from
core v2.71a. Before v2.71a handling NAKs should be performed by driver.
Your core is 2.65a.

Thanks,
Minas
 
On 3/11/2017 7:14 PM, Nick Hudson wrote:
> Hi,
>
> I'm using a mostly unmodified older version of the dwc2 driver in NetBSD
> taken from
>
>git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>
>
> Import latest dwc2 sources
>
> commit 192cb07f7928e8cb09a9851e6c0f7478baa3bc6d
> Author: John Youn >
> Date:   Mon Jan 11 16:32:28 2016 -0800
>
>
> and it would appear that the hardware isn't handling the device NAKs in
> DMA mode. I understand from the code that in DMA mode the NAKs should be
> handled in hardware and not generate interrupts. Is this the case?
>
>
> Any pointers?
>
>
> Thanks,
> Nick
>
>
> dwctwo0: dwc2_hc_init()
> dwctwo0: DMA enabled
> dwctwo0: desc DMA disabled
> dwctwo0: set HCINTMSK to 0006
> dwctwo0: set HAINTMSK to 0080
> dwctwo0: set GINTMSK to f3000806
> dwctwo0: set HCCHAR(7) to 00881200
> dwctwo0: dwc2_hc_init: Channel 7
> dwctwo0: Dev Addr: 2
> dwctwo0: Ep Num: 2
> dwctwo0: Is In: 0
> dwctwo0: Is Low Speed: 0
> dwctwo0: Ep Type: 2
> dwctwo0: Max Pkt: 512
> dwctwo0: Queue non-periodic transactions
> dwctwo0:   NP Tx Req Queue Space Avail (before queue): 8
> dwctwo0:   NP Tx FIFO Space Avail (before queue): 912
> dwctwo0: dwc2_hc_start_transfer()
> dwctwo0: ping, DMA
> dwctwo0: no split
> dwctwo0: Wrote 80401000 to HCTSIZ(7)
> dwctwo0: dwc2_hc_start_transfer: Channel 7
> dwctwo0: Xfer Size: 4096
> dwctwo0: Num Pkts: 8
> dwctwo0: Start PID: 0
> dwctwo0: Multi Cnt: 1
> dwctwo0: Wrote 80981200 to HCCHAR(7)
> dwctwo0: --Host Channel Interrupt--, Channel 7
> dwctwo0:   hcint 0x0012, hcintmsk 0x0002, hcint 0x0002
> dwctwo0: --Host Channel 7 Interrupt: Channel Halted--
> dwctwo0: --Host Channel 7 Interrupt: DMA Channel Halted--
> dwctwo0: --Host Channel 7 Interrupt: NAK Received--
> dwctwo0: DWC_otg: dwc2_update_urb_state_abn: OUT, channel 7
> dwctwo0:   chan->start_pkt_count 8
> dwctwo0:   hctsiz.pktcnt 8
> dwctwo0:   chan->max_packet 512
> dwctwo0:   bytes_transferred 0
> dwctwo0:   urb->actual_length 0
> dwctwo0:   urb->transfer_buffer_length 4096
> dwctwo0: dwc2_halt_channel()
> dwctwo0: DMA enabled
> dwctwo0:   dwc2_release_channel: channel 7, halt_status 4
> dwctwo0: dwc2_deactivate_qh(0x8d046808,0x8cf6bce0,0)
> dwctwo0: dwc2_hcd_qh_deactivate()
> dwctwo0: dwc2_hcd_qh_unlink()
> dwctwo0: dwc2_hcd_qh_add()
> dwctwo0: dwc2_assign_and_init_hc(0x8d046808,0x8cf6bce0)
> dwctwo0: dwc2_hc_init()
> dwctwo0: DMA enabled
> dwctwo0: desc DMA disabled
> dwctwo0: set HCINTMSK to 0006
> dwctwo0: set HAINTMSK to 0001
> dwctwo0: set GINTMSK to f3000806
> dwctwo0: set HCCHAR(0) to 00881200
> dwctwo0: dwc2_hc_init: Channel 0
> dwctwo0: Dev Addr: 2
> dwctwo0: Ep Num: 2
> dwctwo0: Is In: 0
> dwctwo0: Is Low Speed: 0
> dwctwo0: Ep Type: 2
> dwctwo0: Max Pkt: 512
> dwctwo0: Queue non-periodic transactions
> dwctwo0:   NP Tx Req Queue Space Avail (before queue): 8
> dwctwo0:   NP Tx FIFO Space Avail (before queue): 912
> dwctwo0: dwc2_hc_start_transfer()
> dwctwo0: ping, DMA
> dwctwo0: no split
> dwctwo0: Wrote 80401000 to HCTSIZ(0)
> dwctwo0: dwc2_hc_start_transfer: Channel 0
> dwctwo0: Xfer Size: 4096
> dwctwo0: Num Pkts: 8
> dwctwo0: Start PID: 0
> dwctwo0: Multi Cnt: 1
> dwctwo0: Wrote 80981200 to HCCHAR(0)
> dwctwo0: --Host Channel Interrupt--, Channel 0
> dwctwo0:   hcint 0x0012, hcintmsk 0x0002, hcint 0x0002
> dwctwo0: --Host Channel 0 Interrupt: Channel Halted--
> dwctwo0: --Host Channel 0 Interrupt: DMA Channel Halted--
> dwctwo0: --Host Channel 0 Interrupt: NAK Received--
> dwctwo0: DWC_otg: dwc2_update_urb_state_abn: OUT, channel 0
> dwctwo0:   chan->start_pkt_count 8
> dwctwo0:   hctsiz.pktcnt 8
> dwctwo0:   chan->max_packet 512
> dwctwo0:   bytes_transferred 0
> dwctwo0:   urb->actual_length 0
> dwctwo0:   urb->transfer_buffer_length 4096
> dwctwo0: dwc2_halt_channel()
> dwctwo0: DMA enabled
> dwctwo0:   dwc2_release_channel: channel 0, halt_status 4
> dwctwo0: dwc2_deactivate_qh(0x8d046808,0x8cf6bce0,0)
> dwctwo0: dwc2_hcd_qh_deactivate()
> dwctwo0: dwc2_hcd_qh_unlink()
> dwctwo0: dwc2_hcd_qh_add()
> dwctwo0: dwc2_assign_and_init_hc(0x8d046808,0x8cf6bce0)
> dwctwo0: dwc2_hc_init()
>
>
>
>
>

--
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: [RESEND PATCH v3 2/2] phy: Group vendor specific phy drivers

2017-03-15 Thread Heiko Stübner
Am Dienstag, 14. März 2017, 11:52:50 CET schrieb Vivek Gautam:
> Adding vendor specific directories in phy to group
> phy drivers under their respective vendor umbrella.
> 
> Also updated the MAINTAINERS file to reflect the correct
> directory structure for phy drivers.
> 
> Signed-off-by: Vivek Gautam 
> Acked-by: Heiko Stuebner 
> Acked-by: Viresh Kumar 
> Cc: Kishon Vijay Abraham I 
> Cc: David S. Miller 
> Cc: Geert Uytterhoeven 
> Cc: Yoshihiro Shimoda 
> Cc: Guenter Roeck 
> Cc: Heiko Stuebner 
> Cc: Viresh Kumar 
> Cc: Maxime Ripard 
> Cc: Chen-Yu Tsai 
> Cc: Sylwester Nawrocki 
> Cc: Krzysztof Kozlowski 
> Cc: Jaehoon Chung 
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-arm-...@vger.kernel.org
> Cc: linux-ker...@vger.kernel.org
> Cc: linux-o...@vger.kernel.org
> Cc: linux-renesas-...@vger.kernel.org
> Cc: linux-rockc...@lists.infradead.org
> Cc: linux-samsung-...@vger.kernel.org
> Cc: linux-usb@vger.kernel.org
> ---
> 
> Corrected Krzysztof's email-id. Added linux-arm-msm.
> 
> Hi Heiko, Viresh,
> It's been a year since the last version of this patch was posted.
> Kishon has agreed to pull this change now. I am carrying forward
> your Acks since there are no functional changes.
> I have taken care of the drivers that were added/removed since
> the last version.
> Please feel free to jump in if you have any concerns.

still looks all good and I gave that a try on 4.11-rc2 yesterday as well.


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