Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp417091ima; Thu, 31 Jan 2019 19:39:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IaiADkEi15iyDbhwJPzPa1kv5Q0OqkjIwgtJ3sLZ0+iOjCSuYMqBe/R+NgtuSqxNdE+BW7v X-Received: by 2002:a65:64c8:: with SMTP id t8mr656168pgv.31.1548992396475; Thu, 31 Jan 2019 19:39:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548992396; cv=none; d=google.com; s=arc-20160816; b=x9P2tAZeUjzwU+jyYqyEy2sO6iy8QVowW8YAfWbrT3HhX4KcZd5U+nKssDWV6XI8T9 5VRJ71SM0PprTFkd+Hli6sVjbHivBdnmC8eEOuv7lrW2kTOcuQyaIZHx2OZF14JlTvAc 9LPRcVIP+2NZMqvcHRclKC3FpHXTm36rTvC3lnymFU2tNEfu5kAPAcKhuUutrqdxcRwm +RDRiVwhwgP+RSHynPOoWfj3ighqnM3T+sf0I9ltUDix1Dm0sNAv+V043r87gIJceWSn VFFQJ2vk8bqXpgFS7gTXG8NBLJJ/Z3X59t0k+m7W32DG8s1jDSlyUedB1oA1zBljuF7O lYZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=W/b0oc8GZVkD3025OaAQRjZVsMQYhNuuYRfn86IusNA=; b=WHzW2BCQN8HU4i6gvgujzUUU19KXER+P2o4PvClOEXwNdN8mBAuL1NayVfEuzWqF6j alGF9XO21L2eWSqDIGmJKCKqjuC9atS37CNPFt7MoDv8fqxvrwfn0wtvkUvc/UHXLBcn VNw5Darr+ur/eXd2Y8TuVDPPQUlZ0pNxx3aioTx4Ks3scv1EaPv+vVl/bCK5rn65Gz52 lYHDOCYkubp3996ARUhvKyt2P2niRZXl2qCiHq1X/EZG7Y963sK9i68JZECCTCIf03xH b6/X6YhNsp5Af3+5DC772EhjTv24DXcmgiWKfrjvQdvHGa54RT7ZS277cMRHsfurb142 /zAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KoMh8cXs; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 69si1468816pgc.164.2019.01.31.19.39.40; Thu, 31 Jan 2019 19:39:56 -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=@gmail.com header.s=20161025 header.b=KoMh8cXs; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728865AbfBADYp (ORCPT + 99 others); Thu, 31 Jan 2019 22:24:45 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:39500 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbfBADYo (ORCPT ); Thu, 31 Jan 2019 22:24:44 -0500 Received: by mail-pg1-f193.google.com with SMTP id r11so2277745pgp.6; Thu, 31 Jan 2019 19:24:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=W/b0oc8GZVkD3025OaAQRjZVsMQYhNuuYRfn86IusNA=; b=KoMh8cXslL+zoIZ2PgP3rPpQ970r1vRtTR2/nG+q/3maGl+DcfhEoQwKTjkne8E1gm sG+xPLAS5yWwM1wsQosltYuV8TlCSnUxh8fYAgNSepUMPWyHbCd8UnotmNykuP4DGJl1 NXe5YLrR//PWl0jiTcc3YhHp6gP+sqh/m6RZzrbMJICyWmgrVLKjhNMOakMJQRDKpDJv 0VW61UcjYDGFcPnhxu/d1MZbR83byo684zSOSPUU5x3DVo8NRTLq8Ne+xS/0qBOGU9el m6Te9bs63XtKKOoagFPqLrh3jz0Zx99WMRkqbUntvFfuRg/Th3I9oZ3p2+X8YlrVp7Ch cZmw== 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; bh=W/b0oc8GZVkD3025OaAQRjZVsMQYhNuuYRfn86IusNA=; b=mjkwZ4Lw+C24ZOcnEsl06dD8VV3RYQYcoJvkXI/81x0WGbpj3woz6n/9/FKYrGZSlX 3bmTkn+K9BB+OxLQ1waOu/TXsNuwV92riA6r5We9wSvMhk6oAP9CYePvtcPOOtw2/LfT 1UUAyMewF91TetMu6y2VEe5fyzEHSrR45xmJ1kmL3KIxg52Au1oAJVHe7pshsKv6XeRJ +/OKn7Wpct6f1MVKQ213p+F2YGGy8O2SuCQO6NdL2OT+onsIg7DSArcFNgaIkzr14kRt bpm6i49g8sUSOGES/cMB6A/DgWVnLDYHnTH+IBdNpahi2DyCa1wirXu+rn7+BxLREvv7 zklw== X-Gm-Message-State: AHQUAuZt09Sx3bLG7vJBPTTP5QCrMOVrd6hz8XyX9DJHUSH5KHqcc8w2 emonawTQEwLuNY8OOFbWLVA= X-Received: by 2002:a63:5621:: with SMTP id k33mr623633pgb.395.1548991483836; Thu, 31 Jan 2019 19:24:43 -0800 (PST) Received: from localhost.localdomain ([43.224.245.179]) by smtp.gmail.com with ESMTPSA id v191sm11620386pgb.77.2019.01.31.19.24.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 31 Jan 2019 19:24:43 -0800 (PST) From: Xiang Xiao X-Google-Original-From: Xiang Xiao To: ohad@wizery.com, bjorn.andersson@linaro.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Xiang Xiao Subject: [PATCH] rpmsg: add match optional callback to rpmsg_driver Date: Fri, 1 Feb 2019 11:24:19 +0800 Message-Id: <1548991459-12515-1-git-send-email-xiaoxiang@xiaomi.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org so the driver could decide whether support a particular device at runtime Signed-off-by: Xiang Xiao --- drivers/rpmsg/rpmsg_core.c | 3 +++ include/linux/rpmsg.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c index ea88fd4..afdd1c6 100644 --- a/drivers/rpmsg/rpmsg_core.c +++ b/drivers/rpmsg/rpmsg_core.c @@ -413,6 +413,9 @@ static int rpmsg_dev_match(struct device *dev, struct device_driver *drv) if (rpdev->driver_override) return !strcmp(rpdev->driver_override, drv->name); + if (rpdrv->match) + return rpdrv->match(rpdev, rpdrv); + if (ids) for (i = 0; ids[i].name[0]; i++) if (rpmsg_id_match(rpdev, &ids[i])) diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h index 9fe156d..7a5a342 100644 --- a/include/linux/rpmsg.h +++ b/include/linux/rpmsg.h @@ -109,6 +109,7 @@ struct rpmsg_driver { int (*probe)(struct rpmsg_device *dev); void (*remove)(struct rpmsg_device *dev); int (*callback)(struct rpmsg_device *, void *, int, void *, u32); + int (*match)(struct rpmsg_device *dev, struct rpmsg_driver *drv); }; #if IS_ENABLED(CONFIG_RPMSG) -- 2.7.4