On 08/22/2014 08:53 PM, Sergei Shtylyov wrote:

This patch modify the generic code handling PHYs to allow them to be
supplied from the drivers. This adds checks to ensure no PHY was already
there when looking for one in the generic code. This also makes sure we
do not modify its state in the generic HCD functions, it was provided by
the driver.

Signed-off-by: Antoine Ténart <antoine.ten...@free-electrons.com>
Acked-by: Alan Stern <st...@rowland.harvard.edu>
---
  drivers/usb/core/hcd.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 6619239baf6d..dc0e46e5e618 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
[...]
@@ -2666,6 +2666,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
                  goto err_phy;
              }
              hcd->phy = phy;
+            hcd->remove_phy = 1;
          }
      }

@@ -2812,7 +2813,7 @@ err_allocate_root_hub:
  err_register_bus:
      hcd_buffer_destroy(hcd);
  err_create_buf:
-    if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->phy) {
+    if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) {

    The 'hcd->phy' check seems redundant now.

   Oh, sorry, I forgot about USB PHY which also sets this flag.

WBR, Segei

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

Reply via email to