Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp573137ybv; Thu, 13 Feb 2020 05:56:55 -0800 (PST) X-Google-Smtp-Source: APXvYqz0EfD14q/Yd0Uq9Ajd6QOtghtoMeuTJSnu1yUhfzOgoLPC2Ihla50WdDf/04LRky8HxU09 X-Received: by 2002:a9d:6b17:: with SMTP id g23mr13709290otp.139.1581602215556; Thu, 13 Feb 2020 05:56:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581602215; cv=none; d=google.com; s=arc-20160816; b=CuaHDAJ6lY4LbOMwv7gL2pJNDSKreAVdXdUTQqXJelbDgdzK3pZ76TbiYC6h3IQ9VK kiFpt4WNAtwONv+yx9BAuSygt7BhEbACq2rEq7BIfDhTxh9kxm3ALlsX+60cUQIVBekX wnvfkA3rYHgraQ/aI39BafOVED6ejUbEGFWXJlZqybBcB/ZCiqAiIMekZyGZq9hqrfl6 aN9vgZxG7jXgdHC5CaaDLNKQ+ejZXNWYmw5/bF+w4eKhNCz48l5PDY/p6LdX5nwrJaG5 i4n86+1vVwjG5RjAYGk6UCMPoSsgjuUiHLFQFtdCLXoB4Sj/7VvMoVdeiEy9Vuut86br CtmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=YJPJ2VtB5Pf6F+A52rBi6qL7Kcr6n5x21hJ8PjtmHNA=; b=UTcgFQYXsfuzUrNfIJLb3oTXzW2VQcC4N8yU2o7Eer1Q4NXwARw2Yexg3Bp76SgFLd 9ZQ7NB3xR5NmBJeKN1BLFzSFkzgTImXQFDxITxvo0CNW2/E4MS94bGEdOGCXQ9MNNVP1 zjldyT+fxXyPcyGOjvJlv+lFBHjk2PfxDyAU2OwlTS98+qLU/xopYxwzXuTQdXJ8N069 fOAfDts4XDCG1h3re/cblJtJyJXtJWxQ6xr35vDoP+hYf4AWWr5Yc+F5fr4ZH/in6PVO fsHMKYWFYiSfVtlKDn9EFAUj+RbRamt4kSCWjqbqC90/AH/5C0ZKlXfcS1t6UBRK9CUj LpgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=Uz9Sd+XZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13si1211067oiw.106.2020.02.13.05.56.43; Thu, 13 Feb 2020 05:56:55 -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=@st.com header.s=STMicroelectronics header.b=Uz9Sd+XZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730078AbgBMN4Z (ORCPT + 99 others); Thu, 13 Feb 2020 08:56:25 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:62366 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729971AbgBMN4Z (ORCPT ); Thu, 13 Feb 2020 08:56:25 -0500 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01DDmnk7003299; Thu, 13 Feb 2020 14:56:19 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=STMicroelectronics; bh=YJPJ2VtB5Pf6F+A52rBi6qL7Kcr6n5x21hJ8PjtmHNA=; b=Uz9Sd+XZF94QJ2oVs5YxjmqhBWrHfugXDGOU5B66/3I/Cjd4DnCCWhoqIL8fpRYgD/ZG JEwWTDwANHfm9pbndKgDhMmi32TMd27o+yNG3Unts0S9/cmFDRnXkR08syaI+EqQBNeQ Zb3+6w7SEUyYafT1wrdx8E1Pl3FKpS9yCzY+TfXCtpQmx5Ux6TUIHv9+dkpXBzQgEMNJ +AyLlz/Ae1hoZw6N4fH2OEn6AO3D3Nt//X6zA3Mwe82Qe/eabpkzTxOiYcKFSSvOhsC4 DQRz6f9+WHg89wKUpWDvNf41O+IgK2MJPzUN/R9nA2FXxGDjk07gwVahUvTc7mJotKm3 5Q== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2y1ufhnkex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Feb 2020 14:56:19 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id F324E10003B; Thu, 13 Feb 2020 14:56:11 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id E52982B8517; Thu, 13 Feb 2020 14:56:11 +0100 (CET) Received: from lmecxl0889.lme.st.com (10.75.127.45) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 13 Feb 2020 14:56:11 +0100 Subject: Re: [PATCH 1/1] rpmsg: core: Add wildcard match for name service To: Mathieu Poirier , , CC: , , , , , References: <20200212211251.32091-1-mathieu.poirier@linaro.org> <20200212211251.32091-2-mathieu.poirier@linaro.org> From: Arnaud POULIQUEN Message-ID: <034dcb0b-e305-aab9-f52b-5f725856480f@st.com> Date: Thu, 13 Feb 2020 14:56:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200212211251.32091-2-mathieu.poirier@linaro.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG5NODE3.st.com (10.75.127.15) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-13_04:2020-02-12,2020-02-13 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathieu, Simple and elegant :) I tested it with my rpmsg_tty client which defines several IDs: work fine. Just a question regarding the comment else Acked-by: Arnaud Pouliquen On 2/12/20 10:12 PM, Mathieu Poirier wrote: > Adding the capability to supplement the base definition published > by an rpmsg_driver with a postfix description so that it is possible > for several entity to use the same service. > > Signed-off-by: Mathieu Poirier > --- > drivers/rpmsg/rpmsg_core.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c > index e330ec4dfc33..bfd25978fa35 100644 > --- a/drivers/rpmsg/rpmsg_core.c > +++ b/drivers/rpmsg/rpmsg_core.c > @@ -399,7 +399,25 @@ ATTRIBUTE_GROUPS(rpmsg_dev); > static inline int rpmsg_id_match(const struct rpmsg_device *rpdev, > const struct rpmsg_device_id *id) > { > - return strncmp(id->name, rpdev->id.name, RPMSG_NAME_SIZE) == 0; > + size_t len = min_t(size_t, strlen(id->name), RPMSG_NAME_SIZE); > + > + /* > + * Allow for wildcard matches. For example if rpmsg_driver::id_table > + * is: > + * > + * static struct rpmsg_device_id rpmsg_driver_sample_id_table[] = { > + * { .name = "rpmsg-client-sample" }, > + * { }, > + * } > + * > + * Then it is possible to support "rpmsg-client-sample*", i.e: > + * rpmsg-client-sample > + * rpmsg-client-sample_instance0 > + * rpmsg-client-sample_instance1 > + * ... > + * rpmsg-client-sample_instanceX > + */ What about adding this as function documentation? i don't know if it makes sense for a static volatile function... Regards Arnaud > + return strncmp(id->name, rpdev->id.name, len) == 0; > } > > /* match rpmsg channel and rpmsg driver */ >