Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6485964ybv; Wed, 12 Feb 2020 13:13:41 -0800 (PST) X-Google-Smtp-Source: APXvYqxQD5vgJSeHr+y+dXf08Kc3oeVXe/TdzAJflPR8zaRPWKe78+wB/hHIb10wMYpA6J2ktG7s X-Received: by 2002:aca:5582:: with SMTP id j124mr735208oib.20.1581542021093; Wed, 12 Feb 2020 13:13:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581542021; cv=none; d=google.com; s=arc-20160816; b=Yw+IQ7GqFzfSHUc4d/2usISFASIwBLI2jK/TEkrWfiG81FIU8Z6LRdLt8wbJlwQawK v8CaQ5Dfose00s6ClvS9Wk88uzlED9u/XumVUGSsCBqQJRRraiINKJztgHwZ7I3zP6NX tU7NugbYnlAoWNBfcHr4mMmSg7raiuqGg+5xcCcPhSuvz73zD4AoEG4//9h3JB4ybrrg F+ICJlmCeDmrrPLOvoV5/m8MM6vaWPwiPDF7Jq+GvePdX2natWSRdOYS/fwJTe4RfnsZ Caso/NjGxs/4Qtqtj5gQaXkI2X+9jnQDu5znOdpd11/dX4RnyCsu1AhnNSNCLOwGmRvN /LbQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1IJZJYEelASi8ZQCkdIcLDnnIutfG7b5nGAbr7QUKNQ=; b=Fg+ePzvJGSaGBoY6P4QA5zbcod0VQDmxFFsjO4DIaRQ1LnsJ2IKlGSdN2c+fvVXZ01 jDj5NBriim9gmW5JmAEuVhLhA8mDd+P44lxDLrU9YkhMDPTNB5n5ZTQvZUfXLewHXP1Z WCUzDpfvRhk2b5BQwdtZ8ACRMFlvAPHmbrRFBicUrvluLFkUff+CqJZUcbb4U9v2VXDN Aj/SLb6m4A0Q5yncTitjCZYfFa9UGWmDOXEQYoeeON8e6nn4uW9CDawCnsgFnYanIYiS J+BAivfr6TAkCpOF91rdQX6khrZRX2ZMQC0AjR9+xS/GGumut1nBqw0mQooui+RLfS12 DEAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=azqcd8cX; 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 w4si125779oih.231.2020.02.12.13.13.28; Wed, 12 Feb 2020 13:13:41 -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=azqcd8cX; 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 S1729071AbgBLVM5 (ORCPT + 99 others); Wed, 12 Feb 2020 16:12:57 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:45367 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727420AbgBLVM4 (ORCPT ); Wed, 12 Feb 2020 16:12:56 -0500 Received: by mail-pl1-f194.google.com with SMTP id b22so1414525pls.12 for ; Wed, 12 Feb 2020 13:12:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1IJZJYEelASi8ZQCkdIcLDnnIutfG7b5nGAbr7QUKNQ=; b=azqcd8cXw/wi/gh9wa6Ax4h1CZTAj5vm4mi3yCaJwLM15gWZCni5qjGj8emJtZPhnu UgrVTQgxozVXwdWmAIegaw087OBM1ojSCoe02ehql+NPdzCGu573rs61OCyfN2/RJv4U EZpBdv+9iMFYaZCkI0z/f9HY+Igmf0Mx9KdLpYQNBZzoxmDUYjQkPtXPVfQ1rbQ6Pjh/ Zg+v7UUi93wOLeMoA84RfzaL8wu6e4mvfJq9FohqMN5pN83PiUwATRXX/mvvho0Q7Y3O YExVodLuAJrSEeo5y9KEa1H5Kp8d7fBV0lZu7k4Cjx9YccvvUadMm0TmMRwP1DGstWsQ tp+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1IJZJYEelASi8ZQCkdIcLDnnIutfG7b5nGAbr7QUKNQ=; b=SyYvzwh8K/QBR43O0lxy5tQi/KJ/Gb54AWqiSjV1CzC0+wY6MmO8xCMWcV3J+5WGTJ 7hV46cgMBZy4kMHuGDAFeCaWI6FzHqpiCYvLCxcKdqpJMwxCq259nqCokMP5ffIfY/5z vacCcTg7wMgJBKQDikd0t6vA+FXtP83OSH1gI24fr44eU93zWo3LHMxEyAEpaJYPcjUS zVfVEcx4lHS8bS4Xlj37O7+2HBb3MD+SHWAGL9nGZRYKOoTBI7VXMz/YaehA6qfqQM10 U8qguQiO1svXIFUh/gr+yumkaQ/oOJXimuMDrKShntNdoDYz0Fn4T3gh2J6bs6uAn22J b14w== X-Gm-Message-State: APjAAAWWs5dlZzSEv6r2lcvinFNsR5RaMABrtqYdzXnxfqU81vl35wOG 2Y3QSKGtBIrc/hRtGOt8W32UOQ== X-Received: by 2002:a17:90b:14e:: with SMTP id em14mr1061865pjb.112.1581541975312; Wed, 12 Feb 2020 13:12:55 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id h11sm48295pgk.48.2020.02.12.13.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 13:12:54 -0800 (PST) From: Mathieu Poirier To: bjorn.andersson@linaro.org, ohad@wizery.com Cc: arnaud.pouliquen@st.com, s-anna@ti.com, xiaoxiang@xiaomi.com, t-kristo@ti.com, loic.pallardy@st.com, remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/1] rpmsg: core: Add wildcard match for name service Date: Wed, 12 Feb 2020 14:12:51 -0700 Message-Id: <20200212211251.32091-2-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200212211251.32091-1-mathieu.poirier@linaro.org> References: <20200212211251.32091-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 + */ + return strncmp(id->name, rpdev->id.name, len) == 0; } /* match rpmsg channel and rpmsg driver */ -- 2.20.1