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]
Message-ID: <CAPTae5J2K_=VaL2mQOZxBgaSEGDavW=Rm8XNNDM4n=JPgqbjaw@mail.gmail.com>
Date:   Tue, 13 Apr 2021 17:59:52 -0700
From:   Badhri Jagan Sridharan <badhri@...gle.com>
To:     Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc:     Guenter Roeck <linux@...ck-us.net>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Rob Herring <robh+dt@...nel.org>,
        Adam Thomson <Adam.Thomson.Opensource@...semi.com>,
        USB <linux-usb@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>, Kyle Tso <kyletso@...gle.com>
Subject: Re: [PATCH v2 5/6] usb: typec: tcpm: Allow slow charging loops to
 comply to pSnkStby

On Thu, Apr 8, 2021 at 1:22 AM Heikki Krogerus
<heikki.krogerus@...ux.intel.com> wrote:
>
> > > @@ -4047,9 +4053,12 @@ static void run_state_machine(struct tcpm_port *port)
> > >             break;
> > >     case SNK_DISCOVERY:
> > >             if (port->vbus_present) {
> > > -                   tcpm_set_current_limit(port,
> > > -                                          tcpm_get_current_limit(port),
> > > -                                          5000);
> > > +                   u32 current_lim = (!port->slow_charger_loop ||
> > > +                                      (tcpm_get_current_limit(port) <=
> > > +                                       PD_P_SNK_STDBY_MW / 5)) ?
> > > +                           tcpm_get_current_limit(port) :
> > > +                           PD_P_SNK_STDBY_MW / 5;
> >
> > Here the use of the ternary operator is not appropriate. Please try to
> > clean that up somehow. Maybe something like this would be better?
> >
> >                         u32 current_lim = tcpm_get_current_limit(port);
> >
> >                       if (port->slow_charger_loop || (current_lim < PD_P_SNK_STDBY_MW / 5))
> >                               current_lim = PD_P_SNK_STDBY_MW / 5;
>
> Sorry, I mean:
>
>                         if (port->slow_charger_loop || (current_lim > PD_P_SNK_STDBY_MW / 5))
>                                 current_lim = PD_P_SNK_STDBY_MW / 5;

Ack. Updating in my next version: V3.

Thanks,
Badhri

>
> thanks,
>
> --
> heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ