Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp92288imj; Thu, 14 Feb 2019 16:03:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IaV+zIL/+ESXEiJGixXushGOeIa3Fq2nnHeX9RR+sQIDJfGo57qH914/iMKVM4SxgH/e4kt X-Received: by 2002:a17:902:29ab:: with SMTP id h40mr7054257plb.238.1550189014478; Thu, 14 Feb 2019 16:03:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550189014; cv=none; d=google.com; s=arc-20160816; b=EWR7q9G1oD6thCNlx7nlar4eoAlVXdBR7O+FMSXiIPFTTbKuADzpAutYPp/wcv2S6q xt+HQF8S9+FyOhxEu8pGoUeJKojGlK6f6M0whABzyo8/DXmd43tNxKkn/GsO+uhJXHD6 0RlCgOM0xQmIZJ94ysv/rNlhVcSeURFp0pzlH1PK1u0Aj2VoM3JUbKciZgfyAa7kf9cm L/afAGRyPcc8dGmsXawsxHJ/be4+Sdj2CAYmxJbL0dIWIUM1XhWmJEjVFHR/glXFtllC WmG8YVyER/dCIzDCm1PO0nCzUIsG576Q15cAoejZx9HlCvgCwcriVYeRayRGlOYk237c i6oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cFnMdsbINx4+ZmkOJ6d0rz+t+m/b2dNEf+sX9vBS89I=; b=bWio6aIS+MtH/UXgrcTcqx4gM5zdbFhZRjs+WsYPS5YbO9i5Fq9G83kGzr5Kf4TdZ8 1Sxh+2iJ42ea1vhYZUZpMB7Zfvk9KEMgnf4X/4gp73DKwMWgEGlZ/dA/a/jTgP5gwkA9 Q4LDJHQXm8i5VCfQ4QW24DW8f4K1ezQiTM+CteYbAK/kdwm1B5xjR34MLzo6jkYyIRae v4eVhZB2M5mw31HSW6bTUhYSSC/lQ4MCD01DN9xiWiofVvMhIPwsQKhM89TZZ5XUyt3X K02YKSWCjzfJ5TY1yXGthCvZbfRS0vbUFNHwUlEBFR1KRkLTbVl+YlVr6H77pVnUzAAC Hviw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q9D9onDn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n66si3835662pfg.249.2019.02.14.16.03.17; Thu, 14 Feb 2019 16:03:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q9D9onDn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394792AbfBNOaY (ORCPT + 99 others); Thu, 14 Feb 2019 09:30:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:55502 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387633AbfBNOaY (ORCPT ); Thu, 14 Feb 2019 09:30:24 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6E7F9222D7; Thu, 14 Feb 2019 14:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550154622; bh=IMMRQYO4G34EAT3MtGVyI8hF/noM/dk4PKXu4E3lHg8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q9D9onDnJIm/9Xs5Rq68/aRjvh+UsG6Ytv/ReeYBLsVPeVcO8BluWhFN9o6VkvJKz /eti2nRIR4S/dAZJydYprK1qo2afCV+/fpmB5+aVIyDW+6bckc9KcS/RK41zJKNrgS pllrrq6nye4m6UuRSbxLpUzVjEKB8RKz9W7sO8AA= Date: Thu, 14 Feb 2019 15:30:20 +0100 From: Greg KH To: Adam Thomson Cc: Guenter Roeck , Kyle Tso , Heikki Krogerus , Badhri Jagan Sridharan , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] usb: typec: tcpm: Export partner Source Capabilities Message-ID: <20190214143020.GA1317@kroah.com> References: <20190131035411.53576-1-kyletso@google.com> <20190131070238.GA4500@kroah.com> <20190212105421.GA23271@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > 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 > > >>>> --- > > >>>> 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