Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp122370imj; Thu, 14 Feb 2019 16:47:13 -0800 (PST) X-Google-Smtp-Source: AHgI3IZMensmKg1D+NY7t10v63AKpQH6epUe/L2K3eg+IzCFnZ8dLtQl7Jyn36DNQEdiVmk7tkl7 X-Received: by 2002:a63:1204:: with SMTP id h4mr6532404pgl.51.1550191633774; Thu, 14 Feb 2019 16:47:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550191633; cv=none; d=google.com; s=arc-20160816; b=V4WODFzRuHfJOEcSZ2NNjV1fFjxTwC/Fyub1iOGpSQZQNtYR6xE6hqg+iTuxElwoMa FwuTCQB1zEKKIqzzNVA8ilRLqojs6qExhDVKgEN6qgbkunphFDpOiPgPotahH6OMxaTS xP5pk4THIzsUHCxqYy5xZxBLqYkAWs+RKcNeKYGgeDZPk7Y7qrvYE4vIVkqvr+aJe6MD EmDiX/qzL3mo9cSKUylvPdOixq5V6vCkddvkvN3ETq9WvJIFrI3P7OillvIM/ydG3cp0 nnh2pxuDrCeAHNdmHGN+nXZPVNx6yXptwO1q06DR4+5kC0GY5v7F+3VZM+mRIB3rRcPd vqjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=4e+I/N5xnSLSl/AvDPObl+O0qRqicCCVD5bElAjTrUA=; b=CnH8s3QoO0jeIUMA7hWIy/ieKwsf8i21R9hfs5euut9u1Q8fwBDzle4Bljhp2JoWhN bTRukQPM9kz4H+1aK2pD1J+ypyaRHPhmi3PYuPs8KgbT9PraPjpH/J2aZs/wBCFW3hwG HDRBBbqDGSS+VX+zhuzBvOZaC/Ni0RMKEJ9iJPNZxiuwZPlL/sJk+KQ8fv75upc5o1wv knU+SS4tENHp65bUpQx9FCF2Y6ft1sTm1bSA+4nWGthgIXNVPkQanN5EKQ57IewjWhyo KRpTxEMl6sUSj/AayMiHLzMSgnrikzv7KxAt167cbYreyUvJlYxQV6t3jj5XdRNXxvM6 SJHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dialogsemiconductor.onmicrosoft.com header.s=selector1-diasemi-com header.b=QIQ6ZVzR; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=diasemi.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o9si3947147pfe.63.2019.02.14.16.46.58; Thu, 14 Feb 2019 16:47: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=@dialogsemiconductor.onmicrosoft.com header.s=selector1-diasemi-com header.b=QIQ6ZVzR; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=diasemi.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502089AbfBNP3A (ORCPT + 99 others); Thu, 14 Feb 2019 10:29:00 -0500 Received: from mail1.bemta26.messagelabs.com ([85.158.142.4]:53748 "EHLO mail1.bemta26.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726906AbfBNP27 (ORCPT ); Thu, 14 Feb 2019 10:28:59 -0500 Received: from [85.158.142.98] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-4.bemta.az-a.eu-central-1.aws.symcld.net id B4/25-13147-639856C5; Thu, 14 Feb 2019 15:28:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA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zesIqwGThuHW6zcb6FMvonnAwAA X-Env-Sender: Adam.Thomson.Opensource@diasemi.com X-Msg-Ref: server-33.tower-223.messagelabs.com!1550158133!1195723!1 X-Originating-IP: [104.47.6.51] X-SYMC-ESS-Client-Auth: mailfrom-relay-check=pass X-StarScan-Received: X-StarScan-Version: 9.31.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16393 invoked from network); 14 Feb 2019 15:28:53 -0000 Received: from mail-ve1eur02lp2051.outbound.protection.outlook.com (HELO EUR02-VE1-obe.outbound.protection.outlook.com) (104.47.6.51) by server-33.tower-223.messagelabs.com with AES256-GCM-SHA384 encrypted SMTP; 14 Feb 2019 15:28:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dialogsemiconductor.onmicrosoft.com; s=selector1-diasemi-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4e+I/N5xnSLSl/AvDPObl+O0qRqicCCVD5bElAjTrUA=; b=QIQ6ZVzRfWBpLucuC0MKpSeMadlR8FtfmO400jT0fasr1oXgfAb0UOipe/kKh+qYzsdMrLMxiXr7o3CxU5drT2CzCpx45gcUschjc26rkI4tnANAfcmn6MjzO67O/cmhBNuq6sYO0FjbSmhV9Qafzp9F0KRBylj8x24lV+BQRa4= Received: from AM5PR1001MB0994.EURPRD10.PROD.OUTLOOK.COM (10.169.154.17) by AM5PR1001MB1204.EURPRD10.PROD.OUTLOOK.COM (10.169.155.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.18; Thu, 14 Feb 2019 15:28:33 +0000 Received: from AM5PR1001MB0994.EURPRD10.PROD.OUTLOOK.COM ([fe80::10f2:a1bd:4f0d:f118]) by AM5PR1001MB0994.EURPRD10.PROD.OUTLOOK.COM ([fe80::10f2:a1bd:4f0d:f118%8]) with mapi id 15.20.1601.023; Thu, 14 Feb 2019 15:28:33 +0000 From: Adam Thomson To: Greg KH , 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 Thread-Topic: [PATCH] usb: typec: tcpm: Export partner Source Capabilities Thread-Index: AQHUuRincvQr57cnO02hlC0TTWv4QKXI87UAgBMc1ciAAFraAIADAWPwgAAEpwCAAA/60A== Date: Thu, 14 Feb 2019 15:28:32 +0000 Message-ID: References: <20190131035411.53576-1-kyletso@google.com> <20190131070238.GA4500@kroah.com> <20190212105421.GA23271@kroah.com> <20190214143020.GA1317@kroah.com> In-Reply-To: <20190214143020.GA1317@kroah.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.225.80.228] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 34008633-5fce-4e08-79de-08d692911470 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:AM5PR1001MB1204; x-ms-traffictypediagnostic: AM5PR1001MB1204: x-ms-exchange-sharedmailbox-routingagent-processed: True x-ms-exchange-purlcount: 1 x-microsoft-exchange-diagnostics: =?us-ascii?Q?1;AM5PR1001MB1204;23:6vTRzKbI4rE/58BuDCV5UWHIoN0EkLdDTzTjLPN?= =?us-ascii?Q?jq96fZn1hzDBv7QROZajB6t+HB1joOdlkIDV+Ad6e9cI8JsngLD/4DrOqLGp?= =?us-ascii?Q?GIrQEfaKqbW+pYgQcO4xdP7WfSyTcaAhaT0saChMbAJ/cvheY7bYvW/Qd3KU?= =?us-ascii?Q?9/u/jcrkjrckFZGPG1UvzCe4QyVyNgc1ZiuEZ1JM/H4p0T7jns+hnTkiV+e5?= =?us-ascii?Q?nwVLozP/LvqZ9lyGX5kMgkT8MKAdLE89JEUFiI0sI8OxA5i0uKjAOZCVYW6g?= =?us-ascii?Q?MCjwZN+ffPzoSKDppyl2CgbnlEsP0C/wdH9ZpKKIysU3SFmG7moN+XawNmAO?= =?us-ascii?Q?HEd/+v7qC2cY/rI/DtoYHzUrfy5RkYXsniFlkknRKiUE6rM1GkV7UrjMgPLU?= =?us-ascii?Q?nxDOKVHDI5HaAp5s/eoRY/APg29S0x/7F7RmJXeLl6m3dsp20be6ptT10p7n?= =?us-ascii?Q?o6NNXAi/iihh+ojGi6y7NuDzLvSf+OfJArL11ohvPkaU/l26XZLeD0q0qaTL?= =?us-ascii?Q?etoABVLRJOlMF7eKD9fhD+glgJVe5a5jpVcpTd3osneIp7vdiNO5lszGv3vh?= =?us-ascii?Q?6jwQZRACBeSkgADv//AG+RTYugkUxNuyaL+04GaGC436r1m1NFVnOh0YgWyu?= =?us-ascii?Q?LdMSyKggBPyl2/+jN80nFXKJw8YUQaed5qDcoolAr1rqxzEbXR9blUM2TRVZ?= =?us-ascii?Q?nBoZeuYpAEqTlizM4jU8sNzsjD5i2bLyNdigoB6XyfR63efsJkSEjlr49K/f?= =?us-ascii?Q?GeQJqo3Zw1InaMZXXmdgcYjibIEle24XpqIiN6emLD7kvA0HA0uCL2INizRL?= =?us-ascii?Q?AkPHO/0M6oJDpi2unYj/WVx4TctC3zH7O4diOu6bG30zOvpypxaVnatDr6se?= =?us-ascii?Q?owMcJIUtdRfIjXAVl7sALL3Bf5rnpORYdxtzqk8+afSuSWIUQVxhFTogWgKW?= =?us-ascii?Q?thspc7XKFZ3pgUaohSnkJSEBO56GnRwPrIhYuNPk5WtSMsdmh6vKyZiOPtqp?= =?us-ascii?Q?r1aEFhyJWtvjrBAsNYwujbZRGIxhL1WG3JczPqI77EcJc+pu/u74QMvE9opr?= =?us-ascii?Q?21+RNbVKYMzlKzyy+zFPdMAh7nhO6mkRj/ieFKVy0bvM4r5PshypYl5jHID/?= =?us-ascii?Q?sHfKG+RTjY6kXh0TfrY1+I94P5RYDrJaxE9ic4dUxKFoIJembnPg3bLwSVbZ?= =?us-ascii?Q?ZGedFhFKRhi6PK+r4SyOMEUtqmtMVLLE/Ne2SSamSi39Dd0/BC9Uw+9nWoVf?= =?us-ascii?Q?yu17zMoOcKUIfb/S35NvP+9rRPDC4wNHVS/J61YcZAg+1UcujHfhE7SwJi7P?= =?us-ascii?Q?7RA0dMGMPPn/WbqRdmIoA+DU=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09480768F8 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(376002)(366004)(346002)(396003)(136003)(189003)(199004)(7736002)(68736007)(305945005)(14444005)(55236004)(71200400001)(71190400001)(93886005)(66066001)(2906002)(97736004)(74316002)(6116002)(256004)(486006)(8676002)(86362001)(3846002)(8936002)(102836004)(110136005)(186003)(316002)(26005)(106356001)(9686003)(105586002)(55016002)(54906003)(81166006)(81156014)(446003)(11346002)(476003)(7696005)(76176011)(6506007)(53546011)(99286004)(4326008)(53936002)(6246003)(966005)(229853002)(72206003)(33656002)(478600001)(6306002)(6436002)(14454004)(25786009);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR1001MB1204;H:AM5PR1001MB0994.EURPRD10.PROD.OUTLOOK.COM;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:0; received-spf: None (protection.outlook.com: diasemi.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: rTHr1Ze++Mgiu+Um0ZHs+95KUd+wlBAJ7tZgMJCQe8d8F4D0OHCfhZ/6FoBz6QHPfTGYOO3nO2Q6nROCPGJDrGM357Fp+8ABTToYJ2R3t2eXbTvkd1CDhuS4KISp0YcQs9vKBtZxAjiqlauCm6FBs0IdXC04P5uKnfbEVTN1knBXevWLzBzrcu1jQVLcE40/My9TMWDctW+xkDTJdyrmtJJ0DCzlQiVKD9dCAFDKDYoraz0JvoGLG2oETktIdB3CIdIoh1nbkNAAU19Uqh1LB3GQnVtZXTCxfn0LsVXPv1gMGNx90WWP8NrZznugeBmZ0XLm7BtQl8Ha/IFoo95BxXKn8vJTFFexvCxEZiKDPvdyfVEzhF8wd1ORAcjVvWGgQpOqvmU4+bOaZPv/s88a/EtFZFFOHnug2pT3CJ2S8ew= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: diasemi.com X-MS-Exchange-CrossTenant-Network-Message-Id: 34008633-5fce-4e08-79de-08d692911470 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Feb 2019 15:28:32.9822 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 511e3c0e-ee96-486e-a2ec-e272ffa37b7c X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR1001MB1204 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14 February 2019 14:30, Greg KH wrote: > 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 =3D=3D 0) > > > >>>> + return -ENODATA; > > > >>>> + > > > >>>> + *src_pdo =3D kcalloc(port->nr_source_caps, sizeof(u32), > GFP_KERNEL); > > > >>>> + if (!src_pdo) > > > >>>> + return -ENOMEM; > > > >>>> + > > > >>>> + mutex_lock(&port->lock); > > > >>>> + nr_pdo =3D 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 :) >=20 > Nice find :) >=20 > 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'. Yep, agreed.