Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6785685imu; Wed, 30 Jan 2019 23:03:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN5HM9aylyVIhrJWdIH3hcURPLAGGdLWurXbZ2DjMUz30JOh5j6OW1p+2w2NeIfkdrMbvV1f X-Received: by 2002:a63:194f:: with SMTP id 15mr24088293pgz.192.1548918193455; Wed, 30 Jan 2019 23:03:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548918193; cv=none; d=google.com; s=arc-20160816; b=yTCNIbKHcz+pPOfInnZOmdWAUqH+tQCKFhjOsVRhWfOyDk5IRQh5Hrr+vgF77RBKJ9 lF6N/q1SOgzsxq0AARtjJ7uMz0j0dAwrO1eornFeNyxzvMccnZ4L/041Lx0qG3pVSWu5 uBj+3aK0aqdl0BVNIG1P2J0X2BSFp9v0yMwICFI2s+WQ7cGPryq29tgbQG6XcQNuZWEo kHAGB5LKcPBbWI/ulwhS5daOMdMquwFBQS44R/y639uayIKTh1TSu46ZG0DjXIjkeTzT dkpbXXExu+fsp0ytB8MnVJ1VcHsDH3lIMmZ4fkYNp6MqupV7Xyg5ftkjuMjmb+muawSm dk/Q== 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=fP9mUoZ3ra5LKVz9gE3haOieG0L+JKV8lZxJYJvqAeo=; b=arid6YlnAcPg3eyNff4F3vEZg7IxDAyQ4kE7KBzhGn8E1V+TO3ncj0jCOmpiKpF83t 9pcVPbCz9UROWKQ+/AY3ox1VezbD74kPI1/ksFUYzFEQBysbmPGtBtw/7NCIfFWqknvT OdbFOfqK1i/6ssxGmmz9DvZDJpvDV92svAju3pse83i+VlUpEMFAKfncTdhLL8r0nO0Z 4V0+7ggbMEdI6NcMJ3UUfk60O0G7TUPB4e1SJUiqJI9ygVLE1S9LCIdZ7EGfhJIpnnPt iN5wAEc0EtEeRNH84ZF6cU1A0uJfjU9Mu2QOSCA4nfWEvcE69i4SbLFyWMJAUQWtHGi7 AeQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sKAzRSL+; 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 cd16si4352739plb.47.2019.01.30.23.02.57; Wed, 30 Jan 2019 23:03:13 -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=sKAzRSL+; 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 S1730642AbfAaHCl (ORCPT + 99 others); Thu, 31 Jan 2019 02:02:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:60074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725963AbfAaHCl (ORCPT ); Thu, 31 Jan 2019 02:02:41 -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 30D6720870; Thu, 31 Jan 2019 07:02:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548918160; bh=oOZPwLpazFHRy4sVXAKRn8VXU+7Uo0WOpyJjIZQ57VY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sKAzRSL+EthGoxS+wA0bv/Bk60/kOgQbWy/1jzY/+dln73UQNZU7jTmO/i4z4cWYx QuSBnqHU+tJRXf7pmMv8V1VqFK+iE+i/V2MPGhEwNJhtoLNGetgEG+YmGBSPbEh63h hwvHzsQTnwl/7VQIS9fiJsWEtLrtsQotrrdYbpqY= Date: Thu, 31 Jan 2019 08:02:38 +0100 From: Greg KH To: Kyle Tso Cc: linux@roeck-us.net, heikki.krogerus@linux.intel.com, badhri@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: typec: tcpm: Export partner Source Capabilities Message-ID: <20190131070238.GA4500@kroah.com> References: <20190131035411.53576-1-kyletso@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190131035411.53576-1-kyletso@google.com> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 :(