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: <20190214143020.GA1317@kroah.com>
Date:   Thu, 14 Feb 2019 15:30:20 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Adam Thomson <Adam.Thomson.Opensource@...semi.com>
Cc:     Guenter Roeck <linux@...ck-us.net>, Kyle Tso <kyletso@...gle.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Badhri Jagan Sridharan <badhri@...gle.com>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: typec: tcpm: Export partner Source Capabilities

On Thu, Feb 14, 2019 at 02:17:14PM +0000, Adam Thomson wrote:
> On 12 February 2019 16:20, Guenter Roeck wrote:
> 
> > On 2/12/19 2:54 AM, Greg KH wrote:
> > > On Tue, Feb 12, 2019 at 06:29:39PM +0800, Kyle Tso wrote:
> > >> On Thu, Jan 31, 2019 at 3:02 PM Greg KH <gregkh@...uxfoundation.org>
> > wrote:
> > >>
> > >>> On Thu, Jan 31, 2019 at 11:54:11AM +0800, Kyle Tso wrote:
> > >>>> Provide a function to get the partner Source Capabilities.
> > >>>>
> > >>>> Signed-off-by: Kyle Tso <kyletso@...gle.com>
> > >>>> ---
> > >>>>   drivers/usb/typec/tcpm/tcpm.c | 23 +++++++++++++++++++++++
> > >>>>   include/linux/usb/tcpm.h      |  1 +
> > >>>>   2 files changed, 24 insertions(+)
> > >>>>
> > >>>> diff --git a/drivers/usb/typec/tcpm/tcpm.c
> > >>> b/drivers/usb/typec/tcpm/tcpm.c
> > >>>> index f1d3e54210df..29cd84ba9960 100644
> > >>>> --- a/drivers/usb/typec/tcpm/tcpm.c
> > >>>> +++ b/drivers/usb/typec/tcpm/tcpm.c
> > >>>> @@ -4494,6 +4494,29 @@ int tcpm_update_sink_capabilities(struct
> > >>> tcpm_port *port, const u32 *pdo,
> > >>>>   }
> > >>>>   EXPORT_SYMBOL_GPL(tcpm_update_sink_capabilities);
> > >>>>
> > >>>> +/*
> > >>>> + * Don't call this function in interrupt context. Caller needs to
> > >>>> +free
> > >>> the
> > >>>> + * memory itself.
> > >>>> + */
> > >>>> +int tcpm_get_partner_src_caps(struct tcpm_port *port, u32
> > >>>> +**src_pdo) {
> > >>>> +     unsigned int nr_pdo;
> > >>>> +
> > >>>> +     if (port->nr_source_caps == 0)
> > >>>> +             return -ENODATA;
> > >>>> +
> > >>>> +     *src_pdo = kcalloc(port->nr_source_caps, sizeof(u32), GFP_KERNEL);
> > >>>> +     if (!src_pdo)
> > >>>> +             return -ENOMEM;
> > >>>> +
> > >>>> +     mutex_lock(&port->lock);
> > >>>> +     nr_pdo = tcpm_copy_pdos(*src_pdo, port->source_caps,
> > >>>> +                             port->nr_source_caps);
> > >>>> +     mutex_unlock(&port->lock);
> > >>>> +     return nr_pdo;
> > >>>> +}
> > >>>> +EXPORT_SYMBOL_GPL(tcpm_get_partner_src_caps);
> > >>>
> > >>> We don't add new functions that no one uses :(
> > >>>
> > >>>
> > >> This function is useful if the PD Device Policy Manager is
> > >> implemented outside of TCPM.
> > >> In this situation, Device Policy Manager needs to know the partner
> > >> capabilities to optimize the charging process.
> > >
> > > And where is that code?
> > >
> > 
> > Agreed - that code should be sent upstream as well to let us see the entire
> > context.
> > 
> > >> Take existing functions in TCPM for example:
> > >> Function "tcpm_update_sink_capabilities" and
> > >> "tcpm_update_source_capabilities" are exposed as well. And no one
> > >> uses them now.
> > >
> > > Great, let's go delete them now, we should not have apis that no one
> > > uses.  This isn't a new thing...
> > >
> > 
> > I sent a patch to do just that. Quite frankly I don't recal why I thought those
> > functions might be needed.
> 
> As a mind jog - https://lkml.org/lkml/2017/11/27/1256 :)

Nice find :)

Given that no one used these functions in over a year, we should be safe
deleting them.  If not, it's trivial to do 'git revert'.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ