From patchwork Wed Jun 28 21:53:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 106580 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp392749qge; Wed, 28 Jun 2017 14:53:45 -0700 (PDT) X-Received: by 10.98.14.79 with SMTP id w76mr12808683pfi.72.1498686825568; Wed, 28 Jun 2017 14:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498686825; cv=none; d=google.com; s=arc-20160816; b=MgWAuhcE91D6tXjz9nIJzDr8j/yOTi4GRce4jLrzVwUGN/tV7w2goqBFLkqH3X9N1o ATXC6EBo1VzA/+2Sz6mSKyYZPSRhQveQerMW9tUDWF6Sd8hvxmQXV3IMnlv0fnkaJzfq PD67bW8ZH2dqL53B/0SEiajwbnsX9XmF1agsgB75Xe0u1vr37uP8ob/sha/fM5iXz+pV m2vNTTpNpnGpF8YtOQ2UKmnTPniB1giOdvqD4eqdAk5thLUS83TR5Jwub8saXHQFfFUE tQjhCKrW25aXGPkOpiYlSaEzdjLgArmVWbT5Z0C5qdle40aBUhmXyc7KZJqiw8qoFjgv fL0w== 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:arc-authentication-results; bh=WnfXYCh1A2ZsfQelxaeQMVn7kocAvgMkLL6gJ5HXG40=; b=gOPzX4MwAOEDxkAIGoxBqNTsVUoZBbEblJMvRs0Yu+2KTLJnqMia25f7kHy4cABP41 0FlFzrRfuhEe2/VcPuJRn7UMSpXkZBVSFZrWXFvgAKIgnwm/so36bGcMkCzH4iWajOU3 rrCfccMh5+uVPB1sBzkfmvseghm/B4uyUoKfX67REo1nkRkJLny228JbbEdKsPnaD4IF WkPy1U4zluqtbMvgSyd0PkXvpt9BraOTRagZPUqldC41XaVaoLnQfmvWMjo9Jo+zu+am O87YmgmvNGpLlPA51p1m6UNBnSl6k9NIDjPSwcCya165FjtPho0dyfMyyN6CMIYPzYUz 714Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=ShWNQCWz; 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 133si2313093pfb.63.2017.06.28.14.53.45; Wed, 28 Jun 2017 14:53:45 -0700 (PDT) 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.b=ShWNQCWz; 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 S1751703AbdF1Vxd (ORCPT + 25 others); Wed, 28 Jun 2017 17:53:33 -0400 Received: from mail-pg0-f51.google.com ([74.125.83.51]:33512 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbdF1Vx2 (ORCPT ); Wed, 28 Jun 2017 17:53:28 -0400 Received: by mail-pg0-f51.google.com with SMTP id f127so37853966pgc.0 for ; Wed, 28 Jun 2017 14:53:27 -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; bh=WnfXYCh1A2ZsfQelxaeQMVn7kocAvgMkLL6gJ5HXG40=; b=ShWNQCWz1qj26OcyblejTZQnn3cZobWhkK1zcXrs3mCwGbBIBZqQOZwJxlhYCI4bqN ZQ6nbcASxt1fh0UBlp5kaUUtPAij3R+jKuNKEjJYy4WP5LB55sB0Vz4dYxF8J09WOyY+ VgD+ntvq2sgXY36+YYvPM15zUjOU6wh5zD0SY= 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=WnfXYCh1A2ZsfQelxaeQMVn7kocAvgMkLL6gJ5HXG40=; b=klW6m4DPz+UIHZYwP7mJZoVPJ258Nxa1j6mxCdGxYCdkU0A/3O4H+fmfwWXGJ42ANd X7xv/sZ2v56dDumQjxLQ+CsNE2A6r1aqMeQAUFgY0S0hjHweRgW87DOrMhgA90VNv1YO BEcC2Uf2mH+y5/GdbuNxpMs4PJDbd7zFNILfrqexbsvNKllfFduZcJo0bFwHCl68V6Xb rzOq0wWmRvSY9A5E92Oy7QjXwoN6mM7zAYkGc+T3kFN2UKWNDXUtf8Cyy+lvkRoi9D+M zj4L0H6kLjCjhyVwvhZeMk5kNwd2kbgQ6RkcjTyaNuHvlI0jAWdrNyZ4ykyYGdVP8vig Yq0A== X-Gm-Message-State: AKS2vOw1JRKGK4Z+LHJjHQDh8RwH+pF/+NMxaWBwp9WMlEF9fnbUpnfU fz4z1huCpihbV1Vj X-Received: by 10.99.107.66 with SMTP id g63mr12313979pgc.277.1498686807239; Wed, 28 Jun 2017 14:53:27 -0700 (PDT) Received: from localhost.localdomain (ip68-111-217-79.sd.sd.cox.net. [68.111.217.79]) by smtp.gmail.com with ESMTPSA id o6sm6060978pfb.110.2017.06.28.14.53.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jun 2017 14:53:26 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark Subject: [PATCH v2] rpmsg: Make modalias work for DeviceTree based devices Date: Wed, 28 Jun 2017 14:53:23 -0700 Message-Id: <20170628215323.5658-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When rpmsg devices are expected to be matched based on their compatible the modalias should reflect this, so that module autoloading has a chance to match and load the appropriate module. Tested-by: Rob Clark Reported-by: Rob Clark Signed-off-by: Bjorn Andersson --- Changes since v1: - Also update rpmsg_uevent() drivers/rpmsg/rpmsg_core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.12.0 diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c index ad3d2a9df287..067650c5bcb6 100644 --- a/drivers/rpmsg/rpmsg_core.c +++ b/drivers/rpmsg/rpmsg_core.c @@ -343,6 +343,11 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) { struct rpmsg_device *rpdev = to_rpmsg_device(dev); + ssize_t len; + + len = of_device_modalias(dev, buf, PAGE_SIZE); + if (len != -ENODEV) + return len; return sprintf(buf, RPMSG_DEVICE_MODALIAS_FMT "\n", rpdev->id.name); } @@ -387,6 +392,11 @@ static int rpmsg_dev_match(struct device *dev, struct device_driver *drv) static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env) { struct rpmsg_device *rpdev = to_rpmsg_device(dev); + int ret; + + ret = of_device_uevent_modalias(dev, env); + if (ret != -ENODEV) + return ret; return add_uevent_var(env, "MODALIAS=" RPMSG_DEVICE_MODALIAS_FMT, rpdev->id.name);