Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1988954ybv; Fri, 14 Feb 2020 09:22:38 -0800 (PST) X-Google-Smtp-Source: APXvYqzZ7goAvMAC551PFl0s3r9KDunjaSTg62FBWua1a5Ul9/wxq3VdfFRruX+VWtRU5/EsKJZa X-Received: by 2002:a54:4106:: with SMTP id l6mr2590499oic.76.1581700958679; Fri, 14 Feb 2020 09:22:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581700958; cv=none; d=google.com; s=arc-20160816; b=utHs5VSvguCdq6fsdpN6glXQm6afIgB9iGapEk5sr8GX9cZtwXL3toewOYPh5QKWk/ U4YrJfb8NQXw585klUqr1pJHVgqeN8Mm0DUNP5ULa/82CwdzwLgf2bJY6xBR+lasvfqE j/M2aQ72aKZlex3v4on/AbeEZjP2sxiQmGfBwCk3meFMFQrsOpndB1pwcyZDcJZv+UfL i5mt1Sxo3zebZaXJ/UEjB1iH3L52WIrWOkcklWvziT9OoVm+YrVvu2rTJUmoCk7zx7O8 kzE+m6Y+70pLRM3I4G8Icb7khW1ygwyY/eskE91eKUhNwfVW8JkTkEZA+QwWtgo72B0Z YuhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xv17a45pi5NucetgPC6cMwzW5Vj6j3Q1UdEccsF87iI=; b=KAFBJC9OTb+j3h0sqZKSbTDx6dml+Njyf93tbMrfnNk/dEbuZRosu/FK+mqPPmOjT3 dv17tr135gd679iztHUDTuMqGv/29xeumMpntcbAq9wleTO5wzaRxo9q3cuAUifAOY7r BvEM+Qa5i7XIssKU4hbrl/5FqooYDLXljGYkwB0KBbbQeIrkIOCZAKP8r+UfGORO7fi+ 7O7JfACAPmsBw6xlRPbWRo53UtK4UyPocwiHonPYemV9UzX2aDBXF+oa/Ono3WsLUS/c dehw6q5TqpxZF7RiNg5xTpBN3s5G4QlMww4NKxZ+G0p4Ro5tOQXnf9pS7rm8wPD3nnPo gV4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jdkH5PaG; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l65si2805642oih.23.2020.02.14.09.22.26; Fri, 14 Feb 2020 09:22:38 -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=@linaro.org header.s=google header.b=jdkH5PaG; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403769AbgBNRWT (ORCPT + 99 others); Fri, 14 Feb 2020 12:22:19 -0500 Received: from mail-io1-f66.google.com ([209.85.166.66]:42658 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390454AbgBNRWQ (ORCPT ); Fri, 14 Feb 2020 12:22:16 -0500 Received: by mail-io1-f66.google.com with SMTP id z1so10773508iom.9 for ; Fri, 14 Feb 2020 09:22:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xv17a45pi5NucetgPC6cMwzW5Vj6j3Q1UdEccsF87iI=; b=jdkH5PaG1H+2nkU3l9wXveH84Du4g4JPLe3p08esY/8YFJ54sSW20xmuXMNZuEdGXv oplq+b/lfm9egkj7LuYMxQ8bJ6oBD/rGnBL+Ep43i0dgfs34aOJeeo/BekoVdQGl1xyH 61cgMmjI5k08v96putoK2ty0W7x0iSRkgmVyGo+/IrOTRHF0v66Cy8vJbXt73GL4ijDn 6RAW+PifPqEORYEqm43APpyAPqzRvTEInCFBs8NCy3ErMv1DQT8qUSuRig62bqsUv7mN /aPMdW990kBDVRD9r1Mbe9LaF/zd4ojApPMkioKtmZdRLxYfFS0q/r5wKYnNY6vILx67 YfFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xv17a45pi5NucetgPC6cMwzW5Vj6j3Q1UdEccsF87iI=; b=iXgVZKvOSKQOFFLBHMloEVwE4AsBdf06A7r547/IjKYxkpVBIHkX7CPGFWkK2V5fnZ xoUEf/3Y44ZIAUuERQpPmCaVn3DtbruRCGgM2HpT7qK5U16fltD+jlyAq3eri+9y8a5u 0dG7wE6i9tZVIyKHhyDMirTCTyTqxsYF3xV6K16jL4K0SoBlxkhwd0JRMIHyAxC0fDJD hRFiAn85gztpw/nqq3SnjkW91jFnLCwMDYHo3wUDLYMOmfnJ2FtnfoWlwFFYnHyMTM24 Vjlz3g8Gl16dU/DaFdA+VsvaaLGDmgsnaNMZjSAcWRicBBtxab506/4qIjTiv5LlE8FT bTAg== X-Gm-Message-State: APjAAAXMD9nVz6BCPwlpBIVzhKmhsyhXHuQEq04MOLEKFFu7EtL/yOxw VGl9DiBIk8R62M8E1KCILGkTvalCq1nPGJJWcxT2ew== X-Received: by 2002:a05:6638:44a:: with SMTP id r10mr3354681jap.36.1581700935651; Fri, 14 Feb 2020 09:22:15 -0800 (PST) MIME-Version: 1.0 References: <20200212211251.32091-1-mathieu.poirier@linaro.org> <20200212211251.32091-2-mathieu.poirier@linaro.org> <034dcb0b-e305-aab9-f52b-5f725856480f@st.com> In-Reply-To: <034dcb0b-e305-aab9-f52b-5f725856480f@st.com> From: Mathieu Poirier Date: Fri, 14 Feb 2020 10:22:04 -0700 Message-ID: Subject: Re: [PATCH 1/1] rpmsg: core: Add wildcard match for name service To: Arnaud POULIQUEN Cc: Bjorn Andersson , Ohad Ben-Cohen , Suman Anna , Xiang Xiao , Tero Kristo , Loic PALLARDY , remoteproc@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 13 Feb 2020 at 06:56, Arnaud POULIQUEN wrote: > > Hi Mathieu, > > Simple and elegant :) > I tested it with my rpmsg_tty client which defines several IDs: work fine. Perfect - many thanks for giving this a spin. > > 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... It didn't cross my mind because (and as you pointed out) it is a static function. Let me know if you're keen on seeing this corrected and I'll go for a respin. Mathieu > > Regards > Arnaud > > > + return strncmp(id->name, rpdev->id.name, len) == 0; > > } > > > > /* match rpmsg channel and rpmsg driver */ > >