From patchwork Thu Sep 1 22:27:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9310041 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AE1BD60756 for ; Thu, 1 Sep 2016 22:36:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 679EE2955E for ; Thu, 1 Sep 2016 22:36:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C73629562; Thu, 1 Sep 2016 22:36:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 109D52955E for ; Thu, 1 Sep 2016 22:36:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754731AbcIAWfq (ORCPT ); Thu, 1 Sep 2016 18:35:46 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35893 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbcIAW2O (ORCPT ); Thu, 1 Sep 2016 18:28:14 -0400 Received: by mail-pa0-f53.google.com with SMTP id fu3so26010826pad.3 for ; Thu, 01 Sep 2016 15:28:14 -0700 (PDT) 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; bh=nWqTYDmdyGditq9gYTeGfugpiDjcJm/XsB777HRdB8c=; b=kYaeuaU1tvBADI7xqqhyOusk+4tsJc9Lg+eKfFcLQM90GtrqsCe67UN66NJPHdmRBo Lgfv9g16iRvYAuC3qShdBIWvY401Hnq6oIWHy4QX5CqJ+i/2oBuonb+ijs4g42gh+n70 z3bbBsJXzjv/s+gbMlOQDOS6gc3XPQPvdgl2c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nWqTYDmdyGditq9gYTeGfugpiDjcJm/XsB777HRdB8c=; b=XdSLb8JdSh+ChzrSPb+jZkxw3udakvnr34Z4talRCGxe0U9NQ02Z+oV205fGpuBO5K i/aEP0rJfYhE8TqiFns8oIcEvLNCOAtwBtWe8cH9O+0zs9mZxwODvhc1IEikKm6gUH8+ VqYo0fzpccXPjrtw9d00qmeOUHFkKUA/nm2smrkpH3rWIIhx+fnEBHYNdE6Suief3zZb sqk7N7si8Smmflw1r+R+6LKl8z80PhAZ+KSqYm0T/xKuzpyPgWJ4DiAhk/JwS9erYS9h MO80SPOdBTnLEa7Zk7XQhVKIviYS5uuWUvr9DU8jUTN//+ihDD2TIEH8jn9oo8ROdZuj UJrA== X-Gm-Message-State: AE9vXwPK76dW1+b1rdsKCZ1wb3L9piPxFJViOjTL0PBwzWLyIx1m7XNj966lZNHbl7DrZTe2 X-Received: by 10.66.253.7 with SMTP id zw7mr30561249pac.25.1472768893696; Thu, 01 Sep 2016 15:28:13 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id iw10sm8887131pac.14.2016.09.01.15.28.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Sep 2016 15:28:13 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 01/17] rpmsg: Enable matching devices with drivers based on DT Date: Thu, 1 Sep 2016 15:27:53 -0700 Message-Id: <1472768889-3906-2-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1472768889-3906-1-git-send-email-bjorn.andersson@linaro.org> References: <1472768889-3906-1-git-send-email-bjorn.andersson@linaro.org> Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make it possible to match rpmsg devices based on device tree node, in addition to the id table. In some of these cases the rpmsg driver would not have a id_table, so make this optional. Signed-off-by: Bjorn Andersson Reviewed-by: Sarangdhar Joshi --- Changes since v1: - None drivers/rpmsg/virtio_rpmsg_bus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index 4a4374cc6a59..495fa0a282d3 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c @@ -33,6 +33,7 @@ #include #include #include +#include /** * struct virtproc_info - virtual remote processor state @@ -175,11 +176,12 @@ static int rpmsg_dev_match(struct device *dev, struct device_driver *drv) const struct rpmsg_device_id *ids = rpdrv->id_table; unsigned int i; - for (i = 0; ids[i].name[0]; i++) - if (rpmsg_id_match(rpdev, &ids[i])) - return 1; + if (ids) + for (i = 0; ids[i].name[0]; i++) + if (rpmsg_id_match(rpdev, &ids[i])) + return 1; - return 0; + return of_driver_match_device(dev, drv); } static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env)