lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 15 Oct 2019 12:10:22 -0700
From:   John Stultz <john.stultz@...aro.org>
To:     Roger Quadros <rogerq@...com>
Cc:     lkml <linux-kernel@...r.kernel.org>, Yu Chen <chenyu56@...wei.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        Chunfeng Yun <chunfeng.yun@...iatek.com>,
        Felipe Balbi <balbi@...nel.org>,
        Hans de Goede <hdegoede@...hat.com>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        Jun Li <lijun.kernel@...il.com>,
        Valentin Schneider <valentin.schneider@....com>,
        Linux USB List <linux-usb@...r.kernel.org>,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>
Subject: Re: [RFC][PATCH 3/3] usb: dwc3: Registering a role switch in the DRD code.

On Tue, Oct 15, 2019 at 1:25 AM Roger Quadros <rogerq@...com> wrote:
> On 03/10/2019 02:16, John Stultz wrote:
> > @@ -487,7 +539,28 @@ int dwc3_drd_init(struct dwc3 *dwc)
> >       if (IS_ERR(dwc->edev))
> >               return PTR_ERR(dwc->edev);
> >
> > -     if (dwc->edev) {
> > +     if (device_property_read_bool(dwc->dev, "usb-role-switch")) {
>
> I think we should use role switch unconditionally and get rid of the
> debugfs role status/change mechanism.
>
> > +             struct usb_role_switch_desc dwc3_role_switch = {0};
> > +             u32 mode;
> > +
> > +             if (device_property_read_bool(dwc->dev,
> > +                                           "role-switch-default-host")) {
> > +                     dwc->role_switch_default_mode = USB_DR_MODE_HOST;
> > +                     mode = DWC3_GCTL_PRTCAP_HOST;
> > +             } else {
> > +                     dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL;
> > +                     mode = DWC3_GCTL_PRTCAP_DEVICE;
> > +             }
> > +             dwc3_role_switch.fwnode = dev_fwnode(dwc->dev);
> > +             dwc3_role_switch.set = dwc3_usb_role_switch_set;
> > +             dwc3_role_switch.get = dwc3_usb_role_switch_get;
> > +             dwc->role_sw = usb_role_switch_register(dwc->dev,
> > +                                                     &dwc3_role_switch);
> > +             if (IS_ERR(dwc->role_sw))
> > +                     return PTR_ERR(dwc->role_sw);
> > +
> > +             dwc3_set_mode(dwc, mode);
> > +     } else if (dwc->edev) {
>
> Role switch should exist regardless if dwc->edev is present or not.

Does that risk duplicative mode sets when things change (via the
dwc3_drd_notifier and dwc3_usb_role_switch_set calls?).

thanks
-john

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ